Skip to contentSkip to conversation

devicetree: Addition of the Altera SDRAM controller

PATCH Superseded [email protected] 4 participants 9 messages Jun 20, 2014 – Jun 23, 2014

Subsystems (3)

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/3 devicetree: Addition of the Altera SDRAM controller

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM Controller bindings and device tree changes.

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.

---
 .../bindings/arm/altera/socfpga-sdram.txt          |   11 +++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    5 +++++
 2 files changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +11 -0
new file mode 100644
index 0000000..5027026
@@ -0,0 +1,11 @@
+Altera SOCFPGA SDRAM Controller
+
+Required properties:
+- compatible : "altr,sdr-ctl";
+- reg : Should contain 1 register ranges(address and length)
+
+Example:
+	sdrctl at ffc25000 {
+		compatible = "altr,sdr-ctl";
+		reg = <0xffc25000 0x4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +5 -0
index 4676f25..310292e 100644
@@ -682,6 +682,11 @@
 			clocks = <&l4_sp_clk>;
 		};
 
+		sdrctl at ffc25000 {
+			compatible = "altr,sdr-ctl", "syscon";
+			reg = <0xffc25000 0x4>;
+		};
+
 		rst: rstmgr at ffd05000 {
 			compatible = "altr,rst-mgr";
 			reg = <0xffd05000 0x1000>;
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v6 2/3 devicetree: Addition of the Altera SDRAM EDAC

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM EDAC bindings and device tree changes

v2: Changes to SoC EDAC source code.

v3: Fix typo in device tree documentation.

v4,v5: No changes - bump version for consistency.

v6: Assign ECC registers in SDRAM controller to EDAC

---
 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   15 +++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    6 ++++++
 2 files changed, 21 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..540c9cf
@@ -0,0 +1,15 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+
+Required properties:
+- compatible : should contain "altr,sdram-edac";
+- reg : should contain the ECC register range in sdram
+        controller (address and length).
+- interrupts : Should contain the SDRAM ECC IRQ in the
+	appropriate format for the IRQ controller.
+
+Example:
+	sdramedac@0 {
+		compatible = "altr,sdram-edac";
+		reg = <0xffc2502C 0x28>;
+		interrupts = <0 39 4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +6 -0
index 310292e..fe9832e 100644
@@ -687,6 +687,12 @@
 			reg = <0xffc25000 0x4>;
 		};
 
+		sdramedac@0 {
+			compatible = "altr,sdram-edac";
+			reg = <0xffc2502C 0x28>;
+			interrupts = <0 39 4>;
+		};
+
 		rst: rstmgr@ffd05000 {
 			compatible = "altr,rst-mgr";
 			reg = <0xffd05000 0x1000>;
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCHv6 2/3] devicetree: Addition of the Altera SDRAM EDAC

Quoted 45 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM EDAC bindings and device tree changes

v2: Changes to SoC EDAC source code.

v3: Fix typo in device tree documentation.

v4,v5: No changes - bump version for consistency.

v6: Assign ECC registers in SDRAM controller to EDAC

---
 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   15 +++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    6 ++++++
 2 files changed, 21 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..540c9cf
@@ -0,0 +1,15 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+
+Required properties:
+- compatible : should contain "altr,sdram-edac";
+- reg : should contain the ECC register range in sdram
+        controller (address and length).
+- interrupts : Should contain the SDRAM ECC IRQ in the
+	appropriate format for the IRQ controller.
+
+Example:
+	sdramedac at 0 {
+		compatible = "altr,sdram-edac";
+		reg = <0xffc2502C 0x28>;
+		interrupts = <0 39 4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +0 -0
index 310292e..fe9832e 100644

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

Quoted 4 lines
arch/arm/boot/dts/socfpga.dtsi +1 -0
@@ -687,6 +687,12 @@
 			reg = <0xffc25000 0x4>;
 		};
 
+		sdramedac at 0 {
                         ^^^

Please fix the baseaddress (also in the binding doc).

Quoted 8 lines
arch/arm/boot/dts/socfpga.dtsi +5 -0
+			compatible = "altr,sdram-edac";
+			reg = <0xffc2502C 0x28>;
+			interrupts = <0 39 4>;
+		};
+
 		rst: 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 |
#3 lore raw

Re: [PATCHv6 2/3] devicetree: Addition of the Altera SDRAM EDAC

Quoted 49 lines · Steffen Trumtrar
Quoted 48 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM EDAC bindings and device tree changes

v2: Changes to SoC EDAC source code.

v3: Fix typo in device tree documentation.

v4,v5: No changes - bump version for consistency.

v6: Assign ECC registers in SDRAM controller to EDAC

---
 .../bindings/arm/altera/socfpga-sdram-edac.txt     |   15 +++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    6 ++++++
 2 files changed, 21 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..540c9cf
@@ -0,0 +1,15 @@
+Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
+
+Required properties:
+- compatible : should contain "altr,sdram-edac";
+- reg : should contain the ECC register range in sdram
+        controller (address and length).
+- interrupts : Should contain the SDRAM ECC IRQ in the
+     appropriate format for the IRQ controller.
+
+Example:
+     sdramedac at 0 {
+             compatible = "altr,sdram-edac";
+             reg = <0xffc2502C 0x28>;
+             interrupts = <0 39 4>;
+     };
arch/arm/boot/dts/socfpga.dtsi +0 -0
index 310292e..fe9832e 100644
@@ -687,6 +687,12 @@
                      reg = <0xffc25000 0x4>;
              };
 
