From patchwork Tue Oct 29 16:36:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13855147 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2074.outbound.protection.outlook.com [40.107.20.74]) (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 BAA3B205AD5; Tue, 29 Oct 2024 16:37:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219842; cv=fail; b=Qg15utxid0od7I6GT7k7nLKcOKjnc5WzwuHvBV2NjRIrYaCd3dR0woC4dz1GbWUYe7uB4SauhTufAKDcc5HTAU45BSNs4n29nZpQOxL1giZj+IApB5KJZ3NUm0z+k2M9kgnuHep97B3Dj8Y1kDW7Xv9da/ll2PkKWft5FUOLfAE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730219842; c=relaxed/simple; bh=lrLx8Z8SxZT/oJjco5fJswD/ZWUdBilHEZbhlGAZNXk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=c7B7UHcMaB7zzwgxKOFUusjcSl2+8+72sGZFAx1JwyMNXMfFQwOuY8bbag9uwxd0iImQzsLCDvyo1aHRMePrgPcckdPuvVHFEi7rljuTZ6YnXrU+kVwkIlzW9iBSQ0qAj9srNUFRygutho0LJDclGBtzfpEzd1bX8fjcOWbLsck= 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=Vw8SfGzD; arc=fail smtp.client-ip=40.107.20.74 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="Vw8SfGzD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dpindFmvBhlBe0ioOH4j4fJVGyJtmGuJNJCRs8+goRnLLIYvumA9Ffcg7z/MwA1A3HANZZN2oi9UCJWif9X9H1Y+ZnumLIditKhbfETycwtu9r/ZKeC/lgJbfI0WAa6NC5N0AC+mL/UMHo+QU5qAXlAUTHxRI+eg9CymeUXgTv2yqjaVym5VqIU0a8o4NO73YknU32lUOzkVXYJVSQT7Rsm/yn7I4twecjSntZEecGeG3z3u0Z/uD/KwkMSjZLYtZ/zKhx0hWRfP3GokGKrA9kiI32MPZnkeIrAv5+75kzbM3ejtkhZzq3mqxSKfEQU9Zp956YbOom/SLFdmaDHk2A== 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=rH+/ieqErUrPjrX69gEMyYnDDWNyEiJyuGTkw/pz68o=; b=jwml2pKyRZFNm1kpLvLVSueLkm3j76A420rq+kNfrqnXJkXDpyg+PX1FDilEGz//L3ABZxNSKMHp9ZsH8VrzBBoM2JiyFsdEEX8NDiZuIl1W1MbuCMqk8Lx58kXrXi5zWlbzcLy4CnXdz2xqKwlT9mQ7nmiT/JdcQr6+jwY1FHBds2RDiOYmbJCBRaMNGkRArI33E0Ioe/jv5vtRBOYm4G4fllSoxzHU0VW4jNvkviiiGpRjohR+WWbnIESW2L9OsXC8nRI1j/UIerxQ4gBmEmyfBHjyBro7yKMcLY4JX3HB9C4eY9S4uqfQ7oEj6OBU5SR6iq74g8FNfOcoLyFdbg== 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=rH+/ieqErUrPjrX69gEMyYnDDWNyEiJyuGTkw/pz68o=; b=Vw8SfGzDGnK1O9XUvG7rqCMaq3A/VnueWFnX5f8xZMSatTxziRo6xhB4PwI/iEDElEWeJIbKS9iQqterOiTVWbOtKCxSa9w9U0krr4ypYMmI2CkSowEiezq5E1aRqWKf+H8vTG7RE+XFfqN0y35bESBpUPJnkNEoc5EDCopwO4ihknA6kn6GNJGxtbxkRTcjPW/LSFSwHybDsQ9BuKTIZ1CeGjF0wr/zHLoWDeYZnl7MZGHB9Vvfy7J1+7M9SeavyTpdNDuDiQAtybG2KwcPZgFD8TrYIxzzPkFt8Qoe8YwwMtWU37RxNhkPySDo6cA+w1QY6QBtUd3NXelHGKJRZw== 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 DBBPR04MB7577.eurprd04.prod.outlook.com (2603:10a6:10:206::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:37:17 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8093.027; Tue, 29 Oct 2024 16:37:17 +0000 From: Frank Li Date: Tue, 29 Oct 2024 12:36:39 -0400 Subject: [PATCH v7 6/7] PCI: imx6: Pass correct sub mode when calling phy_set_mode_ext() Message-Id: <20241029-pci_fixup_addr-v7-6-8310dc24fb7c@nxp.com> References: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> In-Reply-To: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1730219803; l=1266; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=lrLx8Z8SxZT/oJjco5fJswD/ZWUdBilHEZbhlGAZNXk=; b=c00KuuZdG71AFNsfjgrrDHH6bo9k8MvyBrdD4imApf+17/aizFO9WqyddXoQ2iQWZILpwQFCA SiNNMyuFH0YB0NOmr/OPdMziMPNgryYxb7vlJ+sTTaGZ1cmaPJbkZma X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7577:EE_ X-MS-Office365-Filtering-Correlation-Id: 2147560c-08a7-4bc3-da26-08dcf837f329 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|52116014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?4BKW75E2xG1f/MYjlwfngOXJRms4Eto?= =?utf-8?q?/Fa4ge6R5MKoBnKVtIf4ziS7mn9Ky253XKKKCJF4XTXWfQZhAAhb+Z7njyhovtMKt?= =?utf-8?q?B7HFN4g6A1cLh9M0ixLzuNGD1WsTIpX8eCDPsKVARZSiFexQ5Zg5B5qCLmgl5vzMT?= =?utf-8?q?11Pnx66evokKWIrBoftzqcdIymWba321p1G8neVPFHcZFT8n7WZZCFaMrltzVGMLB?= =?utf-8?q?e/FM84rgqAn1NVYYtiAL+48N5PyjUH1R0xgsYaBYM7EQdcLAruZCHzJYqV1ovPyE9?= =?utf-8?q?WHXW80Ocr+Dl96eaOKTfTHdMAqYrAjpiQoSDngMqLIwWHUEIuze0pqXPy76mCQWtW?= =?utf-8?q?rXMOw9zpTc8yUmsjlWL0H0LDpWWwT2b6UCDoRyEI6Z69keLfiNPAFhGfvMfyqqxmM?= =?utf-8?q?lsohdSb6OdW3PzJOo30h7YfePlNPHs7NZ0ormOGCyylVJnAHK62jIiybj0m+tS/qS?= =?utf-8?q?Zaex8DnZkfFYrs458g3A9G/lMtwHZMnoYO+/zHUTBi02exGdqzaa44VzlA20prkVZ?= =?utf-8?q?sZ/LFHF9395J9rGQeHAglsDjKPRbsrBOYNm0835csI9n7ozqiDLSPe0JNbZVPxUPR?= =?utf-8?q?vqMUzrHs67I+0QISzUlwPKx6VmwkxyHYWV8/A8eow2xY9G2oBUUd3sD3CT7lrRtC3?= =?utf-8?q?ry7MUt2gqsxVNHGIt+KvqhTqNT2JpCYIiY1v1A847r067WjvMhObRLSwSF6q8GKJp?= =?utf-8?q?S6bP8wfIhwtenMgTiWstpUleToGcMvBQCeha9nnuj2sIAt8pNdht17Ilu60L3oj0L?= =?utf-8?q?pW93Zx6M5+uxOr2ZnbJhbReLU+smYvAKRgLtUMKQ8afU2EPuYh8EYqnBFGqJ4eaNq?= =?utf-8?q?38oodmwNrRqrVyHFgkhZTTwNudN+geU4pCi0oOXJpD8b8wDP2yInzN0GNQ+UnL6sc?= =?utf-8?q?SJLgmbmgfKZEuYhlaYqKmBPgYKi0JNgQj2Rd4iRqQ23Nfm9yCJiWxV0sxZzNvnYau?= =?utf-8?q?mu2KPR2CTMj3l+MUq2P/J+g630FVvhwLmrCEK+jpkMvglhAgmJYwWEBd2JrahlFO9?= =?utf-8?q?uM1XE7+4yTEk1jUpIV/hfOFCO77GmEJEyfFqf+sSgRCWCu19v6FW5ImSLiuDwClLi?= =?utf-8?q?siGFI0IhLEQsIYOx6qAUeICRCtqA+KE6eaBxxSrAvIhUh3l2I4Fa4xRgwTf1u4jrs?= =?utf-8?q?BVe87cWQQzO8miqQmJ9Ev99OSBQA9pD/bwj5LUC5avGWlT5POeF7mIvt3IDnn0yj1?= =?utf-8?q?gwcpihmlvN3fkzTDDnmRH0Y992tMY2QIGPmKmUk91Fftmy2zTt7ySVIIAAr+zYfMU?= =?utf-8?q?HS3sv5nnnogZK2zNlvKWC3XP6rHUixMxuyBUmaP0Zjc0QdeBipPTDyXMmj7fA3fWk?= =?utf-8?q?Uct+LP3Aur9B?= 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:(13230040)(1800799024)(366016)(7416014)(52116014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?lC3Mr42UJQWxfrVuPfR3b531Ho/U?= =?utf-8?q?o2qsN+L8Ov5NjkCbbM8N9I5qYXPNE7HpQA2316keU+pwHy7uU8Wn46fQ/OULB/yKh?= =?utf-8?q?O36xvxkBCPiSIWJmRpVqY4UHkhgbwT2Qi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MvETqtMudJVznlJysc1SQAGovzFki++ejxE?= =?utf-8?q?3r/6SF/3XmpgxLXc20YLIiT2gRFEb3GXwif41gtRQi1fFQSRCqWPbEo5hbsE7hQft?= =?utf-8?q?ApB69VjjT0+bgYWg8hDF3Wd9T6SXSC++49K/O4zecoWGImwRvyG1hsxY1r16R+NfN?= =?utf-8?q?Vm8BW0NYDTJbFyIV38m+LBox2RWqSdgior0w33aAa6GIlDtIZRAe9WIAM09M9wYPk?= =?utf-8?q?RejAHbvoAxZH9ZJvJZ0Y5LgdWa9jn4d4HByYLKwAQdz65lcpiB9UfRNWYjbIJWIv7?= =?utf-8?q?WSiTdDvQD4dzTIDf/JtW38NrqKdjqWmZNGJ4tejRamAqElQOovV6eIwirZxvvwE/z?= =?utf-8?q?lLSdtOlSm/FH6peA1OXHfnE+U7uXAsDLpzvyKGTvtyQky6LKlDynBCrh6/Aj1LI2J?= =?utf-8?q?7IR1MfD4PbvpUbNqY28RJ7zz16qzNaD1KE3BVddUl5CeSev6Uy5/sNYDJJT8n7H/r?= =?utf-8?q?QfgVT15beHpyWJXTMbZfvTZ+s63WdY9jHnnjXSFt4DqRR7eKGpx31Iz/wgJJZWlXs?= =?utf-8?q?jye+LBmWCMHu?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2147560c-08a7-4bc3-da26-08dcf837f329 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:37:17.1292 (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: otaB2Zp4WQOoW+y9BqzNW3i79gnu3skGBNxiPKGXjh/zm0QS9B+aD1FitXE/6Im9l7ObNyFqL6jOH0toMYxrwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7577 Fix hardcoding to Root Complex (RC) mode by adding a drvdata mode check. Pass PHY_MODE_PCIE_EP if the PCI controller operates in Endpoint (EP) mode. Fixes: 8026f2d8e8a9 ("PCI: imx6: Call common PHY API to set mode, speed, and submode") Reviewed-by: Manivannan Sadhasivam Reviewed-by: Richard Zhu Signed-off-by: Frank Li --- Change from v3->v7 - none Change from v2->v3 - Add mani's review tag --- drivers/pci/controller/dwc/pci-imx6.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 533905b3942a1..8102a02a00b38 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -960,7 +960,9 @@ 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); + ret = phy_set_mode_ext(imx_pcie->phy, PHY_MODE_PCIE, + imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE ? + PHY_MODE_PCIE_EP : PHY_MODE_PCIE_RC); if (ret) { dev_err(dev, "unable to set PCIe PHY mode\n"); goto err_phy_exit;