mtd: nand: tango: Enable custom page accessors

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Dec 16 11:59:11 PST 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=ff9e9eae0f50ab3f7d1763677b62db4a2ed24a88
Commit:     ff9e9eae0f50ab3f7d1763677b62db4a2ed24a88
Parent:     3371d663bb4579f1b2003a92162edd6d90edd089
Author:     Marc Gonzalez <marc_gonzalez at sigmadesigns.com>
AuthorDate: Tue Nov 15 11:05:39 2016 +0100
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Sat Nov 19 09:43:10 2016 +0100

    mtd: nand: tango: Enable custom page accessors
    
    Enable NAND_ECC_CUSTOM_PAGE_ACCESS in the tango NFC driver.
    Fixup the "raw" page accessors to send the proper NAND commands.
    
    Signed-off-by: Marc Gonzalez <marc_gonzalez at sigmadesigns.com>
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
 drivers/mtd/nand/tango_nand.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/tango_nand.c b/drivers/mtd/nand/tango_nand.c
index fd8cf41..bacc2a0 100644
--- a/drivers/mtd/nand/tango_nand.c
+++ b/drivers/mtd/nand/tango_nand.c
@@ -402,13 +402,17 @@ static int raw_write(struct nand_chip *chip, const u8 *buf, const u8 *oob)
 static int tango_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
 			       u8 *buf, int oob_required, int page)
 {
+	chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
 	return raw_read(chip, buf, chip->oob_poi);
 }
 
 static int tango_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
 				const u8 *buf, int oob_required, int page)
 {
-	return raw_write(chip, buf, chip->oob_poi);
+	chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0, page);
+	raw_write(chip, buf, chip->oob_poi);
+	chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
+	return 0;
 }
 
 static int tango_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
@@ -553,6 +557,7 @@ static int chip_init(struct device *dev, struct device_node *np)
 	ecc->write_page = tango_write_page;
 	ecc->read_oob = tango_read_oob;
 	ecc->write_oob = tango_write_oob;
+	ecc->options = NAND_ECC_CUSTOM_PAGE_ACCESS;
 
 	err = nand_scan_tail(mtd);
 	if (err)



More information about the linux-mtd-cvs mailing list