[MTD] [NAND] S3C2410 Allow unset ecc to be ignored for ecc correction

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Apr 22 16:59:01 EDT 2008


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=c45c6c68333c04de84c21a4b869f36a96f642779
Commit:     c45c6c68333c04de84c21a4b869f36a96f642779
Parent:     71d54f3855b4ca98559e8782350336ec2433cc24
Author:     Ben Dooks <ben-mtd at fluff.org>
AuthorDate: Tue Apr 15 11:36:20 2008 +0100
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Tue Apr 22 21:41:03 2008 +0100

    [MTD] [NAND] S3C2410 Allow unset ecc to be ignored for ecc correction
    
    If a block's ecc field is all 0xff, then ignore the ECC
    correction. This is for systems where some of the blocks,
    such as the initial cramfs are written without ECC and
    need to be loaded on start.
    
    Signed-off-by: Ben Dooks <ben-linux at fluff.org>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/nand/s3c2410.c      |    8 ++++++++
 include/asm-arm/plat-s3c/nand.h |    2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 15397e0..35401f7 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -357,6 +357,14 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
 	if (diff0 == 0 && diff1 == 0 && diff2 == 0)
 		return 0;		/* ECC is ok */
 
+	/* sometimes people do not think about using the ECC, so check
+	 * to see if we have an 0xff,0xff,0xff read ECC and then ignore
+	 * the error, on the assumption that this is an un-eccd page.
+	 */
+	if (read_ecc[0] == 0xff && read_ecc[1] == 0xff && read_ecc[2] == 0xff
+	    && info->platform->ignore_unset_ecc)
+		return 0;
+
 	/* Can we correct this ECC (ie, one row and column change).
 	 * Note, this is similar to the 256 error code on smartmedia */
 
diff --git a/include/asm-arm/plat-s3c/nand.h b/include/asm-arm/plat-s3c/nand.h
index 8816f7f..ab278d5 100644
--- a/include/asm-arm/plat-s3c/nand.h
+++ b/include/asm-arm/plat-s3c/nand.h
@@ -36,6 +36,8 @@ struct s3c2410_platform_nand {
 	int	twrph0;	/* active time for nWE/nOE */
 	int	twrph1;	/* time for release CLE/ALE from nWE/nOE inactive */
 
+	unsigned int	ignore_unset_ecc : 1;
+
 	int			nr_sets;
 	struct s3c2410_nand_set *sets;
 



More information about the linux-mtd-cvs mailing list