Skip to contentSkip to conversation

dts: socfpga: Add bindings for Altera SoC SDRAM EDAC

PATCH Superseded [email protected] 6 participants 25 messages Apr 7, 2014 – Jul 10, 2014 1 message not in the archive

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/3 dts: socfpga: Add bindings for Altera SoC SDRAM controller

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

To: Rob Herring <[email protected]>
To: Pawel Moll <[email protected]>
To: Mark Rutland <[email protected]>
To: Ian Campbell <[email protected]>
To: Kumar Gala <[email protected]>
To: Rob Landley <[email protected]>
To: Russell King <[email protected]>
To: Dinh Nguyen <[email protected]>
Cc: devicetree at vger.kernel.org
Cc: linux-doc at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org

---
 .../bindings/arm/altera/socfpga-sdram.txt          |   14 ++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    5 +++++
 2 files changed, 19 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +14 -0
new file mode 100644
index 0000000..525cb76
@@ -0,0 +1,14 @@
+Altera SOCFPGA SDRAM Controller
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+		bridge driver, EDAC driver and other devices that share the
+		registers.
+- reg : Should contain 1 register ranges(address and length)
+
+Example:
+	sdrctl at ffc25000 {
+		compatible = "altr,sdr-ctl", "syscon";
+		reg = <0xffc25000 0x1000>;
+	};
arch/arm/boot/dts/socfpga.dtsi +5 -0
index df43702..6ce912e 100644
@@ -676,6 +676,11 @@
 			clocks = <&l4_sp_clk>;
 		};
 
+		sdrctl at ffc25000 {
+			compatible = "altr,sdr-ctl", "syscon";
+			reg = <0xffc25000 0x1000>;
+		};
+
 		rstmgr at ffd05000 {
 			compatible = "altr,rst-mgr";
 			reg = <0xffd05000 0x1000>;
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/3] dts: socfpga: Add bindings for Altera SoC SDRAM controller

Quoted 30 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

To: Rob Herring <[email protected]>
To: Pawel Moll <[email protected]>
To: Mark Rutland <[email protected]>
To: Ian Campbell <[email protected]>
To: Kumar Gala <[email protected]>
To: Rob Landley <[email protected]>
To: Russell King <[email protected]>
To: Dinh Nguyen <[email protected]>
Cc: devicetree at vger.kernel.org
Cc: linux-doc at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org

---
 .../bindings/arm/altera/socfpga-sdram.txt          |   14 ++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    5 +++++
 2 files changed, 19 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +0 -0
new file mode 100644
index 0000000..525cb76

Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +7 -0
@@ -0,0 +1,14 @@
+Altera SOCFPGA SDRAM Controller
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+		bridge driver, EDAC driver and other devices that share the
+		registers.

Is the SDRAM controller really a bag of bits that necessitates the use of syscon? Or are the "other devices" just sub-components of the SDRAM controller?

If they are, just describe the SDRAM controller and related interrupts as a single node, and only use the EDAC portion in the Linux driver.

Cheers,
Mark.

Quoted 27 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +7 -0
+- reg : Should contain 1 register ranges(address and length)
+
+Example:
+	sdrctl at ffc25000 {
+		compatible = "altr,sdr-ctl", "syscon";
+		reg = <0xffc25000 0x1000>;
+	};
arch/arm/boot/dts/socfpga.dtsi +5 -0
index df43702..6ce912e 100644
@@ -676,6 +676,11 @@
 			clocks = <&l4_sp_clk>;
 		};
 
+		sdrctl at ffc25000 {
+			compatible = "altr,sdr-ctl", "syscon";
+			reg = <0xffc25000 0x1000>;
+		};
+
 		rstmgr at ffd05000 {
 			compatible = "altr,rst-mgr";
 			reg = <0xffd05000 0x1000>;
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH 1/3] dts: socfpga: Add bindings for Altera SoC SDRAM controller

In reply to [email protected]

Hi!

Quoted 30 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

To: Rob Herring <[email protected]>
To: Pawel Moll <[email protected]>
To: Mark Rutland <[email protected]>
To: Ian Campbell <[email protected]>
To: Kumar Gala <[email protected]>
To: Rob Landley <[email protected]>
To: Russell King <[email protected]>
To: Dinh Nguyen <[email protected]>
Cc: devicetree at vger.kernel.org
Cc: linux-doc at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org

---
 .../bindings/arm/altera/socfpga-sdram.txt          |   14 ++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    5 +++++
 2 files changed, 19 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +0 -0
new file mode 100644
index 0000000..525cb76

Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt line 8

Quoted 8 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +8 -0
@@ -0,0 +1,14 @@
+Altera SOCFPGA SDRAM Controller
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+		bridge driver, EDAC driver and other devices that share the
+		registers.
+- reg : Should contain 1 register ranges(address and length)

