From patchwork Thu Feb 18 23:10:43 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: 45827 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 D109BB7CE2 for ; Fri, 19 Feb 2010 10:13:08 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NiFWI-0007E5-KJ; Thu, 18 Feb 2010 23:10:54 +0000 Received: from sdcmail02.amcc.com ([198.137.200.90]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1NiFWB-0007C6-6u for linux-mtd@lists.infradead.org; Thu, 18 Feb 2010 23:10:52 +0000 X-IronPort-AV: E=Sophos;i="4.49,499,1262592000"; d="scan'208";a="7302295" Received: from sdcexch01.amcc.com (HELO sdcexchange01.amcc.com) ([10.64.18.50]) by sdcmail02-int1.amcc.com with ESMTP; 18 Feb 2010 15:10:44 -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:10:43 -0800 Received: (from fkan@localhost) by amcc.com (8.13.8/8.12.2/Submit) id o1INAhJn030281; Thu, 18 Feb 2010 15:10:43 -0800 From: Feng Kan To: linux-mtd@lists.infradead.org, linuxppc-embedded@ozlabs.org Subject: [PATCH 1/1] NDFC: add support for alternate ECC format for ndfc Date: Thu, 18 Feb 2010 15:10:43 -0800 Message-Id: <1266534643-30261-1-git-send-email-fkan@amcc.com> X-Mailer: git-send-email 1.5.5 X-OriginalArrivalTime: 18 Feb 2010 23:10:44.0146 (UTC) FILETIME=[98D83920:01CAB0EF] X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100218_181047_475102_27A5520F X-CRM114-Status: UNSURE ( 7.77 ) 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; }