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

Miquel Raynal miquel.raynal at bootlin.com
Thu Aug 28 03:07:02 PDT 2025


Hi Markus,

On 24/08/2025 at 21:16:39 +02, <markus.stockhausen at gmx.de> wrote:

>> Von: Miquel Raynal <miquel.raynal at bootlin.com> 
>> Gesendet: Sonntag, 24. August 2025 18:51
>> ...
>> +/*
>> + * The Realtek ECC engine has two operation modes.
>> + *
>> + * - BCH6 : Generate 10 ECC bytes from 512 data bytes plus 6 tag bytes
>> + * - BCH12: Generate 20 ECC bytes from 512 data bytes plus 6 tag bytes
>>
>> What is a tag? I believe it is Realtek wording and we need to find a
>> more generic translation.
>
> I have no real idea. They simply call it "tag". To be more precise
>
> - tag (lowercase): means 6 oob bytes for one 512 byte block
> - syndrome: means 10 ECC bytes for one 512 byte block.
> - TAG (uppercase): means 16 oob bytes (tag+syndrome)

Ok. Based on your feedback, I believe that might be what we more
commonly call "free bytes". "free" as in "available for the user". In the
OOB area you'll mostly find:
- 2 bytes reserved by MTD to store bad block markers
- Bytes available for the user (end user, or more commonly upper layers
  and filesystems. jffs2 does use these free bytes, whereas UBI does not.
    * your "tag" and "TAG", difference is probably that "tag" is not ECC
      protected (subject to bitflip) whereas "TAG" is part of the
      protected area and will be corrected if needed.
- Bytes not available for the user, ie. ECC bytes, which we are being
  read/written at a fixed offset by the ECC engine.

> Do I need to declare the BBM area somehow additionally?

No, they are not user accessible nor ECC bytes. They are not exposed by
the ooblayout callbacks we are discussing.

> Thanks for the other feedback. Will implement that in v2.

Cheers!

Good luck,
Miquèl



More information about the linux-mtd mailing list