[PATCH] mtd: nand: gpmi: Add missing nand_read_page_op() in gpmi_ecc_read_subpage()

Boris Brezillon boris.brezillon at free-electrons.com
Mon Jan 22 13:51:48 PST 2018

When a subpage read request accesses the ECC block containing the BBM,
a full page read is required. Commit 25f815f66a14 ("mtd: nand: force
drivers to explicitly send READ/PROG commands") changed the default
behavior by forcing drivers to manually issue the READ0 command.
Unfortunately, the full page read case in gpmi_ecc_read_subpage() has
been omitted and the nand_read_page_op() call has been moved too far
in the function leading to a situation where gpmi_ecc_read_page() is
called without a READ0 command.

Fix that by adding a call to nand_read_page_op() just before calling
gpmi_ecc_read_page() in the "access ECC block containing the BBM" case.

Fixes: 25f815f66a14 ("mtd: nand: force drivers to explicitly send READ/PROG commands")
Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index b51db8c85405..3198f5f79a82 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -1215,6 +1215,7 @@ static int gpmi_ecc_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
 				"page:%d, first:%d, last:%d, marker at:%d\n",
 				page, first, last, marker_pos);
+			nand_read_page_op(chip, page, 0, NULL, 0);
 			return gpmi_ecc_read_page(mtd, chip, buf, 0, page);

More information about the linux-mtd mailing list