Skip to contentSkip to conversation

Addition of Altera EDAC support

PATCH In review [email protected] 7 participants 19 messages Aug 11, 2014 – Sep 4, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v10 cover Addition of Altera EDAC support

From: Thor Thayer <[email protected]>

The Altera SDRAM controller EDAC support is added in this patch series. The SDRAM controller shares its registers with the EDAC, and 2 upcoming drivers (fpga bridge and power control). This series of patches started using the syscon driver to share the SDRAM controller registers but met with resistance.

In the last series of patches, this was changed to using an MFD for the SDRAM but the suggested changes began to look more like the syscon interface. As a result, I'm resubmitting this with syscon and addressing some of the objections to the use of syscon.

Thor Thayer (2):
edac: altera: Add Altera SDRAM EDAC support.
arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   15 +
 MAINTAINERS                                        |    5 +
 arch/arm/boot/dts/socfpga.dtsi                     |   11 +
 drivers/edac/Kconfig                               |    9 +
 drivers/edac/Makefile                              |    2 +
 drivers/edac/altera_edac.c                         |  410 ++++++++++++++++++++
 6 files changed, 452 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
 create mode 100644 drivers/edac/altera_edac.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v10 1/2 edac: altera: Add Altera SDRAM EDAC support.

From: Thor Thayer <[email protected]>

This patch adds support for the CycloneV and ArriaV SDRAM controllers. Correction and reporting of SBEs, Panic on DBEs.

---
v2: Use the SDRAM controller registers to calculate memory size
instead of the Device Tree. Update To & Cc list. Add maintainer information.

v3: EDAC driver cleanup based on comments from Mailing list.

v4: Panic on DBE. Add macro around inject-error reads to prevent
them from being optimized out. Remove of_match_ptr since this will always use Device Tree.

v5: Addition of printk to trigger function to ensure read vars
are not optimized out.

v6: Changes to split out shared SDRAM controller reg (offset 0x00)
as a syscon device and allocate ECC specific SDRAM registers to EDAC.

v7: No changes. Bump for consistency.

v8: Alphabetize headers.

v9: Changes to support a MFD SDRAM controller with nested EDAC.

v10: Revert to version 5 (syscon) and fix errors found in v5.

---
 MAINTAINERS                |    5 +
 drivers/edac/Kconfig       |    9 +
 drivers/edac/Makefile      |    2 +
 drivers/edac/altera_edac.c |  410 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 426 insertions(+)
 create mode 100644 drivers/edac/altera_edac.c
MAINTAINERS +5 -0
index 86efa7e..2d0bf75 100644
@@ -1340,6 +1340,11 @@ M:	Dinh Nguyen <[email protected]>
 S:	Maintained
 F:	drivers/clk/socfpga/
 
+ARM/SOCFPGA EDAC SUPPORT
+M:	Thor Thayer <[email protected]>
+S:	Maintained
+F:	drivers/edac/altera_edac.
+
 ARM/STI ARCHITECTURE
 M:	Srinivas Kandagatla <[email protected]>
 M:	Maxime Coquelin <[email protected]>
drivers/edac/Kconfig +9 -0
index 878f090..4f4d379 100644
@@ -368,4 +368,13 @@ config EDAC_OCTEON_PCI
 	  Support for error detection and correction on the
 	  Cavium Octeon family of SOCs.
 
+config EDAC_ALTERA_MC
+	bool "Altera SDRAM Memory Controller EDAC"
+	depends on EDAC_MM_EDAC && ARCH_SOCFPGA
+	help
+	  Support for error detection and correction on the
+	  Altera SDRAM memory controller. Note that the
+	  preloader must initialize the SDRAM before loading
+	  the kernel.
+
 endif # EDAC
drivers/edac/Makefile +2 -0
index 4154ed6..70845c4 100644
@@ -64,3 +64,5 @@ obj-$(CONFIG_EDAC_OCTEON_PC)		+= octeon_edac-pc.o
 obj-$(CONFIG_EDAC_OCTEON_L2C)		+= octeon_edac-l2c.o
 obj-$(CONFIG_EDAC_OCTEON_LMC)		+= octeon_edac-lmc.o
 obj-$(CONFIG_EDAC_OCTEON_PCI)		+= octeon_edac-pci.o
