mtd: rawnand: brcmnand: driver and doc updates
Subsystems (5)
v3 cover mtd: rawnand: brcmnand: driver and doc updates
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/[email protected]/
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
Signature · 1 line
2.37.3
PATCH v3 1/10 dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
From: William Zhang <[email protected]>
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.
---
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(-)
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +32 -5
@@ -9,6 +9,7 @@ title: Broadcom STB NAND Controller maintainers: - Brian Norris <[email protected]> - Kamal Dasu <[email protected]> + - William Zhang <[email protected]> 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. + 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. + $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. 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. + $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: - |
Signature · 1 line
2.37.3
Re: [PATCH v3 01/10] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
Hey,
Quoted 78 lines · David Regan
From: William Zhang <[email protected]>
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 <[email protected]>Reviewed-by David Regan <[email protected]>---
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(-)Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +11
-4@@ -9,6 +9,7 @@ title: Broadcom STB NAND Controller maintainers: - Brian Norris <[email protected]> - Kamal Dasu <[email protected]> + - William Zhang <[email protected]> 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
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml properties: · line 124
Quoted 4 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +4
-0+ 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.
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.
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml properties: · line 126
Quoted 2 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +2
-0+ 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.
Quoted 7 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +3
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + patternProperties: "^nand@[a-f0-9]$": type: object
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml patternProperties: · line 160
Quoted 8 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +5
-0@@ -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 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.
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml patternProperties: · line 163
Quoted 4 lines
If ecc
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +3
-0+ 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.
I am confused!
Quoted 25 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +4
-1+ $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: - |Signature · 1 line
2.37.3
William Zhang
maintainerRe: [PATCH v3 01/10] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
Hi Conor,
Quoted 86 lines · Conor Dooley
Hey,
Quoted 78 lines · David Regan
From: William Zhang <[email protected]>
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 <[email protected]>Reviewed-by David Regan <[email protected]>---
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(-)Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +11
-4@@ -9,6 +9,7 @@ title: Broadcom STB NAND Controller maintainers: - Brian Norris <[email protected]> - Kamal Dasu <[email protected]> + - William Zhang <[email protected]> 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
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml properties: · line 124
Quoted 4 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +4
-0+ 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.
Quoted 4 lines
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.
Quoted 10 lines
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 theNAND_WPbandWP_Lpins 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.
Quoted 10 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml properties: · line 126
Quoted 3 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +2
-0+ 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.
Quoted 34 lines
Quoted 7 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +3
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + patternProperties: "^nand@[a-f0-9]$": type: objectDocumentation/devicetree/bindings/mtd/brcm,brcmnand.yaml patternProperties: · line 160
Quoted 8 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +5
-0@@ -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.
Quoted 3 lines
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.
Quoted 5 lines
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.
Quoted 8 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml patternProperties: · line 163
Quoted 4 lines
If ecc
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +3
-0+ 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.
Quoted 28 lines
I am confused!
Quoted 25 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +4
-1+ $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: - |Signature · 1 line
2.37.3
Re: [PATCH v3 01/10] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
Quoted 99 lines · William Zhang
Quoted 79 lines · Conor Dooley
Quoted 73 lines · David Regan
From: William Zhang <[email protected]>
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 <[email protected]>Reviewed-by David Regan <[email protected]>---
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(-)Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +11
-4@@ -9,6 +9,7 @@ title: Broadcom STB NAND Controller maintainers: - Brian Norris <[email protected]> - Kamal Dasu <[email protected]> + - William Zhang <[email protected]> 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
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml properties: · line 124
Quoted 4 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +4
-0+ 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.Quoted 4 lines
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.Quoted 10 lines
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 theNAND_WPbandWP_Lpins 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.
Quoted 5 lines
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.
Quoted 2 lines
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_onto.
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?
Quoted 3 lines
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.
Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml properties: · line 126
Quoted 2 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +2
-0+ 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.
Quoted 4 lines
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.
Quoted 37 lines
Quoted 33 lines
Quoted 7 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +3
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + patternProperties: "^nand@[a-f0-9]$": type: objectDocumentation/devicetree/bindings/mtd/brcm,brcmnand.yaml patternProperties: · line 159
Quoted 7 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +5
-0@@ -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.Quoted 4 lines
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
Quoted 5 lines
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. Thanks for the explanation.
Quoted 8 lines
Quoted 5 lines
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)
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
If ecc
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +3
-0+ 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.
Quoted 7 lines
Quoted 3 lines
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.
Thanks,
Conor.
William Zhang
maintainerRe: [PATCH v3 01/10] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
Quoted 114 lines · Conor Dooley
Quoted 99 lines · William Zhang
Quoted 79 lines · Conor Dooley
Quoted 73 lines · David Regan
From: William Zhang <[email protected]>
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 <[email protected]>Reviewed-by David Regan <[email protected]>---
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(-)Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +11
-4@@ -9,6 +9,7 @@ title: Broadcom STB NAND Controller maintainers: - Brian Norris <[email protected]> - Kamal Dasu <[email protected]> + - William Zhang <[email protected]> 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
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml properties: · line 124
Quoted 4 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +4
-0+ 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.Quoted 4 lines
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.Quoted 10 lines
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 theNAND_WPbandWP_Lpins 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.Quoted 5 lines
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.
Quoted 2 lines
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_onto.
Quoted 7 lines
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.
Quoted 9 lines
Quoted 3 lines
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.
Quoted 60 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml properties: · line 126
Quoted 3 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +2
-0+ 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.
Quoted 4 lines
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.
Quoted 37 lines
Quoted 37 lines
Quoted 7 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +3
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + patternProperties: "^nand@[a-f0-9]$": type: objectDocumentation/devicetree/bindings/mtd/brcm,brcmnand.yaml patternProperties: · line 159
Quoted 7 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +5
-0@@ -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
Quoted 8 lines
Quoted 5 lines
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.
Quoted 11 lines
Thanks for the explanation.
Quoted 8 lines
Quoted 5 lines
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.
Quoted 7 lines
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.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml patternProperties: · line 163
Quoted 4 lines
If ecc
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +3
-0+ 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.
Quoted 7 lines
Quoted 4 lines
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.
Quoted 3 lines
Thanks,
Conor.
Re: [PATCH v3 01/10] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
Quoted 16 lines · William Zhang
Quoted 8 lines · Conor Dooley
Quoted 6 lines · William Zhang
Quoted 2 lines · Conor Dooley
Quoted 1 line · David Regan
From: William Zhang <[email protected]>
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_onto.Quoted 7 lines
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?
Quoted 2 lines
The 3rd mode is WP pin connected but wp feature is disabled in the controller.
What does "disabled" mean? The controller itself is not capable of using the WP pin because of hardware modifications? Or there's a bit in a register that disables it and that bit has been set by software?
If it is a hardware difference for that controller, why does it not have a dedicated compatible? If it's a software decision, then it shouldn't be in the DT in the first place ;)
We've gone back here a bunch trying to figure stuff out, and you give me a vague one sentence answer. Please.
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
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.
Quoted 4 lines
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.
It is "better" because it is easier for you perhaps, but ripe for abuse.
Quoted 2 lines
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.
I'll answer this when you describe the mode better, right now I cannot really comment, but I have not yet seen a justification for the non-flag version of the property. Even if there's a justification for documenting that other mode in the DT, I'm likely to still think boolean properties are a better fit.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml patternProperties: · line 163
Quoted 4 lines
If ecc
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +3
-0+ 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.
Quoted 7 lines
Quoted 2 lines
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.
I would just delete it tbh.
Thanks,
Conor.
William Zhang
maintainerRe: [PATCH v3 01/10] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
Quoted 17 lines · Conor Dooley
Quoted 16 lines · William Zhang
Quoted 15 lines · Conor Dooley
Quoted 6 lines · William Zhang
Quoted 2 lines · Conor Dooley
Quoted 1 line · David Regan
From: William Zhang <[email protected]>
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_onto.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?
Quoted 7 lines
Quoted 2 lines
The 3rd mode is WP pin connected but wp feature is disabled in the controller.
What does "disabled" mean? The controller itself is not capable of using the WP pin because of hardware modifications? Or there's a bit in a register that disables it and that bit has been set by software?
Yes that is a bit in the controller reg to disable the feature by the driver even the chip have the WP pin connected.
Quoted 4 lines
If it is a hardware difference for that controller, why does it not have a dedicated compatible? If it's a software decision, then it shouldn't be in the DT in the first place ;)
Agree it is more on the software for that particular mode.
Quoted 12 lines
We've gone back here a bunch trying to figure stuff out, and you give me a vague one sentence answer. Please.
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
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.
Quoted 7 lines
Quoted 4 lines
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.
It is "better" because it is easier for you perhaps, but ripe for abuse.
Well if binding only say 3 possible value, you can not use this property for other value of course. DTS binding check will fail. But agree there is no check on this in the driver side for any integer property.
Quoted 9 lines
Quoted 2 lines
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.
I'll answer this when you describe the mode better, right now I cannot really comment, but I have not yet seen a justification for the non-flag version of the property. Even if there's a justification for documenting that other mode in the DT, I'm likely to still think boolean properties are a better fit.
That's fine. I will just change to the boolean.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
If ecc
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +3
-0+ 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.Quoted 7 lines
Quoted 3 lines
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.
Quoted 7 lines
Quoted 5 lines
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.
I would just delete it tbh.
Will delete.
Quoted 3 lines
Thanks,
Conor.
Re: [PATCH v3 01/10] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
In reply to David ReganQuoted 12 lines · David Regan
From: William Zhang <[email protected]>
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.
Quoted 5 lines
Remove the requirement of interrupts property to reflect the driver code. Also add myself to the list of maintainers.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>
Oh, and the patch is missing your signoff David.
Miquel Raynal
maintainerRe: [PATCH v3 01/10] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
In reply to David ReganHi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:49 -0800:
Quoted 12 lines
From: William Zhang <[email protected]>
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.
Quoted 5 lines
Remove the requirement of interrupts property to reflect the driver code. Also add myself to the list of maintainers.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>
Please split this into three commits. dt-bindings are hard enough to think again, mixing changes is definitely not a good idea.
Thanks,
Miquèl
William Zhang
maintainerRe: [PATCH v3 01/10] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
Quoted 16 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:49 -0800:
Quoted 12 lines
From: William Zhang <[email protected]>
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.
Quoted 9 lines
Quoted 5 lines
Remove the requirement of interrupts property to reflect the driver code. Also add myself to the list of maintainers.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>Please split this into three commits. dt-bindings are hard enough to think again, mixing changes is definitely not a good idea.
Will do
Quoted 2 lines
Thanks,
Miquèl
PATCH v3 2/10 ARM: dts: broadcom: bcmbca: Add NAND controller node
In reply to David ReganFrom: William Zhang <[email protected]>
Add support for Broadcom STB NAND controller in BCMBCA ARMv7 chip dts files.
---
Changes in v3: None
---
Changes in v2: None
--- 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 ++++ 17 files changed, 165 insertions(+), 8 deletions(-)
arch/arm/boot/dts/broadcom/bcm47622.dtsi +17 -0
@@ -138,6 +138,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm/boot/dts/broadcom/bcm63138.dtsi +9 -1
@@ -229,7 +229,15 @@ nand_controller: nand-controller@2000 { reg-names = "nand", "nand-int-base"; status = "disabled"; interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "nand"; + interrupt-names = "nand_ctlrdy"; + brcm,nand-use-wp = <0>; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; }; serial@4400 {
arch/arm/boot/dts/broadcom/bcm63148.dtsi +17 -0
@@ -119,5 +119,22 @@ hsspi: spi@1000 { num-cs = <8>; status = "disabled"; }; + + nand_controller: nand-controller@2000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x2000 0x600>, <0xf0 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; }; };
arch/arm/boot/dts/broadcom/bcm63178.dtsi +17 -0
@@ -129,6 +129,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm/boot/dts/broadcom/bcm6756.dtsi +17 -0
@@ -139,6 +139,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm/boot/dts/broadcom/bcm6846.dtsi +17 -0
@@ -119,5 +119,22 @@ hsspi: spi@1000 { num-cs = <8>; status = "disabled"; }; + + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; }; };
arch/arm/boot/dts/broadcom/bcm6855.dtsi +17 -0
@@ -129,6 +129,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm/boot/dts/broadcom/bcm6878.dtsi +17 -0
@@ -120,6 +120,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm/boot/dts/broadcom/bcm947622.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm/boot/dts/broadcom/bcm963138.dts +4 -0
@@ -29,3 +29,7 @@ &serial0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm/boot/dts/broadcom/bcm963138dvt.dts +5 -7
@@ -33,14 +33,12 @@ &serial1 { &nand_controller { status = "okay"; +}; - nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-ecc-strength = <4>; - nand-ecc-step-size = <512>; - brcm,nand-oob-sectors-size = <16>; - }; +&nandcs { + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + brcm,nand-oob-sector-size = <16>; }; &ahci {
arch/arm/boot/dts/broadcom/bcm963148.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm/boot/dts/broadcom/bcm963178.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm/boot/dts/broadcom/bcm96756.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm/boot/dts/broadcom/bcm96846.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm/boot/dts/broadcom/bcm96855.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm/boot/dts/broadcom/bcm96878.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
Signature · 1 line
2.37.3
Miquel Raynal
maintainerRe: [PATCH v3 02/10] ARM: dts: broadcom: bcmbca: Add NAND controller node
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:50 -0800:
Quoted 43 lines
From: William Zhang <[email protected]>
Add support for Broadcom STB NAND controller in BCMBCA ARMv7 chip dts files.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>---
Changes in v3: None
---
Changes in v2: None--- 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 ++++ 17 files changed, 165 insertions(+), 8 deletions(-)arch/arm/boot/dts/broadcom/bcm47622.dtsi +4
-0@@ -138,6 +138,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", "brcm,brcmnand";
arch/arm/boot/dts/broadcom/bcm47622.dtsi hsspi: spi@1000 { · line 154
Quoted 10 lines
arch/arm/boot/dts/broadcom/bcm47622.dtsi +10
-0+ reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@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.
Same applies to your arm64 DT patch.
Thanks,
Miquèl
William Zhang
maintainerRe: [PATCH v3 02/10] ARM: dts: broadcom: bcmbca: Add NAND controller node
Hi Miquel,
Quoted 53 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:50 -0800:
Quoted 49 lines
From: William Zhang <[email protected]>
Add support for Broadcom STB NAND controller in BCMBCA ARMv7 chip dts files.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>---
Changes in v3: None
---
Changes in v2: None--- 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 ++++ 17 files changed, 165 insertions(+), 8 deletions(-)arch/arm/boot/dts/broadcom/bcm47622.dtsi +10
-0@@ -138,6 +138,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 {
Quoted 9 lines
arch/arm/boot/dts/broadcom/bcm47622.dtsi hsspi: spi@1000 { · line 154
Quoted 4 lines
arch/arm/boot/dts/broadcom/bcm47622.dtsi +4
-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.
Quoted 4 lines
Same applies to your arm64 DT patch.
Thanks,
Miquèl
Florian Fainelli
maintainerRe: [PATCH v3 02/10] ARM: dts: broadcom: bcmbca: Add NAND controller node
Quoted 65 lines · William Zhang
Hi Miquel,
Quoted 53 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:50 -0800:
Quoted 49 lines
From: William Zhang <[email protected]>
Add support for Broadcom STB NAND controller in BCMBCA ARMv7 chip dts files.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>---
Changes in v3: None
---
Changes in v2: None
---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 ++++ 17 files changed, 165 insertions(+), 8 deletions(-)arch/arm/boot/dts/broadcom/bcm47622.dtsi +10
-0@@ -138,6 +138,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 {Quoted 9 lines
arch/arm/boot/dts/broadcom/bcm47622.dtsi hsspi: spi@1000 { · line 154
Quoted 4 lines
arch/arm/boot/dts/broadcom/bcm47622.dtsi +4
-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.
Quoted 1 line
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?
Signature · 1 line
Florian
William Zhang
maintainerRe: [PATCH v3 02/10] ARM: dts: broadcom: bcmbca: Add NAND controller node
Quoted 68 lines · Florian Fainelli
Quoted 65 lines · William Zhang
Hi Miquel,
Quoted 62 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:50 -0800:
Quoted 43 lines
From: William Zhang <[email protected]>
Add support for Broadcom STB NAND controller in BCMBCA ARMv7 chip dts files.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>---
Changes in v3: None
---
Changes in v2: None
---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 ++++ 17 files changed, 165 insertions(+), 8 deletions(-)arch/arm/boot/dts/broadcom/bcm47622.dtsi +4
-0@@ -138,6 +138,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", "brcm,brcmnand";arch/arm/boot/dts/broadcom/bcm47622.dtsi hsspi: spi@1000 { · line 154
Quoted 10 lines
arch/arm/boot/dts/broadcom/bcm47622.dtsi +10
-0+ reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@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.
Quoted 5 lines
Quoted 1 line
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.
Miquel Raynal
maintainerRe: [PATCH v3 02/10] ARM: dts: broadcom: bcmbca: Add NAND controller node
Hi William,
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 15 lines
Quoted 6 lines
+
nand_controller: nand-controller@1800 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "brcm,nand-bcm63138", >>>> "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x18000x600>, <0x20000x10>;
+ reg-names = "nand", "nand-int-base";Quoted 8 lines
+ brcm,nand-use-wp = <0>;
+ status = "disabled";
+
+ nandcs: nand@0 {
+ compatible = "brcm,nandcs";
+ reg = <0>;
+ nand-on-flash-bbt;
+ brcm,nand-ecc-use-strap;Quoted 4 lines
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.
Quoted 8 lines
Quoted 3 lines
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) 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.
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.
Thanks,
Miquèl
William Zhang
maintainerRe: [PATCH v3 02/10] ARM: dts: broadcom: bcmbca: Add NAND controller node
Hi Miquel,
Quoted 30 lines · Miquel Raynal
Hi William,
Quoted 28 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 6 lines
+
nand_controller: nand-controller@1800 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "brcm,nand-bcm63138", >>>> "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x18000x600>, <0x20000x10>;
+ reg-names = "nand", "nand-int-base";Quoted 8 lines
+ brcm,nand-use-wp = <0>;
+ status = "disabled";
+
+ nandcs: nand@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.
Quoted 5 lines
Quoted 1 line
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.
Quoted 8 lines
Quoted 1 line
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?
Quoted 11 lines
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.
Quoted 6 lines
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.
Quoted 2 lines
Thanks,
Miquèl
PATCH v3 3/10 arm64: dts: broadcom: bcmbca: Add NAND controller node
In reply to David ReganFrom: William Zhang <[email protected]>
Add support for Broadcom STB NAND controller in BCMBCA ARMv8 chip dts files.
---
Changes in v3: None
---
Changes in v2:
- Add nand controller node label for 4908 so it is consistent with other SoCs and can be referenced by board dts file
--- .../arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi | 5 ++++- .../arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi | 17 +++++++++++++++++ .../boot/dts/broadcom/bcmbca/bcm63146.dtsi | 17 +++++++++++++++++ .../boot/dts/broadcom/bcmbca/bcm63158.dtsi | 17 +++++++++++++++++ .../arm64/boot/dts/broadcom/bcmbca/bcm6813.dtsi | 17 +++++++++++++++++ .../arm64/boot/dts/broadcom/bcmbca/bcm6856.dtsi | 17 +++++++++++++++++ .../arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi | 17 +++++++++++++++++ .../arm64/boot/dts/broadcom/bcmbca/bcm94912.dts | 4 ++++ .../boot/dts/broadcom/bcmbca/bcm963146.dts | 4 ++++ .../boot/dts/broadcom/bcmbca/bcm963158.dts | 4 ++++ .../arm64/boot/dts/broadcom/bcmbca/bcm96813.dts | 4 ++++ .../arm64/boot/dts/broadcom/bcmbca/bcm96856.dts | 4 ++++ .../arm64/boot/dts/broadcom/bcmbca/bcm96858.dts | 4 ++++ 13 files changed, 130 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi +4 -1
@@ -589,7 +589,7 @@ hsspi: spi@1000 { status = "disabled"; }; - nand-controller@1800 { + nand_controller: nand-controller@1800 { #address-cells = <1>; #size-cells = <0>; compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", "brcm,brcmnand";
@@ -597,11 +597,14 @@ nand-controller@1800 { reg-names = "nand", "nand-int-base"; interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "nand_ctlrdy"; + brcm,nand-use-wp = <0>; status = "okay"; nandcs: nand@0 { compatible = "brcm,nandcs"; reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; }; };
arch/arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi +17 -0
@@ -138,6 +138,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm64/boot/dts/broadcom/bcmbca/bcm63146.dtsi +17 -0
@@ -119,6 +119,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm64/boot/dts/broadcom/bcmbca/bcm63158.dtsi +17 -0
@@ -137,6 +137,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm64/boot/dts/broadcom/bcmbca/bcm6813.dtsi +17 -0
@@ -138,6 +138,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm64/boot/dts/broadcom/bcmbca/bcm6856.dtsi +17 -0
@@ -119,5 +119,22 @@ hsspi: spi@1000 { num-cs = <8>; status = "disabled"; }; + + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; }; };
arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi +17 -0
@@ -156,5 +156,22 @@ hsspi: spi@1000 { num-cs = <8>; status = "disabled"; }; + + nand_controller: nand-controller@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@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; }; };
arch/arm64/boot/dts/broadcom/bcmbca/bcm94912.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm963146.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm963158.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm96813.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm96856.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm96858.dts +4 -0
@@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +};
Signature · 1 line
2.37.3
PATCH v3 4/10 mtd: rawnand: brcmnand: Rename bcm63138 nand driver
In reply to David ReganFrom: William Zhang <[email protected]>
In preparing to support multiple BCMBCA SoCs, rename bcm63138 to bcmbca in the driver code and driver file name.
---
Changes in v3: None
---
Changes in v2: None
--- drivers/mtd/nand/raw/brcmnand/Makefile | 2 +- drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c | 99 ------------------- drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c | 99 +++++++++++++++++++ 3 files changed, 100 insertions(+), 100 deletions(-) delete mode 100644 drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c create mode 100644 drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c
drivers/mtd/nand/raw/brcmnand/Makefile +1 -1
@@ -2,7 +2,7 @@ # link order matters; don't link the more generic brcmstb_nand.o before the # more specific iproc_nand.o, for instance obj-$(CONFIG_MTD_NAND_BRCMNAND_IPROC) += iproc_nand.o -obj-$(CONFIG_MTD_NAND_BRCMNAND_BCMBCA) += bcm63138_nand.o +obj-$(CONFIG_MTD_NAND_BRCMNAND_BCMBCA) += bcmbca_nand.o obj-$(CONFIG_MTD_NAND_BRCMNAND_BCM63XX) += bcm6368_nand.o obj-$(CONFIG_MTD_NAND_BRCMNAND_BRCMSTB) += brcmstb_nand.o obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand.o
drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c deleted +0 -99
99 lines not on this page · raw message
drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c new file +99 -0
99 lines not on this page · raw message
Signature · 1 line
2.37.3
PATCH v3 5/10 mtd: rawnand: brcmnand: Add BCMBCA read data bus interface
In reply to David ReganFrom: William Zhang <[email protected]>
The BCMBCA broadband SoC integrates the NAND controller differently than STB, iProc and other SoCs. It has different endianness for NAND cache data.
Add a SoC read data bus shim for BCMBCA to meet the specific SoC need and performance improvement using the optimized memcpy function on NAND cache memory.
---
Changes in v3:
- Updated bcmbca_read_data_bus comment
---
Changes in v2:
- 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
- Remove be32_to_cpu from brcmnand_read_data_bus
--- drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c | 27 +++++++++++++++++++++ drivers/mtd/nand/raw/brcmnand/brcmnand.c | 20 ++++++++++++--- drivers/mtd/nand/raw/brcmnand/brcmnand.h | 2 ++ 3 files changed, 46 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c +27 -0
@@ -26,6 +26,18 @@ enum { BCMBCA_CTLRDY = BIT(4), }; +#if defined(CONFIG_ARM64 ) +#define ALIGN_REQ 8 +#else +#define ALIGN_REQ 4 +#endif + +static inline bool bcmbca_nand_is_buf_aligned (void *flash_cache,void *buffer) +{ +return IS_ALIGNED ((uintptr_t )buffer,ALIGN_REQ ) && +IS_ALIGNED ((uintptr_t )flash_cache,ALIGN_REQ ); +} +static bool bcmbca_nand_intc_ack (struct brcmnand_soc *soc) { struct bcmbca_nand_soc *priv =
@@ -56,6 +68,20 @@ static void bcmbca_nand_intc_set(struct brcmnand_soc *soc, bool en)brcmnand_writel (val, mmio); } +static void bcmbca_read_data_bus (struct brcmnand_soc *soc, +void __iomem *flash_cache,u32 *buffer,int fc_words) +{ +/* +* memcpy can do unaligned aligned access depending on source +* and dest address, which is incompatible with nand cache. Fallback +* to the memcpy_fromio in such case +*/ +if (bcmbca_nand_is_buf_aligned ((void *)flash_cache, buffer)) +memcpy ((void *)buffer, (void *)flash_cache, fc_words *4 ); +else +memcpy_fromio ((void *)buffer, flash_cache, fc_words *4 ); +} +static int bcmbca_nand_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -73,6 +99,7 @@ static int bcmbca_nand_probe(struct platform_device *pdev) soc->ctlrdy_ack = bcmbca_nand_intc_ack; soc->ctlrdy_set_enabled = bcmbca_nand_intc_set; + soc->read_data_bus = bcmbca_read_data_bus;return brcmnand_probe (pdev, soc); }
drivers/mtd/nand/raw/brcmnand/brcmnand.c +17 -3
@@ -851,6 +851,20 @@ static inline u32 edu_readl(struct brcmnand_controller *ctrl,return brcmnand_readl (ctrl->edu_base + offs); } +static inline void brcmnand_read_data_bus (struct brcmnand_controller *ctrl, +void __iomem *flash_cache,u32 *buffer,int fc_words) +{ +struct brcmnand_soc *soc = ctrl->soc; +int i; + +if (soc->read_data_bus) { + soc->read_data_bus (soc, flash_cache, buffer, fc_words); + }else { +for (i =0 ; i < fc_words; i++) + buffer[i] =brcmnand_read_fc (ctrl, i); + } +} +static void brcmnand_clear_ecc_addr (struct brcmnand_controller *ctrl) {
@@ -1975,7 +1989,7 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip, {struct brcmnand_host *host =nand_get_controller_data (chip);struct brcmnand_controller *ctrl = host->ctrl; -int i, j, ret =0 ; +int i, ret =0 ;brcmnand_clear_ecc_addr (ctrl);
@@ -1988,8 +2002,8 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip,if (likely (buf)) {brcmnand_soc_data_bus_prepare (ctrl->soc, false); -for (j =0 ; j <FC_WORDS ; j++, buf++) - *buf =brcmnand_read_fc (ctrl, j); +brcmnand_read_data_bus (ctrl, ctrl->nand_fc, buf,FC_WORDS ); + buf +=FC_WORDS ;brcmnand_soc_data_bus_unprepare (ctrl->soc, false); }
drivers/mtd/nand/raw/brcmnand/brcmnand.h +2 -0
@@ -24,6 +24,8 @@ struct brcmnand_soc {void (*ctlrdy_set_enabled)(struct brcmnand_soc *soc,bool en);void (*prepare_data_bus)(struct brcmnand_soc *soc,bool prepare,bool is_param); +void (*read_data_bus)(struct brcmnand_soc *soc,void __iomem *flash_cache, +u32 *buffer,int fc_words);const struct brcmnand_io_ops *ops; };
Signature · 1 line
2.37.3
PATCH v3 6/10 mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
In reply to David ReganFrom: William Zhang <[email protected]>
BCMBCA broadband SoC based board design does not specify ecc setting in dts but rather use the SoC NAND strap info to obtain the ecc strength and spare area size setting. Add brcm,nand-ecc-use-strap dts propety for this purpose and update driver to support this option.
The generic nand ecc settings still take precedence over this flag. For example, if nand-ecc-strength is set in the dts, the driver ignores the strap setting and falls back to original behavior. This makes sure that the existing BCMBCA board dts still works the old way even the strap flag is set in the BCMBCA chip dtsi.
---
Changes in v3: None
---
Changes in v2:
- Minor cosmetic fixes
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 83 ++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 7 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +76 -7
@@ -1038,6 +1038,19 @@ static inline int brcmnand_sector_1k_shift(struct brcmnand_controller *ctrl)return -1 ; } +static int brcmnand_get_sector_size_1k (struct brcmnand_host *host) +{ +struct brcmnand_controller *ctrl = host->ctrl; +int shift =brcmnand_sector_1k_shift (ctrl); +u16 acc_control_offs =brcmnand_cs_offset (ctrl, host->cs, +BRCMNAND_CS_ACC_CONTROL ); + +if (shift <0 ) +return 0 ; + +return (nand_readreg (ctrl, acc_control_offs) >> shift) &0x1 ; +} +static void brcmnand_set_sector_size_1k (struct brcmnand_host *host,int val) {struct brcmnand_controller *ctrl = host->ctrl;
@@ -1055,6 +1068,38 @@ static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val)nand_writereg (ctrl, acc_control_offs, tmp); } +static int brcmnand_get_spare_size (struct brcmnand_host *host) +{ +struct brcmnand_controller *ctrl = host->ctrl; +u16 acc_control_offs =brcmnand_cs_offset (ctrl, host->cs, +BRCMNAND_CS_ACC_CONTROL ); +u32 acc =nand_readreg (ctrl, acc_control_offs); + +return (acc &brcmnand_spare_area_mask (ctrl)); +} + +static int brcmnand_get_ecc_strength (struct brcmnand_host *host) +{ +struct brcmnand_controller *ctrl = host->ctrl; +u16 acc_control_offs =brcmnand_cs_offset (ctrl, host->cs, +BRCMNAND_CS_ACC_CONTROL ); +int sector_size_1k =brcmnand_get_sector_size_1k (host); +int spare_area_size, ecc_level, ecc_strength; +u32 acc; + + spare_area_size =brcmnand_get_spare_size (host); + acc =nand_readreg (ctrl, acc_control_offs); + ecc_level = (acc &brcmnand_ecc_level_mask (ctrl)) >> ctrl->ecc_level_shift; +if (sector_size_1k) + ecc_strength = ecc_level *2 ; +else if (spare_area_size ==16 && ecc_level ==15 ) + ecc_strength =1 ;/* hamming */ +else + ecc_strength = ecc_level; + +return ecc_strength; +} +/*********************************************************************** * CS_NAND_SELECT ***********************************************************************/
@@ -2622,19 +2667,43 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)nanddev_get_memorg (&chip->base);struct brcmnand_controller *ctrl = host->ctrl;struct brcmnand_cfg *cfg = &host->hwcfg; -char msg[128 ]; +struct device_node *np =nand_get_flash_node (chip);u32 offs, tmp, oob_sector; -int ret; +int ret, sector_size_1k =0 ; +bool use_strap = false; +char msg[128 ];memset (cfg,0 ,sizeof (*cfg)); + use_strap =of_property_read_bool (np,"brcm,nand-ecc-use-strap" ); - ret =of_property_read_u32 (nand_get_flash_node (chip), -"brcm,nand-oob-sector-size" , +/* +* Set ECC size and strength based on hw configuration from strap +* if device tree does not specify them and use strap property is set +* If ecc strength is set in dts, don't use strap setting. +*/ +if (chip->ecc.strength) + use_strap =0 ; + +if (use_strap) { + chip->ecc.strength =brcmnand_get_ecc_strength (host); + sector_size_1k =brcmnand_get_sector_size_1k (host); +if (chip->ecc.size ==0 ) { +if (sector_size_1k <0 ) + chip->ecc.size =512 ; +else + chip->ecc.size =512 << sector_size_1k; + } + } + + ret =of_property_read_u32 (np,"brcm,nand-oob-sector-size" , &oob_sector);if (ret) { -/* Use detected size */ - cfg->spare_area_size = mtd->oobsize / - (mtd->writesize >>FC_SHIFT ); +if (use_strap) + cfg->spare_area_size =brcmnand_get_spare_size (host); +else +/* Use detected size */ + cfg->spare_area_size = mtd->oobsize / + (mtd->writesize >>FC_SHIFT ); }else { cfg->spare_area_size = oob_sector; }
Signature · 1 line
2.37.3
Miquel Raynal
maintainerRe: [PATCH v3 06/10] mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
Hi David,
Quoted 12 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +4
-2@@ -2622,19 +2667,43 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)nanddev_get_memorg (&chip->base);struct brcmnand_controller *ctrl = host->ctrl;struct brcmnand_cfg *cfg = &host->hwcfg; -char msg[128 ]; +struct device_node *np =nand_get_flash_node (chip);u32 offs, tmp, oob_sector; -int ret; +int ret, sector_size_1k =0 ; +bool use_strap = false; +char msg[128 ];
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2683
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +6
-2memset (cfg,0 ,sizeof (*cfg)); + use_strap =of_property_read_bool (np,"brcm,nand-ecc-use-strap" ); - ret = of_property_read_u32(nand_get_flash_node(chip), - "brcm,nand-oob-sector-size", +/* +* Set ECC size and strength based on hw configuration from strap +* if device tree does not specify them and use strap property is set +* If ecc strength is set in dts, don't use strap setting. +*/
You would have to use the strap settings only if the property is set. If not property is set, the default from the core should apply I guess.
Quoted 19 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +15
-2+if (chip->ecc.strength) + use_strap =0 ; + +if (use_strap) { + chip->ecc.strength =brcmnand_get_ecc_strength (host); + sector_size_1k =brcmnand_get_sector_size_1k (host); +if (chip->ecc.size ==0 ) { +if (sector_size_1k <0 ) + chip->ecc.size =512 ; +else + chip->ecc.size =512 << sector_size_1k; + } + } + + ret =of_property_read_u32 (np,"brcm,nand-oob-sector-size" , &oob_sector);if (ret) { -/* Use detected size */ - cfg->spare_area_size = mtd->oobsize /
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2709
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +6
-1- (mtd->writesize >>FC_SHIFT ); +if (use_strap) + cfg->spare_area_size =brcmnand_get_spare_size (host); +else +/* Use detected size */ + cfg->spare_area_size = mtd->oobsize / + (mtd->writesize >>FC_SHIFT ); }else { cfg->spare_area_size = oob_sector; }
Thanks,
Miquèl
William Zhang
maintainerRe: [PATCH v3 06/10] mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
Hi Miquel,
Quoted 17 lines · Miquel Raynal
Hi David,
Quoted 15 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +5
-2@@ -2622,19 +2667,43 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)nanddev_get_memorg (&chip->base);struct brcmnand_controller *ctrl = host->ctrl;struct brcmnand_cfg *cfg = &host->hwcfg; -char msg[128 ]; +struct device_node *np =nand_get_flash_node (chip);u32 offs, tmp, oob_sector; -int ret; +int ret, sector_size_1k =0 ; +bool use_strap = false; +char msg[128 ];memset (cfg,0 ,sizeof (*cfg)); + use_strap =of_property_read_bool (np,"brcm,nand-ecc-use-strap" );
Quoted 11 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2683
Quoted 7 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +5
-2- ret = of_property_read_u32(nand_get_flash_node(chip), - "brcm,nand-oob-sector-size", +/* +* Set ECC size and strength based on hw configuration from strap +* if device tree does not specify them and use strap property is set +* If ecc strength is set in dts, don't use strap setting. +*/ You would have to use the strap settings only if the property is set. If not property is set, the default from the core should apply I guess.
Maybe the comment confuse you... I will make it more clear. But the logic here is exactly what you said. If no properties are set, the core value is already set in chip->ecc.strength and chip->ecc.size and it clear the use_strap flag too.
Quoted 33 lines
Quoted 19 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +15
-2+if (chip->ecc.strength) + use_strap =0 ; + +if (use_strap) { + chip->ecc.strength =brcmnand_get_ecc_strength (host); + sector_size_1k =brcmnand_get_sector_size_1k (host); +if (chip->ecc.size ==0 ) { +if (sector_size_1k <0 ) + chip->ecc.size =512 ; +else + chip->ecc.size =512 << sector_size_1k; + } + } + + ret =of_property_read_u32 (np,"brcm,nand-oob-sector-size" , &oob_sector);if (ret) { -/* Use detected size */ - cfg->spare_area_size = mtd->oobsize /drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2709
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +6
-1- (mtd->writesize >>FC_SHIFT ); +if (use_strap) + cfg->spare_area_size =brcmnand_get_spare_size (host); +else +/* Use detected size */ + cfg->spare_area_size = mtd->oobsize / + (mtd->writesize >>FC_SHIFT ); }else { cfg->spare_area_size = oob_sector; }Thanks,
Miquèl
PATCH v3 7/10 mtd: rawnand: brcmnand: Support write protection setting from dts
In reply to David ReganFrom: William Zhang <[email protected]>
The write protection feature is controlled by the module parameter wp_on with default set to enabled. But not all the board use this feature especially in BCMBCA broadband board. And module parameter is not sufficient as different board can have different option. Add a device tree property and allow this feature to be configured through the board dts on per board basis.
---
Changes in v3: None
---
Changes in v2: None
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +7 -1
@@ -3081,7 +3081,7 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)struct brcmnand_controller *ctrl;struct brcmnand_host *host;struct resource *res; -int ret; +int ret, wp_dt;if (dn && !of_match_node (brcmnand_of_match, dn))return -ENODEV ;
@@ -3218,6 +3218,12 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)/* Disable XOR addressing */ brcmnand_rmw_reg (ctrl,BRCMNAND_CS_XOR ,0xff ,0 ,0 ); +/* Not all boards support write protect (WP), check DT property */ +if (of_property_read_u32 (dn,"brcm,nand-use-wp" , &wp_dt) ==0 ) { +if (wp_dt >=0 && wp_dt <=2 ) + wp_on = wp_dt; + } +if (ctrl->features &BRCMNAND_HAS_WP ) {/* Permanently disable write protection */ if (wp_on ==2 )
Signature · 1 line
2.37.3
PATCH v3 8/10 mtd: rawnand: brcmnand: exec_op helper functions return type fixes
In reply to David Reganfix return type for exec_op reset and status detect helper functions
---
Changes in v3: None
---
Changes in v2:
- Added to patch series
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +9 -6
@@ -625,7 +625,7 @@ enum {/* Only for v7.2 */ #define ACC_CONTROL_ECC_EXT_SHIFT 13 -static u8 brcmnand_status (struct brcmnand_host *host); +static int brcmnand_status (struct brcmnand_host *host);static inline bool brcmnand_non_mmio_ops (struct brcmnand_controller *ctrl) {
@@ -1749,7 +1749,7 @@ static int brcmnand_waitfunc(struct nand_chip *chip)INTFC_FLASH_STATUS ; } -static u8 brcmnand_status (struct brcmnand_host *host) +static int brcmnand_status (struct brcmnand_host *host) {struct nand_chip *chip = &host->chip;struct mtd_info *mtd =nand_to_mtd (chip);
@@ -1760,7 +1760,7 @@ static u8 brcmnand_status(struct brcmnand_host *host)return brcmnand_waitfunc (chip); } -static u8 brcmnand_reset (struct brcmnand_host *host) +static int brcmnand_reset (struct brcmnand_host *host) {struct nand_chip *chip = &host->chip;
@@ -2492,11 +2492,14 @@ static int brcmnand_exec_op(struct nand_chip *chip,if (brcmnand_op_is_status (op)) { status = op->instrs[1 ].ctx.data.buf.in; - *status =brcmnand_status (host); + ret =brcmnand_status (host); +if (ret <0 ) +return ret; + + *status = ret &0xFF ;return 0 ; - } -else if (brcmnand_op_is_reset (op)) { + }else if (brcmnand_op_is_reset (op)) { ret =brcmnand_reset (host);if (ret <0 )return ret;
Signature · 1 line
2.37.3
Miquel Raynal
maintainerRe: [PATCH v3 08/10] mtd: rawnand: brcmnand: exec_op helper functions return type fixes
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:56 -0800:
Quoted 1 line
fix return type for
exec_opreset and status detect helper functions
Style, please.
Fix --> .
Quoted 54 lines
Reported-by Dan Carpenter <[email protected]>Fixes 3cc4718fa644 ("mtd: rawnand: brcmnand: exec_op implementation")Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +6
-4@@ -625,7 +625,7 @@ enum {/* Only for v7.2 */ #define ACC_CONTROL_ECC_EXT_SHIFT 13 -static u8 brcmnand_status (struct brcmnand_host *host); +static int brcmnand_status (struct brcmnand_host *host);static inline bool brcmnand_non_mmio_ops (struct brcmnand_controller *ctrl) {@@ -1749,7 +1749,7 @@ static int brcmnand_waitfunc(struct nand_chip *chip)INTFC_FLASH_STATUS ; } -static u8 brcmnand_status (struct brcmnand_host *host) +static int brcmnand_status (struct brcmnand_host *host) {struct nand_chip *chip = &host->chip;struct mtd_info *mtd =nand_to_mtd (chip);@@ -1760,7 +1760,7 @@ static u8 brcmnand_status(struct brcmnand_host *host)return brcmnand_waitfunc (chip); } -static u8 brcmnand_reset (struct brcmnand_host *host) +static int brcmnand_reset (struct brcmnand_host *host) {struct nand_chip *chip = &host->chip;@@ -2492,11 +2492,14 @@ static int brcmnand_exec_op(struct nand_chip *chip,if (brcmnand_op_is_status (op)) { status = op->instrs[1 ].ctx.data.buf.in; - *status =brcmnand_status (host); + ret =brcmnand_status (host); +if (ret <0 ) +return ret;
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_exec_op(struct nand_chip *chip, · line 2505
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-2+ + *status = ret &0xFF ;return 0 ; - } -else if (brcmnand_op_is_reset (op)) { + }else if (brcmnand_op_is_reset (op)) { ret =brcmnand_reset (host);if (ret <0 )return ret;
Thanks,
Miquèl
PATCH v3 9/10 mtd: rawnand: brcmnand: update log level messages
In reply to David ReganUpdate log level messages so that more critical messages can be seen.
---
Changes in v3: None
---
Changes in v2:
- Added to patch series
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3 -3
@@ -1143,7 +1143,7 @@ static int bcmnand_ctrl_poll_status(struct brcmnand_host *host,if ((val & mask) == expected_val)return 0 ; -dev_warn (ctrl->dev,"timeout on status poll (expected %x got %x)\n" , +dev_err (ctrl->dev,"timeout on status poll (expected %x got %x)\n" , expected_val, val & mask);return -ETIMEDOUT ;
@@ -2196,7 +2196,7 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip,return err; } -dev_dbg (ctrl->dev,"uncorrectable error at 0x%llx\n" , +dev_err (ctrl->dev,"uncorrectable error at 0x%llx\n" , (unsigned long long )err_addr); mtd->ecc_stats.failed++;/* NAND layer expects zero on ECC errors */
@@ -2211,7 +2211,7 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, err =brcmnand_read_by_pio (mtd, chip, addr, trans, buf, oob, &err_addr); -dev_dbg (ctrl->dev,"corrected error at 0x%llx\n" , +dev_info (ctrl->dev,"corrected error at 0x%llx\n" , (unsigned long long )err_addr); mtd->ecc_stats.corrected += corrected;/* Always exceed the software-imposed threshold */
Signature · 1 line
2.37.3
Miquel Raynal
maintainerRe: [PATCH v3 09/10] mtd: rawnand: brcmnand: update log level messages
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:57 -0800:
Quoted 19 lines
Update log level messages so that more critical messages can be seen.
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int bcmnand_ctrl_poll_status(struct brcmnand_host *host, · line 1146
Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1
-1@@ -1143,7 +1143,7 @@ static int bcmnand_ctrl_poll_status(struct brcmnand_host *host,if ((val & mask) == expected_val)return 0 ; - dev_warn(ctrl->dev, "timeout on status poll (expected %x got %x)\n", + dev_err(ctrl->dev, "timeout on status poll (expected %x got %x)\n",
I don't see the point but if you want.
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, · line 2199
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1
-1expected_val, val & mask);return -ETIMEDOUT ;@@ -2196,7 +2196,7 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip,return err; } - dev_dbg(ctrl->dev, "uncorrectable error at 0x%llx\n", + dev_err(ctrl->dev, "uncorrectable error at 0x%llx\n",
Upper layer will complain, you can keep this at the debug level.
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, · line 2214
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1
-1(unsigned long long)err_addr); mtd->ecc_stats.failed++;/* NAND layer expects zero on ECC errors */ @@ -2211,7 +2211,7 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, err =brcmnand_read_by_pio (mtd, chip, addr, trans, buf, oob, &err_addr); - dev_dbg(ctrl->dev, "corrected error at 0x%llx\n", + dev_info(ctrl->dev, "corrected error at 0x%llx\n",
Definitely not! Way too verbose. Please keep this one as it is.
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, · line 2217
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0(unsigned long long)err_addr); mtd->ecc_stats.corrected += corrected;/* Always exceed the software-imposed threshold */
Thanks,
Miquèl
Re: [PATCH v3 09/10] mtd: rawnand: brcmnand: update log level messages
Quoted 39 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:57 -0800:
Quoted 19 lines
Update log level messages so that more critical messages can be seen.
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0drivers/mtd/nand/raw/brcmnand/brcmnand.c static int bcmnand_ctrl_poll_status(struct brcmnand_host *host, · line 1146
Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1
-1@@ -1143,7 +1143,7 @@ static int bcmnand_ctrl_poll_status(struct brcmnand_host *host,if ((val & mask) == expected_val)return 0 ; - dev_warn(ctrl->dev, "timeout on status poll (expected %x got %x)\n", + dev_err(ctrl->dev, "timeout on status poll (expected %x got %x)\n",I don't see the point but if you want.
Quoted 7 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0expected_val, val & mask);return -ETIMEDOUT ;@@ -2196,7 +2196,7 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip,return err; }
Quoted 4 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, · line 2199
Quoted 2 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1
-1- dev_dbg(ctrl->dev, "uncorrectable error at 0x%llx\n", + dev_err(ctrl->dev, "uncorrectable error at 0x%llx\n",Upper layer will complain, you can keep this at the debug level.
I've discovered that the upper layer will complain, but typically with information that is maybe not useful for debugging.
Quoted 8 lines
Quoted 8 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0(unsigned long long)err_addr); mtd->ecc_stats.failed++;/* NAND layer expects zero on ECC errors */ @@ -2211,7 +2211,7 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, err =brcmnand_read_by_pio (mtd, chip, addr, trans, buf, oob, &err_addr);
Quoted 4 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, · line 2214
Quoted 2 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1
-1- dev_dbg(ctrl->dev, "corrected error at 0x%llx\n", + dev_info(ctrl->dev, "corrected error at 0x%llx\n",Definitely not! Way too verbose. Please keep this one as it is.
ok
Quoted 8 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, · line 2217
Quoted 4 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0(unsigned long long)err_addr); mtd->ecc_stats.corrected += corrected;/* Always exceed the software-imposed threshold */ Thanks,
Miquèl
Thanks!
-Dave
PATCH v3 10/10 mtd: rawnand: brcmnand: allow for on-die ecc
In reply to David ReganAllow settings for on-die ecc such that if on-die ECC is selected don't error out but require ECC strap setting of zero
---
Changes in v3: None
---
Changes in v2:
- Added to patch series
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +10 -4
@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength); +return -EINVAL ; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {
@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret; -brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" ); +brcmnand_set_ecc_enabled (host,0 ); + }else +brcmnand_set_ecc_enabled (host,1 );brcmnand_print_cfg (host, msg, cfg);dev_info (ctrl->dev,"detected %s\n" , msg);
Signature · 1 line
2.37.3
Miquel Raynal
maintainerRe: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:58 -0800:
Quoted 19 lines
Allow settings for on-die ecc such that if on-die ECC is selected don't error out but require ECC strap setting of zero
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2732
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-3@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength);
Can you use a more formal string? Also clarify it because I don't really understand what it leads to.
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2803
Quoted 12 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +4
-1+return -EINVAL ; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret; -brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" );
Not needed.
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2806
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+brcmnand_set_ecc_enabled (host,0 ); + }else +brcmnand_set_ecc_enabled (host,1 );
Style is wrong, but otherwise I think ECC should be kept disabled while not in active use, so I am a bit surprised by this line.
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2809
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0brcmnand_print_cfg (host, msg, cfg);dev_info (ctrl->dev,"detected %s\n" , msg);
Thanks,
Miquèl
Re: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi Miquèl,
Quoted 26 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:58 -0800:
Quoted 21 lines
Allow settings for on-die ecc such that if on-die ECC is selected don't error out but require ECC strap setting of zero
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2732
Quoted 7 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-3if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength);Can you use a more formal string? Also clarify it because I don't really understand what it leads to.
How about:
dev_err(ctrl->dev, "HW ECC set to %d, must be zero for on-die ECC\n",
Quoted 10 lines
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-0+return -EINVAL ; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret;
Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2803
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-1-brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" );Not needed.
Will remove.
Quoted 7 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2806
Quoted 4 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+brcmnand_set_ecc_enabled (host,0 ); + }else +brcmnand_set_ecc_enabled (host,1 );Style is wrong, but otherwise I think ECC should be kept disabled while not in active use, so I am a bit surprised by this line.
This is a double check to turn on/off our hardware ECC.
Quoted 8 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2809
Quoted 4 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0brcmnand_print_cfg (host, msg, cfg);dev_info (ctrl->dev,"detected %s\n" , msg);Thanks,
Miquèl
Thanks!
-Dave
Miquel Raynal
maintainerRe: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi David,
[email protected] wrote on Thu, 25 Jan 2024 11:47:46 -0800:
Quoted 40 lines
Hi Miquèl,
Quoted 26 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:58 -0800:
Quoted 21 lines
Allow settings for on-die ecc such that if on-die ECC is selected don't error out but require ECC strap setting of zero
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2732
Quoted 7 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-3if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength);Can you use a more formal string? Also clarify it because I don't really understand what it leads to.
Quoted 3 lines
How about:
dev_err(ctrl->dev, "HW ECC set to %d, must be zero for on-die ECC\n",
Actually I am wondering how legitimate this is. Just don't enable the on host ECC engine if it's not in use. No need to check the core's choice.
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-0+return -EINVAL ; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret;Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2803
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-1-brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" );Not needed.
Will remove.
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2806
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+brcmnand_set_ecc_enabled (host,0 ); + }else +brcmnand_set_ecc_enabled (host,1 );Style is wrong, but otherwise I think ECC should be kept disabled while not in active use, so I am a bit surprised by this line.
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
Thanks,
Miquèl
Re: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi Miquèl,
Quoted 45 lines · Miquel Raynal
Hi David,
[email protected] wrote on Thu, 25 Jan 2024 11:47:46 -0800:
Quoted 40 lines
Hi Miquèl,
Quoted 36 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:58 -0800:
Quoted 19 lines
Allow settings for on-die ecc such that if on-die ECC is selected don't error out but require ECC strap setting of zero
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2732
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-3@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength);Can you use a more formal string? Also clarify it because I don't really understand what it leads to.
Quoted 7 lines
Quoted 3 lines
How about:
dev_err(ctrl->dev, "HW ECC set to %d, must be zero for on-die ECC\n",
Actually I am wondering how legitimate this is. Just don't enable the on host ECC engine if it's not in use. No need to check the core's choice.
Our chip ECC engine will either be on if it's needed or off if it's not. Either I can do that in one place or put checks in before each read/write to turn on/off the ECC engine, which seems a lot more work and changes and possible issues/problems.
Turning it on/off as needed has not been explicitly tested and could cause unforeseen consequences. This
is a minimal change which should have minimal impact.
Quoted 25 lines
Quoted 25 lines
Quoted 12 lines
Quoted 12 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-0+return -EINVAL ; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret;Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2803
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-1-brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" );Not needed.
Will remove.
Quoted 5 lines
Quoted 4 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+brcmnand_set_ecc_enabled (host,0 ); + }else +brcmnand_set_ecc_enabled (host,1 );
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Style is wrong, but otherwise I think ECC should be kept disabled while not in active use, so I am a bit surprised by this line.
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
We are already turning on the ECC enable at this point, this is just adding the option to turn it off if the NAND chip itself will be doing the ECC instead of our controller.
Quoted 3 lines
Thanks,
Miquèl
Thanks!
-Dave
Miquel Raynal
maintainerRe: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi David,
[email protected] wrote on Fri, 26 Jan 2024 11:57:39 -0800:
Quoted 93 lines
Hi Miquèl,
Quoted 45 lines · Miquel Raynal
Hi David,
[email protected] wrote on Thu, 25 Jan 2024 11:47:46 -0800:
Quoted 40 lines
Hi Miquèl,
Quoted 36 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:58 -0800:
Quoted 19 lines
Allow settings for on-die ecc such that if on-die ECC is selected don't error out but require ECC strap setting of zero
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2732
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-3@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength);Can you use a more formal string? Also clarify it because I don't really understand what it leads to.
Quoted 7 lines
Quoted 3 lines
How about:
dev_err(ctrl->dev, "HW ECC set to %d, must be zero for on-die ECC\n",
Actually I am wondering how legitimate this is. Just don't enable the on host ECC engine if it's not in use. No need to check the core's choice.
Our chip ECC engine will either be on if it's needed or off if it's not. Either I can do that in one place or put checks in before each read/write to turn on/off the ECC engine, which seems a lot more work and changes and possible issues/problems.
Turning it on/off as needed has not been explicitly tested and could cause unforeseen consequences. This
is a minimal change which should have minimal impact.Quoted 28 lines
Quoted 28 lines
Quoted 12 lines
Quoted 12 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-0+return -EINVAL ; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret;Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2803
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-1-brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" );Not needed.
Will remove.
Quoted 7 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2806
Quoted 4 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+brcmnand_set_ecc_enabled (host,0 ); + }else +brcmnand_set_ecc_enabled (host,1 );Style is wrong, but otherwise I think ECC should be kept disabled while not in active use, so I am a bit surprised by this line.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
We are already turning on the ECC enable at this point, this is just adding the option to turn it off if the NAND chip itself will be doing the ECC instead of our controller.
Sorry if I have not been clear.
This sequence:
- init
- enable hw ECC engine
Is broken.
It *cannot* work as any operation going through exec_op now may perform page reads which should be unmodified by the ECC engine. You driver *must* follow the following sequence:
- init and disable (or keep disabled) the hw ECC engine
- when you perform a page operation with correction you need to
- enable the engine
- perform the operation
- disable the engine
Thanks,
Miquèl
William Zhang
maintainerRe: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi Miquel,
Quoted 106 lines · Miquel Raynal
Hi David,
[email protected] wrote on Fri, 26 Jan 2024 11:57:39 -0800:
Quoted 93 lines
Hi Miquèl,
Quoted 45 lines · Miquel Raynal
Hi David,
[email protected] wrote on Thu, 25 Jan 2024 11:47:46 -0800:
Quoted 40 lines
Hi Miquèl,
Quoted 36 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:58 -0800:
Quoted 19 lines
Allow settings for on-die ecc such that if on-die ECC is selected don't error out but require ECC strap setting of zero
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2732
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-3@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength);Can you use a more formal string? Also clarify it because I don't really understand what it leads to.
Quoted 7 lines
Quoted 3 lines
How about:
dev_err(ctrl->dev, "HW ECC set to %d, must be zero for on-die ECC\n",
Actually I am wondering how legitimate this is. Just don't enable the on host ECC engine if it's not in use. No need to check the core's choice.
Our chip ECC engine will either be on if it's needed or off if it's not. Either I can do that in one place or put checks in before each read/write to turn on/off the ECC engine, which seems a lot more work and changes and possible issues/problems.
Turning it on/off as needed has not been explicitly tested and could cause unforeseen consequences. This
is a minimal change which should have minimal impact.Quoted 28 lines
Quoted 28 lines
Quoted 12 lines
Quoted 12 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-0+return -EINVAL ; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret;Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2803
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-1-brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" );Not needed.
Will remove.
Quoted 7 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2806
Quoted 4 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+brcmnand_set_ecc_enabled (host,0 ); + }else +brcmnand_set_ecc_enabled (host,1 );Style is wrong, but otherwise I think ECC should be kept disabled while not in active use, so I am a bit surprised by this line.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
We are already turning on the ECC enable at this point, this is just adding the option to turn it off if the NAND chip itself will be doing the ECC instead of our controller.
Quoted 7 lines
Sorry if I have not been clear.
This sequence:
- init
- enable hw ECC engine
Is broken.
ECC engine is not enabled for all the cases. Here we only intended to enable it for the nand chip that is set to use NAND_ECC_ENGINE_TYPE_ON_HOST. The logic here should better change to:
if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST)
brcmnand_set_ecc_enabled(host, 1);
else
brcmnand_set_ecc_enabled(host, 0);Quoted 8 lines
It *cannot* work as any operation going through
exec_opnow may
perform page reads which should be unmodified by the ECC engine. You > driver *must* follow the following sequence:
- init and disable (or keep disabled) the hw ECC engine
- when you perform a page operation with correction you need to
- enable the engine
- perform the operation
- disable the engine
Maybe I am missing something here but are you saying theexec_opcan
have different ecc type for page read/write at run time on the same nand chip? I don't see the op instr structure has the ecc type field and thought it is only bind to the nand chip and won't change at run time. So looks to me the init time setting to the engine based on ecc.engine_type should be sufficient.
What you described here can work for the hw.ecc read path (ecc.read_page = brcmnand_read_page) which always assumes ecc is enabled. Although it is probably not too bad with these two extra operation, it would be better if we don't have to add anything as our current code does. For the brcmnand_read_page_raw, we currently disable the engine and then re-enable it(but we need to fix it to only enable it with hw ecc engine type). So it is just opposite of you logic but works the same with no impact on the most performance critical path.
Quoted 2 lines
Thanks,
Miquèl
Miquel Raynal
maintainerRe: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi William,
[email protected] wrote on Tue, 30 Jan 2024 00:11:32 -0800:
Quoted 124 lines
Hi Miquel,
Quoted 99 lines · Miquel Raynal
Hi David,
[email protected] wrote on Fri, 26 Jan 2024 11:57:39 -0800:
Quoted 86 lines
Hi Miquèl,
Quoted 43 lines · Miquel Raynal
Hi David,
[email protected] wrote on Thu, 25 Jan 2024 11:47:46 -0800:
Quoted 39 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Hi Miquèl,
Quoted 35 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:58 -0800:
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Allow settings for on-die ecc such that if on-die ECC is selected
don't error out but require ECC strap setting of zero
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2732
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-3@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength);Can you use a more formal string? Also clarify it because I don't really understand what it leads to.
Quoted 7 lines
Quoted 3 lines
How about:
dev_err(ctrl->dev, "HW ECC set to %d, must be zero for on-die ECC\n",
Actually I am wondering how legitimate this is. Just don't enable the on host ECC engine if it's not in use. No need to check the core's choice.
Our chip ECC engine will either be on if it's needed or off if it's not. Either I can do that in one place or put checks in before each read/write to turn on/off the ECC engine, which seems a lot more work and changes and possible issues/problems.
Turning it on/off as needed has not been explicitly tested and could cause unforeseen consequences. This
is a minimal change which should have minimal impact.Quoted 23 lines
Quoted 23 lines
Quoted 9 lines
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1
-0> >>>>> >>>>>> + return -EINVAL; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret;Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2803
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-1-brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" );Not needed.
Will remove.
Quoted 6 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2806
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-0>>> >>>>>> + brcmnand_set_ecc_enabled(host, 0); + }else +brcmnand_set_ecc_enabled (host,1 );Style is wrong, but otherwise I think ECC should be kept disabled while not in active use, so I am a bit surprised by this line.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
We are already turning on the ECC enable at this point, this is just adding the option to turn it off if the NAND chip itself will be doing the ECC instead of our controller.
Quoted 7 lines
Sorry if I have not been clear.
This sequence:
- init
- enable hw ECC engine
Is broken.ECC engine is not enabled for all the cases. Here we only intended to enable it for the nand chip that is set to use
NAND_ECC_ENGINE_TYPE_ON_HOST. The logic here should better change to:
if (chip->ecc.engine_type==NAND_ECC_ENGINE_TYPE_ON_HOST)brcmnand_set_ecc_enabled(host, 1); else brcmnand_set_ecc_enabled(host, 0);Quoted 8 lines
It *cannot* work as any operation going through
exec_opnow may
perform page reads which should be unmodified by the ECC engine. You > driver *must* follow the following sequence:
- init and disable (or keep disabled) the hw ECC engine
- when you perform a page operation with correction you need to
- enable the engine
- perform the operation
- disable the engine
Maybe I am missing something here but are you saying theexec_opcan have different ecc type for page read/write at run time on the same nand chip? I don't see the op instr structure has the ecc type field and thought it is only bind to the nand chip and won't change at run time. So looks to me the init time setting to the engine based on ecc.engine_type should be sufficient.
Quoted 1 line
What you described here can work for the hw.ecc read path (ecc.read_page =
brcmnand_read_page) which always assumes ecc is enabled. Although it is probably not too bad with these two extra operation, it would be better if we don't have to add anything as our current code does. For thebrcmnand_read_page_raw, we currently disable the engine and then re-enable it(but we need to fix it to only enable it with hw ecc engine type). So it is just opposite of you logic but works the same with no impact on the most performance critical path.
This is not "my" logic, this is the "core's" logic. I am saying: your approach is broken because that is not how the API is supposed to work, but it mostly works in the standard case.
Thanks,
Miquèl
Re: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi Miquel,
Quoted 129 lines · Miquel Raynal
Hi William,
[email protected] wrote on Tue, 30 Jan 2024 00:11:32 -0800:
Quoted 124 lines
Hi Miquel,
Quoted 99 lines · Miquel Raynal
Hi David,
[email protected] wrote on Fri, 26 Jan 2024 11:57:39 -0800:
Quoted 86 lines
Hi Miquèl,
Quoted 43 lines · Miquel Raynal
Hi David,
[email protected] wrote on Thu, 25 Jan 2024 11:47:46 -0800:
Quoted 39 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Hi Miquèl,
Quoted 35 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:58 -0800:
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Allow settings for on-die ecc such that if on-die ECC is selected
don't error out but require ECC strap setting of zero
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2732
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-3@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength);Can you use a more formal string? Also clarify it because I don't really understand what it leads to.
Quoted 7 lines
Quoted 3 lines
How about:
dev_err(ctrl->dev, "HW ECC set to %d, must be zero for on-die ECC\n",
Actually I am wondering how legitimate this is. Just don't enable the on host ECC engine if it's not in use. No need to check the core's choice.
Our chip ECC engine will either be on if it's needed or off if it's not. Either I can do that in one place or put checks in before each read/write to turn on/off the ECC engine, which seems a lot more work and changes and possible issues/problems.
Turning it on/off as needed has not been explicitly tested and could cause unforeseen consequences. This
is a minimal change which should have minimal impact.Quoted 23 lines
Quoted 23 lines
Quoted 9 lines
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1
-0> >>>>> >>>>>> + return -EINVAL; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret;Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2803
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-1-brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" );Not needed.
Will remove.
Quoted 6 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2806
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-0>>> >>>>>> + brcmnand_set_ecc_enabled(host, 0); + }else +brcmnand_set_ecc_enabled (host,1 );Style is wrong, but otherwise I think ECC should be kept disabled while not in active use, so I am a bit surprised by this line.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
We are already turning on the ECC enable at this point, this is just adding the option to turn it off if the NAND chip itself will be doing the ECC instead of our controller.
Quoted 7 lines
Sorry if I have not been clear.
This sequence:
- init
- enable hw ECC engine
Is broken.ECC engine is not enabled for all the cases. Here we only intended to enable it for the nand chip that is set to use
NAND_ECC_ENGINE_TYPE_ON_HOST. The logic here should better change to:
if (chip->ecc.engine_type==NAND_ECC_ENGINE_TYPE_ON_HOST)brcmnand_set_ecc_enabled(host, 1); else brcmnand_set_ecc_enabled(host, 0);Quoted 8 lines
It *cannot* work as any operation going through
exec_opnow may
perform page reads which should be unmodified by the ECC engine. You > driver *must* follow the following sequence:
- init and disable (or keep disabled) the hw ECC engine
- when you perform a page operation with correction you need to
- enable the engine
- perform the operation
- disable the engine
Maybe I am missing something here but are you saying theexec_opcan have different ecc type for page read/write at run time on the same nand chip? I don't see the op instr structure has the ecc type field and thought it is only bind to the nand chip and won't change at run time. So looks to me the init time setting to the engine based on ecc.engine_type should be sufficient.
Quoted 5 lines
Quoted 1 line
What you described here can work for the hw.ecc read path (ecc.read_page =
brcmnand_read_page) which always assumes ecc is enabled. Although it is probably not too bad with these two extra operation, it would be better if we don't have to add anything as our current code does. For thebrcmnand_read_page_raw, we currently disable the engine and then re-enable it(but we need to fix it to only enable it with hw ecc engine type). So it is just opposite of you logic but works the same with no impact on the most performance critical path.This is not "my" logic, this is the "core's" logic. I am saying: your approach is broken because that is not how the API is supposed to work, but it mostly works in the standard case.
In the interest of minimizing register writes, would it be acceptable to enable/disable ECC at the beginning of a standard
path transfer but not, after the transfer, turn off the ECC? This should not affect other standard path operations nor affect the exec_op path as those are low level transfers which our ECC engine would not touch and the NAND device driver should be responsible for turning on/off its own ECC.
Quoted 3 lines
Thanks,
Miquèl
Thanks!
-Dave
Miquel Raynal
maintainerRe: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi David,
[email protected] wrote on Tue, 30 Jan 2024 07:26:02 -0800:
Quoted 138 lines
Hi Miquel,
Quoted 129 lines · Miquel Raynal
Hi William,
[email protected] wrote on Tue, 30 Jan 2024 00:11:32 -0800:
Quoted 124 lines
Hi Miquel,
Quoted 99 lines · Miquel Raynal
Hi David,
[email protected] wrote on Fri, 26 Jan 2024 11:57:39 -0800:
Quoted 86 lines
Hi Miquèl,
Quoted 43 lines · Miquel Raynal
Hi David,
[email protected] wrote on Thu, 25 Jan 2024 11:47:46 -0800:
Quoted 39 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Hi Miquèl,
Quoted 35 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:58 -0800:
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Allow settings for on-die ecc such that if on-die ECC is selected
don't error out but require ECC strap setting of zero
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2732
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-3@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength);Can you use a more formal string? Also clarify it because I don't really understand what it leads to.
Quoted 7 lines
Quoted 3 lines
How about:
dev_err(ctrl->dev, "HW ECC set to %d, must be zero for on-die ECC\n",
Actually I am wondering how legitimate this is. Just don't enable the on host ECC engine if it's not in use. No need to check the core's choice.
Our chip ECC engine will either be on if it's needed or off if it's not. Either I can do that in one place or put checks in before each read/write to turn on/off the ECC engine, which seems a lot more work and changes and possible issues/problems.
Turning it on/off as needed has not been explicitly tested and could cause unforeseen consequences. This
is a minimal change which should have minimal impact.Quoted 23 lines
Quoted 23 lines
Quoted 9 lines
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1
-0> >>>>> >>>>>> + return -EINVAL; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret;Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2803
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-1-brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" );Not needed.
Will remove.
Quoted 6 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2806
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-0>>> >>>>>> + brcmnand_set_ecc_enabled(host, 0); + }else +brcmnand_set_ecc_enabled (host,1 );Style is wrong, but otherwise I think ECC should be kept disabled while not in active use, so I am a bit surprised by this line.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
We are already turning on the ECC enable at this point, this is just adding the option to turn it off if the NAND chip itself will be doing the ECC instead of our controller.
Quoted 7 lines
Sorry if I have not been clear.
This sequence:
- init
- enable hw ECC engine
Is broken.ECC engine is not enabled for all the cases. Here we only intended to enable it for the nand chip that is set to use
NAND_ECC_ENGINE_TYPE_ON_HOST. The logic here should better change to:
if (chip->ecc.engine_type==NAND_ECC_ENGINE_TYPE_ON_HOST)brcmnand_set_ecc_enabled(host, 1); else brcmnand_set_ecc_enabled(host, 0);Quoted 8 lines
It *cannot* work as any operation going through
exec_opnow may
perform page reads which should be unmodified by the ECC engine. You > driver *must* follow the following sequence:
- init and disable (or keep disabled) the hw ECC engine
- when you perform a page operation with correction you need to
- enable the engine
- perform the operation
- disable the engine
Maybe I am missing something here but are you saying theexec_opcan have different ecc type for page read/write at run time on the same nand chip? I don't see the op instr structure has the ecc type field and thought it is only bind to the nand chip and won't change at run time. So looks to me the init time setting to the engine based on ecc.engine_type should be sufficient.Quoted 5 lines
Quoted 1 line
What you described here can work for the hw.ecc read path (ecc.read_page =
brcmnand_read_page) which always assumes ecc is enabled. Although it is probably not too bad with these two extra operation, it would be better if we don't have to add anything as our current code does. For thebrcmnand_read_page_raw, we currently disable the engine and then re-enable it(but we need to fix it to only enable it with hw ecc engine type). So it is just opposite of you logic but works the same with no impact on the most performance critical path.This is not "my" logic, this is the "core's" logic. I am saying: your approach is broken because that is not how the API is supposed to work, but it mostly works in the standard case.
Quoted 6 lines
In the interest of minimizing register writes, would it be acceptable to enable/disable ECC at the beginning of a standard
path transfer but not, after the transfer, turn off the ECC? This should not affect other standard path operations nor affect theexec_oppath as those are low level transfers which our ECC engine would not touch and the NAND device driver should be responsible for turning on/off its own ECC.
Do you have legitimate concerns about this register write taking way more time than I could expect? Because compared to the transfer of a NAND page + tR/tPROG it should not be noticeable. I don't see how you could even measure such impact actually, unless the register write does way more than usual. I'm fine with the above idea if you show me it has an interest.
Thanks,
Miquèl
William Zhang
maintainerRe: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi Miquel,
Quoted 149 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 30 Jan 2024 07:26:02 -0800:
Quoted 138 lines
Hi Miquel,
Quoted 129 lines · Miquel Raynal
Hi William,
[email protected] wrote on Tue, 30 Jan 2024 00:11:32 -0800:
Quoted 124 lines
Hi Miquel,
Quoted 99 lines · Miquel Raynal
Hi David,
[email protected] wrote on Fri, 26 Jan 2024 11:57:39 -0800:
Quoted 86 lines
Hi Miquèl,
Quoted 43 lines · Miquel Raynal
Hi David,
[email protected] wrote on Thu, 25 Jan 2024 11:47:46 -0800:
Quoted 39 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Hi Miquèl,
Quoted 35 lines · Miquel Raynal
Hi David,
[email protected] wrote on Tue, 23 Jan 2024 19:04:58 -0800:
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Allow settings for on-die ecc such that if on-die ECC is selected
don't error out but require ECC strap setting of zero
Signed-off-by David Regan <[email protected]>Reviewed-by William Zhang <[email protected]>---
Changes in v3: None
---
Changes in v2:
- Added to patch series--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2732
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-3@@ -2727,9 +2727,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) cfg->blk_adr_bytes =get_blk_adr_bytes (mtd->size, mtd->writesize);if (chip->ecc.engine_type !=NAND_ECC_ENGINE_TYPE_ON_HOST ) { -dev_err (ctrl->dev,"only HW ECC supported; selected: %d\n" , - chip->ecc.engine_type); -return -EINVAL ; +if (chip->ecc.strength) { +dev_err (ctrl->dev,"ERROR!!! HW ECC must be set to zero for non-hardware ECC; selected: %d\n" , + chip->ecc.strength);Can you use a more formal string? Also clarify it because I don't really understand what it leads to.
Quoted 7 lines
Quoted 3 lines
How about:
dev_err(ctrl->dev, "HW ECC set to %d, must be zero for on-die ECC\n",
Actually I am wondering how legitimate this is. Just don't enable the on host ECC engine if it's not in use. No need to check the core's choice.
Our chip ECC engine will either be on if it's needed or off if it's not. Either I can do that in one place or put checks in before each read/write to turn on/off the ECC engine, which seems a lot more work and changes and possible issues/problems.
Turning it on/off as needed has not been explicitly tested and could cause unforeseen consequences. This
is a minimal change which should have minimal impact.Quoted 23 lines
Quoted 23 lines
Quoted 9 lines
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1
-0> >>>>> >>>>>> + return -EINVAL; + } }if (chip->ecc.algo ==NAND_ECC_ALGO_UNKNOWN ) {@@ -2797,7 +2799,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (ret)return ret;Quoted 5 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2803
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-1-brcmnand_set_ecc_enabled (host,1 ); +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_ON_DIE ) { +dev_dbg (ctrl->dev,"Disable HW ECC for on-die ECC\n" );Not needed.
Will remove.
Quoted 6 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2806
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +2
-0>>> >>>>>> + brcmnand_set_ecc_enabled(host, 0); + }else +brcmnand_set_ecc_enabled (host,1 );Style is wrong, but otherwise I think ECC should be kept disabled while not in active use, so I am a bit surprised by this line.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
We are already turning on the ECC enable at this point, this is just adding the option to turn it off if the NAND chip itself will be doing the ECC instead of our controller.
Quoted 7 lines
Sorry if I have not been clear.
This sequence:
- init
- enable hw ECC engine
Is broken.ECC engine is not enabled for all the cases. Here we only intended to enable it for the nand chip that is set to use
NAND_ECC_ENGINE_TYPE_ON_HOST. The logic here should better change to:
if (chip->ecc.engine_type==NAND_ECC_ENGINE_TYPE_ON_HOST)brcmnand_set_ecc_enabled(host, 1); else brcmnand_set_ecc_enabled(host, 0);Quoted 8 lines
It *cannot* work as any operation going through
exec_opnow may
perform page reads which should be unmodified by the ECC engine. You > driver *must* follow the following sequence:
- init and disable (or keep disabled) the hw ECC engine
- when you perform a page operation with correction you need to
- enable the engine
- perform the operation
- disable the engine
Maybe I am missing something here but are you saying theexec_opcan have different ecc type for page read/write at run time on the same nand chip? I don't see the op instr structure has the ecc type field and thought it is only bind to the nand chip and won't change at run time. So looks to me the init time setting to the engine based on ecc.engine_type should be sufficient.Quoted 5 lines
Quoted 1 line
What you described here can work for the hw.ecc read path (ecc.read_page =
brcmnand_read_page) which always assumes ecc is enabled. Although it is probably not too bad with these two extra operation, it would be better if we don't have to add anything as our current code does. For thebrcmnand_read_page_raw, we currently disable the engine and then re-enable it(but we need to fix it to only enable it with hw ecc engine type). So it is just opposite of you logic but works the same with no impact on the most performance critical path.This is not "my" logic, this is the "core's" logic. I am saying: your approach is broken because that is not how the API is supposed to work, but it mostly works in the standard case.
Quoted 6 lines
In the interest of minimizing register writes, would it be acceptable to enable/disable ECC at the beginning of a standard
path transfer but not, after the transfer, turn off the ECC? This should not affect other standard path operations nor affect theexec_oppath as those are low level transfers which our ECC engine would not touch and the NAND device driver should be responsible for turning on/off its own ECC.
Quoted 7 lines
Do you have legitimate concerns about this register write taking way more time than I could expect? Because compared to the transfer of a NAND page + tR/tPROG it should not be noticeable. I don't see how you could even measure such impact actually, unless the register write does way more than usual. I'm fine with the above idea if you show me it has an interest.
Dave did the mtd_speed test and we can see we get consistently ~35KB/s slower with the extra enable and disable ecc engine calls in ecc read page path.
With the change:
[ 28.148355] mtd_speedtest: page read speed is 9857 KiB/s [ 31.754258] mtd_speedtest: 2 page read speed is 9865 KiB/s Without the change [ 56.444735] mtd_speedtest: page read speed is 9892 KiB/s [ 60.042262] mtd_speedtest: 2 page read speed is 9897 KiB/s
Although it is only less than 1% drop, it is still something. I understand the procedure you laid out above is the preferred way but with our driver fully control the chip ecc read/write page, ecc read_raw/write_raw page function and exec_op path, I don't see where it may not work. What are the non-standard cases that can break it?
If the driver started with preferred procedure, we will never have this conversation:) But unfortunately it is not the case and now if we want to revert this but lose performance, I just don't feel like to swallow this if there is no real world case that breaks this code.
Quoted 2 lines
Thanks,
Miquèl
Miquel Raynal
maintainerRe: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Hi William,
Quoted 49 lines
Quoted 42 lines
Quoted 35 lines
Quoted 29 lines
Quoted 29 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
We are already turning on the ECC enable at this point, this is just adding the option to turn it off if the NAND chip itself will be doing the ECC instead of our controller.
Quoted 7 lines
Sorry if I have not been clear.
This sequence:
- init
- enable hw ECC engine
Is broken.Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
ECC engine is not enabled for all the cases. Here we only intended to enable it for the nand chip that is set to use
NAND_ECC_ENGINE_TYPE_ON_HOST. The logic here should better change to:if (
chip->ecc.engine_type==NAND_ECC_ENGINE_TYPE_ON_HOST)brcmnand_set_ecc_enabled(host, 1); else brcmnand_set_ecc_enabled(host, 0);Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
It *cannot* work as any operation going through
exec_opnow mayperform page reads which should be unmodified by the ECC engine. You > driver *must* follow the following sequence:
- init and disable (or keep disabled) the hw ECC engine
- when you perform a page operation with correction you need to
- enable the engine
- perform the operation
- disable the engine
Maybe I am missing something here but are you saying theexec_opcan have different ecc type for page read/write at run time on the same nand chip? I don't see the op instr structure has the ecc type field and thought it is only bind to the nand chip and won't change at run time. So looks to me the init time setting to the engine based on ecc.engine_type should be sufficient.Quoted 5 lines
Quoted 1 line
What you described here can work for the hw.ecc read path (ecc.read_page =
brcmnand_read_page) which always assumes ecc is enabled. Although it is probably not too bad with these two extra operation, it would be better if we don't have to add anything as our current code does. For thebrcmnand_read_page_raw, we currently disable the engine and then re-enable it(but we need to fix it to only enable it with hw ecc engine type). So it is just opposite of you logic but works the same with no impact on the most performance critical path.This is not "my" logic, this is the "core's" logic. I am saying: your approach is broken because that is not how the API is supposed to work, but it mostly works in the standard case.
Quoted 6 lines
In the interest of minimizing register writes, would it be acceptable to enable/disable ECC at the beginning of a standard
path transfer but not, after the transfer, turn off the ECC? This should not affect other standard path operations nor affect theexec_oppath as those are low level transfers which our ECC engine would not touch and the NAND device driver should be responsible for turning on/off its own ECC.Quoted 7 lines
Do you have legitimate concerns about this register write taking way more time than I could expect? Because compared to the transfer of a NAND page + tR/tPROG it should not be noticeable. I don't see how you could even measure such impact actually, unless the register write does way more than usual. I'm fine with the above idea if you show me it has an interest.
Quoted 8 lines
Dave did the
mtd_speedtest and we can see we get consistently ~35KB/s slower with the extra enable and disable ecc engine calls in ecc read page path.With the change:
[ 28.148355] mtd_speedtest: page read speed is 9857 KiB/s [ 31.754258] mtd_speedtest: 2 page read speed is 9865 KiB/s Without the change [ 56.444735] mtd_speedtest: page read speed is 9892 KiB/s [ 60.042262] mtd_speedtest: 2 page read speed is 9897 KiB/s
I believe if you repeat this 10 times you'll get totally different results. I don't think this test on a non RT machine is precise enough so that a unique 35kiB difference can be interpreted as being significant.
Quoted 1 line
Although it is only less than 1% drop, it is still something. I understand the procedure you laid out above is the preferred way but with our driver fully control the chip ecc read/write page, ecc read_raw/write_raw page function and
exec_oppath, I don't see where it may not work.
I just told you, the exec_op path runs with ECC enabled. I don't know how this controller works. Now if you don't care and are 100% sure this is working and future proof, just keep it like this.
Cheers,
Miquèl
William Zhang
maintainerRe: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
Quoted 60 lines · Miquel Raynal
Hi William,
Quoted 49 lines
Quoted 42 lines
Quoted 35 lines
Quoted 29 lines
Quoted 29 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
We are already turning on the ECC enable at this point, this is just adding the option to turn it off if the NAND chip itself will be doing the ECC instead of our controller.
Quoted 7 lines
Sorry if I have not been clear.
This sequence:
- init
- enable hw ECC engine
Is broken.Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
ECC engine is not enabled for all the cases. Here we only intended to enable it for the nand chip that is set to use
NAND_ECC_ENGINE_TYPE_ON_HOST. The logic here should better change to:if (
chip->ecc.engine_type==NAND_ECC_ENGINE_TYPE_ON_HOST)brcmnand_set_ecc_enabled(host, 1); else brcmnand_set_ecc_enabled(host, 0);Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
It *cannot* work as any operation going through
exec_opnow mayperform page reads which should be unmodified by the ECC engine. You > driver *must* follow the following sequence:
- init and disable (or keep disabled) the hw ECC engine
- when you perform a page operation with correction you need to
- enable the engine
- perform the operation
- disable the engine
Maybe I am missing something here but are you saying theexec_opcan have different ecc type for page read/write at run time on the same nand chip? I don't see the op instr structure has the ecc type field and thought it is only bind to the nand chip and won't change at run time. So looks to me the init time setting to the engine based on ecc.engine_type should be sufficient.Quoted 5 lines
Quoted 1 line
What you described here can work for the hw.ecc read path (ecc.read_page =
brcmnand_read_page) which always assumes ecc is enabled. Although it is probably not too bad with these two extra operation, it would be better if we don't have to add anything as our current code does. For thebrcmnand_read_page_raw, we currently disable the engine and then re-enable it(but we need to fix it to only enable it with hw ecc engine type). So it is just opposite of you logic but works the same with no impact on the most performance critical path.This is not "my" logic, this is the "core's" logic. I am saying: your approach is broken because that is not how the API is supposed to work, but it mostly works in the standard case.
Quoted 6 lines
In the interest of minimizing register writes, would it be acceptable to enable/disable ECC at the beginning of a standard
path transfer but not, after the transfer, turn off the ECC? This should not affect other standard path operations nor affect theexec_oppath as those are low level transfers which our ECC engine would not touch and the NAND device driver should be responsible for turning on/off its own ECC.Quoted 7 lines
Do you have legitimate concerns about this register write taking way more time than I could expect? Because compared to the transfer of a NAND page + tR/tPROG it should not be noticeable. I don't see how you could even measure such impact actually, unless the register write does way more than usual. I'm fine with the above idea if you show me it has an interest.
Quoted 8 lines
Dave did the
mtd_speedtest and we can see we get consistently ~35KB/s slower with the extra enable and disable ecc engine calls in ecc read page path.With the change:
[ 28.148355] mtd_speedtest: page read speed is 9857 KiB/s [ 31.754258] mtd_speedtest: 2 page read speed is 9865 KiB/s Without the change [ 56.444735] mtd_speedtest: page read speed is 9892 KiB/s [ 60.042262] mtd_speedtest: 2 page read speed is 9897 KiB/s
Quoted 5 lines
I believe if you repeat this 10 times you'll get totally different results. I don't think this test on a non RT machine is precise enough so that a unique 35kiB difference can be interpreted as being significant.
No, it is very consistent. It is not RT system but a bare minimum setup with just linux kernel, mtd/nand drivers and a shell. We don't run any apps and extra drivers. So the system is pretty idle while we run mtd speed test.
Quoted 6 lines
Quoted 1 line
Although it is only less than 1% drop, it is still something. I understand the procedure you laid out above is the preferred way but with our driver fully control the chip ecc read/write page, ecc read_raw/write_raw page function and
exec_oppath, I don't see where it may not work.I just told you, the
exec_oppath runs with ECC enabled. I don't know how this controller works. Now if you don't care and are 100% sure this is working and future proof, just keep it like this.
This is something I don't get. The patch basically only enable the ecc when NAND_ECC_ENGINE_TYPE_ON_HOST is set. But in this case exec_op does not do page read/write. Even page read/write go through exec_op, we do want the engine to do the ecc checking. So need to have it enabled. Other op like parameter read does not go through controller's ecc engine so it does not matter if ecc is on or not.
If NAND_ECC_ENGINE_TYPE_ON_DIE is set, this patch disable the controller engine and let NAND chip do the work as it requires. So exec_op path run with ecc disabled when page read/write also go through exec_op path.
I don't see any issue with this either.
I am not trying to make your job hard but I want to understand if there is really any issue here.
Quoted 2 lines
Cheers,
Miquèl
Re: [PATCH v3 10/10] mtd: rawnand: brcmnand: allow for on-die ecc
In reply to Miquel RaynalHi Miquèl,
Quoted 66 lines · Miquel Raynal
Hi William,
Quoted 49 lines
Quoted 42 lines
Quoted 35 lines
Quoted 29 lines
Quoted 29 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
This is a double check to turn on/off our hardware ECC.
I expect the engine to be always disabled. Enable it only when you need (may require an additional patch before this one).
We are already turning on the ECC enable at this point, this is just adding the option to turn it off if the NAND chip itself will be doing the ECC instead of our controller.
Quoted 7 lines
Sorry if I have not been clear.
This sequence:
- init
- enable hw ECC engine
Is broken.Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
ECC engine is not enabled for all the cases. Here we only intended to enable it for the nand chip that is set to use
NAND_ECC_ENGINE_TYPE_ON_HOST. The logic here should better change to:if (
chip->ecc.engine_type==NAND_ECC_ENGINE_TYPE_ON_HOST)brcmnand_set_ecc_enabled(host, 1); else brcmnand_set_ecc_enabled(host, 0);Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
It *cannot* work as any operation going through
exec_opnow mayperform page reads which should be unmodified by the ECC engine. You > driver *must* follow the following sequence:
- init and disable (or keep disabled) the hw ECC engine
- when you perform a page operation with correction you need to
- enable the engine
- perform the operation
- disable the engine
Maybe I am missing something here but are you saying theexec_opcan have different ecc type for page read/write at run time on the same nand chip? I don't see the op instr structure has the ecc type field and thought it is only bind to the nand chip and won't change at run time. So looks to me the init time setting to the engine based on ecc.engine_type should be sufficient.Quoted 5 lines
Quoted 1 line
What you described here can work for the hw.ecc read path (ecc.read_page =
brcmnand_read_page) which always assumes ecc is enabled. Although it is probably not too bad with these two extra operation, it would be better if we don't have to add anything as our current code does. For thebrcmnand_read_page_raw, we currently disable the engine and then re-enable it(but we need to fix it to only enable it with hw ecc engine type). So it is just opposite of you logic but works the same with no impact on the most performance critical path.This is not "my" logic, this is the "core's" logic. I am saying: your approach is broken because that is not how the API is supposed to work, but it mostly works in the standard case.
Quoted 6 lines
In the interest of minimizing register writes, would it be acceptable to enable/disable ECC at the beginning of a standard
path transfer but not, after the transfer, turn off the ECC? This should not affect other standard path operations nor affect theexec_oppath as those are low level transfers which our ECC engine would not touch and the NAND device driver should be responsible for turning on/off its own ECC.Quoted 7 lines
Do you have legitimate concerns about this register write taking way more time than I could expect? Because compared to the transfer of a NAND page + tR/tPROG it should not be noticeable. I don't see how you could even measure such impact actually, unless the register write does way more than usual. I'm fine with the above idea if you show me it has an interest.
Quoted 8 lines
Dave did the
mtd_speedtest and we can see we get consistently ~35KB/s slower with the extra enable and disable ecc engine calls in ecc read page path.With the change:
[ 28.148355] mtd_speedtest: page read speed is 9857 KiB/s [ 31.754258] mtd_speedtest: 2 page read speed is 9865 KiB/s Without the change [ 56.444735] mtd_speedtest: page read speed is 9892 KiB/s [ 60.042262] mtd_speedtest: 2 page read speed is 9897 KiB/sI believe if you repeat this 10 times you'll get totally different results. I don't think this test on a non RT machine is precise enough so that a unique 35kiB difference can be interpreted as being significant.
Quoted 5 lines
Quoted 1 line
Although it is only less than 1% drop, it is still something. I understand the procedure you laid out above is the preferred way but with our driver fully control the chip ecc read/write page, ecc read_raw/write_raw page function and
exec_oppath, I don't see where it may not work.I just told you, the
exec_oppath runs with ECC enabled. I don't know how this controller works. Now if you don't care and are 100% sure this is working and future proof, just keep it like this.
Thank you for all your help, it appears this will need further rework and testing. Since it's not critical to this series I will most likely pull this patch and take all your good information to prepare for a future update.
Quoted 3 lines
Cheers,
Miquèl
Thanks!
-Dave