aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Shijie <shijie8@gmail.com>2012-08-14 22:38:45 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-09-29 10:00:46 -0400
commit657f28f8811c92724db10d18bbbec70d540147d6 (patch)
tree1d8cb32d57eec27f46a74cad73a1ceff43f5e099
parent8da28681eb1430fb6715c7aef67001acfbbbcba5 (diff)
mtd: kill MTD_NAND_VERIFY_WRITE
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>
-rw-r--r--drivers/mtd/nand/Kconfig9
-rw-r--r--drivers/mtd/nand/ams-delta.c13
-rw-r--r--drivers/mtd/nand/au1550nd.c46
-rw-r--r--drivers/mtd/nand/bcm_umi_nand.c22
-rw-r--r--drivers/mtd/nand/cafe_nand.c7
-rw-r--r--drivers/mtd/nand/cmx270_nand.c13
-rw-r--r--drivers/mtd/nand/diskonchip.c63
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c36
-rw-r--r--drivers/mtd/nand/fsl_ifc_nand.c41
-rw-r--r--drivers/mtd/nand/gpio.c39
-rw-r--r--drivers/mtd/nand/lpc32xx_slc.c19
-rw-r--r--drivers/mtd/nand/mpc5121_nfc.c22
-rw-r--r--drivers/mtd/nand/mxc_nand.c9
-rw-r--r--drivers/mtd/nand/nand_base.c53
-rw-r--r--drivers/mtd/nand/nandsim.c16
-rw-r--r--drivers/mtd/nand/ndfc.c13
-rw-r--r--drivers/mtd/nand/nuc900_nand.c17
-rw-r--r--drivers/mtd/nand/omap2.c23
-rw-r--r--drivers/mtd/nand/pxa3xx_nand.c7
-rw-r--r--drivers/mtd/nand/r852.c22
-rw-r--r--drivers/mtd/nand/sh_flctl.c11
-rw-r--r--drivers/mtd/nand/socrates_nand.c19
-rw-r--r--drivers/mtd/nand/tmio_nand.c13
-rw-r--r--drivers/mtd/nand/txx9ndfmc.c13
-rw-r--r--drivers/mtd/sm_ftl.c1
-rw-r--r--include/linux/mtd/nand.h3
26 files changed, 0 insertions, 550 deletions
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 5708d3b28a98..7101e8a03259 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -22,15 +22,6 @@ menuconfig MTD_NAND
22 22
23if MTD_NAND 23if MTD_NAND
24 24
25config MTD_NAND_VERIFY_WRITE
26 bool "Verify NAND page writes"
27 help
28 This adds an extra check when data is written to the flash. The
29 NAND flash device internally checks only bits transitioning
30 from 1 to 0. There is a rare possibility that even though the
31 device thinks the write was successful, a bit could have been
32 flipped accidentally due to device wear or something else.
33
34config MTD_NAND_BCH 25config MTD_NAND_BCH
35 tristate 26 tristate
36 select BCH 27 select BCH
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 861ca8f7e47d..2d73f2393586 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -103,18 +103,6 @@ static void ams_delta_read_buf(struct mtd_info *mtd, u_char *buf, int len)
103 buf[i] = ams_delta_read_byte(mtd); 103 buf[i] = ams_delta_read_byte(mtd);
104} 104}
105 105
106static int ams_delta_verify_buf(struct mtd_info *mtd, const u_char *buf,
107 int len)
108{
109 int i;
110
111 for (i=0; i<len; i++)
112 if (buf[i] != ams_delta_read_byte(mtd))
113 return -EFAULT;
114
115 return 0;
116}
117
118/* 106/*
119 * Command control function 107 * Command control function
120 * 108 *
@@ -233,7 +221,6 @@ static int __devinit ams_delta_init(struct platform_device *pdev)
233 this->read_byte = ams_delta_read_byte; 221 this->read_byte = ams_delta_read_byte;
234 this->write_buf = ams_delta_write_buf; 222 this->write_buf = ams_delta_write_buf;
235 this->read_buf = ams_delta_read_buf; 223 this->read_buf = ams_delta_read_buf;
236 this->verify_buf = ams_delta_verify_buf;
237 this->cmd_ctrl = ams_delta_hwcontrol; 224 this->cmd_ctrl = ams_delta_hwcontrol;
238 if (gpio_request(AMS_DELTA_GPIO_PIN_NAND_RB, "nand_rdy") == 0) { 225 if (gpio_request(AMS_DELTA_GPIO_PIN_NAND_RB, "nand_rdy") == 0) {
239 this->dev_ready = ams_delta_nand_ready; 226 this->dev_ready = ams_delta_nand_ready;
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c
index 9f609d2dcf62..5c47b200045a 100644
--- a/drivers/mtd/nand/au1550nd.c
+++ b/drivers/mtd/nand/au1550nd.c
@@ -141,28 +141,6 @@ static void au_read_buf(struct mtd_info *mtd, u_char *buf, int len)
141} 141}
142 142
143/** 143/**
144 * au_verify_buf - Verify chip data against buffer
145 * @mtd: MTD device structure
146 * @buf: buffer containing the data to compare
147 * @len: number of bytes to compare
148 *
149 * verify function for 8bit buswidth
150 */
151static int au_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
152{
153 int i;
154 struct nand_chip *this = mtd->priv;
155
156 for (i = 0; i < len; i++) {
157 if (buf[i] != readb(this->IO_ADDR_R))
158 return -EFAULT;
159 au_sync();
160 }
161
162 return 0;
163}
164
165/**
166 * au_write_buf16 - write buffer to chip 144 * au_write_buf16 - write buffer to chip
167 * @mtd: MTD device structure 145 * @mtd: MTD device structure
168 * @buf: data buffer 146 * @buf: data buffer
@@ -205,29 +183,6 @@ static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
205 } 183 }
206} 184}
207 185
208/**
209 * au_verify_buf16 - Verify chip data against buffer
210 * @mtd: MTD device structure
211 * @buf: buffer containing the data to compare
212 * @len: number of bytes to compare
213 *
214 * verify function for 16bit buswidth
215 */
216static int au_verify_buf16(struct mtd_info *mtd, const u_char *buf, int len)
217{
218 int i;
219 struct nand_chip *this = mtd->priv;
220 u16 *p = (u16 *) buf;
221 len >>= 1;
222
223 for (i = 0; i < len; i++) {
224 if (p[i] != readw(this->IO_ADDR_R))
225 return -EFAULT;
226 au_sync();
227 }
228 return 0;
229}
230
231/* Select the chip by setting nCE to low */ 186/* Select the chip by setting nCE to low */
232#define NAND_CTL_SETNCE 1 187#define NAND_CTL_SETNCE 1
233/* Deselect the chip by setting nCE to high */ 188/* Deselect the chip by setting nCE to high */
@@ -516,7 +471,6 @@ static int __devinit au1550nd_probe(struct platform_device *pdev)
516 this->read_word = au_read_word; 471 this->read_word = au_read_word;
517 this->write_buf = (pd->devwidth) ? au_write_buf16 : au_write_buf; 472 this->write_buf = (pd->devwidth) ? au_write_buf16 : au_write_buf;
518 this->read_buf = (pd->devwidth) ? au_read_buf16 : au_read_buf; 473 this->read_buf = (pd->devwidth) ? au_read_buf16 : au_read_buf;
519 this->verify_buf = (pd->devwidth) ? au_verify_buf16 : au_verify_buf;
520 474
521 ret = nand_scan(&ctx->info, 1); 475 ret = nand_scan(&ctx->info, 1);
522 if (ret) { 476 if (ret) {
diff --git a/drivers/mtd/nand/bcm_umi_nand.c b/drivers/mtd/nand/bcm_umi_nand.c
index c855e7cd337b..3fcbcbc7b082 100644
--- a/drivers/mtd/nand/bcm_umi_nand.c
+++ b/drivers/mtd/nand/bcm_umi_nand.c
@@ -332,27 +332,6 @@ static void bcm_umi_nand_read_buf(struct mtd_info *mtd, u_char * buf, int len)
332#endif 332#endif
333} 333}
334 334
335static uint8_t readbackbuf[NAND_MAX_PAGESIZE];
336static int bcm_umi_nand_verify_buf(struct mtd_info *mtd, const u_char * buf,
337 int len)
338{
339 /*
340 * Try to readback page with ECC correction. This is necessary
341 * for MLC parts which may have permanently stuck bits.
342 */
343 struct nand_chip *chip = mtd->priv;
344 int ret = chip->ecc.read_page(mtd, chip, readbackbuf, 0, 0);
345 if (ret < 0)
346 return -EFAULT;
347 else {
348 if (memcmp(readbackbuf, buf, len) == 0)
349 return 0;
350
351 return -EFAULT;
352 }
353 return 0;
354}
355
356static int __devinit bcm_umi_nand_probe(struct platform_device *pdev) 335static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
357{ 336{
358 struct nand_chip *this; 337 struct nand_chip *this;
@@ -416,7 +395,6 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
416 395
417 this->write_buf = bcm_umi_nand_write_buf; 396 this->write_buf = bcm_umi_nand_write_buf;
418 this->read_buf = bcm_umi_nand_read_buf; 397 this->read_buf = bcm_umi_nand_read_buf;
419 this->verify_buf = bcm_umi_nand_verify_buf;
420 398
421 this->cmd_ctrl = bcm_umi_nand_hwcontrol; 399 this->cmd_ctrl = bcm_umi_nand_hwcontrol;
422 this->ecc.mode = NAND_ECC_HW; 400 this->ecc.mode = NAND_ECC_HW;
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index 08248a0a167e..2bb7170502c2 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -576,13 +576,6 @@ static int cafe_nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
576 status = chip->waitfunc(mtd, chip); 576 status = chip->waitfunc(mtd, chip);
577 } 577 }
578 578
579#ifdef CONFIG_MTD_NAND_VERIFY_WRITE
580 /* Send command to read back the data */
581 chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
582
583 if (chip->verify_buf(mtd, buf, mtd->writesize))
584 return -EIO;
585#endif
586 return 0; 579 return 0;
587} 580}
588 581
diff --git a/drivers/mtd/nand/cmx270_nand.c b/drivers/mtd/nand/cmx270_nand.c
index 1024bfc05c86..39b2ef848811 100644
--- a/drivers/mtd/nand/cmx270_nand.c
+++ b/drivers/mtd/nand/cmx270_nand.c
@@ -76,18 +76,6 @@ static void cmx270_read_buf(struct mtd_info *mtd, u_char *buf, int len)
76 *buf++ = readl(this->IO_ADDR_R) >> 16; 76 *buf++ = readl(this->IO_ADDR_R) >> 16;
77} 77}
78 78
79static int cmx270_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
80{
81 int i;
82 struct nand_chip *this = mtd->priv;
83
84 for (i=0; i<len; i++)
85 if (buf[i] != (u_char)(readl(this->IO_ADDR_R) >> 16))
86 return -EFAULT;
87
88 return 0;
89}
90
91static inline void nand_cs_on(void) 79static inline void nand_cs_on(void)
92{ 80{
93 gpio_set_value(GPIO_NAND_CS, 0); 81 gpio_set_value(GPIO_NAND_CS, 0);
@@ -209,7 +197,6 @@ static int __init cmx270_init(void)
209 this->read_byte = cmx270_read_byte; 197 this->read_byte = cmx270_read_byte;
210 this->read_buf = cmx270_read_buf; 198 this->read_buf = cmx270_read_buf;
211 this->write_buf = cmx270_write_buf; 199 this->write_buf = cmx270_write_buf;
212 this->verify_buf = cmx270_verify_buf;
213 200
214 /* Scan to find existence of the device */ 201 /* Scan to find existence of the device */
215 if (nand_scan (cmx270_nand_mtd, 1)) { 202 if (nand_scan (cmx270_nand_mtd, 1)) {
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index e2ca067631cf..256eb30f6180 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -376,19 +376,6 @@ static void doc2000_readbuf_dword(struct mtd_info *mtd, u_char *buf, int len)
376 } 376 }
377} 377}
378 378
379static int doc2000_verifybuf(struct mtd_info *mtd, const u_char *buf, int len)
380{
381 struct nand_chip *this = mtd->priv;
382 struct doc_priv *doc = this->priv;
383 void __iomem *docptr = doc->virtadr;
384 int i;
385
386 for (i = 0; i < len; i++)
387 if (buf[i] != ReadDOC(docptr, 2k_CDSN_IO))
388 return -EFAULT;
389 return 0;
390}
391
392static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr) 379static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr)
393{ 380{
394 struct nand_chip *this = mtd->priv; 381 struct nand_chip *this = mtd->priv;
@@ -526,26 +513,6 @@ static void doc2001_readbuf(struct mtd_info *mtd, u_char *buf, int len)
526 buf[i] = ReadDOC(docptr, LastDataRead); 513 buf[i] = ReadDOC(docptr, LastDataRead);
527} 514}
528 515
529static int doc2001_verifybuf(struct mtd_info *mtd, const u_char *buf, int len)
530{
531 struct nand_chip *this = mtd->priv;
532 struct doc_priv *doc = this->priv;
533 void __iomem *docptr = doc->virtadr;
534 int i;
535
536 /* Start read pipeline */
537 ReadDOC(docptr, ReadPipeInit);
538
539 for (i = 0; i < len - 1; i++)
540 if (buf[i] != ReadDOC(docptr, Mil_CDSN_IO)) {
541 ReadDOC(docptr, LastDataRead);
542 return i;
543 }
544 if (buf[i] != ReadDOC(docptr, LastDataRead))
545 return i;
546 return 0;
547}
548
549static u_char doc2001plus_read_byte(struct mtd_info *mtd) 516static u_char doc2001plus_read_byte(struct mtd_info *mtd)
550{ 517{
551 struct nand_chip *this = mtd->priv; 518 struct nand_chip *this = mtd->priv;
@@ -610,33 +577,6 @@ static void doc2001plus_readbuf(struct mtd_info *mtd, u_char *buf, int len)
610 printk("\n"); 577 printk("\n");
611} 578}
612 579
613static int doc2001plus_verifybuf(struct mtd_info *mtd, const u_char *buf, int len)
614{
615 struct nand_chip *this = mtd->priv;
616 struct doc_priv *doc = this->priv;
617 void __iomem *docptr = doc->virtadr;
618 int i;
619
620 if (debug)
621 printk("verifybuf of %d bytes: ", len);
622
623 /* Start read pipeline */
624 ReadDOC(docptr, Mplus_ReadPipeInit);
625 ReadDOC(docptr, Mplus_ReadPipeInit);
626
627 for (i = 0; i < len - 2; i++)
628 if (buf[i] != ReadDOC(docptr, Mil_CDSN_IO)) {
629 ReadDOC(docptr, Mplus_LastDataRead);
630 ReadDOC(docptr, Mplus_LastDataRead);
631 return i;
632 }
633 if (buf[len - 2] != ReadDOC(docptr, Mplus_LastDataRead))
634 return len - 2;
635 if (buf[len - 1] != ReadDOC(docptr, Mplus_LastDataRead))
636 return len - 1;
637 return 0;
638}
639
640static void doc2001plus_select_chip(struct mtd_info *mtd, int chip) 580static void doc2001plus_select_chip(struct mtd_info *mtd, int chip)
641{ 581{
642 struct nand_chip *this = mtd->priv; 582 struct nand_chip *this = mtd->priv;
@@ -1432,7 +1372,6 @@ static inline int __init doc2000_init(struct mtd_info *mtd)
1432 this->read_byte = doc2000_read_byte; 1372 this->read_byte = doc2000_read_byte;
1433 this->write_buf = doc2000_writebuf; 1373 this->write_buf = doc2000_writebuf;
1434 this->read_buf = doc2000_readbuf; 1374 this->read_buf = doc2000_readbuf;
1435 this->verify_buf = doc2000_verifybuf;
1436 this->scan_bbt = nftl_scan_bbt; 1375 this->scan_bbt = nftl_scan_bbt;
1437 1376
1438 doc->CDSNControl = CDSN_CTRL_FLASH_IO | CDSN_CTRL_ECC_IO; 1377 doc->CDSNControl = CDSN_CTRL_FLASH_IO | CDSN_CTRL_ECC_IO;
@@ -1449,7 +1388,6 @@ static inline int __init doc2001_init(struct mtd_info *mtd)
1449 this->read_byte = doc2001_read_byte; 1388 this->read_byte = doc2001_read_byte;
1450 this->write_buf = doc2001_writebuf; 1389 this->write_buf = doc2001_writebuf;
1451 this->read_buf = doc2001_readbuf; 1390 this->read_buf = doc2001_readbuf;
1452 this->verify_buf = doc2001_verifybuf;
1453 1391
1454 ReadDOC(doc->virtadr, ChipID); 1392 ReadDOC(doc->virtadr, ChipID);
1455 ReadDOC(doc->virtadr, ChipID); 1393 ReadDOC(doc->virtadr, ChipID);
@@ -1480,7 +1418,6 @@ static inline int __init doc2001plus_init(struct mtd_info *mtd)
1480 this->read_byte = doc2001plus_read_byte; 1418 this->read_byte = doc2001plus_read_byte;
1481 this->write_buf = doc2001plus_writebuf; 1419 this->write_buf = doc2001plus_writebuf;
1482 this->read_buf = doc2001plus_readbuf; 1420 this->read_buf = doc2001plus_readbuf;
1483 this->verify_buf = doc2001plus_verifybuf;
1484 this->scan_bbt = inftl_scan_bbt; 1421 this->scan_bbt = inftl_scan_bbt;
1485 this->cmd_ctrl = NULL; 1422 this->cmd_ctrl = NULL;
1486 this->select_chip = doc2001plus_select_chip; 1423 this->select_chip = doc2001plus_select_chip;
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 8143873d17a5..cc1480a5e4c1 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -614,41 +614,6 @@ static void fsl_elbc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
614 len, avail); 614 len, avail);
615} 615}
616 616
617/*
618 * Verify buffer against the FCM Controller Data Buffer
619 */
620static int fsl_elbc_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
621{
622 struct nand_chip *chip = mtd->priv;
623 struct fsl_elbc_mtd *priv = chip->priv;
624 struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
625 int i;
626
627 if (len < 0) {
628 dev_err(priv->dev, "write_buf of %d bytes", len);
629 return -EINVAL;
630 }
631
632 if ((unsigned int)len >
633 elbc_fcm_ctrl->read_bytes - elbc_fcm_ctrl->index) {
634 dev_err(priv->dev,
635 "verify_buf beyond end of buffer "
636 "(%d requested, %u available)\n",
637 len, elbc_fcm_ctrl->read_bytes - elbc_fcm_ctrl->index);
638
639 elbc_fcm_ctrl->index = elbc_fcm_ctrl->read_bytes;
640 return -EINVAL;
641 }
642
643 for (i = 0; i < len; i++)
644 if (in_8(&elbc_fcm_ctrl->addr[elbc_fcm_ctrl->index + i])
645 != buf[i])
646 break;
647
648 elbc_fcm_ctrl->index += len;
649 return i == len && elbc_fcm_ctrl->status == LTESR_CC ? 0 : -EIO;
650}
651
652/* This function is called after Program and Erase Operations to 617/* This function is called after Program and Erase Operations to
653 * check for success or failure. 618 * check for success or failure.
654 */ 619 */
@@ -798,7 +763,6 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
798 chip->read_byte = fsl_elbc_read_byte; 763 chip->read_byte = fsl_elbc_read_byte;
799 chip->write_buf = fsl_elbc_write_buf; 764 chip->write_buf = fsl_elbc_write_buf;
800 chip->read_buf = fsl_elbc_read_buf; 765 chip->read_buf = fsl_elbc_read_buf;
801 chip->verify_buf = fsl_elbc_verify_buf;
802 chip->select_chip = fsl_elbc_select_chip; 766 chip->select_chip = fsl_elbc_select_chip;
803 chip->cmdfunc = fsl_elbc_cmdfunc; 767 chip->cmdfunc = fsl_elbc_cmdfunc;
804 chip->waitfunc = fsl_elbc_wait; 768 chip->waitfunc = fsl_elbc_wait;
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index 1f71b545062a..e92d223e5e1a 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -627,46 +627,6 @@ static void fsl_ifc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
627} 627}
628 628
629/* 629/*
630 * Verify buffer against the IFC Controller Data Buffer
631 */
632static int fsl_ifc_verify_buf(struct mtd_info *mtd,
633 const u_char *buf, int len)
634{
635 struct nand_chip *chip = mtd->priv;
636 struct fsl_ifc_mtd *priv = chip->priv;
637 struct fsl_ifc_ctrl *ctrl = priv->ctrl;
638 struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl;
639 int i;
640
641 if (len < 0) {
642 dev_err(priv->dev, "%s: write_buf of %d bytes", __func__, len);
643 return -EINVAL;
644 }
645
646 if ((unsigned int)len > nctrl->read_bytes - nctrl->index) {
647 dev_err(priv->dev,
648 "%s: beyond end of buffer (%d requested, %u available)\n",
649 __func__, len, nctrl->read_bytes - nctrl->index);
650
651 nctrl->index = nctrl->read_bytes;
652 return -EINVAL;
653 }
654
655 for (i = 0; i < len; i++)
656 if (in_8(&nctrl->addr[nctrl->index + i]) != buf[i])
657 break;
658
659 nctrl->index += len;
660
661 if (i != len)
662 return -EIO;
663 if (ctrl->nand_stat != IFC_NAND_EVTER_STAT_OPC)
664 return -EIO;
665
666 return 0;
667}
668
669/*
670 * This function is called after Program and Erase Operations to 630 * This function is called after Program and Erase Operations to
671 * check for success or failure. 631 * check for success or failure.
672 */ 632 */
@@ -796,7 +756,6 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
796 756
797 chip->write_buf = fsl_ifc_write_buf; 757 chip->write_buf = fsl_ifc_write_buf;
798 chip->read_buf = fsl_ifc_read_buf; 758 chip->read_buf = fsl_ifc_read_buf;
799 chip->verify_buf = fsl_ifc_verify_buf;
800 chip->select_chip = fsl_ifc_select_chip; 759 chip->select_chip = fsl_ifc_select_chip;
801 chip->cmdfunc = fsl_ifc_cmdfunc; 760 chip->cmdfunc = fsl_ifc_cmdfunc;
802 chip->waitfunc = fsl_ifc_wait; 761 chip->waitfunc = fsl_ifc_wait;
diff --git a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c
index 27000a5f5f47..ce6a284c8277 100644
--- a/drivers/mtd/nand/gpio.c
+++ b/drivers/mtd/nand/gpio.c
@@ -100,23 +100,6 @@ static void gpio_nand_readbuf(struct mtd_info *mtd, u_char *buf, int len)
100 readsb(this->IO_ADDR_R, buf, len); 100 readsb(this->IO_ADDR_R, buf, len);
101} 101}
102 102
103static int gpio_nand_verifybuf(struct mtd_info *mtd, const u_char *buf, int len)
104{
105 struct nand_chip *this = mtd->priv;
106 unsigned char read, *p = (unsigned char *) buf;
107 int i, err = 0;
108
109 for (i = 0; i < len; i++) {
110 read = readb(this->IO_ADDR_R);
111 if (read != p[i]) {
112 pr_debug("%s: err at %d (read %04x vs %04x)\n",
113 __func__, i, read, p[i]);
114 err = -EFAULT;
115 }
116 }
117 return err;
118}
119
120static void gpio_nand_writebuf16(struct mtd_info *mtd, const u_char *buf, 103static void gpio_nand_writebuf16(struct mtd_info *mtd, const u_char *buf,
121 int len) 104 int len)
122{ 105{
@@ -148,26 +131,6 @@ static void gpio_nand_readbuf16(struct mtd_info *mtd, u_char *buf, int len)
148 } 131 }
149} 132}
150 133
151static int gpio_nand_verifybuf16(struct mtd_info *mtd, const u_char *buf,
152 int len)
153{
154 struct nand_chip *this = mtd->priv;
155 unsigned short read, *p = (unsigned short *) buf;
156 int i, err = 0;
157 len >>= 1;
158
159 for (i = 0; i < len; i++) {
160 read = readw(this->IO_ADDR_R);
161 if (read != p[i]) {
162 pr_debug("%s: err at %d (read %04x vs %04x)\n",
163 __func__, i, read, p[i]);
164 err = -EFAULT;
165 }
166 }
167 return err;
168}
169
170
171static int gpio_nand_devready(struct mtd_info *mtd) 134static int gpio_nand_devready(struct mtd_info *mtd)
172{ 135{
173 struct gpiomtd *gpiomtd = gpio_nand_getpriv(mtd); 136 struct gpiomtd *gpiomtd = gpio_nand_getpriv(mtd);
@@ -391,11 +354,9 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
391 if (this->options & NAND_BUSWIDTH_16) { 354 if (this->options & NAND_BUSWIDTH_16) {
392 this->read_buf = gpio_nand_readbuf16; 355 this->read_buf = gpio_nand_readbuf16;
393 this->write_buf = gpio_nand_writebuf16; 356 this->write_buf = gpio_nand_writebuf16;
394 this->verify_buf = gpio_nand_verifybuf16;
395 } else { 357 } else {
396 this->read_buf = gpio_nand_readbuf; 358 this->read_buf = gpio_nand_readbuf;
397 this->write_buf = gpio_nand_writebuf; 359 this->write_buf = gpio_nand_writebuf;
398 this->verify_buf = gpio_nand_verifybuf;
399 } 360 }
400 361
401 /* set the mtd private data for the nand driver */ 362 /* set the mtd private data for the nand driver */
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index 184035045208..9326e5994b26 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -369,24 +369,6 @@ static void lpc32xx_nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int
369} 369}
370 370
371/* 371/*
372 * Verify data in buffer to data on device
373 */
374static int lpc32xx_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
375{
376 struct nand_chip *chip = mtd->priv;
377 struct lpc32xx_nand_host *host = chip->priv;
378 int i;
379
380 /* DATA register must be read as 32 bits or it will fail */
381 for (i = 0; i < len; i++) {
382 if (buf[i] != (uint8_t)readl(SLC_DATA(host->io_base)))
383 return -EFAULT;
384 }
385
386 return 0;
387}
388
389/*
390 * Read the OOB data from the device without ECC using FIFO method 372 * Read the OOB data from the device without ECC using FIFO method
391 */ 373 */
392static int lpc32xx_nand_read_oob_syndrome(struct mtd_info *mtd, 374static int lpc32xx_nand_read_oob_syndrome(struct mtd_info *mtd,
@@ -871,7 +853,6 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
871 chip->ecc.correct = nand_correct_data; 853 chip->ecc.correct = nand_correct_data;
872 chip->ecc.strength = 1; 854 chip->ecc.strength = 1;
873 chip->ecc.hwctl = lpc32xx_nand_ecc_enable; 855 chip->ecc.hwctl = lpc32xx_nand_ecc_enable;
874 chip->verify_buf = lpc32xx_verify_buf;
875 856
876 /* bitflip_threshold's default is defined as ecc_strength anyway. 857 /* bitflip_threshold's default is defined as ecc_strength anyway.
877 * Unfortunately, it is set only later at add_mtd_device(). Meanwhile 858 * Unfortunately, it is set only later at add_mtd_device(). Meanwhile
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index c259c24d7986..f776c8577b8c 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -506,27 +506,6 @@ static void mpc5121_nfc_write_buf(struct mtd_info *mtd,
506 mpc5121_nfc_buf_copy(mtd, (u_char *)buf, len, 1); 506 mpc5121_nfc_buf_copy(mtd, (u_char *)buf, len, 1);
507} 507}
508 508
509/* Compare buffer with NAND flash */
510static int mpc5121_nfc_verify_buf(struct mtd_info *mtd,
511 const u_char *buf, int len)
512{
513 u_char tmp[256];
514 uint bsize;
515
516 while (len) {
517 bsize = min(len, 256);
518 mpc5121_nfc_read_buf(mtd, tmp, bsize);
519
520 if (memcmp(buf, tmp, bsize))
521 return 1;
522
523 buf += bsize;
524 len -= bsize;
525 }
526
527 return 0;
528}
529
530/* Read byte from NFC buffers */ 509/* Read byte from NFC buffers */
531static u8 mpc5121_nfc_read_byte(struct mtd_info *mtd) 510static u8 mpc5121_nfc_read_byte(struct mtd_info *mtd)
532{ 511{
@@ -732,7 +711,6 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op)
732 chip->read_word = mpc5121_nfc_read_word; 711 chip->read_word = mpc5121_nfc_read_word;
733 chip->read_buf = mpc5121_nfc_read_buf; 712 chip->read_buf = mpc5121_nfc_read_buf;
734 chip->write_buf = mpc5121_nfc_write_buf; 713 chip->write_buf = mpc5121_nfc_write_buf;
735 chip->verify_buf = mpc5121_nfc_verify_buf;
736 chip->select_chip = mpc5121_nfc_select_chip; 714 chip->select_chip = mpc5121_nfc_select_chip;
737 chip->bbt_options = NAND_BBT_USE_FLASH; 715 chip->bbt_options = NAND_BBT_USE_FLASH;
738 chip->ecc.mode = NAND_ECC_SOFT; 716 chip->ecc.mode = NAND_ECC_SOFT;
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 3f94e1f13231..bfee9ebf9ab9 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -746,14 +746,6 @@ static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
746 host->buf_start += n; 746 host->buf_start += n;
747} 747}
748 748
749/* Used by the upper layer to verify the data in NAND Flash
750 * with the data in the buf. */
751static int mxc_nand_verify_buf(struct mtd_info *mtd,
752 const u_char *buf, int len)
753{
754 return -EFAULT;
755}
756
757/* This function is used by upper layer for select and 749/* This function is used by upper layer for select and
758 * deselect of the NAND chip */ 750 * deselect of the NAND chip */
759static void mxc_nand_select_chip_v1_v3(struct mtd_info *mtd, int chip) 751static 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)
1406 this->read_word = mxc_nand_read_word; 1398 this->read_word = mxc_nand_read_word;
1407 this->write_buf = mxc_nand_write_buf; 1399 this->write_buf = mxc_nand_write_buf;
1408 this->read_buf = mxc_nand_read_buf; 1400 this->read_buf = mxc_nand_read_buf;
1409 this->verify_buf = mxc_nand_verify_buf;
1410 1401
1411 host->clk = devm_clk_get(&pdev->dev, "nfc"); 1402 host->clk = devm_clk_get(&pdev->dev, "nfc");
1412 if (IS_ERR(host->clk)) 1403 if (IS_ERR(host->clk))
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 996cc4836885..6a8e15d6b402 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -243,25 +243,6 @@ static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
243} 243}
244 244
245/** 245/**
246 * nand_verify_buf - [DEFAULT] Verify chip data against buffer
247 * @mtd: MTD device structure
248 * @buf: buffer containing the data to compare
249 * @len: number of bytes to compare
250 *
251 * Default verify function for 8bit buswidth.
252 */
253static int nand_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
254{
255 int i;
256 struct nand_chip *chip = mtd->priv;
257
258 for (i = 0; i < len; i++)
259 if (buf[i] != readb(chip->IO_ADDR_R))
260 return -EFAULT;
261 return 0;
262}
263
264/**
265 * nand_write_buf16 - [DEFAULT] write buffer to chip 246 * nand_write_buf16 - [DEFAULT] write buffer to chip
266 * @mtd: MTD device structure 247 * @mtd: MTD device structure
267 * @buf: data buffer 248 * @buf: data buffer
@@ -301,28 +282,6 @@ static void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len)
301} 282}
302 283
303/** 284/**
304 * nand_verify_buf16 - [DEFAULT] Verify chip data against buffer
305 * @mtd: MTD device structure
306 * @buf: buffer containing the data to compare
307 * @len: number of bytes to compare
308 *
309 * Default verify function for 16bit buswidth.
310 */
311static int nand_verify_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
312{
313 int i;
314 struct nand_chip *chip = mtd->priv;
315 u16 *p = (u16 *) buf;
316 len >>= 1;
317
318 for (i = 0; i < len; i++)
319 if (p[i] != readw(chip->IO_ADDR_R))
320 return -EFAULT;
321
322 return 0;
323}
324
325/**
326 * nand_block_bad - [DEFAULT] Read bad block marker from the chip 285 * nand_block_bad - [DEFAULT] Read bad block marker from the chip
327 * @mtd: MTD device structure 286 * @mtd: MTD device structure
328 * @ofs: offset from device start 287 * @ofs: offset from device start
@@ -2120,16 +2079,6 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
2120 status = chip->waitfunc(mtd, chip); 2079 status = chip->waitfunc(mtd, chip);
2121 } 2080 }
2122 2081
2123#ifdef CONFIG_MTD_NAND_VERIFY_WRITE
2124 /* Send command to read back the data */
2125 chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
2126
2127 if (chip->verify_buf(mtd, buf, mtd->writesize))
2128 return -EIO;
2129
2130 /* Make sure the next page prog is preceded by a status read */
2131 chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
2132#endif
2133 return 0; 2082 return 0;
2134} 2083}
2135 2084
@@ -2804,8 +2753,6 @@ static void nand_set_defaults(struct nand_chip *chip, int busw)
2804 chip->write_buf = busw ? nand_write_buf16 : nand_write_buf; 2753 chip->write_buf = busw ? nand_write_buf16 : nand_write_buf;
2805 if (!chip->read_buf) 2754 if (!chip->read_buf)
2806 chip->read_buf = busw ? nand_read_buf16 : nand_read_buf; 2755 chip->read_buf = busw ? nand_read_buf16 : nand_read_buf;
2807 if (!chip->verify_buf)
2808 chip->verify_buf = busw ? nand_verify_buf16 : nand_verify_buf;
2809 if (!chip->scan_bbt) 2756 if (!chip->scan_bbt)
2810 chip->scan_bbt = nand_default_bbt; 2757 chip->scan_bbt = nand_default_bbt;
2811 2758
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index cf0cd3146817..21e64b5d352b 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -447,8 +447,6 @@ static unsigned int rptwear_cnt = 0;
447/* MTD structure for NAND controller */ 447/* MTD structure for NAND controller */
448static struct mtd_info *nsmtd; 448static struct mtd_info *nsmtd;
449 449
450static u_char ns_verify_buf[NS_LARGEST_PAGE_SIZE];
451
452/* 450/*
453 * Allocate array of page pointers, create slab allocation for an array 451 * Allocate array of page pointers, create slab allocation for an array
454 * and initialize the array by NULL pointers. 452 * 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)
2189 return; 2187 return;
2190} 2188}
2191 2189
2192static int ns_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
2193{
2194 ns_nand_read_buf(mtd, (u_char *)&ns_verify_buf[0], len);
2195
2196 if (!memcmp(buf, &ns_verify_buf[0], len)) {
2197 NS_DBG("verify_buf: the buffer is OK\n");
2198 return 0;
2199 } else {
2200 NS_DBG("verify_buf: the buffer is wrong\n");
2201 return -EFAULT;
2202 }
2203}
2204
2205/* 2190/*
2206 * Module initialization function 2191 * Module initialization function
2207 */ 2192 */
@@ -2236,7 +2221,6 @@ static int __init ns_init_module(void)
2236 chip->dev_ready = ns_device_ready; 2221 chip->dev_ready = ns_device_ready;
2237 chip->write_buf = ns_nand_write_buf; 2222 chip->write_buf = ns_nand_write_buf;
2238 chip->read_buf = ns_nand_read_buf; 2223 chip->read_buf = ns_nand_read_buf;
2239 chip->verify_buf = ns_nand_verify_buf;
2240 chip->read_word = ns_nand_read_word; 2224 chip->read_word = ns_nand_read_word;
2241 chip->ecc.mode = NAND_ECC_SOFT; 2225 chip->ecc.mode = NAND_ECC_SOFT;
2242 /* The NAND_SKIP_BBTSCAN option is necessary for 'overridesize' */ 2226 /* The NAND_SKIP_BBTSCAN option is necessary for 'overridesize' */
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 2b6f632cf274..5fd3f010e3ae 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -140,18 +140,6 @@ static void ndfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
140 out_be32(ndfc->ndfcbase + NDFC_DATA, *p++); 140 out_be32(ndfc->ndfcbase + NDFC_DATA, *p++);
141} 141}
142 142
143static int ndfc_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
144{
145 struct nand_chip *chip = mtd->priv;
146 struct ndfc_controller *ndfc = chip->priv;
147 uint32_t *p = (uint32_t *) buf;
148
149 for(;len > 0; len -= 4)
150 if (*p++ != in_be32(ndfc->ndfcbase + NDFC_DATA))
151 return -EFAULT;
152 return 0;
153}
154
155/* 143/*
156 * Initialize chip structure 144 * Initialize chip structure
157 */ 145 */
@@ -172,7 +160,6 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
172 chip->controller = &ndfc->ndfc_control; 160 chip->controller = &ndfc->ndfc_control;
173 chip->read_buf = ndfc_read_buf; 161 chip->read_buf = ndfc_read_buf;
174 chip->write_buf = ndfc_write_buf; 162 chip->write_buf = ndfc_write_buf;
175 chip->verify_buf = ndfc_verify_buf;
176 chip->ecc.correct = nand_correct_data; 163 chip->ecc.correct = nand_correct_data;
177 chip->ecc.hwctl = ndfc_enable_hwecc; 164 chip->ecc.hwctl = ndfc_enable_hwecc;
178 chip->ecc.calculate = ndfc_calculate_ecc; 165 chip->ecc.calculate = ndfc_calculate_ecc;
diff --git a/drivers/mtd/nand/nuc900_nand.c b/drivers/mtd/nand/nuc900_nand.c
index 8febe46e1105..94dc46bc118c 100644
--- a/drivers/mtd/nand/nuc900_nand.c
+++ b/drivers/mtd/nand/nuc900_nand.c
@@ -112,22 +112,6 @@ static void nuc900_nand_write_buf(struct mtd_info *mtd,
112 write_data_reg(nand, buf[i]); 112 write_data_reg(nand, buf[i]);
113} 113}
114 114
115static int nuc900_verify_buf(struct mtd_info *mtd,
116 const unsigned char *buf, int len)
117{
118 int i;
119 struct nuc900_nand *nand;
120
121 nand = container_of(mtd, struct nuc900_nand, mtd);
122
123 for (i = 0; i < len; i++) {
124 if (buf[i] != (unsigned char)read_data_reg(nand))
125 return -EFAULT;
126 }
127
128 return 0;
129}
130
131static int nuc900_check_rb(struct nuc900_nand *nand) 115static int nuc900_check_rb(struct nuc900_nand *nand)
132{ 116{
133 unsigned int val; 117 unsigned int val;
@@ -292,7 +276,6 @@ static int __devinit nuc900_nand_probe(struct platform_device *pdev)
292 chip->read_byte = nuc900_nand_read_byte; 276 chip->read_byte = nuc900_nand_read_byte;
293 chip->write_buf = nuc900_nand_write_buf; 277 chip->write_buf = nuc900_nand_write_buf;
294 chip->read_buf = nuc900_nand_read_buf; 278 chip->read_buf = nuc900_nand_read_buf;
295 chip->verify_buf = nuc900_verify_buf;
296 chip->chip_delay = 50; 279 chip->chip_delay = 50;
297 chip->options = 0; 280 chip->options = 0;
298 chip->ecc.mode = NAND_ECC_SOFT; 281 chip->ecc.mode = NAND_ECC_SOFT;
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 1ede9fb43430..f47c422c7dfd 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -614,27 +614,6 @@ out_copy:
614} 614}
615 615
616/** 616/**
617 * omap_verify_buf - Verify chip data against buffer
618 * @mtd: MTD device structure
619 * @buf: buffer containing the data to compare
620 * @len: number of bytes to compare
621 */
622static int omap_verify_buf(struct mtd_info *mtd, const u_char * buf, int len)
623{
624 struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
625 mtd);
626 u16 *p = (u16 *) buf;
627
628 len >>= 1;
629 while (len--) {
630 if (*p++ != cpu_to_le16(readw(info->nand.IO_ADDR_R)))
631 return -EFAULT;
632 }
633
634 return 0;
635}
636
637/**
638 * gen_true_ecc - This function will generate true ECC value 617 * gen_true_ecc - This function will generate true ECC value
639 * @ecc_buf: buffer to store ecc code 618 * @ecc_buf: buffer to store ecc code
640 * 619 *
@@ -1285,8 +1264,6 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
1285 goto out_release_mem_region; 1264 goto out_release_mem_region;
1286 } 1265 }
1287 1266
1288 info->nand.verify_buf = omap_verify_buf;
1289
1290 /* select the ecc type */ 1267 /* select the ecc type */
1291 if (pdata->ecc_opt == OMAP_ECC_HAMMING_CODE_DEFAULT) 1268 if (pdata->ecc_opt == OMAP_ECC_HAMMING_CODE_DEFAULT)
1292 info->nand.ecc.mode = NAND_ECC_SOFT; 1269 info->nand.ecc.mode = NAND_ECC_SOFT;
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index e8a1ae97a952..5df91d554dac 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -771,12 +771,6 @@ static void pxa3xx_nand_write_buf(struct mtd_info *mtd,
771 info->buf_start += real_len; 771 info->buf_start += real_len;
772} 772}
773 773
774static int pxa3xx_nand_verify_buf(struct mtd_info *mtd,
775 const uint8_t *buf, int len)
776{
777 return 0;
778}
779
780static void pxa3xx_nand_select_chip(struct mtd_info *mtd, int chip) 774static void pxa3xx_nand_select_chip(struct mtd_info *mtd, int chip)
781{ 775{
782 return; 776 return;
@@ -1069,7 +1063,6 @@ static int alloc_nand_resource(struct platform_device *pdev)
1069 chip->read_byte = pxa3xx_nand_read_byte; 1063 chip->read_byte = pxa3xx_nand_read_byte;
1070 chip->read_buf = pxa3xx_nand_read_buf; 1064 chip->read_buf = pxa3xx_nand_read_buf;
1071 chip->write_buf = pxa3xx_nand_write_buf; 1065 chip->write_buf = pxa3xx_nand_write_buf;
1072 chip->verify_buf = pxa3xx_nand_verify_buf;
1073 } 1066 }
1074 1067
1075 spin_lock_init(&chip->controller->lock); 1068 spin_lock_init(&chip->controller->lock);
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
index 8cb627751c9c..4495f8551fa0 100644
--- a/drivers/mtd/nand/r852.c
+++ b/drivers/mtd/nand/r852.c
@@ -309,27 +309,6 @@ static uint8_t r852_read_byte(struct mtd_info *mtd)
309 return r852_read_reg(dev, R852_DATALINE); 309 return r852_read_reg(dev, R852_DATALINE);
310} 310}
311 311
312
313/*
314 * Readback the buffer to verify it
315 */
316int r852_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
317{
318 struct r852_device *dev = r852_get_dev(mtd);
319
320 /* We can't be sure about anything here... */
321 if (dev->card_unstable)
322 return -1;
323
324 /* This will never happen, unless you wired up a nand chip
325 with > 512 bytes page size to the reader */
326 if (len > SM_SECTOR_SIZE)
327 return 0;
328
329 r852_read_buf(mtd, dev->tmp_buffer, len);
330 return memcmp(buf, dev->tmp_buffer, len);
331}
332
333/* 312/*
334 * Control several chip lines & send commands 313 * Control several chip lines & send commands
335 */ 314 */
@@ -882,7 +861,6 @@ int r852_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
882 chip->read_byte = r852_read_byte; 861 chip->read_byte = r852_read_byte;
883 chip->read_buf = r852_read_buf; 862 chip->read_buf = r852_read_buf;
884 chip->write_buf = r852_write_buf; 863 chip->write_buf = r852_write_buf;
885 chip->verify_buf = r852_verify_buf;
886 864
887 /* ecc */ 865 /* ecc */
888 chip->ecc.mode = NAND_ECC_HW_SYNDROME; 866 chip->ecc.mode = NAND_ECC_HW_SYNDROME;
diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
index 4ff8ef526c02..4fbfe96e37a1 100644
--- a/drivers/mtd/nand/sh_flctl.c
+++ b/drivers/mtd/nand/sh_flctl.c
@@ -786,16 +786,6 @@ static void flctl_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
786 flctl->index += len; 786 flctl->index += len;
787} 787}
788 788
789static int flctl_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
790{
791 int i;
792
793 for (i = 0; i < len; i++)
794 if (buf[i] != flctl_read_byte(mtd))
795 return -EFAULT;
796 return 0;
797}
798
799static int flctl_chip_init_tail(struct mtd_info *mtd) 789static int flctl_chip_init_tail(struct mtd_info *mtd)
800{ 790{
801 struct sh_flctl *flctl = mtd_to_flctl(mtd); 791 struct sh_flctl *flctl = mtd_to_flctl(mtd);
@@ -929,7 +919,6 @@ static int __devinit flctl_probe(struct platform_device *pdev)
929 nand->read_byte = flctl_read_byte; 919 nand->read_byte = flctl_read_byte;
930 nand->write_buf = flctl_write_buf; 920 nand->write_buf = flctl_write_buf;
931 nand->read_buf = flctl_read_buf; 921 nand->read_buf = flctl_read_buf;
932 nand->verify_buf = flctl_verify_buf;
933 nand->select_chip = flctl_select_chip; 922 nand->select_chip = flctl_select_chip;
934 nand->cmdfunc = flctl_cmdfunc; 923 nand->cmdfunc = flctl_cmdfunc;
935 924
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c
index e02b08bcf0c0..f3f28fafbf7a 100644
--- a/drivers/mtd/nand/socrates_nand.c
+++ b/drivers/mtd/nand/socrates_nand.c
@@ -98,24 +98,6 @@ static uint16_t socrates_nand_read_word(struct mtd_info *mtd)
98 return word; 98 return word;
99} 99}
100 100
101/**
102 * socrates_nand_verify_buf - Verify chip data against buffer
103 * @mtd: MTD device structure
104 * @buf: buffer containing the data to compare
105 * @len: number of bytes to compare
106 */
107static int socrates_nand_verify_buf(struct mtd_info *mtd, const u8 *buf,
108 int len)
109{
110 int i;
111
112 for (i = 0; i < len; i++) {
113 if (buf[i] != socrates_nand_read_byte(mtd))
114 return -EFAULT;
115 }
116 return 0;
117}
118
119/* 101/*
120 * Hardware specific access to control-lines 102 * Hardware specific access to control-lines
121 */ 103 */
@@ -201,7 +183,6 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
201 nand_chip->read_word = socrates_nand_read_word; 183 nand_chip->read_word = socrates_nand_read_word;
202 nand_chip->write_buf = socrates_nand_write_buf; 184 nand_chip->write_buf = socrates_nand_write_buf;
203 nand_chip->read_buf = socrates_nand_read_buf; 185 nand_chip->read_buf = socrates_nand_read_buf;
204 nand_chip->verify_buf = socrates_nand_verify_buf;
205 nand_chip->dev_ready = socrates_nand_device_ready; 186 nand_chip->dev_ready = socrates_nand_device_ready;
206 187
207 nand_chip->ecc.mode = NAND_ECC_SOFT; /* enable ECC */ 188 nand_chip->ecc.mode = NAND_ECC_SOFT; /* enable ECC */
diff --git a/drivers/mtd/nand/tmio_nand.c b/drivers/mtd/nand/tmio_nand.c
index 5aa518081c51..508e9e04b092 100644
--- a/drivers/mtd/nand/tmio_nand.c
+++ b/drivers/mtd/nand/tmio_nand.c
@@ -256,18 +256,6 @@ static void tmio_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
256 tmio_ioread16_rep(tmio->fcr + FCR_DATA, buf, len >> 1); 256 tmio_ioread16_rep(tmio->fcr + FCR_DATA, buf, len >> 1);
257} 257}
258 258
259static int
260tmio_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
261{
262 struct tmio_nand *tmio = mtd_to_tmio(mtd);
263 u16 *p = (u16 *) buf;
264
265 for (len >>= 1; len; len--)
266 if (*(p++) != tmio_ioread16(tmio->fcr + FCR_DATA))
267 return -EFAULT;
268 return 0;
269}
270
271static void tmio_nand_enable_hwecc(struct mtd_info *mtd, int mode) 259static void tmio_nand_enable_hwecc(struct mtd_info *mtd, int mode)
272{ 260{
273 struct tmio_nand *tmio = mtd_to_tmio(mtd); 261 struct tmio_nand *tmio = mtd_to_tmio(mtd);
@@ -424,7 +412,6 @@ static int tmio_probe(struct platform_device *dev)
424 nand_chip->read_byte = tmio_nand_read_byte; 412 nand_chip->read_byte = tmio_nand_read_byte;
425 nand_chip->write_buf = tmio_nand_write_buf; 413 nand_chip->write_buf = tmio_nand_write_buf;
426 nand_chip->read_buf = tmio_nand_read_buf; 414 nand_chip->read_buf = tmio_nand_read_buf;
427 nand_chip->verify_buf = tmio_nand_verify_buf;
428 415
429 /* set eccmode using hardware ECC */ 416 /* set eccmode using hardware ECC */
430 nand_chip->ecc.mode = NAND_ECC_HW; 417 nand_chip->ecc.mode = NAND_ECC_HW;
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c
index 26398dcf21cf..e3d7266e256f 100644
--- a/drivers/mtd/nand/txx9ndfmc.c
+++ b/drivers/mtd/nand/txx9ndfmc.c
@@ -131,18 +131,6 @@ static void txx9ndfmc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
131 *buf++ = __raw_readl(ndfdtr); 131 *buf++ = __raw_readl(ndfdtr);
132} 132}
133 133
134static int txx9ndfmc_verify_buf(struct mtd_info *mtd, const uint8_t *buf,
135 int len)
136{
137 struct platform_device *dev = mtd_to_platdev(mtd);
138 void __iomem *ndfdtr = ndregaddr(dev, TXX9_NDFDTR);
139
140 while (len--)
141 if (*buf++ != (uint8_t)__raw_readl(ndfdtr))
142 return -EFAULT;
143 return 0;
144}
145
146static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd, 134static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd,
147 unsigned int ctrl) 135 unsigned int ctrl)
148{ 136{
@@ -346,7 +334,6 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
346 chip->read_byte = txx9ndfmc_read_byte; 334 chip->read_byte = txx9ndfmc_read_byte;
347 chip->read_buf = txx9ndfmc_read_buf; 335 chip->read_buf = txx9ndfmc_read_buf;
348 chip->write_buf = txx9ndfmc_write_buf; 336 chip->write_buf = txx9ndfmc_write_buf;
349 chip->verify_buf = txx9ndfmc_verify_buf;
350 chip->cmd_ctrl = txx9ndfmc_cmd_ctrl; 337 chip->cmd_ctrl = txx9ndfmc_cmd_ctrl;
351 chip->dev_ready = txx9ndfmc_dev_ready; 338 chip->dev_ready = txx9ndfmc_dev_ready;
352 chip->ecc.calculate = txx9ndfmc_calculate_ecc; 339 chip->ecc.calculate = txx9ndfmc_calculate_ecc;
diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
index 9e2dfd517aa5..8dd6ba52404a 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
@@ -346,7 +346,6 @@ static int sm_write_sector(struct sm_ftl *ftl,
346 ret = mtd_write_oob(mtd, sm_mkoffset(ftl, zone, block, boffset), &ops); 346 ret = mtd_write_oob(mtd, sm_mkoffset(ftl, zone, block, boffset), &ops);
347 347
348 /* Now we assume that hardware will catch write bitflip errors */ 348 /* Now we assume that hardware will catch write bitflip errors */
349 /* If you are paranoid, use CONFIG_MTD_NAND_VERIFY_WRITE */
350 349
351 if (ret) { 350 if (ret) {
352 dbg("write to block %d at zone %d, failed with error %d", 351 dbg("write to block %d at zone %d, failed with error %d",
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index eeb70153b646..1d90e4f82bcf 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -394,8 +394,6 @@ struct nand_buffers {
394 * @read_word: [REPLACEABLE] read one word from the chip 394 * @read_word: [REPLACEABLE] read one word from the chip
395 * @write_buf: [REPLACEABLE] write data from the buffer to the chip 395 * @write_buf: [REPLACEABLE] write data from the buffer to the chip
396 * @read_buf: [REPLACEABLE] read data from the chip into the buffer 396 * @read_buf: [REPLACEABLE] read data from the chip into the buffer
397 * @verify_buf: [REPLACEABLE] verify buffer contents against the chip
398 * data.
399 * @select_chip: [REPLACEABLE] select chip nr 397 * @select_chip: [REPLACEABLE] select chip nr
400 * @block_bad: [REPLACEABLE] check, if the block is bad 398 * @block_bad: [REPLACEABLE] check, if the block is bad
401 * @block_markbad: [REPLACEABLE] mark the block bad 399 * @block_markbad: [REPLACEABLE] mark the block bad
@@ -478,7 +476,6 @@ struct nand_chip {
478 u16 (*read_word)(struct mtd_info *mtd); 476 u16 (*read_word)(struct mtd_info *mtd);
479 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); 477 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
480 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); 478 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
481 int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
482 void (*select_chip)(struct mtd_info *mtd, int chip); 479 void (*select_chip)(struct mtd_info *mtd, int chip);
483 int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); 480 int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip);
484 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 481 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);