From patchwork Mon Oct 21 20:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13844610 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2078.outbound.protection.outlook.com [40.107.22.78]) (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 610A81FB3D0 for ; Mon, 21 Oct 2024 20:08:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729541283; cv=fail; b=XJKFgxHG7y/W23blnqtg+imMFYMa2GdclkuW0aqAlpfoVklHN8Hvan4Bq8pg1VczPTtFao2hT0z2yhGuHhYJa01Ufnmt5RySeO6/1eZ5Q1+0lqCxQJmpqz9fSGm819y6T618uhRkNlfc+/qrp+XSVfm9V0OQIK5cuuPHJ8dLg0w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729541283; c=relaxed/simple; bh=GExlPE6INqJBVe829R4B7L+Abmx+hOxi51phEI8z7Gw=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=j8Y2YdN44GuJXnuz+KVRgNYmTmZEm92hovyPjreSgPGR7dxz2lWawAs7ZFn7sxFnwM0K3X85LcEWrnLjv/8okM6FhO3Q2k7xlO5Hf4imPljhmquPhORTLtZpbOFwoAf41ptXhrClUKLT5tO9Q5kaffoApXxbAAhpZF0l93giLe4= 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=ZwmyqVqe; arc=fail smtp.client-ip=40.107.22.78 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="ZwmyqVqe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mWgbOVLkoy/f/kgr0RKQdmQsJ2p+vJqraVRPP9bySc67bhLqQv154lXZhrQUSFS0YLMzdAC1iVnaqRPJcBHeQ/40dWZGWXT/+Y2pCWSI3v3hhGycL/LraZU1BpYWbrhIfhU61l1mQ1yR+L/DkKDsvIjTB007avrt/Bs+F6mg4cB9WtyqVAr3dfNCrpP0RlNNOrkatXkpoA+qKYQjACpwfe806jOOwFMbCxmCkN7/+oLzWWvx2tiCRZhQN1lMCwxsG6lMCDuiDVsKRfonuBwj7qaHuQQ0n6N6kI/dLF4XRN1VSR7xGOxPAz8yF2SwzrQNtHz/f2dkQREO6nIHFEBKIw== 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=84RI+077QT0IyR3qvihpandZLg8yhI+5Vnaa39qgDFs=; b=sdbjTRUkPYmfpJIhZQX4RB7W+cSVYjDvcbTUOD4AAJpsNjEmvGUnKeP3fr6gmXeOfI95asOOGrq83fuvshLjaPa0ezJuQeCLzfPIJ83a3qlnR8idvQn84kLVo00J4LZq/ZVNzbYHqtDwmZIb3Yw9mFTLkTfcvZGZCj2OQ46T966gaDjJ9n0eeiYJ7esZsPltQQMGF1lPBp9+u6GxK24UrisxCObLm7adChQx3bkgywOdXtlJiOaioa1LfQ7MUkGVhr2hkCguMgTtgkyBFqutZR71Y2aCba0dF1kKBivhsi0c0OJMZhqKMWXKzqd4YUVYoKox+r594hzgTx0MeioY2A== 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=84RI+077QT0IyR3qvihpandZLg8yhI+5Vnaa39qgDFs=; b=ZwmyqVqefz3bZ8qe9DeHzcm0bmaakQDx9s8G32hIkyB7WR/YxLVedea7+e1eiKuk1PeODkpztBGpgN9Bat55BCgdtAO/Y3/+BwX8fkKUdVkDInxoKX9TZBaRcRZJ4Mg/PdhqqwoW7e/l9o3XIYDCxIlEzcSuoq3aOkkjo69LPWjE5ec07z172i92/tWmEg73FZMGxGtsMBSq5zfYlaphpRyWBeo5r0/5MmemdCmhyxh083vJXkUgT6PbaLcRXuGCWXLjbRbMvf4lSnIgWyImg6Gp0j7l5vxsKqKi0KiFIQk1vrGAkCM+7AT0ln/gxnJHt12GyYLP/duNjRfXJurGaQ== 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 AM0PR04MB6882.eurprd04.prod.outlook.com (2603:10a6:208:184::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 20:08:00 +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.8069.024; Mon, 21 Oct 2024 20:08:00 +0000 From: Frank Li Date: Mon, 21 Oct 2024 16:07:38 -0400 Subject: [PATCH v3 3/4] PCI: imx6: Pass correct sub mode when calling phy_set_mode_ext() Message-Id: <20241021-pcie_ep_range-v3-3-b13526eb0089@nxp.com> References: <20241021-pcie_ep_range-v3-0-b13526eb0089@nxp.com> In-Reply-To: <20241021-pcie_ep_range-v3-0-b13526eb0089@nxp.com> To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Abraham I , Saravana Kannan , Jingoo Han , Gustavo Pimentel , Jesper Nilsson , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@axis.com, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, =?utf-8?q?Krzys?= =?utf-8?q?ztof_Wilczy=C5=84ski?= , Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1729541264; l=1188; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=GExlPE6INqJBVe829R4B7L+Abmx+hOxi51phEI8z7Gw=; b=crDAQDQKZ6D3k6ZY8OmJpO6GsDeZURRgb44H6Y+TiYfG5JjD1HlvPlMq4EtNrY0vyWr2XuS61 UIBDmoTEAEnAiJtBuLMQYUZ67vF/1JGUdEf17KLb+AW11lQiUi12n+u X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR13CA0071.namprd13.prod.outlook.com (2603:10b6:806:23::16) 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_|AM0PR04MB6882:EE_ X-MS-Office365-Filtering-Correlation-Id: 180c6b20-4386-4c34-0650-08dcf20c0ff5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|52116014|376014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?laxBgzPmHUZFmEyv2Wa0zT8T2sSByYx?= =?utf-8?q?laZDjc/6kCkMvCdJBbVpfs0toVUmDwWPCrnKzN/59fCMiSe3LdpJXYyMHlIOkaZ+Z?= =?utf-8?q?z1Yt3bosWEkAVpt4LMLBzdcaXe+wzEy2qKu60ALQq5So3brO4kf9w4umaOl4DW0o4?= =?utf-8?q?WL9WNn+wROCMyk3mZkrSTG8Kn5ChQksgBfaIGV6XczcmT4b3IJeHnZzJZPU0MIzfL?= =?utf-8?q?hTzYYlTRkBQzypPWHGit+IW0i3FywVW792t7URUsM531pe5kbXZmkOY5JQYzoCCMr?= =?utf-8?q?DswCuiWGGTaL2ENidZ9GT5bNl8yhnewpgGpB564fs6bjmlslPJSkw0d6W00iIOcUJ?= =?utf-8?q?9Ip/g1LSKPowtq1TAeKdejv00uzn55A49CmlO/9J4EiaD/fq841CeUtyBov1sQC5Q?= =?utf-8?q?1bz+/h4HKewxW826aKB3UgQLyUFWgjrBQ4v2nskMI/sTPeHe+34CSdRKbH5Z8qxM8?= =?utf-8?q?J2WArncMKJNWT9iURRa7AZrst7e2UeM1YGNaHViklXUSeZBmDagi+VzcGK6lN5+Tr?= =?utf-8?q?0+GnTNnwpTnvOhqBcwYD7Rur7UIKQPnoliRUMh3uGCveY7FUq3NDP0+fzG05p8FSZ?= =?utf-8?q?FWl/YrrU8BZ7mxa9UKTA1PLjd40udFD9d4wK4QU7joPsQWMshW11Nbyv6AmRDWojq?= =?utf-8?q?dg15/5+SSBqAYe4Dh4/h/DW1xPhAH8/yBm/jh5eS7xS2bZ8IRwE6Rz56qwjZFSrTm?= =?utf-8?q?ozOrF7xnRM/Nb49aBcKvP45CUemjoXycSf2kIFvwbrRW/MSO9UkxgoaFqf5//trOi?= =?utf-8?q?GIrHjkEfQ6iF/shxEQnunGFgulJqjIclY0JR2IpV7VSiZpCEEnW8uDTOjVlY/VXVK?= =?utf-8?q?CqoSM6u0Es14Cx1+l7jT3HXcPN79RMC/2xOHMQyCrCUM3ICluDV+TWE4npzKhef3V?= =?utf-8?q?qvf1hpSISJyjDGWJ6XAVXf6divWkrYSLN9zllLBTkiojVVzsULqUfFd1WQIB1Ztok?= =?utf-8?q?CzUCQ84Jx5EvYjQLYTylzcG0zPS2rOLRIOYVW9szaG6JTrL9SjUXn5tu8ovnLskR3?= =?utf-8?q?DxjYYbvOP4EW6jk0SP3/GB5Bl21+ngWJLoPo4P+DlC0KWhsxK/ymLyPfEUeRY6BNe?= =?utf-8?q?ttkSMYW8sH0/lH/zpiICxjNAWCWjkeWPTFkNlbBX4y4DnWtsX17V2VDehOcmHPiWd?= =?utf-8?q?V1ogNqWYcEqlMB36JrDu4FmnleTVSHVNU1mAK1ls2K4la/J7VRAHR00vaIXLUcjQb?= =?utf-8?q?8vf1DlKCJTJ/GlwN0Jc1aDEHQA8xqMr/rqKSXBAjVsce8uSCjpmY9kyRaEj1EBr6n?= =?utf-8?q?0gAuDUfWds3N3CED5BPKvuo5YAxb8P/xlsYi+16QM6575rmTqxA0ktj1NhCBT2cEQ?= =?utf-8?q?gG1qVsnkG9Xn?= 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)(366016)(7416014)(52116014)(376014)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?f5025aomZRjvFNsO70RkzC9Vg0mG?= =?utf-8?q?zncthjS/GOmwncePmh1NZbniil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ZuBhidLn3qrmyTxw1gCoFI7yd6elAfU10POG+R3+ilS63SDuTz?= =?utf-8?q?DBPdF+NTOOc9Pb5XjrcXp4EbljpbeJPuKB0rOSKMBcaDSDlKXIhtGbfVeXvrcxv0q?= =?utf-8?q?1Y9wfA36eckjc+CJeyewRCQ6U/JDSxcSFkaefheQfyJlobevQRv36LQYn6/wb2+QN?= =?utf-8?q?BXgc2UrnAHNATlF+y6kpUkCPwJL3Twv8HUhRn29eENN1b7FHg97zZkU0InrY9oBI0?= =?utf-8?q?wnSc9iojws2zXOUHevvu/mAO4qcr6dXiLb0Z7aftpOmtz6m+x9qyOGOMDf7Zp7yCk?= =?utf-8?q?Nt44e9FNOjODilan/U72DTBNK1DBx0dKa0p5fNyCjXG3T+jcwlMRE5LBHRUmm87nU?= =?utf-8?q?iEm3X5o3AloEniSfr0cFmegwENb9Tql8DWqn2WGQS3NdfmuNwKd08c+Ey/bIiLRJT?= =?utf-8?q?26dCirfVvKv3mzFwFpp99TvSrXIigkoQcdMAM01DTztkdGmCbiep7SfoK+RBVrPsT?= =?utf-8?q?Fjls3fR2MqjLbIkRD6iMxLseRcXpTIPFpMqwoIbyycRBwkG2ySEaIc6jpM0s9KFck?= =?utf-8?q?dTtnvEnTxTgH7Ya1lYKE6O0qK4mwH99GLRr4PgzhbitkmbDvtYtCXa8d4YEAdFPb3?= =?utf-8?q?VqbTNQzCW4HW?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 180c6b20-4386-4c34-0650-08dcf20c0ff5 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 20:08:00.1852 (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: rO2KiRTjn5iEQitW6B8fNzTMpVvUs9Mx2lC2WKhhhWLEjYlGJXBmJMEkdjhw7k6ZKlhzrie8ImqCPEGdkCm+Qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6882 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 --- 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 808d1f1054173..bdc2b372e6c13 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -961,7 +961,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;