mtd: orion_nand: use burst reads with double word accesses
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Mon Jun 8 07:59:03 EDT 2009
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=bfee1a4311702c9fdecd8264ffd1126fd0ce92fb
Commit: bfee1a4311702c9fdecd8264ffd1126fd0ce92fb
Parent: 9dbc090274668abe3fc9f3a5de490d7d412cd74a
Author: Nicolas Pitre <nico at cam.org>
AuthorDate: Sun May 31 22:25:40 2009 -0400
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Jun 8 12:26:59 2009 +0100
mtd: orion_nand: use burst reads with double word accesses
This is not 8 times faster than byte access, but still around 60% faster.
Signed-off-by: Nicolas Pitre <nico at marvell.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
drivers/mtd/nand/orion_nand.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index c2dfd3e..7ad9722 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -47,6 +47,28 @@ static void orion_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl
writeb(cmd, nc->IO_ADDR_W + offs);
}
+static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
+{
+ struct nand_chip *chip = mtd->priv;
+ void __iomem *io_base = chip->IO_ADDR_R;
+ uint64_t *buf64;
+ int i = 0;
+
+ while (len && (unsigned long)buf & 7) {
+ *buf++ = readb(io_base);
+ len--;
+ }
+ buf64 = (uint64_t *)buf;
+ while (i < len/8) {
+ uint64_t x;
+ asm ("ldrd\t%0, [%1]" : "=r" (x) : "r" (io_base));
+ buf64[i++] = x;
+ }
+ i *= 8;
+ while (i < len)
+ buf[i++] = readb(io_base);
+}
+
static int __init orion_nand_probe(struct platform_device *pdev)
{
struct mtd_info *mtd;
@@ -83,6 +105,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
nc->priv = board;
nc->IO_ADDR_R = nc->IO_ADDR_W = io_base;
nc->cmd_ctrl = orion_nand_cmd_ctrl;
+ nc->read_buf = orion_nand_read_buf;
nc->ecc.mode = NAND_ECC_SOFT;
if (board->chip_delay)
More information about the linux-mtd-cvs
mailing list