From: Michal Simek <michal.simek@xilinx.com>
To: Dinh Nguyen <dinguyen@kernel.org>, <michal.simek@xilinx.com>
Cc: <bp@alien8.de>, <mchehab@kernel.org>, <tony.luck@intel.com>,
<james.morse@arm.com>, <rric@kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-edac@vger.kernel.org>
Subject: Re: [PATCHv3 2/3] EDAC/synopsys: add support for version 3 of the Synopsys EDAC DDR
Date: Thu, 30 Sep 2021 11:28:27 +0200 [thread overview]
Message-ID: <99ddd699-5fa4-068b-4648-fe6d34a36b5d@xilinx.com> (raw)
In-Reply-To: <20210928160423.271187-2-dinguyen@kernel.org>
On 9/28/21 6:04 PM, Dinh Nguyen wrote:
> 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 default
>
> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
> ---
> 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(-)
>
> diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c
> index bf237fccb444..66ee37ea0acc 100644
> --- a/drivers/edac/synopsys_edac.c
> +++ b/drivers/edac/synopsys_edac.c
> @@ -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 */
> }
>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Thanks,
Michal
next prev parent reply other threads:[~2021-09-30 9:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 16:04 [PATCHv3 1/3] EDAC/synopsys: use the quirk for version instead of ddr version Dinh Nguyen
2021-09-28 16:04 ` [PATCHv3 2/3] EDAC/synopsys: add support for version 3 of the Synopsys EDAC DDR Dinh Nguyen
2021-09-30 9:28 ` Michal Simek [this message]
2021-09-30 11:41 ` Borislav Petkov
2021-09-30 14:02 ` Dinh Nguyen
2021-09-28 16:04 ` [PATCHv3 3/3] EDAC/synopsys: v3.80a of the synopsys edac contoller is also on the N5X Dinh Nguyen
2021-09-30 9:28 ` Michal Simek
2021-09-30 9:28 ` [PATCHv3 1/3] EDAC/synopsys: use the quirk for version instead of ddr version Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=99ddd699-5fa4-068b-4648-fe6d34a36b5d@xilinx.com \
--to=michal.simek@xilinx.com \
--cc=bp@alien8.de \
--cc=dinguyen@kernel.org \
--cc=james.morse@arm.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rric@kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).