mtd: kill MTD_NAND_VERIFY_WRITE
authorHuang Shijie <shijie8@gmail.com>
Wed, 15 Aug 2012 02:38:45 +0000 (22:38 -0400)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 29 Sep 2012 14:00:46 +0000 (15:00 +0100)
Just as Artem suggested:

"Both UBI and JFFS2 are able to read verify what they wrote already.
There are also MTD tests which do this verification. So I think there
is no reason to keep this in the NAND layer, let alone wasting RAM in
the driver to support this feature. Besides, it does not work for sub-pages
and many drivers have it broken. It hurts more than it provides benefits."

So kill MTD_NAND_VERIFY_WRITE entirely.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
26 files changed:
drivers/mtd/nand/Kconfig
drivers/mtd/nand/ams-delta.c
drivers/mtd/nand/au1550nd.c
drivers/mtd/nand/bcm_umi_nand.c
drivers/mtd/nand/cafe_nand.c
drivers/mtd/nand/cmx270_nand.c
drivers/mtd/nand/diskonchip.c
drivers/mtd/nand/fsl_elbc_nand.c
drivers/mtd/nand/fsl_ifc_nand.c
drivers/mtd/nand/gpio.c
drivers/mtd/nand/lpc32xx_slc.c
drivers/mtd/nand/mpc5121_nfc.c
drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nandsim.c
drivers/mtd/nand/ndfc.c
drivers/mtd/nand/nuc900_nand.c
drivers/mtd/nand/omap2.c
drivers/mtd/nand/pxa3xx_nand.c
drivers/mtd/nand/r852.c
drivers/mtd/nand/sh_flctl.c
drivers/mtd/nand/socrates_nand.c
drivers/mtd/nand/tmio_nand.c
drivers/mtd/nand/txx9ndfmc.c
drivers/mtd/sm_ftl.c
include/linux/mtd/nand.h

index 5708d3b28a9817a64dc4463eb05c0796faa675ee..7101e8a03259d3be9cccea13dfcbae8a54c48cc6 100644 (file)
@@ -22,15 +22,6 @@ menuconfig MTD_NAND
 
 if MTD_NAND
 
-config MTD_NAND_VERIFY_WRITE
-       bool "Verify NAND page writes"
-       help
-         This adds an extra check when data is written to the flash. The
-         NAND flash device internally checks only bits transitioning
-         from 1 to 0. There is a rare possibility that even though the
-         device thinks the write was successful, a bit could have been
-         flipped accidentally due to device wear or something else.
-
 config MTD_NAND_BCH
        tristate
        select BCH
index 861ca8f7e47d2d62ff0b3929100117f0f7036543..2d73f2393586ce218a93e6d0a4fa01d9c1426e9b 100644 (file)
@@ -103,18 +103,6 @@ static void ams_delta_read_buf(struct mtd_info *mtd, u_char *buf, int len)
                buf[i] = ams_delta_read_byte(mtd);
 }
 
-static int ams_delta_verify_buf(struct mtd_info *mtd, const u_char *buf,
-                               int len)
-{
-       int i;
-
-       for (i=0; i<len; i++)
-               if (buf[i] != ams_delta_read_byte(mtd))
-                       return -EFAULT;
-
-       return 0;
-}
-
 /*
  * Command control function
  *
@@ -233,7 +221,6 @@ static int __devinit ams_delta_init(struct platform_device *pdev)
        this->read_byte = ams_delta_read_byte;
        this->write_buf = ams_delta_write_buf;
        this->read_buf = ams_delta_read_buf;
-       this->verify_buf = ams_delta_verify_buf;
        this->cmd_ctrl = ams_delta_hwcontrol;
        if (gpio_request(AMS_DELTA_GPIO_PIN_NAND_RB, "nand_rdy") == 0) {
                this->dev_ready = ams_delta_nand_ready;
index 9f609d2dcf62d3dc993358e4de817de00d154267..5c47b200045a3cbc22571b0eb76db23c8a627890 100644 (file)
@@ -140,28 +140,6 @@ static void au_read_buf(struct mtd_info *mtd, u_char *buf, int len)
        }
 }
 
-/**
- * au_verify_buf -  Verify chip data against buffer
- * @mtd:       MTD device structure
- * @buf:       buffer containing the data to compare
- * @len:       number of bytes to compare
- *
- * verify function for 8bit buswidth
- */
-static int au_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       int i;
-       struct nand_chip *this = mtd->priv;
-
-       for (i = 0; i < len; i++) {
-               if (buf[i] != readb(this->IO_ADDR_R))
-                       return -EFAULT;
-               au_sync();
-       }
-
-       return 0;
-}
-
 /**
  * au_write_buf16 -  write buffer to chip
  * @mtd:       MTD device structure
@@ -205,29 +183,6 @@ static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
        }
 }
 
-/**
- * au_verify_buf16 -  Verify chip data against buffer
- * @mtd:       MTD device structure
- * @buf:       buffer containing the data to compare
- * @len:       number of bytes to compare
- *
- * verify function for 16bit buswidth
- */
-static int au_verify_buf16(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       int i;
-       struct nand_chip *this = mtd->priv;
-       u16 *p = (u16 *) buf;
-       len >>= 1;
-
-       for (i = 0; i < len; i++) {
-               if (p[i] != readw(this->IO_ADDR_R))
-                       return -EFAULT;
-               au_sync();
-       }
-       return 0;
-}
-
 /* Select the chip by setting nCE to low */
 #define NAND_CTL_SETNCE                1
 /* Deselect the chip by setting nCE to high */
