From c1b20e832764e89c1643f0a1356f8a5cb7b5902c Mon Sep 17 00:00:00 2001 From: Michael Hench Date: Tue, 26 Jul 2011 15:07:42 -0500 Subject: [PATCH] --- yaml --- r: 274922 b: refs/heads/master c: f975c6bcb07caacff7fa9904e5d2daa51bcf549d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/mtd/nand/fsl_elbc_nand.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index dfefc8ba01fb..7082e7d6f301 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4aa10626adbc27dcf2e3462bb82b4963c5545669 +refs/heads/master: f975c6bcb07caacff7fa9904e5d2daa51bcf549d diff --git a/trunk/drivers/mtd/nand/fsl_elbc_nand.c b/trunk/drivers/mtd/nand/fsl_elbc_nand.c index acc27ee04749..eedd8ee2c9ac 100644 --- a/trunk/drivers/mtd/nand/fsl_elbc_nand.c +++ b/trunk/drivers/mtd/nand/fsl_elbc_nand.c @@ -243,6 +243,25 @@ static int fsl_elbc_run_command(struct mtd_info *mtd) return -EIO; } + if (chip->ecc.mode != NAND_ECC_HW) + return 0; + + if (elbc_fcm_ctrl->read_bytes == mtd->writesize + mtd->oobsize) { + uint32_t lteccr = in_be32(&lbc->lteccr); + /* + * if command was a full page read and the ELBC + * has the LTECCR register, then bits 12-15 (ppc order) of + * LTECCR indicates which 512 byte sub-pages had fixed errors. + * bits 28-31 are uncorrectable errors, marked elsewhere. + * for small page nand only 1 bit is used. + * if the ELBC doesn't have the lteccr register it reads 0 + */ + if (lteccr & 0x000F000F) + out_be32(&lbc->lteccr, 0x000F000F); /* clear lteccr */ + if (lteccr & 0x000F0000) + mtd->ecc_stats.corrected++; + } + return 0; }