I haven't really thought this through, but why would the FPGA bridge driver access the sdram controller? For releasing the resets in fpgaportrst ? Or is there more?
Wouldn't it be more appropriate to represent those bits as a reset-controller to some hypothetical IP core driver?
Then you could have something like

	hps2fpga at c0000000 {
		ipcore at 0 {
			resets = <&sdr 1>;
			reset-names = "foo";
			resets = <&rst 96>;
			reset-names = "bar";
			(...)
		};

		ipcore at 1000 {
			resets = <&rst 96>;
			reset-names = "baz";
			(...)
		};
	};

And you would always have the correct bridges released out of reset for your IP core. Does the FPGA bridge driver do more? I think that is basically it. Where we maybe could run into problems though is the early_init stuff.

I think syscon is nice for some things, but we should try not to overuse it.

Regards,
Steffen

Quoted 21 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +5 -0
+Example:
+	sdrctl at ffc25000 {
+		compatible = "altr,sdr-ctl", "syscon";
+		reg = <0xffc25000 0x1000>;
+	};
arch/arm/boot/dts/socfpga.dtsi +5 -0
index df43702..6ce912e 100644
@@ -676,6 +676,11 @@
 			clocks = <&l4_sp_clk>;
 		};
 
+		sdrctl at ffc25000 {
+			compatible = "altr,sdr-ctl", "syscon";
+			reg = <0xffc25000 0x1000>;
+		};
+
 		rstmgr at ffd05000 {
 			compatible = "altr,rst-mgr";
 			reg = <0xffd05000 0x1000>;
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 |
#4 lore raw

Re: [PATCH 1/3] dts: socfpga: Add bindings for Altera SoC SDRAM controller

Quoted 8 lines · Steffen Trumtrar

Hi!

Quoted 5 lines · On Mon, Apr 07, 2014 at 04:54:07PM -0500, [email protected] wrote:

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

[snip]

Quoted 11 lines

Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt line 8

Quoted 7 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +7 -0
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+		bridge driver, EDAC driver and other devices that share the
+		registers.
+- reg : Should contain 1 register ranges(address and length)

I haven't really thought this through, but why would the FPGA bridge driver access the sdram controller? For releasing the resets in fpgaportrst ? Or is there more?

Hi Steffan. No, not for resets. We need to enable the FPGA to SDRAM path. Our SDRAM controller allows FPGA master access to the SDRAM.

Quoted 20 lines

Wouldn't it be more appropriate to represent those bits as a reset-controller to some hypothetical IP core driver?
Then you could have something like

	hps2fpga@c0000000 {
		ipcore@0 {
			resets = <&sdr 1>;
			reset-names = "foo";
			resets = <&rst 96>;
			reset-names = "bar";
			(...)
		};

		ipcore@1000 {
			resets = <&rst 96>;
			reset-names = "baz";
			(...)
		};
	};
Quoted 5 lines

And you would always have the correct bridges released out of reset for your IP core. Does the FPGA bridge driver do more? I think that is basically it. Where we maybe could run into problems though is the early_init stuff.

I think syscon is nice for some things, but we should try not to overuse it.

Understood. In this case, syscon seems to be appropriate.

Quoted 26 lines

Regards,
Steffen

Quoted 21 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +5 -0
+Example:
+	sdrctl@ffc25000 {
+		compatible = "altr,sdr-ctl", "syscon";
+		reg = <0xffc25000 0x1000>;
+	};
arch/arm/boot/dts/socfpga.dtsi +5 -0
index df43702..6ce912e 100644
@@ -676,6 +676,11 @@
 			clocks = <&l4_sp_clk>;
 		};
 