@@ -516,7 +471,6 @@ static int __devinit au1550nd_probe(struct platform_device *pdev)
        this->read_word = au_read_word;
        this->write_buf = (pd->devwidth) ? au_write_buf16 : au_write_buf;
        this->read_buf = (pd->devwidth) ? au_read_buf16 : au_read_buf;
-       this->verify_buf = (pd->devwidth) ? au_verify_buf16 : au_verify_buf;
 
        ret = nand_scan(&ctx->info, 1);
        if (ret) {
index c855e7cd337b2f7a278a164c2e7a7b7f17a723f8..3fcbcbc7b082440d4abdfedae7c1eb3f6ebffb5e 100644 (file)
@@ -332,27 +332,6 @@ static void bcm_umi_nand_read_buf(struct mtd_info *mtd, u_char * buf, int len)
 #endif
 }
 
-static uint8_t readbackbuf[NAND_MAX_PAGESIZE];
-static int bcm_umi_nand_verify_buf(struct mtd_info *mtd, const u_char * buf,
-                                  int len)
-{
-       /*
-        * Try to readback page with ECC correction. This is necessary
-        * for MLC parts which may have permanently stuck bits.
-        */
-       struct nand_chip *chip = mtd->priv;
-       int ret = chip->ecc.read_page(mtd, chip, readbackbuf, 0, 0);
-       if (ret < 0)
-               return -EFAULT;
-       else {
-               if (memcmp(readbackbuf, buf, len) == 0)
-                       return 0;
-
-               return -EFAULT;
-       }
-       return 0;
-}
-
 static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
 {
        struct nand_chip *this;
@@ -416,7 +395,6 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
 
        this->write_buf = bcm_umi_nand_write_buf;
        this->read_buf = bcm_umi_nand_read_buf;
-       this->verify_buf = bcm_umi_nand_verify_buf;
 
        this->cmd_ctrl = bcm_umi_nand_hwcontrol;
        this->ecc.mode = NAND_ECC_HW;
index 08248a0a167e00e68cde8e7c767cabd0dab8cb12..2bb7170502c2dde3966b931eb9d1a270e5953feb 100644 (file)
@@ -576,13 +576,6 @@ static int cafe_nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
                status = chip->waitfunc(mtd, chip);
        }
 
-#ifdef CONFIG_MTD_NAND_VERIFY_WRITE
-       /* Send command to read back the data */
-       chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
-
-       if (chip->verify_buf(mtd, buf, mtd->writesize))
-               return -EIO;
-#endif
        return 0;
 }
 
index 1024bfc05c8696485861e35b630522c44810d674..39b2ef848811a5d1cf1c7fea98ef8f6168e98c5f 100644 (file)
@@ -76,18 +76,6 @@ static void cmx270_read_buf(struct mtd_info *mtd, u_char *buf, int len)
                *buf++ = readl(this->IO_ADDR_R) >> 16;
 }
 
-static int cmx270_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       int i;
-       struct nand_chip *this = mtd->priv;
-
-       for (i=0; i<len; i++)
-               if (buf[i] != (u_char)(readl(this->IO_ADDR_R) >> 16))
-                       return -EFAULT;
-
-       return 0;
-}
-
 static inline void nand_cs_on(void)
 {
        gpio_set_value(GPIO_NAND_CS, 0);
@@ -209,7 +197,6 @@ static int __init cmx270_init(void)
        this->read_byte = cmx270_read_byte;
        this->read_buf = cmx270_read_buf;
        this->write_buf = cmx270_write_buf;
-       this->verify_buf = cmx270_verify_buf;
 
        /* Scan to find existence of the device */
        if (nand_scan (cmx270_nand_mtd, 1)) {
index e2ca067631cf118704c107e2bffbe4ab515abda8..256eb30f6180f655e120e2ad90b988a1b7754e0b 100644 (file)
@@ -376,19 +376,6 @@ static void doc2000_readbuf_dword(struct mtd_info *mtd, u_char *buf, int len)
        }
 }
 
-static int doc2000_verifybuf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       struct nand_chip *this = mtd->priv;
-       struct doc_priv *doc = this->priv;
-       void __iomem *docptr = doc->virtadr;
-       int i;
-
-       for (i = 0; i < len; i++)
-               if (buf[i] != ReadDOC(docptr, 2k_CDSN_IO))
-                       return -EFAULT;
-       return 0;
-}
-
 static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr)
 {
        struct nand_chip *this = mtd->priv;
@@ -526,26 +513,6 @@ static void doc2001_readbuf(struct mtd_info *mtd, u_char *buf, int len)
        buf[i] = ReadDOC(docptr, LastDataRead);
 }
 
