Re: [PATCH] MTD: fix s3c2410 error correction

Matt Reimer
2007-11-06T22:35:12Z

On 11/6/07, Jörn Engel <joern@logfs.org> wrote:
> On Tue, 6 November 2007 09:09:00 -0800, Matt Reimer wrote:
> >
> > ping
>
> Ben doesn't seem to comment on this, so I will. And I must say, I don't
> like the function either before or after your patch.
>
> 1. In principle this is just the bog-standard 1-bit error correction
> code everyone and his dog is using.
> 2. The original version of this function is subtly different from
> nand_correct_data(). 12 of the constants are off-by-one. But no
> explanation why.
> 3. After your patch the bit-position constants are back to original, the
> 0x54 remains 0x55, half the byte-position constants are back to
> original and the other half that were identical are off-by-one now.
> Still no explanation why.
>
> So my first question is not whether your patch is correct or not, but
> what makes s3c2410 so different from all the other bog-standard ecc
> schemes?

The explanation is that the s3c hardware ECC gives us the bits in that
order, and this order is what Samsung recommends.

"For more information, compare the s3c2440a or s3c2410 manuals with
page 8 of the following documentation:
http://www.samsung.com/global/business/semiconductor/products/flash/downloads/applicationnote/ecc_algorithm_for_web_512b.pdf"

> Side note:
> The last conditional in both functions,
> if ((diff0 & ~(1<<fls(diff0))) == 0)
> can be replaced by is_power_of_2().

Thanks, that makes it much more readable.

Matt