mbox series

[v3,00/10] mtd: rawnand: brcmnand: driver and doc updates

Message ID 20240124030458.98408-1-dregan@broadcom.com
Headers show
Series mtd: rawnand: brcmnand: driver and doc updates | expand

Message

David Regan Jan. 24, 2024, 3:04 a.m. UTC
This patch series is an update from the previous version [1] after
exex_op support and fixes (patch 1 to 4 from the previous version.)

It updates all the BCMBCA SoC to support the nand controller and add
functions to handle BCMBCA specific needs on ECC and Write Protection
usage. The device tree document is also updated accordingly with the new
properties needed by the driver.

In addition there is a bug fix for exec_op helper functions and on-die ECC.

[1] https://lore.kernel.org/lkml/20230606231252.94838-1-william.zhang@broadcom.com/

Changes in v3:
- Update brcm,nand-use-wp description
- Revert the description change to BCM63168 SoC-specific NAND controller
- Updated bcmbca_read_data_bus comment

Changes in v2:
- Revert the new compatible string nand-bcmbca
- Drop the BCM63168 compatible fix to avoid any potential ABI
Incompatibility issue
- Simplify the explanation for brcm,nand-use-wp
- Keep the interrupt name requirement when interrupt number is specified
- Add nand controller node label for 4908 so it is consistent with other
SoC's and can be referenced by board dts file
- Drop the is_param argument to the read data bus function now that we
have the exec_op API to read the parameter page and ONFI data
- Minor cosmetic fixes
- Added patches 8, 9, 10 to patch series

William Zhang (7):
  dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
  ARM: dts: broadcom: bcmbca: Add NAND controller node
  arm64: dts: broadcom: bcmbca: Add NAND controller node
  mtd: rawnand: brcmnand: Rename bcm63138 nand driver
  mtd: rawnand: brcmnand: Add BCMBCA read data bus interface
  mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
  mtd: rawnand: brcmnand: Support write protection setting from dts

David Regan (3):
  mtd: rawnand: brcmnand: exec_op helper functions return type fixes
  mtd: rawnand: brcmnand: update log level messages
  mtd: rawnand: brcmnand: allow for on-die ecc

 .../bindings/mtd/brcm,brcmnand.yaml           |  37 ++++-
 arch/arm/boot/dts/broadcom/bcm47622.dtsi      |  17 ++
 arch/arm/boot/dts/broadcom/bcm63138.dtsi      |  10 +-
 arch/arm/boot/dts/broadcom/bcm63148.dtsi      |  17 ++
 arch/arm/boot/dts/broadcom/bcm63178.dtsi      |  17 ++
 arch/arm/boot/dts/broadcom/bcm6756.dtsi       |  17 ++
 arch/arm/boot/dts/broadcom/bcm6846.dtsi       |  17 ++
 arch/arm/boot/dts/broadcom/bcm6855.dtsi       |  17 ++
 arch/arm/boot/dts/broadcom/bcm6878.dtsi       |  17 ++
 arch/arm/boot/dts/broadcom/bcm947622.dts      |   4 +
 arch/arm/boot/dts/broadcom/bcm963138.dts      |   4 +
 arch/arm/boot/dts/broadcom/bcm963138dvt.dts   |  12 +-
 arch/arm/boot/dts/broadcom/bcm963148.dts      |   4 +
 arch/arm/boot/dts/broadcom/bcm963178.dts      |   4 +
 arch/arm/boot/dts/broadcom/bcm96756.dts       |   4 +
 arch/arm/boot/dts/broadcom/bcm96846.dts       |   4 +
 arch/arm/boot/dts/broadcom/bcm96855.dts       |   4 +
 arch/arm/boot/dts/broadcom/bcm96878.dts       |   4 +
 .../boot/dts/broadcom/bcmbca/bcm4908.dtsi     |   5 +-
 .../boot/dts/broadcom/bcmbca/bcm4912.dtsi     |  17 ++
 .../boot/dts/broadcom/bcmbca/bcm63146.dtsi    |  17 ++
 .../boot/dts/broadcom/bcmbca/bcm63158.dtsi    |  17 ++
 .../boot/dts/broadcom/bcmbca/bcm6813.dtsi     |  17 ++
 .../boot/dts/broadcom/bcmbca/bcm6856.dtsi     |  17 ++
 .../boot/dts/broadcom/bcmbca/bcm6858.dtsi     |  17 ++
 .../boot/dts/broadcom/bcmbca/bcm94912.dts     |   4 +
 .../boot/dts/broadcom/bcmbca/bcm963146.dts    |   4 +
 .../boot/dts/broadcom/bcmbca/bcm963158.dts    |   4 +
 .../boot/dts/broadcom/bcmbca/bcm96813.dts     |   4 +
 .../boot/dts/broadcom/bcmbca/bcm96856.dts     |   4 +
 .../boot/dts/broadcom/bcmbca/bcm96858.dts     |   4 +
 drivers/mtd/nand/raw/brcmnand/Makefile        |   2 +-
 drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c |  99 ------------
 drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c   | 126 +++++++++++++++
 drivers/mtd/nand/raw/brcmnand/brcmnand.c      | 146 +++++++++++++++---
 drivers/mtd/nand/raw/brcmnand/brcmnand.h      |   2 +
 36 files changed, 578 insertions(+), 138 deletions(-)
 delete mode 100644 drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c
 create mode 100644 drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c

