linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mtd: nand: sunxi: fix sunxi_nfc_hw_ecc_read/write_chunk()
@ 2015-10-20 20:16 Boris Brezillon
  2015-10-20 20:16 ` [PATCH 2/2] mtd: nand: sunxi: avoid retrieving data before ECC pass Boris Brezillon
  2015-11-02 20:55 ` [PATCH 1/2] mtd: nand: sunxi: fix sunxi_nfc_hw_ecc_read/write_chunk() Brian Norris
  0 siblings, 2 replies; 3+ messages in thread
From: Boris Brezillon @ 2015-10-20 20:16 UTC (permalink / raw)
  To: linux-arm-kernel

The sunxi_nfc_hw_ecc_read/write_chunk() functions try to avoid changing
the column address if unnecessary, but the logic to determine whether it's
necessary or not is currently wrong: it adds the ecc->bytes value to the
current offset where it should actually add ecc->size.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Fixes 913821bdd211 "mtd: nand: sunxi: introduce sunxi_nfc_hw_ecc_read/write_chunk()"
---
 drivers/mtd/nand/sunxi_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index ef46ac6..96f7370 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -588,7 +588,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,
 
 	sunxi_nfc_read_buf(mtd, data, ecc->size);
 
-	if (data_off + ecc->bytes != oob_off)
+	if (data_off + ecc->size != oob_off)
 		nand->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_off, -1);
 
 	ret = sunxi_nfc_wait_cmd_fifo_empty(nfc);
@@ -679,7 +679,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd,
 	writel(sunxi_nfc_buf_to_user_data(oob),
 	       nfc->regs + NFC_REG_USER_DATA(0));
 
-	if (data_off + ecc->bytes != oob_off)
+	if (data_off + ecc->size != oob_off)
 		nand->cmdfunc(mtd, NAND_CMD_RNDIN, oob_off, -1);
 
 	ret = sunxi_nfc_wait_cmd_fifo_empty(nfc);
-- 
2.1.4

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

* [PATCH 2/2] mtd: nand: sunxi: avoid retrieving data before ECC pass
  2015-10-20 20:16 [PATCH 1/2] mtd: nand: sunxi: fix sunxi_nfc_hw_ecc_read/write_chunk() Boris Brezillon
@ 2015-10-20 20:16 ` Boris Brezillon
  2015-11-02 20:55 ` [PATCH 1/2] mtd: nand: sunxi: fix sunxi_nfc_hw_ecc_read/write_chunk() Brian Norris
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2015-10-20 20:16 UTC (permalink / raw)
  To: linux-arm-kernel

The in-band data are copied twice: before ECC correction and after the
ECC engine has fixed all the fixable bitflips.
Drop the useless memcpy_fromio operation by passing a NULL pointer when
calling sunxi_nfc_read_buf().

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
 drivers/mtd/nand/sunxi_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 96f7370..8247118 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -586,7 +586,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,
 	if (*cur_off != data_off)
 		nand->cmdfunc(mtd, NAND_CMD_RNDOUT, data_off, -1);
 
-	sunxi_nfc_read_buf(mtd, data, ecc->size);
+	sunxi_nfc_read_buf(mtd, NULL, ecc->size);
 
 	if (data_off + ecc->size != oob_off)
 		nand->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_off, -1);
-- 
2.1.4

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

* [PATCH 1/2] mtd: nand: sunxi: fix sunxi_nfc_hw_ecc_read/write_chunk()
  2015-10-20 20:16 [PATCH 1/2] mtd: nand: sunxi: fix sunxi_nfc_hw_ecc_read/write_chunk() Boris Brezillon
  2015-10-20 20:16 ` [PATCH 2/2] mtd: nand: sunxi: avoid retrieving data before ECC pass Boris Brezillon
@ 2015-11-02 20:55 ` Brian Norris
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Norris @ 2015-11-02 20:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Oct 20, 2015 at 10:16:00PM +0200, Boris Brezillon wrote:
> The sunxi_nfc_hw_ecc_read/write_chunk() functions try to avoid changing
> the column address if unnecessary, but the logic to determine whether it's
> necessary or not is currently wrong: it adds the ecc->bytes value to the
> current offset where it should actually add ecc->size.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Fixes 913821bdd211 "mtd: nand: sunxi: introduce sunxi_nfc_hw_ecc_read/write_chunk()"

Pushed both to l2-mtd.git

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

end of thread, other threads:[~2015-11-02 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-20 20:16 [PATCH 1/2] mtd: nand: sunxi: fix sunxi_nfc_hw_ecc_read/write_chunk() Boris Brezillon
2015-10-20 20:16 ` [PATCH 2/2] mtd: nand: sunxi: avoid retrieving data before ECC pass Boris Brezillon
2015-11-02 20:55 ` [PATCH 1/2] mtd: nand: sunxi: fix sunxi_nfc_hw_ecc_read/write_chunk() Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).