[PATCH] nand: gpmc: Handle bitflips in erased pages when using BCH ECC engine

Tom Rini trini at konsulko.com
Mon Jan 17 19:36:17 CET 2022


On Thu, Nov 18, 2021 at 01:25:24PM -0500, David Rivshin wrote:

> From: David Rivshin <DRivshin at allworx.com>
> 
> In the case of an erased (sub)page both the data and ECC are all 0xFF
> bytes. This fails the normal ECC verification, as the computed ECC of
> all-0xFF is not also 0xFF. The GPMC NAND driver attempted to detect
> erased pages by checking that the ECC bytes are all-0xFF, but this had
> two problems:
> 1) bitflips in the data were not corrected, so the data looked not-erased
> 2) bitflips in the ECC bytes were reported as uncorrectable ECC errors
> 
> The equivalent Linux driver [1] correctly handles this by counting the
> number of 0-bits in the combination of data and ECC bytes. If the number
> of 0-bits is less than the amount of bits correctable by the selected
> ECC algorithm, then it is treated as an erased page with correctable
> bitflips.
> 
> Implement similar, though simplified, logic in omap_correct_data_bch().
> 
> [1] see omap_elm_correct_data() in omap2.c
> 
> Signed-off-by: David Rivshin <drivshin at allworx.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220117/56cbb565/attachment.sig>


More information about the U-Boot mailing list