Comments

William Zhang Jan. 25, 2024, 3:01 a.m. UTC | #1
Hi Conor,

On 1/24/24 09:24, Conor Dooley wrote:
> Hey,
> 
> On Tue, Jan 23, 2024 at 07:04:49PM -0800, David Regan wrote:
>> From: William Zhang <william.zhang@broadcom.com>
>>
>> Update the descriptions to reflect different families of broadband SoC and
>> use the general name bcmbca for ARM based SoC.
>>
>> Add brcm,nand-use-wp property to have an option for disabling this
>> feature on broadband board design that does not use write protection.
>>
>> Add brcm,nand-ecc-use-strap to get ecc setting from board boot strap for
>> broadband board designs because they do not specify ecc setting in dts
>> but rather using the strap setting.
>>
>> Remove the requirement of interrupts property to reflect the driver
>> code. Also add myself to the list of maintainers.
>>
>> Signed-off-by: William Zhang <william.zhang@broadcom.com>
>> Reviewed-by: David Regan <dregan@broadcom.com>
>> ---
>> Changes in v3:
>> - Update brcm,nand-use-wp description
>> - Revert the description change to BCM63168 SoC-specific NAND controller
>> ---
>> Changes in v2:
>> - Revert the new compatible string nand-bcmbca
>> - Drop the BCM63168 compatible fix to avoid any potential ABI
>> incompatibility issue
>> - Simplify the explanation for brcm,nand-use-wp
>> - Keep the interrupt name requirement when interrupt number is specified
>> ---
>>   .../bindings/mtd/brcm,brcmnand.yaml           | 37 ++++++++++++++++---
>>   1 file changed, 32 insertions(+), 5 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml b/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml
>> index f57e96374e67..752c6ee98a7d 100644
>> --- a/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml
>> +++ b/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml
>> @@ -9,6 +9,7 @@ title: Broadcom STB NAND Controller
>>   maintainers:
>>     - Brian Norris <computersforpeace@gmail.com>
>>     - Kamal Dasu <kdasu.kdev@gmail.com>
>> +  - William Zhang <william.zhang@broadcom.com>
>>   
>>   description: |
>>     The Broadcom Set-Top Box NAND controller supports low-level access to raw NAND
>> @@ -18,9 +19,10 @@ description: |
>>     supports basic PROGRAM and READ functions, among other features.
>>   
>>     This controller was originally designed for STB SoCs (BCM7xxx) but is now
>> -  available on a variety of Broadcom SoCs, including some BCM3xxx, BCM63xx, and
>> -  iProc/Cygnus. Its history includes several similar (but not fully register
>> -  compatible) versions.
>> +  available on a variety of Broadcom SoCs, including some BCM3xxx, MIPS based
>> +  Broadband SoC (BCM63xx), ARM based Broadband SoC (BCMBCA) and iProc/Cygnus.
>> +  Its history includes several similar (but not fully register compatible)
>> +  versions.
>>   
>>     -- Additional SoC-specific NAND controller properties --
>>   
>> @@ -53,7 +55,7 @@ properties:
>>                 - brcm,brcmnand-v7.2
>>                 - brcm,brcmnand-v7.3
>>             - const: brcm,brcmnand
>> -      - description: BCM63138 SoC-specific NAND controller
>> +      - description: BCMBCA SoC-specific NAND controller
>>           items:
>>             - const: brcm,nand-bcm63138
>>             - enum:
>> @@ -111,6 +113,20 @@ properties:
>>         earlier versions of this core that include WP
>>       type: boolean
>>   
>> +  brcm,nand-use-wp:
>> +    description:
>> +      Use this property to indicate if board design uses
>> +      controller's write protection feature and connects its
>> +      NAND_WPb pin to nand chip's WP_L pin.
> 
>> By default the driver
>> +      uses a module parameter with default value set to enable to
>> +      control this feature for all boards. Use this dts property to
>> +      override the default behavior and enable/disable this feature
>> +      through board dts on a per board basis.
> 
> None of this information about module parameters is relevant in the
> binding, as it should be independent of the implementation of one
> particular operating system.
> 
Agree this is OS related stuff. I was trying to make it more clean by 
explaining how it is implemented in linux. And if we were to implement 
the driver for another OS, there will be at least a default value for 
wp_on. I will remove any mention of module parameter from this doc.

