Skip to contentSkip to conversation

Update Stratix10 EDAC Bindings

PATCH Superseded [email protected] 2 participants 8 messages Jan 29, 2019 – Feb 19, 2019

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Update Stratix10 EDAC Bindings

From: Thor Thayer <[email protected]>

Instead of using the Arria10 (ARM32) EDAC bindings for Stratix10 (ARM64), create Stratix10 specific EDAC bindings to capture architecture differences between ARM32 and ARM64. This requires fixing the previous Stratix10 bindings. Also add the peripheral bindings for the Stratix10.

Thor Thayer (4):
Documentation: dt: edac: Fix Stratix10 IRQ bindings
Documentation: dt: edac: Add Stratix10 Peripheral bindings EDAC, altera: Skip DB IRQ for Stratix10
arm64: dts: stratix10: Use new Stratix10 EDAC bindings

 .../devicetree/bindings/edac/socfpga-eccmgr.txt    | 129 +++++++++++++++++++--
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi  |  25 ++--
 drivers/edac/altera_edac.c                         |  31 ++---
 3 files changed, 153 insertions(+), 32 deletions(-)
Signature · 1 line
2.7.4
#6 lore raw

PATCH 4/4 arm64: dts: stratix10: Use new Stratix10 EDAC bindings

From: Thor Thayer <[email protected]>

Use the new Stratix10 binding format for EDAC nodes.

---
 arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 25 ++++++++++++-----------
 1 file changed, 13 insertions(+), 12 deletions(-)
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +13 -12
index 8253a1a9e985..de6f0507333d 100644
@@ -479,11 +479,12 @@
 		};
 
 		eccmgr {
-			compatible = "altr,socfpga-a10-ecc-manager";
+			compatible = "altr,socfpga-s10-ecc-manager",
+				     "altr,socfpga-a10-ecc-manager";
 			altr,sysmgr-syscon = <&sysmgr>;
 			#address-cells = <1>;
 			#size-cells = <1>;
-			interrupts = <0 15 4>, <0 95 4>;
+			interrupts = <0 15 4>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
 			ranges;
@@ -491,31 +492,31 @@
 			sdramedac {
 				compatible = "altr,sdram-edac-s10";
 				altr,sdr-syscon = <&sdr>;
-				interrupts = <16 4>, <48 4>;
+				interrupts = <16 4>;
 			};
 
 			usb0-ecc@ff8c4000 {
-				compatible = "altr,socfpga-usb-ecc";
+				compatible = "altr,socfpga-s10-usb-ecc",
+					     "altr,socfpga-usb-ecc";
 				reg = <0xff8c4000 0x100>;
 				altr,ecc-parent = <&usb0>;
-				interrupts = <2 4>,
-					     <34 4>;
+				interrupts = <2 4>;
 			};
 
 			emac0-rx-ecc@ff8c0000 {
-				compatible = "altr,socfpga-eth-mac-ecc";
+				compatible = "altr,socfpga-s10-eth-mac-ecc",
+					     "altr,socfpga-eth-mac-ecc";
 				reg = <0xff8c0000 0x100>;
 				altr,ecc-parent = <&gmac0>;
-				interrupts = <4 4>,
-					     <36 4>;
+				interrupts = <4 4>;
 			};
 
 			emac0-tx-ecc@ff8c0400 {
-				compatible = "altr,socfpga-eth-mac-ecc";
+				compatible = "altr,socfpga-s10-eth-mac-ecc",
+					     "altr,socfpga-eth-mac-ecc";
 				reg = <0xff8c0400 0x100>;
 				altr,ecc-parent = <&gmac0>;
-				interrupts = <5 4>,
-					     <37 4>;
+				interrupts = <5 4>;
 			};
 
 		};
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 Documentation: dt: edac: Fix Stratix10 IRQ bindings

In reply to [email protected]

From: Thor Thayer <[email protected]>

