From patchwork Fri Feb 21 06:39:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 11395659 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F9CB14E3 for ; Fri, 21 Feb 2020 06:47:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5DC9720722 for ; Fri, 21 Feb 2020 06:47:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u4GxBCA+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DC9720722 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=24Sr1dX3qtdr/3YfowZ6LHhNGtZeoMqkWwOHAFEA3jI=; b=u4GxBCA+9DweCZn9Cy6cqJVZpH sLzH4l+HX59pqRwmPMF1QVgTUTkze45NhyaFDF8q1rRboy5VQwb3TrzFE+ex83TWlzAfQSx3l9PdU iwhzWAySSp21ZOWwYtbsE6PkfNW6kmQA6q1g32+7v//6kP386Da77BovajzT+/PuhLC1Ln9vG8x2D aeDy7WoZck+tLlpZtmbJTMQYHGF9imQ/BPtxAABLNkoAnLTkbM89C555W/UzM3psPmVny9w7q0T3J QdIj+Uu1HKn/c7ZcZ+kiGnRdNlYlDs9Vn+1gqEwLV4STd0WplCJ5enQ2+Ghs4pYoTfSoB2HS/atpy bTUISwxQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j525g-00085u-Id; Fri, 21 Feb 2020 06:47:12 +0000 Received: from inva021.nxp.com ([92.121.34.21]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j525d-00083u-Gp for linux-arm-kernel@lists.infradead.org; Fri, 21 Feb 2020 06:47:10 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 20DF6206B9D; Fri, 21 Feb 2020 07:47:08 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 2A932206BAE; Fri, 21 Feb 2020 07:47:00 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 5D98940381; Fri, 21 Feb 2020 14:46:06 +0800 (SGT) From: sherry sun To: bp@alien8.de, mchehab@kernel.org, tony.luck@intel.com, james.morse@arm.com, rrichter@marvell.com, michal.simek@xilinx.com, shawnguo@kernel.org, s.hauer@pengutronix.de, robh+dt@kernel.org, mark.rutland@arm.com Subject: [PATCH 1/3] dt-bindings: memory-controllers: Add i.MX8MP DDRC binding doc Date: Fri, 21 Feb 2020 14:39:14 +0800 Message-Id: <1582267156-20189-2-git-send-email-sherry.sun@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582267156-20189-1-git-send-email-sherry.sun@nxp.com> References: <1582267156-20189-1-git-send-email-sherry.sun@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200220_224709_704982_012F6CAC X-CRM114-Status: UNSURE ( 7.06 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [92.121.34.21 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, frank.li@nxp.com, linux-kernel@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Sherry Sun Add documentation for i.MX8MP DDRC binding based on synopsys_edac doc, which use the same memory-controller IP. Signed-off-by: Sherry Sun Reviewed-by: Rob Herring --- .../devicetree/bindings/memory-controllers/synopsys.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/memory-controllers/synopsys.txt b/Documentation/devicetree/bindings/memory-controllers/synopsys.txt index 9d32762c47e1..5c03959a451f 100644 --- a/Documentation/devicetree/bindings/memory-controllers/synopsys.txt +++ b/Documentation/devicetree/bindings/memory-controllers/synopsys.txt @@ -6,16 +6,20 @@ bus width configurations. The Zynq DDR ECC controller has an optional ECC support in half-bus width (16-bit) configuration. -These both ECC controllers correct single bit ECC errors and detect double bit +The i.MX8MP DDR ECC controller has an ECC support in 64-bit bus width +configurations. + +These all ECC controllers correct single bit ECC errors and detect double bit ECC errors. Required properties: - compatible: One of: - 'xlnx,zynq-ddrc-a05' : Zynq DDR ECC controller - 'xlnx,zynqmp-ddrc-2.40a' : ZynqMP DDR ECC controller + - 'fsl,imx8mp-ddrc' : i.MX8MP DDR ECC controller - reg: Should contain DDR controller registers location and length. -Required properties for "xlnx,zynqmp-ddrc-2.40a": +Required properties for "xlnx,zynqmp-ddrc-2.40a" and "fsl,imx8mp-ddrc": - interrupts: Property with a value describing the interrupt number. Example: From patchwork Fri Feb 21 06:39:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 11395665 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCBC214E3 for ; Fri, 21 Feb 2020 06:47:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA93B24650 for ; Fri, 21 Feb 2020 06:47:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qhsJvq0J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA93B24650 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=eBn9Zj7+SXrB9cbASOdPpjiZKvUXThfZQJ+U7RzYerY=; b=qhsJvq0JoHLLnfcW2aH8XAd2aP 2pyJwYWRj7JZnsQyqgpgkw7iu7xm5KvexLY6AOR2JhMWXJeLbyNiW+oL5HRfmzX4zQj0WTSe24VzF lVYzYVn9obQ0YPMUgzOEwMUELa4PLPU2aLe04bae+U+1+RwbDhJd/Hp0ZBjSsyzK2h2b6wLLsibCd u7i3378cW2cwZdG/tKpimBpGuZtKUBMvZDT+OmPrfLZZu5C5VBMMv/jWr4o9zsWpXnGFcUj9/rklv 48WmJNF42B069U+5eVGt9S2VbOj0wC3g975aiXzn1HHGqpb0oO9lf2D1S5IdaeyfoJ/uJ6l1n0Hg1 FLu5jEoQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j5262-0008Pp-1m; Fri, 21 Feb 2020 06:47:34 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j525i-000877-HH for linux-arm-kernel@lists.infradead.org; Fri, 21 Feb 2020 06:47:15 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 1D8891A6D94; Fri, 21 Feb 2020 07:47:12 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 27D6D1A6D8D; Fri, 21 Feb 2020 07:47:04 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 97AF64042D; Fri, 21 Feb 2020 14:46:08 +0800 (SGT) From: sherry sun To: bp@alien8.de, mchehab@kernel.org, tony.luck@intel.com, james.morse@arm.com, rrichter@marvell.com, michal.simek@xilinx.com, shawnguo@kernel.org, s.hauer@pengutronix.de, robh+dt@kernel.org, mark.rutland@arm.com Subject: [PATCH 2/3] EDAC: Add synopsys edac driver support for i.MX8MP Date: Fri, 21 Feb 2020 14:39:15 +0800 Message-Id: <1582267156-20189-3-git-send-email-sherry.sun@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582267156-20189-1-git-send-email-sherry.sun@nxp.com> References: <1582267156-20189-1-git-send-email-sherry.sun@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200220_224714_726300_8C87AEEB X-CRM114-Status: UNSURE ( 8.94 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [92.121.34.13 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, frank.li@nxp.com, linux-kernel@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Sherry Sun The i.MX8MP has a memory controller supported by this driver. So here add edac driver for i.MX8MP based on synopsys edac driver. Signed-off-by: Sherry Sun --- drivers/edac/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig index fe2eb892a1bd..58a2d67d5513 100644 --- a/drivers/edac/Kconfig +++ b/drivers/edac/Kconfig @@ -475,7 +475,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_MXC help Support for error detection and correction on the Synopsys DDR memory controller. From patchwork Fri Feb 21 06:39:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sherry Sun X-Patchwork-Id: 11395669 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E01B1930 for ; Fri, 21 Feb 2020 06:48:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 88C4820722 for ; Fri, 21 Feb 2020 06:48:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lyKEm3+m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88C4820722 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1HZ1S5D2Y3SVXejC+MsO3/dyvXDgxXY8fuQXH52buvM=; b=lyKEm3+mfUVF8c5qXDcF0Fa49f hL6/V+y47dky0J76VLzuFelyuS1Q9uxaLPAbbvltrf8U/1grjNfEybQsDqNtK0MgulGzpmKQuUM9R 9L36XZv2679kETvtgXrmCxSG7595UETYmfsLaX7zyxDSdjv9rpZ1hC2RBiwwiDl+fbwJZIibixJ9u BgQInXd375EZLzFIZIoGvTF1Upuorg6IgmOlbS3lEa9SIJQpAQZeUYq/xgZLXKZFEy/v02ZupGyM3 nahU7ZSgl3l3PtOIiAlO1PzkSkmuGhqaRdEKyEZ35je88VdREYKK3128CuYvKNqK9Oho5XSobBAHh 6sCYYaYg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j526Y-0000Sh-IH; Fri, 21 Feb 2020 06:48:06 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j525m-0008AB-Ct for linux-arm-kernel@lists.infradead.org; Fri, 21 Feb 2020 06:47:20 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B69FE1A6D88; Fri, 21 Feb 2020 07:47:16 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8931A1A6D82; Fri, 21 Feb 2020 07:47:08 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id C85EB4043C; Fri, 21 Feb 2020 14:46:10 +0800 (SGT) From: sherry sun To: bp@alien8.de, mchehab@kernel.org, tony.luck@intel.com, james.morse@arm.com, rrichter@marvell.com, michal.simek@xilinx.com, shawnguo@kernel.org, s.hauer@pengutronix.de, robh+dt@kernel.org, mark.rutland@arm.com Subject: [PATCH 3/3] EDAC: synopsys: Add edac driver support for i.MX8MP Date: Fri, 21 Feb 2020 14:39:16 +0800 Message-Id: <1582267156-20189-4-git-send-email-sherry.sun@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582267156-20189-1-git-send-email-sherry.sun@nxp.com> References: <1582267156-20189-1-git-send-email-sherry.sun@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200220_224718_737972_0F483FA6 X-CRM114-Status: GOOD ( 12.00 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [92.121.34.13 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, frank.li@nxp.com, linux-kernel@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Sherry Sun Since i.MX8MP use synopsys ddr controller IP, so add edac support for i.MX8MP based on synopsys edac driver. i.MX8MP use LPDDR4 and support interrupts for corrected and uncorrected errors. The main difference between ZynqMP and i.MX8MP ddr controller is the interrupt registers. So add another interrupt handler function, enable/disable interrupt function to distinguish with ZynqMP. Signed-off-by: Sherry Sun --- drivers/edac/synopsys_edac.c | 77 +++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c index 2d263382d797..66c801502212 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_IMX8MP BIT(2) /* ZynqMP Enhanced DDR memory controller registers that are relevant to ECC */ /* ECC Configuration Registers */ @@ -266,6 +267,11 @@ #define RANK_B0_BASE 6 +/* ECCCTL UE/CE Interrupt enable/disable for IMX8MP*/ +#define DDR_CE_INTR_EN_MASK 0x100 +#define DDR_UE_INTR_EN_MASK 0x200 +#define ECC_INTR_MASK 0x10100 + /** * struct ecc_error_info - ECC error log information. * @row: Row number. @@ -524,6 +530,54 @@ static void handle_error(struct mem_ctl_info *mci, struct synps_ecc_status *p) memset(p, 0, sizeof(*p)); } +static void enable_intr_imx8mp(struct synps_edac_priv *priv) +{ + int regval; + + regval = readl(priv->baseaddr + ECC_CLR_OFST); + regval |= (DDR_CE_INTR_EN_MASK | DDR_UE_INTR_EN_MASK); + writel(regval, priv->baseaddr + ECC_CLR_OFST); +} + +static void disable_intr_imx8mp(struct synps_edac_priv *priv) +{ + int regval; + + regval = readl(priv->baseaddr + ECC_CLR_OFST); + regval &= ~(DDR_CE_INTR_EN_MASK | DDR_UE_INTR_EN_MASK); + writel(regval, priv->baseaddr + ECC_CLR_OFST); +} + +/* Interrupt Handler for ECC interrupts on imx8mp platform. */ +static irqreturn_t intr_handler_imx8mp(int irq, void *dev_id) +{ + const struct synps_platform_data *p_data; + struct mem_ctl_info *mci = dev_id; + struct synps_edac_priv *priv; + int status, regval; + + priv = mci->pvt_info; + p_data = priv->p_data; + + regval = readl(priv->baseaddr + ECC_STAT_OFST); + if (!(regval & ECC_INTR_MASK)) + return IRQ_NONE; + + status = p_data->get_error_info(priv); + if (status) + return IRQ_NONE; + + priv->ce_cnt += priv->stat.ce_cnt; + priv->ue_cnt += priv->stat.ue_cnt; + handle_error(mci, &priv->stat); + + edac_dbg(3, "Total error count CE %d UE %d\n", + priv->ce_cnt, priv->ue_cnt); + enable_intr_imx8mp(priv); + + return IRQ_HANDLED; +} + /** * intr_handler - Interrupt Handler for ECC interrupts. * @irq: IRQ number. @@ -541,6 +595,9 @@ static irqreturn_t intr_handler(int irq, void *dev_id) priv = mci->pvt_info; p_data = priv->p_data; + if (p_data->quirks & DDR_ECC_IMX8MP) + return intr_handler_imx8mp(irq, dev_id); + regval = readl(priv->baseaddr + DDR_QOS_IRQ_STAT_OFST); regval &= (DDR_QOSCE_MASK | DDR_QOSUE_MASK); if (!(regval & ECC_CE_UE_INTR_MASK)) @@ -817,7 +874,7 @@ static void mc_init(struct mem_ctl_info *mci, struct platform_device *pdev) platform_set_drvdata(pdev, mci); /* Initialize controller capabilities and configuration */ - mci->mtype_cap = MEM_FLAG_DDR3 | MEM_FLAG_DDR2; + mci->mtype_cap = MEM_FLAG_LRDDR4 | MEM_FLAG_DDR3 | MEM_FLAG_DDR2; mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED; mci->scrub_cap = SCRUB_HW_SRC; mci->scrub_mode = SCRUB_NONE; @@ -842,6 +899,9 @@ 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 */ + if (priv->p_data->quirks & DDR_ECC_IMX8MP) + return enable_intr_imx8mp(priv); + writel(DDR_QOSUE_MASK | DDR_QOSCE_MASK, priv->baseaddr + DDR_QOS_IRQ_EN_OFST); } @@ -849,6 +909,9 @@ static void enable_intr(struct synps_edac_priv *priv) static void disable_intr(struct synps_edac_priv *priv) { /* Disable UE/CE Interrupts */ + if (priv->p_data->quirks & DDR_ECC_IMX8MP) + return disable_intr_imx8mp(priv); + writel(DDR_QOSUE_MASK | DDR_QOSCE_MASK, priv->baseaddr + DDR_QOS_IRQ_DB_OFST); } @@ -898,6 +961,14 @@ static const struct synps_platform_data zynqmp_edac_def = { ), }; +static const struct synps_platform_data imx8mp_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_IMX8MP), +}; + static const struct of_device_id synps_edac_match[] = { { .compatible = "xlnx,zynq-ddrc-a05", @@ -907,6 +978,10 @@ static const struct of_device_id synps_edac_match[] = { .compatible = "xlnx,zynqmp-ddrc-2.40a", .data = (void *)&zynqmp_edac_def }, + { + .compatible = "fsl,imx8mp-ddrc", + .data = (void *)&imx8mp_edac_def + }, { /* end of table */ }