mtd: rawnand: brcmnand: driver and doc updates
Subsystems (5)
William Zhang
maintainerv6 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, log level adjustment on uncorrectable ECC error and some coding style fixes.
[1] https://lore.kernel.org/lkml/[email protected]/
Changes in v6:
- Moved style fixes to a separate patch
- Fix style issue
- Add reviewed-by tags
- Add other nand ecc properties to the exclude check list
- Update the brcm,nand-ecc-use-strap property description
- Combine the ecc step size and ecc strength into one get function
- Treat it as error condition if both brcm,nand-ecc-use-strap and nand ecc dts properties are set
- Add intermediate steps to get the sector size bitfield
Changes in v5:
- Update the commit message
- Add reviewed-by tag
- Update the description of this new property
- Update the description for this ecc strap property
- Add check to make sure brcm,nand-ecc-use-strap and nand-ecc-strength/brcm,nand-oob-sector-size can not be used at the same time
Changes in v4:
- Fix the commit id in the fixes tag
- Revert the log level change for correctable ecc error
- Split the yaml changes into three patches. This is the first one
- Move the WP pin property to this separate patch and change it to boolean type.
- Move ecc strap property to this separate patch and remove some non-binding related text from the description
- Move the board related dts setting from SoC dtsi to board dts
- Move the board related dts setting from SoC dtsi to board dts
- Update the comments for ecc setting selection
- Use the new brcm,wp-not-connected property based on the dts binding change
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:
- Added to patch series
- Added to patch series
- 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 SoCs 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
- Remove be32_to_cpu from brcmnand_read_data_bus
- Minor cosmetic fixes
David Regan (2):
mtd: rawnand: brcmnand: exec_op helper functions return type fixes
mtd: rawnand: brcmnand: update log level messages
William Zhang (11):
mtd: rawnand: brcmnand: fix style issues
dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
dt-bindings: mtd: brcmnand: Add WP pin connection property
dt-bindings: mtd: brcmnand: Add ecc strap property
ARM: dts: broadcom: bcmbca: Add NAND controller node
arm64: dts: broadcom: bcmbca: Add NAND controller node
arm64: dts: broadcom: bcmbca: Update router boards
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
.../bindings/mtd/brcm,brcmnand.yaml | 44 +++++- arch/arm/boot/dts/broadcom/bcm47622.dtsi | 14 ++ arch/arm/boot/dts/broadcom/bcm63138.dtsi | 7 +- arch/arm/boot/dts/broadcom/bcm63148.dtsi | 14 ++ arch/arm/boot/dts/broadcom/bcm63178.dtsi | 14 ++ arch/arm/boot/dts/broadcom/bcm6756.dtsi | 14 ++ arch/arm/boot/dts/broadcom/bcm6846.dtsi | 14 ++ arch/arm/boot/dts/broadcom/bcm6855.dtsi | 14 ++ arch/arm/boot/dts/broadcom/bcm6878.dtsi | 14 ++ arch/arm/boot/dts/broadcom/bcm947622.dts | 10 ++ arch/arm/boot/dts/broadcom/bcm963138.dts | 10 ++ arch/arm/boot/dts/broadcom/bcm963138dvt.dts | 14 +- arch/arm/boot/dts/broadcom/bcm963148.dts | 10 ++ arch/arm/boot/dts/broadcom/bcm963178.dts | 10 ++ arch/arm/boot/dts/broadcom/bcm96756.dts | 10 ++ arch/arm/boot/dts/broadcom/bcm96846.dts | 10 ++ arch/arm/boot/dts/broadcom/bcm96855.dts | 10 ++ arch/arm/boot/dts/broadcom/bcm96878.dts | 10 ++ .../bcmbca/bcm4906-netgear-r8000p.dts | 5 + .../bcmbca/bcm4906-tplink-archer-c2300-v1.dts | 5 + .../bcmbca/bcm4908-asus-gt-ac5300.dts | 6 +- .../boot/dts/broadcom/bcmbca/bcm4908.dtsi | 4 +- .../boot/dts/broadcom/bcmbca/bcm4912.dtsi | 14 ++ .../boot/dts/broadcom/bcmbca/bcm63146.dtsi | 14 ++ .../boot/dts/broadcom/bcmbca/bcm63158.dtsi | 14 ++ .../boot/dts/broadcom/bcmbca/bcm6813.dtsi | 14 ++ .../boot/dts/broadcom/bcmbca/bcm6856.dtsi | 14 ++ .../boot/dts/broadcom/bcmbca/bcm6858.dtsi | 14 ++ .../boot/dts/broadcom/bcmbca/bcm94908.dts | 10 ++ .../boot/dts/broadcom/bcmbca/bcm94912.dts | 10 ++ .../boot/dts/broadcom/bcmbca/bcm963146.dts | 10 ++ .../boot/dts/broadcom/bcmbca/bcm963158.dts | 10 ++ .../boot/dts/broadcom/bcmbca/bcm96813.dts | 10 ++ .../boot/dts/broadcom/bcmbca/bcm96856.dts | 10 ++ .../boot/dts/broadcom/bcmbca/bcm96858.dts | 10 ++ 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 | 148 ++++++++++++++---- drivers/mtd/nand/raw/brcmnand/brcmnand.h | 2 + 40 files changed, 650 insertions(+), 144 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
William Zhang
maintainerPATCH v6 1/13 mtd: rawnand: brcmnand: exec_op helper functions return type fixes
From: David Regan <[email protected]>
Fix return types for exec_op reset and status helper functions.
---
Changes in v6:
- Moved style fixes to a separate patch
Changes in v5: None
Changes in v4:
- Fix the commit id in the fixes tag
Changes in v3: None
Changes in v2:
- Added to patch series
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +8 -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) {
@@ -1690,7 +1690,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);
@@ -1701,7 +1701,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;
@@ -2433,7 +2433,11 @@ 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 ; }
Signature · 1 line
2.37.3
Re: [PATCH v6 01/13] mtd: rawnand: brcmnand: exec_op helper functions return type fixes
Quoted 10 lines · William Zhang
From: David Regan <[email protected]>
Fix return types for
exec_opreset and status helper functions.Reported-by Dan Carpenter <[email protected]>Fixes 3c8260ce7663 ("mtd: rawnand: brcmnand: exec_op implementation")Signed-off-by David Regan <[email protected]>Signed-off-by William Zhang <[email protected]>Reviewed-by William Zhang <[email protected]>
Signature · 1 line
Florian
Re: [PATCH v6 01/13] mtd: rawnand: brcmnand: exec_op helper functions return type fixes
In reply to William ZhangQuoted 11 lines · William Zhang
From: David Regan <[email protected]>
Fix return types for
exec_opreset and status helper functions.Reported-by Dan Carpenter <[email protected]>Fixes 3c8260ce7663 ("mtd: rawnand: brcmnand: exec_op implementation")Signed-off-by David Regan <[email protected]>Signed-off-by William Zhang <[email protected]>Reviewed-by William Zhang <[email protected]>Reviewed-by Florian Fainelli <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 2/13 mtd: rawnand: brcmnand: fix style issues
In reply to William ZhangFix various style issues.
---
Changes in v6:
- Added to patch series
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +11 -12
@@ -2339,7 +2339,7 @@ static int brcmnand_write_oob_raw(struct nand_chip *chip, int page) }static int brcmnand_exec_instr (struct brcmnand_host *host,int i, -const struct nand_operation *op) +const struct nand_operation *op) {const struct nand_op_instr *instr = &op->instrs[i];struct brcmnand_controller *ctrl = host->ctrl;
@@ -2353,7 +2353,7 @@ static int brcmnand_exec_instr(struct brcmnand_host *host, int i,* (WAITRDY excepted). */ last_op = ((i == (op->ninstrs -1 )) && (instr->type !=NAND_OP_WAITRDY_INSTR )) || - ((i == (op->ninstrs -2 )) && (op->instrs[i+1 ].type ==NAND_OP_WAITRDY_INSTR )); + ((i == (op->ninstrs -2 )) && (op->instrs[i +1 ].type ==NAND_OP_WAITRDY_INSTR ));switch (instr->type) {case NAND_OP_CMD_INSTR :
@@ -2398,10 +2398,10 @@ static int brcmnand_exec_instr(struct brcmnand_host *host, int i,static int brcmnand_op_is_status (const struct nand_operation *op) { -if ((op->ninstrs ==2 ) && - (op->instrs[0 ].type ==NAND_OP_CMD_INSTR ) && - (op->instrs[0 ].ctx.cmd.opcode ==NAND_CMD_STATUS ) && - (op->instrs[1 ].type ==NAND_OP_DATA_IN_INSTR )) +if (op->ninstrs ==2 && + op->instrs[0 ].type ==NAND_OP_CMD_INSTR && + op->instrs[0 ].ctx.cmd.opcode ==NAND_CMD_STATUS && + op->instrs[1 ].type ==NAND_OP_DATA_IN_INSTR )return 1 ;return 0 ;
@@ -2409,10 +2409,10 @@ static int brcmnand_op_is_status(const struct nand_operation *op)static int brcmnand_op_is_reset (const struct nand_operation *op) { -if ((op->ninstrs ==2 ) && - (op->instrs[0 ].type ==NAND_OP_CMD_INSTR ) && - (op->instrs[0 ].ctx.cmd.opcode ==NAND_CMD_RESET ) && - (op->instrs[1 ].type ==NAND_OP_WAITRDY_INSTR )) +if (op->ninstrs ==2 && + op->instrs[0 ].type ==NAND_OP_CMD_INSTR && + op->instrs[0 ].ctx.cmd.opcode ==NAND_CMD_RESET && + op->instrs[1 ].type ==NAND_OP_WAITRDY_INSTR )return 1 ;return 0 ;
@@ -2440,8 +2440,7 @@ static int brcmnand_exec_op(struct nand_chip *chip, *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
Re: [PATCH v6 02/13] mtd: rawnand: brcmnand: fix style issues
Quoted 5 lines · William Zhang
Fix various style issues.
Signed-off-by David Regan <[email protected]>Signed-off-by William Zhang <[email protected]>Reviewed-by William Zhang <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 3/13 mtd: rawnand: brcmnand: update log level messages
In reply to William ZhangFrom: David Regan <[email protected]>
Update log level messages so that more critical messages can be logged to console and help the troubleshooting with field devices.
---
Changes in v6:
- Fix style issue
Changes in v5:
- Update the commit message
Changes in v4:
- Revert the log level change for correctable ecc error
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
@@ -1084,8 +1084,8 @@ 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" , - expected_val, val & mask); +dev_err (ctrl->dev,"timeout on status poll (expected %x got %x)\n" , + expected_val, val & mask);return -ETIMEDOUT ; }
@@ -2137,7 +2137,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 */
Signature · 1 line
2.37.3
Re: [PATCH v6 03/13] mtd: rawnand: brcmnand: update log level messages
Quoted 8 lines · William Zhang
From: David Regan <[email protected]>
Update log level messages so that more critical messages can be logged to console and help the troubleshooting with field devices.
Signed-off-by David Regan <[email protected]>Signed-off-by William Zhang <[email protected]>Reviewed-by William Zhang <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 4/13 dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
In reply to William ZhangUpdate the descriptions to reflect different families of broadband SoC and use the general name bcmbca for ARM based SoC.
Remove the requirement of interrupts property to reflect the driver code and only require interrupt-names when interrupts property present.
Also add myself to the list of maintainers.
---
Changes in v6:
- Add reviewed-by tag
Changes in v5:
- Add reviewed-by tag
Changes in v4:
- Split the yaml changes into three patches. This is the first one
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
.../devicetree/bindings/mtd/brcm,brcmnand.yaml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +8 -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:
@@ -177,6 +179,8 @@ allOf: - const: iproc-idm - const: iproc-ext - if: + required: + - interrupts properties: interrupts: minItems: 2
@@ -189,7 +193,6 @@ unevaluatedProperties: false required: - reg - reg-names - - interrupts examples: - |
Signature · 1 line
2.37.3
Re: [PATCH v6 04/13] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs
Quoted 6 lines · William Zhang
Update the descriptions to reflect different families of broadband SoC and use the general name bcmbca for ARM based SoC.
Remove the requirement of interrupts property to reflect the driver code and only require interrupt-names when interrupts property present.
Quoted 6 lines
Also add myself to the list of maintainers.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>Reviewed-by Rob Herring <[email protected]>Reviewed-by Florian Fainelli <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 5/13 dt-bindings: mtd: brcmnand: Add WP pin connection property
In reply to William ZhangAdd brcm,wp-not-connected property to have an option for disabling this feature on broadband board design that does not connect WP pin.
---
Changes in v6:
- Add reviewed-by tags
Changes in v5:
- Update the description of this new property
Changes in v4:
- Move the WP pin property to this separate patch and change it to boolean type.
Changes in v3: None
Changes in v2: None
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +7 -0
@@ -113,6 +113,13 @@ properties: earlier versions of this core that include WP type: boolean + brcm,wp-not-connected: + description: + Use this property when WP pin is not physically wired to the NAND chip. + Write protection feature cannot be used. By default, controller assumes + the pin is connected and feature is used. + $ref: /schemas/types.yaml#/definitions/flag + patternProperties: "^nand@[a-f0-9]$": type: object
Signature · 1 line
2.37.3
Re: [PATCH v6 05/13] dt-bindings: mtd: brcmnand: Add WP pin connection property
Quoted 6 lines · William Zhang
Add brcm,wp-not-connected property to have an option for disabling this feature on broadband board design that does not connect WP pin.
Signed-off-by William Zhang <[email protected]>Reviewed-by Conor Dooley <[email protected]>Reviewed-by Florian Fainelli <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 6/13 dt-bindings: mtd: brcmnand: Add ecc strap property
In reply to William ZhangAdd brcm,nand-ecc-use-strap to get ecc and spare area size settings from board boot strap for broadband board designs because they do not specify ecc setting in dts but rather using the strap setting.
---
Changes in v6:
- Add other nand ecc properties to the exclude check list
- Update the brcm,nand-ecc-use-strap property description
Changes in v5:
- Update the description for this ecc strap property
- Add check to make sure brcm,nand-ecc-use-strap and nand-ecc-strength/brcm,nand-oob-sector-size can not be used at the same time
Changes in v4:
- Move ecc strap property to this separate patch and remove some non-binding related text from the description
Changes in v3: None
Changes in v2: None
.../bindings/mtd/brcm,brcmnand.yaml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+)
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +24 -0
@@ -146,6 +146,15 @@ patternProperties: layout. $ref: /schemas/types.yaml#/definitions/uint32 + brcm,nand-ecc-use-strap: + description: + This property requires the host system to get the ECC related + settings from the SoC NAND boot strap configuration instead of + the generic NAND ECC settings. This is a common hardware design + on BCMBCA based boards. This strap ECC option and generic NAND + ECC option can not be specified at the same time. + $ref: /schemas/types.yaml#/definitions/flag + unevaluatedProperties: false allOf:
@@ -195,6 +204,21 @@ allOf: required: - interrupt-names + - if: + patternProperties: + "^nand@[a-f0-9]$": + required: + - brcm,nand-ecc-use-strap + then: + patternProperties: + "^nand@[a-f0-9]$": + properties: + nand-ecc-strength: false + nand-ecc-step-size: false + nand-ecc-maximize: false + nand-ecc-algo: false + brcm,nand-oob-sector-size: false + unevaluatedProperties: false required:
Signature · 1 line
2.37.3
Re: [PATCH v6 06/13] dt-bindings: mtd: brcmnand: Add ecc strap property
Quoted 5 lines · William Zhang
Add brcm,nand-ecc-use-strap to get ecc and spare area size settings from board boot strap for broadband board designs because they do not specify ecc setting in dts but rather using the strap setting.
Signed-off-by William Zhang <[email protected]>
Cheers,
Conor.
Re: [PATCH v6 06/13] dt-bindings: mtd: brcmnand: Add ecc strap property
In reply to William ZhangQuoted 6 lines · William Zhang
Add brcm,nand-ecc-use-strap to get ecc and spare area size settings from board boot strap for broadband board designs because they do not specify ecc setting in dts but rather using the strap setting.
Signed-off-by William Zhang <[email protected]>Reviewed-by Conor Dooley <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 7/13 ARM: dts: broadcom: bcmbca: Add NAND controller node
In reply to William ZhangAdd support for Broadcom STB NAND controller in BCMBCA ARMv7 chip dts files.
---
Changes in v6: None
Changes in v5: None
Changes in v4:
- Move the board related dts setting from SoC dtsi to board dts
Changes in v3: None
Changes in v2: None
arch/arm/boot/dts/broadcom/bcm47622.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/broadcom/bcm63138.dtsi | 7 ++++++- arch/arm/boot/dts/broadcom/bcm63148.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/broadcom/bcm63178.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/broadcom/bcm6756.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/broadcom/bcm6846.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/broadcom/bcm6855.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/broadcom/bcm6878.dtsi | 14 ++++++++++++++ arch/arm/boot/dts/broadcom/bcm947622.dts | 10 ++++++++++ arch/arm/boot/dts/broadcom/bcm963138.dts | 10 ++++++++++ arch/arm/boot/dts/broadcom/bcm963138dvt.dts | 14 +++++++------- arch/arm/boot/dts/broadcom/bcm963148.dts | 10 ++++++++++ arch/arm/boot/dts/broadcom/bcm963178.dts | 10 ++++++++++ arch/arm/boot/dts/broadcom/bcm96756.dts | 10 ++++++++++ arch/arm/boot/dts/broadcom/bcm96846.dts | 10 ++++++++++ arch/arm/boot/dts/broadcom/bcm96855.dts | 10 ++++++++++ arch/arm/boot/dts/broadcom/bcm96878.dts | 10 ++++++++++ 17 files changed, 191 insertions(+), 8 deletions(-)
arch/arm/boot/dts/broadcom/bcm47622.dtsi +14 -0
@@ -138,6 +138,20 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm/boot/dts/broadcom/bcm63138.dtsi +6 -1
@@ -229,7 +229,12 @@ 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"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; }; serial@4400 {
arch/arm/boot/dts/broadcom/bcm63148.dtsi +14 -0
@@ -119,5 +119,19 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; }; };
arch/arm/boot/dts/broadcom/bcm63178.dtsi +14 -0
@@ -129,6 +129,20 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm/boot/dts/broadcom/bcm6756.dtsi +14 -0
@@ -139,6 +139,20 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm/boot/dts/broadcom/bcm6846.dtsi +14 -0
@@ -119,5 +119,19 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; }; };
arch/arm/boot/dts/broadcom/bcm6855.dtsi +14 -0
@@ -129,6 +129,20 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm/boot/dts/broadcom/bcm6878.dtsi +14 -0
@@ -120,6 +120,20 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm/boot/dts/broadcom/bcm947622.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm/boot/dts/broadcom/bcm963138.dts +10 -0
@@ -29,3 +29,13 @@ &serial0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm/boot/dts/broadcom/bcm963138dvt.dts +7 -7
@@ -32,15 +32,15 @@ &serial1 { }; &nand_controller { + brcm,wp-not-connected; 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>; + nand-on-flash-bbt; }; &ahci {
arch/arm/boot/dts/broadcom/bcm963148.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm/boot/dts/broadcom/bcm963178.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm/boot/dts/broadcom/bcm96756.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm/boot/dts/broadcom/bcm96846.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm/boot/dts/broadcom/bcm96855.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm/boot/dts/broadcom/bcm96878.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
Signature · 1 line
2.37.3
Re: [PATCH v6 07/13] ARM: dts: broadcom: bcmbca: Add NAND controller node
Quoted 5 lines · William Zhang
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]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 8/13 arm64: dts: broadcom: bcmbca: Add NAND controller node
In reply to William ZhangAdd support for Broadcom STB NAND controller in BCMBCA ARMv8 chip dts files.
---
Changes in v6: None
Changes in v5: None
Changes in v4:
- Move the board related dts setting from SoC dtsi to board dts
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
arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi | 4 ++-- arch/arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi | 14 ++++++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm63146.dtsi | 14 ++++++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm63158.dtsi | 14 ++++++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm6813.dtsi | 14 ++++++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm6856.dtsi | 14 ++++++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi | 14 ++++++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm94908.dts | 10 ++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm94912.dts | 10 ++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm963146.dts | 10 ++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm963158.dts | 10 ++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm96813.dts | 10 ++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm96856.dts | 10 ++++++++++ arch/arm64/boot/dts/broadcom/bcmbca/bcm96858.dts | 10 ++++++++++ 14 files changed, 156 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi +2 -2
@@ -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,7 +597,7 @@ nand-controller@1800 { reg-names = "nand", "nand-int-base"; interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "nand_ctlrdy"; - status = "okay"; + status = "disabled"; nandcs: nand@0 { compatible = "brcm,nandcs";
arch/arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi +14 -0
@@ -138,6 +138,20 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm64/boot/dts/broadcom/bcmbca/bcm63146.dtsi +14 -0
@@ -119,6 +119,20 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm64/boot/dts/broadcom/bcmbca/bcm63158.dtsi +14 -0
@@ -137,6 +137,20 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm64/boot/dts/broadcom/bcmbca/bcm6813.dtsi +14 -0
@@ -138,6 +138,20 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>;
arch/arm64/boot/dts/broadcom/bcmbca/bcm6856.dtsi +14 -0
@@ -119,5 +119,19 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; }; };
arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi +14 -0
@@ -156,5 +156,19 @@ 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"; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + }; + }; }; };
arch/arm64/boot/dts/broadcom/bcmbca/bcm94908.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm94912.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm963146.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm963158.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm96813.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm96856.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
arch/arm64/boot/dts/broadcom/bcmbca/bcm96858.dts +10 -0
@@ -32,3 +32,13 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + +&nandcs { + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; +};
Signature · 1 line
2.37.3
Re: [PATCH v6 08/13] arm64: dts: broadcom: bcmbca: Add NAND controller node
Quoted 5 lines · William Zhang
Add support for Broadcom STB NAND controller in BCMBCA ARMv8 chip dts files.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 9/13 arm64: dts: broadcom: bcmbca: Update router boards
In reply to William ZhangEnable the nand controller and add WP pin connection property in actual board dts as they are board level properties now that they are disabled and moved out from SoC dtsi.
Also remove the unnecessary brcm,nand-has-wp property from AC5300 board. This property is only needed for some old controller that this board does not apply.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
.../boot/dts/broadcom/bcmbca/bcm4906-netgear-r8000p.dts | 5 +++++ .../dts/broadcom/bcmbca/bcm4906-tplink-archer-c2300-v1.dts | 5 +++++ .../boot/dts/broadcom/bcmbca/bcm4908-asus-gt-ac5300.dts | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/broadcom/bcmbca/bcm4906-netgear-r8000p.dts +5 -0
@@ -125,6 +125,11 @@ port@7 { }; }; +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + &nandcs { nand-ecc-strength = <4>; nand-ecc-step-size = <512>;
arch/arm64/boot/dts/broadcom/bcmbca/bcm4906-tplink-archer-c2300-v1.dts +5 -0
@@ -155,6 +155,11 @@ port@7 { }; }; +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + &nandcs { nand-ecc-strength = <4>; nand-ecc-step-size = <512>;
arch/arm64/boot/dts/broadcom/bcmbca/bcm4908-asus-gt-ac5300.dts +5 -1
@@ -166,11 +166,15 @@ led@19 { }; }; +&nand_controller { + brcm,wp-not-connected; + status = "okay"; +}; + &nandcs { nand-ecc-strength = <4>; nand-ecc-step-size = <512>; nand-on-flash-bbt; - brcm,nand-has-wp; #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.37.3
Re: [PATCH v6 09/13] arm64: dts: broadcom: bcmbca: Update router boards
Quoted 9 lines · William Zhang
Enable the nand controller and add WP pin connection property in actual board dts as they are board level properties now that they are disabled and moved out from SoC dtsi.
Also remove the unnecessary brcm,nand-has-wp property from AC5300 board. This property is only needed for some old controller that this board does not apply.
Signed-off-by William Zhang <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 10/13 mtd: rawnand: brcmnand: Rename bcm63138 nand driver
In reply to William ZhangIn preparing to support multiple BCMBCA SoCs, rename bcm63138 to bcmbca in the driver code and driver file name.
---
Changes in v6: None
Changes in v5: None
Changes in v4: None
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
Re: [PATCH v6 10/13] mtd: rawnand: brcmnand: Rename bcm63138 nand driver
Quoted 6 lines · William Zhang
In preparing to support multiple BCMBCA SoCs, rename bcm63138 to bcmbca in the driver code and driver file name.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>Acked-by Florian Fainelli <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 11/13 mtd: rawnand: brcmnand: Add BCMBCA read data bus interface
In reply to William ZhangThe 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 v6:
- Fix style issue
Changes in v5: None
Changes in v4: None
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
Re: [PATCH v6 11/13] mtd: rawnand: brcmnand: Add BCMBCA read data bus interface
Quoted 10 lines · William Zhang
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.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
William Zhang
maintainerPATCH v6 12/13 mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
In reply to William ZhangBCMBCA 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. However these two options can not be used at the same time.
---
Changes in v6:
- Combine the ecc step size and ecc strength into one get function
- Treat it as error condition if both brcm,nand-ecc-use-strap and nand ecc dts properties are set
- Add intermediate steps to get the sector size bitfield
Changes in v5: None
Changes in v4:
- Update the comments for ecc setting selection
Changes in v3: None
Changes in v2:
- Minor cosmetic fixes
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 83 ++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 6 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +77 -6
@@ -1038,6 +1038,22 @@ 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 sector_size_bit =brcmnand_sector_1k_shift (ctrl); +u16 acc_control_offs =brcmnand_cs_offset (ctrl, host->cs, +BRCMNAND_CS_ACC_CONTROL ); +u32 acc_control; + +if (sector_size_bit <0 ) +return 0 ; + + acc_control =nand_readreg (ctrl, acc_control_offs); + +return (acc_control &BIT (sector_size_bit)) >> sector_size_bit; +} +static void brcmnand_set_sector_size_1k (struct brcmnand_host *host,int val) {struct brcmnand_controller *ctrl = host->ctrl;
@@ -1055,6 +1071,43 @@ 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 void brcmnand_get_ecc_settings (struct brcmnand_host *host,struct nand_chip *chip) +{ +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; +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) + chip->ecc.strength = ecc_level *2 ; +else if (spare_area_size ==16 && ecc_level ==15 ) + chip->ecc.strength =1 ;/* hamming */ +else + chip->ecc.strength = ecc_level; + +if (chip->ecc.size ==0 ) { +if (sector_size_1k <0 ) + chip->ecc.size =512 ; +else + chip->ecc.size =512 << sector_size_1k; + } +} +/*********************************************************************** * CS_NAND_SELECT ***********************************************************************/
@@ -2625,19 +2678,37 @@ 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; +bool use_strap = false; +char msg[128 ];int ret;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" , +/* +* Either nand-ecc-xxx or brcm,nand-ecc-use-strap can be set. Error out +* if both exist. +*/ +if (chip->ecc.strength && use_strap) { +dev_err (ctrl->dev, +"nand ecc and strap ecc settings can't be set at the same time\n" ); +return -EINVAL ; + } + +if (use_strap) +brcmnand_get_ecc_settings (host, chip); + + 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 v6 12/13] mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
Hi William,
[email protected] wrote on Thu, 22 Feb 2024 19:47:57 -0800:
Quoted 9 lines
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. However these two options can not be used at the same time.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>
FYI I did not receive patches 7, 8, 9, which makes the series numbering very odd.
Quoted 31 lines
---
Changes in v6:
- Combine the ecc step size and ecc strength into one get function
- Treat it as error condition if both brcm,nand-ecc-use-strap and nand ecc dts properties are set
- Add intermediate steps to get the sector size bitfieldChanges in v5: None
Changes in v4:
- Update the comments for ecc setting selectionChanges in v3: None
Changes in v2:
- Minor cosmetic fixesdrivers/mtd/nand/raw/brcmnand/brcmnand.c | 83 ++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 6 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +4
-0@@ -1038,6 +1038,22 @@ 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 sector_size_bit =brcmnand_sector_1k_shift (ctrl);
drivers/mtd/nand/raw/brcmnand/brcmnand.c static inline int brcmnand_sector_1k_shift(struct brcmnand_controller *ctrl) · line 1054
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +10
-0+u16 acc_control_offs =brcmnand_cs_offset (ctrl, host->cs, +BRCMNAND_CS_ACC_CONTROL ); +u32 acc_control; + +if (sector_size_bit <0 ) +return 0 ; + + acc_control =nand_readreg (ctrl, acc_control_offs); + +return (acc_control &BIT (sector_size_bit)) >> sector_size_bit;
FIELD_PREP, FIELD_GET, *please*.
Quoted 21 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +14
-0+} +static void brcmnand_set_sector_size_1k (struct brcmnand_host *host,int val) {struct brcmnand_controller *ctrl = host->ctrl;@@ -1055,6 +1071,43 @@ 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 void brcmnand_get_ecc_settings (struct brcmnand_host *host,struct nand_chip *chip) +{
drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1095
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +10
-0+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; +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;
ditto
drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1104
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +9
-0+if (sector_size_1k) + chip->ecc.strength = ecc_level *2 ; +else if (spare_area_size ==16 && ecc_level ==15 ) + chip->ecc.strength =1 ;/* hamming */ +else + chip->ecc.strength = ecc_level; + +if (chip->ecc.size ==0 ) { +if (sector_size_1k <0 )
Should be <= 0 I guess
drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1107
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+ chip->ecc.size =512 ; + else + chip->ecc.size = 512 << sector_size_1k;
What is this? Are you expecting sector_size_1k to be 0 or 1 and thus multiply 512 by two?
Please just use:
chip->ecc.size = SZ_1K;
Quoted 16 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +6
-1+ } +} +/*********************************************************************** * CS_NAND_SELECT ***********************************************************************/ @@ -2625,19 +2678,37 @@ 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; +bool use_strap = false; +char msg[128 ];int ret;
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2693
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +5
-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", +/* +* Either nand-ecc-xxx or brcm,nand-ecc-use-strap can be set. Error out +* if both exist. +*/
Thanks for the comment but I think the error string is clear enough.
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2696
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+if (chip->ecc.strength && use_strap) { +dev_err (ctrl->dev, +"nand ecc and strap ecc settings can't be set at the same time\n" );
Can we change to
"ECC strap and DT ECC configuration properties are mutually exclusive"
Quoted 11 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +7
-2+return -EINVAL ; + } + +if (use_strap) +brcmnand_get_ecc_settings (host, chip); + + 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 2714
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; }
The rest of the series looks good to me.
Thanks,
Miquèl
William Zhang
maintainerRe: [PATCH v6 12/13] mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
Hi Miquel,
Quoted 10 lines · Miquel Raynal
Hi William,
[email protected] wrote on Thu, 22 Feb 2024 19:47:57 -0800:
Quoted 6 lines
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. However these two options can not be used at the same time.
Quoted 7 lines
Quoted 3 lines
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>FYI I did not receive patches 7, 8, 9, which makes the series numbering very odd.
I was using the get maintainer script mainly and it sends to the linux MTD list. I will add your email directly next time.
Quoted 27 lines
Quoted 27 lines
---
Changes in v6:
- Combine the ecc step size and ecc strength into one get function
- Treat it as error condition if both brcm,nand-ecc-use-strap and nand ecc dts properties are set
- Add intermediate steps to get the sector size bitfieldChanges in v5: None
Changes in v4:
- Update the comments for ecc setting selectionChanges in v3: None
Changes in v2:
- Minor cosmetic fixesdrivers/mtd/nand/raw/brcmnand/brcmnand.c | 83 ++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 6 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +0
-0@@ -1038,6 +1038,22 @@ static inline int brcmnand_sector_1k_shift(struct brcmnand_controller *ctrl)return -1 ; }
Quoted 16 lines
Quoted 4 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +4
-0+static int brcmnand_get_sector_size_1k (struct brcmnand_host *host) +{ +struct brcmnand_controller *ctrl = host->ctrl; +int sector_size_bit =brcmnand_sector_1k_shift (ctrl);drivers/mtd/nand/raw/brcmnand/brcmnand.c static inline int brcmnand_sector_1k_shift(struct brcmnand_controller *ctrl) · line 1054
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +10
-0+u16 acc_control_offs =brcmnand_cs_offset (ctrl, host->cs, +BRCMNAND_CS_ACC_CONTROL ); +u32 acc_control; + +if (sector_size_bit <0 ) +return 0 ; + + acc_control =nand_readreg (ctrl, acc_control_offs); + +return (acc_control &BIT (sector_size_bit)) >> sector_size_bit;
FIELD_PREP,FIELD_GET, *please*.
You probably missed my reply to your comments on the same patch in v5. Here is the link for the post in case it lost in your email:
https://lore.kernel.org/lkml/[email protected]/T/#m1d911d2f119f3bd345c575a81b60bc2bd8c461eb
The mask is not constant here and cause build errors.
Quoted 47 lines
Quoted 22 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +14
-0+} +static void brcmnand_set_sector_size_1k (struct brcmnand_host *host,int val) {struct brcmnand_controller *ctrl = host->ctrl;@@ -1055,6 +1071,43 @@ 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 void brcmnand_get_ecc_settings (struct brcmnand_host *host,struct nand_chip *chip) +{drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1095
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +10
-0+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; +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;ditto
drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1104
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +9
-0+if (sector_size_1k) + chip->ecc.strength = ecc_level *2 ; +else if (spare_area_size ==16 && ecc_level ==15 ) + chip->ecc.strength =1 ;/* hamming */ +else + chip->ecc.strength = ecc_level; + +if (chip->ecc.size ==0 ) { +if (sector_size_1k <0 )Should be <= 0 I guess
Quoted 7 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1107
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+ chip->ecc.size =512 ; + else + chip->ecc.size = 512 << sector_size_1k;What is this? Are you expecting
sector_size_1kto be 0 or 1 and thus multiply 512 by two?
Explained in the same post above. Sector_size_1k can be negative number for error condition where we default to 512 step size. Otherwise 0 for 512 and 1 for 1K which the above shift takes care of.
Quoted 32 lines
Please just use:
chip->ecc.size = SZ_1K;Quoted 16 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +6
-1+ } +} +/*********************************************************************** * CS_NAND_SELECT ***********************************************************************/ @@ -2625,19 +2678,37 @@ 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; +bool use_strap = false; +char msg[128 ];int ret;drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2693
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +5
-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", +/* +* Either nand-ecc-xxx or brcm,nand-ecc-use-strap can be set. Error out +* if both exist. +*/ Thanks for the comment but I think the error string is clear enough.
Quoted 7 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static int brcmnand_setup_dev(struct brcmnand_host *host) · line 2696
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+if (chip->ecc.strength && use_strap) { +dev_err (ctrl->dev, +"nand ecc and strap ecc settings can't be set at the same time\n" );Can we change to
"ECC strap and DT ECC configuration properties are mutually exclusive"
Will do.
Quoted 26 lines
Quoted 11 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +7
-2+return -EINVAL ; + } + +if (use_strap) +brcmnand_get_ecc_settings (host, chip); + + 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 2714
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; }The rest of the series looks good to me.
Thanks,
Miquèl
Miquel Raynal
maintainerRe: [PATCH v6 12/13] mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
Hi William,
[email protected] wrote on Fri, 23 Feb 2024 09:25:09 -0800:
Quoted 13 lines
Hi Miquel,
Quoted 10 lines · Miquel Raynal
Hi William,
[email protected] wrote on Thu, 22 Feb 2024 19:47:57 -0800:
Quoted 6 lines
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. However these two options can not be used at the same time.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>FYI I did not receive patches 7, 8, 9, which makes the series numbering very odd.
I was using the get maintainer script mainly and it sends to the linux MTD list. I will add your email directly next time.
Yes, I prefer to be in Cc of the whole series, please.
Quoted 42 lines
Quoted 34 lines
Quoted 34 lines
---
Changes in v6:
- Combine the ecc step size and ecc strength into one get function
- Treat it as error condition if both brcm,nand-ecc-use-strap and nand ecc dts properties are set
- Add intermediate steps to get the sector size bitfieldChanges in v5: None
Changes in v4:
- Update the comments for ecc setting selectionChanges in v3: None
Changes in v2:
- Minor cosmetic fixesdrivers/mtd/nand/raw/brcmnand/brcmnand.c | 83 ++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 6 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +7
-0@@ -1038,6 +1038,22 @@ 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 sector_size_bit =brcmnand_sector_1k_shift (ctrl); +u16 acc_control_offs =brcmnand_cs_offset (ctrl, host->cs, +BRCMNAND_CS_ACC_CONTROL ); +u32 acc_control; +Quoted 8 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static inline int brcmnand_sector_1k_shift(struct brcmnand_controller *ctrl) · line 1054
Quoted 6 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +6
-0+if (sector_size_bit <0 ) +return 0 ; + + acc_control =nand_readreg (ctrl, acc_control_offs); + +return (acc_control &BIT (sector_size_bit)) >> sector_size_bit;
FIELD_PREP,FIELD_GET, *please*.
Quoted 2 lines
You probably missed my reply to your comments on the same patch in v5. Here is the link for the post in case it lost in your email:
https://lore.kernel.org/lkml/[email protected]/T/#m1d911d2f119f3bd345c575a81b60bc2bd8c461eb
I didn't miss it, but the reason does not sound legitimate to me. Please work on it, it will be so much cleaner.
Quoted 47 lines
The mask is not constant here and cause build errors.
Quoted 46 lines
Quoted 21 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +13
-0+} +static void brcmnand_set_sector_size_1k (struct brcmnand_host *host,int val) {struct brcmnand_controller *ctrl = host->ctrl;@@ -1055,6 +1071,43 @@ 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 void brcmnand_get_ecc_settings (struct brcmnand_host *host,struct nand_chip *chip) +{drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1094
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +10
-0+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; +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;ditto
drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1104
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +9
-0+if (sector_size_1k) + chip->ecc.strength = ecc_level *2 ; +else if (spare_area_size ==16 && ecc_level ==15 ) + chip->ecc.strength =1 ;/* hamming */ +else + chip->ecc.strength = ecc_level; + +if (chip->ecc.size ==0 ) { +if (sector_size_1k <0 )Should be <= 0 I guess
Quoted 8 lines
Quoted 7 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1107
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+ chip->ecc.size =512 ; + else + chip->ecc.size = 512 << sector_size_1k;What is this? Are you expecting
sector_size_1kto be 0 or 1 and thus multiply 512 by two?Explained in the same post above.
Sector_size_1kcan be negative number for error condition where we default to 512 step size. Otherwise 0 for 512 and 1 for 1K which the above shift takes care of.
The logic is unclear, unnatural. Please simplify. You have the possibility to change all the driver, so please simplify and clarify the logic.
Quoted 3 lines
Quoted 3 lines
Please just use:
chip->ecc.size = SZ_1K;
Thanks,
Miquèl
William Zhang
maintainerRe: [PATCH v6 12/13] mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
Quoted 21 lines · Miquel Raynal
Hi William,
[email protected] wrote on Fri, 23 Feb 2024 09:25:09 -0800:
Quoted 17 lines
Hi Miquel,
Quoted 14 lines · Miquel Raynal
Hi William,
[email protected] wrote on Thu, 22 Feb 2024 19:47:57 -0800:
Quoted 9 lines
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. However these two options can not be used at the same time.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
FYI I did not receive patches 7, 8, 9, which makes the series numbering very odd.
I was using the get maintainer script mainly and it sends to the linux MTD list. I will add your email directly next time.
Yes, I prefer to be in Cc of the whole series, please.
Sure. And thanks for applying other patches. Do you want me to just send a new single patch for the update?
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
Quoted 30 lines
---
Changes in v6:
- Combine the ecc step size and ecc strength into one get function
- Treat it as error condition if both brcm,nand-ecc-use-strap and nand ecc dts properties are set
- Add intermediate steps to get the sector size bitfieldChanges in v5: None
Changes in v4:
- Update the comments for ecc setting selectionChanges in v3: None
Changes in v2:
- Minor cosmetic fixesdrivers/mtd/nand/raw/brcmnand/brcmnand.c | 83 ++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 6 deletions(-)drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0@@ -1038,6 +1038,22 @@ 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 sector_size_bit =brcmnand_sector_1k_shift (ctrl);drivers/mtd/nand/raw/brcmnand/brcmnand.c static inline int brcmnand_sector_1k_shift(struct brcmnand_controller *ctrl) · line 1053
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +10
-0+u16 acc_control_offs =brcmnand_cs_offset (ctrl, host->cs, +BRCMNAND_CS_ACC_CONTROL ); +u32 acc_control; + +if (sector_size_bit <0 ) +return 0 ; + + acc_control =nand_readreg (ctrl, acc_control_offs); + +return (acc_control &BIT (sector_size_bit)) >> sector_size_bit;
FIELD_PREP,FIELD_GET, *please*.
Quoted 6 lines
Quoted 2 lines
You probably missed my reply to your comments on the same patch in v5. Here is the link for the post in case it lost in your email:
https://lore.kernel.org/lkml/[email protected]/T/#m1d911d2f119f3bd345c575a81b60bc2bd8c461ebI didn't miss it, but the reason does not sound legitimate to me. Please work on it, it will be so much cleaner.
I understand FIELD_PREP/GET is the preferred way of linux accessing the register fields but it requires a constant MASK value and does not apply to our case as we have different versions of the register and have different mask. There is way to workaround it. i.e defining the multiple constants directly and using these macros with if/else based on reg version. But it is not clean and since we already have helper functions that handle and return different shift/mask value, I see this is a perfect way for our situation and can adapt to future reg version change easily and cleanly.
Quoted 54 lines
Quoted 54 lines
The mask is not constant here and cause build errors.
Quoted 53 lines
Quoted 21 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +13
-0+} +static void brcmnand_set_sector_size_1k (struct brcmnand_host *host,int val) {struct brcmnand_controller *ctrl = host->ctrl;@@ -1055,6 +1071,43 @@ 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 void brcmnand_get_ecc_settings (struct brcmnand_host *host,struct nand_chip *chip) +{drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1094
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +10
-0+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; +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;ditto
drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1104
Quoted 9 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +9
-0+if (sector_size_1k) + chip->ecc.strength = ecc_level *2 ; +else if (spare_area_size ==16 && ecc_level ==15 ) + chip->ecc.strength =1 ;/* hamming */ +else + chip->ecc.strength = ecc_level; + +if (chip->ecc.size ==0 ) { +if (sector_size_1k <0 )Should be <= 0 I guess
drivers/mtd/nand/raw/brcmnand/brcmnand.c static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) · line 1107
Quoted 3 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+ chip->ecc.size =512 ; + else + chip->ecc.size = 512 << sector_size_1k;What is this? Are you expecting
sector_size_1kto be 0 or 1 and thus multiply 512 by two?
Quoted 6 lines
Quoted 1 line
Explained in the same post above.
Sector_size_1kcan be negative number for error condition where we default to 512 step size. Otherwise 0 for 512 and 1 for 1K which the above shift takes care of.The logic is unclear, unnatural. Please simplify. You have the possibility to change all the driver, so please simplify and clarify the logic.
Will update.
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Please just use:
chip->ecc.size = SZ_1K;Thanks,
Miquèl
Miquel Raynal
maintainerRe: [PATCH v6 12/13] mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
Hi William,
[email protected] wrote on Mon, 26 Feb 2024 12:05:18 -0800:
Quoted 20 lines · Miquel Raynal
Quoted 19 lines
Hi William,
[email protected] wrote on Fri, 23 Feb 2024 09:25:09 -0800:
Quoted 15 lines
Hi Miquel,
Quoted 12 lines · Miquel Raynal
Hi William,
[email protected] wrote on Thu, 22 Feb 2024 19:47:57 -0800:
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
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. However these two options can not be used at the same time.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
FYI I did not receive patches 7, 8, 9, which makes the series numbering very odd.
Quoted 1 line
Quoted 1 line
I was using the get maintainer script mainly and it sends to the linux MTD list. I will add your email directly next time.
Yes, I prefer to be in Cc of the whole series, please.
Sure. And thanks for applying other patches. Do you want me to just send a new single patch for the update?
Yes just the missing patch.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
+static int
brcmnand_get_sector_size_1k(struct brcmnand_host *host)drivers/mtd/nand/raw/brcmnand/brcmnand.c +3
-0+{ +struct brcmnand_controller *ctrl = host->ctrl; +int sector_size_bit =brcmnand_sector_1k_shift (ctrl);drivers/mtd/nand/raw/brcmnand/brcmnand.c static inline int brcmnand_sector_1k_shift(struct brcmnand_controller *ctrl) · line 1054
Quoted 10 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +10
-0+u16 acc_control_offs =brcmnand_cs_offset (ctrl, host->cs, +BRCMNAND_CS_ACC_CONTROL ); +u32 acc_control; + +if (sector_size_bit <0 ) +return 0 ; + + acc_control =nand_readreg (ctrl, acc_control_offs); + +return (acc_control &BIT (sector_size_bit)) >> sector_size_bit;
FIELD_PREP,FIELD_GET, *please*.
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
You probably missed my reply to your comments on the same patch in v5. Here is the link for the post in case it lost in your email:
https://lore.kernel.org/lkml/[email protected]/T/#m1d911d2f119f3bd345c575a81b60bc2bd8c461ebI didn't miss it, but the reason does not sound legitimate to me. Please work on it, it will be so much cleaner.
I understand FIELD_PREP/GET is the preferred way of linux accessing the register fields but it requires a constant MASK value and does not apply to our case as we have different versions of the register and have different mask. There is way to workaround it. i.e defining the multiple constants directly and using these macros with if/else based on reg version. But it is not clean and since we already have helper functions that handle and return different shift/mask value, I see this is a perfect way for our situation and can adapt to future reg version change easily and cleanly.
Quoted 1 line
Quoted 1 line
The mask is not constant here and cause build errors.
Which errors?
+ acc_control = nand_readreg(ctrl, acc_control_offs);
+ return FIELD_GET(BIT(sector_size_bit), acc_control);
Does not return any error here.
Thanks,
Miquèl
William Zhang
maintainerRe: [PATCH v6 12/13] mtd: rawnand: brcmnand: Add support for getting ecc setting from strap
Hi Minquel,
Quoted 28 lines · Miquel Raynal
Hi William,
[email protected] wrote on Mon, 26 Feb 2024 12:05:18 -0800:
Quoted 24 lines · Miquel Raynal
Quoted 23 lines
Hi William,
[email protected] wrote on Fri, 23 Feb 2024 09:25:09 -0800:
Quoted 18 lines
Hi Miquel,
Quoted 15 lines · Miquel Raynal
Hi William,
[email protected] wrote on Thu, 22 Feb 2024 19:47:57 -0800:
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
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. However these two options can not be used at the same time.
Signed-off-by William Zhang <[email protected]>Reviewed-by David Regan <[email protected]>Quoted 1 line
Quoted 1 line
Quoted 1 line
FYI I did not receive patches 7, 8, 9, which makes the series numbering very odd.
Quoted 1 line
Quoted 1 line
I was using the get maintainer script mainly and it sends to the linux MTD list. I will add your email directly next time.
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Yes, I prefer to be in Cc of the whole series, please.
Sure. And thanks for applying other patches. Do you want me to just send a new single patch for the update?
Yes just the missing patch.
v7 of this patch was sent early
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
+static int
brcmnand_get_sector_size_1k(struct brcmnand_host *host)drivers/mtd/nand/raw/brcmnand/brcmnand.c +7
-0+{ +struct brcmnand_controller *ctrl = host->ctrl; +int sector_size_bit =brcmnand_sector_1k_shift (ctrl); +u16 acc_control_offs =brcmnand_cs_offset (ctrl, host->cs, +BRCMNAND_CS_ACC_CONTROL ); +u32 acc_control; +Quoted 8 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c static inline int brcmnand_sector_1k_shift(struct brcmnand_controller *ctrl) · line 1054
Quoted 6 lines
drivers/mtd/nand/raw/brcmnand/brcmnand.c +6
-0+if (sector_size_bit <0 ) +return 0 ; + + acc_control =nand_readreg (ctrl, acc_control_offs); + +return (acc_control &BIT (sector_size_bit)) >> sector_size_bit;
FIELD_PREP,FIELD_GET, *please*.You probably missed my reply to your comments on the same patch in v5. Here is the link for the post in case it lost in your email:
https://lore.kernel.org/lkml/[email protected]/T/#m1d911d2f119f3bd345c575a81b60bc2bd8c461eb
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
I didn't miss it, but the reason does not sound legitimate to me. Please work on it, it will be so much cleaner.
I understand FIELD_PREP/GET is the preferred way of linux accessing the register fields but it requires a constant MASK value and does not apply to our case as we have different versions of the register and have different mask. There is way to workaround it. i.e defining the multiple constants directly and using these macros with if/else based on reg version. But it is not clean and since we already have helper functions that handle and return different shift/mask value, I see this is a perfect way for our situation and can adapt to future reg version change easily and cleanly.
Quoted 1 line
Quoted 1 line
The mask is not constant here and cause build errors.
Which errors?
If I use the code below In function brcmnand_get_sector_size_1k, inlined from brcmnand_get_ecc_settings at drivers/mtd/nand/raw/brcmnand/brcmnand.c:1089:24,
inlined from brcmnand_setup_dev atdrivers/mtd/nand/raw/brcmnand/brcmnand.c:2701:3:././include/linux/compiler_types.h:442:38: error: call to compiletime_assert_254 declared with attribute error: FIELD_GET: mask is not constant
Quoted 5 lines
(quoted diff) +2
-0+ acc_control = nand_readreg(ctrl, acc_control_offs); + return FIELD_GET(BIT(sector_size_bit), acc_control);Does not return any error here.
Right, this function does not return error. brcmnand_sector_1k_shift does. I didn't make that clear enough. This function is updated and logic that calls this function is simplified in v7 based on your feedbacks.
Quoted 2 lines
Thanks,
Miquèl
William Zhang
maintainerPATCH v6 13/13 mtd: rawnand: brcmnand: Support write protection setting from dts
In reply to William ZhangThe 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 v6: None
Changes in v5: None
Changes in v4:
- Use the new brcm,wp-not-connected property based on the dts binding change
Changes in v3: None
Changes in v2: None
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +4 -0
@@ -3223,6 +3223,10 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)/* Disable XOR addressing */ brcmnand_rmw_reg (ctrl,BRCMNAND_CS_XOR ,0xff ,0 ,0 ); +/* Check if the board connects the WP pin */ +if (of_property_read_bool (dn,"brcm,wp-not-connected" )) + wp_on =0 ; +if (ctrl->features &BRCMNAND_HAS_WP ) {/* Permanently disable write protection */ if (wp_on ==2 )
Signature · 1 line
2.37.3
Re: [PATCH v6 13/13] mtd: rawnand: brcmnand: Support write protection setting from dts
Quoted 11 lines · William Zhang
The write protection feature is controlled by the module parameter
wp_onwith 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.Signed-off-by William Zhang <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Reviewed-by Kamal Dasu <[email protected]>Reviewed-by David Regan <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
Florian Fainelli
maintainerQuoted 8 lines · William Zhang
This patch series is an update from the previous version [1] after
exex_opsupport 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.
Quoted 4 lines
In addition there is a bug fix for
exec_ophelper functions, log level adjustment on uncorrectable ECC error and some coding style fixes.
Miquel, thanks for having applied the patches, we should have discussed ahead of time whether you should take the SoC/board-level DTS changes through your tree or mine, but it's fine either way and should not lead to conflicts in Linus' tree.
Signature · 1 line
Florian
Miquel Raynal
maintainerHi Florian,
[email protected] wrote on Mon, 26 Feb 2024 09:36:02 -0800:
Quoted 9 lines · William Zhang
Quoted 8 lines
This patch series is an update from the previous version [1] after
exex_opsupport 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.
Quoted 6 lines
Quoted 4 lines
In addition there is a bug fix for
exec_ophelper functions, log level adjustment on uncorrectable ECC error and some coding style fixes.Miquel, thanks for having applied the patches, we should have discussed ahead of time whether you should take the SoC/board-level DTS changes through your tree or mine, but it's fine either way and should not lead to conflicts in Linus' tree.
I'm sorry for not thinking about this ahead of time, I was also not Cced on the other patches, I noticed it (told Willliam) and just forgot about this when I applied the series.
It is currently living in -next so if there is any problem I can still act.
However for this kind of change I usually apply the bindings and .c changes independently from the DT patches. I believe there is no problem having one or the other being merged first, or do I overlook something?
Cheers,
Miquèl
Florian Fainelli
maintainerHi Miquel,
Quoted 16 lines · Miquel Raynal
Hi Florian,
[email protected] wrote on Mon, 26 Feb 2024 09:36:02 -0800:
Quoted 12 lines · William Zhang
Quoted 11 lines
This patch series is an update from the previous version [1] after
exex_opsupport 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_ophelper functions, log level adjustment on uncorrectable ECC error and some coding style fixes.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Miquel, thanks for having applied the patches, we should have discussed ahead of time whether you should take the SoC/board-level DTS changes through your tree or mine, but it's fine either way and should not lead to conflicts in Linus' tree.
I'm sorry for not thinking about this ahead of time, I was also not Cced on the other patches, I noticed it (told Willliam) and just forgot about this when I applied the series.
Not a problem.
Quoted 8 lines
It is currently living in -next so if there is any problem I can still act.
However for this kind of change I usually apply the bindings and .c changes independently from the DT patches. I believe there is no problem having one or the other being merged first, or do I overlook something?
That is totally fine my concern was more with you also applying the DTS changes which could easily conflict with changes queued up in my ARM SoC tree, and also did not have my Signed-off-by/Acked-by tag on them (I was waiting on the bindings patch to be Acked-by before giving my own). Anyway, let's not make this more complicated than it needs to be, and thanks for working with William on these changes!
Signature · 1 line
Florian
Miquel Raynal
maintainerHi Florian,
[email protected] wrote on Thu, 29 Feb 2024 10:11:01 +0100:
Quoted 24 lines
Hi Florian,
[email protected] wrote on Mon, 26 Feb 2024 09:36:02 -0800:
Quoted 9 lines · William Zhang
Quoted 8 lines
This patch series is an update from the previous version [1] after
exex_opsupport 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.
Quoted 6 lines
Quoted 4 lines
In addition there is a bug fix for
exec_ophelper functions, log level adjustment on uncorrectable ECC error and some coding style fixes.Miquel, thanks for having applied the patches, we should have discussed ahead of time whether you should take the SoC/board-level DTS changes through your tree or mine, but it's fine either way and should not lead to conflicts in Linus' tree.
I'm sorry for not thinking about this ahead of time, I was also not Cced on the other patches, I noticed it (told Willliam) and just forgot about this when I applied the series.
Quoted 7 lines
It is currently living in -next so if there is any problem I can still act.
However for this kind of change I usually apply the bindings and .c changes independently from the DT patches. I believe there is no problem having one or the other being merged first, or do I overlook something?
What the heck /o\ I just understand now my mistake, I am very truly sorry for that...
You were telling me I should sync with you before taking DT changes, and I was so convinced I _did_not_ take the DT, when I looked at the branch I did not understand your point. But I am totally sorry I actually did take the DTs by mistake and I truly did not notice it. Confirmation bias I suppose. My very sincere apologies.
As mentioned previously, I was not CC'ed on the DT patches, but I believe the linux-mtd list was, so the patches didn't appear in my inbox, and once I was happy with the binding/driver changes I applied it all without noticing the DT changes had sneaked in.
I'm finally preparing the PR for Linus and I see it now...
I believe the SoC tree is closed now so it's up to you what I should do with them. Let me know if you want me to keep them in my tree and forward them to Linus or if I should drop them and you'll take them for the next cycle. Also, if I keep them, shall I add some tag of yours on these 3 patches? For the record I did not review them.
Thanks and again, I'm confused. I never apply DT patches like that, your initial remark was more than legitimate.
Cheers,
Miquèl
Florian Fainelli
Acked-byQuoted 50 lines · Miquel Raynal
Hi Florian,
[email protected] wrote on Thu, 29 Feb 2024 10:11:01 +0100:
Quoted 24 lines
Hi Florian,
[email protected] wrote on Mon, 26 Feb 2024 09:36:02 -0800:
Quoted 9 lines · William Zhang
Quoted 8 lines
This patch series is an update from the previous version [1] after
exex_opsupport 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.
Quoted 6 lines
Quoted 4 lines
In addition there is a bug fix for
exec_ophelper functions, log level adjustment on uncorrectable ECC error and some coding style fixes.Miquel, thanks for having applied the patches, we should have discussed ahead of time whether you should take the SoC/board-level DTS changes through your tree or mine, but it's fine either way and should not lead to conflicts in Linus' tree.
I'm sorry for not thinking about this ahead of time, I was also not Cced on the other patches, I noticed it (told Willliam) and just forgot about this when I applied the series.
Quoted 7 lines
It is currently living in -next so if there is any problem I can still act.
However for this kind of change I usually apply the bindings and .c changes independently from the DT patches. I believe there is no problem having one or the other being merged first, or do I overlook something?
What the heck /o\ I just understand now my mistake, I am very truly sorry for that...
You were telling me I should sync with you before taking DT changes, and I was so convinced I _did_not_ take the DT, when I looked at the branch I did not understand your point. But I am totally sorry I actually did take the DTs by mistake and I truly did not notice it. Confirmation bias I suppose. My very sincere apologies.
As mentioned previously, I was not CC'ed on the DT patches, but I believe the linux-mtd list was, so the patches didn't appear in my inbox, and once I was happy with the binding/driver changes I applied it all without noticing the DT changes had sneaked in.
Quoted 7 lines
I'm finally preparing the PR for Linus and I see it now...
I believe the SoC tree is closed now so it's up to you what I should do with them. Let me know if you want me to keep them in my tree and forward them to Linus or if I should drop them and you'll take them for the next cycle. Also, if I keep them, shall I add some tag of yours on these 3 patches? For the record I did not review them.
Yes please add my:
tag, and it's fine I don't expect that we will get conflicts for those files.
Quoted 3 lines
Thanks and again, I'm confused. I never apply DT patches like that, your initial remark was more than legitimate.
Not a problem!
Signature · 1 line
Florian
Miquel Raynal
maintainerQuoted 39 lines
Quoted 27 lines
Quoted 5 lines
I'm sorry for not thinking about this ahead of time, I was also not Cced on the other patches, I noticed it (told Willliam) and just forgot about this when I applied the series.
Quoted 7 lines
It is currently living in -next so if there is any problem I can still act.
However for this kind of change I usually apply the bindings and .c changes independently from the DT patches. I believe there is no problem having one or the other being merged first, or do I overlook something?
What the heck /o\ I just understand now my mistake, I am very truly sorry for that...
You were telling me I should sync with you before taking DT changes, and I was so convinced I _did_not_ take the DT, when I looked at the branch I did not understand your point. But I am totally sorry I actually did take the DTs by mistake and I truly did not notice it. Confirmation bias I suppose. My very sincere apologies.
As mentioned previously, I was not CC'ed on the DT patches, but I believe the linux-mtd list was, so the patches didn't appear in my inbox, and once I was happy with the binding/driver changes I applied it all without noticing the DT changes had sneaked in.
Quoted 7 lines
I'm finally preparing the PR for Linus and I see it now...
I believe the SoC tree is closed now so it's up to you what I should do with them. Let me know if you want me to keep them in my tree and forward them to Linus or if I should drop them and you'll take them for the next cycle. Also, if I keep them, shall I add some tag of yours on these 3 patches? For the record I did not review them.
Yes please add my:
Acked-by Florian Fainelli <[email protected]>
Quoted 7 lines
tag, and it's fine I don't expect that we will get conflicts for those files.
Quoted 3 lines
Thanks and again, I'm confused. I never apply DT patches like that, your initial remark was more than legitimate.
Not a problem!
Thanks :-)
Miquèl