+		sdrctl@ffc25000 {
+			compatible = "altr,sdr-ctl", "syscon";
+			reg = <0xffc25000 0x1000>;
+		};
+
 		rstmgr@ffd05000 {
 			compatible = "altr,rst-mgr";
 			reg = <0xffd05000 0x1000>;
#5 lore raw

Re: [PATCH 1/3] dts: socfpga: Add bindings for Altera SoC SDRAM controller

Quoted 22 lines · Thor Thayer
Quoted 8 lines · Steffen Trumtrar

Hi!

Quoted 5 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

[snip]

Quoted 11 lines

Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt line 8

Quoted 7 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +7 -0
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+		bridge driver, EDAC driver and other devices that share the
+		registers.
+- reg : Should contain 1 register ranges(address and length)

I haven't really thought this through, but why would the FPGA bridge driver access the sdram controller? For releasing the resets in fpgaportrst ? Or is there more?

Quoted 3 lines

Hi Steffan. No, not for resets. We need to enable the FPGA to SDRAM path. Our SDRAM controller allows FPGA master access to the SDRAM.

Yes. But what you have to do to enable the path is let the FPGA port you use out of reset. And that is it as far as I can see. The rest happens in the bitstream. Or is there more to enable the path?
The FPGA2SDRAM bridge is the one I didn't use as of yet, so if I miss something please elaborate.

Quoted 20 lines
Quoted 20 lines

Wouldn't it be more appropriate to represent those bits as a reset-controller to some hypothetical IP core driver?
Then you could have something like

	hps2fpga at c0000000 {
		ipcore at 0 {
			resets = <&sdr 1>;
			reset-names = "foo";
			resets = <&rst 96>;
			reset-names = "bar";
			(...)
		};

		ipcore at 1000 {
			resets = <&rst 96>;
			reset-names = "baz";
			(...)
		};
	};
Quoted 7 lines
Quoted 5 lines

And you would always have the correct bridges released out of reset for your IP core. Does the FPGA bridge driver do more? I think that is basically it. Where we maybe could run into problems though is the early_init stuff.

I think syscon is nice for some things, but we should try not to overuse it.

Understood. In this case, syscon seems to be appropriate.

I'm not convinced yet.

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 |
#6 lore raw

Re: [PATCH 1/3] dts: socfpga: Add bindings for Altera SoC SDRAM controller

Quoted 27 lines · Steffen Trumtrar
Quoted 22 lines · Thor Thayer
Quoted 8 lines · Steffen Trumtrar

Hi!

Quoted 5 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

[snip]

Quoted 11 lines

Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt line 8

Quoted 7 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +7 -0
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+         bridge driver, EDAC driver and other devices that share the
+         registers.
+- reg : Should contain 1 register ranges(address and length)

I haven't really thought this through, but why would the FPGA bridge driver access the sdram controller? For releasing the resets in fpgaportrst ? Or is there more?

Quoted 3 lines

Hi Steffan. No, not for resets. We need to enable the FPGA to SDRAM path. Our SDRAM controller allows FPGA master access to the SDRAM.

Quoted 5 lines

Yes. But what you have to do to enable the path is let the FPGA port you use out of reset. And that is it as far as I can see. The rest happens in the bitstream. Or is there more to enable the path?
The FPGA2SDRAM bridge is the one I didn't use as of yet, so if I miss something please elaborate.

Hi Steffen,

The sdram controller is used by two drivers. That's why we want to specify "syscon" here. The other driver is the FPGA bridge driver. Its functionality is very separate from what this driver is doing (we are not enabling the bridge in this driver; we are enabling the monitoring and resetting the interrupt bit of the EDAC). We wanted to specify "syscon" her so that we don't have to have to change it for the other driver.

Alan Tull

#7 lore raw

Re: [PATCH 1/3] dts: socfpga: Add bindings for Altera SoC SDRAM controller

Quoted 37 lines · delicious quinoa
Quoted 27 lines · Steffen Trumtrar
Quoted 22 lines · Thor Thayer
Quoted 8 lines · Steffen Trumtrar

Hi!

Quoted 5 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

[snip]

Quoted 11 lines

Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt line 8

Quoted 7 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +7 -0
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+         bridge driver, EDAC driver and other devices that share the
+         registers.
+- reg : Should contain 1 register ranges(address and length)

I haven't really thought this through, but why would the FPGA bridge driver access the sdram controller? For releasing the resets in fpgaportrst ? Or is there more?

Quoted 3 lines

Hi Steffan. No, not for resets. We need to enable the FPGA to SDRAM path. Our SDRAM controller allows FPGA master access to the SDRAM.

Quoted 5 lines

Yes. But what you have to do to enable the path is let the FPGA port you use out of reset. And that is it as far as I can see. The rest happens in the bitstream. Or is there more to enable the path?
The FPGA2SDRAM bridge is the one I didn't use as of yet, so if I miss something please elaborate.

Hi Steffen,

Quoted 7 lines

The sdram controller is used by two drivers. That's why we want to specify "syscon" here. The other driver is the FPGA bridge driver. Its functionality is very separate from what this driver is doing (we are not enabling the bridge in this driver; we are enabling the monitoring and resetting the interrupt bit of the EDAC). We wanted to specify "syscon" her so that we don't have to have to change it for the other driver.

But are there actually overlapping registers which are accessed by both drivers and need the protection of regmap?

Perhaps MFD is more appropriate than syscon?

Rob

#8 lore raw

Re: [PATCH 1/3] dts: socfpga: Add bindings for Altera SoC SDRAM controller

Quoted 47 lines · Rob Herring
Quoted 37 lines · delicious quinoa
Quoted 27 lines · Steffen Trumtrar
Quoted 22 lines · Thor Thayer
Quoted 8 lines · Steffen Trumtrar

Hi!

Quoted 5 lines · On Mon, Apr 07, 2014 at 04:54:07PM -0500, [email protected] wrote:

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

[snip]

Quoted 11 lines

Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt line 8

Quoted 7 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +7 -0
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+         bridge driver, EDAC driver and other devices that share the
+         registers.
+- reg : Should contain 1 register ranges(address and length)

I haven't really thought this through, but why would the FPGA bridge driver access the sdram controller? For releasing the resets in fpgaportrst ? Or is there more?

Quoted 3 lines

Hi Steffan. No, not for resets. We need to enable the FPGA to SDRAM path. Our SDRAM controller allows FPGA master access to the SDRAM.

Quoted 5 lines

Yes. But what you have to do to enable the path is let the FPGA port you use out of reset. And that is it as far as I can see. The rest happens in the bitstream. Or is there more to enable the path?
The FPGA2SDRAM bridge is the one I didn't use as of yet, so if I miss something please elaborate.

Hi Steffen,

Quoted 7 lines

The sdram controller is used by two drivers. That's why we want to specify "syscon" here. The other driver is the FPGA bridge driver. Its functionality is very separate from what this driver is doing (we are not enabling the bridge in this driver; we are enabling the monitoring and resetting the interrupt bit of the EDAC). We wanted to specify "syscon" her so that we don't have to have to change it for the other driver.

Quoted 4 lines

But are there actually overlapping registers which are accessed by both drivers and need the protection of regmap?

Perhaps MFD is more appropriate than syscon?

Hi Rob,

We are accessing bits in the SDRAM Controller's Control register which has other bits that configure the SDRAM controller. Since this main control register may be accessed by other drivers (more likely for reading the current SDRAM configuration setup than for writing), the syscon still seems like an appropriate use.

Thor

Quoted 2 lines

Rob

#9 lore raw

Re: [PATCH 1/3] dts: socfpga: Add bindings for Altera SoC SDRAM controller

In reply to Rob Herring
Quoted 47 lines · Rob Herring
Quoted 37 lines · delicious quinoa
Quoted 27 lines · Steffen Trumtrar
Quoted 22 lines · Thor Thayer
Quoted 8 lines · Steffen Trumtrar

Hi!

Quoted 5 lines · On Mon, Apr 07, 2014 at 04:54:07PM -0500, [email protected] wrote:

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

[snip]

Quoted 11 lines

Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt line 8

Quoted 7 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +7 -0
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+         bridge driver, EDAC driver and other devices that share the
+         registers.
+- reg : Should contain 1 register ranges(address and length)

I haven't really thought this through, but why would the FPGA bridge driver access the sdram controller? For releasing the resets in fpgaportrst ? Or is there more?

Quoted 3 lines

Hi Steffan. No, not for resets. We need to enable the FPGA to SDRAM path. Our SDRAM controller allows FPGA master access to the SDRAM.

Quoted 5 lines

Yes. But what you have to do to enable the path is let the FPGA port you use out of reset. And that is it as far as I can see. The rest happens in the bitstream. Or is there more to enable the path?
The FPGA2SDRAM bridge is the one I didn't use as of yet, so if I miss something please elaborate.

Hi Steffen,

Quoted 7 lines

The sdram controller is used by two drivers. That's why we want to specify "syscon" here. The other driver is the FPGA bridge driver. Its functionality is very separate from what this driver is doing (we are not enabling the bridge in this driver; we are enabling the monitoring and resetting the interrupt bit of the EDAC). We wanted to specify "syscon" her so that we don't have to have to change it for the other driver.

Quoted 4 lines

But are there actually overlapping registers which are accessed by both drivers and need the protection of regmap?

Perhaps MFD is more appropriate than syscon?

Hi Rob,

We are accessing bits in the SDRAM Controller's Control register which has other bits that configure the SDRAM controller. Since this main control register may be accessed by other drivers (more likely for reading the current SDRAM configuration setup than for writing), the syscon still seems like an appropriate use.

Thor

Quoted 2 lines

Rob

#10 lore raw

Re: [PATCH 1/3] dts: socfpga: Add bindings for Altera SoC SDRAM controller

In reply to Rob Herring
Quoted 47 lines · Rob Herring
Quoted 37 lines · delicious quinoa
Quoted 27 lines · Steffen Trumtrar
Quoted 22 lines · Thor Thayer
Quoted 8 lines · Steffen Trumtrar

Hi!

Quoted 5 lines · On Mon, Apr 07, 2014 at 04:54:07PM -0500, [email protected] wrote:

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

[snip]

Quoted 11 lines

Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt line 8

Quoted 7 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +7 -0
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+         bridge driver, EDAC driver and other devices that share the
+         registers.
+- reg : Should contain 1 register ranges(address and length)

I haven't really thought this through, but why would the FPGA bridge driver access the sdram controller? For releasing the resets in fpgaportrst ? Or is there more?

Quoted 3 lines

Hi Steffan. No, not for resets. We need to enable the FPGA to SDRAM path. Our SDRAM controller allows FPGA master access to the SDRAM.

Quoted 5 lines

Yes. But what you have to do to enable the path is let the FPGA port you use out of reset. And that is it as far as I can see. The rest happens in the bitstream. Or is there more to enable the path?
The FPGA2SDRAM bridge is the one I didn't use as of yet, so if I miss something please elaborate.

Hi Steffen,

Quoted 7 lines

The sdram controller is used by two drivers. That's why we want to specify "syscon" here. The other driver is the FPGA bridge driver. Its functionality is very separate from what this driver is doing (we are not enabling the bridge in this driver; we are enabling the monitoring and resetting the interrupt bit of the EDAC). We wanted to specify "syscon" her so that we don't have to have to change it for the other driver.

Quoted 4 lines

But are there actually overlapping registers which are accessed by both drivers and need the protection of regmap?

Perhaps MFD is more appropriate than syscon?

Hi Rob,

We are accessing bits in the SDRAM Controller's Configuration register which has other bits that configure the SDRAM controller. Since this main configuration register may be accessed by other drivers (more likely for reading the current SDRAM configuration setup than for writing), the syscon still seems like an appropriate use.

Thor

Quoted 2 lines

Rob

#11 lore raw

Re: [PATCH 1/3] dts: socfpga: Add bindings for Altera SoC SDRAM controller

In reply to Rob Herring
Quoted 47 lines · Rob Herring
Quoted 37 lines · delicious quinoa
Quoted 27 lines · Steffen Trumtrar
Quoted 22 lines · Thor Thayer
Quoted 8 lines · Steffen Trumtrar

Hi!

Quoted 5 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM controller bindings and device tree changes to the Altera SoC project.

[snip]

Quoted 11 lines

Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt line 8

Quoted 7 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +7 -0
+
+Required properties:
+- compatible : "altr,sdr-ctl", "syscon";
+                Note that syscon is invoked for this device to support the FPGA
+         bridge driver, EDAC driver and other devices that share the
+         registers.
+- reg : Should contain 1 register ranges(address and length)

I haven't really thought this through, but why would the FPGA bridge driver access the sdram controller? For releasing the resets in fpgaportrst ? Or is there more?

Quoted 3 lines

Hi Steffan. No, not for resets. We need to enable the FPGA to SDRAM path. Our SDRAM controller allows FPGA master access to the SDRAM.

Quoted 5 lines

Yes. But what you have to do to enable the path is let the FPGA port you use out of reset. And that is it as far as I can see. The rest happens in the bitstream. Or is there more to enable the path?
The FPGA2SDRAM bridge is the one I didn't use as of yet, so if I miss something please elaborate.

Hi Steffen,

Quoted 7 lines

The sdram controller is used by two drivers. That's why we want to specify "syscon" here. The other driver is the FPGA bridge driver. Its functionality is very separate from what this driver is doing (we are not enabling the bridge in this driver; we are enabling the monitoring and resetting the interrupt bit of the EDAC). We wanted to specify "syscon" her so that we don't have to have to change it for the other driver.

Quoted 2 lines

But are there actually overlapping registers which are accessed by both drivers and need the protection of regmap?

No overlapping registers here. Just various registers that are used
by: edac driver, fpga bridge, low power modes. So no special protection needed.

Quoted 4 lines

Perhaps MFD is more appropriate than syscon?

Rob

A syscon will do fine here. If we did a MFD, all it would be doing would be providing register access for this range of registers to a few drivers, so syscon does that without any trouble.

Alan Tull
aka
delicious quinoa

#12 lore raw

PATCH 2/3 dts: socfpga: Add bindings for Altera SoC SDRAM EDAC

In reply to a message not in the archive

From: Thor Thayer <[email protected]>

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

To: Rob Herring <[email protected]>
To: Pawel Moll <[email protected]>
To: Mark Rutland <[email protected]>
To: Ian Campbell <[email protected]>
To: Kumar Gala <[email protected]>
To: Rob Landley <[email protected]>
To: Russell King <[email protected]>
To: Dinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   12 ++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    5 +++++
 2 files changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt new file +12 -0
new file mode 100644
index 0000000..9348c53
@@ -0,0 +1,12 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+
+Required properties:
+- compatible : should contain "altr,sdr-edac";
+- interrupts : Should contain the SDRAM ECC IRQ in the
+	appropriate format for the IRQ controller.
+
+Example:
+	sdramedac@0 {
+		compatible = "altr,sdram-edac";
+		interrupts = <0 39 4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +5 -0
index 6ce912e..a0ea69b 100644
@@ -681,6 +681,11 @@
 			reg = <0xffc25000 0x1000>;
 		};
 
+		sdramedac@0 {
+			compatible = "altr,sdram-edac";
+			interrupts = <0 39 4>;
+		};
+
 		rstmgr@ffd05000 {
 			compatible = "altr,rst-mgr";
 			reg = <0xffd05000 0x1000>;
Signature · 1 line
1.7.9.5
#13 lore raw
Quoted 30 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

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

To: Rob Herring <[email protected]>
To: Pawel Moll <[email protected]>
To: Mark Rutland <[email protected]>
To: Ian Campbell <[email protected]>
To: Kumar Gala <[email protected]>
To: Rob Landley <[email protected]>
To: Russell King <[email protected]>
To: Dinh Nguyen <[email protected]>
Cc: devicetree at vger.kernel.org
Cc: linux-doc at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org

---
 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   12 ++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    5 +++++
 2 files changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt new file +0 -0
new file mode 100644
index 0000000..9348c53

Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt line 9

Quoted 9 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt new file +9 -0
@@ -0,0 +1,12 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+
+Required properties:
+- compatible : should contain "altr,sdr-edac";
+- interrupts : Should contain the SDRAM ECC IRQ in the
+	appropriate format for the IRQ controller.
+
+Example:
+	sdramedac at 0 {

Nit: If there's no reg, there shouldn't be a unit-address (the "@0").

Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt line 12

Quoted 3 lines
Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt new file +3 -0
+		compatible = "altr,sdram-edac";
+		interrupts = <0 39 4>;
+	};

No phandle to the actual SDRAM controller node? Is there a guaranteed limitation of a single SDRAM controller?

I don't see the point in describing this separately from the main SDRAM controller node, given this seems to be a subcomponent.

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

Quoted 9 lines
arch/arm/boot/dts/socfpga.dtsi +1 -0
index 6ce912e..a0ea69b 100644
@@ -681,6 +681,11 @@
 			reg = <0xffc25000 0x1000>;
 		};
 
+		sdramedac at 0 {

Nit: get rid of the unit-address here too.

Cheers,
Mark.

Quoted 11 lines
arch/arm/boot/dts/socfpga.dtsi +4 -0
+			compatible = "altr,sdram-edac";
+			interrupts = <0 39 4>;
+		};
+
 		rstmgr at ffd05000 {
 			compatible = "altr,rst-mgr";
 			reg = <0xffd05000 0x1000>;
Signature · 1 line
1.7.9.5
#14 lore raw

PATCH 3/3 edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

In reply to a message not in the archive

From: Thor Thayer <[email protected]>

Added EDAC support for reporting ECC errors of CycloneV and ArriaV SDRAM controller.
- The SDRAM Controller registers are used by the FPGA bridge so these are accessed through the syscon interface.
- The configuration of the SDRAM memory size for the EDAC framework is discovered from the memory node of the device tree.
- Documentation of the bindings in devicetree/bindings/arm/altera/ socfpga-sdram-edac.txt
- Correction of single bit errors, detection of double bit errors.

To: Rob Herring <[email protected]>
To: Doug Thompson <dougthompson-aS9lmoZGLiVWk0Htik3J/[email protected]>
To: Grant Likely <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 drivers/edac/Kconfig          |    9 ++
 drivers/edac/Makefile         |    2 +
 drivers/edac/altera_mc_edac.c |  360 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 371 insertions(+)
 create mode 100644 drivers/edac/altera_mc_edac.c
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..e15d05f 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_mc_edac.o
drivers/edac/altera_mc_edac.c new file +360 -0

360 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#15 lore raw

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

Quoted 11 lines · On Mon, Apr 07, 2014 at 04:54:09PM -0500…

From: Thor Thayer <[email protected]>

Added EDAC support for reporting ECC errors of CycloneV and ArriaV SDRAM controller.
- The SDRAM Controller registers are used by the FPGA bridge so these are accessed through the syscon interface.
- The configuration of the SDRAM memory size for the EDAC framework is discovered from the memory node of the device tree.
- Documentation of the bindings in devicetree/bindings/arm/altera/ socfpga-sdram-edac.txt
- Correction of single bit errors, detection of double bit errors.

Before I go and take a look at this further, is anyone at Altera going to maintain this driver in case of bug reports and issues with it?

Also, I see patch 3/3. Are the other two related? I see they are devicetree additions and, as such, all three should go together...

Signature · 9 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#16 lore raw

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

Quoted 13 lines · Borislav Petkov
Quoted 11 lines · On Mon, Apr 07, 2014 at 04:54:09PM -0500, [email protected] wrote:

From: Thor Thayer <[email protected]>

Added EDAC support for reporting ECC errors of CycloneV and ArriaV SDRAM controller.
- The SDRAM Controller registers are used by the FPGA bridge so these are accessed through the syscon interface.
- The configuration of the SDRAM memory size for the EDAC framework is discovered from the memory node of the device tree.
- Documentation of the bindings in devicetree/bindings/arm/altera/ socfpga-sdram-edac.txt
- Correction of single bit errors, detection of double bit errors.

Quoted 2 lines

Before I go and take a look at this further, is anyone at Altera going to maintain this driver in case of bug reports and issues with it?

Yes, Altera has a group specifically supporting Linux drivers on the Altera SoCs.

Quoted 4 lines

Also, I see patch 3/3. Are the other two related? I see they are devicetree additions and, as such, all three should go together...

I was told that the device tree additions should be separate patches in a series since the device tree additions go to a separate group for approval.

maintainer
#17 lore raw

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

Quoted 2 lines · Thor Thayer

Yes, Altera has a group specifically supporting Linux drivers on the Altera SoCs.

Then please add MAINTAINERS file entry for this EDAC driver so that people can send issues/reports to that group.

Quoted 3 lines

I was told that the device tree additions should be separate patches in a series since the device tree additions go to a separate group for approval.

Well, the EDAC driver depends on the devicetree stuff, right? If so, they should go together.

Signature · 5 lines
Regards/Gruss,
    Boris.

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

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

Quoted 7 lines · Borislav Petkov
Quoted 2 lines · Thor Thayer

Yes, Altera has a group specifically supporting Linux drivers on the Altera SoCs.

Then please add MAINTAINERS file entry for this EDAC driver so that people can send issues/reports to that group.

Quoted 6 lines
Quoted 3 lines

I was told that the device tree additions should be separate patches in a series since the device tree additions go to a separate group for approval.

Well, the EDAC driver depends on the devicetree stuff, right? If so, they should go together.

The patches should be in the same series, but for review purposes it's nicer if the bindings are separate patches from the code within that series.

I usually look at the drivers implementing bindings and prefer to be Cc'd on the whole series, with both the binding and driver.

Cheers,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#19 lore raw

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

Quoted 6 lines · Mark Rutland

The patches should be in the same series, but for review purposes it's nicer if the bindings are separate patches from the code within that series.

I usually look at the drivers implementing bindings and prefer to be Cc'd on the whole series, with both the binding and driver.

Right, but I got only the 3/3 patch on linux-edac which made me wonder.

So I'm guessing you or someone else would be picking the whole set once I've acked the EDAC part?

Signature · 5 lines
Regards/Gruss,
    Boris.

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

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

Quoted 9 lines · Borislav Petkov
Quoted 6 lines · Mark Rutland

The patches should be in the same series, but for review purposes it's nicer if the bindings are separate patches from the code within that series.

I usually look at the drivers implementing bindings and prefer to be Cc'd on the whole series, with both the binding and driver.

Right, but I got only the 3/3 patch on linux-edac which made me wonder.

Ah. The whole series should've been Cc'd to linux-edac; I didn't realise that wasn't the case.

Quoted 2 lines

So I'm guessing you or someone else would be picking the whole set once I've acked the EDAC part?

Typically the bindings would go with the driver via the appropriate subsystem maintainer. That way we don't get bindings without drivers or vice-versa if there's a problem part-way, and we don't end up with every other driver going via a dt tree.

Cheers,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#21 lore raw

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

Quoted 4 lines · Mark Rutland

Typically the bindings would go with the driver via the appropriate subsystem maintainer. That way we don't get bindings without drivers or vice-versa if there's a problem part-way, and we don't end up with every other driver going via a dt tree.

Ok, I can pick them up then, once review is done.

@Thor, please CC linux-edac on the whole patchset for your next submission.

Thanks.

Signature · 9 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#22 lore raw

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

Quoted 10 lines · Borislav Petkov
Quoted 4 lines · Mark Rutland

Typically the bindings would go with the driver via the appropriate subsystem maintainer. That way we don't get bindings without drivers or vice-versa if there's a problem part-way, and we don't end up with every other driver going via a dt tree.

Ok, I can pick them up then, once review is done.

@Thor, please CC linux-edac on the whole patchset for your next submission.

OK. Sorry. I'll add that on V2. Thanks for the gentle pointers.

Quoted 3 lines

Thanks.

#23 lore raw

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

In reply to [email protected]
Quoted 26 lines · On Mon, Apr 07, 2014 at 10:54:09PM +0100…

From: Thor Thayer <[email protected]>

Added EDAC support for reporting ECC errors of CycloneV and ArriaV SDRAM controller.
- The SDRAM Controller registers are used by the FPGA bridge so these are accessed through the syscon interface.
- The configuration of the SDRAM memory size for the EDAC framework is discovered from the memory node of the device tree.
- Documentation of the bindings in devicetree/bindings/arm/altera/ socfpga-sdram-edac.txt
- Correction of single bit errors, detection of double bit errors.

To: Rob Herring <[email protected]>
To: Doug Thompson <dougthompson-aS9lmoZGLiVWk0Htik3J/[email protected]>
To: Grant Likely <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 drivers/edac/Kconfig          |    9 ++
 drivers/edac/Makefile         |    2 +
 drivers/edac/altera_mc_edac.c |  360 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 371 insertions(+)
 create mode 100644 drivers/edac/altera_mc_edac.c

[...]

drivers/edac/altera_mc_edac.c line 204

Quoted 12 lines
drivers/edac/altera_mc_edac.c new file +12 -0
+/* Get total memory size from Open Firmware DTB */
+static u32 altr_sdram_get_total_mem_size(void)
+{
+       struct device_node *np;
+       u32 retcode, reg_array[2];
+
+       np = of_find_node_by_type(NULL, "memory");
+       if (!np)
+               return 0;
+
+       retcode = of_property_read_u32_array(np, "reg",
+                                            reg_array, ARRAY_SIZE(reg_array));

There's no requirement that #address-cells = <1> or #size-cells = <1>, even if any values in either would fit into 32 bits. If we must read this from the DTB rather than elsewhere, please check of_n_{addr,size}_cells.

Additionally, it's possible that the physical memory might be described over multiple reg entries, or multiple memory nodes for some arbitrary reason.

Can we not get this info from elsewhere rather than having to parse the memory node within a driver?

Cheers,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#24 lore raw

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

Quoted 48 lines · Mark Rutland
Quoted 26 lines · On Mon, Apr 07, 2014 at 10:54:09PM +0100…

From: Thor Thayer <[email protected]>

Added EDAC support for reporting ECC errors of CycloneV and ArriaV SDRAM controller.
- The SDRAM Controller registers are used by the FPGA bridge so these are accessed through the syscon interface.
- The configuration of the SDRAM memory size for the EDAC framework is discovered from the memory node of the device tree.
- Documentation of the bindings in devicetree/bindings/arm/altera/ socfpga-sdram-edac.txt
- Correction of single bit errors, detection of double bit errors.

To: Rob Herring <[email protected]>
To: Doug Thompson <dougthompson-aS9lmoZGLiVWk0Htik3J/[email protected]>
To: Grant Likely <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 drivers/edac/Kconfig          |    9 ++
 drivers/edac/Makefile         |    2 +
 drivers/edac/altera_mc_edac.c |  360 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 371 insertions(+)
 create mode 100644 drivers/edac/altera_mc_edac.c

[...]

drivers/edac/altera_mc_edac.c line 204

Quoted 12 lines
drivers/edac/altera_mc_edac.c new file +12 -0
+/* Get total memory size from Open Firmware DTB */
+static u32 altr_sdram_get_total_mem_size(void)
+{
+       struct device_node *np;
+       u32 retcode, reg_array[2];
+
+       np = of_find_node_by_type(NULL, "memory");
+       if (!np)
+               return 0;
+
+       retcode = of_property_read_u32_array(np, "reg",
+                                            reg_array, ARRAY_SIZE(reg_array));

There's no requirement that #address-cells = <1> or #size-cells = <1>, even if any values in either would fit into 32 bits. If we must read this from the DTB rather than elsewhere, please check of_n_{addr,size}_cells.

Quoted 7 lines

Additionally, it's possible that the physical memory might be described over multiple reg entries, or multiple memory nodes for some arbitrary reason.

Can we not get this info from elsewhere rather than having to parse the memory node within a driver?

It should be possible to calculate this from the dramaddrw register in the SDRAM controller.

Regards,
Steffen

Signature · 8 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 |
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#25 lore raw

Re: [PATCH 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV

Quoted 53 lines · Steffen Trumtrar
Quoted 52 lines · Mark Rutland
Quoted 26 lines · On Mon, Apr 07, 2014 at 10:54:09PM +0100, [email protected] wrote:

From: Thor Thayer <[email protected]>

Added EDAC support for reporting ECC errors of CycloneV and ArriaV SDRAM controller.
- The SDRAM Controller registers are used by the FPGA bridge so these are accessed through the syscon interface.
- The configuration of the SDRAM memory size for the EDAC framework is discovered from the memory node of the device tree.
- Documentation of the bindings in devicetree/bindings/arm/altera/ socfpga-sdram-edac.txt
- Correction of single bit errors, detection of double bit errors.

To: Rob Herring <[email protected]>
To: Doug Thompson <[email protected]>
To: Grant Likely <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 drivers/edac/Kconfig          |    9 ++
 drivers/edac/Makefile         |    2 +
 drivers/edac/altera_mc_edac.c |  360 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 371 insertions(+)
 create mode 100644 drivers/edac/altera_mc_edac.c

[...]

drivers/edac/altera_mc_edac.c line 204

Quoted 12 lines
drivers/edac/altera_mc_edac.c new file +12 -0
+/* Get total memory size from Open Firmware DTB */
+static u32 altr_sdram_get_total_mem_size(void)
+{
+       struct device_node *np;
+       u32 retcode, reg_array[2];
+
+       np = of_find_node_by_type(NULL, "memory");
+       if (!np)
+               return 0;
+
+       retcode = of_property_read_u32_array(np, "reg",
+                                            reg_array, ARRAY_SIZE(reg_array));

There's no requirement that #address-cells = <1> or #size-cells = <1>, even if any values in either would fit into 32 bits. If we must read this from the DTB rather than elsewhere, please check of_n_{addr,size}_cells.

Additionally, it's possible that the physical memory might be described over multiple reg entries, or multiple memory nodes for some arbitrary reason.

Quoted 6 lines
Quoted 3 lines

Can we not get this info from elsewhere rather than having to parse the memory node within a driver?

It should be possible to calculate this from the dramaddrw register in the SDRAM controller.

Thank you all for the comments. I will look into this further.

Quoted 4 lines

Regards,
Steffen