+
+obj-$(CONFIG_EDAC_ALTERA_MC)		+= altera_edac.o
drivers/edac/altera_edac.c new file +410 -0

410 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#6 lore raw

PATCH v10 2/2 arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

In reply to [email protected]

From: Thor Thayer <[email protected]>

Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC project.

---
v2: Changes to SoC SDRAM EDAC code.

v3: Implement code suggestions for SDRAM EDAC code.

v4: Remove syscon from SDRAM controller bindings.

v5: No Change, bump version for consistency.

v6: Only map the ctrlcfg register as syscon.

v7: No change. Bump for consistency.

v8: No change. Bump for consistency.

v9: Changes to support a MFD SDRAM controller with nested EDAC.

v10: Revert to using syscon based on feedback.

---
 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   15 +++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |   11 +++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt new file +15 -0
new file mode 100644
index 0000000..d0ce01d
@@ -0,0 +1,15 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+The EDAC accesses a range of registers in the SDRAM controller.
+
+Required properties:
+- compatible : should contain "altr,sdram-edac";
+- altr,sdr-syscon : phandle of the sdr module
+- interrupts : Should contain the SDRAM ECC IRQ in the
+	appropriate format for the IRQ controller.
+
+Example:
+	sdramedac {
+		compatible = "altr,sdram-edac";
+		altr,sdr-syscon = <&sdr>;
+		interrupts = <0 39 4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +11 -0
index 4676f25..45b361e 100644
@@ -603,6 +603,17 @@
 			};
 		};
 
+		sdr: sdr@ffc25000 {
+			compatible = "syscon";
+			reg = <0xffc25000 0x1000>;
+		};
+
+		sdramedac {
+			compatible = "altr,sdram-edac";
+			altr,sdr-syscon = <&sdr>;
+			interrupts = <0 39 4>;
+		};
+
 		L2: l2-cache@fffef000 {
 			compatible = "arm,pl310-cache";
 			reg = <0xfffef000 0x1000>;
Signature · 1 line
1.7.9.5
Acked-by on v10 1/2
#2 lore raw

Re: [PATCHv10 1/2] edac: altera: Add Altera SDRAM EDAC support.

In reply to [email protected]
Quoted 6 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

This patch adds support for the CycloneV and ArriaV SDRAM controllers. Correction and reporting of SBEs, Panic on DBEs.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Acked-by on v10 2/2
#7 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

In reply to [email protected]
Quoted 5 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC project.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#13 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

In reply to [email protected]

Hi!

Quoted 62 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC project.

---
v2: Changes to SoC SDRAM EDAC code.

v3: Implement code suggestions for SDRAM EDAC code.

v4: Remove syscon from SDRAM controller bindings.

v5: No Change, bump version for consistency.

v6: Only map the ctrlcfg register as syscon.

v7: No change. Bump for consistency.

v8: No change. Bump for consistency.

v9: Changes to support a MFD SDRAM controller with nested EDAC.

v10: Revert to using syscon based on feedback.

---
 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   15 +++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |   11 +++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt new file +15 -0
new file mode 100644
index 0000000..d0ce01d
@@ -0,0 +1,15 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+The EDAC accesses a range of registers in the SDRAM controller.
+
+Required properties:
+- compatible : should contain "altr,sdram-edac";
+- altr,sdr-syscon : phandle of the sdr module
+- interrupts : Should contain the SDRAM ECC IRQ in the
+	appropriate format for the IRQ controller.
+
+Example:
+	sdramedac {
+		compatible = "altr,sdram-edac";
+		altr,sdr-syscon = <&sdr>;
+		interrupts = <0 39 4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +4 -0
index 4676f25..45b361e 100644
@@ -603,6 +603,17 @@
 			};
 		};
 
+		sdr: sdr at ffc25000 {
+			compatible = "syscon";
+			reg = <0xffc25000 0x1000>;
+		};

arch/arm/boot/dts/socfpga.dtsi line 619