> If the module parameter is not provided, what does the driver do?
> If "wp_on" is the module parameter, then the default is to enable the
> write protection feature. If that's correct, it seems to me that the
> property should be called something like "brcm,no-wp". This property
> would be a boolean that indicates that the NAND_WPb and WP_L pins are
> not connected & nothing more. Clearly if the module param tries to
> enable WP and the DT property indicates that it is not supported you
> can decline to enable the feature, but that is up to the drivers in
> the OS to decide.
> 
If I were to implement this from day one, I certainly will choose the 
same approach as you suggested here.  But there is existing 
brcm,nand-has-wp property for other purpose and now if we have 
brcm,no-wp, it will be more confusing with that property IMHO. I prefer 
to keep use the "has" for feature availability and "use" for feature 
being used or not.

And the reason I keep it as int is because there could be a potential 
value of 2 for another mode that the current driver could set the wp_on 
to. I don't see it is being used in BCMBCA product but I am not sure 
about other SoC family. So I don't want to completely close the door 
here just in case.

> 
>> +      Set to 0 if WP pins are not connected and feature is not
>> +      used. Set to 1 if WP pins are connected and feature is used.
> 
> As it stands, this property is firmly in the "software policy" side
> of things, as it is being used as an override for a module parameter,
> particularly given you have properties for each direction. Whether or
> not the feature is to be used by the operating system is not relevant to
> the binding.
> 
I don't understand why this is a software policy.  This is the board 
design choice although it does override the driver default value. But it 
is still board or device setting and describe the hardware. OS has to 
follow this hardware configuration and set up accordingly.

