From patchwork Thu Oct 24 20:41: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: 13849694 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2079.outbound.protection.outlook.com [40.107.105.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 3BAC421730B; Thu, 24 Oct 2024 20:42:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729802555; cv=fail; b=mHsuKAXN5yfau8tIg9OiiXd2WbBiHS2mhiViznzh5QQXALKdYKJyirHhwuwR2eb4ouXpVu9Ft0PA3R7ANdNnO81+bVRHUN63VACmMhKXyADJGUvVQoglYB+n79g5LgXV5nxLU6MtUqcI1WpxiCzDWo0pTNNofFbTb9YcXTdXlKA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729802555; c=relaxed/simple; bh=pa21YroKN1Hep2b0+6lkuwO0n6eajEDfXOfgCIbz374=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=tp+HLB71lt1ADAJxK3MVVaVcljyC56wkqJylQO8mLSykm4WXiO2s2xVSbt8uqUxv4bm9nE0H1UJyIE94dN38vKIjiCpPjxCA8wIZ3CDi1qTWwRbkGLseJUhbWECvuyaAs8WoOHLGK3gnyXl0xZRukVcLdV5IARyiScYGjaybgyg= 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=m28Z4gIq; arc=fail smtp.client-ip=40.107.105.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="m28Z4gIq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yRAf66y8yVdTkJ5VLjm2JfKLA5t+koxWWYubaBi5k976xZMJv1VJbhaS5rRHyXO3AR/VIitYrXHRNScMa6GHeepORchyLY+MOPypP8w11HNKRiCFJJwXp40oDukx8r5HtdGxRjIP3Xs1nL1XuS7flPb4Jd6Uhx2THKMLr0rWDIYjtJqtX+bnCxOpTsoNz6Juoe3RqAJJoQ+aavdcHgqpFtbcAXWha5JCm+fjpLX9qvq5cZAQfY4Igf5eqyaArhmoau9RVB1mvaSN/e5vLAsEbf4mWCg4gJI4IxKSAZzETbfWhY+93jfM7eBZlhTSQM6MUGGUtzPVRAlumktFge/gKA== 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=xag/w1g9a9ktecMSESDiXVwOlvIRngpJp5VTemD6Bv8=; b=ZkNPmeNNvO13x/CQXqPMmz19S92m9cxX6Zsamu+fRZ8SMLbCG9c0GqzFqmrVB6wVjJm3QMX6CzBrth4pMAlaG3AHE4JS0ZSJTO3EcyV1kFoNoxJmnWw0+SlqTlg9A34uF9r+5Wrg6vmRtzmF1wCqgKwTmi3JOseaGWjo3aHvjRBYqf7vf0NUa1bSHx0A+qwjvNQLer5CPRJMMRffGXAdIWkP+TrSHbnaz0AfYU7VNsAwM9YOQWgBApjE9XO8reGgt1oBzZYRnVHjehJSNDX6mAyBAwddbTw5F794ViCYFw84Or5YMr9wP6mRLWI82tTtyfox3meJq0X7iQX8N3hfDQ== 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=xag/w1g9a9ktecMSESDiXVwOlvIRngpJp5VTemD6Bv8=; b=m28Z4gIqjPsSD0KRqb/snBgSPaZLxtqKDjSJuDi8HD8NEUsU5pQ2ErqK9bASy1vHggI5b7uQDsfGHqXojGh/gf54svbNqfOY8uSQG13JPKp+Xye9FbVZ0pC/1/cK9K+24z4DJC2UFRBmu5XD4JEeaWqM/9WJKM9OxX8Uq45xu1WuZfEiVWagqsymWmDVrm0qTWgkDL9N3Ul/Qo1CatdHbQerfsAd6TEm0R/yBFzwhXaDRgeVGKeV9dofBOv5MWbfZsFQc+9BR/0G+6UeJkCkB1B3uP4fcdPczHaoNGxkPdExESXgTeguZQj8UaDhkyvX4lqTwnLSU6wnIUsqOwl9bw== 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 PA4PR04MB7517.eurprd04.prod.outlook.com (2603:10a6:102:e0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.21; Thu, 24 Oct 2024 20:42:29 +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; Thu, 24 Oct 2024 20:42:29 +0000 From: Frank Li Date: Thu, 24 Oct 2024 16:41:45 -0400 Subject: [PATCH v4 3/4] PCI: imx6: Pass correct sub mode when calling phy_set_mode_ext() Message-Id: <20241024-pcie_ep_range-v4-3-08f8dcd4e481@nxp.com> References: <20241024-pcie_ep_range-v4-0-08f8dcd4e481@nxp.com> In-Reply-To: <20241024-pcie_ep_range-v4-0-08f8dcd4e481@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=1729802524; l=1266; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=pa21YroKN1Hep2b0+6lkuwO0n6eajEDfXOfgCIbz374=; b=TMYO6I8IT2cnF3WLAyfp8t7Qbi6JBVX4CUPFyIdQzCC2HU8mvJe9M7EXVYFTaoWf2LbgRWml0 E+bz7aEhthvA16GvXOruBnW/aVQSmhPgW0tfMcmOWuDsDm+dnDfbaKP X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0112.namprd13.prod.outlook.com (2603:10b6:a03:2c5::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) 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_|PA4PR04MB7517:EE_ X-MS-Office365-Filtering-Correlation-Id: b392c4a5-34e8-4c59-282e-08dcf46c60a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|7416014|376014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?OCCYA6s7R5Ya2hvvdiSBySdxfkDfab5?= =?utf-8?q?1EdWeQ8tRbioKBOH7hhsnwWuadI3Ob1q82MrhyZtlzNgxZhT4gcHmVoF0qaIm56A2?= =?utf-8?q?EplQKod/8N16xz+TVYMCHOH0MoXSMRKjjTJyuyxkyjtd3+2Ouh1K4NT0zbzt0Nn4o?= =?utf-8?q?1thkZTnAcHIV3tQmuLE+Acu8GFTnyLKLKnN3vLjspETkwypOE81vguXicYYX+tKRA?= =?utf-8?q?uYTxa1+SmkPqJZWLmEdjNVBWEIy9hA8l+/NVBtU/jxHyVrbBMoo/Ezko1zRHZqCts?= =?utf-8?q?swGUyPBm/FkSzMwVJ5fBr/ZRcS8+XsHRBtJ4pT+0bW3Fh4vBos6N5IgSQ61zexlgQ?= =?utf-8?q?qn6M5rx6CBrf04s9HXj5tqOow3JwCaMWWTzRP+H3zY0gnPLuT2m1tSql0JSdB/MFr?= =?utf-8?q?5oWnI4mXWd+SMS20jCw+DT+xylGJ9TPo286zSt2RXA1tb/7jH+CB0WklDYsDPqzjt?= =?utf-8?q?GoumwM1CSRWUncLcf/bJ5HzpiZBDevn1iNQPWKcKG8hZMTTPhO5szJN3m29YP8O9o?= =?utf-8?q?ewZ0KKGrzTzeL3ePxtMF+Rsb2g2AXmvcHqvp9yMxyF613gRI/78HHwpK16zIwPKLo?= =?utf-8?q?gyMzcYDTiH/970dJaJludgg0O9omsfYiSTFR0OvEQJrqCoxx8tFrTxa8aleBAfjQD?= =?utf-8?q?oXDa8BaCUVET2TZk59/C7+6NJdHlX3hiz76SF8oB/YBa+V50RMRJQy2O300RMQWGf?= =?utf-8?q?VxbwE6xJXZlDRO5O/Zp8FuK4i4D3xZZRWtTdY4dRMk94jjVyHrzRu0f8WbN22WmAI?= =?utf-8?q?uOKrcCHF8gXVyC5UsaphuBMObf1gxXriQP7VLbJI4l4Q6dqJXnFET1lNqot5fmRzP?= =?utf-8?q?NNSr9N/mnXVQn99g3gxWtTSGM6Ik1Ap4YYLMn67d8mReTImziYy0j9hArlSdXIB6t?= =?utf-8?q?eRCZlMfQpx6uJ4unTKCG50aMVbQqluIQ5Bv/WwJ3zr8tCN1hJU/t+tCNtOtyscbld?= =?utf-8?q?3rcckZoZzEy8tOIUcZ3nMVEftBcGk3wUH3Lk6c8Z/uoATQ/tEMqNobiBuC11MXA1D?= =?utf-8?q?JxdSthyTJDo+6mRkb1vQDXerEH0iLMozyArQyvQ4FZLI4ItauJcbPMNHy1LbJEpiE?= =?utf-8?q?51lvdDPMpbQ51hsVF21ck4qWL1nsUc6wOcLs2z2wuYXAiblgsjkbaWDHXIvlMixWU?= =?utf-8?q?3rzMByT8L52U9hgjfAoxdr/T4/QxyKFN0vMufFuCBMOXxbEw9+4vG5hRqfdU8e4oZ?= =?utf-8?q?z9GvX6552KXP+AcDCr0Ae+zh0EIcSBG2IHD9F5KPsQKCKjCaqT0Wp5vvJlJOx+U4V?= =?utf-8?q?gnkmIw/jces4TCB+wygFQX3UFmPPhtAkMohM9qcPhjWHONOdZrnhEnZ0DBbNW74m6?= =?utf-8?q?twDKvc75nAyZ?= 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)(52116014)(1800799024)(7416014)(376014)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?GSSgMDZulAFya77lMFM8EpnyL/Gt?= =?utf-8?q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AOoOQuCHZgaZ4ryeH0R00Z6k5GiLv/uHa1JGgbjcEuGgHSGV3bjE2?= =?utf-8?q?3jhLeyCQbyoPFb0E8XAVHz6LsdTOHmG+W0pQhFwDGWugMsjxPyLHLJ60d70Czr8kU?= =?utf-8?q?E8lUy27LuLAltymEhKJwNDlNrHeUyB5x4giU0qKU/Pdy2DJ9v11zzq74ZIThE7MvI?= =?utf-8?q?8orNpKfHb6Wja1qSp4iKpmtUvVmlTEF1AUX3icw6YvGNXZdulePw6bBM/0ZRC+wZo?= =?utf-8?q?FQtqF6N4GuBPeb16G9vkZZFXyaM3hOSEzYyteS1WrfLp+pHsZ470GyfkzGhcVMKTe?= =?utf-8?q?Quh9tLqOMPzySxgIK3fDxdKb6F4lDO0tOd3TsH4guO5WMdp9/Rb/gDlrvAr4bTVUW?= =?utf-8?q?IjvYdaNSKpU0piaCqK6BhD4BxvbiQMLuNndHaTtTAMNoi5RiDvVY8jxHPFBqbJRFy?= =?utf-8?q?/1VqbI9yBaseQpXPfh4ARda9KqCQzvCDIo4sK7v43OHMOHoffcfc2ZjoDOYpggmDj?= =?utf-8?q?ZN526U9CkeUG5ZuW337+xKKyRQOT9Y80vYigESl/WZ7W9vv451w8+3MLzD51oL7s3?= =?utf-8?q?5HOsgqHVig+MH/kIMAqIxSt4O84TBMp1n8xPJXxuFLOr20jJjN7QyoiTM7A0YVjZa?= =?utf-8?q?20lF02L7QNs4?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b392c4a5-34e8-4c59-282e-08dcf46c60a7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 20:42:29.5899 (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: xntXs1Fo3VE3UTHzQy7Qd0MKaF2Z9lBYv7Qql4YIfneCQavcuFcOsRCYcKaoGC6P+3BeloqRUjR2d4LMhNYSkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7517 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->v4 - 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 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;