mtd: rawnand: Add NAND controller support on Intel LGM SoC
Subsystems (4)
v4 cover mtd: rawnand: Add NAND controller support on Intel LGM SoC
From: Ramuthevar Vadivel Murugan <[email protected]>
This patch adds the new IP of Nand Flash Controller(NFC) support on Intel's Lightning Mountain(LGM) SoC.
DMA is used for burst data transfer operation, also DMA HW supports aligned 32bit memory address and aligned data access by default. DMA burst of 8 supported. Data register used to support the read/write operation from/to device.
NAND controller also supports in-built HW ECC engine.
NAND controller driver implements ->exec_op() to replace legacy hooks, these specific call-back method to execute NAND operations.
Thank you very much Boris, Miquel and Hauke for the reviews and suggestions.
---
v4:
- add ebu_nand_cs structure for multiple-CS support
- mask/offset encoding for 0x51 value
- update macro HSNAND_CTL_ENABLE_ECC
- drop the op argument and un-used macros.
- updated the datatype and macros
- add function disable nand module
- remove ebu_host->dma_rx = NULL;
- rename MMIO address range variables to ebu and hsnand
- implement ->setup_data_interface()
- update label err_cleanup_nand and err_cleanup_dma
- add return value check in the nand_remove function
- add/remove tabs and spaces as per coding standard
- encoded CS ids by reg property
v3:
- Add depends on MACRO in Kconfig
- file name update in Makefile
- file name update to intel-nand-controller
- modification of MACRO divided like EBU, HSNAND and NAND
- add NAND_ALE_OFFS, NAND_CLE_OFFS and NAND_CS_OFFS
- rename lgm_ to ebu_ and _va suffix is removed in the whole file
- rename structure and varaibles as per review comments.
- remove lgm_read_byte(), lgm_dev_ready() and cmd_ctrl() un-used function
- update in exec_op() as per review comments
- rename function lgm_dma_exit() by lgm_dma_cleanup()
- hardcoded magic value for base and offset replaced by MACRO defined
- mtd_device_unregister() + nand_cleanup() instead of nand_release()
v2:
- implement the ->exec_op() to replaces the legacy hook-up.
- update the commit message
- YAML compatible string update to intel, lgm-nand-controller
- add MIPS maintainers and xway_nand driver author in CC
v1:
- initial version
Ramuthevar Vadivel Murugan (2):
dt-bindings: mtd: Add YAML for Nand Flash Controller support
mtd: rawnand: Add NAND controller support on Intel LGM SoC
.../devicetree/bindings/mtd/intel,lgm-nand.yaml | 61 ++ drivers/mtd/nand/raw/Kconfig | 8 + drivers/mtd/nand/raw/Makefile | 1 + drivers/mtd/nand/raw/intel-nand-controller.c | 750 +++++++++++++++++++++ 4 files changed, 820 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/intel,lgm-nand.yaml create mode 100644 drivers/mtd/nand/raw/intel-nand-controller.c
Signature · 1 line
2.11.0
PATCH v4 1/2 dt-bindings: mtd: Add YAML for Nand Flash Controller support
From: Ramuthevar Vadivel Murugan <[email protected]>
Add YAML file for dt-bindings to support NAND Flash Controller on Intel's Lightning Mountain SoC.
--- .../devicetree/bindings/mtd/intel,lgm-nand.yaml | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/intel,lgm-nand.yaml
Documentation/devicetree/bindings/mtd/intel,lgm-nand.yaml new file +61 -0
@@ -0,0 +1,61 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/intel,lgm-nand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel LGM SoC NAND Controller Device Tree Bindings + +allOf: + - $ref: "nand-controller.yaml" + +maintainers: + - Ramuthevar Vadivel Murugan <[email protected]> + +properties: + compatible: + const: intel,lgm-nand-controller + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + dmas: + maxItems: 2 + + dma-names: + enum: + - rx + - tx + + pinctrl-names: true + +patternProperties: + "^pinctrl-[0-9]+$": true + + "^nand@[a-f0-9]+$": + type: object + properties: + reg: + minimum: 0 + maximum: 7 + + nand-ecc-mode: true + + nand-ecc-algo: + const: hw + + additionalProperties: false + +required: + - compatible + - reg + - clocks + - clock-names + - dmas + +additionalProperties: false + +...
Signature · 1 line
2.11.0
Re: [PATCH v4 1/2] dt-bindings: mtd: Add YAML for Nand Flash Controller support
Quoted 68 lines · On Wed, 29 Apr 2020 18:42:04 +0800 "Ramuthevar,Vadivel MuruganX"…
From: Ramuthevar Vadivel Murugan <[email protected]>
Add YAML file for dt-bindings to support NAND Flash Controller on Intel's Lightning Mountain SoC.
Signed-off-by Ramuthevar Vadivel Murugan <[email protected]>--- .../devicetree/bindings/mtd/intel,lgm-nand.yaml | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/intel,lgm-nand.yamlDocumentation/devicetree/bindings/mtd/intel,lgm-nand.yaml new file +51
-0@@ -0,0 +1,61 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/intel,lgm-nand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel LGM SoC NAND Controller Device Tree Bindings + +allOf: + - $ref: "nand-controller.yaml" + +maintainers: + - Ramuthevar Vadivel Murugan <[email protected]> + +properties: + compatible: + const: intel,lgm-nand-controller + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + dmas: + maxItems: 2 + + dma-names: + enum: + - rx + - tx + + pinctrl-names: true + +patternProperties: + "^pinctrl-[0-9]+$": true + + "^nand@[a-f0-9]+$": + type: object + properties: + reg: + minimum: 0 + maximum: 7 + + nand-ecc-mode: true + + nand-ecc-algo: + const: hw + + additionalProperties: false +
Documentation/devicetree/bindings/mtd/intel,lgm-nand.yaml line 61
Quoted 10 lines
Documentation/devicetree/bindings/mtd/intel,lgm-nand.yaml new file +10
-0+required: + - compatible + - reg + - clocks + - clock-names + - dmas + +additionalProperties: false + +...
Can you provide an example? I'd like to make sure the binding looks good.
Re: [PATCH v4 1/2] dt-bindings: mtd: Add YAML for Nand Flash Controller support
Hi Boris,
Thank you very much for the review comments and your time...
Quoted 77 lines · Boris Brezillon
Quoted 73 lines · On Wed, 29 Apr 2020 18:42:04 +0800 "Ramuthevar,Vadivel MuruganX"…
From: Ramuthevar Vadivel Murugan <[email protected]>
Add YAML file for dt-bindings to support NAND Flash Controller on Intel's Lightning Mountain SoC.
Signed-off-by Ramuthevar Vadivel Murugan <[email protected]>--- .../devicetree/bindings/mtd/intel,lgm-nand.yaml | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+)create mode 100644
Documentation/devicetree/bindings/mtd/intel,lgm-nand.yamlDocumentation/devicetree/bindings/mtd/intel,lgm-nand.yaml new file +56
-0@@ -0,0 +1,61 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/intel,lgm-nand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel LGM SoC NAND Controller Device Tree Bindings + +allOf: + - $ref: "nand-controller.yaml" + +maintainers: + - Ramuthevar Vadivel Murugan <[email protected]> + +properties: + compatible: + const: intel,lgm-nand-controller + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + dmas: + maxItems: 2 + + dma-names: + enum: + - rx + - tx + + pinctrl-names: true + +patternProperties: + "^pinctrl-[0-9]+$": true + + "^nand@[a-f0-9]+$": + type: object + properties: + reg: + minimum: 0 + maximum: 7 + + nand-ecc-mode: true + + nand-ecc-algo: + const: hw + + additionalProperties: false + +required: + - compatible + - reg + - clocks + - clock-names
Quoted 8 lines
Documentation/devicetree/bindings/mtd/intel,lgm-nand.yaml line 61
Quoted 5 lines
Documentation/devicetree/bindings/mtd/intel,lgm-nand.yaml new file +5
-0+ - dmas + +additionalProperties: false + +...Can you provide an example? I'd like to make sure the binding looks good.
Noted, will update with example. Thanks!
Regards
Vadivel
Quoted 1 line
PATCH v4 2/2 mtd: rawnand: Add NAND controller support on Intel LGM SoC
In reply to Ramuthevar,Vadivel MuruganXFrom: Ramuthevar Vadivel Murugan <[email protected]>
This patch adds the new IP of Nand Flash Controller(NFC) support on Intel's Lightning Mountain(LGM) SoC.
DMA is used for burst data transfer operation, also DMA HW supports aligned 32bit memory address and aligned data access by default. DMA burst of 8 supported. Data register used to support the read/write operation from/to device.
NAND controller driver implements ->exec_op() to replace legacy hooks, these specific call-back method to execute NAND operations.
--- drivers/mtd/nand/raw/Kconfig | 8 + drivers/mtd/nand/raw/Makefile | 1 + drivers/mtd/nand/raw/intel-nand-controller.c | 750 +++++++++++++++++++++++++++ 3 files changed, 759 insertions(+) create mode 100644 drivers/mtd/nand/raw/intel-nand-controller.c
drivers/mtd/nand/raw/Kconfig +8 -0
@@ -457,6 +457,14 @@ config MTD_NAND_CADENCE Enable the driver for NAND flash on platforms using a Cadence NAND controller. +config MTD_NAND_INTEL_LGM + tristate "Support for NAND controller on Intel LGM SoC" + depends on OF || COMPILE_TEST + depends on HAS_IOMEM + help + Enables support for NAND Flash chips on Intel's LGM SoC. + NAND flash interfaced through the External Bus Unit. + comment "Misc" config MTD_SM_COMMON
drivers/mtd/nand/raw/Makefile +1 -0
@@ -58,6 +58,7 @@ obj-$(CONFIG_MTD_NAND_TEGRA) += tegra_nand.o obj-$(CONFIG_MTD_NAND_STM32_FMC2) += stm32_fmc2_nand.o obj-$(CONFIG_MTD_NAND_MESON) += meson_nand.o obj-$(CONFIG_MTD_NAND_CADENCE) += cadence-nand-controller.o +obj-$(CONFIG_MTD_NAND_INTEL_LGM) += intel-nand-controller.o nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o nand-objs += nand_onfi.o
drivers/mtd/nand/raw/intel-nand-controller.c new file +750 -0
750 lines not on this page · raw message
Signature · 1 line
2.11.0
drivers/mtd/nand/raw/intel-nand-controller.c line 104
Quoted 3 lines · On Wed, 29 Apr 2020 18:42:05 +0800 "Ramuthevar,Vadivel MuruganX"…
drivers/mtd/nand/raw/intel-nand-controller.c new file +3
-0+#define NAND_WRITE_CMD (EBU_CON_CS_P_LOW | HSNAND_CLE_OFFS) +#define NAND_WRITE_ADDR (EBU_CON_CS_P_LOW | HSNAND_ALE_OFFS) +
I thought we agreed on dropping those definitions.
Hi Boris,
Thank you very much for the review comments and your time..
Quoted 9 lines · Boris Brezillon
drivers/mtd/nand/raw/intel-nand-controller.c line 104
Quoted 3 lines · On Wed, 29 Apr 2020 18:42:05 +0800 "Ramuthevar,Vadivel MuruganX"…
drivers/mtd/nand/raw/intel-nand-controller.c new file +3
-0+#define NAND_WRITE_CMD (EBU_CON_CS_P_LOW | HSNAND_CLE_OFFS) +#define NAND_WRITE_ADDR (EBU_CON_CS_P_LOW | HSNAND_ALE_OFFS) +I thought we agreed on dropping those definitions.
Yes , we agreed upon it, due to assertion/de-assertion of CS kept it. Thanks!
Regards
Vadivel
Quoted 1 line
Quoted 9 lines · Vadivel MuruganX
Hi Boris,
Thank you very much for the review comments and your time..
Quoted 4 lines · Boris Brezillon
On Wed, 29 Apr 2020 18:42:05 +0800 "Ramuthevar,Vadivel MuruganX" <[email protected]> wrote:
Quoted 7 lines
Quoted 5 lines
drivers/mtd/nand/raw/intel-nand-controller.c line 104
Quoted 3 lines
drivers/mtd/nand/raw/intel-nand-controller.c new file +3
-0+#define NAND_WRITE_CMD (EBU_CON_CS_P_LOW | HSNAND_CLE_OFFS) +#define NAND_WRITE_ADDR (EBU_CON_CS_P_LOW | HSNAND_ALE_OFFS) +I thought we agreed on dropping those definitions.
Yes , we agreed upon it, due to assertion/de-assertion of CS kept it.
And I keep thinking we don't need that, just pass
'HSNAND_CLE_OFFS | HSNAND_CS_OFFS' directly.
Hi Boris,
Thank you very much for the review comments and your time...
Quoted 19 lines · Boris Brezillon
Quoted 15 lines · Vadivel MuruganX
Hi Boris,
Thank you very much for the review comments and your time..
Quoted 9 lines · Boris Brezillon
drivers/mtd/nand/raw/intel-nand-controller.c line 104
Quoted 3 lines · On Wed, 29 Apr 2020 18:42:05 +0800 "Ramuthevar,Vadivel MuruganX"…
drivers/mtd/nand/raw/intel-nand-controller.c new file +3
-0+#define NAND_WRITE_CMD (EBU_CON_CS_P_LOW | HSNAND_CLE_OFFS) +#define NAND_WRITE_ADDR (EBU_CON_CS_P_LOW | HSNAND_ALE_OFFS) +I thought we agreed on dropping those definitions.
Quoted 4 lines
Quoted 1 line
Yes , we agreed upon it, due to assertion/de-assertion of CS kept it.
And I keep thinking we don't need that, just pass
'HSNAND_CLE_OFFS|HSNAND_CS_OFFS' directly.
Agreed!, will update in the next-patch version, Thanks!
Regards
Vadivel
Quoted 1 line
drivers/mtd/nand/raw/intel-nand-controller.c line 30
Quoted 3 lines · Vadivel MuruganX
drivers/mtd/nand/raw/intel-nand-controller.c new file +3
-0+ +#define EBU_ADDR_SEL (n) (0x20 + (n) * 4) +#define EBU_ADDR_MASK (5 << 4)
It's still unclear what ADDR_MASK is for. Can you add a comment explaining what it does?
drivers/mtd/nand/raw/intel-nand-controller.c line 679
Quoted 12 lines
drivers/mtd/nand/raw/intel-nand-controller.c new file +10
-0+#define EBU_ADDR_SEL_REGEN 0x1 + +writel (lower_32_bits (ebu_host->cs[ebu_host->cs_num].nand_pa) | +EBU_ADDR_SEL_REGEN |EBU_ADDR_MASK , + ebu_host->ebu +EBU_ADDR_SEL (reg)); + +writel (EBU_MEM_BASE_CS_0 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (0 )); +writel (EBU_MEM_BASE_CS_1 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (reg));
That's super weird. You seem to set EBU_ADDR_SEL(reg) twice. Are you sure that's needed, and are we setting EBU_ADDR_SEL(0) here?
Hi Boris,
Quoted 10 lines · Boris Brezillon
drivers/mtd/nand/raw/intel-nand-controller.c line 30
Quoted 3 lines · Vadivel MuruganX
drivers/mtd/nand/raw/intel-nand-controller.c new file +3
-0+ +#define EBU_ADDR_SEL (n) (0x20 + (n) * 4) +#define EBU_ADDR_MASK (5 << 4)It's still unclear what
ADDR_MASKis for. Can you add a comment explaining what it does?
Thank you Boris, keep review and giving inputs, will update.
Quoted 4 lines
Quoted 2 lines
+#define
EBU_ADDR_SEL_REGEN0x1
Quoted 12 lines
drivers/mtd/nand/raw/intel-nand-controller.c line 679
Quoted 9 lines
drivers/mtd/nand/raw/intel-nand-controller.c new file +9
-0+ +writel (lower_32_bits (ebu_host->cs[ebu_host->cs_num].nand_pa) | +EBU_ADDR_SEL_REGEN |EBU_ADDR_MASK , + ebu_host->ebu +EBU_ADDR_SEL (reg)); + +writel (EBU_MEM_BASE_CS_0 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (0 )); +writel (EBU_MEM_BASE_CS_1 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (reg));That's super weird. You seem to set
EBU_ADDR_SEL(reg)twice. Are you sure that's needed, and are we settingEBU_ADDR_SEL(0)here?
You are right, its weird only, but we need it, since different chip select has different memory region access address.
Yes , we are setting both CS0 and CS1 memory access region, if you have any concern to optimize, please suggest me, Thanks!
Regards
Vadivel
Quoted 1 line
Quoted 7 lines · Vadivel MuruganX
Hi Boris,
Quoted 4 lines · Boris Brezillon
On Wed, 29 Apr 2020 18:42:05 +0800 "Ramuthevar, Vadivel MuruganX" <[email protected]> wrote:
Quoted 8 lines
Quoted 6 lines
drivers/mtd/nand/raw/intel-nand-controller.c line 30
Quoted 3 lines
drivers/mtd/nand/raw/intel-nand-controller.c new file +3
-0+ +#define EBU_ADDR_SEL (n) (0x20 + (n) * 4) +#define EBU_ADDR_MASK (5 << 4)It's still unclear what
ADDR_MASKis for. Can you add a comment explaining what it does?Thank you Boris, keep review and giving inputs, will update.
Can you please explain it here before sending a new version?
Quoted 17 lines
Quoted 4 lines
Quoted 2 lines
+#define
EBU_ADDR_SEL_REGEN0x1Quoted 12 lines
drivers/mtd/nand/raw/intel-nand-controller.c line 679
Quoted 9 lines
drivers/mtd/nand/raw/intel-nand-controller.c new file +9
-0+ +writel (lower_32_bits (ebu_host->cs[ebu_host->cs_num].nand_pa) | +EBU_ADDR_SEL_REGEN |EBU_ADDR_MASK , + ebu_host->ebu +EBU_ADDR_SEL (reg)); + +writel (EBU_MEM_BASE_CS_0 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (0 )); +writel (EBU_MEM_BASE_CS_1 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (reg));That's super weird. You seem to set
EBU_ADDR_SEL(reg)twice. Are you sure that's needed, and are we settingEBU_ADDR_SEL(0)here?
Quoted 2 lines
You are right, its weird only, but we need it, since different chip select has different memory region access address.
Well, that doesn't make any sense, the second write to EBU_ADDR_SEL(reg) overrides the first one, meaning that nand_pa is actually never written to ADDR_SEL(reg).
Quoted 3 lines
Yes , we are setting both CS0 and CS1 memory access region, if you have any concern to optimize, please suggest me, Thanks!
If you want to setup both CS, and the address written in EBU_ADDR_SEL(x) is really related to the nand_pa address, then retrieve resources for all CS ranges. If it's not related, please explain what those EBU_MEM_BASE_CS_X values encode.
Hi Boris,
Quoted 18 lines · Boris Brezillon
Quoted 14 lines · Vadivel MuruganX
Hi Boris,
Quoted 10 lines · Boris Brezillon
drivers/mtd/nand/raw/intel-nand-controller.c line 30
Quoted 3 lines · Vadivel MuruganX
drivers/mtd/nand/raw/intel-nand-controller.c new file +3
-0+ +#define EBU_ADDR_SEL (n) (0x20 + (n) * 4) +#define EBU_ADDR_MASK (5 << 4)It's still unclear what
ADDR_MASKis for. Can you add a comment explaining what it does?
Quoted 3 lines
Quoted 1 line
Thank you Boris, keep review and giving inputs, will update.
Can you please explain it here before sending a new version?
Memory Region Address Mask:
Specifies the number of right-most bits in the base address that should be included in the address comparison. bits positions(7:4).
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
drivers/mtd/nand/raw/intel-nand-controller.c line 679
Quoted 13 lines
drivers/mtd/nand/raw/intel-nand-controller.c new file +10
-0+#define EBU_ADDR_SEL_REGEN 0x1 + +writel (lower_32_bits (ebu_host->cs[ebu_host->cs_num].nand_pa) | +EBU_ADDR_SEL_REGEN |EBU_ADDR_MASK , + ebu_host->ebu +EBU_ADDR_SEL (reg)); + +writel (EBU_MEM_BASE_CS_0 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (0 )); +writel (EBU_MEM_BASE_CS_1 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (reg));That's super weird. You seem to set
EBU_ADDR_SEL(reg)twice. Are you sure that's needed, and are we settingEBU_ADDR_SEL(0)here?
Quoted 6 lines
Quoted 2 lines
You are right, its weird only, but we need it, since different chip select has different memory region access address.
Well, that doesn't make any sense, the second write to
EBU_ADDR_SEL(reg)overrides the first one, meaning thatnand_pais actually never written toADDR_SEL(reg).
it will not overwrite the first one, since two different registers EBU_ADDR_SEL_0 EBU_ADDR_SEL 20HEBU_ADDR_SEL_1 EBU_ADDR_SEL 24H
it is an internal address selection w.r.t chip select for nand physical address update.
Quoted 8 lines
Quoted 4 lines
Yes , we are setting both CS0 and CS1 memory access region, if you have any concern to optimize, please suggest me, Thanks!
If you want to setup both CS, and the address written in
EBU_ADDR_SEL(x)is really related to thenand_paaddress, then retrieve resources for all CS ranges.
If it's not related, please explain what those
Quoted 1 line
EBU_MEM_BASE_CS_Xvalues encode.
Memory Region Base Address
FPI Bus addresses are compared to this base address in conjunction with the mask control(EBU_ADDR_MASK). Driver need to program this field!
Regards
Vadivel
Quoted 1 line
Hi Boris,
Quoted 6 lines · Vadivel MuruganX
+ writel(lower_32_bits(ebu_host->cs[ebu_host->cs_num].nand_pa) | +
EBU_ADDR_SEL_REGEN|EBU_ADDR_MASK,
+ebu_host->ebu+EBU_ADDR_SEL(reg));
+
+ writel(EBU_MEM_BASE_CS_0 |EBU_ADDR_MASK|EBU_ADDR_SEL_REGEN, +ebu_host->ebu+EBU_ADDR_SEL(0));
Good catch!, one will be removed , Thanks !
Regards
Vadivel
Quoted 21 lines · Vadivel MuruganX
Hi Boris,
Quoted 18 lines · Boris Brezillon
Quoted 14 lines · Vadivel MuruganX
Hi Boris,
Quoted 10 lines · Boris Brezillon
drivers/mtd/nand/raw/intel-nand-controller.c line 30
Quoted 3 lines · Vadivel MuruganX
drivers/mtd/nand/raw/intel-nand-controller.c new file +3
-0+ +#define EBU_ADDR_SEL (n) (0x20 + (n) * 4) +#define EBU_ADDR_MASK (5 << 4)It's still unclear what
ADDR_MASKis for. Can you add a comment explaining what it does?
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Thank you Boris, keep review and giving inputs, will update.
Can you please explain it here before sending a new version?
Memory Region Address Mask:
Specifies the number of right-most bits in the base address that should be included in the address comparison. bits positions(7:4).
Okay, then the macro should be
#define EBU_ADDR_MASK(x) ((x) << 4)
And now I'd like you to explain why 5 is the right value for that field (I guess that has to do with the position of the CS/ALE/CLE pins).
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/mtd/nand/raw/intel-nand-controller.c line 674
Quoted 9 lines
drivers/mtd/nand/raw/intel-nand-controller.c new file +5
-0+#define EBU_ADDR_SEL_REGEN 0x1 + +writel (lower_32_bits (ebu_host->cs[ebu_host->cs_num].nand_pa) | +EBU_ADDR_SEL_REGEN |EBU_ADDR_MASK , + ebu_host->ebu +EBU_ADDR_SEL (reg));
You set EBU_ADDR_SEL(reg) once here...
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/mtd/nand/raw/intel-nand-controller.c line 679
Quoted 5 lines
drivers/mtd/nand/raw/intel-nand-controller.c new file +5
-0+ +writel (EBU_MEM_BASE_CS_0 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (0 )); +writel (EBU_MEM_BASE_CS_1 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (reg));
... and a second time here. That sounds like overwriting the EBU_ADDR_SEL(reg) register to me.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
That's super weird. You seem to set
EBU_ADDR_SEL(reg)twice. Are you sure that's needed, and are we settingEBU_ADDR_SEL(0)here?You are right, its weird only, but we need it, since different chip select has different memory region access address.
Quoted 7 lines
Quoted 3 lines
Well, that doesn't make any sense, the second write to
EBU_ADDR_SEL(reg)overrides the first one, meaning thatnand_pais actually never written toADDR_SEL(reg).it will not overwrite the first one, since two different registers
EBU_ADDR_SEL_0EBU_ADDR_SEL20HEBU_ADDR_SEL_1EBU_ADDR_SEL24H
See my above.
Quoted 13 lines
it is an internal address selection w.r.t chip select for nand physical address update.
Quoted 8 lines
Quoted 4 lines
Yes , we are setting both CS0 and CS1 memory access region, if you have any concern to optimize, please suggest me, Thanks!
If you want to setup both CS, and the address written in
EBU_ADDR_SEL(x)is really related to thenand_paaddress, then retrieve resources for all CS ranges.
Quoted 6 lines
If it's not related, please explain what those
Quoted 1 line
EBU_MEM_BASE_CS_Xvalues encode.Memory Region Base Address
FPI Bus addresses are compared to this base address in conjunction with the maskcontrol(EBU_ADDR_MASK). Driver need to program this field!
That's not explaining what the base address should be. Is 'nand_pa' the value we should have there?
Hi Boris,
Thank you very much for keep reviewing the patches and more queries...
Quoted 33 lines · Boris Brezillon
Quoted 21 lines · Vadivel MuruganX
Hi Boris,
Quoted 18 lines · Boris Brezillon
Quoted 14 lines · Vadivel MuruganX
Hi Boris,
Quoted 10 lines · Boris Brezillon
drivers/mtd/nand/raw/intel-nand-controller.c line 30
Quoted 3 lines · Vadivel MuruganX
drivers/mtd/nand/raw/intel-nand-controller.c new file +3
-0+ +#define EBU_ADDR_SEL (n) (0x20 + (n) * 4) +#define EBU_ADDR_MASK (5 << 4)It's still unclear what
ADDR_MASKis for. Can you add a comment explaining what it does?Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Thank you Boris, keep review and giving inputs, will update.
Can you please explain it here before sending a new version?
Memory Region Address Mask:
Specifies the number of right-most bits in the base address that should be included in the address comparison. bits positions(7:4).
Quoted 6 lines
Okay, then the macro should be
#define
EBU_ADDR_MASK(x)((x) << 4)And now I'd like you to explain why 5 is the right value for that field (I guess that has to do with the position of the CS/ALE/CLE pins).
5 : bit 26, 25, 24, 23, 22 to be included for comparison in the ADDR_SELx , it compares only 5 bits.
Quoted 53 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/mtd/nand/raw/intel-nand-controller.c line 674
Quoted 10 lines
drivers/mtd/nand/raw/intel-nand-controller.c new file +5
-0+#define EBU_ADDR_SEL_REGEN 0x1 + +writel (lower_32_bits (ebu_host->cs[ebu_host->cs_num].nand_pa) | +EBU_ADDR_SEL_REGEN |EBU_ADDR_MASK , + ebu_host->ebu +EBU_ADDR_SEL (reg));You set
EBU_ADDR_SEL(reg)once here...Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/mtd/nand/raw/intel-nand-controller.c line 679
Quoted 5 lines
drivers/mtd/nand/raw/intel-nand-controller.c new file +5
-0+ +writel (EBU_MEM_BASE_CS_0 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (0 )); +writel (EBU_MEM_BASE_CS_1 |EBU_ADDR_MASK |EBU_ADDR_SEL_REGEN , + ebu_host->ebu +EBU_ADDR_SEL (reg));... and a second time here. That sounds like overwriting the
EBU_ADDR_SEL(reg)register to me.Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
That's super weird. You seem to set
EBU_ADDR_SEL(reg)twice. Are you sure that's needed, and are we settingEBU_ADDR_SEL(0)here?You are right, its weird only, but we need it, since different chip select has different memory region access address.
Quoted 7 lines
Quoted 3 lines
Well, that doesn't make any sense, the second write to
EBU_ADDR_SEL(reg)overrides the first one, meaning thatnand_pais actually never written toADDR_SEL(reg).it will not overwrite the first one, since two different registers
EBU_ADDR_SEL_0EBU_ADDR_SEL20HEBU_ADDR_SEL_1EBU_ADDR_SEL24HSee my above.
Quoted 14 lines
it is an internal address selection w.r.t chip select for nand physical address update.
Quoted 8 lines
Quoted 4 lines
Yes , we are setting both CS0 and CS1 memory access region, if you have any concern to optimize, please suggest me, Thanks!
If you want to setup both CS, and the address written in
EBU_ADDR_SEL(x)is really related to thenand_paaddress, then retrieve resources for all CS ranges.If it's not related, please explain what those
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
EBU_MEM_BASE_CS_Xvalues encode.Memory Region Base Address
FPI Bus addresses are compared to this base address in conjunction with the maskcontrol(EBU_ADDR_MASK). Driver need to program this field!That's not explaining what the base address should be. Is '
nand_pa' the value we should have there?
The one prorgrammed in the addr_sel register is used by the HW controller, it remaps to 0x174XX-> CS0 and 0x17CXX->CS1. The hardware itself, decodes only for 1740xx/17c0xx, other random values cannot be programmed
Regards
Vadivel
Quoted 1 line
Quoted 38 lines · Vadivel MuruganX
Hi Boris,
Thank you very much for keep reviewing the patches and more queries...
Quoted 33 lines · Boris Brezillon
Quoted 28 lines · Vadivel MuruganX
Hi Boris,
Quoted 18 lines · Boris Brezillon
Quoted 14 lines · Vadivel MuruganX
Hi Boris,
Quoted 10 lines · Boris Brezillon
Review
Quoted 3 lines · Vadivel MuruganX
(quoted diff) +3
-0+ +#define EBU_ADDR_SEL(n) (0x20 + (n) * 4) +#define EBU_ADDR_MASK (5 << 4)It's still unclear what
ADDR_MASKis for. Can you add a comment explaining what it does?Quoted 3 lines
Quoted 1 line
Thank you Boris, keep review and giving inputs, will update.
Can you please explain it here before sending a new version?
Memory Region Address Mask:
Specifies the number of right-most bits in the base address that should be included in the address comparison. bits positions(7:4).
Quoted 8 lines
Quoted 6 lines
Okay, then the macro should be
#define
EBU_ADDR_MASK(x)((x) << 4)And now I'd like you to explain why 5 is the right value for that field (I guess that has to do with the position of the CS/ALE/CLE pins).
5 : bit 26, 25, 24, 23, 22 to be included for comparison in the
That's 6 bits to me, not 5.
Quoted 1 line
ADDR_SELx, it compares only 5 bits.
Definitely not what I would qualify as right-most bits. So, you say the comparison always starts at bit 22, and ends at 22+<num-addr-bits>?
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 6 lines
Quoted 2 lines
Yes , we are setting both CS0 and CS1 memory access region, if you have any concern to optimize, please suggest me, Thanks!
If you want to setup both CS, and the address written in
EBU_ADDR_SEL(x)is really related to thenand_paaddress, then retrieve resources for all CS ranges.If it's not related, please explain what those
Quoted 1 line
EBU_MEM_BASE_CS_Xvalues encode.Memory Region Base Address
FPI Bus addresses are compared to this base address in conjunction with the maskcontrol(EBU_ADDR_MASK). Driver need to program this field!
Quoted 7 lines
Quoted 2 lines
That's not explaining what the base address should be. Is '
nand_pa' the value we should have there?The one prorgrammed in the
addr_selregister is used by the HW controller, it remaps to 0x174XX-> CS0 and 0x17CXX->CS1. The hardware itself, decodes only for 1740xx/17c0xx, other random values cannot be programmed
The question is, is it the same value we have in nand_pa or it is different?
H Boris,
Quoted 44 lines · Boris Brezillon
Quoted 40 lines · Vadivel MuruganX
Hi Boris,
Thank you very much for keep reviewing the patches and more queries...
Quoted 35 lines · Boris Brezillon
Quoted 21 lines · Vadivel MuruganX
Hi Boris,
Quoted 18 lines · Boris Brezillon
Quoted 14 lines · Vadivel MuruganX
Hi Boris,
Quoted 10 lines · Boris Brezillon
Review
Quoted 3 lines · Vadivel MuruganX
(quoted diff) +3
-0+ +#define EBU_ADDR_SEL(n) (0x20 + (n) * 4) +#define EBU_ADDR_MASK (5 << 4)It's still unclear what
ADDR_MASKis for. Can you add a comment explaining what it does?Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Thank you Boris, keep review and giving inputs, will update.
Can you please explain it here before sending a new version?
Memory Region Address Mask:
Specifies the number of right-most bits in the base address that should be included in the address comparison. bits positions(7:4).Okay, then the macro should be
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
#define
EBU_ADDR_MASK(x)((x) << 4)And now I'd like you to explain why 5 is the right value for that field (I guess that has to do with the position of the CS/ALE/CLE pins).
5 : bit 26, 25, 24, 23, 22 to be included for comparison in the
That's 6 bits to me, not 5.
No , 5 bits only the above case.
Quoted 5 lines
Quoted 2 lines
ADDR_SELx, it compares only 5 bits.Definitely not what I would qualify as right-most bits. So, you say the comparison always starts at bit 22, and ends at 22+<num-addr-bits>?
Correct
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Yes , we are setting both CS0 and CS1 memory access region, if you have any concern to optimize, please suggest me, Thanks!
If you want to setup both CS, and the address written in
EBU_ADDR_SEL(x)is really related to thenand_paaddress, then retrieve resources for all CS ranges.Quoted 6 lines
If it's not related, please explain what those
Quoted 1 line
EBU_MEM_BASE_CS_Xvalues encode.Memory Region Base Address
FPI Bus addresses are compared to this base address in conjunction with the maskcontrol(EBU_ADDR_MASK). Driver need to program this field!That's not explaining what the base address should be. Is '
nand_pa' the value we should have there?
Quoted 8 lines
Quoted 4 lines
The one prorgrammed in the
addr_selregister is used by the HW controller, it remaps to 0x174XX-> CS0 and 0x17CXX->CS1. The hardware itself, decodes only for 1740xx/17c0xx, other random values cannot be programmedThe question is, is it the same value we have in
nand_paor it is different?
Different address which is 0xE1400000 NAND_BASE_PHY address.
Thanks!
Regards
Vadivel
Quoted 9 lines · Vadivel MuruganX
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
And now I'd like you to explain why 5 is the right value for that field (I guess that has to do with the position of the CS/ALE/CLE pins).
5 : bit 26, 25, 24, 23, 22 to be included for comparison in the
That's 6 bits to me, not 5.
No , 5 bits only the above case.
Oops, right, sorry for the brain fart.
Quoted 5 lines
Quoted 4 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.
Then why didn't you tell me they didn't match when I suggested to pass nand_pa? So now the question is, what does this address represent? Do you have a reference manual I can look at to understand what this is?
Hi Boris,
Quoted 17 lines · Boris Brezillon
Quoted 9 lines · Vadivel MuruganX
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
And now I'd like you to explain why 5 is the right value for that field (I guess that has to do with the position of the CS/ALE/CLE pins).
5 : bit 26, 25, 24, 23, 22 to be included for comparison in the
That's 6 bits to me, not 5.
No , 5 bits only the above case.
Oops, right, sorry for the brain fart.
Quoted 1 line
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking nand_pa after that only I realized that.
Quoted 1 line
nand_pa? So now the question is, what does this address represent?
EBU-MODULE
_________ _______________________
| | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |
EBU_CONRTROLLER_BASE : 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0: 0x17400 (internal to ebu controller )MEM_REGION_BASE_CS1: 0x17C00
Quoted 1 line
Do you have a reference manual I can look at to understand what this is?
We dont have reference manual since it is new SoC, we keep get information from HW team and we have only register map
Thanks a lot !!!
Regards
Vadivel
Quoted 1 line
Quoted 17 lines · Vadivel MuruganX
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE
_________ _______________________| | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |
Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00
Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx {
ranges = <0x17400000 0xe1400000 0x1000>,
<0x17c00000 0xe1c00000 0x1000>;
reg = <0x17400000>, <0x17c00000>;
reg-names = "cs-0", "cs-1";
}The translated address (0xE1X00000) will be available in res->start, and the non-translated one (0x17X00000) can be retrieved with of_get_address(). All you'd have to do then would be calculate the mask:
mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));
Which allows you to properly set the ADDR_SEL() register without relying on some hardcoded values:
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));
That's quite important if we want to merge the xway NAND driver with this one.
Quoted 52 lines · On Thu, 30 Apr 2020 14:36:00 +0200 Boris Brezillon…
Quoted 17 lines · Vadivel MuruganX
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE
_________ _______________________| | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:
Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Looks like the translation is done at the FPI bus declaration level (see [1]). We really need to see the big picture to take a wise decision about the bindings. Would you mind pasting your dsti/dts files somewhere? It feels like the NAND controller is a sub-part of a more generic 'memory' controller, in which case the NAND controller should be declared as a child of this generic memory bus (called localbus in [1], but maybe EBU is more accurate).
Hi Boris,
Thank you very much for the review comments and your time...
Quoted 70 lines · Boris Brezillon
Quoted 52 lines · On Thu, 30 Apr 2020 14:36:00 +0200 Boris Brezillon…
Quoted 17 lines · Vadivel MuruganX
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE
_________ _______________________| | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Looks like the translation is done at the FPI bus declaration level (see [1]). We really need to see the big picture to take a wise decision about the bindings. Would you mind pasting your dsti/dts files somewhere? It feels like the NAND controller is a sub-part of a more generic 'memory' controller, in which case the NAND controller should be declared as a child of this generic memory bus (called localbus in [1], but maybe EBU is more accurate).
Quoted 1 line
for the ebu-nand node in the dts file.
ebu_nand: ebu_nand@e0f00000 {
compatible = "intel,lgm-ebu-nand";
reg = <0xe0f00000 0x100 //EBU_NAND controller
0xe1000000 0x300 //NAND ECC Extension access
0xe1400000 0x80000
0xe1c00000 0x10000>;
reg-names = "ebunand", "hsnand", "nand_cs0", "nand_cs1";
dmas = <&dma0 8>, <&dma0 9>;
dma-names = "ebu_rx", "ebu_tx";
clocks = <&cgu0 LGM_GCLK_EBU>;
};
&ebu_nand {
status = "disabled";
nand,cs = <1>;
nand-ecc-mode = "hw";
pinctrl-names = "default";
pinctrl-0 = <&ebu_nand_base &ebu_cs1>;
};This is not comes under fpi in our devicetree.
Regards
Vadivel
Quoted 1 line
Hi Boris,
Quoted 70 lines · Boris Brezillon
Quoted 52 lines · On Thu, 30 Apr 2020 14:36:00 +0200 Boris Brezillon…
Quoted 17 lines · Vadivel MuruganX
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE
_________ _______________________| | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Looks like the translation is done at the FPI bus declaration level (see [1]). We really need to see the big picture to take a wise decision about the bindings. Would you mind pasting your dsti/dts files somewhere? It feels like the NAND controller is a sub-part of a more generic 'memory' controller, in which case the NAND controller should be declared as a child of this generic memory bus (called localbus in [1], but maybe EBU is more accurate).
Quoted 1 line
ebu_nand: ebu_nand@e0f00000 {
compatible = "intel,lgm-ebu-nand";
reg = <0xe0f00000 0x100
0xe1000000 0x300
0xe1400000 0x80000
0xe1c00000 0x10000>;
reg-names = "ebunand", "hsnand", "nand_cs0", nand_cs1";
dmas = <&dma0 8>, <&dma0 9>;
dma-names = "ebu_rx", "ebu_tx";
clocks = <&cgu0 LGM_GCLK_EBU>;
};
&ebu_nand {
status = "disabled";
nand,cs = <1>;
nand-ecc-mode = "hw";
pinctrl-names = "default";
pinctrl-0 = <&ebu_nand_base &ebu_cs1>;
};Quoted 1 line
Quoted 89 lines · Vadivel MuruganX
Hi Boris,
Quoted 70 lines · Boris Brezillon
Quoted 52 lines · On Thu, 30 Apr 2020 14:36:00 +0200 Boris Brezillon…
Quoted 17 lines · Vadivel MuruganX
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE
_________ _______________________| | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Looks like the translation is done at the FPI bus declaration level (see [1]). We really need to see the big picture to take a wise decision about the bindings. Would you mind pasting your dsti/dts files somewhere? It feels like the NAND controller is a sub-part of a more generic 'memory' controller, in which case the NAND controller should be declared as a child of this generic memory bus (called localbus in [1], but maybe EBU is more accurate).
Quoted 1 line
ebu_nand: ebu_nand@e0f00000 { compatible = "intel,lgm-ebu-nand"; reg = <0xe0f00000 0x100 0xe1000000 0x300 0xe1400000 0x80000 0xe1c00000 0x10000>; reg-names = "ebunand", "hsnand", "nand_cs0", nand_cs1"; dmas = <&dma0 8>, <&dma0 9>; dma-names = "ebu_rx", "ebu_tx"; clocks = <&cgu0 LGM_GCLK_EBU>; };
Quoted 9 lines
&ebu_nand { status = "disabled"; nand,cs = <1>; nand-ecc-mode = "hw"; pinctrl-names = "default"; pinctrl-0 = <&ebu_nand_base &ebu_cs1>; };Quoted 1 line
Ok. If I understand the SoC topology correctly it should actually be something like that:
{
...
fpi@xxxxx {
compatible = "intel,lgm-fpi", "simple-bus";
/* You might have other ranges to define here */
ranges = <0x16000000 0xe0000000 0x1000000>;
...
ebu@xxxx {
compatible = "intel,lgm-ebu", "simple-bus";
ranges;
pinctrl-names = "default";
pinctrl-0 = <&ebu_nand_base &ebu_cs1>;
/*
* Add your PCI and NOR controller definitions
* here.
*/
...
nand-controller@16f00000 {
compatible = "intel,lgm-ebu-nand-controller";
reg = <0x16f00000 0x100>,
<0x17000000 0x300>,
<0x17400000 0x80000>,
<0x17c00000 0x10000>;
reg-names = "ebunand", "hsnand",
"cs0", cs1";
#address-cells = <1>;
#size-cells = <0>;
/*
* I'm not sure if those belong here: if the
* DMA channels and clocks are shared by all
* controllers attached to the EBU they should
* be moved to the EBU node.
*/
dmas = <&dma0 8>, <&dma0 9>;
dma-names = "rx", "tx";
clocks = <&cgu0 LGM_GCLK_EBU>;
nand@1 {
reg = <1>;
nand-ecc-mode = "hw";
}
}
}
}
}Hi Boris,
Thank you very much for the prompt review and suggestions...
Quoted 99 lines · Boris Brezillon
Quoted 83 lines · Vadivel MuruganX
Hi Boris,
Quoted 65 lines · Boris Brezillon
Quoted 48 lines · On Thu, 30 Apr 2020 14:36:00 +0200 Boris…
Quoted 14 lines · Vadivel MuruganX
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE _________ _______________________ | | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Looks like the translation is done at the FPI bus declaration level (see [1]). We really need to see the big picture to take a wise decision about the bindings. Would you mind pasting your dsti/dts files somewhere? It feels like the NAND controller is a sub-part of a more generic 'memory' controller, in which case the NAND controller should be declared as a child of this generic memory bus (called localbus in [1], but maybe EBU is more accurate).
Quoted 1 line
ebu_nand: ebu_nand@e0f00000 { compatible = "intel,lgm-ebu-nand"; reg = <0xe0f00000 0x100 0xe1000000 0x300 0xe1400000 0x80000 0xe1c00000 0x10000>; reg-names = "ebunand", "hsnand", "nand_cs0", nand_cs1"; dmas = <&dma0 8>, <&dma0 9>; dma-names = "ebu_rx", "ebu_tx"; clocks = <&cgu0 LGM_GCLK_EBU>; };Quoted 9 lines
&ebu_nand { status = "disabled"; nand,cs = <1>; nand-ecc-mode = "hw"; pinctrl-names = "default"; pinctrl-0 = <&ebu_nand_base &ebu_cs1>; };Quoted 1 line
Ok. If I understand the SoC topology correctly it should actually be something like that:
Quoted 9 lines
{
...
fpi@xxxxx {
compatible = "intel,lgm-fpi", "simple-bus";
/* You might have other ranges to define here */
ranges = <0x16000000 0xe0000000 0x1000000>;
...Sorry, we do not have fpi tree node in our dts/dtsi file instead we have the below one.. , that also not included the major peripherals controllers node.
/* Special part from CPU core */
core: core {
compatible = "intel,core", "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
ranges;
ioapic1: interrupt-controller@fec00000 {
#interrupt-cells = <2>;
#address-cells = <0>;
compatible = "intel,ce4100-ioapic";
interrupt-controller;
reg = <0xfec00000 0x1000>;
nr_entries = <256>;
};
hpet: timer@fed00000 {
compatible = "intel,ce4100-hpet";
reg = <0xfed00000 0x400>;
};
lapic0: interrupt-controller@fee00000 {
compatible = "intel,ce4100-lapic";
reg = <0xfee00000 0x1000>;
no_pic_mode;
};
};other than this, rest all in independent node .
Thanks!
Regards
Vadivel
Quoted 145 lines · Vadivel MuruganX
Hi Boris,
Thank you very much for the prompt review and suggestions...
Quoted 99 lines · Boris Brezillon
Quoted 83 lines · Vadivel MuruganX
Hi Boris,
Quoted 65 lines · Boris Brezillon
Quoted 48 lines · On Thu, 30 Apr 2020 14:36:00 +0200 Boris…
Quoted 14 lines · Vadivel MuruganX
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE _________ _______________________ | | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Looks like the translation is done at the FPI bus declaration level (see [1]). We really need to see the big picture to take a wise decision about the bindings. Would you mind pasting your dsti/dts files somewhere? It feels like the NAND controller is a sub-part of a more generic 'memory' controller, in which case the NAND controller should be declared as a child of this generic memory bus (called localbus in [1], but maybe EBU is more accurate).
Quoted 1 line
ebu_nand: ebu_nand@e0f00000 { compatible = "intel,lgm-ebu-nand"; reg = <0xe0f00000 0x100 0xe1000000 0x300 0xe1400000 0x80000 0xe1c00000 0x10000>; reg-names = "ebunand", "hsnand", "nand_cs0", nand_cs1"; dmas = <&dma0 8>, <&dma0 9>; dma-names = "ebu_rx", "ebu_tx"; clocks = <&cgu0 LGM_GCLK_EBU>; };Quoted 9 lines
&ebu_nand { status = "disabled"; nand,cs = <1>; nand-ecc-mode = "hw"; pinctrl-names = "default"; pinctrl-0 = <&ebu_nand_base &ebu_cs1>; };Quoted 1 line
Ok. If I understand the SoC topology correctly it should actually be something like that:
Quoted 9 lines
{ ... fpi@xxxxx { compatible = "intel,lgm-fpi", "simple-bus"; /* You might have other ranges to define here */ ranges = <0x16000000 0xe0000000 0x1000000>; ...Sorry, we do not have fpi tree node in our dts/dtsi file instead we have the below one.. , that also not included the major peripherals controllers node.
/* Special part from CPU core */ core: core { compatible = "intel,core", "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; ioapic1: interrupt-controller@fec00000 { #interrupt-cells = <2>; #address-cells = <0>; compatible = "intel,ce4100-ioapic"; interrupt-controller; reg = <0xfec00000 0x1000>; nr_entries = <256>; }; hpet: timer@fed00000 { compatible = "intel,ce4100-hpet"; reg = <0xfed00000 0x400>; }; lapic0: interrupt-controller@fee00000 { compatible = "intel,ce4100-lapic"; reg = <0xfee00000 0x1000>; no_pic_mode; }; };
Quoted 1 line
other than this, rest all in independent node .
But you do have an FPI bus, right? If this is the case it should be represented. Or is the "intel,core" bus actually the FPI bus that you named differently?
Hi Boris,
Quoted 149 lines · Boris Brezillon
Quoted 145 lines · Vadivel MuruganX
Hi Boris,
Thank you very much for the prompt review and suggestions...
Quoted 99 lines · Boris Brezillon
Quoted 83 lines · Vadivel MuruganX
Hi Boris,
Quoted 65 lines · Boris Brezillon
Quoted 48 lines · On Thu, 30 Apr 2020 14:36:00 +0200 Boris…
Quoted 14 lines · Vadivel MuruganX
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE _________ _______________________ | | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Looks like the translation is done at the FPI bus declaration level (see [1]). We really need to see the big picture to take a wise decision about the bindings. Would you mind pasting your dsti/dts files somewhere? It feels like the NAND controller is a sub-part of a more generic 'memory' controller, in which case the NAND controller should be declared as a child of this generic memory bus (called localbus in [1], but maybe EBU is more accurate).
Quoted 1 line
ebu_nand: ebu_nand@e0f00000 { compatible = "intel,lgm-ebu-nand"; reg = <0xe0f00000 0x100 0xe1000000 0x300 0xe1400000 0x80000 0xe1c00000 0x10000>; reg-names = "ebunand", "hsnand", "nand_cs0", nand_cs1"; dmas = <&dma0 8>, <&dma0 9>; dma-names = "ebu_rx", "ebu_tx"; clocks = <&cgu0 LGM_GCLK_EBU>; };Quoted 9 lines
&ebu_nand { status = "disabled"; nand,cs = <1>; nand-ecc-mode = "hw"; pinctrl-names = "default"; pinctrl-0 = <&ebu_nand_base &ebu_cs1>; };Quoted 1 line
Ok. If I understand the SoC topology correctly it should actually be something like that:
Quoted 9 lines
{ ... fpi@xxxxx { compatible = "intel,lgm-fpi", "simple-bus"; /* You might have other ranges to define here */ ranges = <0x16000000 0xe0000000 0x1000000>; ...Sorry, we do not have fpi tree node in our dts/dtsi file instead we have the below one.. , that also not included the major peripherals controllers node.
/* Special part from CPU core */ core: core { compatible = "intel,core", "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; ioapic1: interrupt-controller@fec00000 { #interrupt-cells = <2>; #address-cells = <0>; compatible = "intel,ce4100-ioapic"; interrupt-controller; reg = <0xfec00000 0x1000>; nr_entries = <256>; }; hpet: timer@fed00000 { compatible = "intel,ce4100-hpet"; reg = <0xfed00000 0x400>; }; lapic0: interrupt-controller@fee00000 { compatible = "intel,ce4100-lapic"; reg = <0xfee00000 0x1000>; no_pic_mode; }; };
Quoted 4 lines
Quoted 1 line
other than this, rest all in independent node .
But you do have an FPI bus, right? If this is the case it should be represented.
Yes, FPI bus is slave to core which connects all the peripherals.
Or is the "intel,core" bus actually the FPI bus that you
Quoted 1 line
named differently?
FPI slave bus connects to core bus by OCP bridge, so here it is named FPI bus, but SW perspective didn't have root tree which has all sub-nodes, as of now each peripheral has its own node.
Regards
Vadivel
Quoted 1 line
Quoted 157 lines · Vadivel MuruganX
Hi Boris,
Quoted 149 lines · Boris Brezillon
Quoted 145 lines · Vadivel MuruganX
Hi Boris,
Thank you very much for the prompt review and suggestions...
Quoted 99 lines · Boris Brezillon
Quoted 83 lines · Vadivel MuruganX
Hi Boris,
Quoted 65 lines · Boris Brezillon
Quoted 48 lines · On Thu, 30 Apr 2020 14:36:00 +0200 Boris…
Quoted 14 lines · Vadivel MuruganX
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE _________ _______________________ | | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Looks like the translation is done at the FPI bus declaration level (see [1]). We really need to see the big picture to take a wise decision about the bindings. Would you mind pasting your dsti/dts files somewhere? It feels like the NAND controller is a sub-part of a more generic 'memory' controller, in which case the NAND controller should be declared as a child of this generic memory bus (called localbus in [1], but maybe EBU is more accurate).
Quoted 1 line
ebu_nand: ebu_nand@e0f00000 { compatible = "intel,lgm-ebu-nand"; reg = <0xe0f00000 0x100 0xe1000000 0x300 0xe1400000 0x80000 0xe1c00000 0x10000>; reg-names = "ebunand", "hsnand", "nand_cs0", nand_cs1"; dmas = <&dma0 8>, <&dma0 9>; dma-names = "ebu_rx", "ebu_tx"; clocks = <&cgu0 LGM_GCLK_EBU>; };Quoted 9 lines
&ebu_nand { status = "disabled"; nand,cs = <1>; nand-ecc-mode = "hw"; pinctrl-names = "default"; pinctrl-0 = <&ebu_nand_base &ebu_cs1>; };Quoted 1 line
Ok. If I understand the SoC topology correctly it should actually be something like that:
Quoted 9 lines
{ ... fpi@xxxxx { compatible = "intel,lgm-fpi", "simple-bus"; /* You might have other ranges to define here */ ranges = <0x16000000 0xe0000000 0x1000000>; ...Sorry, we do not have fpi tree node in our dts/dtsi file instead we have the below one.. , that also not included the major peripherals controllers node.
/* Special part from CPU core */ core: core { compatible = "intel,core", "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; ioapic1: interrupt-controller@fec00000 { #interrupt-cells = <2>; #address-cells = <0>; compatible = "intel,ce4100-ioapic"; interrupt-controller; reg = <0xfec00000 0x1000>; nr_entries = <256>; }; hpet: timer@fed00000 { compatible = "intel,ce4100-hpet"; reg = <0xfed00000 0x400>; }; lapic0: interrupt-controller@fee00000 { compatible = "intel,ce4100-lapic"; reg = <0xfee00000 0x1000>; no_pic_mode; }; };Quoted 4 lines
Quoted 1 line
other than this, rest all in independent node .
But you do have an FPI bus, right? If this is the case it should be represented.
Quoted 8 lines
Yes, FPI bus is slave to core which connects all the peripherals.
Or is the "intel,core" bus actually the FPI bus that you
Quoted 1 line
named differently?
FPI slave bus connects to core bus by OCP bridge, so here it is named FPI bus, but SW perspective didn't have root tree which has all sub-nodes, as of now each peripheral has its own node.
Duh, not sure that's a good idea to hide that, especially since you have to describe the address translation that happens when crossing the FPI bus (the ranges thing I mentioned previously).
Hi Boris,
Quoted 166 lines · Boris Brezillon
Quoted 162 lines · Vadivel MuruganX
Hi Boris,
Quoted 149 lines · Boris Brezillon
Quoted 145 lines · Vadivel MuruganX
Hi Boris,
Thank you very much for the prompt review and suggestions...
Quoted 99 lines · Boris Brezillon
Quoted 83 lines · Vadivel MuruganX
Hi Boris,
Quoted 65 lines · Boris Brezillon
Quoted 48 lines · On Thu, 30 Apr 2020 14:36:00 +0200 Boris…
Quoted 14 lines · Vadivel MuruganX
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE _________ _______________________ | | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Looks like the translation is done at the FPI bus declaration level (see [1]). We really need to see the big picture to take a wise decision about the bindings. Would you mind pasting your dsti/dts files somewhere? It feels like the NAND controller is a sub-part of a more generic 'memory' controller, in which case the NAND controller should be declared as a child of this generic memory bus (called localbus in [1], but maybe EBU is more accurate).
Quoted 1 line
ebu_nand: ebu_nand@e0f00000 { compatible = "intel,lgm-ebu-nand"; reg = <0xe0f00000 0x100 0xe1000000 0x300 0xe1400000 0x80000 0xe1c00000 0x10000>; reg-names = "ebunand", "hsnand", "nand_cs0", nand_cs1"; dmas = <&dma0 8>, <&dma0 9>; dma-names = "ebu_rx", "ebu_tx"; clocks = <&cgu0 LGM_GCLK_EBU>; };Quoted 9 lines
&ebu_nand { status = "disabled"; nand,cs = <1>; nand-ecc-mode = "hw"; pinctrl-names = "default"; pinctrl-0 = <&ebu_nand_base &ebu_cs1>; };Quoted 1 line
Ok. If I understand the SoC topology correctly it should actually be something like that:
Quoted 9 lines
{ ... fpi@xxxxx { compatible = "intel,lgm-fpi", "simple-bus"; /* You might have other ranges to define here */ ranges = <0x16000000 0xe0000000 0x1000000>; ...Sorry, we do not have fpi tree node in our dts/dtsi file instead we have the below one.. , that also not included the major peripherals controllers node.
/* Special part from CPU core */ core: core { compatible = "intel,core", "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; ioapic1: interrupt-controller@fec00000 { #interrupt-cells = <2>; #address-cells = <0>; compatible = "intel,ce4100-ioapic"; interrupt-controller; reg = <0xfec00000 0x1000>; nr_entries = <256>; }; hpet: timer@fed00000 { compatible = "intel,ce4100-hpet"; reg = <0xfed00000 0x400>; }; lapic0: interrupt-controller@fee00000 { compatible = "intel,ce4100-lapic"; reg = <0xfee00000 0x1000>; no_pic_mode; }; };Quoted 4 lines
Quoted 1 line
other than this, rest all in independent node .
But you do have an FPI bus, right? If this is the case it should be represented.
Yes, FPI bus is slave to core which connects all the peripherals.
Or is the "intel,core" bus actually the FPI bus that you
Quoted 1 line
named differently?
Quoted 7 lines
Quoted 3 lines
FPI slave bus connects to core bus by OCP bridge, so here it is named FPI bus, but SW perspective didn't have root tree which has all sub-nodes, as of now each peripheral has its own node.
Duh, not sure that's a good idea to hide that, especially since you have to describe the address translation that happens when crossing the FPI bus (the ranges thing I mentioned previously).
Thanks Boris, Sure I will do as you have suggested.
can I proceed to send next patch-set.
Regards
Vadivel
Hi Boris,
Quoted 166 lines · Boris Brezillon
Quoted 162 lines · Vadivel MuruganX
Hi Boris,
Quoted 149 lines · Boris Brezillon
Quoted 145 lines · Vadivel MuruganX
Hi Boris,
Thank you very much for the prompt review and suggestions...
Quoted 99 lines · Boris Brezillon
Quoted 83 lines · Vadivel MuruganX
Hi Boris,
Quoted 65 lines · Boris Brezillon
Quoted 48 lines · On Thu, 30 Apr 2020 14:36:00 +0200 Boris…
Quoted 14 lines · Vadivel MuruganX
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE _________ _______________________ | | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Looks like the translation is done at the FPI bus declaration level (see [1]). We really need to see the big picture to take a wise decision about the bindings. Would you mind pasting your dsti/dts files somewhere? It feels like the NAND controller is a sub-part of a more generic 'memory' controller, in which case the NAND controller should be declared as a child of this generic memory bus (called localbus in [1], but maybe EBU is more accurate).
Quoted 1 line
ebu_nand: ebu_nand@e0f00000 { compatible = "intel,lgm-ebu-nand"; reg = <0xe0f00000 0x100 0xe1000000 0x300 0xe1400000 0x80000 0xe1c00000 0x10000>; reg-names = "ebunand", "hsnand", "nand_cs0", nand_cs1"; dmas = <&dma0 8>, <&dma0 9>; dma-names = "ebu_rx", "ebu_tx"; clocks = <&cgu0 LGM_GCLK_EBU>; };Quoted 9 lines
&ebu_nand { status = "disabled"; nand,cs = <1>; nand-ecc-mode = "hw"; pinctrl-names = "default"; pinctrl-0 = <&ebu_nand_base &ebu_cs1>; };Quoted 1 line
Ok. If I understand the SoC topology correctly it should actually be something like that:
Quoted 9 lines
{ ... fpi@xxxxx { compatible = "intel,lgm-fpi", "simple-bus"; /* You might have other ranges to define here */ ranges = <0x16000000 0xe0000000 0x1000000>; ...Sorry, we do not have fpi tree node in our dts/dtsi file instead we have the below one.. , that also not included the major peripherals controllers node.
/* Special part from CPU core */ core: core { compatible = "intel,core", "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; ioapic1: interrupt-controller@fec00000 { #interrupt-cells = <2>; #address-cells = <0>; compatible = "intel,ce4100-ioapic"; interrupt-controller; reg = <0xfec00000 0x1000>; nr_entries = <256>; }; hpet: timer@fed00000 { compatible = "intel,ce4100-hpet"; reg = <0xfed00000 0x400>; }; lapic0: interrupt-controller@fee00000 { compatible = "intel,ce4100-lapic"; reg = <0xfee00000 0x1000>; no_pic_mode; }; };Quoted 4 lines
Quoted 1 line
other than this, rest all in independent node .
But you do have an FPI bus, right? If this is the case it should be represented.
Yes, FPI bus is slave to core which connects all the peripherals.
Or is the "intel,core" bus actually the FPI bus that you
Quoted 1 line
named differently?
Quoted 7 lines
Quoted 3 lines
FPI slave bus connects to core bus by OCP bridge, so here it is named FPI bus, but SW perspective didn't have root tree which has all sub-nodes, as of now each peripheral has its own node.
Duh, not sure that's a good idea to hide that, especially since you have to describe the address translation that happens when crossing the FPI bus (the ranges thing I mentioned previously).
Thanks! for the keep reviewing.
SW Address translation is not required, after discussion with HW team , came to know that 0x17400 and 0x17C00 internal to the SoC.
NOC will translate 0xE1XX... to FPI address 0x17X... internally. There is an address translation in the NOC.
0x17X... is not visible to user.
so far added hard-coded values to CS0 and CS1 is not at required. I will change the code accordingly and sent to you.
Regards
Vadivel
Quoted 1 line
Hello Vadivel,
Quoted 90 lines · Vadivel MuruganX
Quoted 77 lines
Quoted 77 lines
Quoted 67 lines
Quoted 67 lines
Quoted 26 lines
Quoted 14 lines
ebu_nand: ebu_nand@e0f00000 { compatible = "intel,lgm-ebu-nand"; reg = <0xe0f00000 0x100 0xe1000000 0x300 0xe1400000 0x80000 0xe1c00000 0x10000>; reg-names = "ebunand", "hsnand", "nand_cs0", nand_cs1"; dmas = <&dma0 8>, <&dma0 9>; dma-names = "ebu_rx", "ebu_tx"; clocks = <&cgu0 LGM_GCLK_EBU>; };Quoted 9 lines
&ebu_nand { status = "disabled"; nand,cs = <1>; nand-ecc-mode = "hw"; pinctrl-names = "default"; pinctrl-0 = <&ebu_nand_base &ebu_cs1>; };Quoted 1 line
Ok. If I understand the SoC topology correctly it should actually be something like that:
Quoted 9 lines
{ ... fpi@xxxxx { compatible = "intel,lgm-fpi", "simple-bus"; /* You might have other ranges to define here */ ranges = <0x16000000 0xe0000000 0x1000000>; ...Sorry, we do not have fpi tree node in our dts/dtsi file instead we have the below one.. , that also not included the major peripherals controllers node.
/* Special part from CPU core */ core: core { compatible = "intel,core", "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; ioapic1: interrupt-controller@fec00000 { #interrupt-cells = <2>; #address-cells = <0>; compatible = "intel,ce4100-ioapic"; interrupt-controller; reg = <0xfec00000 0x1000>; nr_entries = <256>; }; hpet: timer@fed00000 { compatible = "intel,ce4100-hpet"; reg = <0xfed00000 0x400>; }; lapic0: interrupt-controller@fee00000 { compatible = "intel,ce4100-lapic"; reg = <0xfee00000 0x1000>; no_pic_mode; }; };Quoted 4 lines
Quoted 1 line
other than this, rest all in independent node .
But you do have an FPI bus, right? If this is the case it should be represented.
Yes, FPI bus is slave to core which connects all the peripherals.
Or is the "intel,core" bus actually the FPI bus that you
Quoted 1 line
named differently?
Quoted 7 lines
Quoted 3 lines
FPI slave bus connects to core bus by OCP bridge, so here it is named FPI bus, but SW perspective didn't have root tree which has all sub-nodes, as of now each peripheral has its own node.
Duh, not sure that's a good idea to hide that, especially since you have to describe the address translation that happens when crossing the FPI bus (the ranges thing I mentioned previously).
Thanks! for the keep reviewing.
SW Address translation is not required, after discussion with HW team , came to know that
0x17400and0x17C00internal to the SoC.
Quoted 6 lines
NOC will translate 0xE1XX... to FPI address 0x17X... internally. There is an address translation in the NOC.
0x17X... is not visible to user.so far added hard-coded values to CS0 and CS1 is not at required. I will change the code accordingly and sent to you.
Hm, you told me last week that writing wrong values to this register caused the NAND controller to not work properly (you even had code that was overwriting the dynamically calculated values by hardcoded ones, so I suspect it indeed didn't work) and now you say this write to EBU_ADDR_SEL() is optional?! Sorry but it's hard to believe, and I've received so many contradictory information from you on that matter that I can't really tell which one is correct. Not sure I want to keep reviewing new versions of this driver in this context.
Regards,
Boris
Hi Boris,
Quoted 103 lines · Boris Brezillon
Hello Vadivel,
Quoted 90 lines · Vadivel MuruganX
Quoted 77 lines
Quoted 77 lines
Quoted 67 lines
Quoted 67 lines
Quoted 26 lines
Quoted 14 lines
ebu_nand: ebu_nand@e0f00000 { compatible = "intel,lgm-ebu-nand"; reg = <0xe0f00000 0x100 0xe1000000 0x300 0xe1400000 0x80000 0xe1c00000 0x10000>; reg-names = "ebunand", "hsnand", "nand_cs0", nand_cs1"; dmas = <&dma0 8>, <&dma0 9>; dma-names = "ebu_rx", "ebu_tx"; clocks = <&cgu0 LGM_GCLK_EBU>; };Quoted 9 lines
&ebu_nand { status = "disabled"; nand,cs = <1>; nand-ecc-mode = "hw"; pinctrl-names = "default"; pinctrl-0 = <&ebu_nand_base &ebu_cs1>; };Quoted 1 line
Ok. If I understand the SoC topology correctly it should actually be something like that:
Quoted 9 lines
{ ... fpi@xxxxx { compatible = "intel,lgm-fpi", "simple-bus"; /* You might have other ranges to define here */ ranges = <0x16000000 0xe0000000 0x1000000>; ...Sorry, we do not have fpi tree node in our dts/dtsi file instead we have the below one.. , that also not included the major peripherals controllers node.
/* Special part from CPU core */ core: core { compatible = "intel,core", "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; ioapic1: interrupt-controller@fec00000 { #interrupt-cells = <2>; #address-cells = <0>; compatible = "intel,ce4100-ioapic"; interrupt-controller; reg = <0xfec00000 0x1000>; nr_entries = <256>; }; hpet: timer@fed00000 { compatible = "intel,ce4100-hpet"; reg = <0xfed00000 0x400>; }; lapic0: interrupt-controller@fee00000 { compatible = "intel,ce4100-lapic"; reg = <0xfee00000 0x1000>; no_pic_mode; }; };Quoted 4 lines
Quoted 1 line
other than this, rest all in independent node .
But you do have an FPI bus, right? If this is the case it should be represented.
Yes, FPI bus is slave to core which connects all the peripherals.
Or is the "intel,core" bus actually the FPI bus that you
Quoted 1 line
named differently?
Quoted 7 lines
Quoted 3 lines
FPI slave bus connects to core bus by OCP bridge, so here it is named FPI bus, but SW perspective didn't have root tree which has all sub-nodes, as of now each peripheral has its own node.
Duh, not sure that's a good idea to hide that, especially since you have to describe the address translation that happens when crossing the FPI bus (the ranges thing I mentioned previously).
Thanks! for the keep reviewing.
SW Address translation is not required, after discussion with HW team , came to know that
0x17400and0x17C00internal to the SoC.Quoted 6 lines
NOC will translate 0xE1XX... to FPI address 0x17X... internally. There is an address translation in the NOC.
0x17X... is not visible to user.so far added hard-coded values to CS0 and CS1 is not at required. I will change the code accordingly and sent to you.
Quoted 8 lines
Hm, you told me last week that writing wrong values to this register caused the NAND controller to not work properly (you even had code that was overwriting the dynamically calculated values by hardcoded ones, so I suspect it indeed didn't work) and now you say this write to
EBU_ADDR_SEL()is optional?! Sorry but it's hard to believe, and I've received so many contradictory information from you on that matter that I can't really tell which one is correct. Not sure I want to keep reviewing new versions of this driver in this context.
oh my bad really sorry , since last week based on the input given from person who has worked on legacy IP, but now I have discussed with low-level HW team and confirmed. also we don't have proper document reference manual since it's new SoC.
Please forgive me , this shouldn't be happen once again, Thanks a lot!!
Regards
Vadivel
Quoted 5 lines
Regards,
Boris
Hi Boris,
Thank you very much for the review comments and giving inputs...
Quoted 52 lines · Boris Brezillon
Quoted 17 lines · Vadivel MuruganX
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
The question is, is it the same value we have in
nand_paor it is different?Different address which is
0xE1400000NAND_BASE_PHYaddress.Then why didn't you tell me they didn't match when I suggested to pass
sorry, because you keep asking
nand_paafter that only I realized that.Quoted 1 line
nand_pa? So now the question is, what does this address represent?EBU-MODULE
_________ _______________________| | | |NAND CTRL | | FPI BUS |==>| CS0(0x174) | 0xE100 ( 0xE14/0xE1C) NAND_PHY_BASE |_________| |_CS1(0x17C)_|__________ |Quoted 8 lines
EBU_CONRTROLLER_BASE: 0xE0F0_0000HSNAND_BASE: 0xE100_0000NAND_CS0: 0xE140_0000NAND_CS1: 0xE1C0_0000
MEM_REGION_BASE_CS0:0x17400(internal to ebu controller )MEM_REGION_BASE_CS1:0x17C00Hm, I wonder if we shouldn't use a 'ranges' property to describe this address translation. Something like
ebu@xxx { ranges = <0x17400000 0xe1400000 0x1000>, <0x17c00000 0xe1c00000 0x1000>; reg = <0x17400000>, <0x17c00000>; reg-names = "cs-0", "cs-1"; }The translated address (0xE1X00000) will be available in
res->start, and the non-translated one (0x17X00000) can be retrieved withof_get_address(). All you'd have to do then would be calculate the mask:mask = (translated_address & original_address) >> 22; num_comp_bits = fls(mask); WARN_ON(mask != GENMASK(num_comp_bits - 1, 0));Which allows you to properly set the
ADDR_SEL()register without relying on some hardcoded values:
Quoted 6 lines
writel(original_address | EBU_ADDR_SEL_REGEN | EBU_ADDR_COMP_BITS(num_comp_bits), ebu_host->ebu + EBU_ADDR_SEL(csid));That's quite important if we want to merge the xway NAND driver with this one.
Thanks! , for the optimized and made it generic way, will update in the next patch-set.
Regards
Vadivel