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: 13832670 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2079.outbound.protection.outlook.com [40.107.20.79]) (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 7BBBE1957E2; Fri, 11 Oct 2024 15:31:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660719; cv=fail; b=kDJecrP0nG60lIePhz4k2Y7cDq8jmWkBqaopt+XDqiG8i2bslsvht03Ugf+HtlLsxq0bTJEavJhTFxAP8XeuliUH3jS1Qm+FDnp5y2MqgUEgncDev0PrlG0OWzWglDYZRM2rkJm3FcR8jFX79qbYASeUX8xdwqKg3AhmVgrpLuk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728660719; c=relaxed/simple; bh=tWA2t7dYpkCGQPCP1WcAIC7H3OdUmQUbtGujuyE7dVw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=pB41+O57mhj62TFg4nWG7phJ/ncsNxIagKU96e4sEpUVovppr4bgt3jQcuHd60OZWDX9r6YfGMNf6y6q2uPs0BLHXP7OWOd7yFiS2nBTb7c3y7SxY3nHCdNdDtG/BwYbTLItxgoDLA18UUta+P0q88QLlA72Nh4/iTkc+2LgGOg= 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.20.79 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: linux-edac@vger.kernel.org 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?0XwW0wgWM11pl3GFFPyTZSnvojqnSkrK8D2gTRDe4zX7bs/tdxNxKaO5txdVIMmDT?= =?utf-8?q?C7AQNH43Iabi7VULR3vFGz63IZluF4oZRvmw0FQ0PC0jJvmzljqR3stJGn9VZ87wX?= =?utf-8?q?6YEKP+rVHgvA3XEOOVQtEOJijdk8+R0PPS56UbPkXGPJm002uGbKYdkMyxeYdkmly?= =?utf-8?q?7wUgqZL0H3yU2U2cPSXuqQbgZnLo9KPq/p7ikodmkQdQXdeKhJdXmROXQpe9XKJJ6?= =?utf-8?q?pGo2LNGKB4QQ3w3tGPFY5Vd5B927bhpLyqb2Jx4IFsw1vLi2INLUDRoEKEEITFZzI?= =?utf-8?q?KTC6W7FrbQ4Yd6kzzHGRKLLC5uBtneRpkV3AEfQotWH/SxYiqBYSCAQAU16pChTo/?= =?utf-8?q?gr6FO4IjvNXHifl8VWb3ifn7EHosCPe2n1QodQbLZrtG1BxXb9zqyLow2nCEsqk0D?= =?utf-8?q?I/JCR/vbcBvsgZuj5IHcJPKZixLNrUsbfDwB0vxGcCRvmD9Sz1L679KkiqncU/Se0?= =?utf-8?q?5pl4xVkDnHgas2VKz2wGkaP5J6o2raypML+OFAs+/FST/eGYM8Dod4gY2CPGs2qEz?= =?utf-8?q?ntvuAhctsneTM+DMcMpD3lwIpt3gFH9MbWmH+zsIaKtkLZgmHOu2Oh2ReRr5I4Wic?= =?utf-8?q?G0hqPdwRuuF+eYP0+vScojgTsy9SfVQONUrwj455y46ySSG0zSHNx1AK/RqRO3Brb?= =?utf-8?q?sAR4cXI2VFzqIWsSlSCyFXM9smqUroAQofbWtQFMFayXqZ4m2Qu50fYHzC6T99qJW?= =?utf-8?q?niC8zaGcco8+nhRSPJqZ+LKnlW/014e2GE3mnd+EBqrTd2CIfIliIy8vYjZoqqvi4?= =?utf-8?q?OQfHSdPIXqV7ZXUQ5o4Juq8NAIV8nNxiEaENAddR2ardqVMaj7H7+tjAUZBgQgwn4?= =?utf-8?q?kX43kIy3Wh1NgkslDKt5PTPOeBImo1F1z+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);