[PATCH v3 02/10] ARM: dts: broadcom: bcmbca: Add NAND controller node

William Zhang william.zhang at broadcom.com
Thu Jan 25 10:14:26 PST 2024


Hi Miquel,

On 1/25/24 01:20, Miquel Raynal wrote:
> Hi William,
> 
>>>>>> +        nand_controller: nand-controller at 1800 {
>>>>>> +            #address-cells = <1>;
>>>>>> +            #size-cells = <0>;
>>>>>> +            compatible = "brcm,nand-bcm63138", >>>> "brcm,brcmnand-v7.1", "brcm,brcmnand";
>>>>>> +            reg = <0x1800 0x600>, <0x2000 0x10>;
>>>>>> +            reg-names = "nand", "nand-int-base";
>>>>>> +            brcm,nand-use-wp = <0>;
>>>>>> +            status = "disabled";
>>>>>> +
>>>>>> +            nandcs: nand at 0 {
>>>>>> +                compatible = "brcm,nandcs";
>>>>>> +                reg = <0>;
>>>>>> +                nand-on-flash-bbt;
>>>>>> +                brcm,nand-ecc-use-strap;
>>>>>
>>>>> Describing the NAND chip in a SoC DTSI does not look relevant to me.
>>>>> Even more if you add something like this nand-ecc-use-strap setting
>>>>> which is very board dependent.
>>>>>   
>>>> I am not sure if I understand you comments correctly but are you >> suggesting to put this whole nand controller node into each board dts? >> We have other ip block nodes like SPI, uart in this same soc dtsi file >> too.  For all the bcmbca soc dtsi I am updating here(and its board >> design), we always use the strap to for ecc setting.  So I thought it >> should be okay to put brcm,nand-ecc-use-strap in the default dtsi >> file. For any board that uses the raw nand nand-ecc property, the >> board dts can do so and override the brcm,nand-ecc-use-strap setting.
>>>
>>> I read Miquel's comment as meaning that the nandcs aka the NAND > chip/flash part description should be in the board .dts file, while the > controller itself can remain in the .dtsi file with its status = > "disabled" property.
>>>
>>> Are there customer boards, that is non reference boards that might chose > a different chip select number and/or not use the strap settings?
>> In BCMBCA SoC, there is only one cs and customer design also have to use strap for the bootrom to boot up properly.  They can override it with dts in linux but I don't think any customer would do that.
>>
>> Maybe the nand-on-flash-bbt could be possible item that customer may have to set it differently if they don't follow our reference software design.
>>
>> I will move the nand-on-flash-bbt to the board dts but I would like to keep the other default nandcs settings in SoC.dsti if that is not too out of the conventional rule and Miquel is okay with it.
> 
> I think there is a global misunderstanding regarding the use of the
> nand-ecc-* properties. These are not the default. The default is the OS
> choice and depends on the NAND capabilities. The OS will always try to
> match the closest ECC settings offered by the engine, based on the NAND
> chip requirements which are discoverable. If you want to maximize your
> strength, it is also possible to tell the OS with a dedicated (generic)
This is the nand-ecc-* property, right?

> property. And only if you want something different, you may use these
> properties, but they should be the exception rather than the rule.
> 
> Overriding this with a strap is a bad hardware design on commercial
> products IMO. I am totally fine with the idea of a strap to choose
> the ECC configuration for development boards/evaluation kits, but once
> you've decided which setting you want you cannot change it for the
> lifetime of your project (or with a lot of difficulties) so I don't see
> the point of such a strap. So really, I don't like the idea of defining
> by default a variable which asks for an override of the defaults, even
> though many of your customers might want to use that.
Correct, no change to strap is possible on real product because they are 
always through soldered down resister and no dip switch/jumper for ecc 
strap. But as the SoC requires, it is part of bootstrap each product has 
to set and that's how bootloader get the ecc setting as it does not have 
the access to the dts and the capability to auto select the ecc setting.

Most of the time, customer will set strap to match the OS auto selected 
ecc setting but there are times customer want more strength so yes they 
can use nand-ecc-* to override but it has to match the strap setting. 
Then I think it make sense and much easier for customer to just use 
strap to override and reduce the any manual setting error in dts. It 
will cause many trouble down the road if the edit does not match strap 
setting.  Not saying this is for everyone but definitively a good 
feature for our product and it reduces ecc setting error in case of 
overriding OS default selection.

> 
> So, anything that is design dependent (the chip CS, ECC
> configuration, etc) should go into the board DTS, and what is SoC
> related hardware (like the definition of the NAND controller) should
> stay in the DTSI, as properly clarified by Florian.
> 
Okay I will move nand-on-flash-bbt and brcm,nand-ecc-use-strap from soc 
dtsi to board dts but leave the default nandcs node with compatible and 
reg = 0 in the dtsi as they are not design dependent and board dts can 
conveniently reference the nandcs node.

> Thanks,
> Miquèl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4212 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20240125/205293c0/attachment-0001.p7s>


More information about the linux-mtd mailing list