>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    enum: [0, 1]
>> +
>>   patternProperties:
>>     "^nand@[a-f0-9]$":
>>       type: object
>> @@ -137,6 +153,16 @@ patternProperties:
>>             layout.
>>           $ref: /schemas/types.yaml#/definitions/uint32
>>   
>> +      brcm,nand-ecc-use-strap:
>> +        description:
>> +          This flag is used by the driver to get the ecc strength and
>> +          spare area size from the SoC NAND boot strap setting. This
>> +          is commonly used by the BCMBCA SoC board design.
> 
> Quoting from v1, as I didn't get to it in time:
> 
> | > This property I'm not all that sure about either. If the specific
> | > properties that you mention here are not set in the DT what happens at
> | > the moment?
> | >
> | In that case, the ecc strength and oob size come from ONFI or nand id
> | decoding.  But that is usually the minimum requirement and user can
> | choose to use stronger ecc as long as there is enough oob spare area in
> | the nand chip.
> |
> | > I suppose what I am getting at is why are the bootstrap settings not
> | > always used in the absence of specific values provided in the DT?
> | >
> | This is because the STB, iProc and other chip and their board design may
> | not have or use the strap setting. But for BCMBCA SoC and board
> | reference design, we always use the strap setting.
> 
> My main question here I suppose is why would you need this property at
> all? If the specific properties are provided (nand-ecc-strength etc)
> then use them, and if they are not use the strap settings?If nand-ecc-strength does not exist, the current driver implementation 
use the auto detected ecc strength from the NAND chip ONFI parameter 
which is okay. But for BCABCM SoC and our reference board design, we 
don't use nand-ecc-strength and don't want to use the auto detected 
value(as they are typically minimum requirement) but rather use strap 
setting so I need a third choice.

> If there's no properties and no strap settings, the this property does
> not help. If there's properties and strap settings, but properties are
> wrong, then you just have some devicetrees that incorrectly describe the
> hardware and need to be fixed.
> 
True but manually setting nand-ecc-strength can be error prone like 
copy/paste error. The hardware strap setting does not involve such edit 
in the dts file so no error can happen.

>> If ecc
>> +          strength and spare area size are set by nand-ecc-strength
>> +          and brcm,nand-oob-sector-size in the dts, these settings
>> +          have precedence and override this flag.
> 
> Again, IMO, this is not for the binding to decide. That is a decision
> for the operating system to make.
> 
Again this is just for historic reason and BCMBCA as late player does 
not want to break any existing dts setting.  So I thought it is useful 
to explain here.  I can remove this text if you don't think it should be 
in the binding document.


> I am confused!
> 
> 
>> +        $ref: /schemas/types.yaml#/definitions/flag
>> +
>>       unevaluatedProperties: false
>>   
>>   allOf:
>> @@ -177,6 +203,8 @@ allOf:
>>               - const: iproc-idm
>>               - const: iproc-ext
>>     - if:
>> +      required:
>> +        - interrupts
>>         properties:
>>           interrupts:
>>             minItems: 2
>> @@ -189,7 +217,6 @@ unevaluatedProperties: false
>>   required:
>>     - reg
>>     - reg-names
>> -  - interrupts
>>   
>>   examples:
>>     - |
>> -- 
>> 2.37.3
>>
William Zhang Jan. 25, 2024, 3:14 a.m. UTC | #2
On 1/24/24 09:34, Miquel Raynal wrote:
> Hi David,
> 
> dregan@broadcom.com wrote on Tue, 23 Jan 2024 19:04:49 -0800:
> 
>> From: William Zhang <william.zhang@broadcom.com>
>>
>> Update the descriptions to reflect different families of broadband SoC and
>> use the general name bcmbca for ARM based SoC.
>>
>> Add brcm,nand-use-wp property to have an option for disabling this
>> feature on broadband board design that does not use write protection.
>>
>> Add brcm,nand-ecc-use-strap to get ecc setting from board boot strap for
>> broadband board designs because they do not specify ecc setting in dts
>> but rather using the strap setting.
>>
>> Remove the requirement of interrupts property to reflect the driver
>> code. Also add myself to the list of maintainers.
>>
>> Signed-off-by: William Zhang <william.zhang@broadcom.com>
>> Reviewed-by: David Regan <dregan@broadcom.com>
> 
> Please split this into three commits. dt-bindings are hard enough to
> think again, mixing changes is definitely not a good idea.
> 
Will do

