diff options
author | Nicolas Pitre <nico@cam.org> | 2009-05-31 22:25:40 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-06-08 07:26:59 -0400 |
commit | bfee1a4311702c9fdecd8264ffd1126fd0ce92fb (patch) | |
tree | 71cdaa7d43688b6ee2a14210f4ec2391a7b84c62 /drivers/mtd/nand | |
parent | 9dbc090274668abe3fc9f3a5de490d7d412cd74a (diff) |
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@marvell.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | 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 c2dfd3ea353d..7ad972229db4 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 | |||
47 | writeb(cmd, nc->IO_ADDR_W + offs); | 47 | writeb(cmd, nc->IO_ADDR_W + offs); |
48 | } | 48 | } |
49 | 49 | ||
50 | static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) | ||
51 | { | ||
52 | struct nand_chip *chip = mtd->priv; | ||
53 | void __iomem *io_base = chip->IO_ADDR_R; | ||
54 | uint64_t *buf64; | ||
55 | int i = 0; | ||
56 | |||
57 | while (len && (unsigned long)buf & 7) { | ||
58 | *buf++ = readb(io_base); | ||
59 | len--; | ||
60 | } | ||
61 | buf64 = (uint64_t *)buf; | ||
62 | while (i < len/8) { | ||
63 | uint64_t x; | ||
64 | asm ("ldrd\t%0, [%1]" : "=r" (x) : "r" (io_base)); | ||
65 | buf64[i++] = x; | ||
66 | } | ||
67 | i *= 8; | ||
68 | while (i < len) | ||
69 | buf[i++] = readb(io_base); | ||
70 | } | ||
71 | |||
50 | static int __init orion_nand_probe(struct platform_device *pdev) | 72 | static int __init orion_nand_probe(struct platform_device *pdev) |
51 | { | 73 | { |
52 | struct mtd_info *mtd; | 74 | struct mtd_info *mtd; |
@@ -83,6 +105,7 @@ static int __init orion_nand_probe(struct platform_device *pdev) | |||
83 | nc->priv = board; | 105 | nc->priv = board; |
84 | nc->IO_ADDR_R = nc->IO_ADDR_W = io_base; | 106 | nc->IO_ADDR_R = nc->IO_ADDR_W = io_base; |
85 | nc->cmd_ctrl = orion_nand_cmd_ctrl; | 107 | nc->cmd_ctrl = orion_nand_cmd_ctrl; |
108 | nc->read_buf = orion_nand_read_buf; | ||
86 | nc->ecc.mode = NAND_ECC_SOFT; | 109 | nc->ecc.mode = NAND_ECC_SOFT; |
87 | 110 | ||
88 | if (board->chip_delay) | 111 | if (board->chip_delay) |