[U-Boot] [PATCH 1/5] nand: Use common read function instead of verify_buf()
Peter Tyser
ptyser at xes-inc.com
Mon Jan 26 23:24:47 CET 2015
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 at 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
More information about the U-Boot
mailing list