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.

The driver should not blindly check the 'cs ==0' condition but instead
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