public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben-linux@fluff.org>
To: linux-mtd@lists.infradead.org
Cc: Andy Green <andy@warmcat.com>,
	Nelson Castillo <arhuaco@freaks-unidos.net>,
	Ben Dooks <ben-linux@fluff.org>
Subject: [MTD] [NAND] S3C2410: NAND ECC by chip rather than global
Date: Sat, 30 May 2009 18:41:30 +0100	[thread overview]
Message-ID: <1243705298-21814-4-git-send-email-ben-linux@fluff.org> (raw)
In-Reply-To: <1243705298-21814-3-git-send-email-ben-linux@fluff.org>

From: Andy Green <andy@warmcat.com>

This makes us take note about the chosen ECC mode per-chip and
not the one set globally.

Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: Nelson Castillo <arhuaco@freaks-unidos.net>
[ben-linux@fluff.org: andy@openmoko.com => andy@warmcat.com, rewrite subject]
Signed-off-by: Ben Dooks <ben-linux@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;
 	}
 }
 
-- 
1.5.6.5

  reply	other threads:[~2009-05-30 18:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-30 17:41 S3C2410 NAND controller updates Ben Dooks
2009-05-30 17:41 ` [MTD] [NAND] S3C2410: Move to using platform device table Ben Dooks
2009-05-30 17:41   ` [MTD] [NAND] S3C2410: Basic kerneldoc comment updates Ben Dooks
2009-05-30 17:41     ` Ben Dooks [this message]
2009-05-30 17:41       ` [MTD] [NAND] S3C2410: Small colon cleanup Ben Dooks
2009-05-30 17:41         ` [MTD] [NAND] S3C2410: Uninitialised variable cleanup Ben Dooks
2009-05-30 17:41           ` [MTD] [NAND] S3C2410: Fix CFG debug order Ben Dooks
2009-05-30 17:41             ` [MTD] [NAND] S3C2410: Allow commandline partition processing Ben Dooks
2009-05-30 17:41               ` [MTD] [NAND] S3C2410: Added a kerneldoc for s3c2410_nand_set Ben Dooks
2009-05-30 17:41                 ` [MTD] [NAND] S3C2410: Allow the machine code to get the BBT table from NAND Ben Dooks
2009-05-30 17:41                   ` [MTD] [NAND] S3C2410: Deal with unaligned lengths in S3C2440 buffer read/write Ben Dooks
2009-05-30 17:41                     ` [MTD] [NAND] S3C2410: Use DIV_ROUND_UP Ben Dooks
2009-06-02 19:36                 ` [MTD] [NAND] S3C2410: Added a kerneldoc for s3c2410_nand_set Peter Korsgaard
2009-06-02 22:55                   ` Ben Dooks
2009-06-01  5:47   ` [MTD] [NAND] S3C2410: Move to using platform device table Eric Miao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1243705298-21814-4-git-send-email-ben-linux@fluff.org \
    --to=ben-linux@fluff.org \
    --cc=andy@warmcat.com \
    --cc=arhuaco@freaks-unidos.net \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox