From patchwork Sat May 30 17:41:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 27889 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id A8882B7067 for ; Sun, 31 May 2009 19:00:10 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MAgnw-0004we-Vl; Sun, 31 May 2009 08:54:08 +0000 Received: from aeryn.fluff.org.uk ([87.194.8.8] helo=teyla.home.fluff.org) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1MATG4-00023z-Lg for linux-mtd@lists.infradead.org; Sat, 30 May 2009 18:26:23 +0000 Received: from ben by teyla.home.fluff.org with local (Exim 4.69) (envelope-from ) id 1MASYs-0005gM-IL; Sat, 30 May 2009 18:41:38 +0100 From: Ben Dooks To: linux-mtd@lists.infradead.org Subject: [MTD] [NAND] S3C2410: NAND ECC by chip rather than global Date: Sat, 30 May 2009 18:41:30 +0100 Message-Id: <1243705298-21814-4-git-send-email-ben-linux@fluff.org> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1243705298-21814-3-git-send-email-ben-linux@fluff.org> References: <1243705298-21814-1-git-send-email-ben-linux@fluff.org> <1243705298-21814-2-git-send-email-ben-linux@fluff.org> <1243705298-21814-3-git-send-email-ben-linux@fluff.org> X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Sun, 31 May 2009 04:53:59 -0400 Cc: Andy Green , Nelson Castillo , Ben Dooks X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Andy Green This makes us take note about the chosen ECC mode per-chip and not the one set globally. Signed-off-by: Andy Green Signed-off-by: Nelson Castillo [ben-linux@fluff.org: andy@openmoko.com => andy@warmcat.com, rewrite subject] Signed-off-by: Ben Dooks --- 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; } }