Quoted 10 lines
arch/arm/boot/dts/socfpga.dtsi +7 -0
+
+		sdramedac {
+			compatible = "altr,sdram-edac";
+			altr,sdr-syscon = <&sdr>;
+			interrupts = <0 39 4>;
+		};
+
 		L2: l2-cache at fffef000 {
 			compatible = "arm,pl310-cache";
 			reg = <0xfffef000 0x1000>;

Sorry, but I personally still don't like this approach.

If we do it like this however, shouldn't the different regions of the SDR (EDAC, FPGAPORTRST, ...) at least be child nodes of the syscon? That seems to match the syscon binding and describes the actual hardware better IMHO.
Oh, and "reg = <...>" for the sdram-edac, maybe ?
How would I know where the start address of the EDAC is, if I would use this DT on another OS where I don't have the same driver?

Regards,
Steffen

Signature · 4 lines
Pengutronix e.K.                           | Steffen Trumtrar            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#14 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

Quoted 2 lines · Steffen Trumtrar

Hi!

Hello

Thanks for the feedback...

Quoted 61 lines
Quoted 58 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC project.

---
v2: Changes to SoC SDRAM EDAC code.

v3: Implement code suggestions for SDRAM EDAC code.

v4: Remove syscon from SDRAM controller bindings.

v5: No Change, bump version for consistency.

v6: Only map the ctrlcfg register as syscon.

v7: No change. Bump for consistency.

v8: No change. Bump for consistency.

v9: Changes to support a MFD SDRAM controller with nested EDAC.

v10: Revert to using syscon based on feedback.

---
 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   15 +++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |   11 +++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt new file +15 -0
new file mode 100644
index 0000000..d0ce01d
@@ -0,0 +1,15 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+The EDAC accesses a range of registers in the SDRAM controller.
+
+Required properties:
+- compatible : should contain "altr,sdram-edac";
+- altr,sdr-syscon : phandle of the sdr module
+- interrupts : Should contain the SDRAM ECC IRQ in the
+	appropriate format for the IRQ controller.
+
+Example:
+	sdramedac {
+		compatible = "altr,sdram-edac";
+		altr,sdr-syscon = <&sdr>;
+		interrupts = <0 39 4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +0 -0
index 4676f25..45b361e 100644
@@ -603,6 +603,17 @@
 			};
 		};
 
Quoted 16 lines
Quoted 4 lines
arch/arm/boot/dts/socfpga.dtsi +4 -0
+		sdr: sdr at ffc25000 {
+			compatible = "syscon";
+			reg = <0xffc25000 0x1000>;
+		};

arch/arm/boot/dts/socfpga.dtsi line 619

Quoted 10 lines
arch/arm/boot/dts/socfpga.dtsi +7 -0
+
+		sdramedac {
+			compatible = "altr,sdram-edac";
+			altr,sdr-syscon = <&sdr>;
+			interrupts = <0 39 4>;
+		};
+
 		L2: l2-cache at fffef000 {
 			compatible = "arm,pl310-cache";
 			reg = <0xfffef000 0x1000>;

Sorry, but I personally still don't like this approach.

This is a normal use of syscon. Syscon is great for this case where multiple drivers need access to an ip block's register range but there is otherwise no need to write a MFD from scratch to allow that. I think that's the purpose of syscon in the first place.

Quoted 5 lines

If we do it like this however, shouldn't the different regions of the SDR (EDAC, FPGAPORTRST, ...) at least be child nodes of the syscon? That seems to match the syscon binding and describes the actual hardware better IMHO.

I like that; it would be clean and clear, but I don't think syscon is written such that that would actually work. I haven't seen anybody else do it that way.

Quoted 1 line

Oh, and "reg = <...>" for the sdram-edac, maybe ?

How would that work? Syscon is already mapping the whole register range for the sdr block. Are you proposing a device tree binding that this Linux driver would ignore, but some other driver in some other OS might find useful in the future? I'd rather not put duplicate information in two places, too easy for it to get out of sync.

Quoted 2 lines

How would I know where the start address of the EDAC is, if I would use this DT on another OS where I don't have the same driver?

The start address of the EDAC is an offset into the range mapped by syscon here. The driver knows what the register offsets are.

If we are talking about this device tree being used by some other OS that is not aware of syscon, then that OS won't know what's going on and some modification of the DT will be needed. I have been advised that u-boot will need a significantly different DT, though I don't know what the issues are there.

Quoted 15 lines

Regards,
Steffen

Signature · 9 lines
Pengutronix e.K.                           | Steffen Trumtrar            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#15 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

Quoted 88 lines · atull
Quoted 1 line · Steffen Trumtrar

Hi!

Hello

Thanks for the feedback...

Quoted 60 lines
Quoted 58 lines · [email protected] writes:

From: Thor Thayer <[email protected]>

Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC project.

---
v2: Changes to SoC SDRAM EDAC code.

v3: Implement code suggestions for SDRAM EDAC code.

v4: Remove syscon from SDRAM controller bindings.

v5: No Change, bump version for consistency.

v6: Only map the ctrlcfg register as syscon.

v7: No change. Bump for consistency.

v8: No change. Bump for consistency.

v9: Changes to support a MFD SDRAM controller with nested EDAC.

v10: Revert to using syscon based on feedback.

---
  .../bindings/arm/altera/socfpga-sdram-edac.txt     |   15 +++++++++++++++
  arch/arm/boot/dts/socfpga.dtsi                     |   11 +++++++++++
  2 files changed, 26 insertions(+)

create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt

Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt new file +15 -0
new file mode 100644
index 0000000..d0ce01d
@@ -0,0 +1,15 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+The EDAC accesses a range of registers in the SDRAM controller.
+
+Required properties:
+- compatible : should contain "altr,sdram-edac";
+- altr,sdr-syscon : phandle of the sdr module
+- interrupts : Should contain the SDRAM ECC IRQ in the
+	appropriate format for the IRQ controller.
+
+Example:
+	sdramedac {
+		compatible = "altr,sdram-edac";
+		altr,sdr-syscon = <&sdr>;
+		interrupts = <0 39 4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +0 -0
index 4676f25..45b361e 100644
@@ -603,6 +603,17 @@
  			};
  		};
 