-static int doc2001_verifybuf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       struct nand_chip *this = mtd->priv;
-       struct doc_priv *doc = this->priv;
-       void __iomem *docptr = doc->virtadr;
-       int i;
-
-       /* Start read pipeline */
-       ReadDOC(docptr, ReadPipeInit);
-
-       for (i = 0; i < len - 1; i++)
-               if (buf[i] != ReadDOC(docptr, Mil_CDSN_IO)) {
-                       ReadDOC(docptr, LastDataRead);
-                       return i;
-               }
-       if (buf[i] != ReadDOC(docptr, LastDataRead))
-               return i;
-       return 0;
-}
-
 static u_char doc2001plus_read_byte(struct mtd_info *mtd)
 {
        struct nand_chip *this = mtd->priv;
@@ -610,33 +577,6 @@ static void doc2001plus_readbuf(struct mtd_info *mtd, u_char *buf, int len)
                printk("\n");
 }
 
-static int doc2001plus_verifybuf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       struct nand_chip *this = mtd->priv;
-       struct doc_priv *doc = this->priv;
-       void __iomem *docptr = doc->virtadr;
-       int i;
-
-       if (debug)
-               printk("verifybuf of %d bytes: ", len);
-
-       /* Start read pipeline */
-       ReadDOC(docptr, Mplus_ReadPipeInit);
-       ReadDOC(docptr, Mplus_ReadPipeInit);
-
-       for (i = 0; i < len - 2; i++)
-               if (buf[i] != ReadDOC(docptr, Mil_CDSN_IO)) {
-                       ReadDOC(docptr, Mplus_LastDataRead);
-                       ReadDOC(docptr, Mplus_LastDataRead);
-                       return i;
-               }
-       if (buf[len - 2] != ReadDOC(docptr, Mplus_LastDataRead))
-               return len - 2;
-       if (buf[len - 1] != ReadDOC(docptr, Mplus_LastDataRead))
-               return len - 1;
-       return 0;
-}
-
 static void doc2001plus_select_chip(struct mtd_info *mtd, int chip)
 {
        struct nand_chip *this = mtd->priv;
@@ -1432,7 +1372,6 @@ static inline int __init doc2000_init(struct mtd_info *mtd)
        this->read_byte = doc2000_read_byte;
        this->write_buf = doc2000_writebuf;
        this->read_buf = doc2000_readbuf;
-       this->verify_buf = doc2000_verifybuf;
        this->scan_bbt = nftl_scan_bbt;
 
        doc->CDSNControl = CDSN_CTRL_FLASH_IO | CDSN_CTRL_ECC_IO;
@@ -1449,7 +1388,6 @@ static inline int __init doc2001_init(struct mtd_info *mtd)
        this->read_byte = doc2001_read_byte;
        this->write_buf = doc2001_writebuf;
        this->read_buf = doc2001_readbuf;
-       this->verify_buf = doc2001_verifybuf;
 
        ReadDOC(doc->virtadr, ChipID);
        ReadDOC(doc->virtadr, ChipID);
@@ -1480,7 +1418,6 @@ static inline int __init doc2001plus_init(struct mtd_info *mtd)
        this->read_byte = doc2001plus_read_byte;
        this->write_buf = doc2001plus_writebuf;
        this->read_buf = doc2001plus_readbuf;
-       this->verify_buf = doc2001plus_verifybuf;
        this->scan_bbt = inftl_scan_bbt;
        this->cmd_ctrl = NULL;
        this->select_chip = doc2001plus_select_chip;
index 8143873d17a5c2bebc19c140445a5ad30fac8dee..cc1480a5e4c1e0a23f262a4c880890217fa4ca6c 100644 (file)
@@ -614,41 +614,6 @@ static void fsl_elbc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
                        len, avail);
 }
 
-/*
- * Verify buffer against the FCM Controller Data Buffer
- */
-static int fsl_elbc_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       struct nand_chip *chip = mtd->priv;
-       struct fsl_elbc_mtd *priv = chip->priv;
-       struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
-       int i;
-
-       if (len < 0) {
-               dev_err(priv->dev, "write_buf of %d bytes", len);
-               return -EINVAL;
-       }
-
-       if ((unsigned int)len >
-                       elbc_fcm_ctrl->read_bytes - elbc_fcm_ctrl->index) {
-               dev_err(priv->dev,
-                       "verify_buf beyond end of buffer "
-                       "(%d requested, %u available)\n",
-                       len, elbc_fcm_ctrl->read_bytes - elbc_fcm_ctrl->index);
-
-               elbc_fcm_ctrl->index = elbc_fcm_ctrl->read_bytes;
-               return -EINVAL;
-       }
-
-       for (i = 0; i < len; i++)
-               if (in_8(&elbc_fcm_ctrl->addr[elbc_fcm_ctrl->index + i])
-                               != buf[i])
-                       break;
-
-       elbc_fcm_ctrl->index += len;
-       return i == len && elbc_fcm_ctrl->status == LTESR_CC ? 0 : -EIO;
-}
-
 /* This function is called after Program and Erase Operations to
  * check for success or failure.
  */
@@ -798,7 +763,6 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
        chip->read_byte = fsl_elbc_read_byte;
        chip->write_buf = fsl_elbc_write_buf;
        chip->read_buf = fsl_elbc_read_buf;
