From patchwork Mon Jun 17 20:16:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13701355 X-Patchwork-Delegate: kw@linux.com Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2076.outbound.protection.outlook.com [40.107.103.76]) (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 4DCC51990A8; Mon, 17 Jun 2024 20:17:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655441; cv=fail; b=sFvJzSyAFgJRaRMuDmdexTJyece9PKHreyqrQbNHsvbxOvef5J057qavERlOhLF+cxcAGuqoYVu7lguj1LjVgUfvtVJ1JcRTe7yLgUz/SSI5SsJoKRuAxI7Ptt8hBXN0ieH6PlDB37F7xdHxi7GxDk8zdDMkwWGrRLHEcniReoI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655441; c=relaxed/simple; bh=bQfDRFUmBsjiBwmSYlRFuiuVTUjSe2+Qil7MOoSm6P4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ZpZDIJL47ygnA1yeqW4j7TaBWtxyy/2VchRWd9Ozcq2p664jkYohDf6O0k+rLxaHO6lzi9ui8yvmeCYj9yDhM8+0n3FkEq1FuleNm6mjV8IELPK+uDzo8PblSiaT2I8lmfZqnJcCelZRbCCKEkZ1QxVIJ/i4pOsXarF6iPkIpdI= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=SZjWYQVw; arc=fail smtp.client-ip=40.107.103.76 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="SZjWYQVw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PKdDtz54JKCobdNItONe8nbWE/36Rk4v/Pk5EBb253g1z1P863juD10/LHNeRQQj712Lq5AvZ8AZ002+YEgv7ZDAmcjL/St/7XhZbh2K3zEo5jaceE1IdLpZTtEwnFFa+qI3EYlRfbMwZVipSrj/FafbwnAGDG5dG3dXVWv+wM45NUf9ZEL+ti8a1dk8KeL9dWGIBWyEURl50NIfBZ4THL7Ffi0P/yUzowFB6bDxLu12mAjhfaMj0XRToBMuOxtagyIJVAd0Za6YEqIZKDkncT8NSIw589ZqhZtAWOZk8nrelh8xd+TeCRHbLPdGoB/UZ7cwbNtkRNZwX6/yZ0la1A== 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=T4C4bd6RCTWMeAWPYur9JFr3N+1JAJyKW82kjXipNJY=; b=Dj3q4Dh7tdgDbsAjgBpBf+8ppQo+EicBgjCcS1UDgFWxYC2X4cOLVQGI6fhyhXbbzgyJ1Yf4YK7HCocqKYX2jJjW9Iub5gUQojtPxmxRJ9Y9oAp3SBiSyxVE+nwbSOt0Os0CEvhFmG2SSAmjC9Ko62xoHHo/SPIlX1Cafv6mSuUBjFAJfHr2slZ89FZqHLVUsqwRRHLQbR8EztbyG4w0vJaTwdMF5TEsDpZYnxMHeGfbVaGJBkWgJCgQZUO1e8eLKdLSfyblT0VbwlMYETBAo7Lcn1QSrp2DjXawWe9DTSPsWd6uEButN0Mh2p4wMCmteHcGgcTbZEzntguQUwOltg== 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=T4C4bd6RCTWMeAWPYur9JFr3N+1JAJyKW82kjXipNJY=; b=SZjWYQVw5RN/vASJwdeRmt9czkMQR/8gE9rFrd4Oe2ehf4GTikqa8FBOVKD6oyD4ULi24cEkQCVaUTtrRXte7vNAO+tgi1YzhtL2fE055022T26tc52QkOPmmKZGLFdPiZMOd1gt6pw1gGXGn4jHrgiEwv3xQypAhMOGr0v/vgs= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:17: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%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:17:17 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:37 -0400 Subject: [PATCH v6 01/10] PCI: imx6: Fix establish link failure in EP mode for iMX8MM and iMX8MP Message-Id: <20240617-pci2_upstream-v6-1-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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=1718655424; l=1456; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=K6q4j4Cq6SV/EGfAgEb3QEUnqNvPzUe6F4DIJInjKRQ=; b=5ehFQPKy2lBa0kl679ExySig2nvMKJxELh5ihOZtM3FBIJvsovNT59vYvM4+jMFQla1QE6SMc csswxe4WmdQAScA8TdHa14yccH71qL3duWF6PwJzPGFQ2n4SUJz0Myt X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) 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_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: b298ef22-d82e-4c29-816e-08dc8f0a7bc7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?EVPDA0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Tow58lg5JwTS6kKlvQSagWHBOswtVw?= =?utf-8?q?Mmw+pQ+xwpn9CSDSA2XX92EyPUv/peHhgR3cGy5aqNkS+nJtS/eSgkfUBOzgEfrBx?= =?utf-8?q?U3UgZ2bkNebcE4VI7Ya5ikqe3P5MWOuZthUWe7imhvcmYLAhxm7oqRl3hFYu3Epfu?= =?utf-8?q?FqM9689Po3yNaaSoiNSh5p7phIfrUUnPgPSehxDsWIVzzjVghErCms5/JYzdzMQni?= =?utf-8?q?DGSGN1RIPzkmfSoGhm8xLiM0KM7bZl7nkeARig8bEuWWddpkDITSO3g7uI8Z3zinf?= =?utf-8?q?s1jcM8c0qvh0A9fuEIO9cJfLUXvWFENr0qMzbopEpYB5RNVpcj80MV8CfIuSOFcgh?= =?utf-8?q?yDIJ614CrJbuK4jBjgb4gjvHhknK/w3QZ/iD/v+N1tg1cKLlPIrB5l1qH79W1wfEI?= =?utf-8?q?mnV6Igjo18aCGVJEmkzlljBm+f2ULbeQwx7+Qz7RpUFpytQr0aFrXS1VgXGSlMhKB?= =?utf-8?q?3PySKfm5I1wQ?= 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:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ckjOLgT00npVdiGXRNVvq72VbJwM?= =?utf-8?q?8afBfPG5ColBpgYtI0Vm3WLEwgnzhdgNCDSsoSRYov2YC2gJr6Saj/NQVUfyI759Z?= =?utf-8?q?DB4XykTX00vJQLwKInLHihGDjeRodsBoDKxHBV2XgVix9CEI34IB9svfsTDRxoUpE?= =?utf-8?q?Vrr+Fy9ZFWQpVVhlceUE8rBrs+/aOFXj9NJfVPcgGBLY0oXWLr2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=?utf-8?q?dblzPN5Daliqek5J8mbbuMhzHgCd80FhOs6FEhMACsBNCQVwKT6ZS9AXbrOmAG3oh?= =?utf-8?q?Frrl0+D1icEA4BqVNOT1XthWYNp0G52e5lZowFB9rFe34jAS2O2a32jcZpwat/ZvN?= =?utf-8?q?Rof5MFICqAk4nnniu7biQBORNS5Tj3CziGhNJVL7onH2Xhr9/qXf/kc29Ucws4TZq?= =?utf-8?q?6d9m9uamvO67cS3GZnMxwSwCe7gLDPq+roYXRsnQV/qvnsI6CHnw88WvpvlOSz/sH?= =?utf-8?q?iOrbrg8wLfDDNkgrG9QAMbxrEmWoRz/qXYwR10BtH37pTG0T9obZRpAO9YvvV6UJ+?= =?utf-8?q?s5AeapuP+We3WH6DplmJxNKvev/1NV/zfS1yDble4ztkBcz09u9okf7wOw93aUIXj?= =?utf-8?q?n9yXQbxPBxnAFwKFIyrSNrbGUAnGfc9pwqQpn8kt7mXhp6G8BNSWeYpRb2L2UVtbb?= =?utf-8?q?SJsDc9+CHDp1?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b298ef22-d82e-4c29-816e-08dc8f0a7bc7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:17:16.9694 (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: 0Ut9r386IWK+QeHki7gkF5EVJ+/L5SPATUrCJn8t/feoWyP1HlqTzLFYjj5MuwCdwVX/YdbEQbQouPrfu7ZOGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 From: Richard Zhu Add IMX6_PCIE_FLAG_HAS_APP_RESET flag to IMX8MM_EP and IMX8MP_EP drvdata. This flag was overlooked during code restructuring. It is crucial to release the app-reset from the System Reset Controller before initiating LTSSM to rectify the issue Fixes: 0c9651c21f2a ("PCI: imx6: Simplify reset handling by using *_FLAG_HAS_*_RESET") Signed-off-by: Richard Zhu Signed-off-by: Frank Li Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pci-imx6.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 917c69edee1d5..9a71b8aa09b3c 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1578,7 +1578,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM_EP] = { .variant = IMX8MM_EP, - .flags = IMX6_PCIE_FLAG_HAS_PHYDRV, + .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, @@ -1589,7 +1590,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MP_EP] = { .variant = IMX8MP_EP, - .flags = IMX6_PCIE_FLAG_HAS_PHYDRV, + .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, From patchwork Mon Jun 17 20:16: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: 13701356 X-Patchwork-Delegate: kw@linux.com Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2056.outbound.protection.outlook.com [40.107.103.56]) (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 1FFEE19938A; Mon, 17 Jun 2024 20:17:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655448; cv=fail; b=u9M4bFj9bUZ7nbNSukt6ACoMOreNl6UOk/oA5CAFS6Lv5SMDWiqFF82jbyctalFBZOmDx9XvSCuhQG+Pp9Pf6rzsY3pH7SwfjnVgOQxA0liGprmNibYRK2ssZYh//FXq5rrDf8azqlPOfiUGaNNITlyU2ZjRVRMbUWVcEMrQip0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655448; c=relaxed/simple; bh=EHyeS3eCsKTVfj4EEn10/36Iugqdn8KqQ8XKGyRIeGQ=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=VXKi8cd1RM+7rBM2fm0Bkr5zVR+nH9ArcBcuGxd1Iy3jn2OT2pB4cYaSDZc5AHSBF0uWX2B0ix58zHh6MHw49MdSO+mDxyO5pcC3Mb55lRGk3Zx+Z2IIzLHsPOV9C3zBm9ra+bOVAZNwcSxjDdiq4Ha9HBM6s2X9wweU/5PYJO4= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=iT90QTp0; arc=fail smtp.client-ip=40.107.103.56 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="iT90QTp0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dtaGXGO7AXZ1qVpYGELaYIdiG5O1O9/XyFZekMXA+iocJ+S8sz6pW0P6K5DNfd+00ulDUQd+yTina8sGa58PNRk1/UUs27AJmS+vHnD5hYL0KFKYfdIc8zaJ7OFw7XM9vzf1wMMtQbMA6bJc+W0pSeFULNYDJpqgw2Q2FkRJYMfLJkzhw/S1pS3vmbwv1CP51JTWUmQF+Z5tsucredKzrxEiQL715eAlLvC4i/x3+sDVHgGTp/NcUzohsFMH+9joWIfOy0fap9TSCHbEQ9k+bVXVXtm6pe/wCSqlWtKDcguhM7cxA/NC2eDlma8Vv9yQYtlQqlw3o7VRRdUO6J9XvQ== 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=UUBWGHoGKaKMGJh9TkXeHEMhc07ASjRiTyfpTUk9/iE=; b=co3b64GE7AU3c7ps5rF2QuGN3yD+Kk64xy1heqXsBXdnhGEtRL6+NWVIopk4QaPiwlTfEleKJ0UPYuj43bAt9dbuYGDUIScjkoZo7FyyIW6scN0hhWQ711eBuEsFVBbLOzeCSld/CvnMLpHUxAGPo8AYeRcFh1sYJjw4eVqf9AEhHQRNMUdlQqAgPvMadbQm2GdWkzdEg/akb4DZZtybXWIIR1/uUIVA7lBhICjkh24dTdk1NY7BQKkqQTOKCH8QiDWlfDc2oiv1/ihDCn5A+nPHaLT1w9lXZtkBRXrc6WjaiZcEHtMA84ddjgmuAdsrd3WNzTeregBYDkLYcFLDbA== 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=UUBWGHoGKaKMGJh9TkXeHEMhc07ASjRiTyfpTUk9/iE=; b=iT90QTp0PGvsvqG5erjGy4z+8ck7NmSENIH2zoV+oDQRLL64M/VohzD4kGlPFnNDtWJ+uiVVTOnNKhueIA2te0yTA314ML/KcBZ+u+MaRi02mK1fUiNqLFGMHmzhrNf85AL4wVNltwDlWwPzUxnO46wbM/q0NvPce4CezS0mi3o= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:17:23 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:17:23 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:38 -0400 Subject: [PATCH v6 02/10] PCI: imx6: Fix i.MX8MP PCIe EP's occasional failure to trigger MSI Message-Id: <20240617-pci2_upstream-v6-2-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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 , Jason Liu X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1718655424; l=1357; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=0tg9I2bqWF9gd4zcaTOgOiV9PwF7bz2gPmS25zNUpq8=; b=icFYh2KCatik2YOeIh6B5e1BgU8Dz5wLHv0lscwqBENs3K3lUYYsTOO1g40PbcGJKFNGyBzrt foV+BgSiXYnBXDfeLPGP2+eswK4O5iPCG5aB5pHu0qtojZVDS+3SBfg X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) 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_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: fa98ef6b-76e5-48c7-0327-08dc8f0a7f67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yT5J7sQueU25ZiwQS4I4WRNiaj41Xms?= =?utf-8?q?7IL7gVvuVHYJQrNB3Eg4Dkl2dbVVHQKXMUweJMUuxXt36SWYssZ1TPXtTjVv1PaW4?= =?utf-8?q?Inf0Km+we9DskQPwe0qBym9yg1RFZKBdHUnmpaJvJmWo6LBKs8LX0pMW2+Qeczobh?= =?utf-8?q?6ScaOSIjb05bOQNvB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uCax3sSxXgMHJ4kmvAv3brb44y1d?= =?utf-8?q?RyD1MX/mBd/1HgOHEyGf7+xhmQcNjViW+G0xr6hMT0S/t2ykD8CBNu3S1u7MSN+jx?= =?utf-8?q?+w2d+wYYmqdncFvP6YzqIoSZJf0OArIKuL91HejIQcVm+Zqzsgm+PAsT4rFX5oqZ2?= =?utf-8?q?Q0AAG5InHSWRstnBXgBPDfp23MJMUmqaXwDg6gCcHGv48wei8cBxlIfkXWh8AmiqI?= =?utf-8?q?h0yuxYE67cRB8fNlpyhB6NcPawTnRfZuJRlzyMPCmX2eZtfHjLfusQe3x+fFZZu2C?= =?utf-8?q?NeWM/UiYvkeO?= 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:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?NmcKrDIB4pmZhD2dLXD+luWA9iPo?= =?utf-8?q?SkC0ULPE46eg2XiLqeHGJuvTpCxio0NXSZpVYJBtO2mB5LxM+hs0iSLtopa1ACuD6?= =?utf-8?q?lYJE7uiDw3RzlMFzMfxELknOaEw39mtRwJhRUVI/izjl4XGQ/LPjn6WcdPU/cabbu?= =?utf-8?q?bbwBQWRrlsbq9GQKpinjqXDjjkw63vtFPBDNcPG7fWVvsHmNpn0RNYdcDHKQOKCVW?= =?utf-8?q?VBVpUC2A7uyL5TDxTcwcmlG3PgF/7K6o/sOiZmKAC/HjM3cB0H8Mh0HLZD8pBOsgV?= =?utf-8?q?wZqx2kN+WcuJJfu1DAySczOHlH7WqLWsZOoczxUB42VkJX9qwizo8S4TF0QGw+Ji9?= =?utf-8?q?J7j0e3yVghrXBeTdqvJlULpHRmOk02A7i0dI7DUGuNK87V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ws41WR7VUV32pIzxra?= =?utf-8?q?/ktQZqYtFGQUqTZ0sAqa0Mob6H80Ufdoi2XSp3w1kucIECeRXsROK7a8MWi9KrFuc?= =?utf-8?q?bozWe3xTNlD0LZLzD2JGx32w8JVhJUTQklLObUFRZ6WITxYZmu4lmHPrFMmfX5CcH?= =?utf-8?q?JvmBK5KcA9l/FfsSRdkd8llVDdSPLRGDwDzQ7N2mnFm49y3R3MSpKmO2NCrzv+MeV?= =?utf-8?q?oEsbQOrT79Play3WHv3TBktGX0xYctzuLhRZUF9B0dvOJaUbrBU8Gh+Xh8dQGk5oc?= =?utf-8?q?jnajwSM/k3+Z?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa98ef6b-76e5-48c7-0327-08dc8f0a7f67 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:17:23.0499 (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: FdTRYRJPlmPW1+Y3MR6cdqeo3pxcwZXY37Jq6XlcIv056HNJHxtkGJdHtEidak2aWvkf2SMN6q2mQJdw9dJlfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 From: Richard Zhu Correct occasional MSI triggering failures in i.MX8MP PCIe EP by apply 64KB hardware alignment requirement. MSI triggering fail if the outbound MSI memory region (ep->msi_mem) is not aligned to 64KB. In dw_pcie_ep_init(): ep->msi_mem = pci_epc_mem_alloc_addr(epc, &ep->msi_mem_phys, epc->mem->window.page_size); Set ep->page_size to match drvdata::epc_features::align since different SOCs have different alignment requirements. Fixes: 1bd0d43dcf3b ("PCI: imx6: Clean up addr_space retrieval code") Signed-off-by: Richard Zhu Acked-by: Jason Liu Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 9a71b8aa09b3c..ca9a000c9a96d 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1118,6 +1118,8 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_SUPPORT_64BIT)) dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); + ep->page_size = imx6_pcie->drvdata->epc_features->align; + ret = dw_pcie_ep_init(ep); if (ret) { dev_err(dev, "failed to initialize endpoint\n"); From patchwork Mon Jun 17 20:16: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: 13701357 X-Patchwork-Delegate: kw@linux.com Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2085.outbound.protection.outlook.com [40.107.103.85]) (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 BE547198E80; Mon, 17 Jun 2024 20:17:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655457; cv=fail; b=VoHyizNU50zOVef6LdvDu580/gmex/0t4fU/2kiZg5BMlw4ensQMKPumMYtPg2LLd4IZoOtCRFl462zD+2JtutTud8II0e0Oayv6TeKJX6YOlkMCPkhkIwcP6MLlzMHza+4c2NO4XFj/Z7bsHnqyREvkGJ+KwaDix2+sSibubgg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655457; c=relaxed/simple; bh=1L9rfqGyaE9zMbO5zUOU/Xl2HoZDNvSTKKPxhjqSwmg=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=A1lP8ushh7DkWxfMzriLt3tEpwnCvmPBTsvxuXPlgkYafoZn2Z5ujc8yvnIqv7xJkOOUoAHUGlF9aMyrwkOtNO4akPHogyz+5xl9j+RZ1n2Q2kOVYFB9wV+Vk5QtZIOKbi1E89Wo4c0jG8hH3Qruwpw2ePKPaK9iM4jsCy1oZiU= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=byjMApNS; arc=fail smtp.client-ip=40.107.103.85 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="byjMApNS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NGqwY5ZYK7z2IkD9+OfJtkq3wtrgyg70TeCJ4EKzNjA0D2smqZcpDrZLg7bfeKqyfplWLG6lE6/9lPNcJegVE1U6JKuRg8Oyl+oOAz/9Ikj+aqJmV36LYuWIKsxiDP7MUB4z8TKffsQvkXNlyYur6q1EUf+h9WbMYkCE0678miEWmyhvCGy41xvgNlzqojqJVoQSZY/O9F1YzCnokJy/SXi1eUCvWTeqsAbhVFT50wZPuLLY0mK80wViUELFHBaYB5Jl5BFMPrm8WZQ9SJ7NmZMG2CrW7iKhmPyrCKtCi2a2o/avbFGzwSlWGUNjioeSmbofr5B2A6aWElj5g2YQGA== 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=a2UhTfsLrb5meIuGPcEYmzQz2Eee34aa7gxalXkraJk=; b=llnY//vd4cOFeh5rvSDe+R8tJVLGYJVvOYPRAonz+T1UbmIhFPgiKtHmIvwv3vnfxi+Me9B3NzH2PAur3vWDiiejU80ptENV7qhLAOeIo3b0ILoVq4NsZiTzftVMXBjN7hS1vcdKpQc/WxRqNRBQgc0o+pXcR4+wqMdSi9Gfg70NEwcMlPz+UVBPRNiH5fCD8hbX8mb7DEumwb5bL/zIeZYp008JVdpbSHgFzvonLN277iaTVBcSbOOwKjDFHzjZF9cNXt+IHdsz+UzMWHerdZEZivlYI5RltBK4lM4mkIrObKw3lN0vYHb9pNrxC0pKrvdfMXu+brE78V9qAXuH0A== 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=a2UhTfsLrb5meIuGPcEYmzQz2Eee34aa7gxalXkraJk=; b=byjMApNSNAAwDIO2OU73grGocj9RswXGZURmBa3szlMu8Ps26+omFxLkjhpjYQ+WiKycc4vTIiXxwMCXfgacXwgeU1ZnoHAwTKoscrf0sQk4Sxs9C/XstDPfPIsqiSxDoppVGozJMeqrJXEC8WzL+Zry5DNInxXCBf4OwWwhql8= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:17: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%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:17:29 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:39 -0400 Subject: [PATCH v6 03/10] PCI: imx6: Rename imx6_* with imx_* Message-Id: <20240617-pci2_upstream-v6-3-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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=1718655424; l=59946; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=1L9rfqGyaE9zMbO5zUOU/Xl2HoZDNvSTKKPxhjqSwmg=; b=JdOmTS5xgMYAqiVwboJQtBacZalWcIuyvRLeGZxeOJUIrIlOuiPHoiQZ4pogRhiqQxhNWaIwz f4yRs7DCyvVBLypLF0f/dWSm0iBHD56uw19EaFEO0Xu8zbm0CYKUeYi X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) 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_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f9b8baa-6389-4c40-a126-08dc8f0a8319 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?moV0RbnMdtSbMp9H0nlG5nvJTVub0T4?= =?utf-8?q?2dC9RDM9dvb0Gebd5j70zPMcPnSogeuHqHqJJqQjqLyAkjOx9cBPVa60vKxSzeNRa?= =?utf-8?q?q7vyJmVQrAXIHtRG+/AsLXcVDa2n9+KtFjMt9aYD0IMl8X+sy+2voL+ifl+bapGzg?= =?utf-8?q?v6ZvnuCirNXUtwus1LUGr0zoGoDifFDzW2L51v5m1PCIjZ2kzaD4aSDWh9PhmG2EY?= =?utf-8?q?HUxBveVcbGvhNjUR83qth9ZUiDkfkRhGXYEElWActElUPMVBf3GKpzkmQI4Id9OjA?= =?utf-8?q?qfSdwfhmv97rd+ih1lfxLtEHI4dX0VY+9LKKDuWP6Tgs/aHUF0XPhoiK1de6068DO?= =?utf-8?q?yESvJkeuhf0sXBMNsiR7seXikJ0lbcShnbzGUcP32S6yFV+yYjZxIUl1eqbdGiFH0?= =?utf-8?q?zd5z/wcTMMh9M6lA0OU2eLSaeDdIhCUoB/aYb3lQtzDIRy/wkohAvdCa0h2dzqJqp?= =?utf-8?q?InUgCc8o8XIbT36YT3PO6GGz+0EUu8G2Bz2C6btAuPn92YYcBrAqHJwJlcRE5gO6i?= =?utf-8?q?83H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MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?jaBeFqMTegaJ0xbz0HIhFNsGVJlZ?= =?utf-8?q?H7OGgcVP2dGtT38f7OUgifLQ0NEiXzy5Hfm12ZOOwFYNlfHy1kYd6B65SBNmOHl6Z?= =?utf-8?q?x13pteMUYPYCwDQ4gOT1MBaxsSSU7cOyRQOrRKWTxj2U8junIc1Eq5cdFpxHBkYUN?= =?utf-8?q?a7AyldrBnjmXJYZPx580LDPZfZcNNUKzlBh5IEGuhIsSJNktdvExxc99TQ1iVNuPy?= =?utf-8?q?dAezDvMD5PgoRaRa+Q4S6c4AXgifEQaWw1TUQQVaWwcDw66ckVR3IohxuwHlo5JLf?= =?utf-8?q?cON5fdzd0VoNAGDpa7EkiBl9RTJOQbUQ5aMDsPs4/s7lfhBmx8S8lG6x/Q/cKyryO?= =?utf-8?q?8MG7SDQQGuPeMZDj7ul6SwwGu/6JZ3zKNkac6wiXeFT03KYIrLDA0ja7pND4jeAz5?= =?utf-8?q?LkalW6tzrIN6bF7CE3b1nmDl27p6JGKmL8bnNqW3A9zp9nkQQ5dLwTIJ+kuGRu/bV?= =?utf-8?q?HUI0wWRdaloDkXZnl7Bkeseh6of8Vwfx+nxVTH8pcFpQc0qp191/vGe4YiMJ3gVnl?= =?utf-8?q?15p8eq8OHsmiLEYeD8oBuMdTUwGRv0YeIsxV9eMi+lp9A/60V90k3fQB3wOvZdmhi?= =?utf-8?q?Iyrm4HLJN+G3ebe5vFr8KCzzy9o+HTFukEyzuxycqUwLgkCkanFUKz4JXS7pgdVes?= =?utf-8?q?3R2fQ/Aec4dzHOjlvEZ3OWQvyPMD6z6L3GrnpDw6kqiBNs0kjIbaT+dYGwObChnf+?= =?utf-8?q?y474Q0bv5SaDiJPLTy7OLZZFFtig6wGWwceo0MiTODu5UcTsk0NYONWPrvf/5zpjF?= =?utf-8?q?wRayFxbrpqqEdtCUX9TTKr2AppGuDI4D5j7srD9Kt949O6txSc1Z04K36AuMMVHRB?= =?utf-8?q?7MJ0naQj6syGO/rrhTiRxyTTZ/ohKPPpJwCJKLenTYK901WcQoOWJ9jSqymueO1yM?= =?utf-8?q?2nRgFrhwIxbvTAwpUt1bz5ilj5ezWkjZpfcM7ff25IJsNpBbCndmzR/qQ525JSW14?= =?utf-8?q?KXAzE7020rbzduqX5lxOTNEraL7W+qeHGKvLreqFlZTl90+yxGNkOFGuDUF5WizJI?= =?utf-8?q?9UQoX6KlAIq/HCbf9hb7R9LPICTUWWdpLuvw47uUeaG6j4nFBFTKJ3TmIAR/9XM86?= =?utf-8?q?FS9M0bnfojySGJqo5m+UhGf/7HuT6dxueFW9sH9eF6DgoVNgKbub/3IjoBhCHY8ri?= =?utf-8?q?tlL99sjmAe3Ibu79xoJJGUB/2rIqRYOJEaVXcuxNiL3p9OzDwcjfayoN+YmX2SmVK?= =?utf-8?q?5tfiz6ZOhnep4AI5cic50/U0qw+/QB8R5ynh6KRwgr9Z5WYvN7FfSQFMWXyDfn2hO?= =?utf-8?q?OKSLUUVeX+FiURK5AN/m/8k7Z4EjYNacZMyoD+LI/1dAdWTZSyiCmjCOUg2RgYvRL?= =?utf-8?q?hkZ9ELCKG8MlYUzK1sZC4ULN/z9/NcxF6N2SpclpH3yAzSyZ/6KcZBVZB/TghpGUb?= =?utf-8?q?GtNCRtsWu16mJbhX1SZcrRQFV1+nXtIK/ONdeCIoznh5sv/0HpbpbTEtUSf+n/FiN?= =?utf-8?q?vL5NESwKZn3SVQp0d0xSwW3puMHTvTzTYvarPbxsjpSpsLGATnKmks09M1fyVdF0G?= =?utf-8?q?ZJzj58AAVr0O?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f9b8baa-6389-4c40-a126-08dc8f0a8319 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:17:29.4372 (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: ET9Huz5juLGB93XQf4oGGfo/lu0o/LWX/Nu6Edfn/T6MjiSFRp/J0Svw6n7lZNhhgfpuZbM5GbaHWA2KVOqQ8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 Since this driver has evolved to support other i.MX SoCs such as i.MX7/8/9, let's rename the 'imx6' prefix to 'imx' to avoid confusion. But the driver name is left unchanged to avoid breaking userspace scripts Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 760 +++++++++++++++++----------------- 1 file changed, 380 insertions(+), 380 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index ca9a000c9a96d..47134e2dfecf2 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -55,9 +55,9 @@ #define IMX95_PE0_GEN_CTRL_3 0x1058 #define IMX95_PCIE_LTSSM_EN BIT(0) -#define to_imx6_pcie(x) dev_get_drvdata((x)->dev) +#define to_imx_pcie(x) dev_get_drvdata((x)->dev) -enum imx6_pcie_variants { +enum imx_pcie_variants { IMX6Q, IMX6SX, IMX6QP, @@ -72,25 +72,25 @@ enum imx6_pcie_variants { IMX95_EP, }; -#define IMX6_PCIE_FLAG_IMX6_PHY BIT(0) -#define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) -#define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) -#define IMX6_PCIE_FLAG_HAS_PHYDRV BIT(3) -#define IMX6_PCIE_FLAG_HAS_APP_RESET BIT(4) -#define IMX6_PCIE_FLAG_HAS_PHY_RESET BIT(5) -#define IMX6_PCIE_FLAG_HAS_SERDES BIT(6) -#define IMX6_PCIE_FLAG_SUPPORT_64BIT BIT(7) +#define IMX_PCIE_FLAG_IMX_PHY BIT(0) +#define IMX_PCIE_FLAG_IMX_SPEED_CHANGE BIT(1) +#define IMX_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) +#define IMX_PCIE_FLAG_HAS_PHYDRV BIT(3) +#define IMX_PCIE_FLAG_HAS_APP_RESET BIT(4) +#define IMX_PCIE_FLAG_HAS_PHY_RESET BIT(5) +#define IMX_PCIE_FLAG_HAS_SERDES BIT(6) +#define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7) -#define imx6_check_flag(pci, val) (pci->drvdata->flags & val) +#define imx_check_flag(pci, val) (pci->drvdata->flags & val) -#define IMX6_PCIE_MAX_CLKS 6 +#define IMX_PCIE_MAX_CLKS 6 -#define IMX6_PCIE_MAX_INSTANCES 2 +#define IMX_PCIE_MAX_INSTANCES 2 -struct imx6_pcie; +struct imx_pcie; -struct imx6_pcie_drvdata { - enum imx6_pcie_variants variant; +struct imx_pcie_drvdata { + enum imx_pcie_variants variant; enum dw_pcie_device_mode mode; u32 flags; int dbi_length; @@ -99,18 +99,18 @@ struct imx6_pcie_drvdata { const u32 clks_cnt; const u32 ltssm_off; const u32 ltssm_mask; - const u32 mode_off[IMX6_PCIE_MAX_INSTANCES]; - const u32 mode_mask[IMX6_PCIE_MAX_INSTANCES]; + const u32 mode_off[IMX_PCIE_MAX_INSTANCES]; + const u32 mode_mask[IMX_PCIE_MAX_INSTANCES]; const struct pci_epc_features *epc_features; - int (*init_phy)(struct imx6_pcie *pcie); + int (*init_phy)(struct imx_pcie *pcie); }; -struct imx6_pcie { +struct imx_pcie { struct dw_pcie *pci; int reset_gpio; bool gpio_active_high; bool link_is_up; - struct clk_bulk_data clks[IMX6_PCIE_MAX_CLKS]; + struct clk_bulk_data clks[IMX_PCIE_MAX_CLKS]; struct regmap *iomuxc_gpr; u16 msi_ctrl; u32 controller_id; @@ -131,7 +131,7 @@ struct imx6_pcie { /* power domain for pcie phy */ struct device *pd_pcie_phy; struct phy *phy; - const struct imx6_pcie_drvdata *drvdata; + const struct imx_pcie_drvdata *drvdata; }; /* Parameters for the waiting for PCIe PHY PLL to lock on i.MX7 */ @@ -186,28 +186,28 @@ struct imx6_pcie { #define PHY_RX_OVRD_IN_LO_RX_DATA_EN BIT(5) #define PHY_RX_OVRD_IN_LO_RX_PLL_EN BIT(3) -static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie) +static unsigned int imx_pcie_grp_offset(const struct imx_pcie *imx_pcie) { - WARN_ON(imx6_pcie->drvdata->variant != IMX8MQ && - imx6_pcie->drvdata->variant != IMX8MQ_EP && - imx6_pcie->drvdata->variant != IMX8MM && - imx6_pcie->drvdata->variant != IMX8MM_EP && - imx6_pcie->drvdata->variant != IMX8MP && - imx6_pcie->drvdata->variant != IMX8MP_EP); - return imx6_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14; + WARN_ON(imx_pcie->drvdata->variant != IMX8MQ && + imx_pcie->drvdata->variant != IMX8MQ_EP && + imx_pcie->drvdata->variant != IMX8MM && + imx_pcie->drvdata->variant != IMX8MM_EP && + imx_pcie->drvdata->variant != IMX8MP && + imx_pcie->drvdata->variant != IMX8MP_EP); + return imx_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14; } -static int imx95_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx95_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, + regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_SS_RW_REG_0, IMX95_PCIE_PHY_CR_PARA_SEL, IMX95_PCIE_PHY_CR_PARA_SEL); - regmap_update_bits(imx6_pcie->iomuxc_gpr, + regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_PHY_GEN_CTRL, IMX95_PCIE_REF_USE_PAD, 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, + regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_SS_RW_REG_0, IMX95_PCIE_REF_CLKEN, IMX95_PCIE_REF_CLKEN); @@ -215,9 +215,9 @@ static int imx95_pcie_init_phy(struct imx6_pcie *imx6_pcie) return 0; } -static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) +static void imx_pcie_configure_type(struct imx_pcie *imx_pcie) { - const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; unsigned int mask, val, mode, id; if (drvdata->mode == DW_PCIE_EP_TYPE) @@ -225,7 +225,7 @@ static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) else mode = PCI_EXP_TYPE_ROOT_PORT; - id = imx6_pcie->controller_id; + id = imx_pcie->controller_id; /* If mode_mask[id] is zero, means each controller have its individual gpr */ if (!drvdata->mode_mask[id]) @@ -234,12 +234,12 @@ static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) mask = drvdata->mode_mask[id]; val = mode << (ffs(mask) - 1); - regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->mode_off[id], mask, val); + regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->mode_off[id], mask, val); } -static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) +static int pcie_phy_poll_ack(struct imx_pcie *imx_pcie, bool exp_val) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; bool val; u32 max_iterations = 10; u32 wait_counter = 0; @@ -258,9 +258,9 @@ static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) return -ETIMEDOUT; } -static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) +static int pcie_phy_wait_ack(struct imx_pcie *imx_pcie, int addr) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; u32 val; int ret; @@ -270,24 +270,24 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) val |= PCIE_PHY_CTRL_CAP_ADR; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - return pcie_phy_poll_ack(imx6_pcie, false); + return pcie_phy_poll_ack(imx_pcie, false); } /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ -static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) +static int pcie_phy_read(struct imx_pcie *imx_pcie, int addr, u16 *data) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; u32 phy_ctl; int ret; - ret = pcie_phy_wait_ack(imx6_pcie, addr); + ret = pcie_phy_wait_ack(imx_pcie, addr); if (ret) return ret; @@ -295,7 +295,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) phy_ctl = PCIE_PHY_CTRL_RD; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl); - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; @@ -304,18 +304,18 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) /* deassert Read signal */ dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, 0x00); - return pcie_phy_poll_ack(imx6_pcie, false); + return pcie_phy_poll_ack(imx_pcie, false); } -static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) +static int pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; u32 var; int ret; /* write addr */ /* cap addr */ - ret = pcie_phy_wait_ack(imx6_pcie, addr); + ret = pcie_phy_wait_ack(imx_pcie, addr); if (ret) return ret; @@ -326,7 +326,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) var |= PCIE_PHY_CTRL_CAP_DAT; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; @@ -335,7 +335,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ - ret = pcie_phy_poll_ack(imx6_pcie, false); + ret = pcie_phy_poll_ack(imx_pcie, false); if (ret) return ret; @@ -344,7 +344,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack */ - ret = pcie_phy_poll_ack(imx6_pcie, true); + ret = pcie_phy_poll_ack(imx_pcie, true); if (ret) return ret; @@ -353,7 +353,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ - ret = pcie_phy_poll_ack(imx6_pcie, false); + ret = pcie_phy_poll_ack(imx_pcie, false); if (ret) return ret; @@ -362,74 +362,74 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return 0; } -static int imx8mq_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx8mq_pcie_init_phy(struct imx_pcie *imx_pcie) { /* TODO: Currently this code assumes external oscillator is being used */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, - imx6_pcie_grp_offset(imx6_pcie), + regmap_update_bits(imx_pcie->iomuxc_gpr, + imx_pcie_grp_offset(imx_pcie), IMX8MQ_GPR_PCIE_REF_USE_PAD, IMX8MQ_GPR_PCIE_REF_USE_PAD); /* * Regarding the datasheet, the PCIE_VPH is suggested to be 1.8V. If the PCIE_VPH is * supplied by 3.3V, the VREG_BYPASS should be cleared to zero. */ - if (imx6_pcie->vph && regulator_get_voltage(imx6_pcie->vph) > 3000000) - regmap_update_bits(imx6_pcie->iomuxc_gpr, - imx6_pcie_grp_offset(imx6_pcie), + if (imx_pcie->vph && regulator_get_voltage(imx_pcie->vph) > 3000000) + regmap_update_bits(imx_pcie->iomuxc_gpr, + imx_pcie_grp_offset(imx_pcie), IMX8MQ_GPR_PCIE_VREG_BYPASS, 0); return 0; } -static int imx7d_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx7d_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); return 0; } -static int imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6Q_GPR12_PCIE_CTL_2, 0 << 10); /* configure constant input signal to the pcie ctrl and phy */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6Q_GPR12_LOS_LEVEL, 9 << 4); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_DEEMPH_GEN1, - imx6_pcie->tx_deemph_gen1 << 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_deemph_gen1 << 0); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_DEEMPH_GEN2_3P5DB, - imx6_pcie->tx_deemph_gen2_3p5db << 6); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_deemph_gen2_3p5db << 6); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB, - imx6_pcie->tx_deemph_gen2_6db << 12); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_deemph_gen2_6db << 12); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_SWING_FULL, - imx6_pcie->tx_swing_full << 18); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + imx_pcie->tx_swing_full << 18); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR8, IMX6Q_GPR8_TX_SWING_LOW, - imx6_pcie->tx_swing_low << 25); + imx_pcie->tx_swing_low << 25); return 0; } -static int imx6sx_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx6sx_pcie_init_phy(struct imx_pcie *imx_pcie) { - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_RX_EQ_MASK, IMX6SX_GPR12_PCIE_RX_EQ_2); - return imx6_pcie_init_phy(imx6_pcie); + return imx_pcie_init_phy(imx_pcie); } -static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) +static void imx7d_pcie_wait_for_phy_pll_lock(struct imx_pcie *imx_pcie) { u32 val; - struct device *dev = imx6_pcie->pci->dev; + struct device *dev = imx_pcie->pci->dev; - if (regmap_read_poll_timeout(imx6_pcie->iomuxc_gpr, + if (regmap_read_poll_timeout(imx_pcie->iomuxc_gpr, IOMUXC_GPR22, val, val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED, PHY_PLL_LOCK_WAIT_USLEEP_MAX, @@ -437,19 +437,19 @@ static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) dev_err(dev, "PCIe PLL lock timeout\n"); } -static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) +static int imx_setup_phy_mpll(struct imx_pcie *imx_pcie) { unsigned long phy_rate = 0; int mult, div; u16 val; int i; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_IMX_PHY)) return 0; - for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) - if (strncmp(imx6_pcie->clks[i].id, "pcie_phy", 8) == 0) - phy_rate = clk_get_rate(imx6_pcie->clks[i].clk); + for (i = 0; i < imx_pcie->drvdata->clks_cnt; i++) + if (strncmp(imx_pcie->clks[i].id, "pcie_phy", 8) == 0) + phy_rate = clk_get_rate(imx_pcie->clks[i].clk); switch (phy_rate) { case 125000000: @@ -467,46 +467,46 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) div = 1; break; default: - dev_err(imx6_pcie->pci->dev, + dev_err(imx_pcie->pci->dev, "Unsupported PHY reference clock rate %lu\n", phy_rate); return -EINVAL; } - pcie_phy_read(imx6_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, &val); + pcie_phy_read(imx_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, &val); val &= ~(PCIE_PHY_MPLL_MULTIPLIER_MASK << PCIE_PHY_MPLL_MULTIPLIER_SHIFT); val |= mult << PCIE_PHY_MPLL_MULTIPLIER_SHIFT; val |= PCIE_PHY_MPLL_MULTIPLIER_OVRD; - pcie_phy_write(imx6_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, val); + pcie_phy_write(imx_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, val); - pcie_phy_read(imx6_pcie, PCIE_PHY_ATEOVRD, &val); + pcie_phy_read(imx_pcie, PCIE_PHY_ATEOVRD, &val); val &= ~(PCIE_PHY_ATEOVRD_REF_CLKDIV_MASK << PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT); val |= div << PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT; val |= PCIE_PHY_ATEOVRD_EN; - pcie_phy_write(imx6_pcie, PCIE_PHY_ATEOVRD, val); + pcie_phy_write(imx_pcie, PCIE_PHY_ATEOVRD, val); return 0; } -static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) +static void imx_pcie_reset_phy(struct imx_pcie *imx_pcie) { u16 tmp; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_IMX_PHY)) return; - pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); + pcie_phy_read(imx_pcie, PHY_RX_OVRD_IN_LO, &tmp); tmp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN); - pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); + pcie_phy_write(imx_pcie, PHY_RX_OVRD_IN_LO, tmp); usleep_range(2000, 3000); - pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); + pcie_phy_read(imx_pcie, PHY_RX_OVRD_IN_LO, &tmp); tmp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN | PHY_RX_OVRD_IN_LO_RX_PLL_EN); - pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); + pcie_phy_write(imx_pcie, PHY_RX_OVRD_IN_LO, tmp); } #ifdef CONFIG_ARM @@ -545,22 +545,22 @@ static int imx6q_pcie_abort_handler(unsigned long addr, } #endif -static int imx6_pcie_attach_pd(struct device *dev) +static int imx_pcie_attach_pd(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); struct device_link *link; /* Do nothing when in a single power domain */ if (dev->pm_domain) return 0; - imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); - if (IS_ERR(imx6_pcie->pd_pcie)) - return PTR_ERR(imx6_pcie->pd_pcie); + imx_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); + if (IS_ERR(imx_pcie->pd_pcie)) + return PTR_ERR(imx_pcie->pd_pcie); /* Do nothing when power domain missing */ - if (!imx6_pcie->pd_pcie) + if (!imx_pcie->pd_pcie) return 0; - link = device_link_add(dev, imx6_pcie->pd_pcie, + link = device_link_add(dev, imx_pcie->pd_pcie, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); @@ -569,11 +569,11 @@ static int imx6_pcie_attach_pd(struct device *dev) return -EINVAL; } - imx6_pcie->pd_pcie_phy = dev_pm_domain_attach_by_name(dev, "pcie_phy"); - if (IS_ERR(imx6_pcie->pd_pcie_phy)) - return PTR_ERR(imx6_pcie->pd_pcie_phy); + imx_pcie->pd_pcie_phy = dev_pm_domain_attach_by_name(dev, "pcie_phy"); + if (IS_ERR(imx_pcie->pd_pcie_phy)) + return PTR_ERR(imx_pcie->pd_pcie_phy); - link = device_link_add(dev, imx6_pcie->pd_pcie_phy, + link = device_link_add(dev, imx_pcie->pd_pcie_phy, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); @@ -585,20 +585,20 @@ static int imx6_pcie_attach_pd(struct device *dev) return 0; } -static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) +static int imx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie) { unsigned int offset; int ret = 0; - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0); break; case IMX6QP: case IMX6Q: /* power up core phy and enable ref clock */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); /* * the async reset input need ref clock to sync internally, @@ -607,7 +607,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) * add one ~10us delay here. */ usleep_range(10, 100); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); break; case IMX7D: @@ -620,15 +620,15 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) case IMX8MQ_EP: case IMX8MP: case IMX8MP_EP: - offset = imx6_pcie_grp_offset(imx6_pcie); + offset = imx_pcie_grp_offset(imx_pcie); /* * Set the over ride low and enabled * make sure that REF_CLK is turned on. */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, offset, + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, offset, + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN); break; @@ -637,19 +637,19 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) return ret; } -static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) +static void imx_pcie_disable_ref_clk(struct imx_pcie *imx_pcie) { - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6QP: case IMX6Q: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, IMX6Q_GPR1_PCIE_TEST_PD); break; case IMX7D: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); break; @@ -658,17 +658,17 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) } } -static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) +static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct device *dev = pci->dev; int ret; - ret = clk_bulk_prepare_enable(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + ret = clk_bulk_prepare_enable(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); if (ret) return ret; - ret = imx6_pcie_enable_ref_clk(imx6_pcie); + ret = imx_pcie_enable_ref_clk(imx_pcie); if (ret) { dev_err(dev, "unable to enable pcie ref clock\n"); goto err_ref_clk; @@ -679,41 +679,41 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) return 0; err_ref_clk: - clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); return ret; } -static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie) +static void imx_pcie_clk_disable(struct imx_pcie *imx_pcie) { - imx6_pcie_disable_ref_clk(imx6_pcie); - clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + imx_pcie_disable_ref_clk(imx_pcie); + clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); } -static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) +static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) { - reset_control_assert(imx6_pcie->pciephy_reset); - reset_control_assert(imx6_pcie->apps_reset); + reset_control_assert(imx_pcie->pciephy_reset); + reset_control_assert(imx_pcie->apps_reset); - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, IMX6SX_GPR12_PCIE_TEST_POWERDOWN); /* Force PCIe PHY reset */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR5, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, IMX6SX_GPR5_PCIE_BTNRST_RESET); break; case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, IMX6Q_GPR1_PCIE_SW_RST); break; case IMX6Q: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16); break; default: @@ -721,47 +721,47 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) } /* Some boards don't have PCIe reset GPIO. */ - if (gpio_is_valid(imx6_pcie->reset_gpio)) - gpio_set_value_cansleep(imx6_pcie->reset_gpio, - imx6_pcie->gpio_active_high); + if (gpio_is_valid(imx_pcie->reset_gpio)) + gpio_set_value_cansleep(imx_pcie->reset_gpio, + imx_pcie->gpio_active_high); } -static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) +static int imx_pcie_deassert_core_reset(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct device *dev = pci->dev; - reset_control_deassert(imx6_pcie->pciephy_reset); + reset_control_deassert(imx_pcie->pciephy_reset); - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX7D: /* Workaround for ERR010728, failure of PCI-e PLL VCO to * oscillate, especially when cold. This turns off "Duty-cycle * Corrector" and other mysterious undocumented things. */ - if (likely(imx6_pcie->phy_base)) { + if (likely(imx_pcie->phy_base)) { /* De-assert DCC_FB_EN */ writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, - imx6_pcie->phy_base + PCIE_PHY_CMN_REG4); + imx_pcie->phy_base + PCIE_PHY_CMN_REG4); /* Assert RX_EQS and RX_EQS_SEL */ writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL | PCIE_PHY_CMN_REG24_RX_EQ, - imx6_pcie->phy_base + PCIE_PHY_CMN_REG24); + imx_pcie->phy_base + PCIE_PHY_CMN_REG24); /* Assert ATT_MODE */ writel(PCIE_PHY_CMN_REG26_ATT_MODE, - imx6_pcie->phy_base + PCIE_PHY_CMN_REG26); + imx_pcie->phy_base + PCIE_PHY_CMN_REG26); } else { dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); } - imx7d_pcie_wait_for_phy_pll_lock(imx6_pcie); + imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); break; case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR5, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, 0); break; case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, 0); usleep_range(200, 500); @@ -771,10 +771,10 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) } /* Some boards don't have PCIe reset GPIO. */ - if (gpio_is_valid(imx6_pcie->reset_gpio)) { + if (gpio_is_valid(imx_pcie->reset_gpio)) { msleep(100); - gpio_set_value_cansleep(imx6_pcie->reset_gpio, - !imx6_pcie->gpio_active_high); + gpio_set_value_cansleep(imx_pcie->reset_gpio, + !imx_pcie->gpio_active_high); /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ msleep(100); } @@ -782,9 +782,9 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) return 0; } -static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) +static int imx_pcie_wait_for_speed_change(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct device *dev = pci->dev; u32 tmp; unsigned int retries; @@ -801,33 +801,33 @@ static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) return -ETIMEDOUT; } -static void imx6_pcie_ltssm_enable(struct device *dev) +static void imx_pcie_ltssm_enable(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; if (drvdata->ltssm_mask) - regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, + regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, drvdata->ltssm_mask); - reset_control_deassert(imx6_pcie->apps_reset); + reset_control_deassert(imx_pcie->apps_reset); } -static void imx6_pcie_ltssm_disable(struct device *dev) +static void imx_pcie_ltssm_disable(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; if (drvdata->ltssm_mask) - regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->ltssm_off, + regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, 0); - reset_control_assert(imx6_pcie->apps_reset); + reset_control_assert(imx_pcie->apps_reset); } -static int imx6_pcie_start_link(struct dw_pcie *pci) +static int imx_pcie_start_link(struct dw_pcie *pci) { - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); struct device *dev = pci->dev; u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); u32 tmp; @@ -846,7 +846,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) dw_pcie_dbi_ro_wr_dis(pci); /* Start LTSSM. */ - imx6_pcie_ltssm_enable(dev); + imx_pcie_ltssm_enable(dev); ret = dw_pcie_wait_for_link(pci); if (ret) @@ -869,8 +869,8 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp); dw_pcie_dbi_ro_wr_dis(pci); - if (imx6_pcie->drvdata->flags & - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE) { + if (imx_pcie->drvdata->flags & + IMX_PCIE_FLAG_IMX_SPEED_CHANGE) { /* * On i.MX7, DIRECT_SPEED_CHANGE behaves differently * from i.MX6 family when no link speed transition @@ -880,7 +880,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) * failure. */ - ret = imx6_pcie_wait_for_speed_change(imx6_pcie); + ret = imx_pcie_wait_for_speed_change(imx_pcie); if (ret) { dev_err(dev, "Failed to bring link up!\n"); goto err_reset_phy; @@ -895,37 +895,37 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) dev_info(dev, "Link: Only Gen1 is enabled\n"); } - imx6_pcie->link_is_up = true; + imx_pcie->link_is_up = true; tmp = dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKSTA); dev_info(dev, "Link up, Gen%i\n", tmp & PCI_EXP_LNKSTA_CLS); return 0; err_reset_phy: - imx6_pcie->link_is_up = false; + imx_pcie->link_is_up = false; dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n", dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0), dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1)); - imx6_pcie_reset_phy(imx6_pcie); + imx_pcie_reset_phy(imx_pcie); return 0; } -static void imx6_pcie_stop_link(struct dw_pcie *pci) +static void imx_pcie_stop_link(struct dw_pcie *pci) { struct device *dev = pci->dev; /* Turn off PCIe LTSSM */ - imx6_pcie_ltssm_disable(dev); + imx_pcie_ltssm_disable(dev); } -static int imx6_pcie_host_init(struct dw_pcie_rp *pp) +static int imx_pcie_host_init(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct device *dev = pci->dev; - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); int ret; - if (imx6_pcie->vpcie) { - ret = regulator_enable(imx6_pcie->vpcie); + if (imx_pcie->vpcie) { + ret = regulator_enable(imx_pcie->vpcie); if (ret) { dev_err(dev, "failed to enable vpcie regulator: %d\n", ret); @@ -933,83 +933,83 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) } } - imx6_pcie_assert_core_reset(imx6_pcie); + imx_pcie_assert_core_reset(imx_pcie); - if (imx6_pcie->drvdata->init_phy) - imx6_pcie->drvdata->init_phy(imx6_pcie); + if (imx_pcie->drvdata->init_phy) + imx_pcie->drvdata->init_phy(imx_pcie); - imx6_pcie_configure_type(imx6_pcie); + imx_pcie_configure_type(imx_pcie); - ret = imx6_pcie_clk_enable(imx6_pcie); + ret = imx_pcie_clk_enable(imx_pcie); if (ret) { dev_err(dev, "unable to enable pcie clocks: %d\n", ret); goto err_reg_disable; } - if (imx6_pcie->phy) { - ret = phy_init(imx6_pcie->phy); + if (imx_pcie->phy) { + ret = phy_init(imx_pcie->phy); if (ret) { dev_err(dev, "pcie PHY power up failed\n"); goto err_clk_disable; } } - if (imx6_pcie->phy) { - ret = phy_power_on(imx6_pcie->phy); + if (imx_pcie->phy) { + ret = phy_power_on(imx_pcie->phy); if (ret) { dev_err(dev, "waiting for PHY ready timeout!\n"); goto err_phy_off; } } - ret = imx6_pcie_deassert_core_reset(imx6_pcie); + ret = imx_pcie_deassert_core_reset(imx_pcie); if (ret < 0) { dev_err(dev, "pcie deassert core reset failed: %d\n", ret); goto err_phy_off; } - imx6_setup_phy_mpll(imx6_pcie); + imx_setup_phy_mpll(imx_pcie); return 0; err_phy_off: - if (imx6_pcie->phy) - phy_exit(imx6_pcie->phy); + if (imx_pcie->phy) + phy_exit(imx_pcie->phy); err_clk_disable: - imx6_pcie_clk_disable(imx6_pcie); + imx_pcie_clk_disable(imx_pcie); err_reg_disable: - if (imx6_pcie->vpcie) - regulator_disable(imx6_pcie->vpcie); + if (imx_pcie->vpcie) + regulator_disable(imx_pcie->vpcie); return ret; } -static void imx6_pcie_host_exit(struct dw_pcie_rp *pp) +static void imx_pcie_host_exit(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); - if (imx6_pcie->phy) { - if (phy_power_off(imx6_pcie->phy)) + if (imx_pcie->phy) { + if (phy_power_off(imx_pcie->phy)) dev_err(pci->dev, "unable to power off PHY\n"); - phy_exit(imx6_pcie->phy); + phy_exit(imx_pcie->phy); } - imx6_pcie_clk_disable(imx6_pcie); + imx_pcie_clk_disable(imx_pcie); - if (imx6_pcie->vpcie) - regulator_disable(imx6_pcie->vpcie); + if (imx_pcie->vpcie) + regulator_disable(imx_pcie->vpcie); } -static const struct dw_pcie_host_ops imx6_pcie_host_ops = { - .init = imx6_pcie_host_init, - .deinit = imx6_pcie_host_exit, +static const struct dw_pcie_host_ops imx_pcie_host_ops = { + .init = imx_pcie_host_init, + .deinit = imx_pcie_host_exit, }; static const struct dw_pcie_ops dw_pcie_ops = { - .start_link = imx6_pcie_start_link, - .stop_link = imx6_pcie_stop_link, + .start_link = imx_pcie_start_link, + .stop_link = imx_pcie_stop_link, }; -static void imx6_pcie_ep_init(struct dw_pcie_ep *ep) +static void imx_pcie_ep_init(struct dw_pcie_ep *ep) { enum pci_barno bar; struct dw_pcie *pci = to_dw_pcie_from_ep(ep); @@ -1018,7 +1018,7 @@ static void imx6_pcie_ep_init(struct dw_pcie_ep *ep) dw_pcie_ep_reset_bar(pci, bar); } -static int imx6_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, +static int imx_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, unsigned int type, u16 interrupt_num) { struct dw_pcie *pci = to_dw_pcie_from_ep(ep); @@ -1065,35 +1065,35 @@ static const struct pci_epc_features imx95_pcie_epc_features = { }; static const struct pci_epc_features* -imx6_pcie_ep_get_features(struct dw_pcie_ep *ep) +imx_pcie_ep_get_features(struct dw_pcie_ep *ep) { struct dw_pcie *pci = to_dw_pcie_from_ep(ep); - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); - return imx6_pcie->drvdata->epc_features; + return imx_pcie->drvdata->epc_features; } static const struct dw_pcie_ep_ops pcie_ep_ops = { - .init = imx6_pcie_ep_init, - .raise_irq = imx6_pcie_ep_raise_irq, - .get_features = imx6_pcie_ep_get_features, + .init = imx_pcie_ep_init, + .raise_irq = imx_pcie_ep_raise_irq, + .get_features = imx_pcie_ep_get_features, }; -static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, +static int imx_add_pcie_ep(struct imx_pcie *imx_pcie, struct platform_device *pdev) { int ret; unsigned int pcie_dbi2_offset; struct dw_pcie_ep *ep; - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; struct dw_pcie_rp *pp = &pci->pp; struct device *dev = pci->dev; - imx6_pcie_host_init(pp); + imx_pcie_host_init(pp); ep = &pci->ep; ep->ops = &pcie_ep_ops; - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX8MQ_EP: case IMX8MM_EP: case IMX8MP_EP: @@ -1115,10 +1115,10 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, if (device_property_match_string(dev, "reg-names", "dbi2") >= 0) pci->dbi_base2 = NULL; - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_SUPPORT_64BIT)) + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_SUPPORT_64BIT)) dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); - ep->page_size = imx6_pcie->drvdata->epc_features->align; + ep->page_size = imx_pcie->drvdata->epc_features->align; ret = dw_pcie_ep_init(ep); if (ret) { @@ -1136,30 +1136,30 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, dw_pcie_ep_init_notify(ep); /* Start LTSSM. */ - imx6_pcie_ltssm_enable(dev); + imx_pcie_ltssm_enable(dev); return 0; } -static void imx6_pcie_pm_turnoff(struct imx6_pcie *imx6_pcie) +static void imx_pcie_pm_turnoff(struct imx_pcie *imx_pcie) { - struct device *dev = imx6_pcie->pci->dev; + struct device *dev = imx_pcie->pci->dev; /* Some variants have a turnoff reset in DT */ - if (imx6_pcie->turnoff_reset) { - reset_control_assert(imx6_pcie->turnoff_reset); - reset_control_deassert(imx6_pcie->turnoff_reset); + if (imx_pcie->turnoff_reset) { + reset_control_assert(imx_pcie->turnoff_reset); + reset_control_deassert(imx_pcie->turnoff_reset); goto pm_turnoff_sleep; } /* Others poke directly at IOMUXC registers */ - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX6SX: case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF, IMX6SX_GPR12_PCIE_PM_TURN_OFF); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_PM_TURN_OFF, 0); break; default: @@ -1178,73 +1178,73 @@ static void imx6_pcie_pm_turnoff(struct imx6_pcie *imx6_pcie) usleep_range(1000, 10000); } -static void imx6_pcie_msi_save_restore(struct imx6_pcie *imx6_pcie, bool save) +static void imx_pcie_msi_save_restore(struct imx_pcie *imx_pcie, bool save) { u8 offset; u16 val; - struct dw_pcie *pci = imx6_pcie->pci; + struct dw_pcie *pci = imx_pcie->pci; if (pci_msi_enabled()) { offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); if (save) { val = dw_pcie_readw_dbi(pci, offset + PCI_MSI_FLAGS); - imx6_pcie->msi_ctrl = val; + imx_pcie->msi_ctrl = val; } else { dw_pcie_dbi_ro_wr_en(pci); - val = imx6_pcie->msi_ctrl; + val = imx_pcie->msi_ctrl; dw_pcie_writew_dbi(pci, offset + PCI_MSI_FLAGS, val); dw_pcie_dbi_ro_wr_dis(pci); } } } -static int imx6_pcie_suspend_noirq(struct device *dev) +static int imx_pcie_suspend_noirq(struct device *dev) { - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - struct dw_pcie_rp *pp = &imx6_pcie->pci->pp; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + struct dw_pcie_rp *pp = &imx_pcie->pci->pp; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND)) return 0; - imx6_pcie_msi_save_restore(imx6_pcie, true); - imx6_pcie_pm_turnoff(imx6_pcie); - imx6_pcie_stop_link(imx6_pcie->pci); - imx6_pcie_host_exit(pp); + imx_pcie_msi_save_restore(imx_pcie, true); + imx_pcie_pm_turnoff(imx_pcie); + imx_pcie_stop_link(imx_pcie->pci); + imx_pcie_host_exit(pp); return 0; } -static int imx6_pcie_resume_noirq(struct device *dev) +static int imx_pcie_resume_noirq(struct device *dev) { int ret; - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - struct dw_pcie_rp *pp = &imx6_pcie->pci->pp; + struct imx_pcie *imx_pcie = dev_get_drvdata(dev); + struct dw_pcie_rp *pp = &imx_pcie->pci->pp; - if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND)) + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND)) return 0; - ret = imx6_pcie_host_init(pp); + ret = imx_pcie_host_init(pp); if (ret) return ret; - imx6_pcie_msi_save_restore(imx6_pcie, false); + imx_pcie_msi_save_restore(imx_pcie, false); dw_pcie_setup_rc(pp); - if (imx6_pcie->link_is_up) - imx6_pcie_start_link(imx6_pcie->pci); + if (imx_pcie->link_is_up) + imx_pcie_start_link(imx_pcie->pci); return 0; } -static const struct dev_pm_ops imx6_pcie_pm_ops = { - NOIRQ_SYSTEM_SLEEP_PM_OPS(imx6_pcie_suspend_noirq, - imx6_pcie_resume_noirq) +static const struct dev_pm_ops imx_pcie_pm_ops = { + NOIRQ_SYSTEM_SLEEP_PM_OPS(imx_pcie_suspend_noirq, + imx_pcie_resume_noirq) }; -static int imx6_pcie_probe(struct platform_device *pdev) +static int imx_pcie_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct dw_pcie *pci; - struct imx6_pcie *imx6_pcie; + struct imx_pcie *imx_pcie; struct device_node *np; struct resource *dbi_base; struct device_node *node = dev->of_node; @@ -1252,8 +1252,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) u16 val; int i; - imx6_pcie = devm_kzalloc(dev, sizeof(*imx6_pcie), GFP_KERNEL); - if (!imx6_pcie) + imx_pcie = devm_kzalloc(dev, sizeof(*imx_pcie), GFP_KERNEL); + if (!imx_pcie) return -ENOMEM; pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); @@ -1262,10 +1262,10 @@ static int imx6_pcie_probe(struct platform_device *pdev) pci->dev = dev; pci->ops = &dw_pcie_ops; - pci->pp.ops = &imx6_pcie_host_ops; + pci->pp.ops = &imx_pcie_host_ops; - imx6_pcie->pci = pci; - imx6_pcie->drvdata = of_device_get_match_data(dev); + imx_pcie->pci = pci; + imx_pcie->drvdata = of_device_get_match_data(dev); /* Find the PHY if one is defined, only imx7d uses it */ np = of_parse_phandle(node, "fsl,imx7d-pcie-phy", 0); @@ -1277,9 +1277,9 @@ static int imx6_pcie_probe(struct platform_device *pdev) dev_err(dev, "Unable to map PCIe PHY\n"); return ret; } - imx6_pcie->phy_base = devm_ioremap_resource(dev, &res); - if (IS_ERR(imx6_pcie->phy_base)) - return PTR_ERR(imx6_pcie->phy_base); + imx_pcie->phy_base = devm_ioremap_resource(dev, &res); + if (IS_ERR(imx_pcie->phy_base)) + return PTR_ERR(imx_pcie->phy_base); } pci->dbi_base = devm_platform_get_and_ioremap_resource(pdev, 0, &dbi_base); @@ -1287,12 +1287,12 @@ static int imx6_pcie_probe(struct platform_device *pdev) return PTR_ERR(pci->dbi_base); /* Fetch GPIOs */ - imx6_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0); - imx6_pcie->gpio_active_high = of_property_read_bool(node, + imx_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0); + imx_pcie->gpio_active_high = of_property_read_bool(node, "reset-gpio-active-high"); - if (gpio_is_valid(imx6_pcie->reset_gpio)) { - ret = devm_gpio_request_one(dev, imx6_pcie->reset_gpio, - imx6_pcie->gpio_active_high ? + if (gpio_is_valid(imx_pcie->reset_gpio)) { + ret = devm_gpio_request_one(dev, imx_pcie->reset_gpio, + imx_pcie->gpio_active_high ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW, "PCIe reset"); @@ -1300,70 +1300,70 @@ static int imx6_pcie_probe(struct platform_device *pdev) dev_err(dev, "unable to get reset gpio\n"); return ret; } - } else if (imx6_pcie->reset_gpio == -EPROBE_DEFER) { - return imx6_pcie->reset_gpio; + } else if (imx_pcie->reset_gpio == -EPROBE_DEFER) { + return imx_pcie->reset_gpio; } - if (imx6_pcie->drvdata->clks_cnt >= IMX6_PCIE_MAX_CLKS) + if (imx_pcie->drvdata->clks_cnt >= IMX_PCIE_MAX_CLKS) return dev_err_probe(dev, -ENOMEM, "clks_cnt is too big\n"); - for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) - imx6_pcie->clks[i].id = imx6_pcie->drvdata->clk_names[i]; + for (i = 0; i < imx_pcie->drvdata->clks_cnt; i++) + imx_pcie->clks[i].id = imx_pcie->drvdata->clk_names[i]; /* Fetch clocks */ - ret = devm_clk_bulk_get(dev, imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + ret = devm_clk_bulk_get(dev, imx_pcie->drvdata->clks_cnt, imx_pcie->clks); if (ret) return ret; - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_PHYDRV)) { - imx6_pcie->phy = devm_phy_get(dev, "pcie-phy"); - if (IS_ERR(imx6_pcie->phy)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->phy), + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_PHYDRV)) { + imx_pcie->phy = devm_phy_get(dev, "pcie-phy"); + if (IS_ERR(imx_pcie->phy)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->phy), "failed to get pcie phy\n"); } - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_APP_RESET)) { - imx6_pcie->apps_reset = devm_reset_control_get_exclusive(dev, "apps"); - if (IS_ERR(imx6_pcie->apps_reset)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->apps_reset), + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_APP_RESET)) { + imx_pcie->apps_reset = devm_reset_control_get_exclusive(dev, "apps"); + if (IS_ERR(imx_pcie->apps_reset)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->apps_reset), "failed to get pcie apps reset control\n"); } - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_PHY_RESET)) { - imx6_pcie->pciephy_reset = devm_reset_control_get_exclusive(dev, "pciephy"); - if (IS_ERR(imx6_pcie->pciephy_reset)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pciephy_reset), + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_PHY_RESET)) { + imx_pcie->pciephy_reset = devm_reset_control_get_exclusive(dev, "pciephy"); + if (IS_ERR(imx_pcie->pciephy_reset)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->pciephy_reset), "Failed to get PCIEPHY reset control\n"); } - switch (imx6_pcie->drvdata->variant) { + switch (imx_pcie->drvdata->variant) { case IMX8MQ: case IMX8MQ_EP: case IMX7D: if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) - imx6_pcie->controller_id = 1; + imx_pcie->controller_id = 1; break; default: break; } /* Grab turnoff reset */ - imx6_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); - if (IS_ERR(imx6_pcie->turnoff_reset)) { + imx_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); + if (IS_ERR(imx_pcie->turnoff_reset)) { dev_err(dev, "Failed to get TURNOFF reset control\n"); - return PTR_ERR(imx6_pcie->turnoff_reset); + return PTR_ERR(imx_pcie->turnoff_reset); } - if (imx6_pcie->drvdata->gpr) { + if (imx_pcie->drvdata->gpr) { /* Grab GPR config register range */ - imx6_pcie->iomuxc_gpr = - syscon_regmap_lookup_by_compatible(imx6_pcie->drvdata->gpr); - if (IS_ERR(imx6_pcie->iomuxc_gpr)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->iomuxc_gpr), + imx_pcie->iomuxc_gpr = + syscon_regmap_lookup_by_compatible(imx_pcie->drvdata->gpr); + if (IS_ERR(imx_pcie->iomuxc_gpr)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->iomuxc_gpr), "unable to find iomuxc registers\n"); } - if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_SERDES)) { + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_SERDES)) { void __iomem *off = devm_platform_ioremap_resource_byname(pdev, "app"); if (IS_ERR(off)) @@ -1376,59 +1376,59 @@ static int imx6_pcie_probe(struct platform_device *pdev) .reg_stride = 4, }; - imx6_pcie->iomuxc_gpr = devm_regmap_init_mmio(dev, off, ®map_config); - if (IS_ERR(imx6_pcie->iomuxc_gpr)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->iomuxc_gpr), + imx_pcie->iomuxc_gpr = devm_regmap_init_mmio(dev, off, ®map_config); + if (IS_ERR(imx_pcie->iomuxc_gpr)) + return dev_err_probe(dev, PTR_ERR(imx_pcie->iomuxc_gpr), "unable to find iomuxc registers\n"); } /* Grab PCIe PHY Tx Settings */ if (of_property_read_u32(node, "fsl,tx-deemph-gen1", - &imx6_pcie->tx_deemph_gen1)) - imx6_pcie->tx_deemph_gen1 = 0; + &imx_pcie->tx_deemph_gen1)) + imx_pcie->tx_deemph_gen1 = 0; if (of_property_read_u32(node, "fsl,tx-deemph-gen2-3p5db", - &imx6_pcie->tx_deemph_gen2_3p5db)) - imx6_pcie->tx_deemph_gen2_3p5db = 0; + &imx_pcie->tx_deemph_gen2_3p5db)) + imx_pcie->tx_deemph_gen2_3p5db = 0; if (of_property_read_u32(node, "fsl,tx-deemph-gen2-6db", - &imx6_pcie->tx_deemph_gen2_6db)) - imx6_pcie->tx_deemph_gen2_6db = 20; + &imx_pcie->tx_deemph_gen2_6db)) + imx_pcie->tx_deemph_gen2_6db = 20; if (of_property_read_u32(node, "fsl,tx-swing-full", - &imx6_pcie->tx_swing_full)) - imx6_pcie->tx_swing_full = 127; + &imx_pcie->tx_swing_full)) + imx_pcie->tx_swing_full = 127; if (of_property_read_u32(node, "fsl,tx-swing-low", - &imx6_pcie->tx_swing_low)) - imx6_pcie->tx_swing_low = 127; + &imx_pcie->tx_swing_low)) + imx_pcie->tx_swing_low = 127; /* Limit link speed */ pci->link_gen = 1; of_property_read_u32(node, "fsl,max-link-speed", &pci->link_gen); - imx6_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie"); - if (IS_ERR(imx6_pcie->vpcie)) { - if (PTR_ERR(imx6_pcie->vpcie) != -ENODEV) - return PTR_ERR(imx6_pcie->vpcie); - imx6_pcie->vpcie = NULL; + imx_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie"); + if (IS_ERR(imx_pcie->vpcie)) { + if (PTR_ERR(imx_pcie->vpcie) != -ENODEV) + return PTR_ERR(imx_pcie->vpcie); + imx_pcie->vpcie = NULL; } - imx6_pcie->vph = devm_regulator_get_optional(&pdev->dev, "vph"); - if (IS_ERR(imx6_pcie->vph)) { - if (PTR_ERR(imx6_pcie->vph) != -ENODEV) - return PTR_ERR(imx6_pcie->vph); - imx6_pcie->vph = NULL; + imx_pcie->vph = devm_regulator_get_optional(&pdev->dev, "vph"); + if (IS_ERR(imx_pcie->vph)) { + if (PTR_ERR(imx_pcie->vph) != -ENODEV) + return PTR_ERR(imx_pcie->vph); + imx_pcie->vph = NULL; } - platform_set_drvdata(pdev, imx6_pcie); + platform_set_drvdata(pdev, imx_pcie); - ret = imx6_pcie_attach_pd(dev); + ret = imx_pcie_attach_pd(dev); if (ret) return ret; - if (imx6_pcie->drvdata->mode == DW_PCIE_EP_TYPE) { - ret = imx6_add_pcie_ep(imx6_pcie, pdev); + if (imx_pcie->drvdata->mode == DW_PCIE_EP_TYPE) { + ret = imx_add_pcie_ep(imx_pcie, pdev); if (ret < 0) return ret; } else { @@ -1448,12 +1448,12 @@ static int imx6_pcie_probe(struct platform_device *pdev) return 0; } -static void imx6_pcie_shutdown(struct platform_device *pdev) +static void imx_pcie_shutdown(struct platform_device *pdev) { - struct imx6_pcie *imx6_pcie = platform_get_drvdata(pdev); + struct imx_pcie *imx_pcie = platform_get_drvdata(pdev); /* bring down link, so bootloader gets clean state in case of reboot */ - imx6_pcie_assert_core_reset(imx6_pcie); + imx_pcie_assert_core_reset(imx_pcie); } static const char * const imx6q_clks[] = {"pcie_bus", "pcie", "pcie_phy"}; @@ -1461,11 +1461,11 @@ static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"}; static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}; static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"}; -static const struct imx6_pcie_drvdata drvdata[] = { +static const struct imx_pcie_drvdata drvdata[] = { [IMX6Q] = { .variant = IMX6Q, - .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, + .flags = IMX_PCIE_FLAG_IMX_PHY | + IMX_PCIE_FLAG_IMX_SPEED_CHANGE, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6q_clks, @@ -1474,13 +1474,13 @@ static const struct imx6_pcie_drvdata drvdata[] = { .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, - .init_phy = imx6_pcie_init_phy, + .init_phy = imx_pcie_init_phy, }, [IMX6SX] = { .variant = IMX6SX, - .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | - IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX_PCIE_FLAG_IMX_PHY | + IMX_PCIE_FLAG_IMX_SPEED_CHANGE | + IMX_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6sx_clks, .clks_cnt = ARRAY_SIZE(imx6sx_clks), @@ -1492,9 +1492,9 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX6QP] = { .variant = IMX6QP, - .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | - IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX_PCIE_FLAG_IMX_PHY | + IMX_PCIE_FLAG_IMX_SPEED_CHANGE | + IMX_PCIE_FLAG_SUPPORTS_SUSPEND, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6q_clks, @@ -1503,13 +1503,13 @@ static const struct imx6_pcie_drvdata drvdata[] = { .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, - .init_phy = imx6_pcie_init_phy, + .init_phy = imx_pcie_init_phy, }, [IMX7D] = { .variant = IMX7D, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHY_RESET, + .flags = IMX_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx7d-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), @@ -1519,8 +1519,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MQ] = { .variant = IMX8MQ, - .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHY_RESET, + .flags = IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), @@ -1532,9 +1532,9 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM] = { .variant = IMX8MM, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_PHYDRV | - IMX6_PCIE_FLAG_HAS_APP_RESET, + .flags = IMX_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX_PCIE_FLAG_HAS_PHYDRV | + IMX_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), @@ -1543,9 +1543,9 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MP] = { .variant = IMX8MP, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_PHYDRV | - IMX6_PCIE_FLAG_HAS_APP_RESET, + .flags = IMX_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX_PCIE_FLAG_HAS_PHYDRV | + IMX_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), @@ -1554,7 +1554,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX95] = { .variant = IMX95, - .flags = IMX6_PCIE_FLAG_HAS_SERDES, + .flags = IMX_PCIE_FLAG_HAS_SERDES, .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), .ltssm_off = IMX95_PE0_GEN_CTRL_3, @@ -1565,8 +1565,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, - .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHY_RESET, + .flags = IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHY_RESET, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, @@ -1580,8 +1580,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM_EP] = { .variant = IMX8MM_EP, - .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHYDRV, + .flags = IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, @@ -1592,8 +1592,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MP_EP] = { .variant = IMX8MP_EP, - .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | - IMX6_PCIE_FLAG_HAS_PHYDRV, + .flags = IMX_PCIE_FLAG_HAS_APP_RESET | + IMX_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, @@ -1604,8 +1604,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX95_EP] = { .variant = IMX95_EP, - .flags = IMX6_PCIE_FLAG_HAS_SERDES | - IMX6_PCIE_FLAG_SUPPORT_64BIT, + .flags = IMX_PCIE_FLAG_HAS_SERDES | + IMX_PCIE_FLAG_SUPPORT_64BIT, .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), .ltssm_off = IMX95_PE0_GEN_CTRL_3, @@ -1618,7 +1618,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, }; -static const struct of_device_id imx6_pcie_of_match[] = { +static const struct of_device_id imx_pcie_of_match[] = { { .compatible = "fsl,imx6q-pcie", .data = &drvdata[IMX6Q], }, { .compatible = "fsl,imx6sx-pcie", .data = &drvdata[IMX6SX], }, { .compatible = "fsl,imx6qp-pcie", .data = &drvdata[IMX6QP], }, @@ -1634,19 +1634,19 @@ static const struct of_device_id imx6_pcie_of_match[] = { {}, }; -static struct platform_driver imx6_pcie_driver = { +static struct platform_driver imx_pcie_driver = { .driver = { .name = "imx6q-pcie", - .of_match_table = imx6_pcie_of_match, + .of_match_table = imx_pcie_of_match, .suppress_bind_attrs = true, - .pm = &imx6_pcie_pm_ops, + .pm = &imx_pcie_pm_ops, .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, - .probe = imx6_pcie_probe, - .shutdown = imx6_pcie_shutdown, + .probe = imx_pcie_probe, + .shutdown = imx_pcie_shutdown, }; -static void imx6_pcie_quirk(struct pci_dev *dev) +static void imx_pcie_quirk(struct pci_dev *dev) { struct pci_bus *bus = dev->bus; struct dw_pcie_rp *pp = bus->sysdata; @@ -1656,33 +1656,33 @@ static void imx6_pcie_quirk(struct pci_dev *dev) return; /* Make sure we only quirk devices associated with this driver */ - if (bus->dev.parent->parent->driver != &imx6_pcie_driver.driver) + if (bus->dev.parent->parent->driver != &imx_pcie_driver.driver) return; if (pci_is_root_bus(bus)) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + struct imx_pcie *imx_pcie = to_imx_pcie(pci); /* * Limit config length to avoid the kernel reading beyond * the register set and causing an abort on i.MX 6Quad */ - if (imx6_pcie->drvdata->dbi_length) { - dev->cfg_size = imx6_pcie->drvdata->dbi_length; + if (imx_pcie->drvdata->dbi_length) { + dev->cfg_size = imx_pcie->drvdata->dbi_length; dev_info(&dev->dev, "Limiting cfg_size to %d\n", dev->cfg_size); } } } DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, 0xabcd, - PCI_CLASS_BRIDGE_PCI, 8, imx6_pcie_quirk); + PCI_CLASS_BRIDGE_PCI, 8, imx_pcie_quirk); -static int __init imx6_pcie_init(void) +static int __init imx_pcie_init(void) { #ifdef CONFIG_ARM struct device_node *np; - np = of_find_matching_node(NULL, imx6_pcie_of_match); + np = of_find_matching_node(NULL, imx_pcie_of_match); if (!np) return -ENODEV; of_node_put(np); @@ -1698,6 +1698,6 @@ static int __init imx6_pcie_init(void) "external abort on non-linefetch"); #endif - return platform_driver_register(&imx6_pcie_driver); + return platform_driver_register(&imx_pcie_driver); } -device_initcall(imx6_pcie_init); +device_initcall(imx_pcie_init); From patchwork Mon Jun 17 20:16:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13701358 X-Patchwork-Delegate: kw@linux.com Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2085.outbound.protection.outlook.com [40.107.103.85]) (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 106C51993BF; Mon, 17 Jun 2024 20:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655460; cv=fail; b=GWeolESqcS/8eVdLOKOBqYpRYUUrKFLn3ESGGkoyWFQx1hLA+i8dlfT2/1ZCq0gAsJfLjhqFNyrPXmbaT3x9w8j0OLgfbCtQWiCB75kShIjuWUEOvSwCklCnY+g8Y8yalRkqWBKj7/0Ftqe1ozketRT/kB21d/QoJtToK4GX46E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655460; c=relaxed/simple; bh=AfTVrCLrEti1105wDAcVWo6jI2pjgIWKJzNX5Ep+/9w=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=RfA6r8MfxspUSIqcZxRWX3vieZl/NFBVWjM/7AoPO/mxW8Ei/OI4USTAmnYeHvvelygDoC2izloqPrxozGFdNoIcZYhblUvoZ9UYv68gG18xoAPVqt5LF+mPzxu+NXabii3uTPKdfvh9b77u2EZqm6QSWMGjVJzbsg8/29pQemo= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=LRBotwml; arc=fail smtp.client-ip=40.107.103.85 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="LRBotwml" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hedIVkg2El+B0dZN6ylBwMn4jMFw7MZYdvKR6t8CTk7mIzL45MUdBfqT3W4Odg6CXgWnpQNcz4JAIe+1hPbe2RKznTBZb/rm5Gq9Ima4CkL5L2ImyrFZlu0ZTj3wNJA2tVPFkZi1jtbMTe/T6voi2tZTzJIxzvqzjo2+n8EPGcijp0FUo0IGlWXm1bU/gz7BinJ09AaJPPQX5xfSAIML1tv8DFjrsdnyBtzlnGh11SlnaFo8h1UvsUQmjNtgULJjHILxD1Tk7fPxHpDVGtRxpt9LgkNk/feht86Yo26biGBbPmvXI4cuYuxHGHr7LtZsJqS9Ek5H35rxjVIvCgRqFw== 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=BFZ9y59NHvkPdCbZdfCtsYWQoubEyRTUZZdNbOF+uvs=; b=iYK9MImEKSyDpboKcRFA/PCszi4Izq7NCBOmR+1xorUMjmLv3vT5KcVn/O8BPIbiW0RfaBeRmU2Gm02snZLu+X3M9zT6P15hDG8Xpx831Lfjy8hW8VR+JPYCL6ZGPh+5FEH0/KTD0vP2TzzXLEsazlifxL5tG4M+yp2U7VzAlOtRq0vlXAu+IbrNTgsCuVGwFMzF3HhuED3CCOIr9gLea/E+qyIEEHUCyHjWHc7qLWNICcJ4drd+ukXf8RVgOoEgDrIgzaILprDwG9kSyfbULr2sdcqAJezIOHDxNh0zE0wNI1diLVpHcv/kV3TmNELYc+sKEUGoHkXyntJo0Qv5Kw== 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=BFZ9y59NHvkPdCbZdfCtsYWQoubEyRTUZZdNbOF+uvs=; b=LRBotwmlZHkreOaahvdfj3XurXFdMiWHK7MufhY41XsMcjrshT01rT9++7LKdewI9nEearDil1qHrDsEy29E8diPkX5C5zhIxRIaZ+16Ln0XuyOTmm7J2XBAu5QDkmOUH7tVj7ghKbA4g7qkjFosOnEkyKMUcAvLu7ADbRxlNVg= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:17:35 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:17:35 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:40 -0400 Subject: [PATCH v6 04/10] PCI: imx6: Introduce SoC specific callbacks for controlling REFCLK Message-Id: <20240617-pci2_upstream-v6-4-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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=1718655424; l=8294; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=AfTVrCLrEti1105wDAcVWo6jI2pjgIWKJzNX5Ep+/9w=; b=1Jmd0QbXMPxXo3v3/vatM08XLdpHfMiGbqmJnhHDVAXFbCE2KLER23dNPPZDb0nCj74uRnziJ VBowt2kmJrdD60z5T8ImK/30Qg7gxFz4YFzfeOge6jJtzkg98mKWqNX X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) 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_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: 99f2cad9-2e60-45f0-f5e3-08dc8f0a86b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?v0DG3AYuIJvcVpA0fobPNL/f3px4tNQ?= =?utf-8?q?8IeW9UMWKm1kI3TVGzaV2x78SpfsIH4MmX4INjvOB1+OxvRfZi12hT+BUo0V6HbWq?= =?utf-8?q?7WD6Ra6AJItU+5Io7ii7hbtylrfz1JFaKqdrPymKXtaibKuFOyS/wcwPXYYf7Pd5+?= =?utf-8?q?/CMOuuXxCwSCJOSp8xEImaubwS74maTeQHm9Z6XN1DhG+uTf9Wgwgah+jC7/OkLZ6?= =?utf-8?q?B3ot4/lgGz1FT2h7UJtrjzQnILHrGNMzIVc3Sx61gJIPFBtStCO3YrxqDZmA3Cd5M?= =?utf-8?q?3cKvQwcfOO9OzBIffGQ9N8Sf/nAOU2DbYGTm35yRoBC9JDWXHpvKOQdPBJugtZhWs?= =?utf-8?q?Z7pLgDXbXYQIbm+3llGAwiHqdvuMEIw8cBB6tFOinvc9K9JaYRDbwChSvcLmEBNYJ?= =?utf-8?q?dS0HdZXwSvRMA8Ci2jf8zQC12CXHBH8U+H6IY6Gd3O7TG3Jw2EAuxsP2jkdn9qbDe?= =?utf-8?q?2NV4kofj4w+p9y5H8jXcbgVdGpH2dTVx09GcOFMHWa3JfRI24j3KQfLIVlieM+T/W?= =?utf-8?q?+I0ifMsL32QfQCuapoWWj+a9W/ZT61Ogzamh0CAk/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;CAT:NONE;SFS:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2XA8hYVckA1MzqM5kA7RaGcwJ2iE?= =?utf-8?q?WGUlN2/OdimQZ9OXJUu5rlQTxjYAlPWi1lWyIuhwSiNOUlOoxCSWKIHbtW3Q8xxV+?= =?utf-8?q?MoaNdRPDQxBbMcEErNLcCJVFtUKJZxTQ+El5oi8V5Dw2m/KqzNzCbmRA7Mc8bIl39?= =?utf-8?q?lT7mA0rn21kZjXe02/IRL5PAVicolRBnICbHtqgffSW2B4bsUBPVvcdvPee7gNXDG?= =?utf-8?q?54W2hjZJIi8HDW1KS1vh0lPjCiV6PRwap9Vc4KP5yMafZoBJF8v7qNd+4MOeFyIsS?= =?utf-8?q?w5QQui/rKVrW0Xym0igDGjkaZVzrtBmu2CTuyVI3AlddIQjVON4M1b0sYil7t9/lv?= =?utf-8?q?/w6wU4hHbE7oCfa/oVVmx89D1uZs5EAaCiGNlcJKTRwuGjeWv6RDiZG6xAZ/eRzw6?= =?utf-8?q?SoKiwDisT+vyFq5ZCoGxTi1W+c3BIQLZIEt3ey0mTrrZIJ1hxVgCv+uGmdnfW2zwS?= =?utf-8?q?uDZWjLh0o3uO2ekBcmIBxu0NyaBr1PDZH14yLQ7rOwPdooKKvzi0IbeGP61jECKA/?= =?utf-8?q?7cGziPVzp24F1ogHcTHTtmuegmtnWdoE5BcAdDwgaLDYW8wfv+o58qJPEF0K/9KKr?= =?utf-8?q?tPxTk0hwIcZbxd0LD3cTPhM2fPuOH141uRi5DCPBHGkYfeTmH18A6D6gRF449/YX/?= =?utf-8?q?lIhBsGMLAozblS9YmcEfkBP1rmWLSe4XFGkNwbR2eeJ+YGDPVV3h35dHj5fQDd/T1?= =?utf-8?q?dYFFJYsjzPcQeNn4z9T7p6fYnYRIZhhBPZQ0js4U3XKriO32vMpZtgKP5thktJMYm?= =?utf-8?q?+PqTlQVUs/y8abzRLdUqz3aBE8zj+vTlFJMZBL0tAAchfiobqZAwlgQaplzWmzfkO?= =?utf-8?q?Ffzb/IQytriQEckaLdY1lAYtOWeBaseDMpmXMsparK2VpPoJEQ6rXO4RH8BnsmgTn?= =?utf-8?q?5ZIGAq+h79k+3kf8EM9zHtvlvpyFUtC/D8abLdi33au3cTm3EKOpbTQ9icd3k6pSE?= =?utf-8?q?NgizogyNoaDKqk83vRnN+/x1OS8e7h3HVWPqFpSNv/nZ1ULJVzDEapCo8YN0SXDDY?= =?utf-8?q?yea+vLf7IASDwu1WrTxo4ZyIpYlUAZqVD7eNgFtJf5dYUc8LG4DYXT6lYsN6uveQs?= =?utf-8?q?8vhZzrR4VTMX1U8r9CVEn48t6EU7zlx7fecoGg6ZldwyDcNcILjNeoZ6R0gQgErLh?= =?utf-8?q?ZACeIo18LGcX9AJizeI274jaCMLcBoztLiGwK6CAiPa82JIyyBmImb5mU7tiR0bCZ?= =?utf-8?q?wMuT2VEWsEw+zkeinRhlrvGsMjWDXRfKm+kMNj1gB74CYDtAAmVTs1NW9aRtljbjR?= =?utf-8?q?gJGBPRjHCEx8qI5e+iV/tYlev5ZPNTQF9r56jm2WwOVASN6rTVeGWCp/yWNdZR9fO?= =?utf-8?q?V0hywvBKHoFxkC06cmXs6CMeQ5nOHqmpvArLNrMcI6GGVLYXWmp5u+X2GzvkmIsLi?= =?utf-8?q?AErjgYqsnMZWkhXFpnV/GFCEBqWx1zLesA9dfYl2iHd1qq8YptlSUzgXJBF0Z9wPT?= =?utf-8?q?3KWl8qCgwk3ry1HcI/o/Tb/lvN0W/4+CK3Ysq+3ntzFslnH5iaMAyVXIRRQiTgf+E?= =?utf-8?q?N+pIrJhpVUqw?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99f2cad9-2e60-45f0-f5e3-08dc8f0a86b3 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:17:35.3014 (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: pzm01p0+tQuhhHiE5K5vT8eYvPR86iAPH/n9AGoPct2rK1bvLgIqtcavIRTvoCHalQFKYYN4Nar3BNrtDTMf6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 Instead of using the switch case statement to enable/disable the reference clock handled by this driver itself, let's introduce a new callback set_ref_clk() and define it for platforms that require it. This simplifies the code. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 112 ++++++++++++++++------------------ 1 file changed, 52 insertions(+), 60 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 47134e2dfecf2..ff9d0098294fa 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -103,6 +103,7 @@ struct imx_pcie_drvdata { const u32 mode_mask[IMX_PCIE_MAX_INSTANCES]; const struct pci_epc_features *epc_features; int (*init_phy)(struct imx_pcie *pcie); + int (*set_ref_clk)(struct imx_pcie *pcie, bool enable); }; struct imx_pcie { @@ -585,21 +586,19 @@ static int imx_pcie_attach_pd(struct device *dev) return 0; } -static int imx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie) +static int imx6sx_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) { - unsigned int offset; - int ret = 0; + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, + enable ? 0 : IMX6SX_GPR12_PCIE_TEST_POWERDOWN); - switch (imx_pcie->drvdata->variant) { - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0); - break; - case IMX6QP: - case IMX6Q: + return 0; +} + +static int imx6q_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) +{ + if (enable) { /* power up core phy and enable ref clock */ - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, 0); /* * the async reset input need ref clock to sync internally, * when the ref clock comes after reset, internal synced @@ -608,54 +607,34 @@ static int imx_pcie_enable_ref_clk(struct imx_pcie *imx_pcie) */ usleep_range(10, 100); regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); - break; - case IMX7D: - case IMX95: - case IMX95_EP: - break; - case IMX8MM: - case IMX8MM_EP: - case IMX8MQ: - case IMX8MQ_EP: - case IMX8MP: - case IMX8MP_EP: - offset = imx_pcie_grp_offset(imx_pcie); - /* - * Set the over ride low and enabled - * make sure that REF_CLK is turned on. - */ - regmap_update_bits(imx_pcie->iomuxc_gpr, offset, - IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, - 0); - regmap_update_bits(imx_pcie->iomuxc_gpr, offset, - IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, - IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN); - break; + IMX6Q_GPR1_PCIE_REF_CLK_EN, IMX6Q_GPR1_PCIE_REF_CLK_EN); + } else { + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_REF_CLK_EN, 0); + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_TEST_PD, IMX6Q_GPR1_PCIE_TEST_PD); } - return ret; + return 0; } -static void imx_pcie_disable_ref_clk(struct imx_pcie *imx_pcie) +static int imx8mm_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) { - switch (imx_pcie->drvdata->variant) { - case IMX6QP: - case IMX6Q: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN, 0); - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD, - IMX6Q_GPR1_PCIE_TEST_PD); - break; - case IMX7D: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, - IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); - break; - default: - break; - } + int offset = imx_pcie_grp_offset(imx_pcie); + + /* Set the over ride low and enabled make sure that REF_CLK is turned on.*/ + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE, + enable ? 0 : IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE); + regmap_update_bits(imx_pcie->iomuxc_gpr, offset, IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN, + enable ? IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE_EN : 0); + return 0; +} + +static int imx7d_pcie_set_ref_clk(struct imx_pcie *imx_pcie, bool enable) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, + enable ? 0 : IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); + return 0; } static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) @@ -668,10 +647,12 @@ static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) if (ret) return ret; - ret = imx_pcie_enable_ref_clk(imx_pcie); - if (ret) { - dev_err(dev, "unable to enable pcie ref clock\n"); - goto err_ref_clk; + if (imx_pcie->drvdata->set_ref_clk) { + ret = imx_pcie->drvdata->set_ref_clk(imx_pcie, true); + if (ret) { + dev_err(dev, "Failed to enable PCIe REFCLK\n"); + goto err_ref_clk; + } } /* allow the clocks to stabilize */ @@ -686,7 +667,8 @@ static int imx_pcie_clk_enable(struct imx_pcie *imx_pcie) static void imx_pcie_clk_disable(struct imx_pcie *imx_pcie) { - imx_pcie_disable_ref_clk(imx_pcie); + if (imx_pcie->drvdata->set_ref_clk) + imx_pcie->drvdata->set_ref_clk(imx_pcie, false); clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); } @@ -1475,6 +1457,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, + .set_ref_clk = imx6q_pcie_set_ref_clk, }, [IMX6SX] = { .variant = IMX6SX, @@ -1489,6 +1472,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx6sx_pcie_init_phy, + .set_ref_clk = imx6sx_pcie_set_ref_clk, }, [IMX6QP] = { .variant = IMX6QP, @@ -1504,6 +1488,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, + .set_ref_clk = imx6q_pcie_set_ref_clk, }, [IMX7D] = { .variant = IMX7D, @@ -1516,6 +1501,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx7d_pcie_init_phy, + .set_ref_clk = imx7d_pcie_set_ref_clk, }, [IMX8MQ] = { .variant = IMX8MQ, @@ -1529,6 +1515,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[1] = IOMUXC_GPR12, .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, .init_phy = imx8mq_pcie_init_phy, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MM] = { .variant = IMX8MM, @@ -1540,6 +1527,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx8mm_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MP] = { .variant = IMX8MP, @@ -1551,6 +1539,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx8mm_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX95] = { .variant = IMX95, @@ -1577,6 +1566,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, .init_phy = imx8mq_pcie_init_phy, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MM_EP] = { .variant = IMX8MM_EP, @@ -1589,6 +1579,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, @@ -1601,6 +1592,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, + .set_ref_clk = imx8mm_pcie_set_ref_clk, }, [IMX95_EP] = { .variant = IMX95_EP, From patchwork Mon Jun 17 20:16:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13701359 X-Patchwork-Delegate: kw@linux.com Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2086.outbound.protection.outlook.com [40.107.103.86]) (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 2AB231990D2; Mon, 17 Jun 2024 20:17:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655466; cv=fail; b=tXbni97eQGsOVd9XaUfGq9Eg4sogZkC/QB4jlG8rZ4kv22ieQJ8QUnup7BKqD3SyPDqsMorxR8Pa4G3UZRS784EEU6fgV1IY8sqOP/zU+qZ0ms1QSdLh/5oR5sgtMXfbTNj63S+zSeWHU4eYpG9f31YnSRzIY6Cy6aGilJghPOA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655466; c=relaxed/simple; bh=EnlJL+A6hrb+lx0OJcd5b43KT+ZkB7ImYpV0nsydYlM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=KpF+D/m4ejZuc5g6GUIt7HbKHBsVg4x/ID9V3djxIwsfCqTBrpGDeOe6cd0YPTqBapReTkrD61BtK6zGPuKghKKL/5ulDRlGgjscqECUqaJRjh8ty8EvtasllhQOGxNuIFtlsngJ9b9BoNuU7pTXvX3micXMEvQLQjKFWMgZ+aw= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=e9tRNIIr; arc=fail smtp.client-ip=40.107.103.86 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="e9tRNIIr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X8/Wh2ZXYHLbV0dFC3EWXP0D4Zq5zlKHP1PMzAnsLm68kzDYQ3xzmj5r+8Dpt+843a6qMcBDzj5nIZBZGxSg7Og3YMk3SSobtAgc7PbJ3TaulBn7cENaKx6IVq3HY7Y92fZxDZqKX0mXxaIVdIdwwSAqGevpfPiRD9HbVfcEXRcVJPMZSU2JEeoG8Op6F7pGe8LDnqY1EzjNbJ8A9LFFl/O4BFyhQPJmJ/0t5icsDQi+Evqg0SJug03RPMSvxFagnJsNzy4vLqkhaiZj1ZU3Ea3+kconEmKl9l2gQWP0Ug5iFt+VPI527gWp3DfcHENuZWcdlcF/GAYqCO8OIdDLjw== 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=8F78DgbEfTJ1B0b5oIHR7efzIOfShRafZmsPxBTuawY=; b=GI4phL2AFzqJZxmOMl2GwxoHTgn8YAw688zPBjPpWRNzloHLkmgwXoCDWg1/KGbFH9iGVDGvCNkc+Z3O8SJkOfFPpgcHpfvl6JElZEWn445xkvkqqG6f6eGKHjAiqODjayczT600SY51tSu3rZi9V3Q8gr8i5dKJ+VAg26ib79k2rShni9xtwCbd3htYYPdPSpvWNsmchgAYlrL0Q//IfWmHz0rmNVsS6vugCUDYp2nBH2aKfm2QNB5V+0znoh+VoslRZSV4rKS4ku3Br+J/mfnSklAdcbvP0TsMGuEzH2vwDBkMMSTQgCmHBMDxlYAApn1BxTT9UTuOF5eu9QeJmg== 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=8F78DgbEfTJ1B0b5oIHR7efzIOfShRafZmsPxBTuawY=; b=e9tRNIIr1ff5rzgMZCfGG6tfuMqJ1cY8/OfFkWKc4xUqvR6M/i2YKCKefARpajFz8hbe8/R0vKT92gGW1rguiRgv+Z2jEnY3EXymXNGcI5wAmLkjt+h1Ijb8dpccGKwctTyga0c0L4SUkmxdSQWJFPBkKqROiKQ9oxGj8BWDY7g= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:17:41 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:17:41 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:41 -0400 Subject: [PATCH v6 05/10] PCI: imx6: Simplify switch-case logic by involve core_reset callback Message-Id: <20240617-pci2_upstream-v6-5-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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=1718655424; l=7027; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=EnlJL+A6hrb+lx0OJcd5b43KT+ZkB7ImYpV0nsydYlM=; b=OIGoZ1KHbNuE5OAwVBmOpVWgR0A2KiKP+p0JiLEqdLDRZoDret84ABeKWUG2I1IXMzA9Easrb nnz1ipl1SoSCrueVn4dEvUVGEp1TtMN7C8SLzRxTcZ+oL3MxpZHDKXA X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) 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_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: 3af9abbb-5e44-48e2-235b-08dc8f0a8a3b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?N8wMkaZmRQtmYqDj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Sl28hne/?= =?utf-8?q?cprBO9brkkZKP1APi9a1Nf+Tm4urS1d8J/IyLFFrGBW6NCubdQTRsKXxRZ4Uj3MRy?= =?utf-8?q?ekfEW+DBTsoxGYjxKuBr8zihWvKJfrf8xSpoJ2+BAtpGxmFYH/7ew5QjvQMW5FEmo?= =?utf-8?q?NVgIiPBNS5JQzgoY1zjSbak/gU+m1hoWcwIu9BrL1F6l3JMA0AWZ8+LGtNZVYC7/E?= =?utf-8?q?zT5EvWRGITsknDrfUuYyZ4kQlu8PjSEhZDeRFxQ02U4PzChESlDVC31ha8iojNfWu?= =?utf-8?q?d8/vgMZFK8MQp/1DPs8Wn5ut+cX9DndB65u+P3M76hUFAB6TMlCizqWqWow6L6EMs?= =?utf-8?q?Y+0c+kdyc2qLq63M0GNXW1ZlaQeP6LFJb5si1BTJOnAR0n3qKgkjAy4ERt/tRdOdZ?= =?utf-8?q?BjKqcH2eb3Q3HRc3X8pAoC+o7mf6w+2/q3GBLnM6Jk4SWvUOHScdxgrDikyk8CuBX?= =?utf-8?q?DoSKgNi/x0EW?= 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:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?lYt9Hg54SPrc3oD6tg2LDZBNcWQh?= =?utf-8?q?jcHBHebMMHhZnoCab1BpBlKMKKG2QrHJjuLm3gQm+iSMz8vZ9dOV7IqR7183AtDAc?= =?utf-8?q?m/6mCRQvsZd1LECBxv/2nOeeoKC1DtesQlr/fNr0TRXAxKSEESxanAS7SBUX71NsL?= =?utf-8?q?1By1xQU0rf6ycYaLGhFyZYOjxt5cHOuuWBwjQWFGKqeNWjUd1VuVTOJ68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hb?= =?utf-8?q?Nl4aAsV47KhCtkueUL7F0aYf1+JSnNtZN+u6D+IQnepm2XO9nx2jsLpiV3BqJhMOs?= =?utf-8?q?PSgqMRB9qVBNOiKEocPb1IiDDbw9XfDlknpm9jnhEoT0pim5aWL1qXF34/3YtbSgy?= =?utf-8?q?lwJckR+UQmB1NfEtKBmw6vv7iTFuoAn0ogJyhlJMaqZ67rd0ks/34K4blumVxb3rN?= =?utf-8?q?fjy6GUaPnfMysIrgcozc1dfkeyXwzMKUgXJYUYkjAk14XS4uzWAD7gjrPc3UcIWNc?= =?utf-8?q?rOT3YT/JSbqcU9vXcova1wnWcY3i4W1HI/7JbCfE4naooR/AfkDbCvZwBtiViiT+7?= =?utf-8?q?AQdTN6kOH07c/i/k8IvgyRcS5tTJPeaPXsUhZtn1FUo0vdpYaaotHswzWICmdhSCP?= =?utf-8?q?65m9sswmdIgFyWqhOZZ4RVY+bRIWBC6xi306s9QkLrFUzng6p5DU3N54kRoWVzLXI?= =?utf-8?q?Xr7TnfMpqZs4?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3af9abbb-5e44-48e2-235b-08dc8f0a8a3b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:17:41.2181 (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: 8CfpRoPxVAkkUWBdhiEqwl/wwg7IkObC7fM2SQ3YPNaHYkmaox5pxOqzTLxUs3YwS/+cT6TYlLFtxsJmE8biUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 Instead of using the switch case statement to assert/dassert the core reset handled by this driver itself, let's introduce a new callback core_reset() and define it for platforms that require it. This simplifies the code. Signed-off-by: Frank Li Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pci-imx6.c | 134 ++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 63 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index ff9d0098294fa..6f68bee111029 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -104,6 +104,7 @@ struct imx_pcie_drvdata { const struct pci_epc_features *epc_features; int (*init_phy)(struct imx_pcie *pcie); int (*set_ref_clk)(struct imx_pcie *pcie, bool enable); + int (*core_reset)(struct imx_pcie *pcie, bool assert); }; struct imx_pcie { @@ -672,35 +673,75 @@ static void imx_pcie_clk_disable(struct imx_pcie *imx_pcie) clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); } +static int imx6sx_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + if (assert) + regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX6SX_GPR12_PCIE_TEST_POWERDOWN); + + /* Force PCIe PHY reset */ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, + assert ? IMX6SX_GPR5_PCIE_BTNRST_RESET : 0); + return 0; +} + +static int imx6qp_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, + assert ? IMX6Q_GPR1_PCIE_SW_RST : 0); + if (!assert) + usleep_range(200, 500); + + return 0; +} + +static int imx6q_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + if (!assert) + return 0; + + regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD); + regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN); + + return 0; +} + +static int imx7d_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + + if (assert) + return 0; + + /* + * Workaround for ERR010728, failure of PCI-e PLL VCO to + * oscillate, especially when cold. This turns off "Duty-cycle + * Corrector" and other mysterious undocumented things. + */ + + if (likely(imx_pcie->phy_base)) { + /* De-assert DCC_FB_EN */ + writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, imx_pcie->phy_base + PCIE_PHY_CMN_REG4); + /* Assert RX_EQS and RX_EQS_SEL */ + writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL | PCIE_PHY_CMN_REG24_RX_EQ, + imx_pcie->phy_base + PCIE_PHY_CMN_REG24); + /* Assert ATT_MODE */ + writel(PCIE_PHY_CMN_REG26_ATT_MODE, imx_pcie->phy_base + PCIE_PHY_CMN_REG26); + } else { + dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); + } + imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); + return 0; +} + static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) { reset_control_assert(imx_pcie->pciephy_reset); reset_control_assert(imx_pcie->apps_reset); - switch (imx_pcie->drvdata->variant) { - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN); - /* Force PCIe PHY reset */ - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, - IMX6SX_GPR5_PCIE_BTNRST_RESET, - IMX6SX_GPR5_PCIE_BTNRST_RESET); - break; - case IMX6QP: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_SW_RST, - IMX6Q_GPR1_PCIE_SW_RST); - break; - case IMX6Q: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16); - break; - default: - break; - } + if (imx_pcie->drvdata->core_reset) + imx_pcie->drvdata->core_reset(imx_pcie, true); /* Some boards don't have PCIe reset GPIO. */ if (gpio_is_valid(imx_pcie->reset_gpio)) @@ -710,47 +751,10 @@ static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) static int imx_pcie_deassert_core_reset(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx_pcie->pci; - struct device *dev = pci->dev; - reset_control_deassert(imx_pcie->pciephy_reset); - switch (imx_pcie->drvdata->variant) { - case IMX7D: - /* Workaround for ERR010728, failure of PCI-e PLL VCO to - * oscillate, especially when cold. This turns off "Duty-cycle - * Corrector" and other mysterious undocumented things. - */ - if (likely(imx_pcie->phy_base)) { - /* De-assert DCC_FB_EN */ - writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, - imx_pcie->phy_base + PCIE_PHY_CMN_REG4); - /* Assert RX_EQS and RX_EQS_SEL */ - writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL - | PCIE_PHY_CMN_REG24_RX_EQ, - imx_pcie->phy_base + PCIE_PHY_CMN_REG24); - /* Assert ATT_MODE */ - writel(PCIE_PHY_CMN_REG26_ATT_MODE, - imx_pcie->phy_base + PCIE_PHY_CMN_REG26); - } else { - dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); - } - - imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); - break; - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, - IMX6SX_GPR5_PCIE_BTNRST_RESET, 0); - break; - case IMX6QP: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_SW_RST, 0); - - usleep_range(200, 500); - break; - default: - break; - } + if (imx_pcie->drvdata->core_reset) + imx_pcie->drvdata->core_reset(imx_pcie, false); /* Some boards don't have PCIe reset GPIO. */ if (gpio_is_valid(imx_pcie->reset_gpio)) { @@ -1458,6 +1462,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, .set_ref_clk = imx6q_pcie_set_ref_clk, + .core_reset = imx6q_pcie_core_reset, }, [IMX6SX] = { .variant = IMX6SX, @@ -1473,6 +1478,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx6sx_pcie_init_phy, .set_ref_clk = imx6sx_pcie_set_ref_clk, + .core_reset = imx6sx_pcie_core_reset, }, [IMX6QP] = { .variant = IMX6QP, @@ -1489,6 +1495,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, .set_ref_clk = imx6q_pcie_set_ref_clk, + .core_reset = imx6qp_pcie_core_reset, }, [IMX7D] = { .variant = IMX7D, @@ -1502,6 +1509,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx7d_pcie_init_phy, .set_ref_clk = imx7d_pcie_set_ref_clk, + .core_reset = imx7d_pcie_core_reset, }, [IMX8MQ] = { .variant = IMX8MQ, From patchwork Mon Jun 17 20:16:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13701360 X-Patchwork-Delegate: kw@linux.com Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2050.outbound.protection.outlook.com [40.107.20.50]) (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 D1F2F1991BB; Mon, 17 Jun 2024 20:17:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655473; cv=fail; b=t/jPgsGbODTQzRwxn2IGjuBzLvXwHVYTg95WL6ZKzXUp8FrcsXaPmucv2m4khCH+CDJPpyCF3eYfnsFeDqkKTabfNc6tyVap3XxqxUxrS5EPb36SALI3SkZIm10qrbxrfg6JCDGLxq/SG0++5Hst4wsqUrIkgTscNZZzrTAwqRo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655473; c=relaxed/simple; bh=mnFz1Xd8RiST3TqF6ybWEJkLf/FgE3r/PVt/jRqbg2o=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=OEZp/nYazEpoBTsmNoR2y0mnRzDl5y3gi/E9cH0XuLE/WSu5RwAc17ILX+VZo2StKfUYA5SnWSFv1SQpoyw/0YwqacnyqqJNIK578v0okxfaNhCrFz0UAgyi9CjGq+UsVmtczFK5GZIkEcnSRE4yk83i7iE9/mCjW/BvUbHdb5A= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=XFtfueXI; arc=fail smtp.client-ip=40.107.20.50 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="XFtfueXI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=THLP7NZqpt8eU92wXI0xMttBQ4PTdBqRvfexAJqMk/SJPZ/o6LSJbiiHH0vzS6kjSwgkr4L1ysSolugAlCjm7GIYcG2SWbU5SRsjAry/IIrTkWtPXi/7mkVXnjvTa2u+ingKgfPtqAedFpTvQFkr+BRtylqAlCbvVms5KJOryKD8e8ov0CcaP7v3jp9v6JQaJTcZxjBO4uToiGyHA2v/uvYAXZXSC7qXOxg5aGeGl3EzkPnCDs1iuXPh8tt+AdobNP2m74NoyHXoye4ITJfWIfEukySUUaTVE537UhT4Z+R2l1aprflXwQJnoXQdVAadT+cDaGtYRU1M5wofc9Ut7Q== 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=zwAMUUjuy8B9SJn+L8NdgbW98Y2i2AV2KsWbe85MDfU=; b=V/VKt/pOmXzjVDsLm6fCEhFtzcomlWEfkz7FDghlysfXU6iTWsbmCsnqeE0DZYuEwUTIdHj8NdU7SEfYw7sWs+miw7UXKFiv9W9HM/fBli429mYN5ruN9m45TXD3gxGPh1Fu1tgxPdehukJjGq/0HKI0NYFCtJBBn2/qZELUJYaebLD5Odok1c0owLFpLSKX/zFY+bZn91UwQUxDMoi0vzuilm+B2VF36x2ijwPjPzLRVxGsjljLrCpCRaalsp7zfseSNfdde8wYdgP/hhTpyjl9obbU/ctPOb2Yan1cqwH6gPw8gfIDjCaEY8DZOwrzgJv2lHo76lFlZoom0sOhbg== 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=zwAMUUjuy8B9SJn+L8NdgbW98Y2i2AV2KsWbe85MDfU=; b=XFtfueXILBCkErOuPVFdYdIu9sKLASNpTO8X+ckG3+PUTdg77T3QhEUTC7B1+4gHODvSRdpFtKid5yGKd7F2CC0Iw0xq58lewPyHiBCsecuVXyFeIqEKZrFXZeip03/Nd/9mGHDCkaQSLbS+DJGUkGsF1uX9FBGexJHdtQvy3mM= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:17:47 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:17:47 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:42 -0400 Subject: [PATCH v6 06/10] PCI: imx6: Improve comment for workaround ERR010728 Message-Id: <20240617-pci2_upstream-v6-6-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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=1718655424; l=1779; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=mnFz1Xd8RiST3TqF6ybWEJkLf/FgE3r/PVt/jRqbg2o=; b=d7kv+4s8ZI9/jGyk1E9QJq1B8H2e4cB59kq2tnocyN10+2CQAvCxmX3bTWC7ZW+c/UCvrbCHX c6wP9zr7l7bBWYEC5uXlDkTKv6bw+p5NBKpL3KZ3Nv92zW34pDMxrI0 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) 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_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: 37b3b580-7441-4305-980b-08dc8f0a8db7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?L9bV7qAwl3dV5Jujr09TehsGLwPYuBv?= =?utf-8?q?jlOUqKHqs80YgygVzJRH4ktxvlI4jN6SOWkOBpIcq0SobqC/8l0t47d1Rdse8aK4f?= =?utf-8?q?yJgqGgbV2r4BZ/fSb5E+4Y6eHu7YL59rRbuyeibwx3nz7ogXY7NVw2y7i4A4OuXEt?= =?utf-8?q?a2UGZXaG7DVLZm/e9SWoAiZp08xBh+a9Xq2y4cwPZoLG1US44Ls8P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f60qb/54TAHjji?= =?utf-8?q?ua2pWFwazrnE4vKhP7oU/HmppPC7srCqSfEGqy9K6wCc7vi3PfmcS3BW1EyokilNE?= =?utf-8?q?Ia9QbQln1I3NpdpbWenhErGsDWdvkd8O7fMRZ2yxBp0kA00Ka0Cs/DrtwZWMRybz5?= =?utf-8?q?PomfmNAeEO+u/LxTCGozjtH80c+8vLGiBG+zyHkWHCltK8NPEtZ08Bu11WVy+x4aO?= =?utf-8?q?XqEl/kth0uskY8iWupvpqMf76yJha8P/vlfEtmaFusfT2yrYeQoPffftJ7S+8yQHF?= =?utf-8?q?uLVDYkcEx4j4?= 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:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?zmw+IcumFKGACYocUaQJS/Zm0NH9?= =?utf-8?q?goYQHg+wSM2p9vp3FNfAa61fYIcMGZGjOl0xFf8P+nC0q4p3EU1ArNuUittf7x1+n?= =?utf-8?q?JE8qD0X5J9G4cVQ3dONwiedfIr0zPvEBF09joDVTmKDnrJxbkGGEnmsdwoI+on8HF?= =?utf-8?q?Oh50z31Ai8SCCfMfn9OnSiOOG/eeuq2fKuvqrFCojiS4Onsa8dnx8plnsKiSABj3c?= =?utf-8?q?Z6dVTYRx9vp6kc/Y5sivVAw8DpZvVGfbr1uVARbDBM4vbS1jgbW/usGAdVhrDNI0h?= =?utf-8?q?AR1vUF+zGOrCuUurLiTgEoUWWyvGOzUPhYWeZ4mIDX6j28J0AMFudjaaNQAebJrLb?= =?utf-8?q?6Czo2PcP8MuNf3W9rl0gGosCFacU7cMvi20Da2wXCQY2O3wk3QrW7A3ciWBb4F7w7?= =?utf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KE3IFmu/?= =?utf-8?q?8bFBoH6MqEh2HGA2B0C31V9MNz9J8yS1iW4Ahg1JwGTamMF2tVderZnIclqz8ouJk?= =?utf-8?q?VmgHTyNVkKPn2/nZaaTcRKAugBoE0J8p4WlbGSWieFdoukyH/2IugFr2oPvCyeBHu?= =?utf-8?q?4/24bIGtP7bFA/hORX+PGlK052oD/3mRTj2EwjUMLSuMeKgMHm/AdcR9OBJRz1PgH?= =?utf-8?q?5RySRci1q9Fem+1Ci9/SRzmqd/VK0mAKBvjIjtzPLSlXxmwth25yri5lNTjSPHw7h?= =?utf-8?q?YUQ+JAqwsC5Y?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37b3b580-7441-4305-980b-08dc8f0a8db7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:17:47.0815 (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: ipr5kw5ZRNMFsRDRgfjOvpMBztyVFzKeRVGFs50aiaWTWwfTkV6skjWKNyRtxcubBVIYI6MZiv89lL/eFINBfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 Improve comment about workaround ERR010727 by using official errata document content. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 6f68bee111029..6e3ac3fc33745 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -715,9 +715,25 @@ static int imx7d_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) return 0; /* - * Workaround for ERR010728, failure of PCI-e PLL VCO to - * oscillate, especially when cold. This turns off "Duty-cycle - * Corrector" and other mysterious undocumented things. + * Workaround for ERR010728 (IMX7DS_2N09P, Rev. 1.1, 4/2023): + * + * PCIe: PLL may fail to lock under corner conditions Initial VCO + * oscillation may fail under corner conditions such as cold + * temperature which will cause the PCIe PLL fail to lock in the + * initialization phase. + * + * The Duty-cycle Corrector calibration must be disabled. + * + * 1. De-assert the G_RST signal by clearing + * SRC_PCIEPHY_RCR[PCIEPHY_G_RST]. + * 2. De-assert DCC_FB_EN by writing data “0x29” to the register + * address 0x306d0014 (PCIE_PHY_CMN_REG4). + * 3. Assert RX_EQS, RX_EQ_SEL by writing data “0x48” to the register + * address 0x306d0090 (PCIE_PHY_CMN_REG24). + * 4. Assert ATT_MODE by writing data “0xbc” to the register + * address 0x306d0098 (PCIE_PHY_CMN_REG26). + * 5. De-assert the CMN_RST signal by clearing register bit + * SRC_PCIEPHY_RCR[PCIEPHY_BTN] */ if (likely(imx_pcie->phy_base)) { From patchwork Mon Jun 17 20:16:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13701361 X-Patchwork-Delegate: kw@linux.com Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2067.outbound.protection.outlook.com [40.107.103.67]) (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 D89E71991D8; Mon, 17 Jun 2024 20:17:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655477; cv=fail; b=PAXh4a9IURoZ8hxquj228CqHphzfV8V//ZmEYjCFwrjn7xl9xdh/HXv8wOcgl76WRHdN+YXUhkK16cQ2MJg9IlAj+PzeHZDlYckdONVpS2CDve7HxlUSvDKbczkDKH1KX9uuBKIqLRq6n2oj00qds8jAgv7NW8vM0JIrOiSEFto= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655477; c=relaxed/simple; bh=om4Fh5oG1kwE0U1dD6JH9tan5doH9jtRSql0uUIv1xY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=pmFakF5f2y/ZCA46csST+16WRBQ410MeJ3KRz9MKGkL6WVU3oZuTQ1ySLzWVzWxiboArCxn2j2gR/wr7D9tLw3sobSYAMQqqFQJMK84A76INir34iy6OOBF8I9ORu9xOMRdxLfdyCx4Fe2MsqR23AkJgyAFwlSM2tYyrFnyu9RE= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=dGQ0bjFc; arc=fail smtp.client-ip=40.107.103.67 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="dGQ0bjFc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RQkv+5eczKPHjTcJuDyR3iMU37XH8y0vC9fwRJ9D05W5w0CqBpqkBvNKiditjCOp/TnX5+lvTCXoWEUnBWCq0d/eTLif6b6Stu0rvmbFl4DIjSmKs4EkfFEf75X2eNPYPnsRfNN4tQF7xW5uIrW1kAjYf92qRqxUZPRCw9c3rhzUmlz1Nq6chkrUP4pnJa8BjLla1vGN9I0KPUJ5Nc079JhXiQ5r2rEWoDPQu1o6z5uXZNhKwaFxiBAc4chH1Vo4ZzrHfYO8MQrgiJZRyh+4dd32wZhV9Wxb3mC0CS4qtrYca/8qRAmA/DQFhiTXCN/L7wySMkxShUnjd+XmiwejkQ== 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=TFxC9rPKvd93kah/Dqg8UZA6Y/nTglhldH9xaKShG1E=; b=ib8paJe74nGtt6ZkPVFnsrR2GYLJPDdGZ8ZTOeMzjn2G4zgS+Br37z9iTaP1UpGKmcdjBHh9z6WwYef2ReuKp1KWjyjHsFvrRJNCZ+jjELpFFqSG3ky55bzam7ucIFug6cBTi2B/WCGkrP3E2o1Nt9B39CCpeUjJMUT3Yu1JTbIs/QF26pyb6YiaBC0GUIol3O7UXZ9pEvgvDuUZskBwUu9f/zscnjRTeuXqoEwNzEzQp+WGTZSs58aYw8hlmm/C22pC9SmfmZuIrgzMZA8DjbIbEsC8Ah3MUAsTvSv9FDW2+FjnP19cG9qRi1S3JiWIjxcrdn7s02CYA6Bs36G9FQ== 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=TFxC9rPKvd93kah/Dqg8UZA6Y/nTglhldH9xaKShG1E=; b=dGQ0bjFcrn/NjqDpOwoEA98K40NHE9KY+rh4A6FAbgjQHUaylhHN44f5sVjzUb9TmSHH5vHya+is/OKFgdA82Kdeyio3PUxVnxLiDY/kMcKNBsW3QrYVIoO4Zsoix1VK5X0oYlCORIVVgJnpauJTj+6Z32DmEU5Ewce0S32knSU= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:17:53 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:17:53 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:43 -0400 Subject: [PATCH v6 07/10] PCI: imx6: Consolidate redundant if-checks Message-Id: <20240617-pci2_upstream-v6-7-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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=1718655424; l=1048; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=om4Fh5oG1kwE0U1dD6JH9tan5doH9jtRSql0uUIv1xY=; b=9uMWFLwCroYvOHNKcVvIyAR98TUgqlnHeSFOo7S1rAHPzfM51UrKhhWjtHs+nq2N1UKOlhl1X owo2yndpsGqCSHZI5Lv7DzWZMFSjssR1DMn57At8HNnaPPdP6Muk//F X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) 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_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: b7d209d0-5982-4a3c-7811-08dc8f0a9163 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?OoKU6ir4l6l0+3vYxj9el4my4mRMJsd?= =?utf-8?q?W16SFgEbyW1WkPgLMCscQsf5wCY4vv6Qiex2B/1nud2zqyNU79krh2r02J1jkL2Qw?= =?utf-8?q?TMO7l4xC6aMMpE5Y2FkO3LsJu8FR5osUtAV0RnrWbHrrNykh7wUCjrwFNUsua0v9p?= =?utf-8?q?Hn1oObt0otzklE8oQO+daOjuHMP1MO2zbTUODfZ8bzd5WRCnA+ZfH9NN7DWAJHoWS?= =?utf-8?q?m23MmTfVCzA91c/zIZwvyW7jR4nbuk7WEJvy0xjvM/0F+72YV2k52fOPbXoPq4+Hf?= =?utf-8?q?OIsrnFjuDM53j251O1bkypQZDbmFamfzi2m33dKxbj0YsSPPaP7ZXbtcuCuObuhNF?= =?utf-8?q?C/f3pK+bu1O8Xp2f5V5zIWBuyv32+kimRXvhgpPOC94ruYI2R+jZ46e5ses/y1her?= =?utf-8?q?F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?MvKaltMiaXFtOLTgCGuPBkKrQQP4LuFHjEP1kGrEYG0QPvTXC1fI21SQJNE8b2t4P?= =?utf-8?q?C1l7C9NUteCT?= 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:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?1eV4hL7f7xW7F+KGiSD98l04wZop?= =?utf-8?q?r54zXYmCGj9JOmCKQqQhBxsOPV9K+MGaM5wJu/WfZHkYGgtxsUHcfa6xN2Smz71Cb?= =?utf-8?q?cr/JkDh5Q0ysm/Kb6HCvCnTNJbV+GSeMEq0BDkXnG5aaaFzxWimPK/6cg1el0Hc57?= =?utf-8?q?8FvDe9GZ8sx6suFULOQK5zQjAerM97ZggUMUYNPJDMIhZjerWwJdEY5G0LbBb4ZY9?= =?utf-8?q?kE1aahpFavtrZ7AR2/KCEsyHSO3hudf78y/XWyUTvmUWDKi8IUijcLfi9styPahuL?= =?utf-8?q?FtJmWYY1vz1syqiwBIpwvrWBIWBT+0PkOxk4BBEuThCEucCZcPFZTPvyi41aJQcch?= =?utf-8?q?giGOOT+nJ/6AIbsRucGnpmUQkLDCwGYBdw8i4BPO4qLvD/WAz6aPaDCgzkGxGVvWs?= =?utf-8?q?wIlXodr8CiNnkjpU4j1jCFvDLFvVln04QXSrPby2TGlgzAFqCVZ6vMxUl1jZxZBeC?= =?utf-8?q?I3MutwouD3A+RhV43qxD8klPp84cBd20kVRNxPVUmglooFD8EnufRBFrnE36cDSQO?= =?utf-8?q?dNOBE6+X2nyDzKuCssJONCLOH+HAML7cEuH/NkwlyrxvMdsvgjhpTA6qb6o90yvTh?= =?utf-8?q?8mtuog1bKPfLmDaWbI2g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2rOXjRiN5scafk23CjmhZxKCr90gnYsVGam2iOaWgpcbCmn/H3x5+uQDxW?= =?utf-8?q?2UcP16jxMibW?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7d209d0-5982-4a3c-7811-08dc8f0a9163 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:17:53.2471 (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: AkN85sBbzMxJopQ3Xs6+itDiq2dAuoc2dmKKDiVFZLqrCM7JSwDDxczx9jvgzNOjxGdnM6bY3HFXs0uJupFqPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 Consolidated redundant if-checks pertaining to imx_pcie->phy. Instead of two separate checks, merged them into one to improve code readability. if (imx_pcie->phy) { ... code 1 } if (imx_pcie->phy) { ... code 2 } Merge into one if block. if (imx_pcie->phy) { ... code 1 ... code 2 } Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 6e3ac3fc33745..ab0ed7ab3007a 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -954,9 +954,7 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp) dev_err(dev, "pcie PHY power up failed\n"); goto err_clk_disable; } - } - if (imx_pcie->phy) { ret = phy_power_on(imx_pcie->phy); if (ret) { dev_err(dev, "waiting for PHY ready timeout!\n"); From patchwork Mon Jun 17 20:16:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13701362 X-Patchwork-Delegate: kw@linux.com Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2053.outbound.protection.outlook.com [40.107.103.53]) (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 3B8DF19CCE2; Mon, 17 Jun 2024 20:18:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655484; cv=fail; b=bPEL3NMxjWdiKxrTm6GIAZGTvAZ39FbyeiyJmjmOI+JoyXaQ31k5ejzj5kVzGMt9K1tupcMAq1Qg/IzhuxEYG9CTZhUQ1g9ZHeBZlUyR+vdap/eR3mlBZEt74LXTCowL2aPR/rpqLSfV0UHsKoGgSgMWbN2A6xJ5DlV8a8nNXyg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655484; c=relaxed/simple; bh=rdBX9SAsLGGVokztvn5vz/ebdrIJ20HWryji5UtWJnk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Zd50QhgLLxDi67xywUxgSnQ9mPK6jR5gxukXB87kGEobHOFIA0P1GPvuFA/l6IQIxrPmXyZHl2GQpSV9w8I3Sfqip7DbRuScfiYNQY60yxJSmvOgpciqGRmtEko351LRGmkHFlT4cLzOXZufhp3s7hauqpO+XU0iBRE5KB3qMtA= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=LL8sEZLr; arc=fail smtp.client-ip=40.107.103.53 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="LL8sEZLr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P0gK0y2+zfrPOwAJIKXo+tOAvb5+hdgBxj8NWSDaHm6MIjVDr0+DUMGziO6/dh7MOvyrxmibOvZ4bz8b9zODqzC3EBResvEs8uXQxbyO76uqlDeDtAJcQ1QjKQf23PC/wkfksYk8DrOiI6mPhrOwsJsgUqPleWWzRCAYmicgjanodmJ2+qE3Z8aCMCLK4Yu5MB/RHfHX+zNIJM25vizQ+mM8RNhRrvED4v47VwbK30iEhSTJvMT15LO+tlzlg+/LHu7p12y61jWBG1Xn63NVr9lk7oQ13Xz5YCqGAGY38DkmyDIDz6AcQA2vdnlIZON7fPcC+eP6cpqK4fCq42cWtg== 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=9MbpA0y8LU8HRpju2DUmQSRJX8UDOWjSKuL8l04o6lQ=; b=cOd+4zG5VP8LJr/zth14afVs9g9C6K/5Iq/YrIeHt30ka3rk8qkhLNxln4jZwZWfuK/IN7UzQRi4T/oq9J8Wd5ZRbAuCXgVQjhOGIyUp3ln4wqBFS/mKRfN2FDsCtN0ViEqQuLnOqg3lLbcufj8c6tKU02hlWffAn80NsD/JTSIyS5Wr5NjKcBhz9gRYlJQY0wsvAkynmflV8716P0o9ZpgpZIq/hNEr+Xu6E1PDSB/1GtvmTbszbbJYaIAf2ZR0gGJkfisHV79jAqYAa4euJLhKN57oUxVCFEG18EUEsfmaNytzmVF8G24CzGgQQS0coIQ4XdT1y+2GJi+pZX5YUg== 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=9MbpA0y8LU8HRpju2DUmQSRJX8UDOWjSKuL8l04o6lQ=; b=LL8sEZLrK5E+iaLZYkdsrc+BzuGLQuooe/RcoagPK0AjmbEsjQZijXhJQm9xTsXLiFaJltVP4dPA3W2Fox+tlF3L6fmpae9e/BgeIN7mX+VQ5oVnfZA62OsJoTp2ZPG15PpvNXmo3PoSegBAQVgLWfCvUK6ZcF7qvq+5qYyC8cQ= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:17:59 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:17:59 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:44 -0400 Subject: [PATCH v6 08/10] dt-bindings: imx6q-pcie: Add i.MX8Q pcie compatible string Message-Id: <20240617-pci2_upstream-v6-8-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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 , Conor Dooley X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1718655424; l=1356; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=9ZkdHDkA+jFfsgNpx5r6KX8wuw07nzBbE/IHsRQRYtw=; b=Ltw8SKUOhXUR/N37ex9tuFEBMGyDTCWWFRsCDE7utCebx8DrKCAg1WscVpZCindlfR1yIcs5I e4P6G+RAzCtADzd3Jj9fBuGO7WOn/63jNFDCQ6zmyGqhmTQZyxu/BeW X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) 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_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: 35440926-1c41-4e77-0a46-08dc8f0a9531 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?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xalnhQtzm4QvusD?= =?utf-8?q?QOht+IF9sQ8Zr5Qhg2LoNcqTlgtYY/jeAMzkvbFmmuInyAUVoRz2ehtkQm388tBl+?= =?utf-8?q?c5gbA1x84zx83x0H/+6vJd60sn1XHt3IYLpJTFsWf2RWuEqFLlPuAPECd6ACVZzP7?= =?utf-8?q?DRQO49JYvDUJV3jF2ZcIT2r8oCcXMM8IeV9i+31pU7ygeMTays8DONwLrROPrc0J1?= =?utf-8?q?KBY/T3pbLQXIAipi6mvUsRM15lF0SFcPkimgPqUdwkGrXKS/9y5Udh0I3Is7iWFbm?= =?utf-8?q?nYct24M1CtKVsDdBSIL5j0ib9aQEJZsxcNtKqyjz01F+PW9it3FdwsaYUxmKt8I/g?= =?utf-8?q?xAOxteSAwz6YROlKUJF29YOOeD+CMBhyQCbg9f4mQug6rtuFYK3wBQVKUl5GegPDb?= =?utf-8?q?h7Ne7oyBor4cPokVXkOn3rd47KBp7HIk+plIwoWOK/G/J8jMtUa1QG2AuhNHfvViQ?= =?utf-8?q?4tk+c6jJuloy?= 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:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?YIfBzbzcvTxDCQoEK7FcdVRfPrvV?= =?utf-8?q?TH7RhjqIcXyvPiwP+sYyN4uqf+tc2ZEGW3xnTcvGOgiO8F18twJs3RppFcyB7nI99?= =?utf-8?q?5qSkO8DcjPylj6WMf77sX5BR9RK5URGbkNZLTCdLbMgcWKSmm9t0gQAnaP/NZ+7B1?= =?utf-8?q?Jyce/FOjnsZUWqAS8Aj50zR0NGxkWYQ/6A1+iSRV8L9+5WTIBlvyicq78SdEoBGP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uMQCzb1w/eAbszE6T/sXjblnjKvXVAWVLA6Fs0+TLzEi6HIJiEvk40OtF?= =?utf-8?q?wUauByS2uiErbEDBUgIOf70ITfAYF0eI8t1A+RK1Abl+7nxnzZR6x89Bij+l3mlTl?= =?utf-8?q?J3n1jLMjWM/A5s4L/CcgKgTq1TPRnw1Oi1hBUG8n+DWFVAc/Yct0It2LDe6HFY6BU?= =?utf-8?q?k+WmrHfhF5/SQM2WAgcaTwPPnqmZ4Tr8E86FIvjldTq2eSM4SyC6ZPWVj/KZgxVhV?= =?utf-8?q?WNgNX+8aqcD+ypcPCcHjoUbc6STQ/NJ+93/yrfEVWCAAlEZtzRCN6c8IpGuwG8OBR?= =?utf-8?q?HNkpRCrRokoF1dlWOgYb2R9hVQlqNilDO5cYMzolCkVb3zMmcNR5CzIPzHwuEP4yI?= =?utf-8?q?UnDMiKNAh/YFiLZ8Ve4wkvNK8dAZ209zKJq+6fq+5ML+aVOueffTgUDNn9AbP5ANJ?= =?utf-8?q?3fmeJKvtNJ/3?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35440926-1c41-4e77-0a46-08dc8f0a9531 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:17:59.6141 (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: BExwOTBAoPNdLUAbOp3LjbhcRq0mdIvVyvpdLfd+uZ1chXrfg2t2T18jdSOMrlGW/kUHlSoNLS+xZgZMGx3oWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 From: Richard Zhu Add i.MX8Q PCIe "fsl,imx8q-pcie" compatible strings. clock-names align dwc common naming convension. Signed-off-by: Richard Zhu Acked-by: Conor Dooley Reviewed-by: Rob Herring (Arm) Signed-off-by: Frank Li --- .../devicetree/bindings/pci/fsl,imx6q-pcie.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml index 8b8d77b1154b5..1e05c560d7975 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml @@ -30,6 +30,7 @@ properties: - fsl,imx8mm-pcie - fsl,imx8mp-pcie - fsl,imx95-pcie + - fsl,imx8q-pcie clocks: minItems: 3 @@ -184,6 +185,21 @@ allOf: - const: pcie_bus - const: pcie_aux + - if: + properties: + compatible: + enum: + - fsl,imx8q-pcie + then: + properties: + clocks: + maxItems: 3 + clock-names: + items: + - const: dbi + - const: mstr + - const: slv + unevaluatedProperties: false examples: From patchwork Mon Jun 17 20:16: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: 13701363 X-Patchwork-Delegate: kw@linux.com Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2043.outbound.protection.outlook.com [40.107.103.43]) (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 54F2E19923F; Mon, 17 Jun 2024 20:18:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655490; cv=fail; b=W/GU5RnANrBVJcmhah4ItGInRIl34Sztg/794tyASyr5U2YAQQSZQJSm5k2kE+YF+OZNM5z9R5etc9AWiKl0im7qUsklWH3oA7FZ9r/30sToJCOLOU6Wv9mROjgbpliQwvenGutiFcb3Jk/Jr3ONRhGssC2SjmxSI9lJjJqTwX8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655490; c=relaxed/simple; bh=SHH+RxbPVg9d9vvgQwAyIOSN1a0ktF2Q9tORg7XL1Wg=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=BAASp77DUvJeouY4dyfCDTrXOpv5W1WWBeiehymJUeASDzfSkIQWvCJX6kZGdOVHIL9vpDrJJe1PvzQx7s36lbLtRWqzyuKrLQkCbNt/5hr//sQttrEgq7ka5Ew6UNvAI64hQWiykrHIe9QIJRGjTFcmhLbfL1veBf0WoIg6D/c= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=nUALNL3y; arc=fail smtp.client-ip=40.107.103.43 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="nUALNL3y" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JLlh1Q4LU71Zy6JKAcX+isitunPdsHwVaLip4liZSK4MkU9YqF4RlSYo3+NuH+2KRUt1DBFSB3+40qOO7ZTsoujfwz0Jkl1hV1NYu04pSKtgsI1A9j5/6NV+nHirvMdxkg1aeAmmWVkt3E9esjLDpeTdcuJ9INmN0tYqV6NsLgVhpt8Tjqa9iPrT3X+bXNHl6W5ABUOAIWK+RNTdyYmqp1zLqBVheyUz09uB8IEPFvMGIpQUq3tYmbyY8AAfDzBq6cDio29wWFgBYmRFWwIGHlrgKU9ZaXbSsL/BCdSNeVkzlIqkW4WZPzOLl2nFIV7NW4/fAf+uPa4bpwG+poJjEg== 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=tHd1Na5jpn2/1hr3DnG0fdy90jL7MoCN4Eo+Mj/vcaY=; b=eRXZiA3m8NhUpK9/ZotHyUvmjksuivr9nNIGaFYhFlm67zpKZnmY3ZoKEh+y3KCkww+EMu0NbmtnQZncTexLDHbIxENGAF6zuWMQ4yKkQmXjGAxvl7G7IcOdmrkPinm++QbJ3Tqd9SXI9TmjihLXUvOSxgnMUHqDxW08PFAgfeq7BFFRSW3XnJWwBIyn7sCVJYNp5YYhvd46a3e4ctv7WJWLvTXSSIu+3J+D+V/f1X6idLe2BWfxKpPsagHFMP5BGPIfFPicBnHjPAbhI4dKqnp7FAE4MLo6UA5xL7HIh+r+9ZSqRCCrm8Y6TibgP7jxWglSiybv+QJfxor1+iLhEA== 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=tHd1Na5jpn2/1hr3DnG0fdy90jL7MoCN4Eo+Mj/vcaY=; b=nUALNL3yY13rFk4t5BpAKAS0N7C4vD3lhhclDrk56DvI1/QwFRN83+ZdDsPwDP4whKvx52lb/sJVdPWLVEoExsMU3ENGmGvwSiFba+x2ymsyudSm7jBiDRQvgBzt5pLqZkRaP6bKcQN3UmrZUBqSLOUud7XQS7DKo8xzMOmzqhI= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:18:05 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:18:05 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:45 -0400 Subject: [PATCH v6 09/10] PCI: imx6: Call: Common PHY API to set mode, speed, and submode Message-Id: <20240617-pci2_upstream-v6-9-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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=1718655424; l=2342; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=SHH+RxbPVg9d9vvgQwAyIOSN1a0ktF2Q9tORg7XL1Wg=; b=1DI3HJ76h3fwRbwaWh5+zj2zcwaMy67Ux3uNEvoY+VsVDXNwCeK8AK9kbH+c+fD5DiENFwqw8 s3npenmN8jJBqLfo2zclPe35U8r/3CQzw/wF27Wwy8LUHJeKwEj12gS X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) 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_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: 19e2af5f-b5ba-4353-2f27-08dc8f0a98dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WVHqviDWkREWBd5G2IMln0t9mCx/t1V?= =?utf-8?q?7Jzb7p08Z8MygWH2APB2d5yH/7QwWUjJsZgw4MVpp0UZLIPCUwQyaZ3AI5N/50ub+?= =?utf-8?q?2xE38hQFocMjmurJhWt4PibyVWY97KTwQp1P59ZdQoOtRZsH/BcjpUvCo+e6gwgW2?= =?utf-8?q?eDX/hAwLXANQjkRl2TyNFu1UZK+1iPuGz6/BGUtki8cK+gN68rO7D1crDsKEFfsR7?= =?utf-8?q?7BtaNcJmZihDvKBPQlyQ32Ewjz+OoAWhW3TV1xym+lG6ZhOPIn4emJnZCuzKj0ziO?= =?utf-8?q?j8fTuX02tj9oxrYoKY/aMjge66bEtSxM4GUKMVVK2JfaqjhSW3RClWKYBQfdqlHlI?= =?utf-8?q?S5Zi1YX7YBkrMgfvx/oGaiXDKZrlNTc7vH/4BMgIdOmdRzEf7m8bsr3/KPSzQDu+J?= =?utf-8?q?yziziQYtIZ76Umq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/gaAOcd9dw6vaN0CiTGdJOe3AwT4rJHQz5ApmUawFT7EXMGLkioN8kO?= =?utf-8?q?eM0dYvg3k6Ug?= 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:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?kYOctL2qazr3jxbZjeFmPFWVAljM?= =?utf-8?q?soE0Z6d0yuDJ4nyfX4U8fk3eozIGEeMxq8akG9S0djXkFPRhZWs7DLo0vYxoHmxbJ?= =?utf-8?q?swAfvbMjfrgQMzJ8qxcYJMrnq009Q+P7q/z4dxaPCx4kDKc6eaYx6wJwX7OEJfzJo?= =?utf-8?q?30Gsa06wAMWVyu3ow2Acp5Lg5FtLrR2zytqoLZjxqokuyp24y+IXC+T2ARrhVMO/R?= =?utf-8?q?wldSJtZCPp/w4hz9jGx8hya5dXDEgjYMGaxkzu+w1ZxQ02P+SM1DfZ14AMu0s9EFH?= =?utf-8?q?EDOQH1t//XaXI1q/+wvzJmJdEcKNyIKhJQYegMl0g79Obo39+lLmcynoWtZFAAr52?= =?utf-8?q?iOs9kLlvlHbE/kNn19Az/gM7QWZo5oXkHt5BR3manpBkAhkU5NuFn5EWf8MhPSrSl?= =?utf-8?q?GThCZuJRxfcMtVVvSADV+hS91KMhZukeoCaq6bUbhGFm6DVImEx6XWFrSbQYNeB3S?= =?utf-8?q?HrxD0fqIfStkvuJIjNwiBk3DkSJDSL5KPHKsXL9qUW0PZBiDVC/LyDZOXiqJi9WQR?= =?utf-8?q?+2qxGodTxysW6ItuQLCgN65HKnc2hHWyPLbkIGtXPGAiHSxotHUoT5RHc+LSgy7rI?= =?utf-8?q?lje8CaAT0ploQS8II8fMqy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HZUock898W92qWNnVWunA0XU5l4Dp/FIj?= =?utf-8?q?lfXaq1YgR8rg?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19e2af5f-b5ba-4353-2f27-08dc8f0a98dd X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:18:05.7756 (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: TcQGik/0oNDC8zazY4KbcK01Tw0mraCBnbMElbrZU86Fsd1fYBixyg6LgD+6RyacYUIRUB+vKr9HYZoGUuSVRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 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 ab0ed7ab3007a..18c133f5a56fc 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 @@ -229,6 +230,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; @@ -808,6 +813,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); @@ -820,6 +826,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); @@ -955,6 +962,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"); From patchwork Mon Jun 17 20:16:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13701364 X-Patchwork-Delegate: kw@linux.com Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2059.outbound.protection.outlook.com [40.107.103.59]) (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 EEA6F19D095; Mon, 17 Jun 2024 20:18:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655496; cv=fail; b=A1TqgXdLkj+GSkkqEFu21+R5pXHdvsXBM6BleY61/Xj+f4OCzS74dVNOoqBnjlYVSpTW3vvbXjtdHyhOFQic/0eNpSDwmsruAyThG3LIL48c+G38xB+SB+J5ACg4f3osWXQBfCWpjQZ2wqEFBM5mLjTeSon+F0tVC9vp//m70CI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655496; c=relaxed/simple; bh=oUE4Xraffo59G2Cwd8H4tTqx6L0ogBtrTELPu1EChAY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=YrPVMoLbhecbhtutGCATCJ09QgtN1WcVEXZNtjEF7uXU/iK9gpt+QO66EmwdRRSq4Th3F60eqzeOr1xpPKhfueI1AUI5a4vB1+4QrHN2Zpjjzt8UhO/6uPmysprH2w6V+YaL/gV6Q2WH9jgAd+9Mx/5xI/ZzdRTuDPZdi2QEtaA= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=WPb0E5Bi; arc=fail smtp.client-ip=40.107.103.59 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="WPb0E5Bi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=miUfPUbOgaE+M0Jd9mJ1tQFsR7bzG30M1FN1DdZusX1S3x5capQWeSi3Dzgm+/158HsKqEqmsGLWMGYBWicjcfAJgc/v1l3gAgJX0eLEEiAfoKo3f2RQYMit7UkuhavFu56+DkDo8/xp9m/8lYNReYoU+7KLu0hd5rX5uif1gOlwBLN7ZT6E+Ef0ckzZli3cdQFjVoArkpbggl4++RgpvGCxvQdNWp6K+uRsypEJTIv7xXPm6lalwAU66Hfo5gn4hW62v1zBBKHjY818jjW5kQuOrCm1p82Bmbv5TENlBa1hvPVGOfmmdGwsyq9xfwSnE5+3ri2SLhfdSs6BlzhE7w== 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=dC7y+lP9FT72dkYcb1wFYmrUmi+o7+nTwO+CyeeNizk=; b=B++CxYH84rmCcUwULqCEN0vfOAYM54VfkOPvyz2Trjwoai2uCRP7PIEZvssQYwv3XE2MySRc2K8szItNDrTPP1P91YB0yvFokBw3kA+jWSFfQMjdgpSQZMIdSUqq8jB3cORFYPme4Pvp3/CING8lTHOpJ8daCmjv7KTdPkA7OpZdu3oeA2FamGk0Lfn/xA0IVja6uBn2Q1OH6fMCtWj066kGT1AHHilohNR0ETZ+V3wqTmDSQkH2hs1Ihicbr6/GeeIHlohRPhdUi0nMapfIFNvTSyB7fO5IeTMzUEpDImx4+c5Zsz/oo38UyiefZBwuki9HlHoYzSBv6uKc1djBYA== 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=dC7y+lP9FT72dkYcb1wFYmrUmi+o7+nTwO+CyeeNizk=; b=WPb0E5BiAC+nF8acv7WB/lLnlNE4X1D1mBpIUgL7cMyjL0bSnY+8A6pRHCJjIBar9cKpVSdsIAnSK3fLGi85mrXzK324qm/YHodl9EMOvj8146/DcX5XL+gydjVK/Wp+xarYFqUTti8sjFhDzCyWiofooqaTxyZpCFhX0Q3Rk2A= 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 PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:18:11 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:18:11 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:46 -0400 Subject: [PATCH v6 10/10] PCI: imx6: Add i.MX8Q PCIe root complex (RC) support Message-Id: <20240617-pci2_upstream-v6-10-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@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=1718655424; l=4310; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=bs2t+q/XMnPn03SopOxTsr3xZ1eWXCjxU4EhUtgm1ZU=; b=nuwisvUxo56sAGjhNYVjrLNsb+zYdTaBYmKUjoGmQB0yr+t7sVHBh1P63o3bx5jILtqnq6GnK EKu48i1nnXRDd5Ma/6kCUh78xH0CuEA/BEy3MGTSznspk+PW3bnpA9W X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) 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_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: eccbf4b9-5b6d-47b1-70fc-08dc8f0a9c59 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?n/Mb8kkFi6GWnuyJORqNWAYSMrHWP9K?= =?utf-8?q?vc6vXTNSLcAXfGURTCmxwY3QkjmQ38m/rUKXrL1XcW6vMJ/i6QwGXT1tvBZ4IVdBP?= =?utf-8?q?R3irBjTXNCNhjc2LFcXcJ7re9sqWiIpskB2XgwIacUyQkaGqlYS8hcQKQbzpRxB3u?= =?utf-8?q?Qa3mPO0VPdJxQFfMN+LZtcOFBqAgCac3kOm3dFigJXKOumqaB6+9f7TeC/Fa69AAf?= =?utf-8?q?vX1174dsFdFufgm+2CMSPUpo/nhws8xTltP4qszi4MaIR5OQw5UzhogJ72JGnmEe/?= =?utf-8?q?aG8SzmnosZfGVG0qQvbBVceB/5c8ulwOMiwpNUbhtALSxj8grPVVF4TcqrBLZwgud?= =?utf-8?q?QmJ+ld7X6JV+NoWbjLQjObgsxb1aog9BJHuOp7g/4cYLElql7lEE3MAuk4p0ksABP?= =?utf-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suo?= =?utf-8?q?45BQB9EUPzcTkdJuU6ep1MfxERGvkJUtPI6oW7+HFKkC21cFeYlYfp/gKT5/SIM+r?= =?utf-8?q?L+soS9oaladL?= 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:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?HdJdcbidlHcaxHDnR3ebp2ihkHOv?= =?utf-8?q?qF+1t0lVBEZhrwZpHXVTVHV65CkdnVU1/pArOfAgTN/EMQSkFm3EdSIsaUyWyBOve?= =?utf-8?q?+mIPnfqx2c9V6ofNZSX1Q8Uhcwk8MqXU7tPkLpfnD15fo0gd5/7nvrhb4In9whGUN?= =?utf-8?q?KZNWScSnjmYFxGoHNRgYqyA8FV3HwcNziCkGkIFUm1nQg0rnzZS47aJi4TkVSI3hp?= =?utf-8?q?zrTVZ+W/Hs43k1pz/pxk/i0qqRSnoSgNZNHE6R1Xd5BD5VlpuC56voK/0dFT6RwUB?= =?utf-8?q?D3YaXHbOG/wpbghVE8AE6+AKyYOK03c2uYeiaa/Lr8fovjr+5Zp1EmgPs+i1JF6JJ?= =?utf-8?q?IzQ7RQVI3OiBE+ga3ZBEobmhlcIBxLtdBos+KMceYaRISjkIUVb1TrvQn1wdD5BgQ?= =?utf-8?q?h33gJpMy7RB3jWGwXizgOF7HMVzO2pmttagHFLpfOOkP7bls6RbfkUa0mNn5z4Seh?= =?utf-8?q?Tc5ooIfGj9bgW7WUjcZQV9/LtCjUP6ip6RTR5plCPhPx+H/w/viiG/MWdgae+j8Ng?= =?utf-8?q?zOZVcy+MeJtSYpSogiBjgwRwfT1zpHulzIy7kZMrPNycV2CmN3/oHvnBrDXsxgJMd?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MYR6?= =?utf-8?q?O7x5llVE+BuIEwNcQq+eNgiG77TK95ilPtgqLqx7b7J+oSGNQvUTvAxvhCv4WKqaY?= =?utf-8?q?pgYtCnG8VX2r?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eccbf4b9-5b6d-47b1-70fc-08dc8f0a9c59 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:18:11.6111 (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: yYoAPJmAhOE+nh80Osf2Flp6pqX6UisglL8ceBL2re9iIkFsJqnb88h+hIGgPJxpcHsGui0z6t8XMnq/Fp+8Pw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 From: Richard Zhu Implement i.MX8Q (i.MX8QM, i.MX8QXP, and i.MX8DXL) PCIe RC support. While the controller resembles that of iMX8MP, the PHY differs significantly. Notably, there's a distinction between PCI bus addresses and CPU addresses. Introduce IMX_PCIE_FLAG_CPU_ADDR_FIXUP in drvdata::flags to indicate driver need the cpu_addr_fixup() callback to facilitate CPU address to PCI bus address conversion according to "range" property. Signed-off-by: Richard Zhu Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 18c133f5a56fc..d2533d889d120 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -66,6 +66,7 @@ enum imx_pcie_variants { IMX8MQ, IMX8MM, IMX8MP, + IMX8Q, IMX95, IMX8MQ_EP, IMX8MM_EP, @@ -81,6 +82,7 @@ enum imx_pcie_variants { #define IMX_PCIE_FLAG_HAS_PHY_RESET BIT(5) #define IMX_PCIE_FLAG_HAS_SERDES BIT(6) #define IMX_PCIE_FLAG_SUPPORT_64BIT BIT(7) +#define IMX_PCIE_FLAG_CPU_ADDR_FIXUP BIT(8) #define imx_check_flag(pci, val) (pci->drvdata->flags & val) @@ -1012,6 +1014,22 @@ static void imx_pcie_host_exit(struct dw_pcie_rp *pp) regulator_disable(imx_pcie->vpcie); } +static u64 imx_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr) +{ + struct imx_pcie *imx_pcie = to_imx_pcie(pcie); + struct dw_pcie_rp *pp = &pcie->pp; + struct resource_entry *entry; + unsigned int offset; + + if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_CPU_ADDR_FIXUP)) + return cpu_addr; + + entry = resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM); + offset = entry->offset; + + return (cpu_addr - offset); +} + static const struct dw_pcie_host_ops imx_pcie_host_ops = { .init = imx_pcie_host_init, .deinit = imx_pcie_host_exit, @@ -1020,6 +1038,7 @@ static const struct dw_pcie_host_ops imx_pcie_host_ops = { static const struct dw_pcie_ops dw_pcie_ops = { .start_link = imx_pcie_start_link, .stop_link = imx_pcie_stop_link, + .cpu_addr_fixup = imx_pcie_cpu_addr_fixup, }; static void imx_pcie_ep_init(struct dw_pcie_ep *ep) @@ -1449,6 +1468,13 @@ static int imx_pcie_probe(struct platform_device *pdev) if (ret < 0) return ret; + if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_CPU_ADDR_FIXUP)) { + if (!resource_list_first_type(&pci->pp.bridge->windows, IORESOURCE_MEM)) { + dw_pcie_host_deinit(&pci->pp); + return dev_err_probe(dev, -EINVAL, "DTS Miss PCI memory range"); + } + } + if (pci_msi_enabled()) { u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_MSI); @@ -1473,6 +1499,7 @@ static const char * const imx6q_clks[] = {"pcie_bus", "pcie", "pcie_phy"}; static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"}; static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}; static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"}; +static const char * const imx8q_clks[] = {"mstr", "slv", "dbi"}; static const struct imx_pcie_drvdata drvdata[] = { [IMX6Q] = { @@ -1576,6 +1603,13 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .set_ref_clk = imx8mm_pcie_set_ref_clk, }, + [IMX8Q] = { + .variant = IMX8Q, + .flags = IMX_PCIE_FLAG_HAS_PHYDRV | + IMX_PCIE_FLAG_CPU_ADDR_FIXUP, + .clk_names = imx8q_clks, + .clks_cnt = ARRAY_SIZE(imx8q_clks), + }, [IMX95] = { .variant = IMX95, .flags = IMX_PCIE_FLAG_HAS_SERDES, @@ -1653,6 +1687,7 @@ static const struct of_device_id imx_pcie_of_match[] = { { .compatible = "fsl,imx8mq-pcie", .data = &drvdata[IMX8MQ], }, { .compatible = "fsl,imx8mm-pcie", .data = &drvdata[IMX8MM], }, { .compatible = "fsl,imx8mp-pcie", .data = &drvdata[IMX8MP], }, + { .compatible = "fsl,imx8q-pcie", .data = &drvdata[IMX8Q], }, { .compatible = "fsl,imx95-pcie", .data = &drvdata[IMX95], }, { .compatible = "fsl,imx8mq-pcie-ep", .data = &drvdata[IMX8MQ_EP], }, { .compatible = "fsl,imx8mm-pcie-ep", .data = &drvdata[IMX8MM_EP], },