From patchwork Fri Oct 11 15:31:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13832677 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2077.outbound.protection.outlook.com [40.107.22.77]) (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 E8279195B18 for ; Fri, 11 Oct 2024 15:31:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660720; cv=fail; b=dNnyfhkjJZL6i1vBEoLwEDtaDoJDbEltQKgN9wJm5iaCGKn8TMLxd35hZHCPKs3XwQrlwNR/hE6+wqtzf2598+EqLKSMaYEQvChkyj8go16srGGUTwz1LS+U1LJGADpKhaBQ/uU6jew8v2khz2Y/c2NYm32eKMVxDVoNnFGoQvM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660720; c=relaxed/simple; bh=tWA2t7dYpkCGQPCP1WcAIC7H3OdUmQUbtGujuyE7dVw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=N9L3MpP1Tm/j6VCk7wJ2eDOrjXAHTw5jZCxKxIGBnXEPpNx6mKcmyR5wXbw5a3098AK2sFrR1was8lEm/TLp02KJaQLlJxVMkvHQo8WbjQXij4s76oW6pwFMUuCVFjWY/gQTnWOqcGVaval8S/vxT9QIeR/biuM77zanKEQUWRU= 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=MztvPEz5; arc=fail smtp.client-ip=40.107.22.77 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="MztvPEz5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JMlW8/s+aa0AZBC4bo7Vf0lW1J5HZ1ItCqylPjcRhvTSMI+yU9qrzP+sgAqizo4Kj/i7ANOQsUCj03PfHWd6am/X8G/XTTS5Y8z4mbC/1C+bwhzuBFhbJQKMccaJcOMi9gB7/gZAxQ3bUeJUW4cWuf/mqqfMchZVVVPGh3eCVCISvlJj6dWb9rDVoDsz2peRcQPRSKZiqxcAz7uFATtu6ZnlbQMMSnF6NP0E/CjoBw3NKrYntcEnBY9orVtPyRCsSVi+NfXOJmDtjl/ZvieQNXlIbpanGXAuOU1aE57VbBOZlW69xObLQu8vrcneoRvwH+/uPZBJsC+XOfaOI6jNJA== 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=oWWIgflstIVDXTjDGLYnl7metuS73gQMf9j95c82+E0=; b=AfNKGjJk70sjxjWT1u6INCtYyWeunol4tjK7CD0o5pIXg5uzuRDX58jKRjQWnzp1SpXsDli1nM1iWaw6CfUJ+2REzLx0KuB2C3vf1Rc4UNT+JVfr5U2eip8mVsJFQJJ65TLVQCfTHBeA3jHlXIut8LsWqvfOLUgMxr+0S3LjNIrgaEnNeDElJJ6yv0mUDG9nE9frdrmKvuaUbEICXoLUdG/1ILwaMmwwsEtjEtUtip28f5S5eBAVjLjIO34wQEZJTCjwAxAnZuXCaQ8XvVmw5hdGA7OdpKr96LVzv7UU38VPQLMHRuZHbzCfSQocvXh9eBde5wX4TBmE4BVtVjDVow== 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=oWWIgflstIVDXTjDGLYnl7metuS73gQMf9j95c82+E0=; b=MztvPEz5iIrSku1WFfgIbQg4/N0lxtiEPtvNrB181SUNfcwKFhHzpVfmf535C8EGeUSSGeib1uiWSvAL6tNg/jx16wdDjzMkDFIS5XxJY58Hcow/iFb8XVjlN3HYBWIuG6UVsono+65yWvEsasuPRKqJkEsxYKobmDo4Deyv4VlRubZCG9mX1AhS9F/5XTVonaEtJ5M7JUPTQ6MCH327Yi1Ig5I5bdrWXRSQlPp5Tgu4Rw6iFHK/NJvo1ogGYvprjc/LvHG5xQQE/1uJOzh9BZcdHD6ktDFnzz9MqQNq4QIzIdYiTMdYKTaPlY2flFUOM2vi+iuXRYc5URr/dSxBuw== 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 AM7PR04MB7064.eurprd04.prod.outlook.com (2603:10a6:20b:118::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20; Fri, 11 Oct 2024 15:31:54 +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.8048.013; Fri, 11 Oct 2024 15:31:54 +0000 From: Frank Li Date: Fri, 11 Oct 2024 11:31:29 -0400 Subject: [PATCH v2 1/6] EDAC/fsl_ddr: Pass down fsl_mc_pdata in ddr_in32() and ddr_out32() Message-Id: <20241011-imx95_edac-v2-1-011b68290951@nxp.com> References: <20241011-imx95_edac-v2-0-011b68290951@nxp.com> In-Reply-To: <20241011-imx95_edac-v2-0-011b68290951@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 X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1728660703; l=8457; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=tWA2t7dYpkCGQPCP1WcAIC7H3OdUmQUbtGujuyE7dVw=; b=I229zlgU2anPbvLij1cNUj64GMxTUvyazyq5Wyp0/AqlTYU5gx71QGZhHN0QgziCfhpJ2cJaz mfGEa/rp+ayCugzBn75mIiqFgDJHPfRIfhA7xTSpJBbwG5Sx89aN3Xa X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY3PR04CA0014.namprd04.prod.outlook.com (2603:10b6:a03:217::19) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM7PR04MB7064:EE_ X-MS-Office365-Filtering-Correlation-Id: 65113d73-0a4c-47ca-49f0-08dcea09d609 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|376014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?pe78WNzmUiKoF0PDGoEOPwyL2jqbXWB?= =?utf-8?q?WI7p5AHLp0kh1d0kYVdxDPnZkxNxeKnxNvoR4h2ufUDORQZiYPuBHSt6CoMpsVP/Q?= =?utf-8?q?qAR4h/jGSoL+wQAX4+4+Vm5w4RUxs9uwBa3CrD5G5E9f/lXbdohJSv9YVzIPn87uo?= =?utf-8?q?hMSCOcAd2D6n75tLGQ0hxJBS6V/4i3W+SwCuBY4g5RnH+sYLjVxylEwI2oIWDibRA?= =?utf-8?q?lmvHhiqgghurl3Yrmkla5MjDybwRzRmyMlsVI5JggSCY3LJfhEYb8MBAJqj5V06C+?= =?utf-8?q?aQEQh0u7HYEhAnn5oeT7mGH4HVlGVsw16ABnPldLDRlxrprnDyr3D4gdCBsU2nB5y?= =?utf-8?q?GctTxf03yp6NS1lNRL9wdAHgXKBXkoKCsC57ceA5zXvtjcmX1nNAKdk0Ovw0SlDRQ?= =?utf-8?q?DS1H+NBHriXHZChPHYh+EDrHNJXJXZLdbOLZ+XwVcQdLX7dr/gJc9qWXG6KkqMKys?= =?utf-8?q?MkubIKzegS9lDXkahVQ9b4T3/64Rm8Ms75Rxsi1pkpc3Lr/phxyO1qHwGQHszg9Ut?= =?utf-8?q?Prf0bSDaKl5uGA1GLeR7iVKghh5sw8aI8YHimR+mZv16q7Xh7OnDBH9v2W+g7uOBN?= =?utf-8?q?vrsuoU+cIp//eUWtZtjusdcCf64r1zHT571ZV0zux0TrdxYFMf8pj2yFHclpIo2Gy?= =?utf-8?q?Si7gwxFSu4vsoOTSG060MbVajBIsONYJpMgt+LFRQRrvXahVkZyFk7yy+MZEF9INU?= =?utf-8?q?Dx7H7VjwfvDilipWec2E5/DjmXPCmHExbbg8JpDSvFuERHFcLWYsYNHf+x2nJM39Y?= =?utf-8?q?zrQHh+T83yg3il5HInHYsONVUyERfJiUhjrgr5/uJ51+SL9HTUihJvWHHsdPP3lOn?= =?utf-8?q?G8SE1GgP61qKTaDRrMKRgoGx+5MrxJgzBkUHO0VK/+fECq/BMJP+MX3tQrfg7khrO?= =?utf-8?q?qdtDpgDbn7a5/z5Eb32YBEAMU8Lt5ce97eWhiEOj/NWdkYkq9dfiEoChmf8a4dx0o?= =?utf-8?q?UxNdF/5Fwe/pbn7Re86OQgbwj3Jg/bRUvWYdtcprLKJOpmO3ncvbCqFcF4lMAdIpk?= =?utf-8?q?AzkYPU/PeH5nl9EzhffItAqHKF4cjyRBjzJwTeeRti8yvi9UFoqedYLRnrG8sqiJc?= =?utf-8?q?hpvW3getf6DoaOJPdid9ZwDCWrIEqRskuzXlsaPb9FOcFx3fnT6CuBgQdaZjL3Qa+?= =?utf-8?q?G8rdkB4gpBWyoTgytW4nYNJk+4VZdfj+Disq0nzCvu6RUdlouoZjrpsMDwTnHtVQ4?= =?utf-8?q?TSKal2H3mJUyCglCfEPBhoI+sVteda85ajw2rh5F/dW4WCQFgBULFbNarwZgfCXjF?= =?utf-8?q?PJFYWtIOQxsy5yXOAEINEbBOJMdpeyKDLCCIwRLdUnNzThcCx2O65too=3D?= 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)(52116014)(7416014)(376014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7P5qXxaxdpyejX13uoxHlyzrJgIU?= =?utf-8?q?cXZX3eG3EZn7ybnmJ4QHrB3n2JMQ6SZJZXHkATcqV6jPJyzskytNjN1xwllq0qGcb?= =?utf-8?q?+L74s8Odt3oeTyvFbaCEDPnu4e0rlnMMdNb1OG0LYKBBRezYEkx4ndRLCcVbYICZ4?= =?utf-8?q?0XwW0wgWM11pl3GFFPy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eBImo1F1z+WTO8DWL2mm5zGVzoP/AWXmnqW7F9hj3?= =?utf-8?q?b4rYjAzHhKphJ6g+vLkpDIyduvkhKdmm9guqLBnSB6TylNajLJ/Y7r2O6fCmiVBRs?= =?utf-8?q?e74bB07l0mjXJSgZBoH3GOF9TwjdoivLF6s+sgPYTEpUrNwIjyELrGNRrehx7kt0W?= =?utf-8?q?ZwEqVJH6S1E/NxknXATJeOAPQa8lLbK43IFbYkJCn4/8q1PofW+L0yduY3q/QgaFG?= =?utf-8?q?O+PGuOyB5VCtmc7Fv3nxIFopGAGYVa6FA0ZP216lI5deNu5EmYW21HfiXMe+Mh+bJ?= =?utf-8?q?r1UxItdJ28PMYgge/fYR0rjfNHiohL7kn6ZCVoZetZeJ9iQt2X8aQ5OXPmVwP3P1y?= =?utf-8?q?yXZyqWAl3ty0bf/HKScV98H8pij/Kbnd6Z1smlw80y6JPcY8hTZBuIaFkZN7IrnxT?= =?utf-8?q?y5trfKU4gMn/o3vKzQRgVciMRyQWz5fswBtLtOwkiW03wt/JLIng2WEd49SjoZn7+?= =?utf-8?q?i8/kKCAzzN4a?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65113d73-0a4c-47ca-49f0-08dcea09d609 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 15:31:54.7271 (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: ShSsbeseJKCZ+yntuCUGoY1kVabxTWaIshAzKovM4mZ+tfN91p3aUrZPysq9ukvlCnIcE7uTeaiV+KUX5xvrdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7064 Pass down `fsl_mc_pdata` in helper functions `ddr_in32()` and `ddr_out32()` to prepare for adding iMX9 support. The iMX9 has a slightly different register layout. No functional change. Signed-off-by: Frank Li --- Change from v1 to v2 - update commit message. - fix a build error. --- drivers/edac/fsl_ddr_edac.c | 64 ++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/drivers/edac/fsl_ddr_edac.c b/drivers/edac/fsl_ddr_edac.c index d148d262d0d4d..9924c6b816648 100644 --- a/drivers/edac/fsl_ddr_edac.c +++ b/drivers/edac/fsl_ddr_edac.c @@ -35,13 +35,17 @@ static u32 orig_ddr_err_disable; static u32 orig_ddr_err_sbe; static bool little_endian; -static inline u32 ddr_in32(void __iomem *addr) +static inline u32 ddr_in32(struct fsl_mc_pdata *pdata, unsigned int off) { + void __iomem *addr = pdata->mc_vbase + off; + return little_endian ? ioread32(addr) : ioread32be(addr); } -static inline void ddr_out32(void __iomem *addr, u32 value) +static inline void ddr_out32(struct fsl_mc_pdata *pdata, unsigned int off, u32 value) { + void __iomem *addr = pdata->mc_vbase + off; + if (little_endian) iowrite32(value, addr); else @@ -60,7 +64,7 @@ static ssize_t fsl_mc_inject_data_hi_show(struct device *dev, struct mem_ctl_info *mci = to_mci(dev); struct fsl_mc_pdata *pdata = mci->pvt_info; return sprintf(data, "0x%08x", - ddr_in32(pdata->mc_vbase + FSL_MC_DATA_ERR_INJECT_HI)); + ddr_in32(pdata, FSL_MC_DATA_ERR_INJECT_HI)); } static ssize_t fsl_mc_inject_data_lo_show(struct device *dev, @@ -70,7 +74,7 @@ static ssize_t fsl_mc_inject_data_lo_show(struct device *dev, struct mem_ctl_info *mci = to_mci(dev); struct fsl_mc_pdata *pdata = mci->pvt_info; return sprintf(data, "0x%08x", - ddr_in32(pdata->mc_vbase + FSL_MC_DATA_ERR_INJECT_LO)); + ddr_in32(pdata, FSL_MC_DATA_ERR_INJECT_LO)); } static ssize_t fsl_mc_inject_ctrl_show(struct device *dev, @@ -80,7 +84,7 @@ static ssize_t fsl_mc_inject_ctrl_show(struct device *dev, struct mem_ctl_info *mci = to_mci(dev); struct fsl_mc_pdata *pdata = mci->pvt_info; return sprintf(data, "0x%08x", - ddr_in32(pdata->mc_vbase + FSL_MC_ECC_ERR_INJECT)); + ddr_in32(pdata, FSL_MC_ECC_ERR_INJECT)); } static ssize_t fsl_mc_inject_data_hi_store(struct device *dev, @@ -97,7 +101,7 @@ static ssize_t fsl_mc_inject_data_hi_store(struct device *dev, if (rc) return rc; - ddr_out32(pdata->mc_vbase + FSL_MC_DATA_ERR_INJECT_HI, val); + ddr_out32(pdata, FSL_MC_DATA_ERR_INJECT_HI, val); return count; } return 0; @@ -117,7 +121,7 @@ static ssize_t fsl_mc_inject_data_lo_store(struct device *dev, if (rc) return rc; - ddr_out32(pdata->mc_vbase + FSL_MC_DATA_ERR_INJECT_LO, val); + ddr_out32(pdata, FSL_MC_DATA_ERR_INJECT_LO, val); return count; } return 0; @@ -137,7 +141,7 @@ static ssize_t fsl_mc_inject_ctrl_store(struct device *dev, if (rc) return rc; - ddr_out32(pdata->mc_vbase + FSL_MC_ECC_ERR_INJECT, val); + ddr_out32(pdata, FSL_MC_ECC_ERR_INJECT, val); return count; } return 0; @@ -286,7 +290,7 @@ static void fsl_mc_check(struct mem_ctl_info *mci) int bad_data_bit; int bad_ecc_bit; - err_detect = ddr_in32(pdata->mc_vbase + FSL_MC_ERR_DETECT); + err_detect = ddr_in32(pdata, FSL_MC_ERR_DETECT); if (!err_detect) return; @@ -295,14 +299,14 @@ static void fsl_mc_check(struct mem_ctl_info *mci) /* no more processing if not ECC bit errors */ if (!(err_detect & (DDR_EDE_SBE | DDR_EDE_MBE))) { - ddr_out32(pdata->mc_vbase + FSL_MC_ERR_DETECT, err_detect); + ddr_out32(pdata, FSL_MC_ERR_DETECT, err_detect); return; } - syndrome = ddr_in32(pdata->mc_vbase + FSL_MC_CAPTURE_ECC); + syndrome = ddr_in32(pdata, FSL_MC_CAPTURE_ECC); /* Mask off appropriate bits of syndrome based on bus width */ - bus_width = (ddr_in32(pdata->mc_vbase + FSL_MC_DDR_SDRAM_CFG) & + bus_width = (ddr_in32(pdata, FSL_MC_DDR_SDRAM_CFG) & DSC_DBW_MASK) ? 32 : 64; if (bus_width == 64) syndrome &= 0xff; @@ -310,8 +314,8 @@ static void fsl_mc_check(struct mem_ctl_info *mci) syndrome &= 0xffff; err_addr = make64( - ddr_in32(pdata->mc_vbase + FSL_MC_CAPTURE_EXT_ADDRESS), - ddr_in32(pdata->mc_vbase + FSL_MC_CAPTURE_ADDRESS)); + ddr_in32(pdata, FSL_MC_CAPTURE_EXT_ADDRESS), + ddr_in32(pdata, FSL_MC_CAPTURE_ADDRESS)); pfn = err_addr >> PAGE_SHIFT; for (row_index = 0; row_index < mci->nr_csrows; row_index++) { @@ -320,8 +324,8 @@ static void fsl_mc_check(struct mem_ctl_info *mci) break; } - cap_high = ddr_in32(pdata->mc_vbase + FSL_MC_CAPTURE_DATA_HI); - cap_low = ddr_in32(pdata->mc_vbase + FSL_MC_CAPTURE_DATA_LO); + cap_high = ddr_in32(pdata, FSL_MC_CAPTURE_DATA_HI); + cap_low = ddr_in32(pdata, FSL_MC_CAPTURE_DATA_LO); /* * Analyze single-bit errors on 64-bit wide buses @@ -367,7 +371,7 @@ static void fsl_mc_check(struct mem_ctl_info *mci) row_index, 0, -1, mci->ctl_name, ""); - ddr_out32(pdata->mc_vbase + FSL_MC_ERR_DETECT, err_detect); + ddr_out32(pdata, FSL_MC_ERR_DETECT, err_detect); } static irqreturn_t fsl_mc_isr(int irq, void *dev_id) @@ -376,7 +380,7 @@ static irqreturn_t fsl_mc_isr(int irq, void *dev_id) struct fsl_mc_pdata *pdata = mci->pvt_info; u32 err_detect; - err_detect = ddr_in32(pdata->mc_vbase + FSL_MC_ERR_DETECT); + err_detect = ddr_in32(pdata, FSL_MC_ERR_DETECT); if (!err_detect) return IRQ_NONE; @@ -396,7 +400,7 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci) u32 cs_bnds; int index; - sdram_ctl = ddr_in32(pdata->mc_vbase + FSL_MC_DDR_SDRAM_CFG); + sdram_ctl = ddr_in32(pdata, FSL_MC_DDR_SDRAM_CFG); sdtype = sdram_ctl & DSC_SDTYPE_MASK; if (sdram_ctl & DSC_RD_EN) { @@ -444,7 +448,7 @@ static void fsl_ddr_init_csrows(struct mem_ctl_info *mci) csrow = mci->csrows[index]; dimm = csrow->channels[0]->dimm; - cs_bnds = ddr_in32(pdata->mc_vbase + FSL_MC_CS_BNDS_0 + + cs_bnds = ddr_in32(pdata, FSL_MC_CS_BNDS_0 + (index * FSL_MC_CS_BNDS_OFS)); start = (cs_bnds & 0xffff0000) >> 16; @@ -531,7 +535,7 @@ int fsl_mc_err_probe(struct platform_device *op) goto err; } - sdram_ctl = ddr_in32(pdata->mc_vbase + FSL_MC_DDR_SDRAM_CFG); + sdram_ctl = ddr_in32(pdata, FSL_MC_DDR_SDRAM_CFG); if (!(sdram_ctl & DSC_ECC_EN)) { /* no ECC */ pr_warn("%s: No ECC DIMMs discovered\n", __func__); @@ -558,11 +562,11 @@ int fsl_mc_err_probe(struct platform_device *op) fsl_ddr_init_csrows(mci); /* store the original error disable bits */ - orig_ddr_err_disable = ddr_in32(pdata->mc_vbase + FSL_MC_ERR_DISABLE); - ddr_out32(pdata->mc_vbase + FSL_MC_ERR_DISABLE, 0); + orig_ddr_err_disable = ddr_in32(pdata, FSL_MC_ERR_DISABLE); + ddr_out32(pdata, FSL_MC_ERR_DISABLE, 0); /* clear all error bits */ - ddr_out32(pdata->mc_vbase + FSL_MC_ERR_DETECT, ~0); + ddr_out32(pdata, FSL_MC_ERR_DETECT, ~0); res = edac_mc_add_mc_with_groups(mci, fsl_ddr_dev_groups); if (res) { @@ -571,15 +575,15 @@ int fsl_mc_err_probe(struct platform_device *op) } if (edac_op_state == EDAC_OPSTATE_INT) { - ddr_out32(pdata->mc_vbase + FSL_MC_ERR_INT_EN, + ddr_out32(pdata, FSL_MC_ERR_INT_EN, DDR_EIE_MBEE | DDR_EIE_SBEE); /* store the original error management threshold */ - orig_ddr_err_sbe = ddr_in32(pdata->mc_vbase + + orig_ddr_err_sbe = ddr_in32(pdata, FSL_MC_ERR_SBE) & 0xff0000; /* set threshold to 1 error per interrupt */ - ddr_out32(pdata->mc_vbase + FSL_MC_ERR_SBE, 0x10000); + ddr_out32(pdata, FSL_MC_ERR_SBE, 0x10000); /* register interrupts */ pdata->irq = platform_get_irq(op, 0); @@ -620,12 +624,12 @@ void fsl_mc_err_remove(struct platform_device *op) edac_dbg(0, "\n"); if (edac_op_state == EDAC_OPSTATE_INT) { - ddr_out32(pdata->mc_vbase + FSL_MC_ERR_INT_EN, 0); + ddr_out32(pdata, FSL_MC_ERR_INT_EN, 0); } - ddr_out32(pdata->mc_vbase + FSL_MC_ERR_DISABLE, + ddr_out32(pdata, FSL_MC_ERR_DISABLE, orig_ddr_err_disable); - ddr_out32(pdata->mc_vbase + FSL_MC_ERR_SBE, orig_ddr_err_sbe); + ddr_out32(pdata, FSL_MC_ERR_SBE, orig_ddr_err_sbe); edac_mc_del_mc(&op->dev); edac_mc_free(mci); From patchwork Fri Oct 11 15:31:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13832678 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2068.outbound.protection.outlook.com [40.107.103.68]) (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 E3672194A65 for ; Fri, 11 Oct 2024 15:32:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660725; cv=fail; b=qZcWzIbIN9ItZYgCk1kFWQgpfNzrMMCHLmLC194pwaxTqEAm9XfLYYHcISFar81T3VL+iOi0tyMqPaz6fbGaCBLJg73fR2IFM8dMY4NAxYWyfntkhw86EUUX/C/lwmJ/qo32gRp6qJqQHIo2n5qPKDRyOyvmuaAgpO16zp94WYg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660725; c=relaxed/simple; bh=bYOSUeH8Tsfygywx3VBHrQIC4eU9dzx5J8svyPSfkS4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ERi9KQz8IIW8tQ0uq+a0gc5MunsWR012Uc5ikH+wGJ39gXMw8uoku6x2ptUhoPxR8hJ90mgZLL9U+kB0A3Gf0gQ4CV32O10pBL1+G55lFZJ9zHFT4h99mYDVezrJZrkob/NaO75WTA02kwMYhSowK6W90PApLtq17sggh6o5rME= 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=ag0tOMSZ; arc=fail smtp.client-ip=40.107.103.68 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="ag0tOMSZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rEoOWXwahvR1BJEW3+lpHQb9Sa+iAmQEKMrpS58P585zcGFosZHqBSpcP0lPnXgaRrMl+FTqBPLQG4KlSP08yxYYHuvrWRndA2MrjIq27ttCxSj1Qx/gOV6S75haaVIRd/zozkFqEycfUDVNJZzGI+iXBKEus2mxabwPEO/gDZtMvfF5ForICAnTBwZa1Gja5JctlZQ6yjNFLECBbnv1sMgJ7Sf80gT4QBh1I2Nt1P7xEqcvTWt9NhE4NiH7MAWpFj7fg0GDzZxAgro8Aa3FEwm/oSJFmV8SnEWmcRfi3UQXTNpMHxYVnCyqGm0n1U+g9HRURJwEZdhYE8XJnwFbKw== 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=oThGc+PInWWFzFHWkQtWRVZUx01s9iDEryoUEl8TSD8=; b=cJ7YKl+/OdZ60XmzS/yLQ6+TFWYNi46QMCmp/LzP5grU/IFY60rrZmWE+DOD2C/qvGWj2iEmbNVYxRxm1/vq/MYMcBQa8YN73CtwGNYj4nGoA535IBY7xD9Uz+w+b3ubwQINKUDl2rhY+wau/RZDG2vvbABFt/Y2vtl1fSaqcatjyTe24X5PxYR3vjXeXDXquNfL3w6u9QDsEqUgyvDVcvfD5CGgF2kBv6dmnvD4yBJAqhFBzr/7LUDjZQQUoq1j/NM4yYQBWaxHQj7GdZv0yqMEP0S5iCcKXno8JKz77S3Eg9Xlt+OxsrxEchrT6/uTFFSOp9TKNucSaywEQruU5w== 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=oThGc+PInWWFzFHWkQtWRVZUx01s9iDEryoUEl8TSD8=; b=ag0tOMSZeGlCwY6HqL++k36OfWBb5CKMV/bPK0/5hIHCoIqn/1swExmBkvp43b4ShqySsy+yk+3n8g5KczbdH64l06Q5rw6vjGpsXPdoF4zQ2JlnpUn/chEL3rCOJTZFuN+9oUqdAX87/T9ZY/+cOq9i2fEKboxYx2BqVMmRzCxHCHGYQ/7M2vWG9fOrfDCGE6q/JMTGlWElhiWn6NgXhii4y5Rcsgn1CewgHRgBgmY8wbm47o7IzvbsUxvZoJKTzCazXD1OyJYMdC6iiGj8OJEeTnmcIu6V+jKbkzHzfftAqvPcxVdflZu5gokTXAk7YZfo/LHac4dmSARVX+4a0w== 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 VE1PR04MB7360.eurprd04.prod.outlook.com (2603:10a6:800:1a3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Fri, 11 Oct 2024 15:32:00 +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.8048.013; Fri, 11 Oct 2024 15:32:00 +0000 From: Frank Li Date: Fri, 11 Oct 2024 11:31:30 -0400 Subject: [PATCH v2 2/6] EDAC/fsl_ddr: Move global variables into struct fsl_mc_pdata Message-Id: <20241011-imx95_edac-v2-2-011b68290951@nxp.com> References: <20241011-imx95_edac-v2-0-011b68290951@nxp.com> In-Reply-To: <20241011-imx95_edac-v2-0-011b68290951@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 X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1728660703; l=3246; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=bYOSUeH8Tsfygywx3VBHrQIC4eU9dzx5J8svyPSfkS4=; b=Jr4ZBVdjm68AQYMozrhBBkHuOgXtkZe2yfQsG4tul8HwMEu9Uo4auwEhsTkM3jvVp+pVnWdqK GiUBeH7crjmAohu8MLvaUbS/kQCKODv1F1SqrqywQjvgjyJV5/5ZJCK X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY3PR04CA0014.namprd04.prod.outlook.com (2603:10b6:a03:217::19) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VE1PR04MB7360:EE_ X-MS-Office365-Filtering-Correlation-Id: a58a03ec-8828-41d7-0cd3-08dcea09d92a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|7416014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?KVETjEvOQBKwtJzFFh58j9JEzIOBmVV?= =?utf-8?q?KHL4dkMrfjGLx/AcpJ6hrmi9goFOXKw6uOeliuNVq2hnTN+71gJPccfcmOEP3xEDS?= =?utf-8?q?+Wb5qDjSMAsGbUSysdUEUinj0TE8VczVnVkAS/EUtBiXY590clAxID7IjCt8Vh2bU?= =?utf-8?q?kQTSRsykPMp/Jf7At7KFzdZrpecMrFiuB/Ss4UQGf2iq4ndn5wIJB3BOshvJwb2sP?= =?utf-8?q?enC9lNhVtXn8OXAitK9V38NuYqb2t7jOQC4kdw1KVLNyJyQqOAgvBVKQaf5jW6nJU?= =?utf-8?q?Jwv3/92gEmDMOB1yTrpfQ40zbXNT9yy0AlVvH4NSyGSwh1d2UIKfL7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f-8?q?bE3pAoXxxtvITm56opmsXjI8zMkeS10r8Wg+wX+ZFsB9+xUdhZZ53lZG5OfgF5VRB?= =?utf-8?q?uuuB1kPE0jcWjP8xDLed+lDZXZF56QkkSDNZ44Y92hZdXI6OX3KdizMI=3D?= 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)(52116014)(376014)(366016)(7416014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?cBZsmmeoImnp+ZpzOVJ3IclQYH9X?= =?utf-8?q?F8osHFdnHwoQixZwIzQgzf7M1RmktUVz5QfCKvj+kOwktG1Gau88oXMXQn0jl1yGr?= =?utf-8?q?GVcVrZCnUWpoNSsNCMAZfu9g8ia7Jsbypx4OtIBO9cGlo6k74DWbF4z0zzZfL7C/a?= =?utf-8?q?FY3lr4izj7qY8pdBzs8gfuYeKnCd3RhBBvY/GAXqKDv2/XP8QrGxxAyeluFvDF0qh?= =?utf-8?q?gauBWN/sp1wCih36oFhAWGmkPSsWUrtUy9I4GPw7sjzc9XVNkv07JZgAZpTLItPp+?= =?utf-8?q?5jlDWjrYquU2YRxGAEPfkbrecgSUKiuZUVOk3EtzBJ6O8nbqDsTF9ED0FY66p3gDY?= =?utf-8?q?GxxWTHNxhssM4Jwilmv/s8qq2nfIhMiaiQTZ4jEBGJMgqK9nWvYpOzBL1j2PM8BET?= =?utf-8?q?pDtfnPZeiAm8Prq4xF4m7FSnMbWH0zb9p/TBvklfWmlw5MD8JW4q3XCOIU7dQSj0J?= =?utf-8?q?Wm42jRttLUMHhF4hnwC6d2JKikOa0VKU8n2a8Mtw8bFFL/rnZ88nfvbmPEvRe2YNG?= =?utf-8?q?iY8TGZKHJaEO5A3/b3ijdeB8OT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OXEOtvoeeJFqZ9GqMu4wG3fQ4w6+CnGPp+iTN6j5TI?= =?utf-8?q?+hSioe7h1pVLWm4ebeKamWZbPcxH2X2hTiSuLO19FXmey8YDQAi30hMIVOI08gzqB?= =?utf-8?q?wDTstX9p54ps?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a58a03ec-8828-41d7-0cd3-08dcea09d92a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 15:32:00.0664 (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: bNuusndbDpAAtiRZGmMBiy3+0/o3zzKz3e2qf/miMXWs4oQGVdxFwPA5OZ71/janMXY8aBw9KRoOsX5l8CPA5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7360 Move global variables into the struct `fsl_mc_pdata` to handle systems with multiple DDR controllers. No functional change. Signed-off-by: Frank Li --- - rework commit message. --- drivers/edac/fsl_ddr_edac.c | 21 +++++++++------------ drivers/edac/fsl_ddr_edac.h | 3 +++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/edac/fsl_ddr_edac.c b/drivers/edac/fsl_ddr_edac.c index 9924c6b816648..7a9fb1202f1a0 100644 --- a/drivers/edac/fsl_ddr_edac.c +++ b/drivers/edac/fsl_ddr_edac.c @@ -31,22 +31,18 @@ static int edac_mc_idx; -static u32 orig_ddr_err_disable; -static u32 orig_ddr_err_sbe; -static bool little_endian; - static inline u32 ddr_in32(struct fsl_mc_pdata *pdata, unsigned int off) { void __iomem *addr = pdata->mc_vbase + off; - return little_endian ? ioread32(addr) : ioread32be(addr); + 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; - if (little_endian) + if (pdata->little_endian) iowrite32(value, addr); else iowrite32be(value, addr); @@ -511,7 +507,7 @@ int fsl_mc_err_probe(struct platform_device *op) * Get the endianness of DDR controller registers. * Default is big endian. */ - little_endian = of_property_read_bool(op->dev.of_node, "little-endian"); + pdata->little_endian = of_property_read_bool(op->dev.of_node, "little-endian"); res = of_address_to_resource(op->dev.of_node, 0, &r); if (res) { @@ -562,7 +558,7 @@ int fsl_mc_err_probe(struct platform_device *op) fsl_ddr_init_csrows(mci); /* store the original error disable bits */ - orig_ddr_err_disable = ddr_in32(pdata, FSL_MC_ERR_DISABLE); + pdata->orig_ddr_err_disable = ddr_in32(pdata, FSL_MC_ERR_DISABLE); ddr_out32(pdata, FSL_MC_ERR_DISABLE, 0); /* clear all error bits */ @@ -579,8 +575,8 @@ int fsl_mc_err_probe(struct platform_device *op) DDR_EIE_MBEE | DDR_EIE_SBEE); /* store the original error management threshold */ - orig_ddr_err_sbe = ddr_in32(pdata, - FSL_MC_ERR_SBE) & 0xff0000; + pdata->orig_ddr_err_sbe = ddr_in32(pdata, + FSL_MC_ERR_SBE) & 0xff0000; /* set threshold to 1 error per interrupt */ ddr_out32(pdata, FSL_MC_ERR_SBE, 0x10000); @@ -628,8 +624,9 @@ void fsl_mc_err_remove(struct platform_device *op) } ddr_out32(pdata, FSL_MC_ERR_DISABLE, - orig_ddr_err_disable); - ddr_out32(pdata, FSL_MC_ERR_SBE, orig_ddr_err_sbe); + pdata->orig_ddr_err_disable); + ddr_out32(pdata, FSL_MC_ERR_SBE, pdata->orig_ddr_err_sbe); + edac_mc_del_mc(&op->dev); edac_mc_free(mci); diff --git a/drivers/edac/fsl_ddr_edac.h b/drivers/edac/fsl_ddr_edac.h index c0994a2a003c2..de66f9822fba1 100644 --- a/drivers/edac/fsl_ddr_edac.h +++ b/drivers/edac/fsl_ddr_edac.h @@ -70,6 +70,9 @@ struct fsl_mc_pdata { int edac_idx; void __iomem *mc_vbase; int irq; + u32 orig_ddr_err_disable; + u32 orig_ddr_err_sbe; + bool little_endian; }; int fsl_mc_err_probe(struct platform_device *op); void fsl_mc_err_remove(struct platform_device *op); From patchwork Fri Oct 11 15:31:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13832679 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2086.outbound.protection.outlook.com [40.107.103.86]) (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 E10C5198A30 for ; Fri, 11 Oct 2024 15:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660732; cv=fail; b=YgqzoaIiWOq5hY5ALxewwn4gwaFM1DfH1xb6C0pZaHG8wHrQqZ3Wi2sWQmcb0zrNjMHfULr3INgAIYi6jna5uA09ivEnhM0M4HhcRhNCpwNvXBIiy3NKw3NegI5yct/l01JECqe3N4BsDRtZlbFo+mE+j+/iyt4Vhk8HDKQ74xw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660732; c=relaxed/simple; bh=hC0sBAxHzPnh9khLdTN4tfAoX1ZN08Fnf4NleRupY5U=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=EQVwgYYSJg5JUj0Ij4ABdNiMoV8cGOFuO4qevbxzdqYjgQ47QuSycBEM2vbfS0EVYpHVAAoj4HZK8YEOT4580ND7kUIG2fouTW8SbfJQojVeD+rTIzTre1F0Rgkw3F5cKLrDGGOwJu3shVjMUhVmRmpT/7DGV5CE7wgFYRELaOo= 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=G0P0puEG; arc=fail smtp.client-ip=40.107.103.86 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="G0P0puEG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JLsMksbZ7ldFthLQgSBiinu453UTWNWDNGfUfR3GUuEOJ0BgpNJvnr5fTWskiQUjQYtIuVAU4D006lFQwn3S1fcvReitIyXR0AbyNTmlAJK+iYIJcKoB+TQ9QZj2ujzAuqUTBXNb/lanwRf2eXx65h1nXyynv1cbWICdLM/+KBhPbUe7pW5UaSFMNWtCnEpkF467H8EYhoduUiTMQdQwYsfalaI5CPGRQpPYZ7DypkFD5LqJ/b8J1gfVWX43Cq98cLYmGywcru900yLDLzxXRAXfCzjC0XXBWxI4bAm3DC8+JzckluR/uX8q1xd2wsSnwyvFduceMaVnqjrYqFhZdA== 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=L1ERM/8wrAcld2CBubSctUu43sT3fAk/B7hSFIIETS4=; b=o+f/cSgD11bMsD8XzB/IXsuWxGldJZnt9zj/2fQkKW2uWj0mWBd/97DSrlcWzdTYSL1xE8Hy0PgI562ceKdoYP/4tTLCrAEFAjZlvFX5flCOLLl5AfoDXGgZUFXLqCQjn+Iv59RVwwBOhjP6jOCACMss+y8XDjFLRmxyrC6BdtcjpSpsHHfIdeSDStMQ1Ht3C9kzHtIRyevW01e9YRmw4yLebvchPtvBxrKDe2mRF00+Q8JEMIawtcLbK2ohmrA89euFvwvG4m1yjfkUBHWVcTicuBXGB+7VUTrB1FsS6LOpbpFMcavKoyCdJuoZD1N55H7xuhkfs2Q7OmTFdXXunw== 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=L1ERM/8wrAcld2CBubSctUu43sT3fAk/B7hSFIIETS4=; b=G0P0puEGzrIe3TKl0oNVtsIBYB3BnJYZzuVpU5MGDO23AR+U8qMvHrsRFGjGs2KGI0U8RfIrlzj20JSho4lRSiUAfyJr+Y+8aGW9jtGC5LluFrrinHGwG0myFMGFNdrPLPvbSTjE3aZxulwxgAghu12OCSfNW2nepdECOz5L2mnASwuaYy5YKKVlIPzLn9Yq2aBf2GSH2466pVNKIWp+mZze+cnF4xxQC5VMU5NSjfn0RsdSYY7+I5JSwHJUwumfr+mu6XU4OoB8IoAML+IzKE2aFPBYVlmV56BZa7TD7cLOHbasItb3kekYDHA0ea1m/T8nUVGprGdPxUsV3f7FnA== 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 VE1PR04MB7360.eurprd04.prod.outlook.com (2603:10a6:800:1a3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Fri, 11 Oct 2024 15:32:06 +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.8048.013; Fri, 11 Oct 2024 15:32:06 +0000 From: Frank Li Date: Fri, 11 Oct 2024 11:31:31 -0400 Subject: [PATCH v2 3/6] EDAC/fsl_ddr: Fix bad bit shift operations Message-Id: <20241011-imx95_edac-v2-3-011b68290951@nxp.com> References: <20241011-imx95_edac-v2-0-011b68290951@nxp.com> In-Reply-To: <20241011-imx95_edac-v2-0-011b68290951@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 , Priyanka Singh , Sherry Sun , Li Yang X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1728660703; l=1906; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=+xRnp+RgtbOKGy8sOPUGCuuHfdPE/AGGQkiNocVxHng=; b=SMO52SX0EcGfPBqBbXpSDQbbPJX77GVtYwAMuCSnjLrGcDJ/ZFR56hKvD8MaU9TYgbn5zZv6X SFvzBe7b28uClXDQP20eGC60xpABjgiLBoGg2PWiMggsbsRFik+ii9U X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY3PR04CA0014.namprd04.prod.outlook.com (2603:10b6:a03:217::19) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VE1PR04MB7360:EE_ X-MS-Office365-Filtering-Correlation-Id: 81e99a82-bff9-4492-ba7d-08dcea09dcbd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|7416014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?CyyCHkaJUXC1fTrgNN1EvLkJ7iilh6f?= =?utf-8?q?OAGkIpYp//0H5ugn/vdAlYoSB2DecKQLM4joZG6H28xFS0waD/BWLMBjB0xHXNxkL?= =?utf-8?q?RS8BhwMBOy2rt9tRyreCz2BrtbPmk++sxZmDoZJWn5mKIT7xIb1eZ1aJg1/3Kulf4?= =?utf-8?q?iyxjkMrdw2lOl7GFzOeL87gNYJ3wR6p+5ZYpmXjqT5QX2uH1EUs8IqhhEB+a06MT+?= =?utf-8?q?lURRoowObRCNfLDjHnBeP4fgxD5efRt6Tk7chBBzQahvEzLkNyu2K4N5/aAXa57qp?= =?utf-8?q?u5qR6YlNlwG/Y6hVbNzqY5O6guFs7dqkCtXcm+BZ6vLMpErksvN4EwU/lA4+ui9Tt?= =?utf-8?q?IkS16azYt8U7zO4fjm8JIdq7wSQx/GKUzto1gLkUhXHTFN7zcGXQ7jSoUMQWNKsI5?= =?utf-8?q?O9K3u8UURFdIXBUqN1bTrBGUQH1TRjhfQ0qv8ZKCM8CTxzoqc5H62UVnkwWFgPkvX?= =?utf-8?q?UwvPj2kemVPGqOBZoLr2CFBhbJ0EO0LGVwmKr64BE1N1nQmFlsaJu5ij5t5SqOmaG?= =?utf-8?q?R1EBnocNG46XDqW99SIRmCqA36cZKS7z5Ak6yEAM41Hj4g0n84D4yr4+KC9rjI+Dn?= =?utf-8?q?4gffcsiuFF0fflUmIDni0+G9uLNv/a6m1nD7OVCjABiVWsaUsozoiHnpq1/erSJc5?= =?utf-8?q?Q1XjG+6svBjRQG9AfAt7gwz3j6D8Y5GCDaZNrKD+lNpt3kGQeykrzGXbFONs9N8pY?= =?utf-8?q?wSIzLBa/pTbrPgedr4idxsh7dAXK7fGIZO+T94oPe6xV/bUhUwvBthyOQAPBkQJCm?= =?utf-8?q?EL988Lpyqyx/HjIYhQTlJz4dJKupMIdLVs1dxmEu3F1Spds9ownqYQspXKxBbSbmB?= =?utf-8?q?wGsOX7tNLUYwAg2bSyCTUFBcWhZNlvZEAyejAvEhAfGmGJd/5HbH1GmZppniaZdRq?= =?utf-8?q?HNDLQ9u9rnjI0OExR7Hx/hmwmjmhf/cH3KA6bntC57cslCa76DCErm1LD2bh6/248?= =?utf-8?q?O8Bw8hoYAc8wZvd/eeGWHNbQJjWzRAUEHHhNGtLQP/z/IOEzgAOP6L9Np1k2d+/4H?= =?utf-8?q?EzZ+E6+AZ3DJHHqe/ighjfi6UmKJEdNrhD3aO2h9nU9gKHIQlEv9ICYleBQd8wxyd?= =?utf-8?q?fxuecf1uuxD91/9qOMtElCqM7ZxbdzfScb+dCZtX4mNGXgsxMO5UWezN3sA+LvZtj?= =?utf-8?q?aqBH8bLG+8FdOjIvk4V+oYmrNVEzHKPrV2C4Wmc4aZB9VErgrxJbVNSEj3FxIz/4U?= =?utf-8?q?+8ZMweqdN+bjUOBKvRqdQQF4knlpV1EdgXTmvWMML1bcwgo7DJ3PlC0ebTJSF+Znj?= =?utf-8?q?IrPKcyRYqf7y5VegyPfAawWGVpLXniWZ5TNPnorEEo2l2BV05YwFkzc0=3D?= 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)(52116014)(376014)(366016)(7416014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?asobm2R2GQkOXsTAO1bU17KzURxs?= =?utf-8?q?vXvkLgnA+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?qnwkvA01HRTY/ezd7ccp+8w4GHTfOypa3xWZIF/68+RYAC1zt6+wzqQvmQgGNXFyF?= =?utf-8?q?uvMy3vOOyjKEfVQDl5lms55mPm9PLkduZeeVrjumtwe0OsA9me8qZv1xA47ACBh+8?= =?utf-8?q?IKrko1k6EF/Dwl/KdgIuP962M6ELOuHF+Qx0YRXUfDXgEQugzhWZs5CdtAAq8RMD7?= =?utf-8?q?A0aps086RErXG+i8FbWewJS3EfsnTJs4zT50AzJVEd0yQ7A3m6qMJU/jbx/2e4r8B?= =?utf-8?q?drMZd+6SbHpYJZzYBBc/3/MJVWhs0MjvRAB9y6EubBSzPbCc95gVMOsd6qz0OLjrU?= =?utf-8?q?HxgBQZbjGvcUftrwbZwEftQ9wEVaws+72cp0YFaxrJzLVZkc8IDjTXIpCtQmSBoq3?= =?utf-8?q?yV2ih9QhSb7tlv6Pcn9e3u6mfsker2VOO1QE48/V/CjbkS2+sH0ufc0+AmVh9/BUn?= =?utf-8?q?tGAU+yBzaXIAvEjgFeYVXufYC16pIF+8Dlv5eaqcYKY1M0g/OlUJApwzotwEpMOrC?= =?utf-8?q?KKtgJffMb0KcWGYsG8v9Wxt5tv8HowwMk6ByjMkNOiLUBnXB3UBREwbl9FGo7Knti?= =?utf-8?q?eiW0oCiNSfc8igdb7TivKsaQkXkul7YiqWIDG3T91pgOIXJ6hdAV34p6zLfqiHiOm?= =?utf-8?q?yEidZYv3WziJ?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81e99a82-bff9-4492-ba7d-08dcea09dcbd X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 15:32:05.9771 (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: lFKsWBLy1iZ/9aUtR2af6dxuthCUaNhrthmyWa/L7QZlUiFUxP6lxL5iv2GgygtHcsW/d1LOBMPm4eKIm4cFTg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7360 From: Priyanka Singh Fix undefined behavior caused by left-shifting a negative value in the expression: cap_high ^ (1 << (bad_data_bit - 32)) The variable `bad_data_bit` ranges from 0 to 63. When `bad_data_bit` is less than 32, `bad_data_bit - 32` becomes negative, and left-shifting by a negative value in C is undefined behavior. Fix this by checking the range of `bad_data_bit` before performing the shift. Fixes: ea2eb9a8b620 ("EDAC, fsl-ddr: Separate FSL DDR driver from MPC85xx") Signed-off-by: Priyanka Singh Reviewed-by: Sherry Sun Signed-off-by: Li Yang Signed-off-by: Frank Li --- drivers/edac/fsl_ddr_edac.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/edac/fsl_ddr_edac.c b/drivers/edac/fsl_ddr_edac.c index 7a9fb1202f1a0..ccc13c2adfd6f 100644 --- a/drivers/edac/fsl_ddr_edac.c +++ b/drivers/edac/fsl_ddr_edac.c @@ -338,11 +338,18 @@ static void fsl_mc_check(struct mem_ctl_info *mci) fsl_mc_printk(mci, KERN_ERR, "Faulty ECC bit: %d\n", bad_ecc_bit); - fsl_mc_printk(mci, KERN_ERR, - "Expected Data / ECC:\t%#8.8x_%08x / %#2.2x\n", - cap_high ^ (1 << (bad_data_bit - 32)), - cap_low ^ (1 << bad_data_bit), - syndrome ^ (1 << bad_ecc_bit)); + if ((bad_data_bit > 0 && bad_data_bit < 32) && bad_ecc_bit > 0) { + fsl_mc_printk(mci, KERN_ERR, + "Expected Data / ECC:\t%#8.8x_%08x / %#2.2x\n", + cap_high, cap_low ^ (1 << bad_data_bit), + syndrome ^ (1 << bad_ecc_bit)); + } + if (bad_data_bit >= 32 && bad_ecc_bit > 0) { + fsl_mc_printk(mci, KERN_ERR, + "Expected Data / ECC:\t%#8.8x_%08x / %#2.2x\n", + cap_high ^ (1 << (bad_data_bit - 32)), + cap_low, syndrome ^ (1 << bad_ecc_bit)); + } } fsl_mc_printk(mci, KERN_ERR, From patchwork Fri Oct 11 15:31:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13832680 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2042.outbound.protection.outlook.com [40.107.103.42]) (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 2FE6D1991A3 for ; Fri, 11 Oct 2024 15:32:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660737; cv=fail; b=cANnCS3XRH3UT4EbqFjOAnSOSNgzBtTkeiThBKqHTVQaPzMiQTDCkz94G6dp9qGytULjYfHwIXqz4u5jHhbu6oHho2o2uZnZ+SOQ3QtGPYcU1Bth8ZGpq0dy3anp78OC9F6eDMnXYX3mrjJ59OCfkSYvLx+YhA0bFpOCUW/z6Vg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660737; c=relaxed/simple; bh=lyWe/ySMkDZ490wGZqd1uDY524RbQ2uyh4spYd1a1x8=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=UW0xZ33tI/kXOl5uFRS8s1eHdRocz0bAmWyOZ8VfsRzQOnMU2g0dkMw7vLxx1Xl5uQibKmS2xAzfrtyy2v/KaDw8I4OhYcn5aYsHtoeqpfoAEvzFzdF6IzMB4f76N3r/qUWzDSKdm2b8uhSP2P4oMckBofzfCA67uE+8fn1uGfw= 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=i7hM8ayA; arc=fail smtp.client-ip=40.107.103.42 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="i7hM8ayA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UGxKQfLwGyZREdw4HxRv4wrJ2iZm18NK+X3uwJIdL5cDFGKKWwuB4lOB6trIS/+AL/ak4drnMEqPg/BBVV7vtv6zzq723zVjU+41Va6qH26XT2DUUJZMenROAoLpRHDGk6FaRBlLoExhTLqWmnsxKIMD7zJ1q7IOpc+8VxppIuw9JsPuR8pdOL/COgJdmOQuAhq8nMdmjNypyYiEGv3FohXcFgCb4uygUAPAvwieJtiVpG4etAky4vL74IpCx9mvu4XLLnanut2KKyssPbC2GK/iBnPhVKJbUAaRLh9u6f+pTJ7c5XBqO/wfR9F695r10fEtpVVL00eUJW0roJPbwQ== 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=qMo2ngT7gPC02/8eJPlx4Oq5Zz9LMuVnQAOCsuCJbzU=; b=NAD4mCozlbfl40y/GccvCefq9CSxXyu4Ulp6rMGucHpGa3Setx643tvnprH09Bw63mSMD82i3pCGDisTGIZMmIya9FZEZNA5r2JVhZ9c7nx+esalTCuJjxq1Hb9nSC3gr4+zkN2ktXdJZLL/OzpnBUJ9Ga0grynRqu7SqZs/39gUnwvgyi81LD6JY2oaq+cZ6XFC61a/hvhMEX6OEO24z4bYQi+zvcJlLumno1aoAVW1WU66N0cspaBcHTshUgQaWdwsngfYlx4mGl4qzojpzut1BDuOfyc0amsDUauywTxZfGjag5zxBl3Pb0CzTWXIXVDLdD+84CvDOABeAGvm0g== 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=qMo2ngT7gPC02/8eJPlx4Oq5Zz9LMuVnQAOCsuCJbzU=; b=i7hM8ayAI0mDQCWGuR2nvsP8Z+kKvamnuB7HoxGyy+DMCqvrpDh4RendBFLwaM3BFAi6ra4sE41lwwZBaV46IZEhUomEFsmw6/Aw1oiU4xU8QOiETb2yB9oA7sdcDMi1TiGHl/SNar4L5G2Dx1D2FL0m/+LPtKjniQiCKUnvglONPqRttwpuGB1WuRyhZjbA4QhpTK8hduCU825LBIu8Mso6V5Z8+ivg4+tymHO9lSDPPQItsEhjg6l2jthCHSGEl3IjXgHopb4GUCFkaaht+3P/a+LauaCpFq4Uas2+cd4Sigzf+h4TIgfY2DJaY2bAPisAPuaBSsYNF01JrF7t3g== 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 VE1PR04MB7360.eurprd04.prod.outlook.com (2603:10a6:800:1a3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Fri, 11 Oct 2024 15:32:11 +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.8048.013; Fri, 11 Oct 2024 15:32:11 +0000 From: Frank Li Date: Fri, 11 Oct 2024 11:31:32 -0400 Subject: [PATCH v2 4/6] dt-bindings: memory: fsl: Add compatible string nxp,imx9-memory-controller Message-Id: <20241011-imx95_edac-v2-4-011b68290951@nxp.com> References: <20241011-imx95_edac-v2-0-011b68290951@nxp.com> In-Reply-To: <20241011-imx95_edac-v2-0-011b68290951@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 , Krzysztof Kozlowski X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1728660703; l=1970; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=lyWe/ySMkDZ490wGZqd1uDY524RbQ2uyh4spYd1a1x8=; b=8xslh7HyUKmks2Olrk03Ae8GT5TqK/INwuDUBhtlDDIKksmu24kLZyPT7edpKvnbT/Be06O3Z Y4s6zNk2GrFAcsi7vbKkJBbrYW+H64BVD7o25CZGmtRRLxDfSq2Sr6N X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY3PR04CA0014.namprd04.prod.outlook.com (2603:10b6:a03:217::19) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VE1PR04MB7360:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d46f4a2-257b-47c8-3d54-08dcea09dfc6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|7416014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?9EUgAEuReTqyBoSK/5Dcd5JrS8Ln18F?= =?utf-8?q?IJ5Ysf/ueiA6AMIZH5GQHIJ1lSYWq+W3nEPmE4LcvJf3pJNgSiiD+OCgyYCbGd8Hc?= =?utf-8?q?1AcvX2f9TDMCysQPwuYoYV0UC7EmH70ygDKJmz5k4VBZ9OsSd/1fig3BWSaYN5MUx?= =?utf-8?q?/HniZc/400JdNf1DIoN3CQ+1OGanCzYY1zjOowYKnjzqvzqHRetHOOBcu1HL4h1Fm?= =?utf-8?q?u6BY49qeYav8df1vXiRl5YOACy/9uPl7mSG44OgkUCQswRrtAfyXdenf5sNOcKpsL?= =?utf-8?q?LcW/yjMi8WDFawDhxzgIPfkxcydvi3vjOhZaiAwDjbwaqe3l1JpVgxAPGLTZe0+u2?= =?utf-8?q?UK0gbnHj1YlszJFjTXhIX0W9R9pdAb4jad26ykLGqQSM984E3b4dTb6aDw3gE8cyx?= =?utf-8?q?iDq5OyZ9GHHk1XjlaQcQJjOJHE0/dr91lruYXjelwvffwMLxIHAOjUOSmtnRRFTVF?= =?utf-8?q?aSHT9nN90xVWxU7EEkRFQZdoYxMr+WnYgtgiyPwz+Du9u+1mvVwRRgCH//EwMiBd0?= =?utf-8?q?hWvaN5NzUsJQwVd4zV8ohnpwVS6wNYpRuGQGNzdsU6TPeune+trcW/u8HT633u+Ap?= =?utf-8?q?5TRkXjwuHIrY6DRBidD8e3XubC8fHJzbO8VxXCb+QBQqE9oEvbcBFfVyUVLEub5A9?= =?utf-8?q?057XnPAMdQgpf/m2oevfqN8Q6uocrKqSRA0QtZxS3ouDrtT2mwS6RKvFGqZ9oKILx?= =?utf-8?q?T12oFXgIgV3nu4eCGUwA0L9cQdWavHxCmYrirjA5O4/tUJmYBFN92XoVbTqcXti3a?= =?utf-8?q?1q6+veyLRoPC5VMDJBvGkrI20pa2F2wTWmfD1pPrj9bXVUYBBkZA2/EiFYOcJvMlv?= =?utf-8?q?j7Sb+EvFiZg6xg/fGbKgltBBT3W2dOnj1My1hVCQOH226VG+75sWbuBXJkhXkKVtV?= =?utf-8?q?C5x5jGGyYIxbGbpmwe1QKZhVhzq1vo+XsL2IMlB+/L6DTn5hjaWKqGB7/oyxteTa1?= =?utf-8?q?qSCdRhHQbh7i3hiIfdofSzEopSZzxaHwvs9+3lNea2eSOnfq081SNbgFPkS9thiFn?= =?utf-8?q?QeUZ4p/yrkg0JgcUtXe3pasgA5BD0/qB+ZFQd4YtOa7snDkGhR6i+4zA0Yzl1vQpc?= =?utf-8?q?2wtCyr/6m8PwkbBgrF+PCuvxGKtUJZCcvXxKCG3WD5GsVkXkvhRmQV5nKU5gULyhy?= =?utf-8?q?NJ03P+AFZq1CPGVIZ5xA9VAnyYa7isARPzNge7Zoqc5u+MNsBhKIsGDURlHsR5azE?= =?utf-8?q?ACy7jKAVN6e1cRFTqLUHvJIlb93fmwV2kuxgK6ZaOVecO3U/BJ5o0i8sI/CHMtT37?= =?utf-8?q?GrgPxbNolEA2bIUnNMdb7IXMagNM8MihnbQ=3D=3D?= 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)(52116014)(376014)(366016)(7416014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?4Ni0hFiRnjWJf01bBV4llu+ygTu/?= =?utf-8?q?/SwaRHNSnsyniYhG7rR4mzFu6qEaq8sndSpya+NHnJOn24La6zT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Sad7/+lWGd?= =?utf-8?q?hJNYQwVGppOU1P457bcR+yMG54P/F/jP0y5pwL20ZAD259Er8HVnUb7IUvXXBzrTY?= =?utf-8?q?irGivVquJ30YwTzMYWok+nyAC6InnFXfPKPzi3bLWetoo1rIjpsAKk4Wl4KpyZlqd?= =?utf-8?q?5hs1A9nmIi/Q+I1uItznnumsNXsTIAT1y+AfF4j3WWi/RiyEUmejty4g/OmfxMKvN?= =?utf-8?q?VJs5B661uHHMfw+oXB/lV3K/D5flH/GiJyn0GHrnvIttLmsWghNrEpt/XlLVdGbW+?= =?utf-8?q?bLCqwgcnO4dlH7duri1FoCecic2E8qVFn+z/94MPBZtUVHnH60jXlR9ZyRFVnZHnc?= =?utf-8?q?WR+1F1X4U7Or/03orp+H+iCf6riUCIVe4O4ZUdWu3JTrsvyOzCX4vGYa//UNyz/LO?= =?utf-8?q?8IdNbnNNmKKI93CMhRKNz7Lt3acn1GQhS4GUpnNqbYAq4S59Br130jyYipZrWJa/I?= =?utf-8?q?Lv3i7j3eCAw/rKtz1FnyWSsLXMKm7xBnEAx/z+bcOSmE1qxG378oJI71ugeZG9DyU?= =?utf-8?q?ThqTXu/Xg4cZ2LIwwBD+pupMEKwgsNWN2PO6WRzDwsyVn9LAvjVFfiQ96sKIaAM0G?= =?utf-8?q?1p1EvjabuojU?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d46f4a2-257b-47c8-3d54-08dcea09dfc6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 15:32:11.0828 (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: VAzlLe0S7kgcgZsVFsmqVLzX02+BJ7gHLOo7jRqF7Oy4zOWWD5Mb7GKeZfsQxtGFNRZvJ5MI1B9tiyf4iSoxKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7360 iMX9 memory controller is similar with other layerscape chips. But some register layout has a little bit difference, so add new compatible string 'nxp,imx9-memory-controller' for it. imx9 need two 'reg', one for DDR controller and the other is ECC inject engine register space. Keep the same restriction for other compatible string. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Frank Li --- .../bindings/memory-controllers/fsl/fsl,ddr.yaml | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/memory-controllers/fsl/fsl,ddr.yaml b/Documentation/devicetree/bindings/memory-controllers/fsl/fsl,ddr.yaml index 84f778a99546b..e0786153eec73 100644 --- a/Documentation/devicetree/bindings/memory-controllers/fsl/fsl,ddr.yaml +++ b/Documentation/devicetree/bindings/memory-controllers/fsl/fsl,ddr.yaml @@ -40,6 +40,7 @@ properties: - fsl,p1021-memory-controller - fsl,p2020-memory-controller - fsl,qoriq-memory-controller + - nxp,imx9-memory-controller interrupts: maxItems: 1 @@ -51,13 +52,41 @@ properties: type: boolean reg: - maxItems: 1 + items: + - description: Controller register space + - description: Inject register space + minItems: 1 + + reg-names: + items: + - const: ctrl + - const: inject + minItems: 1 required: - compatible - interrupts - reg +allOf: + - if: + properties: + compatible: + contains: + enum: + - nxp,imx9-memory-controller + then: + properties: + reg: + minItems: 2 + reg-names: + minItems: 2 + else: + properties: + reg: + maxItems: 1 + reg-names: false + additionalProperties: false examples: From patchwork Fri Oct 11 15:31:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13832681 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2068.outbound.protection.outlook.com [40.107.103.68]) (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 6D5985381E for ; Fri, 11 Oct 2024 15:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660741; cv=fail; b=c8EZLMnvZvB6CoeGtwQUPaSbWd9fsSfp4mdSYlUxU4bcols6GcAm6axrURjuWSApmxLpRfTpx5o5gNV/d0VPEPN8bynrfRw8gF/LoJA2DrV1lzRgIM1GVftyL7FKg1d5ItW1OA9Iq0DZ+U14l/AiIZRskf0gQlKapJD7exSR8a4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660741; c=relaxed/simple; bh=gc6MJagSfltYpYFvAf1m4jDcabhy+YaKNDc5xPAp+Ho=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Z7Um+grTylyuweIDRs8nQiZdFFM0f/2w1uwsFs2al8ygr2njtthWPD5th4qOH862JZZAutGwUF7qqnyz+QTPl82Kw/TyePLapwsoDY56K35CkuM8RTxJZvsNGxe0+PN1qNctU+4mwEOexS7WfydibhqENf1icTHqaFgkan2jCe0= 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=aay3Dn2j; arc=fail smtp.client-ip=40.107.103.68 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="aay3Dn2j" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jcLEpqRJuzlGlA3iCLpBg0/IxZNqCuW0pKav7l3Stly/ABlQwtEAEyMpDloOjijXVMHh/iJ1osmpBz6DGlFlKMtgZAnRGWFoz0TqC+fRY2YjWDd+tB5mW1CmEa7zSrSO4n7j+ILLOd2j+TTEGIE9TG2K3vbof9EBaGn5puOT+8kmwD5/qJuacdydUx3ofWMKDKDKOQeFjhuDomCHosrEW40T2EQ8DvySy79u8AdqI/ShzHaUnJH+GQLNE3L7yxralF1PA58EeHIuGkUVNgPjI6lai0XJFMXMfkl2iHoVkzg5cMj0zx1Z5VGveMorEefm4yHkTYnV3yA1OgxzD1k0UA== 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=mxG0yqWh7JOJe4yZxrUWXuSBYgE7RS5YP+66smYxrH4=; b=eMyA8FCBU72m1skytn6Q3jI4wxNe+qcSmh1mdni7IvGezY1rhM8CfTmHCEimZTW0VMzGFxRqn8D8/wvQLRyaDzGEGuDmL44JgLqcA2Jkork4SHGApaYuVqW4nwXvz1UpmKjtzP69b1QlG15v2j1B80Z2oTBJ7ct6RkgjVDaGkW05TpdDi01eP/MPWxd6mds2zzokiapJCJ27S/ap2gSvp25lzVV54Uz3rTGhTOcv87rktrHHjmNm0miYNhqRGMoeSxEoS6nGjt3x2Z8N2eJ/qxQwawXmIdj7Mhstv3RnPM/8UeDNfxeWv124J8L5142dTzxA2LJJZJIq4FhH4SRGSg== 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=mxG0yqWh7JOJe4yZxrUWXuSBYgE7RS5YP+66smYxrH4=; b=aay3Dn2jnbWT2/c1UmxcgJeUjgkggG6D7a0qkmO4uYWGI44lYJEqQFuyH0Wn5aj5I6Pg75IRWLT5jgtF7juC9ReRAqrAeCP4VPq74iQYJTeWLwNz9mFXNeemBaEKwfvJKu3400CGA3R+F7bNNrHQ7wKRrTHNzg1jk54zgQuxpqUhxhjdk4datZl4m+gVP+sTsfjVnR285i7+Ao8TEAuMXypARzRiCoEgP2PhToyG6AsvIhoYO+uK3y6a2t8JJs7WiC25XbzOJt8ydowEcyhTkLyq126lt95sGmIpuyJSEZWMgBQEz4QjMj6192u8liWXQx7ATMbSoupPBNPtQFRK3A== 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 VE1PR04MB7360.eurprd04.prod.outlook.com (2603:10a6:800:1a3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Fri, 11 Oct 2024 15:32:16 +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.8048.013; Fri, 11 Oct 2024 15:32:16 +0000 From: Frank Li Date: Fri, 11 Oct 2024 11:31:33 -0400 Subject: [PATCH v2 5/6] EDAC/fsl_ddr: Add support for i.MX9 DDR controller Message-Id: <20241011-imx95_edac-v2-5-011b68290951@nxp.com> References: <20241011-imx95_edac-v2-0-011b68290951@nxp.com> In-Reply-To: <20241011-imx95_edac-v2-0-011b68290951@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=1728660703; l=5954; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=M8I8hajo7XY5xWGLxmn0PTrzPVpEdSTe8Q2nAI4GQg0=; b=7h4BJZ3mCnPCp/AD4A6vgkBR47ZLFq3MbXdu65ZwN022GV3hyVKXT7toQyBv/9i4bctjP0Ft0 aj4V27sIwQsDXUdWxSpOFedzyS1TwYkXpKBShyGiDlE4goRrDDvTEmo X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY3PR04CA0014.namprd04.prod.outlook.com (2603:10b6:a03:217::19) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VE1PR04MB7360:EE_ X-MS-Office365-Filtering-Correlation-Id: d0c13928-fb2c-4cce-5701-08dcea09e2eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|7416014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?5nO46jgCH9LgVFacymnf+RYaw+TfeOO?= =?utf-8?q?ScRvti4PMhd2sRu4AbY7LUEHjgNgkNbG9C0Hd0GUFJQOfMCFUEe7UPMWKgq8Chkj9?= =?utf-8?q?p7LiJyYRS7PQXpfhw1CbXaprpaA63m6B3BHFh3mPNdkB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ApbNDI6N?= =?utf-8?q?UiaRKu6lYuQanBzd+MgLoQSB/O3/XeLTFeW8PQMpjj0nvymyBVH0OcpUnVfUoOv3G?= =?utf-8?q?ntPoKYyQtgKX5tU4sqiw4xCPcwZS770/m2tQzcEgoPG/q0MhLUVCzDxM4kqQHPsOz?= =?utf-8?q?cCnIPs3+O0sgrkOaX9FFOeuFhO4Q6KUehwciNJlPnWHh5RwIucVqx4zgXsChg0BSL?= =?utf-8?q?uBdjugrFWHaDVdVqBNfJll4Wf4cCV/jZTH6aH5EZVLUn8tCpFoGR981pZRqbgfuF+?= =?utf-8?q?FgSNcjr/Ag4cmXfYjyAnBKZtZx3RMESke0E7/EMLyfMNZJNyUcJQkq9o=3D?= 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)(52116014)(376014)(366016)(7416014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?rRGChV4Ff69a0iR36DKdjzfFvHv1?= =?utf-8?q?Et5kusbXu0pejxFM+jjR1YLVtelyUfjolTwb+pHgIaaPpZL92Wbo/bWFGdd7UyD/6?= =?utf-8?q?HwN578NC4Kz4Wdj7z3sNp7OYrJHm523Ix6BIMyTl5JJxKlXhr2+DIbkrfWo97J7Pg?= =?utf-8?q?sddgXRTPkjwTSFjSAgdQRzViYN9zan4uD+V6fxb9iV39uiOrxVpDHcsV6KHFFHeo+?= =?utf-8?q?PBxqHKyKxc5h6x1tA2ICrlSeR+VLfVrs+4n14O+XjoGvBN90THRCvUcmn1tDsYnrZ?= =?utf-8?q?Y5tqMV3pSKgtClNwTH3TNzH1/avi0Kjp5O9E+O4nKwZ4hTHz3i0YUS3tLEJVVK4WD?= =?utf-8?q?GhG75jNZm+NBvwuj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LspdcLvqBvF0YADuHoXp038fRpvwro8SwVUnvvCNeCwvR5?= =?utf-8?q?GlGZpU892BW71IGjOU1uMT/rQPG64BQP1mepsqfufCL6h70HEmhRquSuhGqMSq2Oo?= =?utf-8?q?Y2mjKVIA1r6UTgaKYnPfK7j7e8jCEgJLOPIrzMUjcTMLFublWU7t5dpknSSnXS8Ty?= =?utf-8?q?etOb1Sx34pqXiMmD78Wv5hdRPCUmKLZgkrvaBuyxYMvAbY4sEVLLEMGG9LgGJH5WB?= =?utf-8?q?TJLnJXGt0PfNNbOSAGcKgV76NOJr+GBwZEdNnwIVr2QkgdujORa+CJn/lA/KMBzvy?= =?utf-8?q?umhiqbbYjcSA?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0c13928-fb2c-4cce-5701-08dcea09e2eb X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 15:32:16.3282 (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: CM6a9wDgmT5mkqJx3mQ2KWmar3yeGEkA/uyOv60TPEmbr6WPJLnksdh+qTMyqDSYVX1Bb37il+3vCXL6w5g3aQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7360 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 ccc13c2adfd6f..3e4c2869a07cd 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); From patchwork Fri Oct 11 15:31:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13832682 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2082.outbound.protection.outlook.com [40.107.105.82]) (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 01A88199E84 for ; Fri, 11 Oct 2024 15:32:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660745; cv=fail; b=XHqqk/KqqOOzCJ4CaQzhQcm0Q7V4YM5aggJy4FNLMe2eyMRQHkPn2HqxmSmdc07wS8LCifPCMQ+5i5NGS10LVICFhJV1T643ZrjSJH9Tn2XFbhWhksPkGlNXBopXgFTGspGiaUFCd2zFnuAm8P+80w7PqwKHt2PcLN51nskLJqk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660745; c=relaxed/simple; bh=79MXg57Cyd0Ls8RHW05eE1dZDeIAJiwGUJukDHuBEDA=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=BByaFvRjUx30wXPApxhhVpQqPsJ4ETKq5K6ov1hT5YB2vuErdQgG9YKUys3VcBD9DsXKs7R3kIH8Xx8EnbXWDTQW7lQEkDcluQtqBKYLE/J07389mWinx5myFHD36U6qKn18XjwIG9YtitGGwCO9nc2DTVxQm3QjQJWsncggGas= 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=PLi83TMZ; arc=fail smtp.client-ip=40.107.105.82 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="PLi83TMZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yR5Cdc2Y3t2N5YYhxRYo+a5UKax2dpU2cBbaKGYsiFagmc5cq51qSscHCVlTNUGi9sZ4liSUR60S8QctwPJ3S2o9Sb6+8CMDUNDS49YDqyeGeg89g9N5hNf2Q6LQt2DCr/OjDkQF1oFdUJn/5zXYkmhUtu6Ad0ZnONgGdbAICqheq42dKILNYIFjnEaR/Bn1W8lJGyVG2irwockJYZZmiIx+5mIpG29UtPs0ZR9YAC8q4go8TXAu0dQnMyKB3pOdy/JUQqG7WSEJixw0aXwrwwg5cNHPVpqQHs3bp2veYTLIoTnyrPAxO+nwWfqVKu4zVC8NK440L13k1k+5ocJByg== 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=yMjEE4+kvbYP5U/kSZ9Rky2OKvC/sfNSCk6XWJ+IRQI=; b=O+tSwGhWprLNHWAsFWHuyxmAu0T58MIDhuV5ojTv5RW8lZGtCcraV0LQnKxqB+4l4CCUioayvLqPmBchMPoy3oqrS23wWRx4zRxD0DJtpPcZcbrll1yBRn2/Eq7CiSv9q4a4qbP3cN5ma5XXFDm9KtQnQE/kgo+3+F3GVa7iB+Fc91w8jd9oSzKcIjOVE7MlGgsJpmGEaNabs/5lblJ4WKo2OLyiJYvOHgveJQFkh7Nu/NVjQHyuGjkdFUSv4Fq6Z/m2uhpBOF1DR70uYyqSISufwyHLXrjLrnFy7henQJ2L90WvEKoowotcI/rDclImLTvcwz22dCQfxsi33tO1+Q== 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=yMjEE4+kvbYP5U/kSZ9Rky2OKvC/sfNSCk6XWJ+IRQI=; b=PLi83TMZidU4AWRXwiFqx4oEESOhJUgzghaC1b6j27pqsI98qXknViwvyGD3dGNC36rzySCHYN/re1Mx9UnctXRapwDsLYyFsLTyXY8fIDIYR8zOLIgyccSWUABP8QAkR+Q58ivQGLh/bKrBrVYYU+4MLgCZJckRJAcXAOt29exMg0/HR8MXLVISatbcmmPztltkTgYhH4cf/bN8Dsnk8QXCGIRYOaYjvxSpRm0k1bPSfVebIdnx07AnrrOiOt8t0YYJKEccCNlMCEwQN4/JmC6a2aLdtNNLb2sEKSOY0ob9eTb4vZvYnwUOr749eyWMDhoFyvgqeik1Ezi+Mf/hfg== 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 VE1PR04MB7360.eurprd04.prod.outlook.com (2603:10a6:800:1a3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Fri, 11 Oct 2024 15:32:21 +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.8048.013; Fri, 11 Oct 2024 15:32:21 +0000 From: Frank Li Date: Fri, 11 Oct 2024 11:31:34 -0400 Subject: [PATCH v2 6/6] arm64: dts: imx93: add ddr edac support Message-Id: <20241011-imx95_edac-v2-6-011b68290951@nxp.com> References: <20241011-imx95_edac-v2-0-011b68290951@nxp.com> In-Reply-To: <20241011-imx95_edac-v2-0-011b68290951@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 X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1728660703; l=859; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=79MXg57Cyd0Ls8RHW05eE1dZDeIAJiwGUJukDHuBEDA=; b=w6Ci5x6+kUwU0qSrTG7LmFOXnAYqjOYX6i/PqI9i2yScNOg94SIwsb40Ls7cAvvfpqdhHtsPA hsOP5cFadw4Cqf3eRo3/Bj5l9CGbI4jnuTSUm6uqBOuIIVdIxI5Xv4a X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY3PR04CA0014.namprd04.prod.outlook.com (2603:10b6:a03:217::19) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VE1PR04MB7360:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ecc51ff-41c7-4431-29ca-08dcea09e5d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|7416014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WDlS/hJQewSlwMukRLFNJNFtElB7bUT?= =?utf-8?q?MvMjlXgeJpvhc35Lnj8hG4fEYo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cTtt46qcPpDNx0N0a114n7ekgVyFdjXhmGH?= =?utf-8?q?8uOYhI9jXmSUCLz9g1h9VW3Rvde8cFVamcw4W3eKLJ6I8w00OgwvMRlZSfd90kCJY?= =?utf-8?q?P42R4I0/NTOAwX8t9KEw4NZIxeHsjUSHfaXg5F7XlEANc1oaIrt6vjf/XmShZuT6B?= =?utf-8?q?V3w7amDl7+TzhfN9w42sJQXuW4mUDmpwVDBZYMGLLrtyDnBWE6A1Agz/M3vHEx4Xy?= =?utf-8?q?BQNf+iSqb5TMBJAwOCMbSWjzuSuFMUnxfDSHhTg13xdehpYW1pQQD9YhQHKMQR8dI?= =?utf-8?q?7cfTaLriq2Upk+SJalNCXyHgJ9zj/zFs0MZGxhKuQlcvONzR/ddyF1bx9/RjzU7EZ?= =?utf-8?q?PbEqyIYidXmWGFimfBv4bdJRhAbORkUaPkw9c5VivgqpO1nifDBY9GeE=3D?= 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)(52116014)(376014)(366016)(7416014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?YfE15qhlsOyiwAhsi0hU4vBPzymX?= =?utf-8?q?AkD49fbOlMtwOgJO3AjZUIxblBVuRC+VT6aoTltQQc7sPq/KX197L4+tRRap2iv4L?= =?utf-8?q?IH19aAM196gfT0Tbb0bTyvr18dwyLnME656TPQvhHabf7UveL/4V+qWERPlZWgUz+?= =?utf-8?q?GWRq0//kFbcL7/IxivMAAvjCyEdIo8N93iXJsULuiLUzH1mJ4K+Vh79tYklrFHxnc?= =?utf-8?q?C+Uq2iBnmPU8edJRdWqb2lRLBo0G5sd2vDzPlHx6y3xq++7MNrJgyjoJZG0eG7PoR?= =?utf-8?q?jq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A23xCreoWMMqRATPYcqT0bMk+ncrwcPwjWIKr1?= =?utf-8?q?1D5kJ2OcMYOo2qViXUKp+7QZPzBwYuCm+OA0waGq4KbwsVRvnmqfP9437wsWTr3QW?= =?utf-8?q?yJZ1vYTGPnXrL94kcy+jI4XzcuNkb1aWi3wv0TD75/UUwGp+BaR6rFKffRjAkClPp?= =?utf-8?q?DEEYdwPb7woFb71Dt8prpPRAEEQ5TGIHYPDcRVnw8PZYDLEdT1ShpezILD7MrFQyT?= =?utf-8?q?5Sufko1b9bveDLRDTXvr1cJ4GxfBtEhn4z+ErpzmfG7lHyiPS5arQs1csxTH2Xl9e?= =?utf-8?q?vZLt1USXNL5yotgviwaFDiYjv9RCVxrbe5rQ/aXUK4AL/7UdelgOTmfYIED215bwe?= =?utf-8?q?KXfCp6mqrXv/?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ecc51ff-41c7-4431-29ca-08dcea09e5d0 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 15:32:21.1975 (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: 8223AXzy8ZNfxYC4tgebjTU7tWrq3C6iRXMi7JjL1FTJ3E6suRmcNJvdXXgz2ikEi6XDl9h/GSceJt1H3EGAww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7360 Add ddr edac support for imx93. Signed-off-by: Frank Li --- arch/arm64/boot/dts/freescale/imx93.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi index 04b9b3d31f4fa..ea83e38ae4d88 100644 --- a/arch/arm64/boot/dts/freescale/imx93.dtsi +++ b/arch/arm64/boot/dts/freescale/imx93.dtsi @@ -1326,6 +1326,14 @@ usbmisc2: usbmisc@4c200200 { #index-cells = <1>; }; + memory-controller@4e300000 { + compatible = "nxp,imx9-memory-controller"; + reg = <0x4e300000 0x800>, <0x4e301000 0x1000>; + reg-names = "ctrl", "inject"; + interrupts = ; + little-endian; + }; + ddr-pmu@4e300dc0 { compatible = "fsl,imx93-ddr-pmu"; reg = <0x4e300dc0 0x200>;