public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: sunxi: Fix OOB bytes retrieval in read_chunks_dma()
@ 2016-06-15  9:22 Boris Brezillon
  2016-06-20 11:52 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Boris Brezillon @ 2016-06-15  9:22 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, linux-mtd, Boris Brezillon,
	Richard Weinberger
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-sunxi

The column address passed to the RNDOUT operation was missing the page
size offset.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Fixes: 614049a8d904 ("mtd: nand: sunxi: add support for DMA assisted operations")
---
 drivers/mtd/nand/sunxi_nand.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index ea74827..bcdd015 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -1094,7 +1094,8 @@ static int sunxi_nfc_hw_ecc_read_chunks_dma(struct mtd_info *mtd, uint8_t *buf,
 
 		if (oob_required && !erased) {
 			/* TODO: use DMA to retrieve OOB */
-			nand->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_off, -1);
+			nand->cmdfunc(mtd, NAND_CMD_RNDOUT,
+				      mtd->writesize + oob_off, -1);
 			nand->read_buf(mtd, oob, ecc->bytes + 4);
 
 			sunxi_nfc_hw_ecc_get_prot_oob_bytes(mtd, oob, i,
@@ -1129,7 +1130,8 @@ static int sunxi_nfc_hw_ecc_read_chunks_dma(struct mtd_info *mtd, uint8_t *buf,
 			}
 
 			/* TODO: use DMA to retrieve OOB */
-			nand->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_off, -1);
+			nand->cmdfunc(mtd, NAND_CMD_RNDOUT,
+				      mtd->writesize + oob_off, -1);
 			nand->read_buf(mtd, oob, ecc->bytes + 4);
 
 			ret = nand_check_erased_ecc_chunk(data,	ecc->size,
-- 
2.7.4

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

* Re: [PATCH] mtd: nand: sunxi: Fix OOB bytes retrieval in read_chunks_dma()
  2016-06-15  9:22 [PATCH] mtd: nand: sunxi: Fix OOB bytes retrieval in read_chunks_dma() Boris Brezillon
@ 2016-06-20 11:52 ` Boris Brezillon
  0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2016-06-20 11:52 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, linux-mtd, Boris Brezillon,
	Richard Weinberger
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-sunxi

On Wed, 15 Jun 2016 11:22:12 +0200
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> The column address passed to the RNDOUT operation was missing the page
> size offset.
> 

Applied.

> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Fixes: 614049a8d904 ("mtd: nand: sunxi: add support for DMA assisted operations")
> ---
>  drivers/mtd/nand/sunxi_nand.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
> index ea74827..bcdd015 100644
> --- a/drivers/mtd/nand/sunxi_nand.c
> +++ b/drivers/mtd/nand/sunxi_nand.c
> @@ -1094,7 +1094,8 @@ static int sunxi_nfc_hw_ecc_read_chunks_dma(struct mtd_info *mtd, uint8_t *buf,
>  
>  		if (oob_required && !erased) {
>  			/* TODO: use DMA to retrieve OOB */
> -			nand->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_off, -1);
> +			nand->cmdfunc(mtd, NAND_CMD_RNDOUT,
> +				      mtd->writesize + oob_off, -1);
>  			nand->read_buf(mtd, oob, ecc->bytes + 4);
>  
>  			sunxi_nfc_hw_ecc_get_prot_oob_bytes(mtd, oob, i,
> @@ -1129,7 +1130,8 @@ static int sunxi_nfc_hw_ecc_read_chunks_dma(struct mtd_info *mtd, uint8_t *buf,
>  			}
>  
>  			/* TODO: use DMA to retrieve OOB */
> -			nand->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_off, -1);
> +			nand->cmdfunc(mtd, NAND_CMD_RNDOUT,
> +				      mtd->writesize + oob_off, -1);
>  			nand->read_buf(mtd, oob, ecc->bytes + 4);
>  
>  			ret = nand_check_erased_ecc_chunk(data,	ecc->size,

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

end of thread, other threads:[~2016-06-20 11:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-15  9:22 [PATCH] mtd: nand: sunxi: Fix OOB bytes retrieval in read_chunks_dma() Boris Brezillon
2016-06-20 11:52 ` Boris Brezillon

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