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: 45828 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 ozlabs.org (Postfix) with ESMTPS id 52EB7B7CF9 for ; Fri, 19 Feb 2010 10:13:37 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NiFXG-0007Kd-Et; Thu, 18 Feb 2010 23:11:54 +0000 Received: from sdcmail01.amcc.com ([198.137.200.72]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1NiFX9-0007J9-Ri for linux-mtd@lists.infradead.org; Thu, 18 Feb 2010 23:11:52 +0000 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] X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100218_181148_102125_68EEDA86 X-CRM114-Status: UNSURE ( 9.12 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- _SUMMARY_ Cc: Feng Kan X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 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 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; }