From patchwork Tue May 7 18:45:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13657603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F532C10F1A for ; Tue, 7 May 2024 18:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+ImT4vB7F+vNnfbcb6Em8G16vIcypnI70jR3qZy+IzU=; b=HidZX9RbSQ67mskUPDHxlTKIkf H0Ue6lcvaPTf6715O9QKqb1vruOV+wrko7RUC0m9O2uGjChSiPwOn6lgviH/cgs9x0QgOHWyiTGmB iHtsG0t2spkKbRBz/c7pZzEO1PkzP2+VelJjUpzH6YLDMmhpRASg0baBt7oGCjI6rEYJGpyXqg7Zh UGC67gzGz7NS9TiRoBw74EzJxYmRZGPICSti2V3YQSoXevHMXpODi892+voRbC22YRbCwfBwG2PxK H0Aa75o2PI+d+AWRpu27cnnWuE/X2v8nuAtB2NN2DS7pPt3LLPNmTJKyU5CDLiFYR2nhwLb8O1cxy G7Xz/D/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Pr4-0000000CQNx-3exL; Tue, 07 May 2024 18:47:58 +0000 Received: from mail-he1eur01on0626.outbound.protection.outlook.com ([2a01:111:f400:fe1e::626] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Pqm-0000000CPkC-3ABV for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2024 18:47:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BVC0slsCU7m6rwCaqyU0zemLyqnpdMNp4/iBP1A0gATqMJ1S/lok8CgSg/V/C78FNhHI8JZmSa8tJ4S3fX6L1mer3lx24/ZrpnWzNr2NTvqRfusiAQQCLt+puocB4OJ/1Xd4eiDXAj2kKYivPI56CtMD5QSwoOJsIMWZ3Bmxt12AbLWIt/Bi5ptzvJXTum0Rxg6xVFXO30zUmj8N+w38Im9WegGGgKT25AO8akFGhnPXMmyx8NHxsflfOZA8FP5zzK7ZGX5vVTILiJ2zm0ybv66Um5TiXCgko87QcMyRJCXoRfDt1rSM682gF1YnJGz5fbSyh2dpleYS+6Fm/WUO1g== 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=3gTTDoBfA/yf91PPA7MqT/q+r+bNwi1FVYdnjZCH/pM=; b=AY2iTw9Rt+1nZPoVfXCpaRXzhL+ij8CHgco5qb7EqRaCAG3mT86wFxS1C2y+yqEwvJaOUvmx17q/8JVp0pmWVxsygSqGsC7TBHMUW77nhXg3lq5ePgFpltsQ2nZKd6dqvBuE27cMGT6c9GdmcH5VDBsLrJWt3nJmiFZN9NoaTR9sgxhD3EDq/dCsiJ+hdWWY1NSg9MOv6O93foeVRqnXtqxJfzxXZywcmTFImsip/D9TU6YXY6BJz+fFFnpFng+BeCOb2htK6Kn1TzH3Y1sWvKdVduDhpaWsIRavXLfFg9NCMLfhBOiRZJIRn0kkeWjkpCJjdSeQbXTR4hegnYDlww== 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=3gTTDoBfA/yf91PPA7MqT/q+r+bNwi1FVYdnjZCH/pM=; b=pj48bWJx3lGiBnoAHuTDveo/2hVXXWvQXRKRg8ZhyodlObgQiMLuQ9dTCJ0NQXPRhPXICQbejmbCAg8o7Q3EWryvI40z7FpRgu0QKlYLJioMsNY/ZSeGeMkGuHu1lcBThziwXGc4iAe+p7WtSRV+958TekhI9LpCN2H9bURyPgM= 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 DU0PR04MB9636.eurprd04.prod.outlook.com (2603:10a6:10:320::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Tue, 7 May 2024 18:47:22 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::1e67:dfc9:d0c1:fe58]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::1e67:dfc9:d0c1:fe58%7]) with mapi id 15.20.7544.041; Tue, 7 May 2024 18:47:22 +0000 From: Frank Li Date: Tue, 07 May 2024 14:45:49 -0400 Subject: [PATCH v4 11/12] PCI: imx6: Call: Common PHY API to set mode, speed, and submode Message-Id: <20240507-pci2_upstream-v4-11-e8c80d874057@nxp.com> References: <20240507-pci2_upstream-v4-0-e8c80d874057@nxp.com> In-Reply-To: <20240507-pci2_upstream-v4-0-e8c80d874057@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=1715107574; l=2344; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=rRm5SujhEiX9hVYVjrxBprduIqi9bHP431kr+qPwfZU=; b=WnHtWsp2PCQ89Q1ObmF3XJCsbhZXA9pISVqfFPDcdZvNNlXxL+QnVzS9Awh0VaZGnDJc4pQFV LpJsjSeWcV8AYCsOyL7PfeeZ2dJyupXyMN5LEntzJxC+NB0RcLE+lhY X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0026.namprd17.prod.outlook.com (2603:10b6:a03:1b8::39) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU0PR04MB9636:EE_ X-MS-Office365-Filtering-Correlation-Id: 577e8acb-a1d5-4427-4e5e-08dc6ec62161 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|7416005|52116005|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?gpFbGQ0Q8Bu2KdG4H8gQ6Lc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?Q26zoX5tHZT2M6QH+QIIXIOgUo2kpRGTmMWkaV6ARJZqVuK6IMctc6udoZigh/KW1?= =?utf-8?q?gqYFpHNuvScnM3cx9y6xSyaCkn2qDv0wERBGtWIyUgC0pNMtkDgWlR/ICp7FYl5eI?= =?utf-8?q?R0is+6xm/sbSkgRAPatOtgIz192UuLJVGIcWEKakRNG6HugAEGmPLYdFvT/TxtJ4S?= =?utf-8?q?HO/Qpa1aVQa/nmyBL25FsW4sX3P8//77eAGOuG33Q5DSaFqwWSyEAtiy3BK/MFzSW?= =?utf-8?q?1HCHR3KGYrSymgMJwPEknDZhiLjJLkmTeOoxQAblaOnJ0J88EcUJfNkinW1mApHav?= =?utf-8?q?+YBcAMb9WXSPiRBSpBEDvizlVVgfHZb39ApzPJ+aV90ywDqAaLnoYZEkVz8Y1KNG4?= =?utf-8?q?08cLo92bDZJYDjGigmK+vCZ4EclE0+r+0aNCD7nMV6kpUmSh4B9pDLSk=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)(1800799015)(376005)(7416005)(52116005)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?R+vQTVb7HgUpIXIhMmRRmtR7mStM?= =?utf-8?q?a/2rWRiAyvN5sXiLTWS2CThtPO1g3Yjqd+IMeB1iTK4x8AFTWL7Bbf6+cA0g+mcap?= =?utf-8?q?3GC/3c4VxmEbuCgiKTvFWbPTShnfxqzxgit5cdXhxGtAB0PartM8EZecxIBl6G8MC?= =?utf-8?q?uY3RRw6/oEK67N8cMim+h1Jg+yg/UgbV4B1y3UUgKf/5f10bW+XFlZpoBRylrKY5f?= =?utf-8?q?ORii49fpcg51CtSPF3G7HEuNul09L7x//cajE6DOPQjZJl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oj5s4LMvSRwNxLxShTuAAyM6gNWT?= =?utf-8?q?BYxb5av2rdCIzpFw0Igs0bLqIj/NdOYqw94DCZJbnZMPxJToqpv/GiLXq1IKd/cmm?= =?utf-8?q?bhPu/jL2M5UW1heNRfvCYPglB3moDUlO81eu9AVmH9VLmTsP2oWUcY0SM/xORWi4U?= =?utf-8?q?oW3iz8O0xE3TzuPBRwiE+YRNQYUlf0wsQ4pIF38wI5uN1iNNRhxJxiuKF1eitzvAR?= =?utf-8?q?Iqpt8lVGNBXocGTbTL3BdQuHBTLvnUgIHqVsEBcS+REiWvS3TrmP4Z3DYKCiYBWHD?= =?utf-8?q?raT++WrODjNBLfr3mUGJVzdr0B8e5U15h1xLcO+jiU6aQc0XMwEAlvO3tfxWyKGhj?= =?utf-8?q?PRXQR08SF/f1Et+ou7BHceddu3F0tABAcJBNoYO9vaMWNV9HVYsut6AQfuVyj9HMW?= =?utf-8?q?xwjwCZzJ9Xj5?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 577e8acb-a1d5-4427-4e5e-08dc6ec62161 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 18:47:22.3242 (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: nvrNUWcSTYaHBRMGb/2tH2Oe3m8IcLfb1K1D352gy2T62g3yZIPHSLBCLJfG77LzK/rhBQvymM9HjEJa/MGoyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9636 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240507_114741_254501_DF997D02 X-CRM114-Status: GOOD ( 14.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 9d53b545540c6..df623977d8fe6 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 @@ -308,6 +309,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; @@ -887,6 +892,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); @@ -899,6 +905,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); @@ -1034,6 +1041,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");