Skip to contentSkip to conversation

EDAC/nuvoton: Add NPCM memory controller driver

PATCH In review Marvin Lin 3 participants 13 messages Jan 11, 2023 – Jun 13, 2023

Subsystems (5)
lore
Share & tools
lore

Marvin Lin

author
#0 lore raw

v18 cover EDAC/nuvoton: Add NPCM memory controller driver

This patch series add DTS node, dt-bindings document and driver for memory controller present on Nuvoton NPCM SoCs.

The memory controller supports single bit error correction and double bit error detection (in-line ECC in which a section 1/8th of the memory device used to store data is used for ECC storage).

Changes in v18:
- Driver refinements
- Adjust line breaks, order of variable declarations and destroy resources.
- Catch weired cases by WARN_ON_ONCE.
- Add defines for constants, and provide injection examples in comment.
- Correct subject prefixes of patch 2/3.

Changes in v17:
- Correct subject prefixes of patch 1/3.
- Change dt-bindings document name to "nuvoton,npcm-memory-controller.yaml" and refine the document format.

Changes in v16:
- Correct dt-bindings document path in MAINTAINERS.
- Fix wrong indentation in driver.

Changes in v15:
- Move dt-bindings document to memory-controllers directory and remove superfluous string in content title.

Changes in v14:
- Fix compile warnings.

Changes in v13:
- Support error injection via debugfs.
- Fix coding style issues.

Marvin Lin (3):
ARM: dts: nuvoton: Add node for NPCM memory controller
dt-bindings: memory-controllers: nuvoton: Add NPCM memory controller EDAC/npcm: Add NPCM memory controller driver

 .../nuvoton,npcm-memory-controller.yaml       |  50 ++
 MAINTAINERS                                   |   8 +
 arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi |   7 +
 drivers/edac/Kconfig                          |  11 +
 drivers/edac/Makefile                         |   1 +
 drivers/edac/npcm_edac.c                      | 543 ++++++++++++++++++
 6 files changed, 620 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/nuvoton,npcm-memory-controller.yaml
 create mode 100644 drivers/edac/npcm_edac.c
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v18 1/3 ARM: dts: nuvoton: Add node for NPCM memory controller

Add node for memory controller present on Nuvoton NPCM SoCs. The memory controller supports single bit error correction and double bit error detection.

---
 arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi +7 -0
index c7b5ef15b716..d875e8ac1e09 100644
@@ -179,6 +179,13 @@ fiux: spi@fb001000 {
 			status = "disabled";
 		};
 
