From patchwork Wed Oct 16 20:31:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13838896 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2070.outbound.protection.outlook.com [40.107.21.70]) (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 B9A801C4A14; Wed, 16 Oct 2024 20:31:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729110704; cv=fail; b=gkdRjYMLL+Uj0IK5RJ4e2hnhLNN1xkWADR4iBCi7/rO9gVymwzIoutddEwPpXo0DUk9HlFnFy+Y7mIMLtY/3bXquDYWmrHIofoff9w5fM6QDW38KutAsOPPjVu44ncZ7nQEqVzgbD5HA0M8ZMVd8J23UebE/XiFik19kZ6JIrDU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729110704; c=relaxed/simple; bh=bYOSUeH8Tsfygywx3VBHrQIC4eU9dzx5J8svyPSfkS4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=PBiPC/yfm83fUxJeL2hDNQgyOwJuLXRDE1n0h1wPc3FOJVYJFiPETHAp+SBhNdsADKk1OnpPZhEh72XZ3HpcMIPp+eaefoD7lD7rCbhIKMzKOHExq4TImuytXuMYRh3I5UxM5/hl2D2ViXS4w0A/OOcEKy+hPAS4upHW3fHFkn8= 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=M41b0SIk; arc=fail smtp.client-ip=40.107.21.70 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="M41b0SIk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fNzKmygUhsp8gm9gI4tEUignAIuXPEThaOPO+iAo3Jdcjrhi3Eshn1kvwrgryBuuZMCwLzJOQU7ViCptRq95NYMHRyF8J02JG8c+bHTPB01+UfI8hzO8Q+WbeVCl0xdbkGnkDej9bAikbChhpqWxz9ekXEWZ3H7SMJoTHRZ5zwCxlC4etjLAK+SZ4AWX4CtghHqbDY+QF9X3yms6GPHEBFmtZXPNTa5gUjhCFoEsmc0WeooVDVlfOyS0mUlobwBt8z2u+ptkZ4Q5cXA+UTN9P8KnAfp5ss+yt3DyHS2HFFxT2kdOcjVWCrRtgb01oa7zTpixshDW2nlcCEVObXY74A== 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=npss4q7HddpLqjpOKOIn4T6eAsqumBA6eE5wwNc03HPRti1qruBUl/wpj3HIyfyWIMrqtXxWg+8ZES38kM2yD1eGoDoYQY47U/J4hefjB8Hj1aUTKkxD4/U30ecAmvm5Q6WQfWoPq65u6LaZjBmMVTHOMQGf/r3u5LH3Vj5wtjWJtJv18OHRVM17NTJdnMfTq57nbrx3gfTmCSGh9rWtPuG/3yD+q10LBCNgXAjQbFaCP4BxZWTNtiMJEHG8h3diWUbTqHAonix5c4hsboD2twITVyokF7HEwGV3JjEYiMdYoJhfCGrLD2mRVqg7BhKdUBvTeuU8er0SKfgK10nBbQ== 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=M41b0SIkwItn3SpnFblrgb2c3amjjvao121fzz9DCPW5HIQmU8nz6cPH+T2dG+Jd7YGcE9x4Fvjgkt/Ru+i08uxlyHVexUZU7MHJoflyd+D2MhIXWrk524aT3r7CkxRMxLookDUo0YqKq4SBvABuuH65UK7/InVIDpsulyplhIPDscHI1vlrao830GBLPSLZMCLSxoooMFejfOIYc4WRYzbDYY1VWRCr9NeNqeUNLNq9kQ28srG91CxehHc6KrRvQcdJ+Jj2Ee2KzOKsfhOFAben+ylIEc27WmJkC1IGhjXH1ZT0yBIvhIZoidGlzv0MMAFX7dOytKncUP6YRMk2aA== 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:39 +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:39 +0000 From: Frank Li Date: Wed, 16 Oct 2024 16:31:10 -0400 Subject: [PATCH v3 2/6] EDAC/fsl_ddr: Move global variables into struct fsl_mc_pdata Message-Id: <20241016-imx95_edac-v3-2-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=3246; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=bYOSUeH8Tsfygywx3VBHrQIC4eU9dzx5J8svyPSfkS4=; b=EKJ8Dge2Ozee1A5eHctxPf+S/Ui6RqoLC6ohUz06aDXLz0UD0HtMz1CDFZWmF1+QiLVF6XjTL 6FqZaRM0buaDpWWjPtzLsbT0bxa1pUWy+WpA1RnLq6V0AOPwE0LDTxU 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: cd9e725f-234e-4f9e-14b4-08dcee2189f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|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LQNH8VVDtR62bgJZpnvpm4KVd4E?= =?utf-8?q?n0jpmo3VDpPTDvbazbJKr7NhKP0NOQBdEtIXDxfcOYyWxWCB4uYhAqZByG96P+f5O?= =?utf-8?q?5/z1s8xpQCtGNaSnIwZNrIJDyHkmSQNbH/v1AN9s2WKwhO/h2sjAoxDtu33FkB/PC?= =?utf-8?q?LAQr1FA4PNfEi9G5OJu2Dg+6+6ELXMAfd7RYO7iX0BwU6HgEuPtt27IzmondJkO2x?= =?utf-8?q?csK7gOVX3OWDTH6wZaXWjtGkM7kpLZXIlVxcCbK2MCcO9boXjWF6MfVAPwUNHvJfr?= =?utf-8?q?JpxkQBNdu1i6e9LY+tOk0dr23iIym/V43kfDygMZfkDzIgv4abUCZ/pTSKRJsEuf8?= =?utf-8?q?/hjvdUzlh/qsiy281TipZxB82QWY/mknH2Ugsg/Xb2yuQ6JrLwPglmowkf2B8FM1T?= =?utf-8?q?2aQ3toohRWq5g8AXZsZgXqqqo/GoLFt89q2PCleTbInpGpQaRbKPHSZDKcC/BA2DA?= =?utf-8?q?lfB+4Ygo5NtFzWOoysl3vGejaJsrVwJSIOqmFkV6DxozKlmEizba22OkdWqCHG0XC?= =?utf-8?q?IRBxvauV7YE9?= 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?8pd+bZ7BOrvYCeBgSfzdmOfDrD7z?= =?utf-8?q?4a1rBsRLRpoHCXUertgU2w2nHP2utU91bmxhuB+LSfszlk3Exo8Mnu9SByBFq6Oyp?= =?utf-8?q?g6JHrqZ/ToYu2pk/ddrDSZJJndcvqy6u9zk2+NFSrn5JABurPM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5?= =?utf-8?q?T9Rfxf6qfRD0ATukjXrJo1uLt5pf/4pBI5J/zVkzP8x6b4qD4bDOpPVEmhgVg5aLt?= =?utf-8?q?AevZtRkHe9ASxo28MgfpH86noPi5/4qgk7ApHrE/96jo8OdAxBt58ed+u/92Q7Kby?= =?utf-8?q?FDORi4F+xVY0BD7elwySHIk4FutBbV5kWZYexg04P4wsuy+kI/io8as39uvarI1nQ?= =?utf-8?q?GIUA9CtsqOx/KmLNJUb8HyCapbPgjHavZqXCyxA20hCSmkGsnCZLM/iYXyLklNOOZ?= =?utf-8?q?7l2mounODAnMILAqyg2btBbc1eoNa/lBGpp60pP90ZLB6OK2FOgnL1miWSnFyS0YD?= =?utf-8?q?k5gbSqRQSd7ZVv2QEZLzALJdETdKhQ7QJem3Y/pfh+nRk2h83c0SBWuo5gx0ki3Ia?= =?utf-8?q?VbS9YUyF1Cx8XKnHiZZAT7wy1PF7VB1vhsxRIQMyHWLNzoaed+7FTUnwBmC1AC54y?= =?utf-8?q?trjj7o8ILkqaTVRqU4qZr5Y7Lug9QO8oKxodjWf7DZziDJa3zRhHlHr7/rCdNXf3T?= =?utf-8?q?++M8r8hnyuzn?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd9e725f-234e-4f9e-14b4-08dcee2189f3 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:39.6367 (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: dYPE268wOfISqh9pNv4rPJNh4MXRFgWaut2MenZqSuNVd2P/8LlAmnIOQ/N0CgtChJP768cYT0+apyoG/r+4WA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9845 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);