Skip to contentSkip to conversation

Add Stratix10 OCRAM & SDMMC EDAC Support

PATCH In review [email protected] 3 participants 8 messages Apr 23, 2019 – May 10, 2019

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

cover Add Stratix10 OCRAM & SDMMC EDAC Support

From: Thor Thayer <[email protected]>

This patch series adds EDAC support for the Stratix10 OCRAM and SDMMC peripherals.

Thor Thayer (4):
EDAC, altera: Add Stratix10 OCRAM ECC support
arm64: dts: stratix10: Add OCRAM EDAC node
EDAC, altera: Add Stratix10 SDMMC support
arm64: dts: stratix10: Add SDMMC EDAC node

 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi  |  8 ++++
 .../boot/dts/altera/socfpga_stratix10_socdk.dts    | 11 ++++++
 drivers/edac/altera_edac.c                         | 43 ++++++++++++++++++++--
 3 files changed, 59 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 EDAC, altera: Add Stratix10 OCRAM ECC support

From: Thor Thayer <[email protected]>

Use the newer ECC error injection method for Arria10 and Stratix10 OCRAM.
If OCRAM has already been initialized during the boot and OCRAM ECC is enabled, ensure the Single Bit Error IRQ is enabled.

---
 drivers/edac/altera_edac.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)
drivers/edac/altera_edac.c +25 -2
index 8816f74a22b4..b7bc8f020df8 100644
@@ -1223,8 +1223,31 @@ static const struct edac_device_prv_data ocramecc_data = {
 	.inject_fops = &altr_edac_device_inject_fops,
 };
 