-       chip->verify_buf = fsl_elbc_verify_buf;
        chip->select_chip = fsl_elbc_select_chip;
        chip->cmdfunc = fsl_elbc_cmdfunc;
        chip->waitfunc = fsl_elbc_wait;
index 1f71b545062aa0e548b7cca6de6a0d763a357826..e92d223e5e1a89c40c57c6ccd3fd38fa9f6af7c9 100644 (file)
@@ -626,46 +626,6 @@ static void fsl_ifc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
                        __func__, len, avail);
 }
 
-/*
- * Verify buffer against the IFC Controller Data Buffer
- */
-static int fsl_ifc_verify_buf(struct mtd_info *mtd,
-                              const u_char *buf, int len)
-{
-       struct nand_chip *chip = mtd->priv;
-       struct fsl_ifc_mtd *priv = chip->priv;
-       struct fsl_ifc_ctrl *ctrl = priv->ctrl;
-       struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl;
-       int i;
-
-       if (len < 0) {
-               dev_err(priv->dev, "%s: write_buf of %d bytes", __func__, len);
-               return -EINVAL;
-       }
-
-       if ((unsigned int)len > nctrl->read_bytes - nctrl->index) {
-               dev_err(priv->dev,
-                       "%s: beyond end of buffer (%d requested, %u available)\n",
-                       __func__, len, nctrl->read_bytes - nctrl->index);
-
-               nctrl->index = nctrl->read_bytes;
-               return -EINVAL;
-       }
-
-       for (i = 0; i < len; i++)
-               if (in_8(&nctrl->addr[nctrl->index + i]) != buf[i])
-                       break;
-
-       nctrl->index += len;
-
-       if (i != len)
-               return -EIO;
-       if (ctrl->nand_stat != IFC_NAND_EVTER_STAT_OPC)
-               return -EIO;
-
-       return 0;
-}
-
 /*
  * This function is called after Program and Erase Operations to
  * check for success or failure.
@@ -796,7 +756,6 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
 
        chip->write_buf = fsl_ifc_write_buf;
        chip->read_buf = fsl_ifc_read_buf;
-       chip->verify_buf = fsl_ifc_verify_buf;
        chip->select_chip = fsl_ifc_select_chip;
        chip->cmdfunc = fsl_ifc_cmdfunc;
        chip->waitfunc = fsl_ifc_wait;
index 27000a5f5f47722a1b30707a7b7d56f83b0e0559..ce6a284c827741bc0928108ae84e4f92a5eab213 100644 (file)
@@ -100,23 +100,6 @@ static void gpio_nand_readbuf(struct mtd_info *mtd, u_char *buf, int len)
        readsb(this->IO_ADDR_R, buf, len);
 }
 
-static int gpio_nand_verifybuf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       struct nand_chip *this = mtd->priv;
-       unsigned char read, *p = (unsigned char *) buf;
-       int i, err = 0;
-
-       for (i = 0; i < len; i++) {
-               read = readb(this->IO_ADDR_R);
-               if (read != p[i]) {
-                       pr_debug("%s: err at %d (read %04x vs %04x)\n",
-                              __func__, i, read, p[i]);
-                       err = -EFAULT;
-               }
-       }
-       return err;
-}
-
 static void gpio_nand_writebuf16(struct mtd_info *mtd, const u_char *buf,
                                 int len)
 {
@@ -148,26 +131,6 @@ static void gpio_nand_readbuf16(struct mtd_info *mtd, u_char *buf, int len)
        }
 }
 
-static int gpio_nand_verifybuf16(struct mtd_info *mtd, const u_char *buf,
-                                int len)
-{
-       struct nand_chip *this = mtd->priv;
-       unsigned short read, *p = (unsigned short *) buf;
-       int i, err = 0;
-       len >>= 1;
-
-       for (i = 0; i < len; i++) {
-               read = readw(this->IO_ADDR_R);
-               if (read != p[i]) {
-                       pr_debug("%s: err at %d (read %04x vs %04x)\n",
-                              __func__, i, read, p[i]);
-                       err = -EFAULT;
-               }
-       }
-       return err;
-}
-
-
 static int gpio_nand_devready(struct mtd_info *mtd)
 {
        struct gpiomtd *gpiomtd = gpio_nand_getpriv(mtd);
@@ -391,11 +354,9 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
        if (this->options & NAND_BUSWIDTH_16) {
                this->read_buf   = gpio_nand_readbuf16;
                this->write_buf  = gpio_nand_writebuf16;
-               this->verify_buf = gpio_nand_verifybuf16;
        } else {
                this->read_buf   = gpio_nand_readbuf;
                this->write_buf  = gpio_nand_writebuf;
-               this->verify_buf = gpio_nand_verifybuf;
        }
 
        /* set the mtd private data for the nand driver */
index 1840350452084d64601a2dff44c63af8376565c0..9326e5994b263e5efae0aabee1f84da07a8421a8 100644 (file)
@@ -368,24 +368,6 @@ static void lpc32xx_nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int
                writel((uint32_t)*buf++, SLC_DATA(host->io_base));
 }
 
