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: 13838927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96D2CD2A555 for ; Wed, 16 Oct 2024 20:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oWWIgflstIVDXTjDGLYnl7metuS73gQMf9j95c82+E0=; b=l8PJQ9Oy7YhPTaoSk7N714Y17i Q7R78DgYvTLqsbknSuRZr8RfUx/Ja7KqcH4wygx/BN80wKZfjgQcEtQl1Q5d0mOxrPyzU5DQXCM2U 4mLnQ2kNB7x0/AKPdNi+l4CqKOR1RlBoDsieqQA1CFKTCxCy1PDRxrRFyU6ueAgMxcU4riAKwGc6G kVAPIwyNadsnnl8aqUhCV1JQtyinbsXeUnSQHFUmm4cXa45lu1QryxZdjPWY3v5gS+U6qWf/PN7WA moFqDGmoxCiFxC7iTtewFEiiIRSyWcZVpWnEy80QNI8TJCs7YsLQHyWgUsc9FS+paLqw0Xe3okz/m dCG2bdrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1Aj0-0000000Cxub-0oTm; Wed, 16 Oct 2024 20:34:30 +0000 Received: from mail-vi1eur05on20605.outbound.protection.outlook.com ([2a01:111:f403:2613::605] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1AgD-0000000Cxa0-00E7 for linux-arm-kernel@lists.infradead.org; Wed, 16 Oct 2024 20:31:38 +0000 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) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_133137_092164_02735AD9 X-CRM114-Status: GOOD ( 14.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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);