Skip to content

Commit f693b64

Browse files
Amit Kumar Mahapatramiquelraynal
authored andcommitted
mtd: rawnand: arasan: Include ECC syndrome along with in-band data while checking for ECC failure
Following an ECC failure condition upon page reads, we shall distinguish between a real ECC failure and an empty page. This is handled with a call to nand_check_erased_ecc_chunk() which looks at the data and counts the number of bits which are not 'ones'. If we get less zeros than the ECC strength, we assume the page was erased and we are in the presence of natural bitflips. Otherwise, if we are above, we assume some data was written and the ECC engine could not recover it all, so we report an ECC failure. In order for this logic to be as close as the reality as we can (this is already a simplified condition but we can hardly be more precise), we should check all the data that is covered by the ECC step not only the in-band data, so we should also include the ECC syndrome in the check. Fixes: 88ffef1 ("mtd: rawnand: arasan: Support the hardware BCH ECC engine") Signed-off-by: Amit Kumar Mahapatra <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 48919c6 commit f693b64

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mtd/nand/raw/arasan-nand-controller.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static int anfc_read_page_hw_ecc(struct nand_chip *chip, u8 *buf,
481481
}
482482

483483
bf = nand_check_erased_ecc_chunk(raw_buf, chip->ecc.size,
484-
NULL, 0, NULL, 0,
484+
anand->hw_ecc, chip->ecc.bytes, NULL, 0,
485485
chip->ecc.strength);
486486
if (bf > 0) {
487487
mtd->ecc_stats.corrected += bf;

0 commit comments

Comments
 (0)