public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: gpmi: Add missing nand_read_page_op() in gpmi_ecc_read_subpage()
@ 2018-01-22 21:51 Boris Brezillon
  2018-01-22 22:48 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Boris Brezillon @ 2018-01-22 21:51 UTC (permalink / raw)
  To: Boris Brezillon, Richard Weinberger, linux-mtd
  Cc: David Woodhouse, Brian Norris, Marek Vasut, Cyrille Pitchen,
	Han Xu, Miquel Raynal

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@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,
 			dev_dbg(this->dev,
 				"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);
 		}
 	}
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: nand: gpmi: Add missing nand_read_page_op() in gpmi_ecc_read_subpage()
  2018-01-22 21:51 [PATCH] mtd: nand: gpmi: Add missing nand_read_page_op() in gpmi_ecc_read_subpage() Boris Brezillon
@ 2018-01-22 22:48 ` Boris Brezillon
  0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2018-01-22 22:48 UTC (permalink / raw)
  To: Boris Brezillon, Richard Weinberger, linux-mtd
  Cc: David Woodhouse, Brian Norris, Marek Vasut, Cyrille Pitchen,
	Han Xu, Miquel Raynal

On Mon, 22 Jan 2018 22:51:48 +0100
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> 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@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,
>  			dev_dbg(this->dev,
>  				"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);

Please ignore this patch: nand_read_page_op() is already called from
gpmi_ecc_read_page().

>  		}
>  	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-22 22:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-22 21:51 [PATCH] mtd: nand: gpmi: Add missing nand_read_page_op() in gpmi_ecc_read_subpage() Boris Brezillon
2018-01-22 22:48 ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox