From patchwork Tue Nov 26 07:56:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhu X-Patchwork-Id: 13885553 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011021.outbound.protection.outlook.com [52.101.70.21]) (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 9F3C21B3936 for ; Tue, 26 Nov 2024 07:58:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.21 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732607905; cv=fail; b=kSW0BVkzvdUmJ4jjKwC4FmwIrou+w0YWgRMoiOYjaMbKPg1PbXcdGkQrSoaQYEyzPe54wEOy8R+ZE2z89x2CV14D5aZHrkkiH0FsjvpJ8hghvFAWx7+0Vjrm0dgplbENA5mA1rcVxMvd5XaAXDq8ZiEF6cQbxPXOLskzoR2iytA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732607905; c=relaxed/simple; bh=kaokeuoUAOSunrNU8j/+kg1e+Y4FChqDRmAQZ/17nzU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=JbRpLZ1zOoRyYZGIFkxksENE6ze8Jss/H0U2QJORtvLS+MuXQMPPrtRHWpYRjiDoEWyxWwc6D6qXN2k9Px8Tf9mKVRTAw/7qOkmX0nXPZfaSgU3npAsBJO7louKkUEuf0csmccxH3vkq3OyUpjsG1/EnvluwUpD2DMe9Su0gBRE= 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=Z122owBx; arc=fail smtp.client-ip=52.101.70.21 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="Z122owBx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P12dig6tgFJkrXDO51C+qHkErt90BUGaePKGXNRlqOMM0wK2HddRUVpE3jQH507he2ksWH2RcZZtv44GoCpzWLuaf6yw4b0DHWQkYj6Z1gsznKI43hSg2h5tHHjKcEnj5YcSQBavRAhrhfH4QnD89wTA1C1J7HDZ+WRbmR9AR5xQ1ZOj9wX4vYGFy+YEOw+W44RUw0uFkGvY2Y1SccdjEVxn1cYnlb5VdcFSvK4nJRQJGdjoqP4R7bc5urT4uC1t8pN2WhVaBaUcFCe33xfo7TZLagSHfe6T5KjG8sAoG1ziNuT3qAasoYXY3ZW3M0Fx/3QZuG1qRk6EyqhkDWcalw== 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=gw2GdgKgzxq5HSKx9n+vRdiBQcPlh5JwuYYecwcvkAw=; b=tLl1WaRFzfru8l7vELIY7Q/XbWIu139osFoMzSpNY4p0gg5sHNzbvCwrY4IaQJ4Le0f4dWBKPWPfmVehJF1Blmso/ZHtJBEjOLOgkKeOdrq2a0POVQZfjzkZkWcwoPW94UNnZyXuXsXt5Cecs0K+1HNTr+5jT0iVi3GUS7lXargG12UWAH0KR6xMjF7ZdVgyqAaUf75jZ9AugT0HKhcs4az1Shdxid09seRCXNVsIW+57Od/4SPgq2QVC5TtwVQ/0IbYu1EuzFQ0frc++6i3u+MMq1CVF6lK1G5Qdg1O0H93GWmPKMKg74ZDLMsWIWi49S4rZsNO2w1bo5IKlR5zbw== 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=gw2GdgKgzxq5HSKx9n+vRdiBQcPlh5JwuYYecwcvkAw=; b=Z122owBxm3Q/xOnGyoVAoRA9E9by67yLopa/YhtSl1CqkcbFqDzE+1UtKUFbYWtdYpk1cVV31L+sGUsNtG5HWgU1lURiuLd++j8io+NHwjVtbJ4lmop2dtHtOHXcS2/OzD1+1fq01vpOni/EOj0qv4V3rRVfcOzXiYbL81G73kwf6jPh7DJRqJHrrrZ9bA4mumi7ExhQUftOVuBI3nDooG2MjZlr1mWCse2sZKvqElBjUTy0caoXq1GsFk10juuVbcXd/gHz9KIWcrp1vzdBWvHi9GbuFMzWNQQUaHgmEV6h+uR64OEFzwPcAVekg8ZxFpkDASM8gUpYdSJ+smBzMw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8676.eurprd04.prod.outlook.com (2603:10a6:20b:42b::10) by PAXPR04MB8489.eurprd04.prod.outlook.com (2603:10a6:102:1dd::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.20; Tue, 26 Nov 2024 07:58:20 +0000 Received: from AS8PR04MB8676.eurprd04.prod.outlook.com ([fe80::28b2:de72:ad25:5d93]) by AS8PR04MB8676.eurprd04.prod.outlook.com ([fe80::28b2:de72:ad25:5d93%4]) with mapi id 15.20.8182.019; Tue, 26 Nov 2024 07:58:20 +0000 From: Richard Zhu To: l.stach@pengutronix.de, bhelgaas@google.com, lpieralisi@kernel.org, kw@linux.com, manivannan.sadhasivam@linaro.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org, frank.li@nxp.com, s.hauer@pengutronix.de, festevam@gmail.com Cc: imx@lists.linux.dev, kernel@pengutronix.de, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Zhu , Frank Li Subject: [PATCH v7 06/10] PCI: imx6: Fix the missing reference clock disable logic Date: Tue, 26 Nov 2024 15:56:58 +0800 Message-Id: <20241126075702.4099164-7-hongxing.zhu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20241126075702.4099164-1-hongxing.zhu@nxp.com> References: <20241126075702.4099164-1-hongxing.zhu@nxp.com> X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To AS8PR04MB8676.eurprd04.prod.outlook.com (2603:10a6:20b:42b::10) 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: AS8PR04MB8676:EE_|PAXPR04MB8489:EE_ X-MS-Office365-Filtering-Correlation-Id: 2aa0831c-1c1b-4226-ac01-08dd0df0181e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|376014|1800799024|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: w4UpRNiE6U8rUkbpBSSOchl215Y4xU/gtwaXgqMRT3RSzU9meYpf7YJ1RPr0Us6N4x2Af41czVdGg5aAW27OfIpYIWXy+G+KnatyoWNiRMo4qHu5lsXOTZK0E9CLDwD9U9x+rv4GGV1pUwpbxbQhUgsRUwpC/VTclnjV1HTfuuZ5vPJIjKyck5vWk2DFayuSp0agNzIybDm1gzf/QVFRyYwiAiDHkS8jE/sJDYV4eoqvG+sQL+Ry+kDh/Pdk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ILg0VSFBIkVTgsF3K6DR2NTqPujyByQeXFBhO5frEPghC8yHkrMbU0shSXlyxQ7/RNuI6ez4V06Sk3O3ubnc72g7o5dfGdbB5PLtb46X2IFzn7P1948yRbzakA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8676.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(7416014)(376014)(1800799024)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ok3N50o/l2ekSoPqSnoGH/328NRxW+HzA4WvGd6hOhnvX/mmxhhc2mp8hL/gqMfwY1nIvtJ2txY91wYjX2WCOVAeBKWV50JOxbdmTVfcC9zHcGFBj2gRNUWVQpjW2mQ+cnSnb8iGFQZ52UoHH3Xc89HKHfbzM6m9IH/aLGhDzwChSAg37qf0A9bjTomsN+0gfVMZ5xt4aXKoj8FsdsUkAz4tuDmcVU0R4vUKKfaVFveXADZDKtr68G9275USI/wfgVCEyAoFyP89340CAJ7fdFLMA9TwFXZdhSOSbREe0cNpFIQ5/tbvYLtkzM1yPKBwp90gTmS4PSlspm092sXE8h09S+2YT/VIaePyQN6VNTZze+HOM/HIuvg3aVM/J67bOpVmHkmekryJLKLDjNGtDIoSCet0ScRhL0p/GyKQFe7POjM6dRoHyyDkaxw8KULxIMJdfumr1VHWEIzvD8TDueAnURaX+UfhHhV5xwh9iaiqG/5T1jLn8LtuVH+HTgG5XsxdUDmBo6o9pPrlNa+qGf5UJWIQ+XMjSc7SQlOmzX4pkXH9V16t/Wl3aeBz16Ll5sL9RzrIGts/vAXJUUVmf9I+yVY31LQSLExQABZXcvaYJUOg2CuIIsLxgRwVhaGxBAWcFvRf/QkY6ztAHkzQ5MsjxuKXE61BCz8vKOlUNlfm3HuTbGCRQrCDytOvnLMbRP41RKP46LPRM5QzDDdS0YqwQzQa6cvJxOoycALLy8rbMjOpCe5qg9s7Z1QlL8D8es6hhInvo34x9ydLWoRHBzATMgSl0F/l4rzZ8BYxUczGIItt7iEuuD1s5w8ZfcctQdMddXpoXgC+0Nur7qALfagT/PTfqsbx+Evpu8gexCTy47M+HCKGnTiPh6Iu0QIC8Du7SLOSugNPCU2g2vYNRAjoBmz1p7wmN498I8qXiW0xcpFeMew6yr09HGyU5WyUBy7RPlTxWzwuudposlDJKpnjhUlBleYmBwcQB4CnmvHgo4HWKl4MUN85Ufi/yFf9S9MX53oRlmkpPZJZcNqJNnrDiDN9zHfGIh2BSiBmK1gwJr9ZPkSxXcq48u7bH9X/2O/e4rMTyznmOWWxUOKcPdmBb2b5JVYuy0mHz2oc/zNu3ebzXJzXUobAJGzcQqsFITR2162huQXwNbdcFKi0Aqt0qzDJzXRBmbqvuyzhC7kJsPARMmDg4tmr+ZSHRY+Uw2FU0R5G2pme/djq0DRRT6BTKJWp5kJfm/AxSdnVxZAqcD+wBvDryFXecfuIdc67hK8XRAD+Dep3P/gXoTvF8x6NxcmjGyO1+UMt1Y6zYpCsXiKcbwUZNjnbB3a5q98hH/9QpIBUcyTKngrqf2dUAC7XDBaGQ2p09ptWXmpdlhgwEbK4kb/fsixq85kYnZoBzflgp3n5mQSLsC2qPOMBZMrkUS5rBkkVdP6IRID+17a4Y9uaUCFvMHAjYyFHFr9jQlf+go0BQbX1I15evDHRnV/hCYsQdqvxO6GhKXDZtMM090rTN6BYt9FB4LPShZW5jhtLSrLnjLSPtHGE485mNeoZT0IKICNKpBPsPLu76ObLmodMh3yqhIBKZqu5zE4a X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2aa0831c-1c1b-4226-ac01-08dd0df0181e X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8676.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 07:58:20.6690 (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: KTYJovi5cncek4WfgNMnw3OwMdFh2HdXAfjY0mV9aDeVESHIvAjZVv2QgkkxjikKJKL38q3ImaSoqpn10gbQQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8489 Ensure the *_enable_ref_clk() function is symmetric by addressing missing disable parts on some platforms. Fixes: d0a75c791f98 ("PCI: imx6: Factor out ref clock disable to match enable") Signed-off-by: Richard Zhu Reviewed-by: Manivannan Sadhasivam Reviewed-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 413db182ce9f..ab2c97a8c327 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -599,10 +599,9 @@ static int imx_pcie_attach_pd(struct device *dev) static int imx6sx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable) { - if (enable) - regmap_clear_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN); - + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX6SX_GPR12_PCIE_TEST_POWERDOWN, + enable ? 0 : IMX6SX_GPR12_PCIE_TEST_POWERDOWN); return 0; } @@ -631,19 +630,20 @@ static int imx8mm_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable) { int offset = imx_pcie_grp_offset(imx_pcie); - if (enable) { - regmap_clear_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE); - regmap_set_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN); - } - + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, + IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, + enable ? 0 : IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE); + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, + IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, + enable ? IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN : 0); return 0; } static int imx7d_pcie_enable_ref_clk(struct imx_pcie *imx_pcie, bool enable) { - if (!enable) - regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, + enable ? 0 : IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); return 0; }