Quoted 15 lines
Quoted 4 lines
arch/arm/boot/dts/socfpga.dtsi +4 -0
+		sdr: sdr@ffc25000 {
+			compatible = "syscon";
+			reg = <0xffc25000 0x1000>;
+		};

arch/arm/boot/dts/socfpga.dtsi line 619

Quoted 10 lines
arch/arm/boot/dts/socfpga.dtsi +7 -0
+
+		sdramedac {
+			compatible = "altr,sdram-edac";
+			altr,sdr-syscon = <&sdr>;
+			interrupts = <0 39 4>;
+		};
+
  		L2: l2-cache@fffef000 {
  			compatible = "arm,pl310-cache";
  			reg = <0xfffef000 0x1000>;

Sorry, but I personally still don't like this approach.

This is a normal use of syscon. Syscon is great for this case where multiple drivers need access to an ip block's register range but there is otherwise no need to write a MFD from scratch to allow that. I think that's the purpose of syscon in the first place.

Quoted 7 lines
Quoted 4 lines

If we do it like this however, shouldn't the different regions of the SDR (EDAC, FPGAPORTRST, ...) at least be child nodes of the syscon? That seems to match the syscon binding and describes the actual hardware better IMHO.

I like that; it would be clean and clear, but I don't think syscon is written such that that would actually work. I haven't seen anybody else do it that way.

Hi Steffen!

Building on Alan's points, I don't see the reference to the child nodes in the syscon.txt binding documentation - can you point out what I'm missing?

I based this patch on other examples of syscon, and there aren't child nodes (exynos5250.dtsi, omap3.dtsi, etc). According to my understanding of the device tree parsing, the parent needs to register child nodes. Since syscon is the parent and doesn't register the child nodes, they won't be automatically probed. The other syscon implementations are at the same level as the syscon and use a phandle to the syscon (for instance the omap3.dtsi).

Thanks for reviewing!

Thor

Quoted 32 lines
Quoted 1 line

Oh, and "reg = <...>" for the sdram-edac, maybe ?

How would that work? Syscon is already mapping the whole register range for the sdr block. Are you proposing a device tree binding that this Linux driver would ignore, but some other driver in some other OS might find useful in the future? I'd rather not put duplicate information in two places, too easy for it to get out of sync.

Quoted 2 lines

How would I know where the start address of the EDAC is, if I would use this DT on another OS where I don't have the same driver?

The start address of the EDAC is an offset into the range mapped by syscon here. The driver knows what the register offsets are.

If we are talking about this device tree being used by some other OS that is not aware of syscon, then that OS won't know what's going on and some modification of the DT will be needed. I have been advised that u-boot will need a significantly different DT, though I don't know what the issues are there.

Quoted 14 lines

Regards,
Steffen

Signature · 9 lines
Pengutronix e.K.                           | Steffen Trumtrar            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#17 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

In reply to atull
Quoted 87 lines · atull
Quoted 2 lines · Steffen Trumtrar

Hi!

Hello

Thanks for the feedback...

Quoted 61 lines
Quoted 58 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC project.

---
v2: Changes to SoC SDRAM EDAC code.

v3: Implement code suggestions for SDRAM EDAC code.

v4: Remove syscon from SDRAM controller bindings.

v5: No Change, bump version for consistency.

v6: Only map the ctrlcfg register as syscon.

v7: No change. Bump for consistency.

v8: No change. Bump for consistency.

v9: Changes to support a MFD SDRAM controller with nested EDAC.

v10: Revert to using syscon based on feedback.

---
 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   15 +++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |   11 +++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt new file +15 -0
new file mode 100644
index 0000000..d0ce01d
@@ -0,0 +1,15 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+The EDAC accesses a range of registers in the SDRAM controller.
+
+Required properties:
+- compatible : should contain "altr,sdram-edac";
+- altr,sdr-syscon : phandle of the sdr module
+- interrupts : Should contain the SDRAM ECC IRQ in the
+	appropriate format for the IRQ controller.
+
+Example:
+	sdramedac {
+		compatible = "altr,sdram-edac";
+		altr,sdr-syscon = <&sdr>;
+		interrupts = <0 39 4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +0 -0
index 4676f25..45b361e 100644
@@ -603,6 +603,17 @@
 			};
 		};
 
