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

markus.stockhausen at gmx.de markus.stockhausen at gmx.de
Sun Aug 24 12:16:39 PDT 2025


> 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)

Even the register is named ECDTAR (ECC Controller DMA TAG 
address register). For me tag (lowercase) is simply additional 
input data that can contain arbitrary content. It can be used
for extended/auxiliary/meta data or simply padding I assume.

Looking at the data on my devices I see that tags are always 
filled with 0xff. So it seems as this gets populated after erasing
data and is never overwritten afterwards.

What naming do you advise?

> > +	oobregion->offset = ctx->steps * RTL_ECC_TAG_SIZE + section * ctx->parity_size;
> > +	oobregion->length = ctx->parity_size;
>
> Please reserve 2 bytes for BBM.
>
> For me it looks like you have a bit free section and a bit ECC
> section. If that simplifies your life, you can just return a single
> section for both.

The first two "tag" bytes seem to be designated for BBM according
to my information. Will adapt the first oob region offset/size.

Do I need to declare the BBM area somehow additionally?

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

Markus




More information about the linux-mtd mailing list