aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/ndfc.c
diff options
context:
space:
mode:
authorFeng Kan <fkan@amcc.com>2009-08-25 14:27:20 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-09-19 17:15:00 -0400
commit76c23c32e3b3ad48e07e07897075ab19ae1ef117 (patch)
tree0ed6a6b459b116b6dc06cf5f6725b65826cad97e /drivers/mtd/nand/ndfc.c
parentebd5a74db74ee2db833d43ea35108a4be9cab42f (diff)
mtd: nand: fix ECC Correction bug for SMC ordering for NDFC driver
Fix ECC Correction bug where the byte offset location were double fliped causing correction routine to toggle the wrong byte location in the ECC segment. The ndfc_calculate_ecc routine change the order of getting the ECC code. /* The NDFC uses Smart Media (SMC) bytes order */ ecc_code[0] = p[2]; ecc_code[1] = p[1]; ecc_code[2] = p[3]; But in the Correction algorithm when calculating the byte offset location, the b1 is used as the upper part of the address. Which again reverse the order making the final byte offset address location incorrect. byte_addr = (addressbits[b1] << 4) + addressbits[b0]; The order is change to read it in straight and let the correction function to revert it to SMC order. Cc: stable@kernel.org Signed-off-by: Feng Kan <fkan@amcc.com> Acked-by: Victor Gallardo <vgallardo@amcc.com> Acked-by: Prodyut Hazarika <phazarika@amcc.com> Acked-by: Stefan Roese <sr@denx.de> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/ndfc.c')
-rw-r--r--drivers/mtd/nand/ndfc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 89bf85af642c..40b5658bdbe6 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -102,8 +102,8 @@ static int ndfc_calculate_ecc(struct mtd_info *mtd,
102 wmb(); 102 wmb();
103 ecc = in_be32(ndfc->ndfcbase + NDFC_ECC); 103 ecc = in_be32(ndfc->ndfcbase + NDFC_ECC);
104 /* The NDFC uses Smart Media (SMC) bytes order */ 104 /* The NDFC uses Smart Media (SMC) bytes order */
105 ecc_code[0] = p[2]; 105 ecc_code[0] = p[1];
106 ecc_code[1] = p[1]; 106 ecc_code[1] = p[2];
107 ecc_code[2] = p[3]; 107 ecc_code[2] = p[3];
108 108
109 return 0; 109 return 0;