From patchwork Tue Jul 9 20:23:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13728457 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2043.outbound.protection.outlook.com [40.107.22.43]) (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 47716185617; Tue, 9 Jul 2024 20:23:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720556618; cv=fail; b=OZkS2itexhFoO6ITHYnZg6HsLt0t9B9t8BVZawgMyAhNfkc5WkIk/303puUsZ3IMOLRKSxeq+6lJ/oixjtD43WEDhGf06zAfBhpz9Bgn5+9qo/aJwNmdzJjenU4UUIEXu6TrLtz8dy6BCTU8H1X6jwBLffOch+VAYEkG3OsDvuE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720556618; c=relaxed/simple; bh=UpONqte5r5Hx1nNN0JjvCuZqCq5lGesddoh8PgZv3uY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=UoNDDLdlChrA5RM4hEvzxZ1W2dAkjMB+fHT/pw4nzJcMDKxoePeWATxNFPdDReO7XITxG4xj7Oa9Xk19sWYixYQ3HyP8NxLNHwWgR1kYUY+SmOH8pt/BbIGwtPsRfYBhvWyHQpgxwoiMB7bd9Z6ocYDMrICnLbgV/HJ0iHCOcbo= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=eEJgz9pQ; arc=fail smtp.client-ip=40.107.22.43 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="eEJgz9pQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GFlpWOeg4ThsxuD98daI2fwHnJMuuHMkV23ILR0qJ5zAqmyIevW3CcXPSZlSkixFdntdUvUM5YkrZIjCQSXuGLvoiB6r0R2+VrIFiSIMag/kc0uw+9rPaLllibNQYRCGRhZhXQINWn57tlbBXpVc1HpfDScHpDsF4VL74AhsYLF4NgDPT92oICLPVqqGVms+rVbBaYcNluBOyMJGeztJ1SiClIR6jTRYKonDnUYHARA6NnL47OLysnh0nhgLOso2EjJknLQvxrIQ681YLDnJkOQVWzQlJoksWhUeasx/OiqwAWh0tHuIK4mDc1zENvoKiNt4FWjFBter/m7Iw8uPGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xtQ3uJl8YmG6bKL+/+LLKJQTXQhg9Sbo8MTtwpVypTo=; b=lTTaP+IylBnxTqK6rSVh4wWgPP4B+CO9+O2+/k0VwHb1mS9GB5BNDyC4XsNLdz0fn2r7hCxYT4PVmvGVNLrEAzjUzr8cFhLbZEVzSsl6BYeke6PLYCBukkEIuL4+vg6EWP6CwrCKFvT9chdYIni20/8fFhqLqU1tHlxhfOcyMXKsy56n151T72lZSoIDPuV0PbAId4uut3HFtQlbd3zmmZGNksRNQHmVg/fDwDNSm25eaBXr6kfV32X1ueivRHHWFVY6UH1eGem4qLVcHIcluAbxwaIhhRziMxmm7cIy5B4k4RJRz0WrkRTvLlvgJ/itmls6qrYt+j+dn+B6dKkmPA== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xtQ3uJl8YmG6bKL+/+LLKJQTXQhg9Sbo8MTtwpVypTo=; b=eEJgz9pQKLNHpqHfuZPr5gLJU6ks+SABvW2/+UlEz17HLkYhGd5mIAw6O1B5+qnnP2nGltcx6YbhHmSEphS6cUVzDLG5c/1hC3lmIFR/QfXVxsHOBN44DmGb4UVTqRUqHXXPX8MTCtSrDZnj6jwzr4M6ZeAkFSIvVUHMTvAMUro= 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 DB9PR04MB8267.eurprd04.prod.outlook.com (2603:10a6:10:24b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Tue, 9 Jul 2024 20:23:32 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7741.033; Tue, 9 Jul 2024 20:23:32 +0000 From: Frank Li Date: Tue, 09 Jul 2024 16:23:02 -0400 Subject: [PATCH 1/6] EDAC: fsl_ddr: Pass down fsl_mc_pdata in ddr_in32() and ddr_out32() Message-Id: <20240709-imx95_edac-v1-1-3e9c146c1b01@nxp.com> References: <20240709-imx95_edac-v1-0-3e9c146c1b01@nxp.com> In-Reply-To: <20240709-imx95_edac-v1-0-3e9c146c1b01@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=1720556601; l=8040; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=UpONqte5r5Hx1nNN0JjvCuZqCq5lGesddoh8PgZv3uY=; b=V5ZiyLvLjkvpDmrLpJjydLkxqGPR/+inkeTzXlPL4kvbNQvJpz88JEjfpoZ6Ziig67dxwb9LR hsXNOtjKJ4eCYHypgAbk+o+tAv5Jc1JRpN5YVdar8tVwweimd0LbrG0 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0033.namprd03.prod.outlook.com (2603:10b6:a02:a8::46) 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_|DB9PR04MB8267:EE_ X-MS-Office365-Filtering-Correlation-Id: 61049fa5-fbb5-49d6-5efe-08dca0550099 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|7416014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?zWGRuPgJh58TF82Ft89ayb7BX5h3ZoX?= =?utf-8?q?N+3TSdqnBHuwBqW+9r6aOFdwG2I3SGg3pCB341ZK95x/Xvufxw+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4H9zL369gzP6di2?= =?utf-8?q?FEcK1KA9zLDufWPzocoivrdV+GvuICOFJ2VnSw7vdBbdnsxenor9vJCHKMm3PgSoV?= =?utf-8?q?OGsnlXGGdeWgqD+2Kf5UiXFVtFISy/dC6PQc3jp42FhY3w9dFF4USKmuoqTuaPNtc?= =?utf-8?q?up1dWA4ac4m3PbpAqeHm8rWB7HkIu7aDLsKmBupAjDzYyIhiXISHBfRq3aENIne4d?= =?utf-8?q?Welj4okIS4FdmrZVc+lCufl64/6ZEqi34Tx1vPSwGNZRHJyhE4Vi9iSXNDbpAGo+l?= =?utf-8?q?bp+9ipw6d2EPy39qoBi/y+a/YczSkx0dAejXKhj1YBRP85Mb8LFmOwqGjkxcfjXWT?= =?utf-8?q?1c/Dxae/CwD0r8tTTQipDd365HLf5qtWnNGhU2wiE2xlZLgXzcLWHp9WoQy0kZRuP?= =?utf-8?q?MPZ4Kgdipa9UxyK6/TWN60yYYCWtaw7rAjjqY93kwFkDyD9iLWWrOg4=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)(1800799024)(7416014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?dagi3zJIa9pwKcb5REC78qi8DdMP?= =?utf-8?q?uF/wTvg22hlBSTFSMLrzJ3L7r1agk85PUVPtp66iOF13w1v9XksyHW7OxVZnCJJfW?= =?utf-8?q?HPAzy1s9ovSKA/6Gf365TGs0sLYVHl1Z/KQ2N13+U6KFmH8Bok/X0gczl+lOUe5Pc?= =?utf-8?q?B1ZWtFd05qgp7AbyTu97akxUrMVzTlHJulQki5VFMAwrVuMJgwxFbXi6pnxwQ2HHv?= =?utf-8?q?43KFCyhFqgntldY86LlZWO7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MLxQa99e0F7lzT2c9RyGSBZye5TN6uUyRI1MCkO+4Qzv?= =?utf-8?q?ZekU0NqFXbQ2CayG7qGEaFARk9RAxigao2SzQj641CU5vg32cxu88+tQoBxtGCDNw?= =?utf-8?q?PCWAAiGSAjSo/vA9newQI1ya3RCWPxhSdnfMRDW6lUJ9ceuQbwWwyIBMSvYLEnTSN?= =?utf-8?q?7rhQNrv6uZVDELE1798N+BFs2cYsxKDYdz6cZoEjbLvcUnXEVwpMB0/UJqkh/ThZW?= =?utf-8?q?ARZy8MoYqfX22rVWVkw4Y5XeMWPQE4vEyAKCTmPGlwpMNY0gyUwzDdhjqGfGpuOQN?= =?utf-8?q?VZz8vSAQoNjAovvltblutWgJDxDPB3ylsAKdgBlm4cCs1K3ERpcwGTago5NRa+CDM?= =?utf-8?q?HrgEfR9e/1GvFeVN+ETbN9uVYUi+qMOokHy+rLtUh6b7ZwQmGN/v5rXlnR0S1ya2S?= =?utf-8?q?t9K68dMAIFKs?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61049fa5-fbb5-49d6-5efe-08dca0550099 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 20:23:32.3514 (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: daMtabAcM8bGAIdmpzi0j4Oa3s1NVhyCZgo1lbcnMfRfR4KmBm6/x0lz5CbdlU8Qce50m99NaZQre6BOibtfxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8267 Pass down fsl_mc_data in help function ddr_in32() and ddr_out32() to prepare add iMX9 support. iMX9 have a little difference register layout. No functional change. Signed-off-by: Frank Li --- drivers/edac/fsl_ddr_edac.c | 62 ++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/drivers/edac/fsl_ddr_edac.c b/drivers/edac/fsl_ddr_edac.c index d148d262d0d4d..a7982370e2381 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; @@ -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);