diff mbox

mtd: nand: Add a NAND_CMD_STATUS when using write verification

Message ID 1335521971-5046-1-git-send-email-hechtb@gmail.com
State Accepted
Commit 09cbe581e346229e33c48da00439419ff2fe6af7
Headers show

Commit Message

Bastian Hecht April 27, 2012, 10:19 a.m. UTC
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(-)

Comments

Artem Bityutskiy April 29, 2012, 5:49 p.m. UTC | #1
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!
diff mbox

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;
 }