[PATCH] mtd: nand: omap: Return corrected bits for BCH

Daniel Schultz d.schultz at phytec.de
Tue Jun 6 08:49:33 PDT 2017


If using ECC mode OMAP_ECC_HAMMING_CODE_HW_ROMCODE (which is default for
all AM335x with DTS support) the page_read function won't return the
corrected bitflips.

Signed-off-by: Daniel Schultz <d.schultz at phytec.de>
---
 drivers/mtd/nand/nand_omap_gpmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c
index e18ce63..05c8486 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -707,10 +707,12 @@ static int omap_gpmc_read_page_bch_rom_mode(struct mtd_info *mtd,
 	__omap_calculate_ecc(mtd, buf, ecc_calc, 1);
 
 	stat = omap_correct_bch(mtd, buf, ecc_code, ecc_calc);
-	if (stat < 0)
+	if (stat < 0) {
 		mtd->ecc_stats.failed++;
-	else
+	} else {
 		mtd->ecc_stats.corrected += stat;
+		return stat;
+	}
 
 	return 0;
 }
-- 
1.9.1




More information about the barebox mailing list