]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mtd: nand: fix ECC Correction bug for SMC ordering for NDFC driver
authorFeng Kan <fkan@amcc.com>
Tue, 25 Aug 2009 18:27:20 +0000 (11:27 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Oct 2009 16:31:51 +0000 (09:31 -0700)
commitcb5cef6bfc6e635f06cce182d76a1682176c0df5
treede0905d37a6c00749a61dd1eaaee625386e57980
parenta9e31b939c86bc6cb6989ed542ff5b3c77446e0d
mtd: nand: fix ECC Correction bug for SMC ordering for NDFC driver

commit 76c23c32e3b3ad48e07e07897075ab19ae1ef117 upstream.

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.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/mtd/nand/ndfc.c