From patchwork Mon Jun 17 20:16:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13701375 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2043.outbound.protection.outlook.com [40.107.103.43]) (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 54F2E19923F; Mon, 17 Jun 2024 20:18:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655490; cv=fail; b=W/GU5RnANrBVJcmhah4ItGInRIl34Sztg/794tyASyr5U2YAQQSZQJSm5k2kE+YF+OZNM5z9R5etc9AWiKl0im7qUsklWH3oA7FZ9r/30sToJCOLOU6Wv9mROjgbpliQwvenGutiFcb3Jk/Jr3ONRhGssC2SjmxSI9lJjJqTwX8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655490; c=relaxed/simple; bh=SHH+RxbPVg9d9vvgQwAyIOSN1a0ktF2Q9tORg7XL1Wg=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=BAASp77DUvJeouY4dyfCDTrXOpv5W1WWBeiehymJUeASDzfSkIQWvCJX6kZGdOVHIL9vpDrJJe1PvzQx7s36lbLtRWqzyuKrLQkCbNt/5hr//sQttrEgq7ka5Ew6UNvAI64hQWiykrHIe9QIJRGjTFcmhLbfL1veBf0WoIg6D/c= 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=nUALNL3y; arc=fail smtp.client-ip=40.107.103.43 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="nUALNL3y" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JLlh1Q4LU71Zy6JKAcX+isitunPdsHwVaLip4liZSK4MkU9YqF4RlSYo3+NuH+2KRUt1DBFSB3+40qOO7ZTsoujfwz0Jkl1hV1NYu04pSKtgsI1A9j5/6NV+nHirvMdxkg1aeAmmWVkt3E9esjLDpeTdcuJ9INmN0tYqV6NsLgVhpt8Tjqa9iPrT3X+bXNHl6W5ABUOAIWK+RNTdyYmqp1zLqBVheyUz09uB8IEPFvMGIpQUq3tYmbyY8AAfDzBq6cDio29wWFgBYmRFWwIGHlrgKU9ZaXbSsL/BCdSNeVkzlIqkW4WZPzOLl2nFIV7NW4/fAf+uPa4bpwG+poJjEg== 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=tHd1Na5jpn2/1hr3DnG0fdy90jL7MoCN4Eo+Mj/vcaY=; b=eRXZiA3m8NhUpK9/ZotHyUvmjksuivr9nNIGaFYhFlm67zpKZnmY3ZoKEh+y3KCkww+EMu0NbmtnQZncTexLDHbIxENGAF6zuWMQ4yKkQmXjGAxvl7G7IcOdmrkPinm++QbJ3Tqd9SXI9TmjihLXUvOSxgnMUHqDxW08PFAgfeq7BFFRSW3XnJWwBIyn7sCVJYNp5YYhvd46a3e4ctv7WJWLvTXSSIu+3J+D+V/f1X6idLe2BWfxKpPsagHFMP5BGPIfFPicBnHjPAbhI4dKqnp7FAE4MLo6UA5xL7HIh+r+9ZSqRCCrm8Y6TibgP7jxWglSiybv+QJfxor1+iLhEA== 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=tHd1Na5jpn2/1hr3DnG0fdy90jL7MoCN4Eo+Mj/vcaY=; b=nUALNL3yY13rFk4t5BpAKAS0N7C4vD3lhhclDrk56DvI1/QwFRN83+ZdDsPwDP4whKvx52lb/sJVdPWLVEoExsMU3ENGmGvwSiFba+x2ymsyudSm7jBiDRQvgBzt5pLqZkRaP6bKcQN3UmrZUBqSLOUud7XQS7DKo8xzMOmzqhI= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:18:05 +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.7677.030; Mon, 17 Jun 2024 20:18:05 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:45 -0400 Subject: [PATCH v6 09/10] PCI: imx6: Call: Common PHY API to set mode, speed, and submode Message-Id: <20240617-pci2_upstream-v6-9-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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=1718655424; l=2342; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=SHH+RxbPVg9d9vvgQwAyIOSN1a0ktF2Q9tORg7XL1Wg=; b=1DI3HJ76h3fwRbwaWh5+zj2zcwaMy67Ux3uNEvoY+VsVDXNwCeK8AK9kbH+c+fD5DiENFwqw8 s3npenmN8jJBqLfo2zclPe35U8r/3CQzw/wF27Wwy8LUHJeKwEj12gS X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: 19e2af5f-b5ba-4353-2f27-08dc8f0a98dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WVHqviDWkREWBd5G2IMln0t9m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gDWbxbXn4H7tYJh33?= =?utf-8?q?i5KQftJ3oI28loC4I1wviXFUTpENDEBgTF8rlWR2fxWm2NxWH7PCQbgk6qMEjGmKd?= =?utf-8?q?KKBeTYQP92PgK3Pcd1Zhrfj7nNXRQA0DxAC5oXq2f9z8fw/6xD4cBP+9g/DGU2qqE?= =?utf-8?q?dexntM19f+nOz2WcT4v9l5po3rf8H9br9Pt8zIir51ygb6K3xjbPDaoIDeWbJwctr?= =?utf-8?q?LxY/fELllvwlP/FFRcsREVYmS4o+a9Z8gDmUM0lP/ltdnlfxcIwUa4JIVHa+s/LK2?= =?utf-8?q?myEwK7QYzkgqHYZcc2vhYREy3i7/FjEsK2ePF+4SVotzoNl9b4KFpshlq6UR3uBsQ?= =?utf-8?q?EhqR/EG8vPTqeNgiWvqCF4LEY143t/2C/Cv54Lsy/NJas1DcY197uNucb4iBFDv3F?= =?utf-8?q?olDX78vWyJ/gaAOcd9dw6vaN0CiTGdJOe3AwT4rJHQz5ApmUawFT7EXMGLkioN8kO?= =?utf-8?q?eM0dYvg3k6Ug?= 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:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?kYOctL2qazr3jxbZjeFmPFWVAljM?= =?utf-8?q?soE0Z6d0yuDJ4nyfX4U8fk3eozIGEeMxq8akG9S0djXkFPRhZWs7DLo0vYxoHmxbJ?= =?utf-8?q?swAfvbMjfrgQMzJ8qxcYJMrnq009Q+P7q/z4dxaPCx4kDKc6eaYx6wJwX7OEJfzJo?= =?utf-8?q?30Gsa06wAMWVyu3ow2Acp5Lg5FtLrR2zytqoLZjxqokuyp24y+IXC+T2ARr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f-8?q?aSycgFQnwAEWfFzq6R3kuD0B3xgP5WvIarebGCm1xjdVHHjqbv7Kgis5llcgG3peo?= =?utf-8?q?KcBCqNAdFA4QGvdpbgD1B9WOWaMxtt5G0TOAHsslUAkAwq+kefecanjE5vaESudGw?= =?utf-8?q?8+heJ4rm2JxrocU2sNmWKqSREY9vBcWamLy8hz12geVEy+kerEG/42pV6tkU4olxg?= =?utf-8?q?fTT/fOLxGa7kJT1Q+Y+rolGeMHNBo0v0nIAOBENnDiC+d33XodkpmPC5Mg2NvVo2R?= =?utf-8?q?WpjHhkhqAOgqg6KBIIkcy30+ZTPWMvFGBoSqnnxBgJka5pQlKzSCmM/N6Gbw1zDtY?= =?utf-8?q?cdkhWgc+2OFYZnjGV7Jw/kSUlLeaAr1vjDDlqmf3P2tI72QZF/cygtVnDDnRKCsGI?= =?utf-8?q?wDEqhTkGvt2CLV1uyT5BN81zXQ9pO0woHZUock898W92qWNnVWunA0XU5l4Dp/FIj?= =?utf-8?q?lfXaq1YgR8rg?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19e2af5f-b5ba-4353-2f27-08dc8f0a98dd X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:18:05.7756 (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: TcQGik/0oNDC8zazY4KbcK01Tw0mraCBnbMElbrZU86Fsd1fYBixyg6LgD+6RyacYUIRUB+vKr9HYZoGUuSVRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 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 ab0ed7ab3007a..18c133f5a56fc 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -229,6 +230,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; @@ -808,6 +813,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); @@ -820,6 +826,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); @@ -955,6 +962,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");