Re: [PATCH 2/3] mtd: rawnand: sunxi: support randomized OOB formats
From: Miquel Raynal
Date: Fri Sep 04 2026 - 13:26:27 EST
On 04/09/2026 at 11:17:46 -04, James Hilliard <james.hilliard1@xxxxxxxxx> wrote:
> On Fri, Sep 4, 2026 at 8:42 AM Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:
>>
>> On 10/08/2026 at 17:04:50 -06, James Hilliard <james.hilliard1@xxxxxxxxx> wrote:
>>
>> > The controller randomizer covers the bad block marker along with the
>> > rest of the OOB data. The driver currently compensates the marker bytes
>> > before writes and after reads so that they remain plain on flash.
>> >
>> > Allwinner NAND firmware instead stores the marker through the
>> > randomizer. Media using that format appears to contain bad blocks unless
>> > the randomizer is enabled while reading the marker.
>> >
>> > Honor the allwinner,randomized-oob property by unconditionally enabling
>> > page scrambling and leaving the marker in the randomizer data stream.
>> > Keep the existing plain marker behavior when the property is absent.
>> > This changes marker handling on all supported controllers; the H6/H616
>> > protected user-data placement is handled separately.
>>
>> But I think the reason why this has never been done is because it just
>> breaks raw accesses, including the BBT reads. I don't think this is
>> handled, is it?
>
> From my understanding raw access bypasses randomization entirely.
yes, so the implementation you propose is invalid, raw reads shall
show the BBM. And also, when accessing a BBT, it is made in raw mode,
without randomization, and hence totally fail. This cannot fly!