From patchwork Wed Oct 16 20:31:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13838895 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2073.outbound.protection.outlook.com [40.107.20.73]) (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 B46A1176AB6; Wed, 16 Oct 2024 20:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729110698; cv=fail; b=KH4mLWEB5Yi54nCwRFbMUqUDbKRyWaUtyZmj/W6NPRRRHwUpLC4zMH60f64izpWIWgsEK5OvXf3iWLG6c4KPNHVurboCOuo2VHaSd7DR/VdRJx78eqUf9yT4frm9Lvsu+5kRy8sODNXDwsL4/PzNxJMVecFFbFV9yfPVtbLz6u8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729110698; c=relaxed/simple; bh=tWA2t7dYpkCGQPCP1WcAIC7H3OdUmQUbtGujuyE7dVw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ZEm0Juc0VJ5Qox6US6nwRqSRScFtZie5slRtr8L6y/qmZGUzUggHDzP1UJ6KhI+yn3T5FEzHw1l+MILPgR2tUI5cZzJDz7bhH4//sgjaVyjwixAR2fCn0UzYhoRFvPY1RhEix1YFQhelxS1cEFrlA5WTWz631cCoQdZ+QtjHV0k= 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=HaUuf68g; arc=fail smtp.client-ip=40.107.20.73 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="HaUuf68g" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rArMl372FD+nVxbux3L3mBZabLu/qSSChwHXmhakA3I0TyjZ5ggdjx++PMDiiyO10U5YBjCb9wfJDea3XQcbp8p/hNO+d0Ypu/xrL2vCLLEUQb9Km7jFlBerGyRXINqqmAMV8xfNQFXffozTj8U4i9yHNMc89g0gOEA1Yk3b4loB91WzVjLpQluyMHDIv9lh5J9eCypVyeFXekL7PjBNeZTDs3Yi1/bZGWSEgtDn9W5sOwsj7jRAMgSZVrilbl0IH7uraA/xpe9i/SYtGcphnYW/e0yKA8F/gXYD9KwdZgKffyHf4BtKifSfjUaTJkY9nyPAyGM4HY7/fFkUkeGf1Q== 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=urJICd3lbSdxaxqeEJplrHvCl1CJfsObgNCFo7v2RW2v4huggHbO3aVv6rkAeIFc/D0rk4lDMLb0NOOhEToreqtV/pyuJ0KmnSBzsJDiW9zV6Tjw6HpEOuxSqNnBU/VGuLtno/F/omV1pR12sHbfzbnKXJ49vFuB/wj/KRGBxbrqp7I1hfiN3fm4ZeQKEO3UrhfbUVHqN6Y0/L/ogqu9d0o+wfLh41inQz3ua2RzuU3BiPWFcQnIiDgjMxD5eAV1OowavrVjYCUVLZAjukL3OowcoEzKUsALTeHRHTb3veTzZ5wrelxw/awTUBduwnorEYOkuwzcMWVX0efeCCq8GA== 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=HaUuf68g2dbWxFoph3+axCosMY3+NBHKGOWhZ9NruHfWVJLIRswwoq6oSSdpkgbjL/7faaLBFdQHnCInv6glhsTL6XPF7zIMfn/rDAJTXGgDVY0FPBpLo/L0y4ihGalAtZS1As9GIl99I82zxX88tdoj7fJ71SUs4lbnhEvdHxt/+IzUU2m1kAXHVsDQK7VEPzq9PJzmVPUi8huZxGgI1IQBFfnsnGaX5zlAUVZEhsPrvztmZ9pyCkiNZhysr7TmzJ/O75rpv+G/usIUmSeu6xOFrDvPHOm67Zcl6dhnPzNiWX4n2J7qbRbYfg5li2cBD6m0h5+TacnlQvFU0pevfg== 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 DUZPR04MB9845.eurprd04.prod.outlook.com (2603:10a6:10:4d8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Wed, 16 Oct 2024 20:31:34 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8069.016; Wed, 16 Oct 2024 20:31:34 +0000 From: Frank Li Date: Wed, 16 Oct 2024 16:31:09 -0400 Subject: [PATCH v3 1/6] EDAC/fsl_ddr: Pass down fsl_mc_pdata in ddr_in32() and ddr_out32() Message-Id: <20241016-imx95_edac-v3-1-86ae6fc2756a@nxp.com> References: <20241016-imx95_edac-v3-0-86ae6fc2756a@nxp.com> In-Reply-To: <20241016-imx95_edac-v3-0-86ae6fc2756a@nxp.com> To: York Sun , Borislav Petkov , Tony Luck , James Morse , Mauro Carvalho Chehab , Robert Richter , Krzysztof Kozlowski , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov , devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729110683; l=8457; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=tWA2t7dYpkCGQPCP1WcAIC7H3OdUmQUbtGujuyE7dVw=; b=34tuxc5Oxl6QFwxosBHK4hU0B75MJTe51HVmMDYoaMh+3EeG/jrcNLOw3slkd7+tm2ffcoHTI jkuMYiZpWtCD1/fhprUINqz30X9P7tU1Tv7YHghohKKDFDt09Ynp23S X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR07CA0042.namprd07.prod.outlook.com (2603:10b6:a03:60::19) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DUZPR04MB9845:EE_ X-MS-Office365-Filtering-Correlation-Id: 85a3b70a-3e17-400c-beeb-08dcee218709 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|7416014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WfjJw+kdm8M3GfO3vXjEcqfuPNUtJdJ?= =?utf-8?q?n7tLb4w6NqH1UHAmxYZhOdun4A+tpf1+6FZQ2azCfYucXpvT54OME4e5oFQdaymYk?= =?utf-8?q?OBvrEPL527XoZZNP+XRy0ZJ0IYaEI0l+2Us3Btd60dqKRsAtJjdfFR+nGnz6q9HDL?= =?utf-8?q?z647E3TkbmKOLhSjFOAxp2qy+EfiEz4+tb9H7qj0HtSOoUN0NsiLEpR1XhxUgTIqx?= =?utf-8?q?oDDwn9jBuAvWXj9AINXr4pEUIVeBqp/iKAFmMHVh5jPKAKpDO2EiRzHZ5hXIkz4lM?= =?utf-8?q?s81aotUR2dpkaa2bCYvmTC6UodRTTes026fe01bclKd9uVFUv9Q/qyjkOsnUaDph6?= =?utf-8?q?YixOqu4Fda1rBbpJTiFdZCk2F/NAu1OByrr8kk27Lfho1eA7+5Vc88h1+l1DeyNbR?= =?utf-8?q?FbysmZ9KcdHsxk5UwXUHbo81ojxAr/LtiwL0mjePqb3fmpZ8S3oiM12cO3W94wzT2?= =?utf-8?q?cE2sP8ITUbLh6bCAJc0snASFw0f7JKTs/tQ0Ga0yF5Yn/ALEOniTClru6L4BUKIwQ?= =?utf-8?q?TC3CT/aGd/OxIIKt7+1D0ETipBbVU9PGpD8DZMqj/tSgBrGRTZ9ESpWqim2FBOg2g?= =?utf-8?q?agZ/0sNmQyfM17Q1BkcEYxyBo4tbpQj6IdQzjvZROkbpWyP4/FwfJixqPdrxNqYrT?= =?utf-8?q?8vx4Yq/jcE5v0vbX0F2/DtGXhnYf7dqnC8PRL6lBnPA1mLMu8J0bcBECEjwCN9O25?= =?utf-8?q?oSEeAxPNdokrKtdJhXq4Wb41uRbVvb+VsnH/yejHrBz+F/XtPQVN6BU7b2DFbfdu7?= =?utf-8?q?ENj5HeXKx3MyBMFKsUcScnV9jXGs35ubzF594K6VlHt5w355Tp6VzetUf9VDlxw/0?= =?utf-8?q?dYuDKGKu4qJEzaERVx4PFJfs1WykDRA2m+yaPao4yvLlg9soEmwPI+Vf0fZPzOEs0?= =?utf-8?q?lVUQzsYjrl9G0QkdVQ9Sngy18ZR8vg932Hjo/myu17+Cr3fg2Qq7AE+EIhO0xv+8k?= =?utf-8?q?PyYfCoU2zdchorjJRH5VuXGsC4v2AMQHXsCMtb1Nw6c0v+L5UsWW1KbVJFJI5wl89?= =?utf-8?q?s/ytfu0WUscndKcJq2txEzHpb3JSE55EG8tWJUzLYc9h/odliRKg/kD1nuHN0mPCE?= =?utf-8?q?Gvr2ef5gA1H/jmt2IbyH/rSRzHovN+b+oaV3JiYY1Jw9vcw2+Vr3bavj90s/6e4KH?= =?utf-8?q?JhGLkCizK+QcAjzBa2HA00sskEhrZ+anH4vGuDRk1LjcjOFSEqzxKLHw9RiPFqUzy?= =?utf-8?q?gx49uCS+dg8XMnkCvZbF0ZQWbFeycRCLAyDQMpns7lpURT/opBgExguMNZqot3Rrb?= =?utf-8?q?MnlscpC4pjefX/aKfaV9bQBDIHj5TuR9Sf1P/Ai74OobbvsWQNRToBqClUWXBN2B2?= =?utf-8?q?26FE5O1mRc2M?= 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)(376014)(52116014)(7416014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2LEvi56kx8H0XkOYkfGLwHzWFSfN?= =?utf-8?q?APK0OndFg2bk+u7Q+wNcIbcvkx+me8uBE0EB0Pl/Iz7SyJP4fs78QyhaOBNg08JG/?= =?utf-8?q?E7fHkghSq2Gb2aFZkuRHpfMJMHxztfVpzVe/Px+8X/ANDsT/cc65D8cypSrlyDO00?= =?utf-8?q?HDzuYnyRLoEPg9i/Edaqe3173Jv/RvGrNS8LafHU0unMvT+eRUVLwBEcEMREufw3s?= =?utf-8?q?gFbuONFicuEiNmpvaOfF4GGwUrFojlXA1h5gtJ2IFO/aiUNyxSTH+usfsjTLTLI6x?= =?utf-8?q?Mr8BdR3vnqYjNnI2i8y9z7yD8OijlQubSaU91oRNMJjnRhOJv+v/LK4a/vZx6g4r/?= =?utf-8?q?hR2nG8rh+u9QZj8HUL0VdZDM4XCsrD3rq/w0ippCMO8cQZwlRMYzKQAgIw2QHySfP?= =?utf-8?q?XXQNqdugn6U3ixi5KjAmHmUaQbWj2DjAMj17CGsYSXOmGiaUNc1VO937OkKB2mgP8?= =?utf-8?q?fqAN0nuxAEt+ep4QclsqsgzMkT5rHYBAZNYct26fxns6K6R89rPRmcqRTyHTe4PYF?= =?utf-8?q?ZOkV3qHF0FDcusP4TTm8JK75xuo0Y6AElZRFqKhZC38AaKQML+WW8fLSEipbGy4Gv?= =?utf-8?q?5cQg8ZMYOVcAxn2ko8yCfsa828QcDieUdrqFIIpdIEuswUdLN/57O3w2vW6e/3gFf?= =?utf-8?q?/EaTyfj1jMqTPTAN4G4eFQobEWHGjR93h2c8es8KqywPdjcZ1dS8zY88hC9HTwGZL?= =?utf-8?q?ASaTjfPPc1sVwgwNA6V48TaYtO8SbUaUwcuaXNR+2JyF93ahzhV1gSGGYRj2hYAkr?= =?utf-8?q?zk4I2f6py9qaVe2NgI5GwvLcwBtCCUUyiEBQGrN9MvpSlHjwIK4a5jVF2iBc2RUR7?= =?utf-8?q?MGq96vSP8HbWpSeGZKE1hw8iBJt1fRektuU3Yll1qM9u+hzpmu0hx9rjf059truti?= =?utf-8?q?kfPEZCXvaI13AnQIscjzvD3O8ckJpENGMDyvR4IfG/5OIVJJv1L+e71sPthMIEvrE?= =?utf-8?q?l/mekJfZB9Dca2Gs/GbepmJRdZLSXvwvzHlSvWZF1m9WFojEA5oIwnPA2uBW8hslu?= =?utf-8?q?y1lxPCgHXEN17JWjJ605o4SL0UrkQOp2+o6hI9SJMHYWqs2bJPNASlxGmxX+45L8c?= =?utf-8?q?7zZ3qQm/IZO5gjm2oLAu37MR6jvuX4KqTT3/DvM3uab1hkz6e6FUaX8lkdXvvjzr0?= =?utf-8?q?aSLGgg68sDq1/sB7ywBTgq1tZoU9xL6pB7onu0Uya8pmm7kLU9T3/qobOAb1eL10y?= =?utf-8?q?dzrshs99ppRhjH+4bLXtD1jfhDOqh8CNCVs66hAwYMGXRyn8EeXd7LSZVz2P7o9wD?= =?utf-8?q?GkOEaequ5+UMlRQmHV/5deDkW/JOLMhwQIBfqE7Xgu4S/+Iq5Z1qMd8342YEkhHSW?= =?utf-8?q?CZ9/wqJo2iOn8GSK0seE2zsS7dM44u2k6H/j2RYVDaZqH0bnGxCwmdRyGbEGsJVBw?= =?utf-8?q?XBBKYKlcwOCChzlE25WgK8TPu57zo9YFLxYuwYYnuZXD/n2YdPz1drRXw1w7QRKSW?= =?utf-8?q?RgqjNzKX0gGAaqykW2zyHOt/de0U2tanyCwYxKVCogXLc+2UVvXfUUv8IqWiF6lm2?= =?utf-8?q?3mnJiCkd7ZEP?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85a3b70a-3e17-400c-beeb-08dcee218709 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 20:31:34.7404 (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: /JS4W3mH56qcjr4pbP4NIchaULlI6C7dV3qAds6E/iMq3ZfaGY6XeXunXXBPDcZGcEwi7gPy5zUNGgcp+UzBmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9845 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);