]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00175572 add NAND write verify support
authorAllen Xu <allen.xu@freescale.com>
Tue, 28 Feb 2012 10:01:30 +0000 (18:01 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:34:23 +0000 (08:34 +0200)
Add NAND write verify support in NAND code

Signed-off-by: Allen Xu <allen.xu@freescale.com>
drivers/mtd/nand/gpmi-nand/gpmi-nand.c

index ea3ce22ff9d56b761465535c6667032cb5c8eefa..40470f231d366ca90c72c44f47c87e51255e0069 100644 (file)
@@ -1001,6 +1001,19 @@ exit_auxiliary:
        }
 }
 
+#define MAX_PAGESIZE 8192
+static uint8_t verify_buf[MAX_PAGESIZE];
+
+static int gpmi_verify_buf(struct mtd_info *mtd, const uint8_t * buf, int len)
+{
+       struct nand_chip *nand = mtd->priv;
+
+       gpmi_ecc_read_page(mtd, nand, verify_buf, len);
+       if (memcmp(buf, verify_buf, len))
+               return -EFAULT;
+       return 0;
+}
+
 /*
  * There are several places in this driver where we have to handle the OOB and
  * block marks. This is the function where things are the most complicated, so
@@ -1482,6 +1495,7 @@ static int __devinit gpmi_nfc_init(struct gpmi_nand_data *this)
        chip->read_byte         = gpmi_read_byte;
        chip->read_buf          = gpmi_read_buf;
        chip->write_buf         = gpmi_write_buf;
+       chip->verify_buf        = gpmi_verify_buf;
        chip->ecc.read_page     = gpmi_ecc_read_page;
        chip->ecc.write_page    = gpmi_ecc_write_page;
        chip->ecc.read_oob      = gpmi_ecc_read_oob;