Quoted 5 lines

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

Quoted 1 line
arch/arm/boot/dts/socfpga.dtsi +1 -0
+             sdramedac at 0 {
                         ^^^

Please fix the baseaddress (also in the binding doc).

Thanks. Good catch. I will fix this.

Quoted 14 lines

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

Quoted 8 lines
arch/arm/boot/dts/socfpga.dtsi +5 -0
+                     compatible = "altr,sdram-edac";
+                     reg = <0xffc2502C 0x28>;
+                     interrupts = <0 39 4>;
+             };
+
              rst: rstmgr at ffd05000 {
                      compatible = "altr,rst-mgr";
                      reg = <0xffd05000 0x1000>;

--

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

PATCH v6 3/3 edac: altera: Add EDAC support for SDRAM Ctlr

In reply to [email protected]

From: Thor Thayer <[email protected]>

Addition of the driver to support the Altera SDRAM Controller. 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.

---
 drivers/edac/Kconfig       |    9 +
 drivers/edac/Makefile      |    2 +
 drivers/edac/altera_edac.c |  448 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 459 insertions(+)
 create mode 100644 drivers/edac/altera_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..9741336 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 +448 -0

448 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#5 lore raw

Re: [PATCHv6 3/3] edac: altera: Add EDAC support for SDRAM Ctlr

Hi Thor,

Quoted 19 lines · Thor Thayer

From: Thor Thayer <[email protected]>

Addition of the driver to support the Altera SDRAM Controller. 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.

Quoted 6 lines

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

---

For future patch submissions, please add your version history after the "---".

Quoted 61 lines
 drivers/edac/Kconfig       |    9 +
 drivers/edac/Makefile      |    2 +
 drivers/edac/altera_edac.c |  448 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 459 insertions(+)
 create mode 100644 drivers/edac/altera_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..9741336 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 +21 -0
new file mode 100644
index 0000000..e3fcd27
@@ -0,0 +1,448 @@
+/*
+ *  Copyright Altera Corporation (C) 2014. All rights reserved.
+ *  Copyright 2011-2012 Calxeda, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+
+ *
+ * Adapted from the highbank_mc_edac driver
+ *
+ */

drivers/edac/altera_edac.c line 31

Quoted 10 lines
drivers/edac/altera_edac.c new file +10 -0
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/ctype.h>
+#include <linux/edac.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/of_platform.h>
+#include <linux/uaccess.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>

Can you alphabetize these headers please?

Dinh

#6 lore raw
In reply to [email protected]

Hi!

Quoted 43 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM Controller bindings and device tree changes.

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.

---
 .../bindings/arm/altera/socfpga-sdram.txt          |   11 +++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    5 +++++
 2 files changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +11 -0
new file mode 100644
index 0000000..5027026
@@ -0,0 +1,11 @@
+Altera SOCFPGA SDRAM Controller
+
+Required properties:
+- compatible : "altr,sdr-ctl";
+- reg : Should contain 1 register ranges(address and length)
+
+Example:
+	sdrctl at ffc25000 {
+		compatible = "altr,sdr-ctl";
+		reg = <0xffc25000 0x4>;
+	};
arch/arm/boot/dts/socfpga.dtsi +0 -0
index 4676f25..310292e 100644

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

Quoted 5 lines
arch/arm/boot/dts/socfpga.dtsi +2 -0
@@ -682,6 +682,11 @@
 			clocks = <&l4_sp_clk>;
 		};
 