+		mc: memory-controller@f0824000 {
+			compatible = "nuvoton,npcm750-memory-controller";
+			reg = <0xf0824000 0x1000>;
+			interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
 		apb {
 			#address-cells = <1>;
 			#size-cells = <1>;
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH v18 1/3] ARM: dts: nuvoton: Add node for NPCM memory controller

Quoted 8 lines · Marvin Lin

Add node for memory controller present on Nuvoton NPCM SoCs. The memory controller supports single bit error correction and double bit error detection.

---
 arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

I guess this needs an Ack from OF folks if it is going to go through the EDAC tree ...

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#3 lore raw

Re: [PATCH v18 1/3] ARM: dts: nuvoton: Add node for NPCM memory controller

Quoted 5 lines · Borislav Petkov
Quoted 4 lines · Marvin Lin

Add node for memory controller present on Nuvoton NPCM SoCs. The memory controller supports single bit error correction and double bit error detection.

Quoted 7 lines
Quoted 4 lines
---
 arch/arm/boot/dts/nuvoton-common-npcm7xx.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

I guess this needs an Ack from OF folks if it is going to go through the EDAC tree ...

It is preferred this goes via Nuvoton ARM SoC tree. I don't understand why this is first in the series - it's clearly wrong.

Best regards,
Krzysztof

maintainer
#4 lore raw

Re: [PATCH v18 1/3] ARM: dts: nuvoton: Add node for NPCM memory controller

Quoted 2 lines · Krzysztof Kozlowski

It is preferred this goes via Nuvoton ARM SoC tree. I don't understand why this is first in the series - it's clearly wrong.

Don't ask me...

So the EDAC driver itself is self-contained so I can review it and you can pick it up with the rest, if it looks ok.

That ok?

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#5 lore raw

Re: [PATCH v18 1/3] ARM: dts: nuvoton: Add node for NPCM memory controller

Quoted 10 lines · Borislav Petkov
Quoted 2 lines · Krzysztof Kozlowski

It is preferred this goes via Nuvoton ARM SoC tree. I don't understand why this is first in the series - it's clearly wrong.

Don't ask me...

So the EDAC driver itself is self-contained so I can review it and you can pick it up with the rest, if it looks ok.

That ok?

Yes. Please review and take the EDAC driver and the bindings (2/3, they already have my ack).

Marvin,
Please route the DTS (1/3) via Nuvoton SoC tree.

Best regards,
Krzysztof

maintainer
#6 lore raw

Re: [PATCH v18 1/3] ARM: dts: nuvoton: Add node for NPCM memory controller

Quoted 1 line · Krzysztof Kozlowski

Please route the DTS (1/3) via Nuvoton SoC tree.

Don't all three need to go together?

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#7 lore raw

Re: [PATCH v18 1/3] ARM: dts: nuvoton: Add node for NPCM memory controller

Quoted 4 lines · Borislav Petkov
Quoted 1 line · Krzysztof Kozlowski

Please route the DTS (1/3) via Nuvoton SoC tree.

Don't all three need to go together?

No, the DTS is always independent because it describes the hardware. Linux should work fine regardless of hardware description. Tying Linux to specific DTS is usually sign of an ABI break.

Best regards,
Krzysztof

maintainer
#8 lore raw

Re: [PATCH v18 1/3] ARM: dts: nuvoton: Add node for NPCM memory controller

Quoted 3 lines · Krzysztof Kozlowski

No, the DTS is always independent because it describes the hardware. Linux should work fine regardless of hardware description. Tying Linux to specific DTS is usually sign of an ABI break.

Ok, I see.

Patches 2 and 3 queued for 6.5.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
author
#9 lore raw

Re: [PATCH v18 1/3] ARM: dts: nuvoton: Add node for NPCM memory controller

Quoted 2 lines

Marvin,
Please route the DTS (1/3) via Nuvoton SoC tree.

OK, will route the DTS via Nuvoton SoC tree.
Thanks, Krzysztof!

Quoted 1 line

Patches 2 and 3 queued for 6.5.

Thanks, Boris!

author
#10 lore raw

PATCH v18 2/3 dt-bindings: memory-controllers: nuvoton: Add NPCM memory controller

In reply to Marvin Lin

Add dt-bindings document for Nuvoton NPCM memory controller.

---
 .../nuvoton,npcm-memory-controller.yaml       | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/nuvoton,npcm-memory-controller.yaml
Documentation/devicetree/bindings/memory-controllers/nuvoton,npcm-memory-controller.yaml new file +50 -0
new file mode 100644
index 000000000000..ac1a5a17749d
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/memory-controllers/nuvoton,npcm-memory-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Nuvoton NPCM Memory Controller
+
+maintainers:
+  - Marvin Lin <[email protected]>
+  - Stanley Chu <[email protected]>
+
+description: |
+  The Nuvoton BMC SoC supports DDR4 memory with or without ECC (error correction
+  check).
+
+  The memory controller supports single bit error correction, double bit error
+  detection (in-line ECC in which a section (1/8th) of the memory device used to
+  store data is used for ECC storage).
+
+  Note, the bootloader must configure ECC mode for the memory controller.
+
+properties:
+  compatible:
+    enum:
+      - nuvoton,npcm750-memory-controller
+      - nuvoton,npcm845-memory-controller
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    mc: memory-controller@f0824000 {
+        compatible = "nuvoton,npcm750-memory-controller";
+        reg = <0xf0824000 0x1000>;
+        interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
+    };
Signature · 1 line
2.34.1
Acked-by on v18 2/3
#11 lore raw

Re: [PATCH v18 2/3] dt-bindings: memory-controllers: nuvoton: Add NPCM memory controller

Quoted 8 lines · Marvin Lin

Add dt-bindings document for Nuvoton NPCM memory controller.

---
 .../nuvoton,npcm-memory-controller.yaml       | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/nuvoton,npcm-memory-controller.yaml

I assume this can go with the driver via EDAC tree. Otherwise let me know if I should take it via memory-controllers:

Best regards,
Krzysztof

author
#12 lore raw

PATCH v18 3/3 EDAC/npcm: Add NPCM memory controller driver

In reply to Marvin Lin

Add driver for memory controller present on Nuvoton NPCM SoCs. The memory controller supports single bit error correction and double bit error detection.

---
 MAINTAINERS              |   8 +
 drivers/edac/Kconfig     |  11 +
 drivers/edac/Makefile    |   1 +
 drivers/edac/npcm_edac.c | 543 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 563 insertions(+)
 create mode 100644 drivers/edac/npcm_edac.c
MAINTAINERS +8 -0
index 7f86d02cb427..7b41be30e6b3 100644
@@ -7557,6 +7557,14 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/edac/mpc85xx_edac.[ch]
 
+EDAC-NPCM
+M:	Marvin Lin <[email protected]>
+M:	Stanley Chu <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/memory-controllers/nuvoton,npcm-memory-controller.yaml
+F:	drivers/edac/npcm_edac.c
+
 EDAC-PASEMI
 M:	Egor Martovetsky <[email protected]>
 L:	[email protected]
drivers/edac/Kconfig +11 -0
index 4cfdefbd744d..aa575f5b3125 100644
@@ -542,4 +542,15 @@ config EDAC_DMC520
 	  Support for error detection and correction on the
 	  SoCs with ARM DMC-520 DRAM controller.
 
+config EDAC_NPCM
+	tristate "Nuvoton NPCM DDR Memory Controller"
+	depends on (ARCH_NPCM || COMPILE_TEST)
+	help
+	  Support for error detection and correction on the Nuvoton NPCM DDR
+	  memory controller.
+
+	  The memory controller supports single bit error correction, double bit
+	  error detection (in-line ECC in which a section 1/8th of the memory
+	  device used to store data is used for ECC storage).
+
 endif # EDAC
drivers/edac/Makefile +1 -0
index 2d1641a27a28..db3c59d3ad84 100644
@@ -84,3 +84,4 @@ obj-$(CONFIG_EDAC_QCOM)			+= qcom_edac.o
 obj-$(CONFIG_EDAC_ASPEED)		+= aspeed_edac.o
 obj-$(CONFIG_EDAC_BLUEFIELD)		+= bluefield_edac.o
 obj-$(CONFIG_EDAC_DMC520)		+= dmc520_edac.o
+obj-$(CONFIG_EDAC_NPCM)			+= npcm_edac.o
drivers/edac/npcm_edac.c new file +543 -0

543 lines not on this page · raw message

Signature · 1 line
2.34.1