From patchwork Tue Jul 9 20:23:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13728465 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2054.outbound.protection.outlook.com [40.107.104.54]) (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 1B93218562D for ; Tue, 9 Jul 2024 20:23:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720556621; cv=fail; b=pBHXifzSCM9nRl5C30tfNNZlw3B8Z9hs6m6pwGB6WWbU98h0oEmMGdZGpFr1z4lIMTeVGyIHb/k6YMon0AT8E2o2PQ/ufmLdtAdlpMaDnVXpwH9OD5syMfdclqQiRSGj7IPrNyr9uWtxBM+KoAQhHFTJ/ziQTs25vEHnPTFb5TA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720556621; c=relaxed/simple; bh=QNZOx5eJVCU0W7EZ2hHtejXRuENDwxZu91LDUv0owoM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=mBB2Vl62nApX1YqQEsqa0sdx8mWc9zQUXEZn4tEG4wO67RMuxmKigAd/ZrXHk/RlrBhiOIs8YiX0TAljEq2xgfgprYFiD9PUCVrbw3y4gQbGq/QwYx3ceUuVmgtxCWPGIjTv6eLcPmIZly4cHac5fD1cAingi0uI4hGn58c3SZA= 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=cqCkJ/OW; arc=fail smtp.client-ip=40.107.104.54 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="cqCkJ/OW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WlpMYTz1WIhrbqpwQxRNAVXa5LgMyQ05R55zexLA1jXyzUP94FyXubKVxI57k1zGWgwbPUmiEPgqWvOIMwjONISIaMprzi9OR7UgHaUheemnmv1hANcixAlaj434b1rVN9taBskiS/FI+4Kf6vShBMzSpQ80S2m+vUtR+qW+CdSbR6qa2B+qzvWSIjUjWY8foQpFU5OY+FlgPgJVxTaW88NFTn6AbuLqxDAcLKKrbbjEYZookwtHpKW+YBfjoYWFuwPjV6Fo6t/MqlkeDBOAwT7bOfJ0YbOupNWgv65RrUp9KdJYeIHgZysvH7LLROrXR5WOw/SBK80K6IQNf93bUw== 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=JA819jqoPZrn1JnIi72gwTFnZaIouoJzS/nUgbAKfqM=; b=l1GUnb9LKTPfgoHjdg5deb073YOPSHDs7W48H9pNYcbY5fWFYU+3VeCQceKWuv1S5ChB8FC1vOtthmQTjIuWoffDh+2y1yCzHTI3rJv0S7t2eKT2e/XOTp/Kg8OaXhzjeWnEtmFD4w9dwRGDyyxdUCMmzbVvUeGMMtx5WLb94ABPelUDM5beERp6dqcxjZ4WLOQB5Q7/qkbACYdtSgN+lhYt3bGyouZkURKk1TZH+o7JL3d8txMsEpv0Vr2feV3pvAsckIvStnhqeUXfSwN1SOMNDBm/mTymuxjLYqmKAGNIXHct/52L2JhXplqqh2FGZvQZiaYq+4ijBDfdp3gCMg== 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=JA819jqoPZrn1JnIi72gwTFnZaIouoJzS/nUgbAKfqM=; b=cqCkJ/OWY1ypIvbQm93oSumEqpAVgH89vtyQLcdDUKejuyZlGKcVmCg3xum9tnfeDDDApNdxq/oTsmjz0+QSG7eHPsyCMLAMR2reCHsJzJ3ptaYITHptOvdTRaS0kh1t2nSAgP0eO/QWQoFrVmtC9kDodG1JocxvbNXn9S63a5I= 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:37 +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:37 +0000 From: Frank Li Date: Tue, 09 Jul 2024 16:23:03 -0400 Subject: [PATCH 2/6] EDAC, fsl_ddr: Move global variable into struct fsl_mc_pdata Message-Id: <20240709-imx95_edac-v1-2-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=3448; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=QNZOx5eJVCU0W7EZ2hHtejXRuENDwxZu91LDUv0owoM=; b=02ZNyms3Nt0w9tn9oyTolLLBuW7enItXsYUKkZGHONgeXNOpVfgJiBo2QYpuUpDj3Y+FDVvt4 Zv3n/DEGv7UB+aiJNfULpRb6a73izM3leYPYmDM6FUVCtpvMb5msd5a 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: imx@lists.linux.dev 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: 6874fe9f-9f85-4ee9-21dd-08dca055037f 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?jVEja25ZCr0Hg8XQsH1PwQn8bBQERUp?= =?utf-8?q?hMLoiDA6hLfMO24jbEJVgDGNCJ82uzBcBskgAgD6MPIcvtcYO89ORCKfRcBCbv+Lr?= =?utf-8?q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?5KSiyFtIdpbk0xOZseYR1n6NS3oLTnZNHj9EofcHx0kfqlr7xNTwlFKOZO70EoosO?= =?utf-8?q?2y5MeiO1LKHlfONBBPdRagfatXq3JK3vkf/MNw902XG1jJpY6i4WQv++yewNqVWuV?= =?utf-8?q?Z8WiCuysjk8fOw/Kp2sl561qxC6RSwzKYg9VP7I7baPD1Jo4Jz+y2WrG8DSSD8BPR?= =?utf-8?q?rABMAu3CFc+PO2834IR2dtDj6j356m+HQ1lrOwWg+zRAIbXvfZ276YsdkuxIiRq93?= =?utf-8?q?1uI9RFd/hkFdHiu8t5rSMSrOEoiagPhWXRlTpvhF9Q8Td3Ed6SzbpYB584KdC6/4B?= =?utf-8?q?a2hpYSQieHua1ovm5k1U6wrXdmY1u4kN9eQP+JqO1iNlOslr+yGvmczCOJat1z72+?= =?utf-8?q?s8sU1J34M//5jOTkCJ7tTUYtWxCHZlcX3u1TNy9CvLygP9u0LIeQh5A=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?EDY7wqgGxqMdd/GEEYwoToDqRsNz?= =?utf-8?q?8LTmqKRj+VqIvfGH9A3axevvUsGYxX0sMa+BqmnIm92cfqNybueCT+Nv24VI6sylP?= =?utf-8?q?KSYWfYE89BcxeO4cPfBZ5EQXySIm/zOYAdF0qzDz9oIMq8tXqk1j5ZVr1dXTKji2q?= =?utf-8?q?gYMQyajjFwUNhKwbLRjBoDsRFAP8SgNogP20HUohk3KKEIG9ClX+CW1TfmF8drHwc?= =?utf-8?q?wxByesQh3T0sN3JDJQMTLZntqsQN2+eCFEcPRJejdbT6DsiDjRUJ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jz13nJ9G4KPoMXj8wpghuz+N?= =?utf-8?q?dXkNjxprgy52I2rELeQmBuc06FGP166Sks1EcpRZMCgJRMy1QrZYDw5r4ItoidoZV?= =?utf-8?q?XpOGpOKvQWQNQXXhiZPj2mbEdy+VbIPlYbRfS996RCkeodnf81GaGUINGMFgD8lDF?= =?utf-8?q?MSwoI1Xqi2meG8c9jlGNLwfbAOHAmbDDYxPbGCQ/j6tws/g2rFdl0VthEmWZgVAPn?= =?utf-8?q?+u+l4puXpaNRcVhylnFThGfmY0bfz1ckmq09w0r3Mkf0d4ykoD8YYE33DbcRKjCW3?= =?utf-8?q?UAPW6PiCSaYdSDqOtLQL6MeG7hYnS6pcU7ayRIElYHdQUW6+q7tXsHC9V+nNzfjDN?= =?utf-8?q?/DtOPTOLX2W9taDif25NzP3Xr7fJj59IUBehjvS6GNVzRyvD+H70DIL/+7wshT/3D?= =?utf-8?q?9vjCRU39Qofa?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6874fe9f-9f85-4ee9-21dd-08dca055037f 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:37.1945 (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: ujC/chjcQ0TViU10DIsngJX9IwhCxlfZYTfoWiEfMW19bLPSArC1JQBuPDvmNyaRjMeIJUfAU2RCKHSBtyikoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8267 Move global variable into struct fsl_mc_data in case there are more than one ddr controller in system. No function change. Signed-off-by: Frank Li --- 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 a7982370e2381..10b0a46669f3d 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) { @@ -535,7 +531,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__); @@ -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,7 +575,7 @@ 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, + pdata->orig_ddr_err_sbe = ddr_in32(pdata, FSL_MC_ERR_SBE) & 0xff0000; /* set threshold to 1 error per interrupt */ @@ -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);