Fix Stratix10 ECC bindings to specify only the single bit error. On Stratix10 double bit errors are handled as SErrors instead of interrupts.
Indicate the differences between the ARM64 and ARM32 EDAC architecture in the bindings.

---
 .../devicetree/bindings/edac/socfpga-eccmgr.txt    | 23 +++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/edac/socfpga-eccmgr.txt +16 -7
index 5626560a6cfd..a0ac50e15912 100644
@@ -236,33 +236,42 @@ Stratix10 SoCFPGA ECC Manager
 The Stratix10 SoC ECC Manager handles the IRQs for each peripheral
 in a shared register similar to the Arria10. However, ECC requires
 access to registers that can only be read from Secure Monitor with
-SMC calls. Therefore the device tree is slightly different.
+SMC calls. Therefore the device tree is slightly different. Note that
+only 1 interrupt is sent because the double bit errors are treated as
+SErrors instead of IRQ.
 
 Required Properties:
 - compatible : Should be "altr,socfpga-s10-ecc-manager"
-- interrupts : Should be single bit error interrupt, then double bit error
-	interrupt.
+- altr,sysgr-syscon : phandle to Stratix10 System Manager Block
+	              containing the ECC manager registers.
+- interrupts : Should be single bit error interrupt.
 - interrupt-controller : boolean indicator that ECC Manager is an interrupt controller
 - #interrupt-cells : must be set to 2.
+- #address-cells: must be 1
+- #size-cells: must be 1
+- ranges : standard definition, should translate from local addresses
 
 Subcomponents:
 
 SDRAM ECC
 Required Properties:
 - compatible : Should be "altr,sdram-edac-s10"
-- interrupts : Should be single bit error interrupt, then double bit error
-	interrupt, in this order.
+- interrupts : Should be single bit error interrupt.
 
 Example:
 
 	eccmgr {
 		compatible = "altr,socfpga-s10-ecc-manager";
-		interrupts = <0 15 4>, <0 95 4>;
+		altr,sysmgr-syscon = <&sysmgr>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		interrupts = <0 15 4>;
 		interrupt-controller;
 		#interrupt-cells = <2>;
+		ranges;
 
 		sdramedac {
 			compatible = "altr,sdram-edac-s10";
-			interrupts = <16 4>, <48 4>;
+			interrupts = <16 IRQ_TYPE_LEVEL_HIGH>;
 		};
 	};
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 Documentation: dt: edac: Add Stratix10 Peripheral bindings

In reply to [email protected]

From: Thor Thayer <[email protected]>

Add peripheral bindings for Stratix10 EDAC to capture the differences between the ARM64 and ARM32 architecture.

---
 .../devicetree/bindings/edac/socfpga-eccmgr.txt    | 106 +++++++++++++++++++++
 1 file changed, 106 insertions(+)
Documentation/devicetree/bindings/edac/socfpga-eccmgr.txt +106 -0
index a0ac50e15912..a0fa80c53d2a 100644
@@ -258,6 +258,49 @@ Required Properties:
 - compatible : Should be "altr,sdram-edac-s10"
 - interrupts : Should be single bit error interrupt.
 