+static int __maybe_unused
+altr_check_ocram_deps_init(struct altr_edac_device_dev *device)
+{
+	void __iomem  *base = device->base;
+	int ret;
+
+	ret = altr_check_ecc_deps(device);
+	if (ret)
+		return ret;
+
+	/* Verify OCRAM has been initialized */
+	if (!ecc_test_bits(ALTR_A10_ECC_INITCOMPLETEA,
+			   (base + ALTR_A10_ECC_INITSTAT_OFST)))
+		return -ENODEV;
+
+	/* Enable IRQ on Single Bit Error */
+	writel(ALTR_A10_ECC_SERRINTEN, (base + ALTR_A10_ECC_ERRINTENS_OFST));
+	/* Ensure all writes complete */
+	wmb();
+
+	return 0;
+}
+
 static const struct edac_device_prv_data a10_ocramecc_data = {
-	.setup = altr_check_ecc_deps,
+	.setup = altr_check_ocram_deps_init,
 	.ce_clear_mask = ALTR_A10_ECC_SERRPENA,
 	.ue_clear_mask = ALTR_A10_ECC_DERRPENA,
 	.irq_status_mask = A10_SYSMGR_ECC_INTSTAT_OCRAM,
@@ -1234,7 +1257,7 @@ static const struct edac_device_prv_data a10_ocramecc_data = {
 	.ue_set_mask = ALTR_A10_ECC_TDERRA,
 	.set_err_ofst = ALTR_A10_ECC_INTTEST_OFST,
 	.ecc_irq_handler = altr_edac_a10_ecc_irq,
-	.inject_fops = &altr_edac_a10_device_inject_fops,
+	.inject_fops = &altr_edac_a10_device_inject2_fops,
 	/*
 	 * OCRAM panic on uncorrectable error because sleep/resume
 	 * functions and FPGA contents are stored in OCRAM. Prefer
Signature · 1 line
2.7.4
#5 lore raw

PATCH 4/4 arm64: dts: stratix10: Add SDMMC EDAC node

In reply to [email protected]

From: Thor Thayer <[email protected]>

Add the Stratix10 SDMMC EDAC node.

---
 arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts +11 -0
index 2e3863ee12b3..91fed85cf8e5 100644
@@ -67,6 +67,17 @@
 				clock-frequency = <25000000>;
 			};
 		};
+
+		eccmgr {
+			sdmmca-ecc@ff8c8c00 {
+				compatible = "altr,socfpga-s10-sdmmc-ecc",
+					     "altr,socfpga-sdmmc-ecc";
+				reg = <0xff8c8c00 0x100>;
+				altr,ecc-parent = <&mmc>;
+				interrupts = <14 4>,
+					     <15 4>;
+			};
+		};
 	};
 };
 
Signature · 1 line
2.7.4
#4 lore raw

PATCH 3/4 EDAC, altera: Add Stratix10 SDMMC support

In reply to [email protected]

From: Thor Thayer <[email protected]>

Addition of SDMMC EDAC for Stratix10 which has IRQ differences from Arria10. Update comment accordingly.

---
 drivers/edac/altera_edac.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/edac/altera_edac.c +15 -1
index b7bc8f020df8..c2e693e34d43 100644
@@ -1583,8 +1583,12 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
 	dci->mod_name = ecc_name;
 	dci->dev_name = ecc_name;
 
-	/* Update the IRQs for PortB */
+	/* Update the PortB IRQs - A10 has 4, S10 has 2, Index accordingly */
+#ifdef CONFIG_ARCH_STRATIX10
+	altdev->sb_irq = irq_of_parse_and_map(np, 1);
+#else
 	altdev->sb_irq = irq_of_parse_and_map(np, 2);
+#endif
 	if (!altdev->sb_irq) {
 		edac_printk(KERN_ERR, EDAC_DEVICE, "Error PortB SBIRQ alloc\n");
 		rc = -ENODEV;
@@ -1599,6 +1603,15 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
 		goto err_release_group_1;
 	}
 
+#ifdef CONFIG_ARCH_STRATIX10
+	/* Use IRQ to determine SError origin instead of assigning IRQ */
+	rc = of_property_read_u32_index(np, "interrupts", 1, &altdev->db_irq);
+	if (rc) {
+		edac_printk(KERN_ERR, EDAC_DEVICE,
+			    "Error PortB DBIRQ alloc\n");
+		goto err_release_group_1;
+	}
+#else
 	altdev->db_irq = irq_of_parse_and_map(np, 3);
 	if (!altdev->db_irq) {
 		edac_printk(KERN_ERR, EDAC_DEVICE, "Error PortB DBIRQ alloc\n");
@@ -1613,6 +1626,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
 		edac_printk(KERN_ERR, EDAC_DEVICE, "PortB DBERR IRQ error\n");
 		goto err_release_group_1;
 	}
+#endif
 
 	rc = edac_device_add_device(dci);
 	if (rc) {
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 arm64: dts: stratix10: Add OCRAM EDAC node

In reply to [email protected]

From: Thor Thayer <[email protected]>

Add the OCRAM ECC node with Stratix10 compatible string.

---
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +8 -0
index 41109995563c..c28310ff70a0 100644
@@ -547,6 +547,14 @@
 				interrupts = <16 4>;
 			};
 
+			ocram-ecc@ff8cc000 {
+				compatible = "altr,socfpga-s10-ocram-ecc",
+					     "altr,socfpga-a10-ocram-ecc";
+				reg = <0xff8cc000 0x100>;
+				altr,ecc-parent = <&ocram>;
+				interrupts = <1 4>;
+			};
+
 			usb0-ecc@ff8c4000 {
 				compatible = "altr,socfpga-s10-usb-ecc",
 					     "altr,socfpga-usb-ecc";
Signature · 1 line
2.7.4
maintainer Acked-by on v1 2/4
#3 lore raw

Re: [PATCH 2/4] arm64: dts: stratix10: Add OCRAM EDAC node

Quoted 19 lines · On 4/23/19 9:36 AM, [email protected] wrote:

From: Thor Thayer <[email protected]>

Add the OCRAM ECC node with Stratix10 compatible string.

---
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +1 -0
index 41109995563c..c28310ff70a0 100644
@@ -547,6 +547,14 @@
 				interrupts = <16 4>;
 			};
 
+			ocram-ecc@ff8cc000 {

arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi line 560

Quoted 10 lines
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +7 -0
+				compatible = "altr,socfpga-s10-ocram-ecc",
+					     "altr,socfpga-a10-ocram-ecc";
+				reg = <0xff8cc000 0x100>;
+				altr,ecc-parent = <&ocram>;
+				interrupts = <1 4>;
+			};
+
 			usb0-ecc@ff8c4000 {
 				compatible = "altr,socfpga-s10-usb-ecc",
 					     "altr,socfpga-usb-ecc";
maintainer Acked-by on v1 4/4
#6 lore raw

Re: [PATCH 4/4] arm64: dts: stratix10: Add SDMMC EDAC node

In reply to [email protected]
Quoted 22 lines · On 4/23/19 9:36 AM, [email protected] wrote:

From: Thor Thayer <[email protected]>

Add the Stratix10 SDMMC EDAC node.

---
 arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts +4 -0
index 2e3863ee12b3..91fed85cf8e5 100644
@@ -67,6 +67,17 @@
 				clock-frequency = <25000000>;
 			};
 		};
+
+		eccmgr {
+			sdmmca-ecc@ff8c8c00 {
+				compatible = "altr,socfpga-s10-sdmmc-ecc",

arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts line 83

Quoted 10 lines
arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts +7 -0
+					     "altr,socfpga-sdmmc-ecc";
+				reg = <0xff8c8c00 0x100>;
+				altr,ecc-parent = <&mmc>;
+				interrupts = <14 4>,
+					     <15 4>;
+			};
+		};
 	};
 };
 
maintainer
#7 lore raw
In reply to [email protected]
Quoted 11 lines · On Tue, Apr 23, 2019 at 09:36:33AM -0500, [email protected] wrote:

From: Thor Thayer <[email protected]>

This patch series adds EDAC support for the Stratix10 OCRAM and SDMMC peripherals.

Thor Thayer (4):
EDAC, altera: Add Stratix10 OCRAM ECC support
arm64: dts: stratix10: Add OCRAM EDAC node
EDAC, altera: Add Stratix10 SDMMC support
arm64: dts: stratix10: Add SDMMC EDAC node

Quoted 6 lines
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi  |  8 ++++
 .../boot/dts/altera/socfpga_stratix10_socdk.dts    | 11 ++++++
 drivers/edac/altera_edac.c                         | 43 ++++++++++++++++++++--
 3 files changed, 59 insertions(+), 3 deletions(-)

All 4 queued locally, will appear after -rc1 releases.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.