From patchwork Tue May 28 19:39:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677268 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2073.outbound.protection.outlook.com [40.107.21.73]) (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 CBCF31802B2 for ; Tue, 28 May 2024 19:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925234; cv=fail; b=JHL9rKCpo+v5fKroOxjfsYOo6dCdJsjAOChpVcqB/3/HMBFktmam1GzJBj+ZYYShxj/HT1sc6UtWH3JBOiao2JMAKlS8CS2XwPvTZGpxp9XDUN9f+oKYsKGxs9yn/FIob09DDjPA5iKrmk7ubFQOSt2mdP6gPIo8tLdg4DhjfiQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925234; c=relaxed/simple; bh=yaBb5frcbXHTqJflSEnujAuuV0Cuk9LQ2ZU996mjQOw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=OIwk7cbWaxO89xrHPVrichq7qgC8rhldM/ofzuXlo5D1Ra0uBVQcnrnfZEt2J1c0wUaaZpyowBJt0Np/Mw0pY+9gN3LoVibS/RScyT1MD89faQWqnO/M3mf3qSIxwUOoNbIgcsn8/VvKiKu2DYkhc6zu+ywMkACv8BUqlAC8tyk= 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=bKliTQbM; arc=fail smtp.client-ip=40.107.21.73 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="bKliTQbM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dQLIDBdpoAia3qUGiDigeW7fO+Ayas2wXzCq/m9z7kN7gfDfy6rlYxZyImY6v1JTzGLbfbnsna0mG/3w5NMTpEVreB57aWj/mu3jiyxksEkzaHoTM4IuQSGO+Ncf9UGdbGxjfsvuMWSiGAlK1FxoqJDo3Po0PoVORVBYlyBrIBYMydl6Nx27qrHAYGBiaJkBLkkeYcObzudJkkbJp1v9dr6CqtSecMOsaog7CIbzpQvIlCrBy7CxX05Y7mYboglV5qDc3O0XdA3ud3FiXa+k8Amnv1yGAGNBJ4UiyiZU7+bCivibXS7h8zA9iSVVvZA2HZAb9SITRbu0BXPgE+6Ysg== 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=cr8a2OtZJWrim4Vtd8B6aDZmDsKq+lJ4vIK5XEvazZc=; b=L0kiOB1BjAFFGWXBZ+o95NSQntxJg2gsLI3KLkO9JSM8XVqsYExxve7YeIFiaReQRvpa57v/oNCtSP4Q6bsHw35U0Sf0+cmEKi5zCv5UaJMUmWup5Il/KTj3zMNygT+TZASnYgYdzhY97sTliqLcn5OSTNC45Z3ATojHjfoora1l5Ck9OMjkS8fgNBPHJCg1pleHHfJ2VUlibyGsSbKtQYY8BQMjqVeCDtlPlRfj6Gv9P1IbQSTKkVzHsyAQOeh94tb2DVPGtQ8sjExYTJDo2nsM5XJ5K+yf4NhH7DCiNTcua4BtS1sLBikxkeNKs73wHuvtmzukvMKLyaPANIPS2Q== 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=cr8a2OtZJWrim4Vtd8B6aDZmDsKq+lJ4vIK5XEvazZc=; b=bKliTQbMrikkrjbRNsm4p5jjeSpttim1LdCdJGqiKzQT2l1S9wsy/th33vh1aIT5BdFUWm/5tL1bWoIGMBnIx13Nx2DJCe9qLRonng6PZ1Oh9iS6wn8VmRo/xq5PZGm6fMTwvf6KuvpDv9dWCf51ufMGqEVVUuk4hEGT/KOANWY= 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 PAXPR04MB8655.eurprd04.prod.outlook.com (2603:10a6:102:21e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:40:29 +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.7611.016; Tue, 28 May 2024 19:40:29 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:24 -0400 Subject: [PATCH v5 11/12] PCI: imx6: Call: Common PHY API to set mode, speed, and submode Message-Id: <20240528-pci2_upstream-v5-11-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1716925161; l=2344; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=yaBb5frcbXHTqJflSEnujAuuV0Cuk9LQ2ZU996mjQOw=; b=KPjigMZM/5Tck8+akEzRLrnGJhJjNlccMhb3gLqFSW8FURwFBzwVk7GH3yEkPCsvjMdX8eeJv gLunL1L8gxRA6LQECfgvgYoAT06G3txiz3oSuAIZ9+xbhHxzz9gJN1T X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) 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_|PAXPR04MB8655:EE_ X-MS-Office365-Filtering-Correlation-Id: 79fd5fe2-77b0-4cb4-8cb7-08dc7f4e07f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|7416005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?240oed+vLWBO4zu2oMIPQh2Z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fp8aq?= =?utf-8?q?1oOUzHYi84u03jFpJgdD2VdeNLzfdP/ZlWxdX+JjP3AmIKzS9m/L1R/1MZry1rfoi?= =?utf-8?q?N0wNy/dzN8XjcCdrPCaI+Dh0zhHG/mm2WSpX69D58xm8S+nPWjlqf5OTPi1fl3M8k?= =?utf-8?q?0sCaceWPhlRevoixDPPBvTy0ReRxvKSFUJA3p8PEi2nuw80J4Qf3dxy7e588vCgCF?= =?utf-8?q?f4if0Z74f9X+2uJcYp8SQVSnFTtGzFwCJZK7245QwuWcMnsLkkqTkcPi3NA67zEUw?= =?utf-8?q?nP26camw4pTD4WNLuz+a7mIEBRtz+adqrtKj1Q7okpdjOb65rTFtixd5fTCxIsjNm?= =?utf-8?q?JN1sxrDe1y4hGNaAPgyyCPbh1VGbOn25B/0uXS/NnhJW3InPTIURde0JcLHY0/T5q?= =?utf-8?q?03YMuZFhYRvfmAqIokY/P4zLQf84/ZE2SMVjkAfkCv4tg6SWElV/k11w=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:(13230031)(376005)(52116005)(7416005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?gMHtOzXaU7SQ09xWg0wDb58si9xO?= =?utf-8?q?N7ykbYFZCIS7SpRs8IAXb2LvZwdp6TBXkOX+3WIm+x31LW1aLiV74hjjKvbhrj3a9?= =?utf-8?q?IxGZAhJKdBgbYYJ4YSI0wTGbEHPsaa7X5H7dPPN02tUApScKiJpzKd1RpHCATWXxl?= =?utf-8?q?ILMYjbDnNx7gpCC6NMmwLCIFCVGQkiWGOI/zy2NqzFCRmWS7mY7I/wK+iSVU0MAEo?= =?utf-8?q?HaQBva49v3bwexIcj7ijlWTIPkMBY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BCqXOjJddgfqc2ze7IrYhSPzuDyyX9XfQ6OE/5o?= =?utf-8?q?f8nugUrNniFposSzqU8TBdmh+3qXU1XcaWJ8/IGRVGA7wgjdYNzcwcuOzAjDjuJEC?= =?utf-8?q?/PM7mmMBQrKRD6BNr9qG81Ax2DEtjVApSPmQSzYyHXZAMHJx8yBy8Md6n+BQhu1rY?= =?utf-8?q?Gyv63vxKXK4F5EWMShY4PQoeB6YOJUPgNEkn48ZX3wYXwNlWwRMtMXQ8FA8O0LdNJ?= =?utf-8?q?q5osCy9FvGD8Fb/rofWXRtef7OB1h4CWMe8HnQtVqCX6AiDEP1U0hPUdyGXWGGmKX?= =?utf-8?q?cqFNjGF+QjUCiezcI6AYHoJzmIkfJ0yyHdSEG0//HY09LarQwvPS1yjlFqCXus6Ct?= =?utf-8?q?np0vFNJjvldtgrg0B1rqKQ+aReXqUIUCYcPBvG8Fv1ayqv70tzgXrNV8=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79fd5fe2-77b0-4cb4-8cb7-08dc7f4e07f6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:40:29.8185 (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: h1VQtrhDKX2cmpwiC2F3hAPmxFkyoyZNh71uU7qhoSny+UEVCah9BVIWqLzqIyPvYTF25eif5TC+J7r/GkkiJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8655 Invoke the common PHY API to configure mode, speed, and submode. While these functions are optional in the PHY interface, they are necessary for certain PHY drivers. Lack of support for these functions in a PHY driver does not cause harm. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index c8d58481f80dc..5a725ef6ed0cb 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -306,6 +307,10 @@ static void imx_pcie_configure_type(struct imx_pcie *imx_pcie) id = imx_pcie->controller_id; + /* If mode_mask[0] is 0, means use phy driver to set mode */ + if (!drvdata->mode_mask[0]) + return; + /* If mode_mask[id] is zero, means each controller have its individual gpr */ if (!drvdata->mode_mask[id]) id = 0; @@ -882,6 +887,7 @@ static void imx_pcie_ltssm_enable(struct device *dev) struct imx_pcie *imx_pcie = dev_get_drvdata(dev); const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; + phy_set_speed(imx_pcie->phy, PCI_EXP_LNKCAP_SLS_2_5GB); if (drvdata->ltssm_mask) regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, drvdata->ltssm_mask); @@ -894,6 +900,7 @@ static void imx_pcie_ltssm_disable(struct device *dev) struct imx_pcie *imx_pcie = dev_get_drvdata(dev); const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; + phy_set_speed(imx_pcie->phy, 0); if (drvdata->ltssm_mask) regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, 0); @@ -1029,6 +1036,12 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp) goto err_clk_disable; } + ret = phy_set_mode_ext(imx_pcie->phy, PHY_MODE_PCIE, PHY_MODE_PCIE_RC); + if (ret) { + dev_err(dev, "unable to set pcie PHY mode\n"); + goto err_phy_off; + } + ret = phy_power_on(imx_pcie->phy); if (ret) { dev_err(dev, "waiting for PHY ready timeout!\n");