aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2016-06-20 17:32:13 -0400
committerBoris Brezillon <boris.brezillon@free-electrons.com>2016-07-11 02:40:16 -0400
commit250d45eb828a48bcfe0ef32ef861ea950e3483fc (patch)
tree9931f780b5820dd71048b10c5aada8706070e276
parentddbed9c211ebddd1ad14903f276a51321d7b8fcd (diff)
mtd: nand: xway: add missing write_buf and read_buf to nand driver
This driver needs a special write_buf and read_buf function, because we have to read from a specific address to tell the controller this is a read from the nand controller. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
-rw-r--r--drivers/mtd/nand/xway_nand.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mtd/nand/xway_nand.c b/drivers/mtd/nand/xway_nand.c
index 4cdef245f52d..429ba02fc0f5 100644
--- a/drivers/mtd/nand/xway_nand.c
+++ b/drivers/mtd/nand/xway_nand.c
@@ -129,6 +129,22 @@ static unsigned char xway_read_byte(struct mtd_info *mtd)
129 return xway_readb(mtd, NAND_READ_DATA); 129 return xway_readb(mtd, NAND_READ_DATA);
130} 130}
131 131
132static void xway_read_buf(struct mtd_info *mtd, u_char *buf, int len)
133{
134 int i;
135
136 for (i = 0; i < len; i++)
137 buf[i] = xway_readb(mtd, NAND_WRITE_DATA);
138}
139
140static void xway_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
141{
142 int i;
143
144 for (i = 0; i < len; i++)
145 xway_writeb(mtd, NAND_WRITE_DATA, buf[i]);
146}
147
132/* 148/*
133 * Probe for the NAND device. 149 * Probe for the NAND device.
134 */ 150 */
@@ -162,6 +178,8 @@ static int xway_nand_probe(struct platform_device *pdev)
162 data->chip.cmd_ctrl = xway_cmd_ctrl; 178 data->chip.cmd_ctrl = xway_cmd_ctrl;
163 data->chip.dev_ready = xway_dev_ready; 179 data->chip.dev_ready = xway_dev_ready;
164 data->chip.select_chip = xway_select_chip; 180 data->chip.select_chip = xway_select_chip;
181 data->chip.write_buf = xway_write_buf;
182 data->chip.read_buf = xway_read_buf;
165 data->chip.read_byte = xway_read_byte; 183 data->chip.read_byte = xway_read_byte;
166 data->chip.chip_delay = 30; 184 data->chip.chip_delay = 30;
167 185