From patchwork Fri Oct 11 15:31:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13832694 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 1FD04D0EE08 for ; Fri, 11 Oct 2024 15:43:14 +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=oThGc+PInWWFzFHWkQtWRVZUx01s9iDEryoUEl8TSD8=; b=CXHL2v2pAKHWi5yGKlp+ZGzL22 wvI2jiOzZm5z2np1TJFtwAQ6auxAk1qkcSP5P/0JCdV7yskjg3u9ajERqCIcypGxtzdkIjjBafh21 PnclA282p1MPYYa9uoFOBzC44/v4d2z7sJNSvkmoRvnKlvfakx+Xl7RWiqznMeMoOLQq3uF41BdQM RhcCR3/4V8qF/oO01BqsdAZKur716k3AZuL08BNXKQJWC6dE4UZA3Azp8R1fS8Fuk6UgbHfNB5HQw PH0yLtmVB/CP07tZUqIs1uYfD9lFMP7uRhJTRWryWKI6maQMSAMVU5ARu6q4oddQewNn+hBCICwtk wxsDWTug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1szHnC-0000000Gpvc-1IKu; Fri, 11 Oct 2024 15:43:02 +0000 Received: from mail-am7eur03on2075.outbound.protection.outlook.com ([40.107.105.75] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1szHci-0000000GoO2-0YOE for linux-arm-kernel@lists.infradead.org; Fri, 11 Oct 2024 15:32:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rEoOWXwahvR1BJEW3+lpHQb9Sa+iAmQEKMrpS58P585zcGFosZHqBSpcP0lPnXgaRrMl+FTqBPLQG4KlSP08yxYYHuvrWRndA2MrjIq27ttCxSj1Qx/gOV6S75haaVIRd/zozkFqEycfUDVNJZzGI+iXBKEus2mxabwPEO/gDZtMvfF5ForICAnTBwZa1Gja5JctlZQ6yjNFLECBbnv1sMgJ7Sf80gT4QBh1I2Nt1P7xEqcvTWt9NhE4NiH7MAWpFj7fg0GDzZxAgro8Aa3FEwm/oSJFmV8SnEWmcRfi3UQXTNpMHxYVnCyqGm0n1U+g9HRURJwEZdhYE8XJnwFbKw== 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=oThGc+PInWWFzFHWkQtWRVZUx01s9iDEryoUEl8TSD8=; b=cJ7YKl+/OdZ60XmzS/yLQ6+TFWYNi46QMCmp/LzP5grU/IFY60rrZmWE+DOD2C/qvGWj2iEmbNVYxRxm1/vq/MYMcBQa8YN73CtwGNYj4nGoA535IBY7xD9Uz+w+b3ubwQINKUDl2rhY+wau/RZDG2vvbABFt/Y2vtl1fSaqcatjyTe24X5PxYR3vjXeXDXquNfL3w6u9QDsEqUgyvDVcvfD5CGgF2kBv6dmnvD4yBJAqhFBzr/7LUDjZQQUoq1j/NM4yYQBWaxHQj7GdZv0yqMEP0S5iCcKXno8JKz77S3Eg9Xlt+OxsrxEchrT6/uTFFSOp9TKNucSaywEQruU5w== 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=oThGc+PInWWFzFHWkQtWRVZUx01s9iDEryoUEl8TSD8=; b=ag0tOMSZeGlCwY6HqL++k36OfWBb5CKMV/bPK0/5hIHCoIqn/1swExmBkvp43b4ShqySsy+yk+3n8g5KczbdH64l06Q5rw6vjGpsXPdoF4zQ2JlnpUn/chEL3rCOJTZFuN+9oUqdAX87/T9ZY/+cOq9i2fEKboxYx2BqVMmRzCxHCHGYQ/7M2vWG9fOrfDCGE6q/JMTGlWElhiWn6NgXhii4y5Rcsgn1CewgHRgBgmY8wbm47o7IzvbsUxvZoJKTzCazXD1OyJYMdC6iiGj8OJEeTnmcIu6V+jKbkzHzfftAqvPcxVdflZu5gokTXAk7YZfo/LHac4dmSARVX+4a0w== 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 VE1PR04MB7360.eurprd04.prod.outlook.com (2603:10a6:800:1a3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Fri, 11 Oct 2024 15:32:00 +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:32:00 +0000 From: Frank Li Date: Fri, 11 Oct 2024 11:31:30 -0400 Subject: [PATCH v2 2/6] EDAC/fsl_ddr: Move global variables into struct fsl_mc_pdata Message-Id: <20241011-imx95_edac-v2-2-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=3246; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=bYOSUeH8Tsfygywx3VBHrQIC4eU9dzx5J8svyPSfkS4=; b=Jr4ZBVdjm68AQYMozrhBBkHuOgXtkZe2yfQsG4tul8HwMEu9Uo4auwEhsTkM3jvVp+pVnWdqK GiUBeH7crjmAohu8MLvaUbS/kQCKODv1F1SqrqywQjvgjyJV5/5ZJCK 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) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VE1PR04MB7360:EE_ X-MS-Office365-Filtering-Correlation-Id: a58a03ec-8828-41d7-0cd3-08dcea09d92a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|7416014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?KVETjEvOQBKwtJzFFh58j9JEzIOBmVV?= =?utf-8?q?KHL4dkMrfjGLx/AcpJ6hrmi9goFOXKw6uOeliuNVq2hnTN+71gJPccfcmOEP3xEDS?= =?utf-8?q?+Wb5qDjSMAsGbUSysdUEUinj0TE8VczVnVkAS/EUtBiXY590clAxID7IjCt8Vh2bU?= =?utf-8?q?kQTSRsykPMp/Jf7At7KFzdZrpecMrFiuB/Ss4UQGf2iq4ndn5wIJB3BOshvJwb2sP?= =?utf-8?q?enC9lNhVtXn8OXAitK9V38NuYqb2t7jOQC4kdw1KVLNyJyQqOAgvBVKQaf5jW6nJU?= =?utf-8?q?Jwv3/92gEmDMOB1yTrpfQ40zbXNT9yy0AlVvH4NSyGSwh1d2UIKfL7eeoM4OzR6lr?= =?utf-8?q?Id4/2FCQJDi8uhZmU5ftJY0jmAOaGnRZuaIH+fQkelZGnF/TcCcvpNZFgCTBcUmJA?= =?utf-8?q?xjsmgroCb4YBt8/MlV6gPgrH5F85fftsncox4SQjF27wegu7yxzCf9zH2sslSMlKS?= =?utf-8?q?6GRsj+BbP2BXKH65PdnPXNPIuyBt+Eqzo+6uZujvEr386/JLWFseyHzDilWbJtyKS?= =?utf-8?q?zkfxEiTJ7gLMo94P2oiJ4O+vWuDve0PJhIwH59WUezqT83ptbxa7F/RAk/Tm3HV3n?= =?utf-8?q?vnanraQhDAmO9H6OoiS3mz4wsK1TzPCGodC7+/aXMvyVblGnFGzQsp9eVHxFr34uP?= =?utf-8?q?JThCshNUsdPEPj6TEzDiAGz0+nyYHow5mZyMz8CicbkJrEs2tpClpvOwrg/LC7Sdi?= =?utf-8?q?9/C1JEtGKBIwHLLn8Lowr66moPOvfMab+PPpwhmvWKg5vVVUeQUrP3DQ1/AaK7IVi?= =?utf-8?q?wp6smWMz2IQDvxHrLv4gDVocTGkXoNkxFiFwZGwmj0S7UjD/7ZRrhAUXo1FnuFg7r?= =?utf-8?q?qqPZDdMzZnc7Bzd+RDWtjmzLYHEE96RNxme5+uqBKh2i3WIbGwADMXwlggO3Z7hsz?= =?utf-8?q?07viYtpHkqpNjP6HmNBM6Dvum8cHfZRWvm8Av8fJqvuDVWxJ/2YtN2d6sA/ONFzDr?= =?utf-8?q?yZXyGLQUispqakyWsrBvb/oPh7BqNaaS04bwFo37wiKl06prldNbftjVPPne35Xxy?= =?utf-8?q?yNsW9mpDo7AFknAM+VjsQEXfN0n0oStNtufLtJBHzsW89fjyELr0LijolGi6eT9my?= =?utf-8?q?ACSkHj/bMnbPFB5lUPwO8jGSrzy6z78LkFJM9As4i8ts16/Q8SFL+j9a5LcksyAHM?= =?utf-8?q?qGvETgMqm9Yt5vhpTNtf2QbqeF+0oauOpaYk977NFk/c0WTEHRRF24XAvfuRw2qMU?= =?utf-8?q?bE3pAoXxxtvITm56opmsXjI8zMkeS10r8Wg+wX+ZFsB9+xUdhZZ53lZG5OfgF5VRB?= =?utf-8?q?uuuB1kPE0jcWjP8xDLed+lDZXZF56QkkSDNZ44Y92hZdXI6OX3KdizMI=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)(366016)(7416014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?cBZsmmeoImnp+ZpzOVJ3IclQYH9X?= =?utf-8?q?F8osHFdnHwoQixZwIzQgzf7M1RmktUVz5QfCKvj+kOwktG1Gau88oXMXQn0jl1yGr?= =?utf-8?q?GVcVrZCnUWpoNSsNCMAZfu9g8ia7Jsbypx4OtIBO9cGlo6k74DWbF4z0zzZfL7C/a?= =?utf-8?q?FY3lr4izj7qY8pdBzs8gfuYeKnCd3RhBBvY/GAXqKDv2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OmeZyxJTtujZ8HRy1t2PXg0ixwE1KO?= =?utf-8?q?kWC1q52uTj8zVVU8JWSTob0EX+BHJUUl1apTXs1cRmGytPPz050DLA7eoM+DvFCr9?= =?utf-8?q?VKCtdhiWEAOsXoItYCiYRPy/Ryo9xQkYcx+FcP7kVr66hrgXv5bo4uBwnAsAScFyI?= =?utf-8?q?L/GOTT0QeqA1uQVe0D37JHtORqEU1YlLJrfRalbbsaknwpPPyzfNSgXYXxWR5GOXj?= =?utf-8?q?bOtB+3TzUQoFJ37ijB2nkcr2ARepo3i29qjNgOC7Lt447IpqrDZJ6DO6UCGlp6+go?= =?utf-8?q?YccOQgSzDJq5ebkkEIGkT5YyJNi9Sg4Im2IpO9CoOdh8RsNle+4bL/0C6lII5P1HF?= =?utf-8?q?q/88CLDqz4ZrVUPIT6dD9jFOXEOtvoeeJFqZ9GqMu4wG3fQ4w6+CnGPp+iTN6j5TI?= =?utf-8?q?+hSioe7h1pVLWm4ebeKamWZbPcxH2X2hTiSuLO19FXmey8YDQAi30hMIVOI08gzqB?= =?utf-8?q?wDTstX9p54ps?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a58a03ec-8828-41d7-0cd3-08dcea09d92a 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:32:00.0664 (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: bNuusndbDpAAtiRZGmMBiy3+0/o3zzKz3e2qf/miMXWs4oQGVdxFwPA5OZ71/janMXY8aBw9KRoOsX5l8CPA5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7360 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241011_083212_477491_3A4EA6D7 X-CRM114-Status: GOOD ( 15.30 ) 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 Move global variables into the struct `fsl_mc_pdata` to handle systems with multiple DDR controllers. No functional change. Signed-off-by: Frank Li --- - rework commit message. --- 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 9924c6b816648..7a9fb1202f1a0 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) { @@ -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,8 +575,8 @@ 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, - FSL_MC_ERR_SBE) & 0xff0000; + pdata->orig_ddr_err_sbe = ddr_in32(pdata, + FSL_MC_ERR_SBE) & 0xff0000; /* set threshold to 1 error per interrupt */ ddr_out32(pdata, FSL_MC_ERR_SBE, 0x10000); @@ -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);