+On-Chip RAM ECC
+Required Properties:
+- compatible      : Should be "altr,socfpga-s10-ocram-ecc"
+- reg             : Address and size for ECC block registers.
+- altr,ecc-parent : phandle to parent OCRAM node.
+- interrupts      : Should be single bit error interrupt.
+
+Ethernet FIFO ECC
+Required Properties:
+- compatible      : Should be "altr,socfpga-s10-eth-mac-ecc"
+- reg             : Address and size for ECC block registers.
+- altr,ecc-parent : phandle to parent Ethernet node.
+- interrupts      : Should be single bit error interrupt.
+
+NAND FIFO ECC
+Required Properties:
+- compatible      : Should be "altr,socfpga-s10-nand-ecc"
+- reg             : Address and size for ECC block registers.
+- altr,ecc-parent : phandle to parent NAND node.
+- interrupts      : Should be single bit error interrupt.
+
+DMA FIFO ECC
+Required Properties:
+- compatible      : Should be "altr,socfpga-s10-dma-ecc"
+- reg             : Address and size for ECC block registers.
+- altr,ecc-parent : phandle to parent DMA node.
+- interrupts      : Should be single bit error interrupt.
+
+USB FIFO ECC
+Required Properties:
+- compatible      : Should be "altr,socfpga-s10-usb-ecc"
+- reg             : Address and size for ECC block registers.
+- altr,ecc-parent : phandle to parent USB node.
+- interrupts      : Should be single bit error interrupt.
+
+SDMMC FIFO ECC
+Required Properties:
+- compatible      : Should be "altr,socfpga-s10-sdmmc-ecc"
+- reg             : Address and size for ECC block registers.
+- altr,ecc-parent : phandle to parent SD/MMC node.
+- interrupts      : Should be single bit error interrupt for port A
+		    and then single bit error interrupt for port B.
+
 Example:
 
 	eccmgr {
@@ -274,4 +317,67 @@ Example:
 			compatible = "altr,sdram-edac-s10";
 			interrupts = <16 IRQ_TYPE_LEVEL_HIGH>;
 		};
