Patchwork mtd: nand: Add a NAND_CMD_STATUS when using write verification

login
register
mail settings
Submitter Bastian Hecht
Date April 27, 2012, 10:19 a.m.
Message ID <1335521971-5046-1-git-send-email-hechtb@gmail.com>
Download mbox | patch
Permalink /patch/155458/
State Accepted
Commit 09cbe581e346229e33c48da00439419ff2fe6af7
Headers show

Comments

Bastian Hecht - April 27, 2012, 10:19 a.m.
To make sure the NAND chip is properly programmed we need a status
command before each page write. When CONFIG_MTD_NAND_VERIFY_WRITE=y this
assumption is broken when writing multiple pages consecutively. This
patch fixes this.

Signed-off-by: Bastian Hecht <hechtb@gmail.com>
---
 drivers/mtd/nand/nand_base.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Artem Bityutskiy - April 29, 2012, 5:49 p.m.
On Fri, 2012-04-27 at 12:19 +0200, Bastian Hecht wrote:
> To make sure the NAND chip is properly programmed we need a status
> command before each page write. When CONFIG_MTD_NAND_VERIFY_WRITE=y this
> assumption is broken when writing multiple pages consecutively. This
> patch fixes this.
> 
> Signed-off-by: Bastian Hecht <hechtb@gmail.com>

Pushed to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 8a393f9..58335cd 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2101,6 +2101,9 @@  static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
 
 	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;
 }