All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/5] nand: Use common read function instead of verify_buf()
@ 2015-01-26 22:24 Peter Tyser
  2015-01-26 22:24 ` [U-Boot] [PATCH 2/5] mtd: davinci_nand: " Peter Tyser
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Peter Tyser @ 2015-01-26 22:24 UTC (permalink / raw)
  To: u-boot

The driver-specific verify_buf() function can be replaced with the
standard read_page_raw() function to verify writes.  This will allow
verify_buf() to be removed from individual drivers.  verify_buf() is no
longer supported in mainline Linux, so it is a pain to continue
supporting.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
---

 drivers/mtd/nand/nand_base.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 63bdf65..788846a 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2394,6 +2394,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
 		int oob_required, int page, int cached, int raw)
 {
 	int status, subpage;
+	__maybe_unused uint8_t *vfy_buf;
 
 	if (!(chip->options & NAND_NO_SUBPAGE_WRITE) &&
 		chip->ecc.write_subpage)
@@ -2443,10 +2444,19 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
 
 #ifdef __UBOOT__
 #if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
+	vfy_buf = malloc(mtd->writesize);
+	if (!vfy_buf)
+		return -ENOMEM;
+
 	/* Send command to read back the data */
 	chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
+	chip->ecc.read_page_raw(mtd, chip, vfy_buf, oob_required, page);
+
+	status = memcmp(buf, vfy_buf, mtd->writesize);
 
-	if (chip->verify_buf(mtd, buf, mtd->writesize))
+	free(vfy_buf);
+
+	if (status)
 		return -EIO;
 
 	/* Make sure the next page prog is preceded by a status read */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-01-30  0:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 22:24 [U-Boot] [PATCH 1/5] nand: Use common read function instead of verify_buf() Peter Tyser
2015-01-26 22:24 ` [U-Boot] [PATCH 2/5] mtd: davinci_nand: " Peter Tyser
2015-01-26 22:24 ` [U-Boot] [PATCH 3/5] mtd: nand: Remove nand_verify_buf() function Peter Tyser
2015-01-26 22:24 ` [U-Boot] [PATCH 4/5] mtd: nand: Use ECC for NAND write verification Peter Tyser
2015-01-26 22:24 ` [U-Boot] [PATCH 5/5] mtd: davinci " Peter Tyser
2015-01-26 22:33 ` [U-Boot] [PATCH 1/5] nand: Use common read function instead of verify_buf() Scott Wood
2015-01-26 23:17   ` Peter Tyser
2015-01-27  1:25     ` Scott Wood
2015-01-27 23:47       ` Peter Tyser
2015-01-29 23:02         ` Scott Wood
2015-01-29 23:37           ` Peter Tyser
2015-01-30  0:58             ` Scott Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.