> Thanks,
> Miquèl
William Zhang Jan. 26, 2024, 1:55 a.m. UTC | #3
On 1/25/24 11:51, Conor Dooley wrote:
> 
> On Wed, Jan 24, 2024 at 07:01:48PM -0800, William Zhang wrote:
>> On 1/24/24 09:24, Conor Dooley wrote:
>>> On Tue, Jan 23, 2024 at 07:04:49PM -0800, David Regan wrote:
>>>> From: William Zhang <william.zhang@broadcom.com>
>>>>
>>>> Update the descriptions to reflect different families of broadband SoC and
>>>> use the general name bcmbca for ARM based SoC.
>>>>
>>>> Add brcm,nand-use-wp property to have an option for disabling this
>>>> feature on broadband board design that does not use write protection.
>>>>
>>>> Add brcm,nand-ecc-use-strap to get ecc setting from board boot strap for
>>>> broadband board designs because they do not specify ecc setting in dts
>>>> but rather using the strap setting.
>>>>
>>>> Remove the requirement of interrupts property to reflect the driver
>>>> code. Also add myself to the list of maintainers.
>>>>
>>>> Signed-off-by: William Zhang <william.zhang@broadcom.com>
>>>> Reviewed-by: David Regan <dregan@broadcom.com>
>>>> ---
>>>> Changes in v3:
>>>> - Update brcm,nand-use-wp description
>>>> - Revert the description change to BCM63168 SoC-specific NAND controller
>>>> ---
>>>> Changes in v2:
>>>> - Revert the new compatible string nand-bcmbca
>>>> - Drop the BCM63168 compatible fix to avoid any potential ABI
>>>> incompatibility issue
>>>> - Simplify the explanation for brcm,nand-use-wp
>>>> - Keep the interrupt name requirement when interrupt number is specified
>>>> ---
>>>>    .../bindings/mtd/brcm,brcmnand.yaml           | 37 ++++++++++++++++---
>>>>    1 file changed, 32 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml b/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml
>>>> index f57e96374e67..752c6ee98a7d 100644
>>>> --- a/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml
>>>> +++ b/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml
>>>> @@ -9,6 +9,7 @@ title: Broadcom STB NAND Controller
>>>>    maintainers:
>>>>      - Brian Norris <computersforpeace@gmail.com>
>>>>      - Kamal Dasu <kdasu.kdev@gmail.com>
>>>> +  - William Zhang <william.zhang@broadcom.com>
>>>>    description: |
>>>>      The Broadcom Set-Top Box NAND controller supports low-level access to raw NAND
>>>> @@ -18,9 +19,10 @@ description: |
>>>>      supports basic PROGRAM and READ functions, among other features.
>>>>      This controller was originally designed for STB SoCs (BCM7xxx) but is now
>>>> -  available on a variety of Broadcom SoCs, including some BCM3xxx, BCM63xx, and
>>>> -  iProc/Cygnus. Its history includes several similar (but not fully register
>>>> -  compatible) versions.
>>>> +  available on a variety of Broadcom SoCs, including some BCM3xxx, MIPS based
>>>> +  Broadband SoC (BCM63xx), ARM based Broadband SoC (BCMBCA) and iProc/Cygnus.
>>>> +  Its history includes several similar (but not fully register compatible)
>>>> +  versions.
>>>>      -- Additional SoC-specific NAND controller properties --
>>>> @@ -53,7 +55,7 @@ properties:
>>>>                  - brcm,brcmnand-v7.2
>>>>                  - brcm,brcmnand-v7.3
>>>>              - const: brcm,brcmnand
>>>> -      - description: BCM63138 SoC-specific NAND controller
>>>> +      - description: BCMBCA SoC-specific NAND controller
>>>>            items:
>>>>              - const: brcm,nand-bcm63138
>>>>              - enum:
>>>> @@ -111,6 +113,20 @@ properties:
>>>>          earlier versions of this core that include WP
>>>>        type: boolean
>>>> +  brcm,nand-use-wp:
>>>> +    description:
>>>> +      Use this property to indicate if board design uses
>>>> +      controller's write protection feature and connects its
>>>> +      NAND_WPb pin to nand chip's WP_L pin.
>>>
>>>> By default the driver
>>>> +      uses a module parameter with default value set to enable to
>>>> +      control this feature for all boards. Use this dts property to
>>>> +      override the default behavior and enable/disable this feature
>>>> +      through board dts on a per board basis.
>>>
>>> None of this information about module parameters is relevant in the
>>> binding, as it should be independent of the implementation of one
>>> particular operating system.
>>>
>> Agree this is OS related stuff. I was trying to make it more clean by
>> explaining how it is implemented in linux. And if we were to implement the
>> driver for another OS, there will be at least a default value for wp_on. I
>> will remove any mention of module parameter from this doc.
>>
>>> If the module parameter is not provided, what does the driver do?
>>> If "wp_on" is the module parameter, then the default is to enable the
>>> write protection feature. If that's correct, it seems to me that the
>>> property should be called something like "brcm,no-wp". This property
>>> would be a boolean that indicates that the NAND_WPb and WP_L pins are
>>> not connected & nothing more. Clearly if the module param tries to
>>> enable WP and the DT property indicates that it is not supported you
>>> can decline to enable the feature, but that is up to the drivers in
>>> the OS to decide.
>>>
>> If I were to implement this from day one, I certainly will choose the same
>> approach as you suggested here.  But there is existing brcm,nand-has-wp
>> property for other purpose and now if we have brcm,no-wp, it will be more
>> confusing with that property IMHO. I prefer to keep use the "has" for
>> feature availability and "use" for feature being used or not.
> 
> "brcm,wp-not-connected" then, since I want it to become a boolean and it
> would better communicate what the problem is than "brcm,dont-use-wp"
> would.
> 
>> And the reason I keep it as int is because there could be a potential value
>> of 2 for another mode that the current driver could set the wp_on to.
> 
> Can you explain, in driver independent terms, what this other mode has
> to do with how the WP is connected?
> Either you've got the standard scenario where apparently "NAND_WPb" and
> "WP_L" are connected and another situation where they are not.
> Is there another pin configuration in addition to that, that this 3rd
> mode represents?
> 
The 3rd mode is WP pin connected but wp feature is disabled in the 
controller.