Quoted 16 lines
Quoted 4 lines
arch/arm/boot/dts/socfpga.dtsi +4 -0
+		sdr: sdr at ffc25000 {
+			compatible = "syscon";
+			reg = <0xffc25000 0x1000>;
+		};

arch/arm/boot/dts/socfpga.dtsi line 619

Quoted 10 lines
arch/arm/boot/dts/socfpga.dtsi +7 -0
+
+		sdramedac {
+			compatible = "altr,sdram-edac";
+			altr,sdr-syscon = <&sdr>;
+			interrupts = <0 39 4>;
+		};
+
 		L2: l2-cache at fffef000 {
 			compatible = "arm,pl310-cache";
 			reg = <0xfffef000 0x1000>;

Sorry, but I personally still don't like this approach.

Quoted 6 lines

This is a normal use of syscon. Syscon is great for this case where multiple drivers need access to an ip block's register range but there is otherwise no need to write a MFD from scratch to allow that. I think that's the purpose of syscon in the first place.

I talked with a co-worker about this. And we came to the conclusion, that syscon is wrong and has issues, but we sadly had no better idea.

I'd rather have the whole range be a syscon than some bad MFD implementation.

Quoted 9 lines
Quoted 5 lines

If we do it like this however, shouldn't the different regions of the SDR (EDAC, FPGAPORTRST, ...) at least be child nodes of the syscon? That seems to match the syscon binding and describes the actual hardware better IMHO.

I like that; it would be clean and clear, but I don't think syscon is written such that that would actually work. I haven't seen anybody else do it that way.

Don't actually know. The documentation says this is possible.

Quoted 9 lines
Quoted 2 lines

Oh, and "reg = <...>" for the sdram-edac, maybe ?

How would that work? Syscon is already mapping the whole register range for the sdr block. Are you proposing a device tree binding that this Linux driver would ignore, but some other driver in some other OS might find useful in the future? I'd rather not put duplicate information in two places, too easy for it to get out of sync.

Yes. I think you are actually right. This won't work.

Quoted 12 lines
Quoted 2 lines

How would I know where the start address of the EDAC is, if I would use this DT on another OS where I don't have the same driver?

The start address of the EDAC is an offset into the range mapped by syscon here. The driver knows what the register offsets are.

If we are talking about this device tree being used by some other OS that is not aware of syscon, then that OS won't know what's going on and some modification of the DT will be needed. I have been advised that u-boot will need a significantly different DT, though I don't know what the issues are there.

That is one issue I personally have with syscon. We are always told to only describe the hardware and don't mix Linux specifics in the bindings. How is syscon not a Linux specific thing? Maybe I see this wrong though.

Then u-boot has a problem that should be fixed.
For barebox we try to stay as close to the "official" DT bindings as possible.

Regards,
Steffen

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#16 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

In reply to Thor Thayer
Quoted 14 lines · Thor Thayer

Hi Steffen!

Building on Alan's points, I don't see the reference to the child nodes in the syscon.txt binding documentation - can you point out what I'm missing?

I based this patch on other examples of syscon, and there aren't child nodes (exynos5250.dtsi, omap3.dtsi, etc). According to my understanding of the device tree parsing, the parent needs to register child nodes. Since syscon is the parent and doesn't register the child nodes, they won't be automatically probed. The other syscon implementations are at the same level as the syscon and use a phandle to the syscon (for instance the omap3.dtsi).

Quoted 3 lines

Thanks for reviewing!

Thor

Hm, I looked in one of my many directories with some version of the kernel tree checked out, but ... you are right.
I can't find where I read that. Seems like I got confused somewhere... There is now version of syscon.txt that mentions anything about childs.

Should have drank my morning coffee first.

Regards,
Steffen

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#8 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

In reply to Pavel Machek
Quoted 9 lines · Pavel Machek
Quoted 5 lines · On Mon 2014-08-11 10:18:13, [email protected] wrote:

From: Thor Thayer <[email protected]>

Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC project.

Hi All,

Any further comments or suggestions on this patch series? Thanks for the review, Pavel!

Thor

#3 lore raw

Re: [PATCHv10 1/2] edac: altera: Add Altera SDRAM EDAC support.

In reply to Pavel Machek
Quoted 9 lines · Pavel Machek
Quoted 6 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

This patch adds support for the CycloneV and ArriaV SDRAM controllers. Correction and reporting of SBEs, Panic on DBEs.

Hi All,

Any further comments or suggestions on this patch series? Thanks for reviewing, Pavel!

Thor

#9 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

In reply to Thor Thayer
Quoted 8 lines · Thor Thayer
Quoted 6 lines · Pavel Machek
Quoted 5 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC project.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Hi All,

Any further comments or suggestions on this patch series? Thanks for the review, Pavel!

If Boris is okay with driver part and everyone else is OK with the DTS portion, then I can apply the DTS patch to my tree, and Boris take the driver patch into his tree?

Thanks,
Dinh

#10 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

Quoted 13 lines · Dinh Nguyen
Quoted 12 lines · Thor Thayer
Quoted 10 lines · Pavel Machek
Quoted 6 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC project.

Quoted 9 lines
Quoted 4 lines

Hi All,

Any further comments or suggestions on this patch series? Thanks for the review, Pavel!

If Boris is okay with driver part and everyone else is OK with the DTS portion, then I can apply the DTS patch to my tree, and Boris take the driver patch into his tree?

Actually, I think I need to get an Ack-by from a DTS maintainer before I can apply
this as it is introducing a new binding.

Sorry for the noise.

Dinh

maintainer
#11 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

In reply to Dinh Nguyen
Quoted 3 lines · Dinh Nguyen

If Boris is okay with driver part and everyone else is OK with the DTS portion, then I can apply the DTS patch to my tree, and Boris take the driver patch into his tree?

Actually, it would be easier for everyone involved if those patches go together due to their dependency. So if you want me to take a look at the EDAC parts again and give you my ack so that you can pick them all up together and they go through your tree, let me know.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#12 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

Hi Boris

Quoted 10 lines · Borislav Petkov
Quoted 3 lines · Dinh Nguyen

If Boris is okay with driver part and everyone else is OK with the DTS portion, then I can apply the DTS patch to my tree, and Boris take the driver patch into his tree?

Actually, it would be easier for everyone involved if those patches go together due to their dependency. So if you want me to take a look at the EDAC parts again and give you my ack so that you can pick them all up together and they go through your tree, let me know.

That would be great!

Thanks,
Dinh

maintainer Acked-by on v10 1/2
#4 lore raw

Re: [PATCHv10 1/2] edac: altera: Add Altera SDRAM EDAC support.

In reply to [email protected]
Quoted 24 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

This patch adds support for the CycloneV and ArriaV SDRAM controllers. Correction and reporting of SBEs, Panic on DBEs.

---
v2: Use the SDRAM controller registers to calculate memory size
instead of the Device Tree. Update To & Cc list. Add maintainer information.

v3: EDAC driver cleanup based on comments from Mailing list.

v4: Panic on DBE. Add macro around inject-error reads to prevent
them from being optimized out. Remove of_match_ptr since this will always use Device Tree.

v5: Addition of printk to trigger function to ensure read vars
are not optimized out.

v6: Changes to split out shared SDRAM controller reg (offset 0x00)
as a syscon device and allocate ECC specific SDRAM registers to EDAC.

Quoted 7 lines

v7: No changes. Bump for consistency.

v8: Alphabetize headers.

v9: Changes to support a MFD SDRAM controller with nested EDAC.

v10: Revert to version 5 (syscon) and fix errors found in v5.

EDAC bits look ok to me,

Dinh, please convert that version information above to a nice commit message and add it when applying as it is very useful for future reference.

Thanks.

Signature · 3 lines
Regards/Gruss,
    Boris.
--
#18 lore raw

Re: [PATCHv10 2/2] arm: dts: Add Altera SDRAM EDAC bindings & devicetree entries.

In reply to [email protected]

Hi DTS maintainers,

If possible, can I please get an Acked-by for this patch?

Many thanks...

Dinh

Quoted 73 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

Add the Altera SDRAM EDAC bindings and device tree changes to the Altera SoC project.

---
v2: Changes to SoC SDRAM EDAC code.

v3: Implement code suggestions for SDRAM EDAC code.

v4: Remove syscon from SDRAM controller bindings.

v5: No Change, bump version for consistency.

v6: Only map the ctrlcfg register as syscon.

v7: No change. Bump for consistency.

v8: No change. Bump for consistency.

v9: Changes to support a MFD SDRAM controller with nested EDAC.

v10: Revert to using syscon based on feedback.

---
 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   15 +++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |   11 +++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt new file +15 -0
new file mode 100644
index 0000000..d0ce01d
@@ -0,0 +1,15 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+The EDAC accesses a range of registers in the SDRAM controller.
+
+Required properties:
+- compatible : should contain "altr,sdram-edac";
+- altr,sdr-syscon : phandle of the sdr module
+- interrupts : Should contain the SDRAM ECC IRQ in the
+	appropriate format for the IRQ controller.
+
+Example:
+	sdramedac {
+		compatible = "altr,sdram-edac";
+		altr,sdr-syscon = <&sdr>;
+		interrupts = <0 39 4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +11 -0
index 4676f25..45b361e 100644
@@ -603,6 +603,17 @@
 			};
 		};
 
