EDAC/synopsys: use the quirk for version instead of ddr version
Subsystems (2)
PATCH v3 2/3 EDAC/synopsys: add support for version 3 of the Synopsys EDAC DDR
In reply to Dinh NguyenAdds support for version 3.80a of the Synopsys DDR controller with EDAC. This version of the controller has the following differences:
- UE/CE are auto cleared
- Interrupts are supported by default
---
v3: Address comments from Michal Simek
use bit macro
removed extra "cleared" word from comment section about v3.0
v2: remove "This patch" from commit message
--- drivers/edac/synopsys_edac.c | 49 ++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-)
drivers/edac/synopsys_edac.c +42 -7
@@ -101,6 +101,7 @@/* DDR ECC Quirks */ #define DDR_ECC_INTR_SUPPORT BIT(0)#define DDR_ECC_DATA_POISON_SUPPORT BIT(1) +#define DDR_ECC_INTR_SELF_CLEAR BIT(2)/* ZynqMP Enhanced DDR memory controller registers that are relevant to ECC */ /* ECC Configuration Registers */
@@ -171,6 +172,10 @@#define DDR_QOS_IRQ_EN_OFST 0x20208#define DDR_QOS_IRQ_DB_OFST 0x2020C +/* DDR QOS Interrupt register definitions */ +#define DDR_UE_MASK BIT(9) +#define DDR_CE_MASK BIT(8) +/* ECC Corrected Error Register Mask and Shifts*/ #define ECC_CEADDR0_RW_MASK 0x3FFFF#define ECC_CEADDR0_RNK_MASK BIT(24)
@@ -533,10 +538,16 @@ static irqreturn_t intr_handler(int irq, void *dev_id) priv = mci->pvt_info; p_data = priv->p_data; - regval =readl (priv->baseaddr +DDR_QOS_IRQ_STAT_OFST ); - regval &= (DDR_QOSCE_MASK |DDR_QOSUE_MASK ); -if (!(regval &ECC_CE_UE_INTR_MASK )) -return IRQ_NONE ; +/* +* v3.0 of the controller has the ce/ue bits cleared automatically, +* so this condition does not apply. +*/ +if (!(priv->p_data->quirks &DDR_ECC_INTR_SELF_CLEAR )) { + regval =readl (priv->baseaddr +DDR_QOS_IRQ_STAT_OFST ); + regval &= (DDR_QOSCE_MASK |DDR_QOSUE_MASK ); +if (!(regval &ECC_CE_UE_INTR_MASK )) +return IRQ_NONE ; + } status = p_data->get_error_info (priv);if (status)
@@ -548,7 +559,9 @@ static irqreturn_t intr_handler(int irq, void *dev_id)edac_dbg (3 ,"Total error count CE %d UE %d\n" , priv->ce_cnt, priv->ue_cnt); -writel (regval, priv->baseaddr +DDR_QOS_IRQ_STAT_OFST ); +/* v3.0 of the controller does not have this register */ +if (!(priv->p_data->quirks &DDR_ECC_INTR_SELF_CLEAR )) +writel (regval, priv->baseaddr +DDR_QOS_IRQ_STAT_OFST );return IRQ_HANDLED ; }
@@ -834,8 +847,13 @@ static void mc_init(struct mem_ctl_info *mci, struct platform_device *pdev)static void enable_intr (struct synps_edac_priv *priv) {/* Enable UE/CE Interrupts */ -writel (DDR_QOSUE_MASK |DDR_QOSCE_MASK , - priv->baseaddr +DDR_QOS_IRQ_EN_OFST ); +if (priv->p_data->quirks &DDR_ECC_INTR_SELF_CLEAR ) +writel (DDR_UE_MASK |DDR_CE_MASK , + priv->baseaddr +ECC_CLR_OFST ); +else +writel (DDR_QOSUE_MASK |DDR_QOSCE_MASK , + priv->baseaddr +DDR_QOS_IRQ_EN_OFST ); + }static void disable_intr (struct synps_edac_priv *priv)
@@ -890,6 +908,19 @@ static const struct synps_platform_data zynqmp_edac_def = { ), }; +static const struct synps_platform_data synopsys_edac_def = { + .get_error_info = zynqmp_get_error_info, + .get_mtype = zynqmp_get_mtype, + .get_dtype = zynqmp_get_dtype, + .get_ecc_state = zynqmp_get_ecc_state, + .quirks = (DDR_ECC_INTR_SUPPORT |DDR_ECC_INTR_SELF_CLEAR +#ifdef CONFIG_EDAC_DEBUG + |DDR_ECC_DATA_POISON_SUPPORT +#endif + ), +}; + +static const struct of_device_id synps_edac_match[] = { { .compatible ="xlnx,zynq-ddrc-a05" ,
@@ -899,6 +930,10 @@ static const struct of_device_id synps_edac_match[] = { .compatible = "xlnx,zynqmp-ddrc-2.40a", .data = (void *)&zynqmp_edac_def }, + { + .compatible = "snps,ddrc-3.80a", + .data = (void *)&synopsys_edac_def + }, {/* end of table */ }
Signature · 1 line
2.25.1
PATCH v3 1/3 EDAC/synopsys: use the quirk for version instead of ddr version
Version 2.40a supports DDR_ECC_INTR_SUPPORT for a quirk, so use that quirk to determine a call to setup_address_map().
---
v3: new patch
--- drivers/edac/synopsys_edac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/edac/synopsys_edac.c +1 -2
@@ -1352,8 +1352,7 @@ static int mc_probe(struct platform_device *pdev) } } -if (of_device_is_compatible (pdev->dev.of_node, -"xlnx,zynqmp-ddrc-2.40a" )) +if (priv->p_data->quirks &DDR_ECC_INTR_SUPPORT )setup_address_map (priv);#endif
Signature · 1 line
2.25.1
PATCH v3 3/3 EDAC/synopsys: v3.80a of the synopsys edac contoller is also on the N5X
Intel's N5X platform is also using the Synopsys EDAC controller.
---
v3: s/ARCH_N5X/ARCH_INTEL_SOCFPGA
v2: no changes
--- drivers/edac/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/Kconfig +1 -1
@@ -484,7 +484,7 @@ config EDAC_ARMADA_XP config EDAC_SYNOPSYS tristate "Synopsys DDR Memory Controller" - depends on ARCH_ZYNQ || ARCH_ZYNQMP + depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_INTEL_SOCFPGA help Support for error detection and correction on the Synopsys DDR memory controller.
Signature · 1 line
2.25.1
Quoted 16 lines · Dinh Nguyen
Version 2.40a supports
DDR_ECC_INTR_SUPPORTfor a quirk, so use that quirk to determine a call tosetup_address_map().Signed-off-by Dinh Nguyen <[email protected]>---
v3: new patch--- drivers/edac/synopsys_edac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/edac/synopsys_edac.c +0
-0
drivers/edac/synopsys_edac.c static int mc_probe(struct platform_device *pdev) · line 1358
Quoted 9 lines
drivers/edac/synopsys_edac.c +1
-2@@ -1352,8 +1352,7 @@ static int mc_probe(struct platform_device *pdev) } } -if (of_device_is_compatible (pdev->dev.of_node, -"xlnx,zynqmp-ddrc-2.40a" )) +if (priv->p_data->quirks &DDR_ECC_INTR_SUPPORT )setup_address_map (priv);#endif
Thanks,
Michal
Re: [PATCHv3 2/3] EDAC/synopsys: add support for version 3 of the Synopsys EDAC DDR
In reply to Dinh NguyenQuoted 109 lines · Dinh Nguyen
Adds support for version 3.80a of the Synopsys DDR controller with EDAC. This version of the controller has the following differences:
- UE/CE are auto cleared
- Interrupts are supported by defaultSigned-off-by Dinh Nguyen <[email protected]>---
v3: Address comments from Michal Simek
use bit macro
removed extra "cleared" word from comment section about v3.0
v2: remove "This patch" from commit message--- drivers/edac/synopsys_edac.c | 49 ++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-)drivers/edac/synopsys_edac.c +38
-7@@ -101,6 +101,7 @@/* DDR ECC Quirks */ #define DDR_ECC_INTR_SUPPORT BIT(0)#define DDR_ECC_DATA_POISON_SUPPORT BIT(1) +#define DDR_ECC_INTR_SELF_CLEAR BIT(2)/* ZynqMP Enhanced DDR memory controller registers that are relevant to ECC */ /* ECC Configuration Registers */ @@ -171,6 +172,10 @@#define DDR_QOS_IRQ_EN_OFST 0x20208#define DDR_QOS_IRQ_DB_OFST 0x2020C +/* DDR QOS Interrupt register definitions */ +#define DDR_UE_MASK BIT(9) +#define DDR_CE_MASK BIT(8) +/* ECC Corrected Error Register Mask and Shifts*/ #define ECC_CEADDR0_RW_MASK 0x3FFFF#define ECC_CEADDR0_RNK_MASK BIT(24)@@ -533,10 +538,16 @@ static irqreturn_t intr_handler(int irq, void *dev_id) priv = mci->pvt_info; p_data = priv->p_data; - regval =readl (priv->baseaddr +DDR_QOS_IRQ_STAT_OFST ); - regval &= (DDR_QOSCE_MASK |DDR_QOSUE_MASK ); -if (!(regval &ECC_CE_UE_INTR_MASK )) -return IRQ_NONE ; +/* +* v3.0 of the controller has the ce/ue bits cleared automatically, +* so this condition does not apply. +*/ +if (!(priv->p_data->quirks &DDR_ECC_INTR_SELF_CLEAR )) { + regval =readl (priv->baseaddr +DDR_QOS_IRQ_STAT_OFST ); + regval &= (DDR_QOSCE_MASK |DDR_QOSUE_MASK ); +if (!(regval &ECC_CE_UE_INTR_MASK )) +return IRQ_NONE ; + } status = p_data->get_error_info (priv);if (status)@@ -548,7 +559,9 @@ static irqreturn_t intr_handler(int irq, void *dev_id)edac_dbg (3 ,"Total error count CE %d UE %d\n" , priv->ce_cnt, priv->ue_cnt); -writel (regval, priv->baseaddr +DDR_QOS_IRQ_STAT_OFST ); +/* v3.0 of the controller does not have this register */ +if (!(priv->p_data->quirks &DDR_ECC_INTR_SELF_CLEAR )) +writel (regval, priv->baseaddr +DDR_QOS_IRQ_STAT_OFST );return IRQ_HANDLED ; }@@ -834,8 +847,13 @@ static void mc_init(struct mem_ctl_info *mci, struct platform_device *pdev)static void enable_intr (struct synps_edac_priv *priv) {/* Enable UE/CE Interrupts */ -writel (DDR_QOSUE_MASK |DDR_QOSCE_MASK , - priv->baseaddr +DDR_QOS_IRQ_EN_OFST ); +if (priv->p_data->quirks &DDR_ECC_INTR_SELF_CLEAR ) +writel (DDR_UE_MASK |DDR_CE_MASK , + priv->baseaddr +ECC_CLR_OFST ); +else +writel (DDR_QOSUE_MASK |DDR_QOSCE_MASK , + priv->baseaddr +DDR_QOS_IRQ_EN_OFST ); + }static void disable_intr (struct synps_edac_priv *priv)@@ -890,6 +908,19 @@ static const struct synps_platform_data zynqmp_edac_def = { ), }; +static const struct synps_platform_data synopsys_edac_def = { + .get_error_info = zynqmp_get_error_info, + .get_mtype = zynqmp_get_mtype, + .get_dtype = zynqmp_get_dtype, + .get_ecc_state = zynqmp_get_ecc_state, + .quirks = (DDR_ECC_INTR_SUPPORT |DDR_ECC_INTR_SELF_CLEAR +#ifdef CONFIG_EDAC_DEBUG + |DDR_ECC_DATA_POISON_SUPPORT +#endif + ), +}; + +static const struct of_device_id synps_edac_match[] = { { .compatible ="xlnx,zynq-ddrc-a05" ,
drivers/edac/synopsys_edac.c static const struct of_device_id synps_edac_match[] = { · line 939
Quoted 10 lines
drivers/edac/synopsys_edac.c +4
-0@@ -899,6 +930,10 @@ static const struct of_device_id synps_edac_match[] = { .compatible = "xlnx,zynqmp-ddrc-2.40a", .data = (void *)&zynqmp_edac_def }, + { + .compatible = "snps,ddrc-3.80a", + .data = (void *)&synopsys_edac_def + }, {/* end of table */ }
Thanks,
Michal
Re: [PATCHv3 3/3] EDAC/synopsys: v3.80a of the synopsys edac contoller is also on the N5X
In reply to Dinh NguyenQuoted 16 lines · Dinh Nguyen
Intel's N5X platform is also using the Synopsys EDAC controller.
Signed-off-by Dinh Nguyen <[email protected]>---
v3: s/ARCH_N5X/ARCH_INTEL_SOCFPGA
v2: no changes--- drivers/edac/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/edac/Kconfig +0
-0
drivers/edac/Kconfig config EDAC_ARMADA_XP · line 490
Quoted 8 lines
drivers/edac/Kconfig +1
-1@@ -484,7 +484,7 @@ config EDAC_ARMADA_XP config EDAC_SYNOPSYS tristate "Synopsys DDR Memory Controller" - depends on ARCH_ZYNQ || ARCH_ZYNQMP + depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_INTEL_SOCFPGA help Support for error detection and correction on the Synopsys DDR memory controller.
Thanks,
Michal
Borislav Petkov
maintainerRe: [PATCHv3 2/3] EDAC/synopsys: add support for version 3 of the Synopsys EDAC DDR
In reply to Dinh Nguyendrivers/edac/synopsys_edac.c static const struct of_device_id synps_edac_match[] = { · line 934
Quoted 6 lines · Dinh Nguyen
drivers/edac/synopsys_edac.c +2
-0@@ -899,6 +930,10 @@ static const struct of_device_id synps_edac_match[] = { .compatible = "xlnx,zynqmp-ddrc-2.40a", .data = (void *)&zynqmp_edac_def }, + { + .compatible = "snps,ddrc-3.80a",
WARNING: DT compatible string "snps,ddrc-3.80a" appears un-documented -- check ./Documentation/devicetree/bindings/ #169: FILE: drivers/edac/synopsys_edac.c:934:
+ .compatible = "snps,ddrc-3.80a",
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCHv3 2/3] EDAC/synopsys: add support for version 3 of the Synopsys EDAC DDR
Quoted 12 lines · Borislav Petkov
drivers/edac/synopsys_edac.c static const struct of_device_id synps_edac_match[] = { · line 934
Quoted 6 lines · Dinh Nguyen
drivers/edac/synopsys_edac.c +2
-0@@ -899,6 +930,10 @@ static const struct of_device_id synps_edac_match[] = { .compatible = "xlnx,zynqmp-ddrc-2.40a", .data = (void *)&zynqmp_edac_def }, + { + .compatible = "snps,ddrc-3.80a",WARNING: DT compatible string "snps,ddrc-3.80a" appears un-documented -- check
./Documentation/devicetree/bindings/#169: FILE:drivers/edac/synopsys_edac.c:934:
+ .compatible = "snps,ddrc-3.80a",
I'll send a follow-up patch to document this.
Dinh