>> I
>> don't see it is being used in BCMBCA product but I am not sure about other
>> SoC family. So I don't want to completely close the door here just in case.
> 
> If you ever need it, you could have a "brcm,wp-in-wacky-configuration"
> property that indicates that the hardware is configured in that way
> (providing that this hardware configuration is not just "NAND_WPb" and
> "WP_L" pins connected. The property can very easily be made mutually
> exclusive with "brcm,wp-not-connected" iff it ever comes to be.
Yes we could have a new property but if we can have a single int 
property to cover all, IMHO it is better to just have one property as 
these three modes are related. I would really like to have it as an int 
property to keep things simple.

But if you think this is absolutely against the dts rule,  I will switch 
to the "brcm,wp-not-connected" boolean property as you suggested.

> 
>>>> +      Set to 0 if WP pins are not connected and feature is not
>>>> +      used. Set to 1 if WP pins are connected and feature is used.
>>>
>>> As it stands, this property is firmly in the "software policy" side
>>> of things, as it is being used as an override for a module parameter,
>>> particularly given you have properties for each direction. Whether or
>>> not the feature is to be used by the operating system is not relevant to
>>> the binding.
>>>
>> I don't understand why this is a software policy.  This is the board design
>> choice although it does override the driver default value. But it is still
>> board or device setting and describe the hardware. OS has to follow this
>> hardware configuration and set up accordingly.
> 
> The software policy side of things is that you are instructing the
> software what to do with "use" nature of it and the force enable &
> disable options for the property. A boolean property that tells software
> that the wp is not connected is all you need, as far as I can tell.
> That should be sufficient information for the operating system to know
> whether or not it can use the wp.
>

>>>> +    $ref: /schemas/types.yaml#/definitions/uint32
>>>> +    enum: [0, 1]
>>>> +
>>>>    patternProperties:
>>>>      "^nand@[a-f0-9]$":
>>>>        type: object
>>>> @@ -137,6 +153,16 @@ patternProperties:
>>>>              layout.
>>>>            $ref: /schemas/types.yaml#/definitions/uint32
>>>> +      brcm,nand-ecc-use-strap:
>>>> +        description:
>>>> +          This flag is used by the driver to get the ecc strength and
>>>> +          spare area size from the SoC NAND boot strap setting. This
>>>> +          is commonly used by the BCMBCA SoC board design.
>>>
>>> Quoting from v1, as I didn't get to it in time:
>>>
>>> | > This property I'm not all that sure about either. If the specific
>>> | > properties that you mention here are not set in the DT what happens at
>>> | > the moment?
>>> | >
>>> | In that case, the ecc strength and oob size come from ONFI or nand id
>>> | decoding.  But that is usually the minimum requirement and user can
>>> | choose to use stronger ecc as long as there is enough oob spare area in
>>> | the nand chip.
>>> |
>>> | > I suppose what I am getting at is why are the bootstrap settings not
>>> | > always used in the absence of specific values provided in the DT?
>>> | >
>>> | This is because the STB, iProc and other chip and their board design may
>>> | not have or use the strap setting. But for BCMBCA SoC and board
>>> | reference design, we always use the strap setting.
>>>
>>> My main question here I suppose is why would you need this property at
>>> all? If the specific properties are provided (nand-ecc-strength etc)
>>> then use them, and if they are not use the strap settings?If
>>> nand-ecc-strength does not exist, the current driver implementation
>> use the auto detected ecc strength from the NAND chip ONFI parameter which
>> is okay. But for BCABCM SoC and our reference board design, we don't use
>> nand-ecc-strength and don't want to use the auto detected value(as they are
>> typically minimum requirement) but rather use strap setting so I need a
>> third choice.
> 
> That seems reasonable. Please limit the property though to the SoCs
> where it is relevant if you had not done so already.
Yes it is only for BCMBCA SoC that I am updating in this patch series.