+		sdr: sdr at ffc25000 {
+			compatible = "syscon";
+			reg = <0xffc25000 0x1000>;
+		};
+
+		sdramedac {
+			compatible = "altr,sdram-edac";
+			altr,sdr-syscon = <&sdr>;
+			interrupts = <0 39 4>;
+		};
+
 		L2: l2-cache at fffef000 {
 			compatible = "arm,pl310-cache";
 			reg = <0xfffef000 0x1000>;
#5 lore raw

Re: [PATCHv10 1/2] edac: altera: Add Altera SDRAM EDAC support.

In reply to Borislav Petkov
Quoted 33 lines · Borislav Petkov
Quoted 24 lines · tthayer at opensource.altera.com

From: Thor Thayer <[email protected]>

This patch adds support for the CycloneV and ArriaV SDRAM controllers. Correction and reporting of SBEs, Panic on DBEs.

---
v2: Use the SDRAM controller registers to calculate memory size
instead of the Device Tree. Update To & Cc list. Add maintainer information.

v3: EDAC driver cleanup based on comments from Mailing list.

v4: Panic on DBE. Add macro around inject-error reads to prevent
them from being optimized out. Remove of_match_ptr since this will always use Device Tree.

v5: Addition of printk to trigger function to ensure read vars
are not optimized out.

v6: Changes to split out shared SDRAM controller reg (offset 0x00)
as a syscon device and allocate ECC specific SDRAM registers to EDAC.

Quoted 7 lines

v7: No changes. Bump for consistency.

v8: Alphabetize headers.

v9: Changes to support a MFD SDRAM controller with nested EDAC.

v10: Revert to version 5 (syscon) and fix errors found in v5.

Quoted 8 lines

EDAC bits look ok to me,

Dinh, please convert that version information above to a nice commit message and add it when applying as it is very useful for future reference.

Thank Boris. I had to fix up the patch a bit by making EDAC_ALTERA_MC a tristate instead of bool to prevent a build error with allmodconfig.

Dinh

Quoted 2 lines

Thanks.