AW: [PATCH v2 2/2] mtd: nand: realtek-ecc: Add Realtek external ECC engine support

Miquel Raynal miquel.raynal at bootlin.com
Wed Sep 10 09:00:40 PDT 2025


On 10/09/2025 at 17:48:20 +02, <markus.stockhausen at gmx.de> wrote:

>> Von: Miquel Raynal <miquel.raynal at bootlin.com> 
>> Gesendet: Mittwoch, 10. September 2025 10:43
>>
>> > +	ret = FIELD_GET(RTL_ECC_RESULT, status);
>> > +	all_one = FIELD_GET(RTL_ECC_ALL_ONE, status);
>>
>> Maybe you should check whether all_one remains true if there are
>> correctable bitflips in your buffer (you may use nandflipbits for that
>> purpose). If not, you shall probably spend extra time when checking for
>> ret checking if there are less bitflips than the ECC controller can
>> correct compared to ones in the *entire* buffer, which would indicate
>> that you are really in the presence of an erased page, see:
>> https://elixir.bootlin.com/linux/v6.16.5/source/drivers/mtd/nand/raw/nand_base.c#L2841
>>
>> This helper may be moved if you need it.
>
> ECC engine cannot handle bitflips in erased blocks.
> Seems as this helper really can increase robustness
> in this case. I will make use of it in the next version.
>
> What do you mean by "can be moved"?

It is part of the raw NAND subsystem and is not a NAND wide helper,
ie. it is not available for SPI NANDs nor NAND ECC engines. The herlper
is already device agnostic, so you might just need to moeve it out of
mtd/nand/raw/nand_base.c. Perhaps you can put it into mtd/nand/core.c or
whatever other place you see fit.

Cheers,
Miquèl



More information about the linux-mtd mailing list