mtd: nand: xway: add missing write_buf and read_buf to nand driver

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Aug 1 18:59:07 PDT 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=250d45eb828a48bcfe0ef32ef861ea950e3483fc
Commit:     250d45eb828a48bcfe0ef32ef861ea950e3483fc
Parent:     ddbed9c211ebddd1ad14903f276a51321d7b8fcd
Author:     Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Mon Jun 20 23:32:13 2016 +0200
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Mon Jul 11 08:40:16 2016 +0200

    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 at hauke-m.de>
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
 drivers/mtd/nand/xway_nand.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mtd/nand/xway_nand.c b/drivers/mtd/nand/xway_nand.c
index 4cdef24..429ba02 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)
 	return xway_readb(mtd, NAND_READ_DATA);
 }
 
+static void xway_read_buf(struct mtd_info *mtd, u_char *buf, int len)
+{
+	int i;
+
+	for (i = 0; i < len; i++)
+		buf[i] = xway_readb(mtd, NAND_WRITE_DATA);
+}
+
+static void xway_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
+{
+	int i;
+
+	for (i = 0; i < len; i++)
+		xway_writeb(mtd, NAND_WRITE_DATA, buf[i]);
+}
+
 /*
  * Probe for the NAND device.
  */
@@ -162,6 +178,8 @@ static int xway_nand_probe(struct platform_device *pdev)
 	data->chip.cmd_ctrl = xway_cmd_ctrl;
 	data->chip.dev_ready = xway_dev_ready;
 	data->chip.select_chip = xway_select_chip;
+	data->chip.write_buf = xway_write_buf;
+	data->chip.read_buf = xway_read_buf;
 	data->chip.read_byte = xway_read_byte;
 	data->chip.chip_delay = 30;
 



More information about the linux-mtd-cvs mailing list