Hello Miquel

On 7/24/26 11:26, Miquel Raynal wrote:
On 22/07/2026 at 11:16:20 +02, Johan Jonker <[email protected]> wrote:

Changed References:
Added Linux MTD maintainers. Question below.

Hi,

On 7/22/26 00:56, Boogie wrote:
Hello Quentin

I had reported this bug to Johan so i can give detailed explanation.

The bug was really the lock of "&& nfc->selected_bank == 0" not existing for 
write_page_* variants.

When rockchip nfc was reading, it required bootblks to be a part of
the first nand chip only with the condition "nfc->selected_bank ==
0". But when writing it interpreted 'all' nand chips first boot_blks
as boot blocks.

The practical problem. I had mentioned this in V1 and give more explicit 
details here.

I have 2 nand chips, and a partition (linux below) starts in nand
chip 1 (CS=0 in below) and ends in chip2 (CS=2 below). And i am using
UBI on top of that mtd.
nand@0 {
     reg = <0>, <2>;
     label = "rk-nand-0";
     nand-bus-width = <8>;
     nand-ecc-mode = "hw";
     nand-ecc-step-size = <1024>;
     nand-ecc-strength = <40>;

     nand-is-boot-medium;

What you may want is to declare the NAND using two different nodes, then
use mtd-virt-concat to generate one bigger MTD device spanning across
the two devices.

Thats also an option but i prefer this way to be more straight forward since entire partition layout can be kept in dts.


The driver should not blindly check the 'cs ==0' condition but instead

I think my statement was also not accurate, i think the brom at least for 3066 should check only the first chip which has the least cs so nfc->selected_bank == 0. This could have been validated easily by erasing boot blocks in both chips and writing an idb to 2nd chip deliberately and check if the 3066 would boot or not. But i think i burned gpios in my board while messing with the shorting nand chips, 2nd chip is RIP. so i cant test this anymore unfortunately. In any case current working way of rockchip_nfc in mainline linux is also fine. If somehow those low eccs create problem, they can be marked as bad anyways.

But thanks for your input.

also take nand-is-boot-medium into account (which would then only be
required in the NAND chip with the said boot partition) to make sure the
special handling is only applied on the boot partition.

Hope that helps.

Thanks,
Miquèl

Reply via email to