summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/nand_micron.c
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2017-05-16 19:27:49 +0300
committerBoris Brezillon <boris.brezillon@free-electrons.com>2017-06-01 11:09:33 +0300
commit41145649f4acb30249b636b945053db50c9331c5 (patch)
tree0d1a10e2aae6967ac3401f2217f3f5e8019985dd /drivers/mtd/nand/nand_micron.c
parenta186493237a9d8559997c2f97c33c4716d602fd2 (diff)
downloadlinux-41145649f4acb30249b636b945053db50c9331c5.tar.xz
mtd: nand: Wait for PAGEPROG to finish in drivers setting NAND_ECC_CUSTOM_PAGE_ACCESS
Drivers setting NAND_ECC_CUSTOM_PAGE_ACCESS are supposed to handle the full read/write page sequence, and waiting for a page to actually be programmed is part of this write-page sequence. This is also what is done in ->write_oob_xxx() hooks, so let's do that in ->write_page_xxx() as well to make it consistent. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'drivers/mtd/nand/nand_micron.c')
-rw-r--r--drivers/mtd/nand/nand_micron.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand_micron.c b/drivers/mtd/nand/nand_micron.c
index 9993f8ead1e2..c30ab60f8e1b 100644
--- a/drivers/mtd/nand/nand_micron.c
+++ b/drivers/mtd/nand/nand_micron.c
@@ -151,15 +151,18 @@ micron_nand_write_page_on_die_ecc(struct mtd_info *mtd, struct nand_chip *chip,
const uint8_t *buf, int oob_required,
int page)
{
+ int status;
+
micron_nand_on_die_ecc_setup(chip, true);
chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page);
nand_write_page_raw(mtd, chip, buf, oob_required, page);
chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
+ status = chip->waitfunc(mtd, chip);
micron_nand_on_die_ecc_setup(chip, false);
- return 0;
+ return status & NAND_STATUS_FAIL ? -EIO : 0;
}
static int
@@ -180,11 +183,14 @@ micron_nand_write_page_raw_on_die_ecc(struct mtd_info *mtd,
const uint8_t *buf, int oob_required,
int page)
{
+ int status;
+
chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page);
nand_write_page_raw(mtd, chip, buf, oob_required, page);
chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
+ status = chip->waitfunc(mtd, chip);
- return 0;
+ return status & NAND_STATUS_FAIL ? -EIO : 0;
}
enum {