-/*
- * Verify data in buffer to data on device
- */
-static int lpc32xx_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
-{
-       struct nand_chip *chip = mtd->priv;
-       struct lpc32xx_nand_host *host = chip->priv;
-       int i;
-
-       /* DATA register must be read as 32 bits or it will fail */
-       for (i = 0; i < len; i++) {
-               if (buf[i] != (uint8_t)readl(SLC_DATA(host->io_base)))
-                       return -EFAULT;
-       }
-
-       return 0;
-}
-
 /*
  * Read the OOB data from the device without ECC using FIFO method
  */
@@ -871,7 +853,6 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
        chip->ecc.correct = nand_correct_data;
        chip->ecc.strength = 1;
        chip->ecc.hwctl = lpc32xx_nand_ecc_enable;
-       chip->verify_buf = lpc32xx_verify_buf;
 
        /* bitflip_threshold's default is defined as ecc_strength anyway.
         * Unfortunately, it is set only later at add_mtd_device(). Meanwhile
index c259c24d7986034f3a2d14e02d5c06fb9a19a323..f776c8577b8cc4b36b5a7397084f88b457715898 100644 (file)
@@ -506,27 +506,6 @@ static void mpc5121_nfc_write_buf(struct mtd_info *mtd,
        mpc5121_nfc_buf_copy(mtd, (u_char *)buf, len, 1);
 }
 
-/* Compare buffer with NAND flash */
-static int mpc5121_nfc_verify_buf(struct mtd_info *mtd,
-                                               const u_char *buf, int len)
-{
-       u_char tmp[256];
-       uint bsize;
-
-       while (len) {
-               bsize = min(len, 256);
-               mpc5121_nfc_read_buf(mtd, tmp, bsize);
-
-               if (memcmp(buf, tmp, bsize))
-                       return 1;
-
-               buf += bsize;
-               len -= bsize;
-       }
-
-       return 0;
-}
-
 /* Read byte from NFC buffers */
 static u8 mpc5121_nfc_read_byte(struct mtd_info *mtd)
 {
@@ -732,7 +711,6 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op)
        chip->read_word = mpc5121_nfc_read_word;
        chip->read_buf = mpc5121_nfc_read_buf;
        chip->write_buf = mpc5121_nfc_write_buf;
-       chip->verify_buf = mpc5121_nfc_verify_buf;
        chip->select_chip = mpc5121_nfc_select_chip;
        chip->bbt_options = NAND_BBT_USE_FLASH;
        chip->ecc.mode = NAND_ECC_SOFT;
index 3f94e1f13231b07ea43b71d945e9615eabe1fc65..bfee9ebf9ab9f7f91a40444da75d8ee01aad6c11 100644 (file)
@@ -746,14 +746,6 @@ static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
        host->buf_start += n;
 }
 
-/* Used by the upper layer to verify the data in NAND Flash
- * with the data in the buf. */
-static int mxc_nand_verify_buf(struct mtd_info *mtd,
-                               const u_char *buf, int len)
-{
-       return -EFAULT;
-}
-
 /* This function is used by upper layer for select and
  * deselect of the NAND chip */
 static void mxc_nand_select_chip_v1_v3(struct mtd_info *mtd, int chip)
@@ -1406,7 +1398,6 @@ static int __init mxcnd_probe(struct platform_device *pdev)
        this->read_word = mxc_nand_read_word;
        this->write_buf = mxc_nand_write_buf;
        this->read_buf = mxc_nand_read_buf;
-       this->verify_buf = mxc_nand_verify_buf;
 
        host->clk = devm_clk_get(&pdev->dev, "nfc");
        if (IS_ERR(host->clk))
index 996cc48368851b48deeddfb0d38566f766dd7fb9..6a8e15d6b4023c90641e86fc76436f46ecde932d 100644 (file)
@@ -242,25 +242,6 @@ static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
                buf[i] = readb(chip->IO_ADDR_R);
 }
 
-/**
- * nand_verify_buf - [DEFAULT] Verify chip data against buffer
- * @mtd: MTD device structure
- * @buf: buffer containing the data to compare
- * @len: number of bytes to compare
- *
- * Default verify function for 8bit buswidth.
- */
-static int nand_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
-{
-       int i;
-       struct nand_chip *chip = mtd->priv;
-
-       for (i = 0; i < len; i++)
-               if (buf[i] != readb(chip->IO_ADDR_R))
-                       return -EFAULT;
-       return 0;
-}
-
 /**
  * nand_write_buf16 - [DEFAULT] write buffer to chip
  * @mtd: MTD device structure
@@ -300,28 +281,6 @@ static void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len)
                p[i] = readw(chip->IO_ADDR_R);
 }
 
-/**
- * nand_verify_buf16 - [DEFAULT] Verify chip data against buffer
- * @mtd: MTD device structure
- * @buf: buffer containing the data to compare
- * @len: number of bytes to compare
- *
- * Default verify function for 16bit buswidth.
- */
-static int nand_verify_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
-{
-       int i;
-       struct nand_chip *chip = mtd->priv;
-       u16 *p = (u16 *) buf;
-       len >>= 1;
-
-       for (i = 0; i < len; i++)
-               if (p[i] != readw(chip->IO_ADDR_R))
-                       return -EFAULT;
-
-       return 0;
-}
-
 /**
  * nand_block_bad - [DEFAULT] Read bad block marker from the chip
  * @mtd: MTD device structure
@@ -2120,16 +2079,6 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
                status = chip->waitfunc(mtd, chip);
        }
 
-#ifdef CONFIG_MTD_NAND_VERIFY_WRITE
-       /* Send command to read back the data */
-       chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
-
-       if (chip->verify_buf(mtd, buf, mtd->writesize))
-               return -EIO;
-
-       /* Make sure the next page prog is preceded by a status read */
-       chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
-#endif
        return 0;
 }
 
