EDAC/altera: use flag to differentiate 64-bit platforms
Subsystems (5)
Dinh Nguyen
maintainerPATCH v3 1/4 EDAC/altera: use flag to differentiate 64-bit platforms
In commit (d4486fc3098e "EDAC/altera: Use ECC manager compatible to select A10/S10 IRQ layout"), it added a way to only differentiate Stratix10 from a 32-bit platform. In preparation to add support for Agilex5, it needs a way to make a further differentiation.
Make use of the driver match data to hold a flag for different platforms, specifically Stratix10 and Agilex5.
---
v3: no changes
v2: use enum for altr_platform_idx
use SOCFPGA_A10 for A10 platforms
--- drivers/edac/altera_edac.c | 20 +++++++++++--------- drivers/edac/altera_edac.h | 8 +++++++- 2 files changed, 18 insertions(+), 10 deletions(-)
drivers/edac/altera_edac.c +11 -9
@@ -1489,7 +1489,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)int edac_idx, rc;struct device_node *np;const struct edac_device_prv_data *prv = &a10_sdmmceccb_data; -bool is_s10 = device->edac->is_s10; +unsigned long flag = (unsigned long )device->edac->flag; rc =altr_check_ecc_deps (device);if (rc)
@@ -1538,7 +1538,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)*/ /* Using compatibles to determine the IRQ Index */ -if (is_s10) +if (flag ==SOCFPGA_S10 ) altdev->sb_irq =irq_of_parse_and_map (np,1 );else altdev->sb_irq =irq_of_parse_and_map (np,2 );
@@ -1556,7 +1556,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) goto err_release_group_1; } -if (is_s10) { +if (flag ==SOCFPGA_S10 ) {/* Use IRQ to determine SError origin instead of assigning IRQ */ rc =of_property_read_u32_index (np,"interrupts" ,1 , &altdev->db_irq);if (rc) {
@@ -1967,7 +1967,7 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac, goto err_release_group1; } -if (edac->is_s10) { +if (edac->flag ==SOCFPGA_S10 ) {/* Use IRQ to determine SError origin instead of assigning IRQ */ rc =of_property_read_u32_index (np,"interrupts" ,0 , &altdev->db_irq);if (rc) {
@@ -2121,7 +2121,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev)platform_set_drvdata (pdev, edac);INIT_LIST_HEAD (&edac->a10_ecc_devices); - edac->is_s10 = !!device_get_match_data (&pdev->dev); + edac->flag = (unsigned long )device_get_match_data (&pdev->dev); edac->ecc_mgr_map = altr_sysmgr_regmap_lookup_by_phandle(pdev->dev.of_node,
@@ -2154,8 +2154,8 @@ static int altr_edac_a10_probe(struct platform_device *pdev)irq_set_chained_handler_and_data (edac->sb_irq, altr_edac_a10_irq_handler, edac); -if (edac->is_s10) - { + +if (edac->flag ==SOCFPGA_S10 ) {int dberror, err_addr; edac->panic_notifier.notifier_call = s10_edac_dberr_handler;
@@ -2205,8 +2205,10 @@ static int altr_edac_a10_probe(struct platform_device *pdev) }static const struct of_device_id altr_edac_a10_of_match[] = { - { .compatible ="altr,socfpga-a10-ecc-manager" }, - { .compatible ="altr,socfpga-s10-ecc-manager" , .data = (void *)1 }, + { .compatible ="altr,socfpga-a10-ecc-manager" , + .data = (void *)SOCFPGA_A10 }, + { .compatible ="altr,socfpga-s10-ecc-manager" , + .data = (void *)SOCFPGA_S10 }, {}, };MODULE_DEVICE_TABLE (of, altr_edac_a10_of_match);
drivers/edac/altera_edac.h +7 -1
@@ -351,6 +351,12 @@ struct altr_sdram_mc_data {#define ECC_READ_EOVR 0x2#define ECC_READ_EDOVR 0x3 +enum altr_platform_idx { +SOCFPGA_A10 , +SOCFPGA_S10 , +SOCFPGA_AGILEX5 +}; +struct altr_edac_device_dev ;struct edac_device_prv_data {
@@ -394,7 +400,7 @@ struct altr_arria10_edac {struct irq_chip irq_chip;struct list_head a10_ecc_devices;struct notifier_block panic_notifier; - bool is_s10; + unsigned long flag; };#endif /* #ifndef _ALTERA_EDAC_H */
Signature · 1 line
2.42.0.411.g813d9a9188
Dinh Nguyen
maintainerPATCH v3 2/4 dt-bindings: edac: altera: agilex5: document new edac support
The Agilex5 EDAC module supports ECC on a few additional peripherals. Along with support for ocram, ethernet and USB, the Agilex5 EDAC adds support for SDM QSPI, CRAM SEU and IO96B.
The Agilex5 EDAC also exposes up to 7 named interrupts on the manager node. global_sbe and global_dbe are aggregate single/double-bit error interrupts that fan-out through the manager's IRQ domain to the child peripheral ECCs. The remaining named interrupts are routed directly from dedicated controllers (IO96B memory controllers and Secure Device Manager) to the GIC.
---
v3: Add minItems for interrupts
Add constraint for interrupt-names
Add interrupt-name as false for non "altr,socfpga-agilex5-ecc-manager" platforms
v2: add if/then to enforce maxItem of 2 interrupts for older platforms,
and 7 for Agilex5
add if/then to enforce interrupt-names as required property for Agilex5
enum altr,socfpga-s10-ecc-manager and altr,socfpga-agilex5-ecc-manager
--- .../edac/altr,socfpga-ecc-manager.yaml | 90 ++++++++++++++----- 1 file changed, 66 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +66 -24
@@ -20,7 +20,9 @@ properties: compatible: oneOf: - items: - - const: altr,socfpga-s10-ecc-manager + - enum: + - altr,socfpga-s10-ecc-manager + - altr,socfpga-agilex5-ecc-manager - const: altr,socfpga-a10-ecc-manager - const: altr,socfpga-a10-ecc-manager - const: altr,socfpga-ecc-manager
@@ -33,7 +35,25 @@ properties: interrupts: minItems: 1 - maxItems: 2 + items: + - description: Global single-bit error + - description: Global double-bit error + - description: IO96B0 DRAM controller error + - description: IO96B1 DRAM controller error + - description: SDM QSPI single-bit error + - description: SDM QSPI double-bit error + - description: SDM single-event + + interrupt-names: + minItems: 1 + items: + - const: global_sbe + - const: global_dbe + - const: io96b0 + - const: io96b1 + - const: sdm_qspi_sbe + - const: sdm_qspi_dbe + - const: sdm_seu interrupt-controller: true
@@ -235,28 +255,50 @@ patternProperties: - interrupts - altr,ecc-parent -if: - properties: - compatible: - contains: - const: altr,socfpga-ecc-manager -then: - required: - - compatible - - "#address-cells" - - "#size-cells" - - ranges - -else: - required: - - compatible - - "#address-cells" - - "#size-cells" - - interrupts - - interrupt-controller - - "#interrupt-cells" - - ranges - - altr,sysmgr-syscon +allOf: + - if: + properties: + compatible: + contains: + const: altr,socfpga-ecc-manager + then: + required: + - compatible + - "#address-cells" + - "#size-cells" + - ranges + + else: + required: + - compatible + - "#address-cells" + - "#size-cells" + - interrupts + - interrupt-controller + - "#interrupt-cells" + - ranges + - altr,sysmgr-syscon + + - if: + properties: + compatible: + contains: + const: altr,socfpga-agilex5-ecc-manager + then: + properties: + interrupts: + minItems: 1 + maxItems: 7 + interrupt-names: + minItems: 1 + maxItems: 7 + required: + - interrupt-names + else: + properties: + interrupts: + maxItems: 2 + interrupt-names: false additionalProperties: false
Signature · 1 line
2.42.0.411.g813d9a9188
[email protected]
AI reviewRe: [PATCHv3 2/4] dt-bindings: edac: altera: agilex5: document new edac support
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] dt-bindings: edac: altera: fixed-order interrupt-names tuple with minItems 1 - [Medium]…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] dt-bindings: edac: altera: fixed-order interrupt-names tuple with minItems 1
- [Medium] dt-bindings: edac: altera: incompatible a10 fallback compatible for agilex5
- [Low] dt-bindings: edac: altera: unwieldy per-compatible conditionals in schema
--
commit 8ef209bb93609f50bb0952f3479bdf8adcfdc2d5
Author: Dinh Nguyen <[email protected]>
dt-bindings: edac: altera: agilex5: document new edac support
This commit documents the Agilex5 ECC manager compatible string and its seven named interrupts in the Altera SoCFPGA ECC manager DT binding.
Quoted 5 lines
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +0
-0
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml properties: · line 28
Quoted 10 lines
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +3
-1@@ -20,7 +20,9 @@ properties: compatible: oneOf: - items: - - const: altr,socfpga-s10-ecc-manager + - enum: + - altr,socfpga-s10-ecc-manager + - altr,socfpga-agilex5-ecc-manager - const: altr,socfpga-a10-ecc-manager - const: altr,socfpga-a10-ecc-manager - const: altr,socfpga-ecc-manager
[Severity: Medium]
Is altr,socfpga-a10-ecc-manager a valid fallback compatible for altr,socfpga-agilex5-ecc-manager?
On a kernel without dedicated Agilex5 support, matching altr,socfpga-a10-ecc-manager binds altr_edac_a10_driver with is_s10 set to false. altr_edac_a10_probe() and altr_edac_a10_device_add() then treat the device as a 32-bit Arria10 ECC manager, writing Arria10 System Manager register offsets (A10_SYSMGR_ECC_INTMASK_SET_OFST), registering platform_get_irq(pdev, 1) as a chained IRQ handler, and requiring two interrupts on every child peripheral ECC node.
Quoted 14 lines
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +9
-1@@ -33,7 +35,25 @@ properties: interrupts: minItems: 1 - maxItems: 2 + items: + - description: Global single-bit error + - description: Global double-bit error + - description: IO96B0 DRAM controller error + - description: IO96B1 DRAM controller error + - description: SDM QSPI single-bit error + - description: SDM QSPI double-bit error + - description: SDM single-event +
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml properties: · line 56
Quoted 10 lines
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +10
-0+ interrupt-names: + minItems: 1 + items: + - const: global_sbe + - const: global_dbe + - const: io96b0 + - const: io96b1 + - const: sdm_qspi_sbe + - const: sdm_qspi_dbe + - const: sdm_seu
[Severity: Medium]
Does defining interrupt-names as a fixed-order tuple of const values with minItems: 1 match how Agilex5 nodes specify interrupts?
In JSON Schema tuple validation, an array of length N (with N < 7) must match the first N entries in exact order, so dtbs_check will reject any Agilex5 node that omits an earlier interrupt (such as global_dbe or io96b1) while specifying a later one (such as io96b0 or sdm_seu). Or, if all seven GIC interrupts are always wired in the Agilex5 SoC device tree, should minItems be 7?
[ ... ]
Quoted 60 lines
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +34
-22@@ -235,28 +255,50 @@ patternProperties: - interrupts - altr,ecc-parent -if: - properties: - compatible: - contains: - const: altr,socfpga-ecc-manager -then: - required: - - compatible - - "#address-cells" - - "#size-cells" - - ranges - -else: - required: - - compatible - - "#address-cells" - - "#size-cells" - - interrupts - - interrupt-controller - - "#interrupt-cells" - - ranges - - altr,sysmgr-syscon +allOf: + - if: + properties: + compatible: + contains: + const: altr,socfpga-ecc-manager + then: + required: + - compatible + - "#address-cells" + - "#size-cells" + - ranges + + else: + required: + - compatible + - "#address-cells" + - "#size-cells" + - interrupts + - interrupt-controller + - "#interrupt-cells" + - ranges + - altr,sysmgr-syscon + + - if: + properties: + compatible: + contains: + const: altr,socfpga-agilex5-ecc-manager + then: + properties: + interrupts: + minItems: 1 + maxItems: 7
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml patternProperties: · line 301
Quoted 10 lines
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +10
-0+ interrupt-names: + minItems: 1 + maxItems: 7 + required: + - interrupt-names + else: + properties: + interrupts: + maxItems: 2 + interrupt-names: false
[Severity: Low]
This isn't a bug, but this binding already spans several SoCFPGA generations with different property requirements, and defining seven Agilex5-specific interrupts at the top level only to restrict older variants back in a second if/then/else block makes the schema hard to follow (with minItems: 1 and maxItems: 7 in the Agilex5 branch also duplicating the top-level 7-item lists). Would it be cleaner to split Agilex5 into a separate schema document instead of adding more per-compatible conditionals here?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCHv3 2/4] dt-bindings: edac: altera: agilex5: document new edac support
In reply to Dinh NguyenDocumentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml patternProperties: · line 291
Quoted 10 lines · Dinh Nguyen
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +10
-0+ - if: + properties: + compatible: + contains: + const: altr,socfpga-agilex5-ecc-manager + then: + properties: + interrupts: + minItems: 1 + maxItems: 7
Why is this flexible? Wasn't before and changelog explains nothing.
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml patternProperties: · line 294
Quoted 3 lines
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +3
-0+ interrupt-names: + minItems: 1 + maxItems: 7
Best regards,
Krzysztof
Dinh Nguyen
maintainerRe: [PATCHv3 2/4] dt-bindings: edac: altera: agilex5: document new edac support
Hi Krzysztof,
Quoted 12 lines · Krzysztof Kozlowski
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml patternProperties: · line 291
Quoted 10 lines · Dinh Nguyen
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +10
-0+ - if: + properties: + compatible: + contains: + const: altr,socfpga-agilex5-ecc-manager + then: + properties: + interrupts: + minItems: 1 + maxItems: 7
Quoted 2 lines
Why is this flexible? Wasn't before and changelog explains nothing.
Sorry, but I'm having difficulty understanding your comment here. Doesn't the minItems as 1 specify that the "altr,socfpga-agilex5-ecc-manager" must have at least 1 interrupts specified, and up to 7?
My changelog also specifies "up to 7 named interrupts".
Thanks,
Dinh
Re: [PATCHv3 2/4] dt-bindings: edac: altera: agilex5: document new edac support
Quoted 15 lines · Dinh Nguyen
Hi Krzysztof,
Quoted 12 lines · Krzysztof Kozlowski
Quoted 10 lines · Dinh Nguyen
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml +10
-0+ - if: + properties: + compatible: + contains: + const: altr,socfpga-agilex5-ecc-manager + then: + properties: + interrupts: + minItems: 1 + maxItems: 7
Quoted 8 lines
Quoted 2 lines
Why is this flexible? Wasn't before and changelog explains nothing.
Sorry, but I'm having difficulty understanding your comment here. Doesn't the minItems as 1 specify that the "altr,socfpga-agilex5-ecc-manager" must have at least 1 interrupts specified, and up to 7?
My changelog also specifies "up to 7 named interrupts".
So is my question: why is this number flexible?
Best regards,
Krzysztof
Dinh Nguyen
maintainerPATCH v3 3/4 EDAC/altera: Add support for Agilex5 ECC manager
In reply to Dinh NguyenAdd support for the Agilex5 ECC manager, unlike Stratix10/Agilex7, Agilex5 exposes up to 7 named interrupts on its DT node:
global_sbe - aggregate single-bit error (chained, drives IRQ domain)
global_dbe - aggregate double-bit error (chained; DBE is no longer
delivered exclusively through Asynchronous SError)
io96b0 - IO96B0 DRAM controller ECC io96b1 - IO96B1 DRAM controller ECC sdm_qspi_sbe - SDM QSPI single-bit error sdm_qspi_dbe - SDM QSPI double-bit error sdm_seu - SDM single-event-upset
Place all seven interrupt's name in a new agilex5_irqs[] array on struct altr_arria10_edac so subsequent peripheral support (IO96B, SDM QSPI, CRAM SEU) can consume them without re-parsing the DT. Only the global_sbe is mandatory, the rest are optional.
global_sbe is wired up as the chained SBE handler (replacing the legacy index-0 lookup). global_dbe is hooked into the same altr_edac_a10_irq_handler() so that the existing sb_irq/db_irq demux routes DBE events through the manager's IRQ domain.
Legacy A10/S10 probe paths are unchanged.
---
v3: Use irq_domain_remove() in error path of altr_edac_a10_probe() when
irq names cannot be found.
Return -EINVAL for when sbe irq is not found in altr_agilex5_get_named_irqs()
v2: Reorganize db_error so Agilex5 goes last to prevent going into
default condition for A10
Clean up the commit message to be less wordy
--- drivers/edac/altera_edac.c | 86 ++++++++++++++++++++++++++++++++++++-- drivers/edac/altera_edac.h | 29 +++++++++++++ 2 files changed, 111 insertions(+), 4 deletions(-)
drivers/edac/altera_edac.c +82 -4
@@ -2107,11 +2107,63 @@ static int s10_edac_dberr_handler(struct notifier_block *this,return NOTIFY_DONE ; } +/* +* Ordered table of named interrupts published by an +* "altr,socfpga-agilex5-ecc-manager" device tree node. Indices match +* enum altr_agilex5_irq_idx. Only "global_sbe" is mandatory; the rest are +* optional so platforms can omit interrupts for unused subsystems. +*/ +static const char *const altr_agilex5_irq_names[ALTR_AGILEX5_NUM_IRQS ] = { + [ALTR_AGILEX5_IRQ_GLOBAL_SBE ] ="global_sbe" , + [ALTR_AGILEX5_IRQ_GLOBAL_DBE ] ="global_dbe" , + [ALTR_AGILEX5_IRQ_IO96B0 ] ="io96b0" , + [ALTR_AGILEX5_IRQ_IO96B1 ] ="io96b1" , + [ALTR_AGILEX5_IRQ_SDM_QSPI_SBE ] ="sdm_qspi_sbe" , + [ALTR_AGILEX5_IRQ_SDM_QSPI_DBE ] ="sdm_qspi_dbe" , + [ALTR_AGILEX5_IRQ_SDM_SEU ] ="sdm_seu" , +}; + +/* +* Populate edac->agilex5_irqs[] from the named interrupts on the manager +* platform device. Missing optional interrupts are stored as a negative +* errno (-ENXIO) so that subsequent feature code can probe whether the +* resource exists. global_sbe is required because it drives the manager's +* IRQ domain dispatch path. +* +* platform_get_irq_byname_optional() can return -EPROBE_DEFER when the +* parent irqchip (e.g. the GIC) is not yet probed. Propagate that error +* up so the kernel re-tries the probe later instead of permanently +* disabling the named interrupt. +*/ +static int altr_agilex5_get_named_irqs (struct platform_device *pdev, +struct altr_arria10_edac *edac) +{ +int i, irq; + +for (i =0 ; i <ALTR_AGILEX5_NUM_IRQS ; i++) { + irq =platform_get_irq_byname_optional (pdev, + altr_agilex5_irq_names[i]); +if (irq == -EPROBE_DEFER ) +return -EPROBE_DEFER ; + + edac->agilex5_irqs[i] = irq >0 ? irq : -ENXIO ; + } + +if (edac->agilex5_irqs[ALTR_AGILEX5_IRQ_GLOBAL_SBE ] <0 ) { +dev_err (&pdev->dev, +"Agilex5 ECC manager missing required 'global_sbe' interrupt\n" ); +return -EINVAL ; + } + +return 0 ; +} +/****************** Arria 10 EDAC Probe Function *********************/ static int altr_edac_a10_probe (struct platform_device *pdev) {struct altr_arria10_edac *edac;struct device_node *child; +int rc; edac =devm_kzalloc (&pdev->dev,sizeof (*edac),GFP_KERNEL );if (!edac)
@@ -2147,14 +2199,32 @@ static int altr_edac_a10_probe(struct platform_device *pdev)return -ENOMEM ; } - edac->sb_irq =platform_get_irq (pdev,0 ); -if (edac->sb_irq <0 ) -return edac->sb_irq; +if (edac->flag ==SOCFPGA_AGILEX5 ) { + rc =altr_agilex5_get_named_irqs (pdev, edac); +if (rc) { +irq_domain_remove (edac->domain); +return rc; + } + + edac->sb_irq = edac->agilex5_irqs[ALTR_AGILEX5_IRQ_GLOBAL_SBE ]; + }else { + edac->sb_irq =platform_get_irq (pdev,0 ); +if (edac->sb_irq <0 ) +return edac->sb_irq; + }irq_set_chained_handler_and_data (edac->sb_irq, altr_edac_a10_irq_handler, edac); +/* +* Unlike Stratix10/Agilex7 (which deliver uncorrectable errors as +* Asynchronous SError), Agilex5 routes the global double-bit error +* through a dedicated SPI ("global_dbe"). Hook it into the same +* chained handler so the existing sb_irq/db_irq demux in +* altr_edac_a10_irq_handler() routes DBE events through the manager's +* IRQ domain. +*/ if (edac->flag ==SOCFPGA_S10 ) {int dberror, err_addr;
@@ -2177,13 +2247,19 @@ static int altr_edac_a10_probe(struct platform_device *pdev)regmap_write (edac->ecc_mgr_map,S10_SYSMGR_UE_ADDR_OFST ,0 ); } - }else { + }else if (edac->flag ==SOCFPGA_A10 ) { edac->db_irq =platform_get_irq (pdev,1 );if (edac->db_irq <0 )return edac->db_irq;irq_set_chained_handler_and_data (edac->db_irq, altr_edac_a10_irq_handler, edac); + }else if (edac->flag ==SOCFPGA_AGILEX5 && + edac->agilex5_irqs[ALTR_AGILEX5_IRQ_GLOBAL_DBE ] >=0 ) { + edac->db_irq = edac->agilex5_irqs[ALTR_AGILEX5_IRQ_GLOBAL_DBE ]; +irq_set_chained_handler_and_data (edac->db_irq, + altr_edac_a10_irq_handler, + edac); }for_each_child_of_node (pdev->dev.of_node, child) {
@@ -2209,6 +2285,8 @@ static const struct of_device_id altr_edac_a10_of_match[] = { .data = (void *)SOCFPGA_A10 }, { .compatible = "altr,socfpga-s10-ecc-manager", .data = (void *)SOCFPGA_S10 }, + { .compatible = "altr,socfpga-agilex5-ecc-manager", + .data = (void *)SOCFPGA_AGILEX5 }, {}, };MODULE_DEVICE_TABLE (of, altr_edac_a10_of_match);
drivers/edac/altera_edac.h +29 -0
@@ -326,6 +326,27 @@ struct altr_sdram_mc_data {#define S10_DDR0_IRQ_MASK BIT(16)#define S10_DBE_IRQ_MASK 0x3FFFE +/************* Agilex5 Defines **************/ +/* +* The Agilex5 ECC manager exposes up to 7 named interrupts on the manager +* node. global_sbe and global_dbe are aggregate single/double-bit error +* interrupts that fan-out through the manager's IRQ domain to the child +* peripheral ECCs. The remaining named interrupts are routed directly from +* dedicated controllers (IO96B memory controllers and Secure Device Manager) +* to the GIC. +*/ +#define ALTR_AGILEX5_NUM_IRQS 7 + +enum altr_agilex5_irq_idx { +ALTR_AGILEX5_IRQ_GLOBAL_SBE , +ALTR_AGILEX5_IRQ_GLOBAL_DBE , +ALTR_AGILEX5_IRQ_IO96B0 , +ALTR_AGILEX5_IRQ_IO96B1 , +ALTR_AGILEX5_IRQ_SDM_QSPI_SBE , +ALTR_AGILEX5_IRQ_SDM_QSPI_DBE , +ALTR_AGILEX5_IRQ_SDM_SEU , +}; +/* Define ECC Block Offsets for peripherals */ #define ECC_BLK_ADDRESS_OFST 0x40#define ECC_BLK_RDATA0_OFST 0x44
@@ -401,6 +422,14 @@ struct altr_arria10_edac {struct list_head a10_ecc_devices;struct notifier_block panic_notifier;unsigned long flag; + +/* +* Agilex5 ECC manager supports up to 7 named interrupts. Entries +* are indexed by the altr_agilex5_irq_idx enum and hold the virtual +* IRQ number, or a negative errno when the corresponding interrupt +* was not provided in the device tree. +*/ + int agilex5_irqs[ALTR_AGILEX5_NUM_IRQS]; };#endif /* #ifndef _ALTERA_EDAC_H */
Signature · 1 line
2.42.0.411.g813d9a9188
Dinh Nguyen
maintainerPATCH v3 4/4 arm64: dts: socfpga: agilex5: add support for the ECC manager
In reply to Dinh NguyenAdd the ECC manager to the base Agilex5 dtsi, along with OCRAM ECC and RX/TX ECC for EMAC0, EMAC1, and EMAC2.
The eccmgr node is an interrupt aggregator, not an MMIO device. Its INTMASK and INTSTAT registers live in the System Manager, and the driver reaches them through altr,sysmgr-syscon, so the node has no reg property and no unit address.
The OCRAM and EMAC children are MMIO devices, each at its own ECC controller address. #address-cells, #size-cells, and ranges translate those addresses onto CPU physical addresses. ranges does not give the manager its own window.
The children stay under eccmgr because they are clients of its irqchip. The Agilex5 manager binds to altr_edac_a10_probe(), which walks the child nodes and uses one IRQ domain for the per-RAM blocks.
---
v3: no changes
v2: add more context to commit message
move eccmgr out of soc node
s/38/36 for emac0-rx
--- .../boot/dts/altera/socfpga_agilex5.dtsi | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+)
arch/arm64/boot/dts/altera/socfpga_agilex5.dtsi +69 -0
@@ -160,6 +160,75 @@ qspi_clk: qspi-clk { }; }; + eccmgr { + compatible = "altr,socfpga-agilex5-ecc-manager", + "altr,socfpga-a10-ecc-manager"; + altr,sysmgr-syscon = <&sysmgr>; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&intc>; + interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 241 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 95 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 120 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "global_sbe", "global_dbe", "io96b0" , "io96b1", + "sdm_qspi_sbe", "sdm_qspi_dbe", "sdm_seu"; + interrupt-controller; + #interrupt-cells = <2>; + ranges = <0 0 0 0xffffffff>; + + ocram-ecc@108cc000 { + compatible = "altr,socfpga-a10-ocram-ecc"; + reg = <0x108cc000 0x100>; + interrupts = <1 IRQ_TYPE_LEVEL_HIGH>, <33 IRQ_TYPE_LEVEL_HIGH>; + }; + + emac0-rx-ecc@108c0000 { + compatible = "altr,socfpga-eth-mac-ecc"; + reg = <0x108c0000 0x100>; + altr,ecc-parent = <&gmac0>; + interrupts = <4 IRQ_TYPE_LEVEL_HIGH>, <36 IRQ_TYPE_LEVEL_HIGH>; + }; + + emac0-tx-ecc@108c0400 { + compatible = "altr,socfpga-eth-mac-ecc"; + reg = <0x108c0400 0x100>; + altr,ecc-parent = <&gmac0>; + interrupts = <5 IRQ_TYPE_LEVEL_HIGH>, <37 IRQ_TYPE_LEVEL_HIGH>; + }; + + emac1-rx-ecc@108c0800 { + compatible = "altr,socfpga-eth-mac-ecc"; + reg = <0x108c0800 0x100>; + altr,ecc-parent = <&gmac1>; + interrupts = <6 IRQ_TYPE_LEVEL_HIGH>, <38 IRQ_TYPE_LEVEL_HIGH>; + }; + + emac1-tx-ecc@108c0c00 { + compatible = "altr,socfpga-eth-mac-ecc"; + reg = <0x108c0c00 0x100>; + altr,ecc-parent = <&gmac1>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH>, <39 IRQ_TYPE_LEVEL_HIGH>; + }; + + emac2-rx-ecc@108c1000 { + compatible = "altr,socfpga-eth-mac-ecc"; + reg = <0x108c1000 0x100>; + altr,ecc-parent = <&gmac2>; + interrupts = <8 IRQ_TYPE_LEVEL_HIGH>, <40 IRQ_TYPE_LEVEL_HIGH>; + }; + + emac2-tx-ecc@108c1400 { + compatible = "altr,socfpga-eth-mac-ecc"; + reg = <0x108c1400 0x100>; + altr,ecc-parent = <&gmac2>; + interrupts = <9 IRQ_TYPE_LEVEL_HIGH>, <41 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + timer { compatible = "arm,armv8-timer"; interrupt-parent = <&intc>;
Signature · 1 line
2.42.0.411.g813d9a9188
[email protected]
AI reviewRe: [PATCHv3 4/4] arm64: dts: socfpga: agilex5: add support for the ECC manager
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] arm64: dts: socfpga: eccmgr node violates altr,socfpga-ecc-manager binding --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] arm64: dts: socfpga: eccmgr node violates altr,socfpga-ecc-manager binding
--
commit 2d0a9122ec3d7d762cb61c5759aa15895402f73d
Author: Dinh Nguyen <[email protected]>
arm64: dts: socfpga: agilex5: add support for the ECC manager
This commit adds the ECC manager node and child ECC nodes for OCRAM and EMAC0/1/2 to the Agilex5 base device tree.
Quoted 14 lines
arch/arm64/boot/dts/altera/socfpga_agilex5.dtsi +6
-0@@ -160,6 +160,75 @@ qspi_clk: qspi-clk { }; }; + eccmgr { + compatible = "altr,socfpga-agilex5-ecc-manager", + "altr,socfpga-a10-ecc-manager"; + altr,sysmgr-syscon = <&sysmgr>; + #address-cells = <1>; + #size-cells = <1>;
arch/arm64/boot/dts/altera/socfpga_agilex5.dtsi qspi_clk: qspi-clk { · line 178
Quoted 10 lines
arch/arm64/boot/dts/altera/socfpga_agilex5.dtsi +10
-0+ interrupt-parent = <&intc>; + interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 241 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 95 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 120 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "global_sbe", "global_dbe", "io96b0" , "io96b1", + "sdm_qspi_sbe", "sdm_qspi_dbe", "sdm_seu";
[Severity: Low]
Does this eccmgr node fail make dtbs_check against Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml?
Matching "altr,socfpga-a10-ecc-manager" selects that schema, which does not document "altr,socfpga-agilex5-ecc-manager" in compatible, limits interrupts to maxItems: 2 rather than 7, and rejects interrupt-names under
additionalProperties: false.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1