diff options
-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) |