From patchwork Thu Oct 31 08:06:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxing Zhu X-Patchwork-Id: 13857686 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2044.outbound.protection.outlook.com [40.107.247.44]) (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 C3E54186E3A for ; Thu, 31 Oct 2024 07:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730361455; cv=fail; b=Ej0rvFHMfABPfyj5Cw+N+U3VvWc8xwvC+hPalDM/4vH6X1E8etLjjbOOUsLdNCIe0xRRsGBEO9WADlYFRvllar+4Q5Hcsee94/+Ck0bg2DQq2gq/cWErkEtg/ec7QLuIJY1ba4ITP5a/wFCHBHAyoNmw3Worr9breuUkWduYbVA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730361455; c=relaxed/simple; bh=wgh8MWnQ5WiLKbTXhZ0tm2fvsa1yO/xAJIzWe+B2o2U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ZnNwsOKcgmG4xergSlJdDmLA9N2SsPoFKMy6jhGUO0UGVDc5F5Gvx5cri1u/UYIOCFMCt1R3MyMs5urBWFsM49/VnA/aizVYeKM/sUO/KGVexztm68nWh6jXBgqxGJCCGLqEtYbxA4YmboyN5v1Dsh7h7TiZDu1Vo2fNbY2ekCc= 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=GSCFxlUM; arc=fail smtp.client-ip=40.107.247.44 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="GSCFxlUM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rVQqPhhFzzAD58Y2w24FEyJO9ykbP9iM1APcTaI1bSkjs81fHd/BDUs7qe3uqHmcr/IqkrhmYyoQhh0mQcRmjBl7FLaFsXyPNrrLGSDzhLSOXI9tfUkVan/5AK6n2PgnAfZuAD1HWQzzpQrbTPFkWhyoz2qHyw5ERuzXEcIY2OE9AlAQchPeR70f/Q1waCH2mU1LH1PZeY6bpi/+2jtdvfH22KicmCRHcswbCiLP7D5PupdwzJyrKKf/NI5L2NvPbKtoq43ExIy07L7L1vRrelMfWUH+QoqGgMG0/wAC1fbimX2ry396+1KkqcWvhoeRzSVXlMuDfFoGwJ1ChsuDJA== 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=fnSkLIV9obQZuA+bG5vyt9kpBfeeKXGJOSCwD4qlG5g=; b=s6QCwjLV8okhJuYJmT/PPzde2dhQ3IABL4rYCqnRKit5EZeRBC/lH77H0lWonSoYqZMKI0lr6+ufASZCX9Akoh9mrvl8g4NFfhRyk9Ursok4sPXpZ3qHTOmUVfceXZZM/xbZCP17Dxt9iEMUCJVwdPXhx2moOx564tsfCAAOPZjXJIP6MmV6MTl2HB9A2demI7U/KAFYGmiXIkzr39YSDBG5wY2yqWhFH1MNsGbJ8RMy9s2UZWxPzrGIMNCdi43OhobGZb8SniML9pI4a2gI6GbvkjPrS+R49WQYKNh0HLQSIfV4APdql8pqtnRmSV/eK3pr+9tIw1faNF+KqAInqg== 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=fnSkLIV9obQZuA+bG5vyt9kpBfeeKXGJOSCwD4qlG5g=; b=GSCFxlUMWhm0dYTaPLf/x4NDgyY8fKc00hxK49BAbZ7HgFGqvLap0Q5jE1iGhp/1ULrLVDWRl76tGwBtdYdPZT9hJ4oagApG0LrTHmb6sj1bHrMyOo9S2d8pTt5EseMxKpO+BkylmA5tgsQcK2V24e0FO5bBXgZ6XMfTWDWfOXQHHHPCqrvik853lP3YhkK+4kLJU8iUKqpPzmlxTsctXgZQcJJVxNkr3rtk+ZC6uKozqaCU2G785oYCo7ickPKB4Jve4AqltZQNj37zmTMoF/9pRKTv3xViVV+FzdYkjORm7gANxM89Ipw5LNAkGUVLngAYhyU+h7UnHzY0LNnzSQ== 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 DB9PR04MB8139.eurprd04.prod.outlook.com (2603:10a6:10:248::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Thu, 31 Oct 2024 07:57:29 +0000 Received: from AS8PR04MB8676.eurprd04.prod.outlook.com ([fe80::28b2:de72:ad25:5d93]) by AS8PR04MB8676.eurprd04.prod.outlook.com ([fe80::28b2:de72:ad25:5d93%6]) with mapi id 15.20.8114.015; Thu, 31 Oct 2024 07:57:29 +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 v5 06/10] PCI: imx6: Fix the missing reference clock disable logic Date: Thu, 31 Oct 2024 16:06:51 +0800 Message-Id: <20241031080655.3879139-7-hongxing.zhu@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20241031080655.3879139-1-hongxing.zhu@nxp.com> References: <20241031080655.3879139-1-hongxing.zhu@nxp.com> X-ClientProxiedBy: SG2PR04CA0184.apcprd04.prod.outlook.com (2603:1096:4:14::22) 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_|DB9PR04MB8139:EE_ X-MS-Office365-Filtering-Correlation-Id: e0e5dc12-5005-41e7-65e5-08dcf981ab0a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|52116014|376014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: DK7YjFBLbdKU3dDTXkAg7EQj0Fx2B/FqZOwQ1ThReJ+liwIvnFMLaN+l1ABxminGuO9aU1YjWmE0k73PoATCPimBsZMdN9a0w+WyXjA0rvi5HMsY3WYeTMI6qewUj1epX5acv6HPWCp/IGu2RjdN1QcUTsrPxa1Jj0ACdfUl1xERpsi8zkf5mL2nhV0iSiGUAzwoC/fMM15w8pTHidk15F5e3GwCRetdI9/sZyU1tGbpkpuM3Rs0TUDXRU/+9V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egM+ePTLEsiRj4NQPfekUD9SDmKcv5tpizjJlHWI88JeQf47rZgcoqzd0Rsmm2bOCbfGM 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)(7416014)(52116014)(376014)(1800799024)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZyheOXLonZ6mxBDDXNe4Qr3MluvHbuqGFRTT/pMPmTKMUfPrNLfCWS0VVs+Y39vCcu/+IJgGI5ipWZNsziGekatuQBNukpnIgGwxUJwkzY03UT8lsQwfE2yzG9Opv6R+DuHvpx1KALJxVleBnpBhjGqan9HB2FU+qLTmi1Rim56qK1nmDnAb6TMiAt6qY3ZZjTOj7vHhuubZZsg4VLBEzfLK3TNb0z7Enj/GCLfYjv+7TJZNC/Yuz54PaNyBBuCO8BQ6GfOoPEl4r/M1vvVj8ebP21wnkaUY7l/hwScJTlTNox413sxXOkAP2raKtRhKlSzriGBGe1LV6xQ1hrP2uE1NjYel8sKP1iELQfrbBoJo/9Tu3HsU1YCG2GWH6I2lbsd7dCaeNXxYdKOlMF3QY+oRunPUsd1wCxHtHPOOGjheT6Pu9z8/U0IUhgkHbb2iiTfbvGYDQzqvaDrZZ/eu7J6hMOzEtMQNYF0Kqjd+gNFE+E3pbdjNK7O7/kgvuZtpHJG4S2WaJZF/l1HNRH6w3la5TNjXbpHuD5YDGd0P2aowWLVkRrs4pvfI9gXs5gNavpe4BpH+VczOx0p1xWsVOMrTXvYuWRsjzKaTFV0qhtwQEzhg/anTAQya2Al2TeMxQI1ej+iOKHbplUvomM/5S8BN5SHRw7H1Iau2xpJ/1/IlJLVCpJlcTzQuJOufI+9WWZthbaGTMwmGWpLCqSwzNYMBoFF+jPtpMXSE9vD9xgQbvvjZHqrsR2F7622COUX6FukncNVDxYXbr56G3jzZ0c5b4LgxoxbGuWWixRzH6fbwzHFpzQ7lBC/fDcBoPGACUR9wZhpuIo65h9Q5WvABE3sYg9qIPNasTKlf0XpeBu3tt9e9CNLCPKB0/a2OSEjB3x5lNFhrJDWVkQ/G5RjOo/4ED/EG+jc+XexJBz9kOszH6PAO27ukoptJMvFl7WvhuRYDjVT1mLRvocfDfpzwcqLSci8+ewNu7m3LTpE4b0dk81a7ZRjREKhVOtINGfrl3in4KyzCO4gxeyEdCKS1DLd77yzko7BtoLpKEzf1olkeQLMU4o4m4sTxCYGTbsQSbZzTMU+BcYRika5blhEzdkGnLaskk3pQcCSnyWJMSoUtHZGTkaPDp3GKGacjnKe27PVJMxRGRQnLOnLPGPS2+taTIQNGgqP6NxkJwCFnFIkwriDhkDzUgF0aBolbG6gLYUcjhu8EKVgPMTvK+yRZEFItSZamMnGuV4MMbWMTWLHuNoL0J1rvCwR2lHUMvGOchJtJC0iktMYI0sjTjEoIcYcBgx5ic88/bYqsIw5okNtu5vQwlBtZmYqJCXXsUBKixXwC0Z19coe7hWG9Hip5QHDg9SuF9sE1fAVeu/5E1thbmzze+pjNW+izD0a9BtufTkDLA0DOzBJTwcGnb0T7QBPIJoPb7PYu9LjhL4LEY9Cl85s+n8RncCGNN3fVZprjJlo3h3x9RF/BKtgHfcz3lJ/AiIOhUqBXb7OKuRZkEYYfcXoCoMDLz6J4S+Dvzh4TTL+BwkYYtjxJZfFOEQYbimofO8kfVb6o57NWXRzDCkf97Euoa0Yy/XsY6oGJqFWX X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0e5dc12-5005-41e7-65e5-08dcf981ab0a X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8676.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 07:57:29.7304 (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: ZI/pP1JPUuIOqD0e0ofjIEb1mqpJFXW3NJ8XoNgLT+xVzM4egTAlGohJkP40rEHcau9u+7ppy2YKJ6u3tS9Z8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8139 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: 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 92f2d2536ffc..e696dc9381cd 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -594,10 +594,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; } @@ -626,19 +625,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; }