+
+		ocram-ecc@ff8cc000 {
+			compatible = "altr,socfpga-s10-ocram-ecc";
+			reg = <ff8cc000 0x100>;
+			altr,ecc-parent = <&ocram>;
+			interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
+		emac0-rx-ecc@ff8c0000 {
+			compatible = "altr,socfpga-s10-eth-mac-ecc";
+			reg = <0xff8c0000 0x100>;
+			altr,ecc-parent = <&gmac0>;
+			interrupts = <4 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
+		emac0-tx-ecc@ff8c0400 {
+			compatible = "altr,socfpga-s10-eth-mac-ecc";
+			reg = <0xff8c0400 0x100>;
+			altr,ecc-parent = <&gmac0>;
+			interrupts = <5 IRQ_TYPE_LEVEL_HIGH>'
+		};
+
+		nand-buf-ecc@ff8c8000 {
+			compatible = "altr,socfpga-s10-nand-ecc";
+			reg = <0xff8c8000 0x100>;
+			altr,ecc-parent = <&nand>;
+			interrupts = <11 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
+		nand-rd-ecc@ff8c8400 {
+			compatible = "altr,socfpga-s10-nand-ecc";
+			reg = <0xff8c8400 0x100>;
+			altr,ecc-parent = <&nand>;
+			interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
+		nand-wr-ecc@ff8c8800 {
+			compatible = "altr,socfpga-s10-nand-ecc";
+			reg = <0xff8c8800 0x100>;
+			altr,ecc-parent = <&nand>;
+			interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
+		dma-ecc@ff8c9000 {
+			compatible = "altr,socfpga-s10-dma-ecc";
+			reg = <0xff8c9000 0x100>;
+			altr,ecc-parent = <&pdma>;
+			interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
+
+		usb0-ecc@ff8c4000 {
+			compatible = "altr,socfpga-s10-usb-ecc";
+			reg = <0xff8c4000 0x100>;
+			altr,ecc-parent = <&usb0>;
+			interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
+		sdmmc-ecc@ff8c8c00 {
+			compatible = "altr,socfpga-s10-sdmmc-ecc";
+			reg = <0xff8c8c00 0x100>;
+			altr,ecc-parent = <&mmc>;
+			interrupts = <14 IRQ_TYPE_LEVEL_HIGH>,
+				     <15 IRQ_TYPE_LEVEL_HIGH>;
+		};
 	};
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/4 EDAC, altera: Skip DB IRQ for Stratix10

In reply to [email protected]

From: Thor Thayer <[email protected]>

Stratix10 Double Bit errors are configured as SErrors so skip the Double Bit IRQ initialization if Stratix10.

---
 drivers/edac/altera_edac.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)
drivers/edac/altera_edac.c +18 -13
index c89d82aa2776..6a460c742e3f 100644
@@ -1924,20 +1924,25 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac,
 		goto err_release_group1;
 	}
 
-	altdev->db_irq = irq_of_parse_and_map(np, 1);
-	if (!altdev->db_irq) {
-		edac_printk(KERN_ERR, EDAC_DEVICE, "Error allocating DBIRQ\n");
-		rc = -ENODEV;
-		goto err_release_group1;
-	}
-	rc = devm_request_irq(edac->dev, altdev->db_irq, prv->ecc_irq_handler,
-			      IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
-			      ecc_name, altdev);
-	if (rc) {
-		edac_printk(KERN_ERR, EDAC_DEVICE, "No DBERR IRQ resource\n");
-		goto err_release_group1;
+	/* Arria10 has double bit error IRQs. Stratix10 uses SErrors */
+	if (socfpga_is_a10()) {
+		altdev->db_irq = irq_of_parse_and_map(np, 1);
+		if (!altdev->db_irq) {
+			edac_printk(KERN_ERR, EDAC_DEVICE,
+				    "Error allocating DBIRQ\n");
+			rc = -ENODEV;
+			goto err_release_group1;
+		}
+		rc = devm_request_irq(edac->dev, altdev->db_irq,
+				      prv->ecc_irq_handler,
+				      IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
+				      ecc_name, altdev);
+		if (rc) {
+			edac_printk(KERN_ERR, EDAC_DEVICE,
+				    "No DBERR IRQ resource\n");
+			goto err_release_group1;
+		}
 	}
-
 	rc = edac_device_add_device(dci);
 	if (rc) {
 		dev_err(edac->dev, "edac_device_add_device failed\n");
Signature · 1 line
2.7.4
maintainer
#4 lore raw

Re: [PATCH 3/4] EDAC, altera: Skip DB IRQ for Stratix10

Hi Thor,

Quoted 22 lines · On 1/29/19 4:03 PM, [email protected] wrote:

From: Thor Thayer <[email protected]>

Stratix10 Double Bit errors are configured as SErrors so skip the Double Bit IRQ initialization if Stratix10.

---
 drivers/edac/altera_edac.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)
drivers/edac/altera_edac.c +0 -4
index c89d82aa2776..6a460c742e3f 100644
@@ -1924,20 +1924,25 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac,
 		goto err_release_group1;
 	}
 
-	altdev->db_irq = irq_of_parse_and_map(np, 1);
-	if (!altdev->db_irq) {
-		edac_printk(KERN_ERR, EDAC_DEVICE, "Error allocating DBIRQ\n");
-		rc = -ENODEV;

drivers/edac/altera_edac.c static int altr_edac_a10_device_add(struct altr_arria10_edac *edac, · line 1928

Quoted 10 lines
drivers/edac/altera_edac.c +2 -8
-		goto err_release_group1;
-	}
-	rc = devm_request_irq(edac->dev, altdev->db_irq, prv->ecc_irq_handler,
-			      IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
-			      ecc_name, altdev);
-	if (rc) {
-		edac_printk(KERN_ERR, EDAC_DEVICE, "No DBERR IRQ resource\n");
-		goto err_release_group1;
+	/* Arria10 has double bit error IRQs. Stratix10 uses SErrors */
+	if (socfpga_is_a10()) {

I see that there are socfpga_is_a10() and socfpga_is_s10() sprinkled around the driver. Since you're adding a specific binding for s10, would it make sense to remove these functions? I've gotten comments in the past from ARM maintainers that we want to avoid looking up platforms at runtime and make the differentiation at load time.

Dinh

#5 lore raw

Re: [PATCH 3/4] EDAC, altera: Skip DB IRQ for Stratix10

Hi Dinh,

Quoted 42 lines · Dinh Nguyen

Hi Thor,

Quoted 22 lines · On 1/29/19 4:03 PM, [email protected] wrote:

From: Thor Thayer <[email protected]>

Stratix10 Double Bit errors are configured as SErrors so skip the Double Bit IRQ initialization if Stratix10.

---
  drivers/edac/altera_edac.c | 31 ++++++++++++++++++-------------
  1 file changed, 18 insertions(+), 13 deletions(-)
drivers/edac/altera_edac.c +0 -4
index c89d82aa2776..6a460c742e3f 100644
@@ -1924,20 +1924,25 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac,
  		goto err_release_group1;
  	}
 
-	altdev->db_irq = irq_of_parse_and_map(np, 1);
-	if (!altdev->db_irq) {
-		edac_printk(KERN_ERR, EDAC_DEVICE, "Error allocating DBIRQ\n");
-		rc = -ENODEV;

drivers/edac/altera_edac.c static int altr_edac_a10_device_add(struct altr_arria10_edac *edac, · line 1928

Quoted 10 lines
drivers/edac/altera_edac.c +2 -8
-		goto err_release_group1;
-	}
-	rc = devm_request_irq(edac->dev, altdev->db_irq, prv->ecc_irq_handler,
-			      IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
-			      ecc_name, altdev);
-	if (rc) {
-		edac_printk(KERN_ERR, EDAC_DEVICE, "No DBERR IRQ resource\n");
-		goto err_release_group1;
+	/* Arria10 has double bit error IRQs. Stratix10 uses SErrors */
+	if (socfpga_is_a10()) {

I see that there are socfpga_is_a10() and socfpga_is_s10() sprinkled around the driver. Since you're adding a specific binding for s10, would it make sense to remove these functions? I've gotten comments in the past from ARM maintainers that we want to avoid looking up platforms at runtime and make the differentiation at load time.

Quoted 2 lines

Dinh

If there were larger differences between the Arria10 and Stratix10 then I'd agree. The differences between Arria10 and Stratix10 are minor because the ECC blocks are similar.

Since all the different families of Altera EDACs are in the same file, I think the runtime allocation is warranted especially since these checks are in the initialization functions. The interrupt handling functions are clean.

If the maintainers have a strong preference for separate functions, I can make that change but the Stratix10 functions will be very similar to the Arria10 functions resulting in a much larger file.

My preference would be to keep the method in this patch but of course, I'll follow the consensus of the maintainers.

Thanks for the review and comment!

Thor

#7 lore raw
In reply to [email protected]
Quoted 14 lines · On 1/29/19 4:03 PM, [email protected] wrote:

From: Thor Thayer <[email protected]>

Instead of using the Arria10 (ARM32) EDAC bindings for Stratix10 (ARM64), create Stratix10 specific EDAC bindings to capture architecture differences between ARM32 and ARM64. This requires fixing the previous Stratix10 bindings. Also add the peripheral bindings for the Stratix10.

Thor Thayer (4):
Documentation: dt: edac: Fix Stratix10 IRQ bindings
Documentation: dt: edac: Add Stratix10 Peripheral bindings EDAC, altera: Skip DB IRQ for Stratix10
arm64: dts: stratix10: Use new Stratix10 EDAC bindings

Quoted 5 lines
  .../devicetree/bindings/edac/socfpga-eccmgr.txt    | 129 +++++++++++++++++++--
  arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi  |  25 ++--
  drivers/edac/altera_edac.c                         |  31 ++---
  3 files changed, 153 insertions(+), 32 deletions(-)

Abandoning this review. As Dinh suggested, there are a few places
I can use the Stratix10 compatibles to make the code cleaner (although a few socfpga_is_a10() calls will remain where it makes sense).

I'll resubmit a new version with more Stratix10 compatibles.