[MTD] [NAND] S3C2410: NAND ECC by chip rather than global

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Jun 8 07:59:01 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=8c3e843d56f74889f3ff32202e82e3bc16d0d552
Commit:     8c3e843d56f74889f3ff32202e82e3bc16d0d552
Parent:     3db72151aa4c246f8bdb8b3501972e1f1b32fe0d
Author:     Andy Green <andy at warmcat.com>
AuthorDate: Sun May 10 15:41:25 2009 -0500
Committer:  Ben Dooks <ben-linux at fluff.org>
CommitDate: Sat May 30 17:54:40 2009 +0100

    [MTD] [NAND] S3C2410: NAND ECC by chip rather than global
    
    This makes us take note about the chosen ECC mode per-chip and
    not the one set globally.
    
    Signed-off-by: Andy Green <andy at warmcat.com>
    Signed-off-by: Nelson Castillo <arhuaco at freaks-unidos.net>
    [ben-linux at fluff.org: andy at openmoko.com => andy at warmcat.com, rewrite subject]
    Signed-off-by: Ben Dooks <ben-linux at fluff.org>
---
 drivers/mtd/nand/s3c2410.c |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index a2d1c70..daa4af9 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -819,6 +819,21 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
 
 	if (set->disable_ecc)
 		chip->ecc.mode	= NAND_ECC_NONE;
+
+	switch (chip->ecc.mode) {
+	case NAND_ECC_NONE:
+		dev_info(info->device, "NAND ECC disabled\n");
+		break;
+	case NAND_ECC_SOFT:
+		dev_info(info->device, "NAND soft ECC\n");
+		break;
+	case NAND_ECC_HW:
+		dev_info(info->device, "NAND hardware ECC\n");
+		break;
+	default:
+		dev_info(info->device, "NAND ECC UNKNOWN\n");
+		break;
+	}
 }
 
 /**
@@ -840,18 +855,19 @@ static void s3c2410_nand_update_chip(struct s3c2410_nand_info *info,
 	dev_dbg(info->device, "chip %p => page shift %d\n",
 		chip, chip->page_shift);
 
-	if (hardware_ecc) {
+	if (chip->ecc.mode != NAND_ECC_HW)
+		return;
+
 		/* change the behaviour depending on wether we are using
 		 * the large or small page nand device */
 
-		if (chip->page_shift > 10) {
-			chip->ecc.size	    = 256;
-			chip->ecc.bytes	    = 3;
-		} else {
-			chip->ecc.size	    = 512;
-			chip->ecc.bytes	    = 3;
-			chip->ecc.layout    = &nand_hw_eccoob;
-		}
+	if (chip->page_shift > 10) {
+		chip->ecc.size	    = 256;
+		chip->ecc.bytes	    = 3;
+	} else {
+		chip->ecc.size	    = 512;
+		chip->ecc.bytes	    = 3;
+		chip->ecc.layout    = &nand_hw_eccoob;
 	}
 }
 



More information about the linux-mtd-cvs mailing list