> Thanks for the explanation.
> 
>>> If there's no properties and no strap settings, the this property does
>>> not help. If there's properties and strap settings, but properties are
>>> wrong, then you just have some devicetrees that incorrectly describe the
>>> hardware and need to be fixed.
>>>
>> True but manually setting nand-ecc-strength can be error prone like
>> copy/paste error. The hardware strap setting does not involve such edit in
>> the dts file so no error can happen.
> 
> Copy paste errors are not really an argument here, you could use that as
> an excuse for anything DT property in the world.. You could copy paste
> the wrong thing into the strap, and idk about you, but on the systems I
> have it is far easier to change the DT passed to the kernel than what I
> assume is an early bootloader stage? (I tried googling for "broadcom
> strap" but there was nothing relevant)
> 
Agree, the strap could be set incorrectly in the hardware but then the 
board likely won't be able to boot to linux for linux developer to work 
on. Changing dts is easy but obtaining the ecc setting from hardware 
strap automatically is no-brainer as it require no change in dts or any 
manual setting, assuming hardware is correct.

>>>> If ecc
>>>> +          strength and spare area size are set by nand-ecc-strength
>>>> +          and brcm,nand-oob-sector-size in the dts, these settings
>>>> +          have precedence and override this flag.
>>>
>>> Again, IMO, this is not for the binding to decide. That is a decision
>>> for the operating system to make.
>>>
>> Again this is just for historic reason and BCMBCA as late player does not
>> want to break any existing dts setting.  So I thought it is useful to
>> explain here.  I can remove this text if you don't think it should be in the
>> binding document.
> 
> I don't, at least not in that form. I think it is reasonable to explain
> why these values are better though.
I understand the decision is for OS/driver to make. If we were to write 
another driver for other OS, the same precedence will apply too so the 
binding works the same way across all the OS. So I am not sure what 
better explanation or form I can put up here. I am open to any 
suggestion or I just delete it.

> 
> Thanks,
> Conor.