Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: arasan: Check for bitflips in page data & its ECC data
@ 2023-09-26 12:13 Amit Kumar Mahapatra
  2023-09-26 15:00 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Amit Kumar Mahapatra @ 2023-09-26 12:13 UTC (permalink / raw)
  To: miquel.raynal, vigneshr
  Cc: git, michal.simek, richard, boris.brezillon, linux-mtd, akumarma,
	amitrkcian2002, Amit Kumar Mahapatra

During page read in HW-ECC mode the driver checks for bitflips to confirm
that the page is erased one or not, currently this check is only for page
data and not for ECC data of that page. Due to this, in case of ECC
corruption, the driver considers some of the page data as erased page data
and overwrites the valid data with 0xFF. Update the driver to include the
ECC bitflips check along with page data while checking for erased ECC data
chunk.

Fixes: 88ffef1b65cf ("mtd: rawnand: arasan: Support the hardware BCH ECC engine")
Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
---
BRANCH: nand/next
---
 drivers/mtd/nand/raw/arasan-nand-controller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/arasan-nand-controller.c b/drivers/mtd/nand/raw/arasan-nand-controller.c
index 4621ec549cc7..547cc82b5d80 100644
--- a/drivers/mtd/nand/raw/arasan-nand-controller.c
+++ b/drivers/mtd/nand/raw/arasan-nand-controller.c
@@ -481,7 +481,7 @@ static int anfc_read_page_hw_ecc(struct nand_chip *chip, u8 *buf,
 		}
 
 		bf = nand_check_erased_ecc_chunk(raw_buf, chip->ecc.size,
-						 NULL, 0, NULL, 0,
+						 anand->hw_ecc, chip->ecc.bytes, NULL, 0,
 						 chip->ecc.strength);
 		if (bf > 0) {
 			mtd->ecc_stats.corrected += bf;
-- 
2.25.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2023-09-26 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-26 12:13 [PATCH] mtd: rawnand: arasan: Check for bitflips in page data & its ECC data Amit Kumar Mahapatra
2023-09-26 15:00 ` Miquel Raynal

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