[PATCH 5/5] nand omap: handle erased pages correctly in hamming ecc mode

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 11 10:10:36 EDT 2011


do not throw ecc errors on erased pages.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mtd/nand/nand_omap_gpmc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c
index d61f7d9..9d375aa 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -377,6 +377,11 @@ static int omap_correct_data(struct mtd_info *mtd, uint8_t *dat,
 
 	switch (oinfo->ecc_mode) {
 	case OMAP_ECC_HAMMING_CODE_HW_ROMCODE:
+		if (read_ecc[0] == 0xff && read_ecc[1] == 0xff &&
+				read_ecc[2] == 0xff && calc_ecc[0] == 0x0 &&
+				calc_ecc[1] == 0x0 && calc_ecc[0] == 0x0)
+			break;
+
 		/* Regenerate the orginal ECC */
 		orig_ecc = gen_true_ecc(read_ecc);
 		new_ecc = gen_true_ecc(calc_ecc);
-- 
1.7.2.3




More information about the barebox mailing list