@@ -2804,8 +2753,6 @@ static void nand_set_defaults(struct nand_chip *chip, int busw)
                chip->write_buf = busw ? nand_write_buf16 : nand_write_buf;
        if (!chip->read_buf)
                chip->read_buf = busw ? nand_read_buf16 : nand_read_buf;
-       if (!chip->verify_buf)
-               chip->verify_buf = busw ? nand_verify_buf16 : nand_verify_buf;
        if (!chip->scan_bbt)
                chip->scan_bbt = nand_default_bbt;
 
index cf0cd3146817f9275706f1d4f61b53724d0d5dc1..21e64b5d352b446b8211294a66331617d1b2ceb1 100644 (file)
@@ -447,8 +447,6 @@ static unsigned int rptwear_cnt = 0;
 /* MTD structure for NAND controller */
 static struct mtd_info *nsmtd;
 
-static u_char ns_verify_buf[NS_LARGEST_PAGE_SIZE];
-
 /*
  * Allocate array of page pointers, create slab allocation for an array
  * and initialize the array by NULL pointers.
@@ -2189,19 +2187,6 @@ static void ns_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
        return;
 }
 
-static int ns_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       ns_nand_read_buf(mtd, (u_char *)&ns_verify_buf[0], len);
-
-       if (!memcmp(buf, &ns_verify_buf[0], len)) {
-               NS_DBG("verify_buf: the buffer is OK\n");
-               return 0;
-       } else {
-               NS_DBG("verify_buf: the buffer is wrong\n");
-               return -EFAULT;
-       }
-}
-
 /*
  * Module initialization function
  */
@@ -2236,7 +2221,6 @@ static int __init ns_init_module(void)
        chip->dev_ready  = ns_device_ready;
        chip->write_buf  = ns_nand_write_buf;
        chip->read_buf   = ns_nand_read_buf;
-       chip->verify_buf = ns_nand_verify_buf;
        chip->read_word  = ns_nand_read_word;
        chip->ecc.mode   = NAND_ECC_SOFT;
        /* The NAND_SKIP_BBTSCAN option is necessary for 'overridesize' */
index 2b6f632cf27429ff691c7007a8a842689a8878d4..5fd3f010e3aef041a89471fd413d9603174d10c1 100644 (file)
@@ -140,18 +140,6 @@ static void ndfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
                out_be32(ndfc->ndfcbase + NDFC_DATA, *p++);
 }
 
-static int ndfc_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
-{
-       struct nand_chip *chip = mtd->priv;
-       struct ndfc_controller *ndfc = chip->priv;
-       uint32_t *p = (uint32_t *) buf;
-
-       for(;len > 0; len -= 4)
-               if (*p++ != in_be32(ndfc->ndfcbase + NDFC_DATA))
-                       return -EFAULT;
-       return 0;
-}
-
 /*
  * Initialize chip structure
  */
@@ -172,7 +160,6 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
        chip->controller = &ndfc->ndfc_control;
        chip->read_buf = ndfc_read_buf;
        chip->write_buf = ndfc_write_buf;
-       chip->verify_buf = ndfc_verify_buf;
        chip->ecc.correct = nand_correct_data;
        chip->ecc.hwctl = ndfc_enable_hwecc;
        chip->ecc.calculate = ndfc_calculate_ecc;
index 8febe46e1105e9aad7212dd442e4160d855fe11d..94dc46bc118cf7afac5608a9b3f2483b5719fd6c 100644 (file)
@@ -112,22 +112,6 @@ static void nuc900_nand_write_buf(struct mtd_info *mtd,
                write_data_reg(nand, buf[i]);
 }
 
-static int nuc900_verify_buf(struct mtd_info *mtd,
-                            const unsigned char *buf, int len)
-{
-       int i;
-       struct nuc900_nand *nand;
-
-       nand = container_of(mtd, struct nuc900_nand, mtd);
-
-       for (i = 0; i < len; i++) {
-               if (buf[i] != (unsigned char)read_data_reg(nand))
-                       return -EFAULT;
-       }
-
-       return 0;
-}
-
 static int nuc900_check_rb(struct nuc900_nand *nand)
 {
        unsigned int val;
@@ -292,7 +276,6 @@ static int __devinit nuc900_nand_probe(struct platform_device *pdev)
        chip->read_byte         = nuc900_nand_read_byte;
        chip->write_buf         = nuc900_nand_write_buf;
        chip->read_buf          = nuc900_nand_read_buf;
-       chip->verify_buf        = nuc900_verify_buf;
        chip->chip_delay        = 50;
        chip->options           = 0;
        chip->ecc.mode          = NAND_ECC_SOFT;
index 1ede9fb434308b9769503f8bd352e691d9c06c29..f47c422c7dfd4eb7ccaa65b613cccca31c86a62b 100644 (file)
@@ -613,27 +613,6 @@ out_copy:
                omap_write_buf8(mtd, buf, len);
 }
 
