From patchwork Tue Nov 19 19:44: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: 13880491 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2079.outbound.protection.outlook.com [40.107.22.79]) (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 D01711D6194 for ; Tue, 19 Nov 2024 19:45:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732045509; cv=fail; b=pxVrlqOy0cL4ajB6jv1oUYWwcaxn9F+jsVgQI/S/lZ1O1MOnnxz7/lcXv2wHVg1lE/MBW6bOHywbXi7fnA0V+6bjgwFIE1uDEMF7p0nzDG19Uy6CnI+q+nTg5P1A9UPSMgf3UhhPdM1dq4/EBOLKa0vnzxmHjhBq7i2Cfpzxm1U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732045509; c=relaxed/simple; bh=I1xS6x/bVgth6uCt4K17fnxBjFtfeZ9wcN/vlP80bSs=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=FReRVLzA4R7AgNV3nyltF81OOAeguUFkRArbCVCH3GyJUfIyq7BdL2WP2MfC3M4ZAyb2tCcyjmTSANqCFogbcJtb794FYCFFmBPhxo+DbYScn50h7E9UoOoAOWnzYBBTTTgieohMHVupmroof8vTAHWUvhC+HRVOPL1aGIS69Sw= 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=FxGHMjg5; arc=fail smtp.client-ip=40.107.22.79 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="FxGHMjg5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RhZiQcpeQzQs1p9cAthpkGgw4seZ01YkUNc/1ZTOFettsOmPI5sWlVPhVf+bSQ+/h8zSePRNVmtsvPjyU+U18bDaxl/FUoDAWKw7X8M1iMmfWd7V+9SbRYnvx0G0dAu3CQ0HNX8ABOEgFQ15NXmblhMgJW6+IvlqRDnm5KyZHGLzqK3ivyYrzY6+GGR21nAb0EyJ4vKyGEPl0aBpMe0rJqWrEPMITE8qE5JNV+M9acFTQPm1yigEMwn2f2uDV8spUczmREnJLQLHrl2zVz0RQqZNgnCV53PDK07DvBaLTB6k7kW58bcyl7sHJ31zvaNmRJRzZbuAHhJcHCtQPw4FFA== 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=ayvkn6j5ctMor6f5EgGeTcwZhVoL9kYC9Om0+bxxxyY=; b=teuODFJ1GCYdO7Zp6yybrrpR5hUTCLM2KlcYY77sN3deLpOYZvb0TRpFobo9RWBvsUUQj3FQfc84KCLIW/qt0rUzZsK9AKPct/yw8wmRNEmjwXxUEG4yQRTJCoQcbWOBdvNwimM1TDDxqZwBGfLqoYuo510jIXfFTSbNtQp2N958T/hmXRZphHehDLdqHSIu81XiciSfbRTODatDfpVq/3dWrBEnd9Es0co1ghmx/xI/CDEc60WsuE54sqCdtn+pJVINtN7baI1qJEHqrQoMFk9VpSUgsKaKxtQ9GNyBQU3yDFYmj9RaU6o2GdM+IM27eUVOF2RO91v7VbV5j88Okw== 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=ayvkn6j5ctMor6f5EgGeTcwZhVoL9kYC9Om0+bxxxyY=; b=FxGHMjg5kA/qrGfXCAKc1XNJ1yl867ATuns5FtCzzToORztWt0ugonCGpjPrjclGo/hdtirDTynhAf4eZK3sA8lFf2CwfdGPAI+aq3N9tJrFX0aHBbAAY17cP5i+KjpeMhHC0iRbfer7JzO0JOZUKuFPTkGcwkFBZHEC95rr8st8UcHwYvuvQ2T1DhfcJmuprtcO+iwX7sg25Zrnce2Ndbsf8uV/jvZnGOsgd3fTs8s+o/3O0UrwRoQyHqwiAK4H6GI0b2Gqpi2inwKGwv9z7TgnOmrSc5mxu3GXwtXZ1XD1vFDS2IylEJ6DhG6dz+WJ+AhKqyyiIy0UoFAR9UgO8A== 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 GVXPR04MB11068.eurprd04.prod.outlook.com (2603:10a6:150:215::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Tue, 19 Nov 2024 19:45:04 +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.8158.021; Tue, 19 Nov 2024 19:45:04 +0000 From: Frank Li Date: Tue, 19 Nov 2024 14:44:24 -0500 Subject: [PATCH v8 6/7] PCI: imx6: Pass correct sub mode when calling phy_set_mode_ext() Message-Id: <20241119-pci_fixup_addr-v8-6-c4bfa5193288@nxp.com> References: <20241119-pci_fixup_addr-v8-0-c4bfa5193288@nxp.com> In-Reply-To: <20241119-pci_fixup_addr-v8-0-c4bfa5193288@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=1732045469; l=1266; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=I1xS6x/bVgth6uCt4K17fnxBjFtfeZ9wcN/vlP80bSs=; b=tM6zs543BtrgjN+85Ni4hJ2pKwjs7eBwgMkk2DbgBE1oEAHzhCwHvhLAwLFVdTcqgDQe2qwb3 8xYSXCRa+xuB9yGDIQJoUsUZiD4KiTkVuFOsSBOLJDW02QUIYO24EYF X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:33b::14) 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_|GVXPR04MB11068:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ed88dad-ec27-40a7-6370-08dd08d2aa13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?5ofp6/CvtRqa3CoVIULHWMPAxLxMnmi?= =?utf-8?q?bJvQJvfR/KpU1OJHIy0lwCaxDDkCWaGB1oUGV991/rLCQeRCRLxSCmpIyO/YNNuR+?= =?utf-8?q?eGEoul6SximNiXfLw7xHK/z8jxAj7KB+5RlhW6gRrMyZm6onLxPunwzck/DReV6LH?= =?utf-8?q?lg8x0T14zH2ZjYaXje405qRxm7xdwI9gjcgQd5a9A06jOrfcJF5uo0stcmadESlZ9?= =?utf-8?q?gKRHQ5r24Q/uAvC4TDnJrOtByU5C0+VkCylYSP4Emx/e4Yoc8y81BTvU5DJcHhUPl?= =?utf-8?q?AuGOcQ/OvO+jfnFdV4Zig9ymSA4N41YUtBrt7ubKr/nY6No/agN0Nh+/B14hv+vx8?= =?utf-8?q?tBuObkaeEhm1HJ3/KVcDjU9jrCzVvmcvj3lmlrQGR6Qn6j/O2Pa0qFcL8O7emPyCY?= =?utf-8?q?7VgQunYhPKWnBsh/C10ZlMN52HAGpyfSnnWi3edf3SyKR8Kjeq+AhICLmRdywMVE1?= =?utf-8?q?MguFapruN5O1QZ3KsBVZfQXqPcPhO5bSPvOjbA9oG+u7jZe8KfwOziwibZxtx0KgA?= =?utf-8?q?L9lZQ5ksK5LkEnsh9UWekl+q1sEL9JCUl3L3in25ENsWWWKbc/zjiYZIJW9ibviRd?= =?utf-8?q?cdGSXb+dF1ppMFVsla5bW54NqfBJHdfDidfs9tUEmFLhLGuC8fLq/ie9ZzHG1BAJg?= =?utf-8?q?gFaPm/z34anJMnW/Y9AJAUY/iyK7VHGl5ipNGNYO2axau0yPtnF7BxbE5qohwT5OC?= =?utf-8?q?brbXzfqXaTz66OjFeKkLkKk9TgWyItq4yr5qAz+zrNWtIdfbzs+yvNVkmz8rsWIUF?= =?utf-8?q?hZZFe6zAkb40TlycU4nPRWkjrx5VeHcbNvc0P702gUFpWQu/gKy6QrKVCbyWYiuIG?= =?utf-8?q?t5y/4es7n7LMiBZ+ggyvA3HeWmARwkjHUL2+4EK4RaMwxd3l53lrJY3Ng5ta3IIMu?= =?utf-8?q?YGzRmMJQVkfqFyaCZUuuXHiatG9UF2HvlcDPRs4+Y9Q7ejtuX5cbS8cpJEyDAvUKr?= =?utf-8?q?Z9IvnkfIKR+xs2tIunuy3cn7qq6r9+gJ1eTJ1+mJhA/SR++kEj+oyjWC54asjLNS/?= =?utf-8?q?i+jGSMe38HDIq7F/EGY/09hu5c9Acpi+M4iDFTuXLFlYYH5B+Q4cVemPT2lbsfS2E?= =?utf-8?q?VQhOGqrXLSVQvu+UleszzpTfUYDTZLhG5pedwSS9dev5PPIP1kBEHuPxt6ATHmVlW?= =?utf-8?q?cbU3HFPra3FBsdSOVp5e1ZW4uPZCrsAsGcExL6SRyh3nPCMhKFPcjQa5u3Lk0MS+C?= =?utf-8?q?hyoNnPttv5yJev1C09ECMKDE03+hjR4jfVg1H67tv80HUfkoZkxjMSjgO3L9ruLRC?= =?utf-8?q?JncH9ZN0oRZpxbLYrkz7emRq/we7v+hPg584uMSxq8zYAXhm+RKwqxfjIt7wuE5pw?= =?utf-8?q?3GiZ3A4igvS2?= 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)(52116014)(376014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pk79SGafiOIoJnrzxFXCexE9qIgF?= =?utf-8?q?wCySqxRIegSXZnUNHOC5HuxmMdEIpTWvBZB3zkENE18QSWqlgSFAO6/yRD9jvI173?= =?utf-8?q?+CQMVocbADpKZuJoHU/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OieAgIjn2aR5Z55ckrNPCsIXAZIxkDZzt8/pB4M7+u?= =?utf-8?q?aZMGRGf8syd7TyrNlnTWQ0ymMlHl4YJB5wfe0iSp99D7so4WmTRUN3YJWYl3P48em?= =?utf-8?q?HXob18Wdj9E5FeFkgTfS6pIW7/95iICJCVnPuNQ1aqWoixqCo1FvvuCAFnp45sGNo?= =?utf-8?q?zhBapjQf1QcQwBVxzvPC6mexHQy6O7G03IOe5IGAWsQrFDsKHgb2h256zXBCPMYio?= =?utf-8?q?L3Wg9nihR5XzvdFDREqVV8+nOiijRpZTQtR1IBfgGSAERHGrpH+M19Q5iEPB48AuD?= =?utf-8?q?6n1pTDWUyMT4AUsHiauo6hGsEUpH6/aCknsh++XZ74P6GY7AAJDC0iuKsFQqVSX4A?= =?utf-8?q?cTMSpW0bRPbHkmXBDpwteYBSmHwE9XOqyYeYdPD+ptxww+K69VODhGoxdekidBWOb?= =?utf-8?q?5S4oKCXw8NqPVkleTzJtAVNKs5Rp2w53fIXBS/rRNw1tVmj6J3ZnM1GSheL27V9Rm?= =?utf-8?q?KDsLuaMbIDgWyI2nWqkoWj6KsAa9zJsqmPIah/WQzX4OtUZgyNawHY4niso+Rji2y?= =?utf-8?q?I3dkrhJfOS72?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ed88dad-ec27-40a7-6370-08dd08d2aa13 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2024 19:45:04.7260 (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: AQh1LdT33bwMeG+oRapj3Qd7ecwb2EOYLWRnHTlSPHL2KKgLdpqix2VQRTfC8NUaWRRkye1ISzoc/uBz5B2ruQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB11068 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->v8 - 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 cf033e672dbde..5303dfc3dbb41 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;