From patchwork Thu Feb 18 23:11:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/1] NDFC: add support for alternate ECC format for ndfc Date: Thu, 18 Feb 2010 13:11:18 -0000 From: fkan@amcc.com X-Patchwork-Id: 45828 Message-Id: <1266534678-30293-1-git-send-email-fkan@amcc.com> To: linux-mtd@lists.infradead.org, linuxppc-dev@ozlabs.org Cc: Feng Kan 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; }