-/**
- * omap_verify_buf - Verify chip data against buffer
- * @mtd: MTD device structure
- * @buf: buffer containing the data to compare
- * @len: number of bytes to compare
- */
-static int omap_verify_buf(struct mtd_info *mtd, const u_char * buf, int len)
-{
-       struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
-                                                       mtd);
-       u16 *p = (u16 *) buf;
-
-       len >>= 1;
-       while (len--) {
-               if (*p++ != cpu_to_le16(readw(info->nand.IO_ADDR_R)))
-                       return -EFAULT;
-       }
-
-       return 0;
-}
-
 /**
  * gen_true_ecc - This function will generate true ECC value
  * @ecc_buf: buffer to store ecc code
@@ -1285,8 +1264,6 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
                goto out_release_mem_region;
        }
 
-       info->nand.verify_buf = omap_verify_buf;
-
        /* select the ecc type */
        if (pdata->ecc_opt == OMAP_ECC_HAMMING_CODE_DEFAULT)
                info->nand.ecc.mode = NAND_ECC_SOFT;
index e8a1ae97a95293bb91516096d76e8fe61e1c6144..5df91d554daceb0e5d227fe23142b93b0ebe6eaf 100644 (file)
@@ -771,12 +771,6 @@ static void pxa3xx_nand_write_buf(struct mtd_info *mtd,
        info->buf_start += real_len;
 }
 
-static int pxa3xx_nand_verify_buf(struct mtd_info *mtd,
-               const uint8_t *buf, int len)
-{
-       return 0;
-}
-
 static void pxa3xx_nand_select_chip(struct mtd_info *mtd, int chip)
 {
        return;
@@ -1069,7 +1063,6 @@ static int alloc_nand_resource(struct platform_device *pdev)
                chip->read_byte         = pxa3xx_nand_read_byte;
                chip->read_buf          = pxa3xx_nand_read_buf;
                chip->write_buf         = pxa3xx_nand_write_buf;
-               chip->verify_buf        = pxa3xx_nand_verify_buf;
        }
 
        spin_lock_init(&chip->controller->lock);
index 8cb627751c9c9658c5a3d6ac7c0a9cf1f78fb6af..4495f8551fa093fc6f30117475d624691e918430 100644 (file)
@@ -309,27 +309,6 @@ static uint8_t r852_read_byte(struct mtd_info *mtd)
        return r852_read_reg(dev, R852_DATALINE);
 }
 
-
-/*
- * Readback the buffer to verify it
- */
-int r852_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
-{
-       struct r852_device *dev = r852_get_dev(mtd);
-
-       /* We can't be sure about anything here... */
-       if (dev->card_unstable)
-               return -1;
-
-       /* This will never happen, unless you wired up a nand chip
-               with > 512 bytes page size to the reader */
-       if (len > SM_SECTOR_SIZE)
-               return 0;
-
-       r852_read_buf(mtd, dev->tmp_buffer, len);
-       return memcmp(buf, dev->tmp_buffer, len);
-}
-
 /*
  * Control several chip lines & send commands
  */
@@ -882,7 +861,6 @@ int  r852_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
        chip->read_byte = r852_read_byte;
        chip->read_buf = r852_read_buf;
        chip->write_buf = r852_write_buf;
-       chip->verify_buf = r852_verify_buf;
 
        /* ecc */
        chip->ecc.mode = NAND_ECC_HW_SYNDROME;
index 4ff8ef526c02df7e04be0645a76fd6fa326fb0b9..4fbfe96e37a1f93dd58dd2b9dae063e8568cb0a9 100644 (file)
@@ -786,16 +786,6 @@ static void flctl_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
        flctl->index += len;
 }
 
-static int flctl_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       int i;
-
-       for (i = 0; i < len; i++)
-               if (buf[i] != flctl_read_byte(mtd))
-                       return -EFAULT;
-       return 0;
-}
-
 static int flctl_chip_init_tail(struct mtd_info *mtd)
 {
        struct sh_flctl *flctl = mtd_to_flctl(mtd);
@@ -929,7 +919,6 @@ static int __devinit flctl_probe(struct platform_device *pdev)
        nand->read_byte = flctl_read_byte;
        nand->write_buf = flctl_write_buf;
        nand->read_buf = flctl_read_buf;
-       nand->verify_buf = flctl_verify_buf;
        nand->select_chip = flctl_select_chip;
        nand->cmdfunc = flctl_cmdfunc;
 
index e02b08bcf0c044e7cd845b046f81d013ec8140cc..f3f28fafbf7ae85b72311a46dfe437f4739a78e9 100644 (file)
@@ -98,24 +98,6 @@ static uint16_t socrates_nand_read_word(struct mtd_info *mtd)
        return word;
 }
 
