From patchwork Wed Oct 16 20:31:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13838899 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2070.outbound.protection.outlook.com [40.107.247.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5974D218308; Wed, 16 Oct 2024 20:31:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729110720; cv=fail; b=Ik9qQfDI9iQg06WXLHXbJAklA85fT49S7wU04IjUOjzEA0HpswjEsrAvC5DDhT2XPsVio2oKPjE5HY3kQB2egPQioqJ9YF98TOH8yUnLFdRiuQ7fH/jJjBjJoEmywNfgRrzAc0iZM/qZOrJ/draQrScyHa9JmKo47hfuiwv5F4U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729110720; c=relaxed/simple; bh=uQlwmIwixbrtiEhQ0s/EITjv87vXrYDoWoQrwUcKDC8=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=saw7Fd1A0PgulkmaC7IiSemIkxYtLIB3AinvVQ7Cu5OZu7aSpJGrbxxXpa++hqbfxuS/3wpccPJ78rV1XEH0HTeF9bZ1lSjF9d0rFQs3SSd81dmuDu7x/AkfxIoQrQ7FKfQ/h73jPT2rgq7wJgW97pIJvCbvcYMTvn73lK368ws= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=FTl8kDJn; arc=fail smtp.client-ip=40.107.247.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="FTl8kDJn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kq1wtsFJCWwBen3wXprQS+IpuXaVx6MtvFVuDQ1s20RbRHLkiKUFBf3+++cQtDJ4zWzrrAN3jR8RDBggEm6v4LTKHHTNw1Z/ZwI/heBcOGwKYyPTKKKmNG++sU+JzC/65Q8RNUxZlsOEkoKxIAs/EFajoJJXmkIe6iFl9+EPxCUMfgWiJVYTIwrxeij0Iu3AUqWeAn8Xml6v1jD566Vzcf3JwAg4EwDK//05iGFudAAjsyv41DFI4OS5bf82ibi2XltFmW9ccWYTZ9UjtU/9tD+KPcmMMgYuWJcA0hwypcYwcZQwvfS3OYEqpppRKMPEggQ27xrHS1FSyrirZ/TMZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=in5RvYSFRwXmI05RdH8h/gSXJgH6cbfzuJX+7Y0Tn5s=; b=psWdpb4j2nk9Q4jyJDR5bPKwHtb8TmTvfyh0PBKXBSxOC1VSFH/Uo+SQtR23NCBZsQ/kdhUt23KJxUZz0U/FQVh74YyfN9VKkeQGFzoi6Ul6S0I8dw0nkT1b3fckg0pmUhTZwJzJXlHzCRUFoJAm8HuMF1dhNVNGH75y7aYLwE5sCle/LzbQ1AZAUW9lNbZ8xlxYu8deTAwP+V6UuoUZo7MuIrH6AnQArrh37B2SFZEvjzRNkZlnKe1eZE0K8OpeUHNNjvzksNvSmWr1gfKOOn15pRoLr7e/ZqeUmbaLZJjIjXT/lm261U4wOqo7GKaXD/nCXUPQvqUppBrTsc4hoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=in5RvYSFRwXmI05RdH8h/gSXJgH6cbfzuJX+7Y0Tn5s=; b=FTl8kDJntCu17byf1oe2rsYEIKPJXhZ2OXfj5D4cAs3cOHxwt+zf3b2FjfqzBFTp/k2Vit7MHmPvYhgGaH8n1xo80Y0snhbzfNpJ00lGjkLafdirfoa6vGLIeS5fuBcSRQchjU68e+QhfLq0uBMlxHAWCWy7XUAzWvXqqpb33VqMtW/I7vfZf4IgTqVeq78OfKeOCkBlRgfxUU8PLtokct4LueO0IyWPYAgJCq6n3ylDz+JSU8reikH8mbDMPLixaxA2K0piouZ0od/gr/eoA+21ne8XPN5+Edv0g3DUMo8LYnK52zvovFZtRxCfdDFGTVsifRtVqYSyhFZKq+8kiA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AS8PR04MB8738.eurprd04.prod.outlook.com (2603:10a6:20b:42b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Wed, 16 Oct 2024 20:31:55 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8069.016; Wed, 16 Oct 2024 20:31:55 +0000 From: Frank Li Date: Wed, 16 Oct 2024 16:31:13 -0400 Subject: [PATCH v3 5/6] EDAC/fsl_ddr: Add support for i.MX9 DDR controller Message-Id: <20241016-imx95_edac-v3-5-86ae6fc2756a@nxp.com> References: <20241016-imx95_edac-v3-0-86ae6fc2756a@nxp.com> In-Reply-To: <20241016-imx95_edac-v3-0-86ae6fc2756a@nxp.com> To: York Sun , Borislav Petkov , Tony Luck , James Morse , Mauro Carvalho Chehab , Robert Richter , Krzysztof Kozlowski , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov , devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Frank Li , Ye Li , Peng Fan X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729110683; l=5954; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=hUQnyfJFTL94sxJNzfCg3IOb5Vka/0x2CpQy/F03SQk=; b=Uz7YCUC9DM7d3qQwjHo5x/2yPSms5CnmjZlbIqUL1o+tSam1kMslNv3vi7p4IVUo24iIjZYRx 4g0+UNyUhZNBNC+Z0oQpvcFhgjlPyVR+ebRPmLZPZK1I16DxOck64xd X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR07CA0042.namprd07.prod.outlook.com (2603:10b6:a03:60::19) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8738:EE_ X-MS-Office365-Filtering-Correlation-Id: c6b2c753-edd4-4f09-0d9b-08dcee219361 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|366016|52116014|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?4NSOWZStRLaFUnwFU2IiZxcWeXAYYJ4?= =?utf-8?q?9+LsZxYJjXG64HLXbG9J5iH/AprY8MTlIlXfohhkRuZLPXDW06snsO75thPo8fdHW?= =?utf-8?q?xlgSBJ6TnpB65ryARFZcrYiVIKL4cD3v2aKZNyQxVkZ89mNfrs1i2SHz9U9GmBbqL?= =?utf-8?q?aJwPyPo4UyAIj9FpbwAyD0P4S9aO1R4nJ0yHvlPSM/Znbe5Wp7f+RNzy+n2dZA/Px?= =?utf-8?q?+LGQE0z7Q8OzAeDjiiXQUOW3z6fB5pWh76FpYqI0VYs9YPjNYVop3xg8Lxk718y7o?= =?utf-8?q?JldwhV/pgS6pK4MyjDRFDRlM3bqgvGH4OS2iakjwsW1+zlJodq1jk9XytuWbnS52X?= =?utf-8?q?ZUFHSAM+hShNPDNFu7E2mpy8HI3I8U2hCfPOvvofrwbjrPuVsveqIxXJVoM1e9XQI?= =?utf-8?q?RVlxEkMKMadky3gCfqpRb2iSCnXwtOqVtJpUSzY74j0ADQMWBX14AB/yKnu11C4JY?= =?utf-8?q?wN4bRH4INi/7mzFT/dZBzgLe7hGR3fB/KUphz6/YN+uOvnJv8N1zFFSR4LLgkl5Rx?= =?utf-8?q?ENHUGA74pfRubaIdnSM0Lc1VUDw/0mvSYyTDqK/QBW3u+GEIk2PQdwN8yCGgmV/7B?= =?utf-8?q?3KSCa1AGfAyxcERx3u6hUoKPB1K7cTjryZzhwTn2QRFqstPvwTVrGDcy0vVh6E9S3?= =?utf-8?q?TqEoqmlp7C0/6cBZ5BqPwk1Hjnp0Gnt+Hy0OPkvd5tCq36P/QNSZGsBPru5iwrqt4?= =?utf-8?q?3hh7xTfeXBa5F/RaA+TuuzUPbdTvSN/iIsNS6lhRxLE6ymVGliOt3wgkhGftOr1ON?= =?utf-8?q?uJ6Xeu68RjVEsOcQUzSUA9iWM1wAoPjbvEyYy52P5a/vxLB4MsOHQi/fFZQ1r3MPo?= =?utf-8?q?g5p07mQkyAxe9tC1yQ4U0rY1JdbcMtX+rn8hRIZmdiR0cd1Mu53W4eqN9crPWb8w9?= =?utf-8?q?p6veCXpvuaJ1Sl/4zDlyal5t57tJC7XwpEgDp1QQ28MpngYQRDP6nY5Xuc/tT1cvX?= =?utf-8?q?rIBxoA7nBsbOnvYVKnnUeCj+21n4gx49jt/N5ZnjtOSR2t1AMUS+XTYTLujPKyBQn?= =?utf-8?q?bY+8KAVXFZsFn1AXdbcLkAv3TxCh/HG+VhhK3PI3MZZrX08dtChFU6MjUzNq0JR5O?= =?utf-8?q?rdFXTcx6JHKWgHSFMIvr+jOvc8mgCmqIA206eXLoVeaV3MLjZFbjH5XIjBMaF9RID?= =?utf-8?q?zsb+5v9J9sLeKA8XeX+3IBO4LexmOow2rGEIl93wDhcpVREwG56Hlmy262xbICvD6?= =?utf-8?q?gMldjnc8yl3xPYsL4JG1UFcJiQG5TbJEkq7wNbQfu9mdCIwIPECk0qliHhEvvPz4d?= =?utf-8?q?+RoSsBnFNcuSXNeMVKUSLThvYVtCY7QCHPQFg7yck38P6mVKZ5hS2BmULTyYwH1Yz?= =?utf-8?q?K82hr+QC3szq?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(1800799024)(366016)(52116014)(376014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?SMBqG7nix/QFlW9PWDPW/goLiKdS?= =?utf-8?q?SipNNUVyNum7B5TSYukX/o+rBXj3d+jFZC2hdBuxveYAesLk6wDFKCu2vUXD6Ms9V?= =?utf-8?q?Q1glfiHmNBtJAbFXsj9W2U+gAgz1i5b11WVOjqN/leMTeKbRY275BRfdWFjFl6tkR?= =?utf-8?q?dJw8UdjzlHJlH7aI116k5IRwjBhU7Fts6gUs8NiCaCgatTamXFUcC+47dbVHUK1Np?= =?utf-8?q?qP/cVU7xlTTAAtnKILt4QVLdTMfy+dH4xXX3T3sEzXVk1Uc9hV39808rMWU+VzXQY?= =?utf-8?q?vjoH0bRpkqN4SUZf2HEFdYBqw9OqpW6dRxTvQXju00W/oRa19Lt/qRs77dBeAXPNw?= =?utf-8?q?Xeu6Ux02SuwavgXNAnhyqfE+uKFtjfm4lGjYA4TUy7IWt5r2AjwOJjkRGK1oIn3Ea?= =?utf-8?q?kqhkeH40lPtfNjdRsGmY6XSj1g4MKbsotxV7xuwGu6HdQlLrmN6LhEsVbAxIgZMRg?= =?utf-8?q?6FkwO7dib3HswkxeaWs2eRZnv2i6rHwnL+TGETOaNv7F6H8Pc8Vx3dnO6IomMmgZJ?= =?utf-8?q?5HES2n2CJBACFSZNFxBlq10sk+e8ZCSldH/oHirdUfZVJrWtCD3l9jVvy7C5fITdy?= =?utf-8?q?MqCN79nHgtGgIJvhcCAab/hktcqanHtNqQaO/NqO9CZVc+u6WpMJuR8p47I6srp2F?= =?utf-8?q?IBC06EA9WHL/RV1mLkx8TL7fHXBYsutMjSVx0S5Y1l8McRgtrCd4ydNWA4KRz1lFg?= =?utf-8?q?mbCY/OiUa6ed/XKlWqQo8K4wqirrsn3tha3V54xUVcpaexa16HN2eXFiuaOLPZS7r?= =?utf-8?q?asF4ql+hGiWwJflEvR67p4OSevrexkB+cLBQBmbW8Nv7FZEo8mzLsh4dLH2fjBMh8?= =?utf-8?q?YeAli/iM098mscSLUz2+sPoGzXlvxp9gsDFJXu/qDgyg2t/6r0BoFcg+xXsAnWIfb?= =?utf-8?q?+ro1I4SP8JGkByrFBX6yQP5tNJlj1xCdull06H3vzEuCyQG2N8rRqQto1UyvBH16e?= =?utf-8?q?6sOEngF8HQXSFJ5CYzFWDqeBjWkSyTSaC+P1mY302yndwXA9HtDYRrKkWUA4b7uNB?= =?utf-8?q?nubLA3NAoChlqRoUyl+J6rFI83Dd2UiDsQ5tk/+4OOLfH8DFKRrPt69MS8rGwIdQ+?= =?utf-8?q?XoELpagK6p83lhhC9Z9gmFAicfhB4A9CsPucsltIU0At76Z8x6JesXxvCRnLMoaAA?= =?utf-8?q?F257nDvw4ObHan+xMWZPq+fw3ftsFAuMhuDcdGRD3OjuGDYaDzwD/Ah61jPkZtXIZ?= =?utf-8?q?nn38qLa50oZ9hjiSTwSY7/EQwd69Zz8ijsd7g9Q7xBq4WxuOkvUxlajhfw9Yft//t?= =?utf-8?q?y9y9Q3QD3bGY6xGnA/NR11RrZkeDdDHty6NP0aGVIFm2NvurUIEP3manimkrnrPNn?= =?utf-8?q?VoAc6b6/Ek7zNxCm6LNjQE/3h88yHKc1r8LZ8Tqhc2oEZKcb5xQU0DfBbqIQTTyUK?= =?utf-8?q?/ukpgONo48VR5XPlG5dBDUErXb/aMSExWFIOXMmeO+unSDYLxxNod9Ur5hnXQT+3V?= =?utf-8?q?6h8mo/eU5pxDRS0kMBsHOZj7sGoXW/SblqEi4SM/jPa8BVBMXzPnUV/XeSYXiTiw9?= =?utf-8?q?VgdJEBeuA0kc?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6b2c753-edd4-4f09-0d9b-08dcee219361 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 20:31:55.4614 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uJFGC/RlPrwU5i2052DDbq+8rnn2bPyU+loxfPS7jfNJlRyYN3m0KZR8rqWDcez/KXnukv505zuPQ4kpdUPoQA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8738 From: Ye Li Add support for the i.MX9 DDR controller, which has different register offsets and some function changes compared to the existing fsl_ddr controller. The ECC and error injection functions are almost the same, so update and reuse the driver for i.MX9. A special type 'TYPE_IMX9' is added specifically for the i.MX9 controller to distinguish the differences. Signed-off-by: Ye Li Reviewed-by: Peng Fan Signed-off-by: Frank Li --- drivers/edac/fsl_ddr_edac.c | 48 ++++++++++++++++++++++++++++++++++++------ drivers/edac/fsl_ddr_edac.h | 10 +++++++++ drivers/edac/layerscape_edac.c | 1 + 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/drivers/edac/fsl_ddr_edac.c b/drivers/edac/fsl_ddr_edac.c index 846a4ba25342a..8f64a4fe02ce9 100644 --- a/drivers/edac/fsl_ddr_edac.c +++ b/drivers/edac/fsl_ddr_edac.c @@ -31,16 +31,28 @@ static int edac_mc_idx; +static inline void __iomem *ddr_reg_addr(struct fsl_mc_pdata *pdata, unsigned int off) +{ + if (pdata->flag == TYPE_IMX9 && off >= FSL_MC_DATA_ERR_INJECT_HI && off <= FSL_MC_ERR_SBE) + return pdata->inject_vbase + off - FSL_MC_DATA_ERR_INJECT_HI + + IMX9_MC_DATA_ERR_INJECT_OFF; + + if (pdata->flag == TYPE_IMX9 && off >= IMX9_MC_ERR_EN) + return pdata->inject_vbase + off - IMX9_MC_ERR_EN; + + return pdata->mc_vbase + off; +} + static inline u32 ddr_in32(struct fsl_mc_pdata *pdata, unsigned int off) { - void __iomem *addr = pdata->mc_vbase + off; + void __iomem *addr = ddr_reg_addr(pdata, off); return pdata->little_endian ? ioread32(addr) : ioread32be(addr); } static inline void ddr_out32(struct fsl_mc_pdata *pdata, unsigned int off, u32 value) { - void __iomem *addr = pdata->mc_vbase + off; + void __iomem *addr = ddr_reg_addr(pdata, off); if (pdata->little_endian) iowrite32(value, addr); @@ -438,6 +450,9 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci) case 0x05000000: mtype = MEM_DDR4; break; + case 0x04000000: + mtype = MEM_LPDDR4; + break; default: mtype = MEM_UNKNOWN; break; @@ -471,7 +486,9 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci) dimm->grain = 8; dimm->mtype = mtype; dimm->dtype = DEV_UNKNOWN; - if (sdram_ctl & DSC_X32_EN) + if (pdata->flag == TYPE_IMX9) + dimm->dtype = DEV_X16; + else if (sdram_ctl & DSC_X32_EN) dimm->dtype = DEV_X32; dimm->edac_mode = EDAC_SECDED; } @@ -483,6 +500,7 @@ int fsl_mc_err_probe(struct platform_device *op) struct edac_mc_layer layers[2]; struct fsl_mc_pdata *pdata; struct resource r; + u32 ecc_en_mask; u32 sdram_ctl; int res; @@ -510,6 +528,8 @@ int fsl_mc_err_probe(struct platform_device *op) mci->ctl_name = pdata->name; mci->dev_name = pdata->name; + pdata->flag = (unsigned long)device_get_match_data(&op->dev); + /* * Get the endianness of DDR controller registers. * Default is big endian. @@ -538,8 +558,23 @@ int fsl_mc_err_probe(struct platform_device *op) goto err; } - sdram_ctl = ddr_in32(pdata, FSL_MC_DDR_SDRAM_CFG); - if (!(sdram_ctl & DSC_ECC_EN)) { + if (pdata->flag == TYPE_IMX9) { + pdata->inject_vbase = devm_platform_ioremap_resource_byname(op, "inject"); + if (IS_ERR(pdata->inject_vbase)) { + res = -ENOMEM; + goto err; + } + } + + if (pdata->flag == TYPE_IMX9) { + sdram_ctl = ddr_in32(pdata, IMX9_MC_ERR_EN); + ecc_en_mask = ERR_ECC_EN | ERR_INLINE_ECC; + } else { + sdram_ctl = ddr_in32(pdata, FSL_MC_DDR_SDRAM_CFG); + ecc_en_mask = DSC_ECC_EN; + } + + if ((sdram_ctl & ecc_en_mask) != ecc_en_mask) { /* no ECC */ pr_warn("%s: No ECC DIMMs discovered\n", __func__); res = -ENODEV; @@ -550,7 +585,8 @@ int fsl_mc_err_probe(struct platform_device *op) mci->mtype_cap = MEM_FLAG_DDR | MEM_FLAG_RDDR | MEM_FLAG_DDR2 | MEM_FLAG_RDDR2 | MEM_FLAG_DDR3 | MEM_FLAG_RDDR3 | - MEM_FLAG_DDR4 | MEM_FLAG_RDDR4; + MEM_FLAG_DDR4 | MEM_FLAG_RDDR4 | + MEM_FLAG_LPDDR4; mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED; mci->edac_cap = EDAC_FLAG_SECDED; mci->mod_name = EDAC_MOD_STR; diff --git a/drivers/edac/fsl_ddr_edac.h b/drivers/edac/fsl_ddr_edac.h index de66f9822fba1..73618f79e587f 100644 --- a/drivers/edac/fsl_ddr_edac.h +++ b/drivers/edac/fsl_ddr_edac.h @@ -39,6 +39,9 @@ #define FSL_MC_CAPTURE_EXT_ADDRESS 0x0e54 #define FSL_MC_ERR_SBE 0x0e58 +#define IMX9_MC_ERR_EN 0x1000 +#define IMX9_MC_DATA_ERR_INJECT_OFF 0x100 + #define DSC_MEM_EN 0x80000000 #define DSC_ECC_EN 0x20000000 #define DSC_RD_EN 0x10000000 @@ -46,6 +49,9 @@ #define DSC_DBW_32 0x00080000 #define DSC_DBW_64 0x00000000 +#define ERR_ECC_EN 0x80000000 +#define ERR_INLINE_ECC 0x40000000 + #define DSC_SDTYPE_MASK 0x07000000 #define DSC_X32_EN 0x00000020 @@ -65,14 +71,18 @@ #define DDR_EDI_SBED 0x4 /* single-bit ECC error disable */ #define DDR_EDI_MBED 0x8 /* multi-bit ECC error disable */ +#define TYPE_IMX9 0x1 /* MC used by iMX9 having registers changed */ + struct fsl_mc_pdata { char *name; int edac_idx; void __iomem *mc_vbase; + void __iomem *inject_vbase; int irq; u32 orig_ddr_err_disable; u32 orig_ddr_err_sbe; bool little_endian; + unsigned long flag; }; int fsl_mc_err_probe(struct platform_device *op); void fsl_mc_err_remove(struct platform_device *op); diff --git a/drivers/edac/layerscape_edac.c b/drivers/edac/layerscape_edac.c index 0d42c1238908b..9a0c92ebbc3c4 100644 --- a/drivers/edac/layerscape_edac.c +++ b/drivers/edac/layerscape_edac.c @@ -21,6 +21,7 @@ static const struct of_device_id fsl_ddr_mc_err_of_match[] = { { .compatible = "fsl,qoriq-memory-controller", }, + { .compatible = "nxp,imx9-memory-controller", .data = (void *)TYPE_IMX9, }, {}, }; MODULE_DEVICE_TABLE(of, fsl_ddr_mc_err_of_match);