From patchwork Thu Feb 18 23:11:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fkan@amcc.com X-Patchwork-Id: 45829 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 35E86B8033 for ; Fri, 19 Feb 2010 10:25:39 +1100 (EST) Received: by ozlabs.org (Postfix) id 5B6D7B7CF9; Fri, 19 Feb 2010 10:25:32 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org X-Greylist: delayed 823 seconds by postgrey-1.32 at bilbo; Fri, 19 Feb 2010 10:25:31 EST Received: from sdcmail01.amcc.com (sdcmail01.amcc.com [198.137.200.72]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "Messaging Gateway Appliance Demo Cert", Issuer "Messaging Gateway Appliance Demo Cert" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D34F5B7CCD for ; Fri, 19 Feb 2010 10:25:31 +1100 (EST) X-IronPort-AV: E=Sophos;i="4.49,499,1262592000"; d="scan'208";a="25206275" Received: from sdcexch01.amcc.com (HELO sdcexchange01.amcc.com) ([10.64.18.50]) by sdcmail01-int1.amcc.com with ESMTP; 18 Feb 2010 15:11:19 -0800 Received: from amcc.com ([10.66.12.74]) by sdcexchange01.amcc.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Feb 2010 15:11:18 -0800 Received: (from fkan@localhost) by amcc.com (8.13.8/8.12.2/Submit) id o1INBIHI030313; Thu, 18 Feb 2010 15:11:18 -0800 From: Feng Kan To: linux-mtd@lists.infradead.org, linuxppc-dev@ozlabs.org Subject: [PATCH 1/1] NDFC: add support for alternate ECC format for ndfc Date: Thu, 18 Feb 2010 15:11:18 -0800 Message-Id: <1266534678-30293-1-git-send-email-fkan@amcc.com> X-Mailer: git-send-email 1.5.5 X-OriginalArrivalTime: 18 Feb 2010 23:11:18.0771 (UTC) FILETIME=[AD7B9430:01CAB0EF] Cc: Feng Kan X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org This is to lock down the ordering in the correction routine against the calculate routine. Otherwise, incorrect define would cause ECC errors. Signed-off-by: Feng Kan Acked-by: Victor Gallardo --- drivers/mtd/nand/ndfc.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index 40b5658..fc1f0ff 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c @@ -102,10 +102,15 @@ static int ndfc_calculate_ecc(struct mtd_info *mtd, wmb(); ecc = in_be32(ndfc->ndfcbase + NDFC_ECC); /* The NDFC uses Smart Media (SMC) bytes order */ +#ifdef CONFIG_MTD_NAND_ECC_SMC ecc_code[0] = p[1]; ecc_code[1] = p[2]; ecc_code[2] = p[3]; +#else + ecc_code[0] = p[2]; + ecc_code[1] = p[1]; + ecc_code[2] = p[3]; +#endif return 0; }