-/**
- * socrates_nand_verify_buf -  Verify chip data against buffer
- * @mtd:       MTD device structure
- * @buf:       buffer containing the data to compare
- * @len:       number of bytes to compare
- */
-static int socrates_nand_verify_buf(struct mtd_info *mtd, const u8 *buf,
-               int len)
-{
-       int i;
-
-       for (i = 0; i < len; i++) {
-               if (buf[i] != socrates_nand_read_byte(mtd))
-                       return -EFAULT;
-       }
-       return 0;
-}
-
 /*
  * Hardware specific access to control-lines
  */
@@ -201,7 +183,6 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
        nand_chip->read_word = socrates_nand_read_word;
        nand_chip->write_buf = socrates_nand_write_buf;
        nand_chip->read_buf = socrates_nand_read_buf;
-       nand_chip->verify_buf = socrates_nand_verify_buf;
        nand_chip->dev_ready = socrates_nand_device_ready;
 
        nand_chip->ecc.mode = NAND_ECC_SOFT;    /* enable ECC */
index 5aa518081c513454e0fedb70f907cdeffcbaecd2..508e9e04b0926a5b16c4620dc1f2a821e945680d 100644 (file)
@@ -256,18 +256,6 @@ static void tmio_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
        tmio_ioread16_rep(tmio->fcr + FCR_DATA, buf, len >> 1);
 }
 
-static int
-tmio_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
-{
-       struct tmio_nand *tmio = mtd_to_tmio(mtd);
-       u16                             *p = (u16 *) buf;
-
-       for (len >>= 1; len; len--)
-               if (*(p++) != tmio_ioread16(tmio->fcr + FCR_DATA))
-                       return -EFAULT;
-       return 0;
-}
-
 static void tmio_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 {
        struct tmio_nand *tmio = mtd_to_tmio(mtd);
@@ -424,7 +412,6 @@ static int tmio_probe(struct platform_device *dev)
        nand_chip->read_byte = tmio_nand_read_byte;
        nand_chip->write_buf = tmio_nand_write_buf;
        nand_chip->read_buf = tmio_nand_read_buf;
-       nand_chip->verify_buf = tmio_nand_verify_buf;
 
        /* set eccmode using hardware ECC */
        nand_chip->ecc.mode = NAND_ECC_HW;
index 26398dcf21cfdccb606c923a7e0d96eefbd370de..e3d7266e256f2f5601aa6117bab6669964c0d604 100644 (file)
@@ -131,18 +131,6 @@ static void txx9ndfmc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
                *buf++ = __raw_readl(ndfdtr);
 }
 
-static int txx9ndfmc_verify_buf(struct mtd_info *mtd, const uint8_t *buf,
-                               int len)
-{
-       struct platform_device *dev = mtd_to_platdev(mtd);
-       void __iomem *ndfdtr = ndregaddr(dev, TXX9_NDFDTR);
-
-       while (len--)
-               if (*buf++ != (uint8_t)__raw_readl(ndfdtr))
-                       return -EFAULT;
-       return 0;
-}
-
 static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd,
                               unsigned int ctrl)
 {
@@ -346,7 +334,6 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
                chip->read_byte = txx9ndfmc_read_byte;
                chip->read_buf = txx9ndfmc_read_buf;
                chip->write_buf = txx9ndfmc_write_buf;
-               chip->verify_buf = txx9ndfmc_verify_buf;
                chip->cmd_ctrl = txx9ndfmc_cmd_ctrl;
                chip->dev_ready = txx9ndfmc_dev_ready;
                chip->ecc.calculate = txx9ndfmc_calculate_ecc;
index 9e2dfd517aa51c68e15e80d864d1a12f80c1fbe8..8dd6ba52404a390c57462bb90f25f470c1d32687 100644 (file)
@@ -346,7 +346,6 @@ static int sm_write_sector(struct sm_ftl *ftl,
        ret = mtd_write_oob(mtd, sm_mkoffset(ftl, zone, block, boffset), &ops);
 
        /* Now we assume that hardware will catch write bitflip errors */
-       /* If you are paranoid, use CONFIG_MTD_NAND_VERIFY_WRITE */
 
        if (ret) {
                dbg("write to block %d at zone %d, failed with error %d",
index eeb70153b646a0ebf3e9a088e200acb5aebd8aba..1d90e4f82bcf9755ec724f4f5b007e7101e32a53 100644 (file)
@@ -394,8 +394,6 @@ struct nand_buffers {
  * @read_word:         [REPLACEABLE] read one word from the chip
  * @write_buf:         [REPLACEABLE] write data from the buffer to the chip
  * @read_buf:          [REPLACEABLE] read data from the chip into the buffer
- * @verify_buf:                [REPLACEABLE] verify buffer contents against the chip
- *                     data.
  * @select_chip:       [REPLACEABLE] select chip nr
  * @block_bad:         [REPLACEABLE] check, if the block is bad
  * @block_markbad:     [REPLACEABLE] mark the block bad
@@ -478,7 +476,6 @@ struct nand_chip {
        u16 (*read_word)(struct mtd_info *mtd);
        void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
        void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
-       int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
        void (*select_chip)(struct mtd_info *mtd, int chip);
        int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip);
        int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);