+		sdrctl at ffc25000 {
+			compatible = "altr,sdr-ctl", "syscon";

Did you forget to add the syscon to the binding documentation?

Quoted 6 lines
arch/arm/boot/dts/socfpga.dtsi +3 -0
+			reg = <0xffc25000 0x4>;
+		};
+
 		rst: 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 |
#7 lore raw
Quoted 49 lines · Steffen Trumtrar

Hi!

Quoted 46 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM Controller bindings and device tree changes.

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.

---
 .../bindings/arm/altera/socfpga-sdram.txt          |   11 +++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    5 +++++
 2 files changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +11 -0
new file mode 100644
index 0000000..5027026
@@ -0,0 +1,11 @@
+Altera SOCFPGA SDRAM Controller
+
+Required properties:
+- compatible : "altr,sdr-ctl";
+- reg : Should contain 1 register ranges(address and length)
+
+Example:
+     sdrctl at ffc25000 {
+             compatible = "altr,sdr-ctl";
+             reg = <0xffc25000 0x4>;
+     };
arch/arm/boot/dts/socfpga.dtsi +0 -0
index 4676f25..310292e 100644
@@ -682,6 +682,11 @@
                      clocks = <&l4_sp_clk>;
              };
 
Quoted 5 lines

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

Quoted 2 lines
arch/arm/boot/dts/socfpga.dtsi +2 -0
+             sdrctl at ffc25000 {
+                     compatible = "altr,sdr-ctl", "syscon";

Did you forget to add the syscon to the binding documentation?

Hi Steffen,

I guess I'm confused about when to use syscon. In my last series, I was advised not to include syscon in the bindings but to use it in the device tree. I had been including it in the binding document until this patch.

Thanks,

Thor

Quoted 12 lines

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

Quoted 6 lines
arch/arm/boot/dts/socfpga.dtsi +3 -0
+                     reg = <0xffc25000 0x4>;
+             };
+
              rst: rstmgr at ffd05000 {
                      compatible = "altr,rst-mgr";
                      reg = <0xffd05000 0x1000>;

--

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
Quoted 56 lines · Thor Thayer
Quoted 49 lines · Steffen Trumtrar

Hi!

Quoted 46 lines · tthayer at altera.com

From: Thor Thayer <[email protected]>

Addition of the Altera SDRAM Controller bindings and device tree changes.

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.

---
 .../bindings/arm/altera/socfpga-sdram.txt          |   11 +++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |    5 +++++
 2 files changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt
Documentation/devicetree/bindings/arm/altera/socfpga-sdram.txt new file +11 -0
new file mode 100644
index 0000000..5027026
@@ -0,0 +1,11 @@
+Altera SOCFPGA SDRAM Controller
+
+Required properties:
+- compatible : "altr,sdr-ctl";
+- reg : Should contain 1 register ranges(address and length)
+
+Example:
+     sdrctl at ffc25000 {
+             compatible = "altr,sdr-ctl";
+             reg = <0xffc25000 0x4>;
+     };
arch/arm/boot/dts/socfpga.dtsi +0 -0
index 4676f25..310292e 100644
@@ -682,6 +682,11 @@
                      clocks = <&l4_sp_clk>;
              };
 
Quoted 5 lines

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

Quoted 2 lines
arch/arm/boot/dts/socfpga.dtsi +2 -0
+             sdrctl at ffc25000 {
+                     compatible = "altr,sdr-ctl", "syscon";

Did you forget to add the syscon to the binding documentation?

Quoted 7 lines

Hi Steffen,

I guess I'm confused about when to use syscon. In my last series, I was advised not to include syscon in the bindings but to use it in the device tree. I had been including it in the binding document until this patch.

Oh, aha. Well, then I'm confused, too. Let's wait for one of the DT binding guys than.

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 |