abuse of nand_correct_data in tmio_nand driver
vimal.newwork at gmail.com
Mon Jul 20 01:15:20 EDT 2009
On Sun, Jul 19, 2009 at 9:38 PM, Dmitry
Eremin-Solenikov<dbaryshkov at gmail.com> wrote:
> 2009/7/19, Atsushi Nemoto <anemo at mba.ocn.ne.jp>:
>> On Sun, 19 Jul 2009 04:11:27 +0400, Dmitry Eremin-Solenikov
>> <dbaryshkov at gmail.com> wrote:
>>> > The current nand_correct_data() can be used for ecc.bytes = 3 case
>>> > only. The tmio_nand driver uses ecc.bytes = 6.
>>> IIRC, tmio_nand driver accesses two ecc "sectors" at once, so this is
>>> most probably ok. I'll look into it though, when I have some time.
>> Yes, tmio_nand driver read 512 byte data and calculate 6 byte ecc at
>> once, but nand_correct_data only references first 3 byte of ecc.
>> I doubt the driver cannot detect errors in the second 256 byte sector
>> of the 512 byte block.
Seems like this driver may be reading 512 bytes at a times, but still
calculates 256-byte sector ECC. (1-bit error correction for each 256
bytes of data).
In that case, nand_correct_data() should be called twice, once for
each 256 byte data.
This can be handled by overriding 'chip->ecc.correct' in driver. You
may reuse 'nand_correct_data()' code in the driver of 256 byte sector
> Hmm. That's strange: nand_correct_data() seems to support 512-byte sectors,
> however it assumes that ECC is still 3 bytes. I'll have to check specs to see
> who is wrong...
Yes, nand_correct_data() supports 512-byte sector ECC. 3 bytes of ECC
are not assumed one, but are required by Hamming algo for 512 byte
sector. Which gives 1 bit error correction capability over 512 bytes
> With best wishes
> Linux MTD discussion mailing list
\/ | |\/| /-\ |_
----- ( )/ ( )
More information about the linux-mtd