From patchwork Mon Jan 8 23:21:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 760838 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2053.outbound.protection.outlook.com [40.107.8.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 8A29556B62; Mon, 8 Jan 2024 23:22:20 +0000 (UTC) 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="il7FVr9O" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B7PC2mPRZX7onW85meibs4yCDulraaWBIp/j4feVs1lo8/5rek7uqNEOc2NngLZh8IF6Q4xeDvQ72f0EqNmjWopGJKHY4cDpe38IuETeQIBH+platrWbBPkSnK7mJkSTpvde9VAQHqRgXNBlyvU3TUQvTgsTfqp5bEb1Tg9fRLN8He6JbsZ24nEJa62U8ev7nyHCQmhjXdFXia0XlXGndRM+lXqx62avgW26w+2+ILP6Q01uf076Bs7FDTtWoH7qWSFxP+fwvGTwtjXYYL9Fl0RBJV4J7jGQYNDMYzAbDjTIOpBiqwJUcZ4cI+UgAJl6yD7srRL1UEl8Ux1Zv2c1qw== 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=A1CrNRT5ctZHxCjcDQCzV3x7HL/s9hzwMWdep+KVbg8=; b=lzpjze1gvLr0TLsyNQW0kH4//5GsZw92gAlL8gL9Pd4fPtL6IJvWlV3thCSX1RSCLGXPJf9rHfIC4QbbtM/tidc9jGOLU1Ra0Ssfdm4dwOYdRBFtszWjIQ+gAn90Heii/knOoJImIOC2+nICV9D0MCnelqQdapIqpMQ+FmqKDYJFgJEt9HkoHxfm6+lBR9i8fsLsaupBG7GK+V9WlPnJkG3G9RvC58J/1AE+mOzP8JCJWriCrpRX3AVXzA0CvpC/W8BYV3X4YmZtvcDPM4TzFaK/au+Ek5TaRVMffWjmQjEQvUvnYA/0CwAJ9lvmObcCD0i4NRNKGLt38IOC0S8OMg== 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=A1CrNRT5ctZHxCjcDQCzV3x7HL/s9hzwMWdep+KVbg8=; b=il7FVr9O4/KnemcOXtoOPjfEm0ogs8cVxLnFkuKMRHPT70hCIDMklVXbPF2BAFpyk2X3JoheH67yHpihBSIdDNZAMgNv+0yP3+jmP3fTesps7MFt3R5OOskfxPG6mYze9yl+tu0OnjkAgqzKfwGruZMKcY8yBP8F6Exsvf1sQAI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) by AS4PR04MB9338.eurprd04.prod.outlook.com (2603:10a6:20b:4e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Mon, 8 Jan 2024 23:22:17 +0000 Received: from AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469]) by AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469%4]) with mapi id 15.20.7159.020; Mon, 8 Jan 2024 23:22:17 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v8 02/16] PCI: imx6: Simplify phy handling by using IMX6_PCIE_FLAG_HAS_PHYDRV Date: Mon, 8 Jan 2024 18:21:31 -0500 Message-Id: <20240108232145.2116455-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108232145.2116455-1-Frank.Li@nxp.com> References: <20240108232145.2116455-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR02CA0063.namprd02.prod.outlook.com (2603:10b6:a03:54::40) To AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB7511:EE_|AS4PR04MB9338:EE_ X-MS-Office365-Filtering-Correlation-Id: e04d9f69-f39d-4d90-067c-08dc10a0a6e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iu10UdCgxHFVQGu5saVR4g56XVj10Ax1N9EHFghALJPJKFbzjQTQSUUa0pF+Ra3xFoJ4Z96ajSCMJBFqHVX3CkFMn2+t/r55IA4NZLBYHFS4q+J4QH94WzTP+GVv8nam28tm6Bsj8cW288hhRNgfz21kDmOH3JifFRB7U9mvvAu+e2/K3RoZyaijrR3S9JwCUcrcSPh0QKhzwJyvZniSdb11DxebOEdLe90ozu8TbfuJY0qazLF2WQPG6oDmwZsHzVrlVDbwzthmPYHhGfU9RqpS/SrGQvQum61u99BlfRndF/QLHkmy5rju8y6Qz2Nukk/lJpV2JUQTtyk12ISRdBqgerbQ3feRnJRIvixQ03bplW443Pu3ViCif1QGIUiqaE/6AWWmAMPOb7RUpGIcsA2xspmtX2BIcJ20hZLNujJsCs2ydM4FC9UrTx2jZnaE5dhpgWTgIR6joQOSTEfGETjayxO6MJgdmhmS1Tm//AJIVAo/UuGUEwpYtcURFUPXOKIaBYi8HtVvwvU2CIQEfnRt3kN/bBPl0gGF7tCF5YcKZqMKQvPptSzGoSz7Gl3t2smpR6dbEWO9e8A9gze1i6Prs2hpiSYHlKai0zXUvjyxRISVfORcgooHO0QYWRG/ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB7511.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39860400002)(376002)(346002)(396003)(366004)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(52116002)(6506007)(2616005)(1076003)(6666004)(6512007)(478600001)(26005)(6486002)(38100700002)(86362001)(38350700005)(36756003)(41300700001)(83380400001)(7416002)(66556008)(2906002)(316002)(66476007)(6916009)(4326008)(5660300002)(8676002)(8936002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z4oKPe+0lXs3PsY82DGNjeLGGtpGO4xcZwuWrkbnnVYs1n7QPhER7TLoX2GsiP1JTnfsu/mibegsYTf6A8azNqKgw4qv0c3TTb3giY4ukO9/UCdOyiRHyk8Ni7DARdRNqRJ16Y7gUc1Nz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LokTtZCBQWU8xqcehRGcKAFi/fymnT9IC9hnx/ZuyK+CNzhEG+HVSs2TLM/PNSQ3rjFfHkVtttStmAy6onj4P68QeNagshxV3nQsPehgsBZfSRQX/aeRM8vPK/SgI/sVnI8yZBGIIZCN5W+//AWtAb5ljmrkEiqNV7mj+E07z1UaVTh4yoqQDjgynlH5JaZSn9J9J4KOuAa0JzSXJp14CEDoYsQQ9LJfaPiyIafc5Wz8UBeQtLtY2ezFxaNuecsv7fnRGbbI8latGmctJ+UtigBtr7o69EkELr9u16uHhF1virGzLQU7YC2xLg5/HJcNFlqFzfh9Lf5QNSpRihHI2JRxjSG1Mn4tVgZAmogdqXYHwRR/Trn X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e04d9f69-f39d-4d90-067c-08dc10a0a6e4 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB7511.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2024 23:22:17.5591 (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: RSOTKagLjGSEaHLXPOwKz4dqPkwYiaMGISxmkEtb3/zHFPkqX2/1BafsoICOBKT3N0F/XkrJQf0vmdZllEZBSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9338 Add IMX6_PCIE_FLAG_HAS_PHYDRV bitmask define for drvdata::flags. Reduce switch-case structure for handling phy. Signed-off-by: Frank Li --- Notes: Change from v7 to v8: - renmae IMX6_PCIE_FLAG_HAS_PHY to IMX6_PCIE_FLAG_HAS_PHYDRV Change from v6 to v7: - none Change from v4 to v5: - none, Keep IMX6_PCIE_FLAG_HAS_PHY to indicate dts mismatch when platform require phy suppport. Change from v1 to v3: - none drivers/pci/controller/dwc/pci-imx6.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 4912c6b08ecf8..adc90099ec7f8 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -60,6 +60,9 @@ enum imx6_pcie_variants { #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_check_flag(pci, val) (pci->drvdata->flags & val) #define IMX6_PCIE_MAX_CLKS 6 @@ -1277,6 +1280,13 @@ static int imx6_pcie_probe(struct platform_device *pdev) 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), + "failed to get pcie phy\n"); + } + switch (imx6_pcie->drvdata->variant) { case IMX7D: if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) @@ -1306,11 +1316,6 @@ static int imx6_pcie_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(imx6_pcie->apps_reset), "failed to get pcie apps reset control\n"); - 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), - "failed to get pcie phy\n"); - break; default: break; @@ -1458,14 +1463,17 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM] = { .variant = IMX8MM, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX6_PCIE_FLAG_HAS_PHYDRV | + IMX6_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx6_3clks_bus_pcie_aux, .clks_cnt = ARRAY_SIZE(imx6_3clks_bus_pcie_aux), }, [IMX8MP] = { .variant = IMX8MP, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX6_PCIE_FLAG_HAS_PHYDRV, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx6_3clks_bus_pcie_aux, .clks_cnt = ARRAY_SIZE(imx6_3clks_bus_pcie_aux), @@ -1479,6 +1487,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM_EP] = { .variant = IMX8MM_EP, + .flags = IMX6_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx6_3clks_bus_pcie_aux, @@ -1486,6 +1495,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MP_EP] = { .variant = IMX8MP_EP, + .flags = IMX6_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx6_3clks_bus_pcie_aux, From patchwork Mon Jan 8 23:21:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 760837 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2088.outbound.protection.outlook.com [40.107.8.88]) (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 7A60956B92; Mon, 8 Jan 2024 23:22:32 +0000 (UTC) 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="UWXdZi8D" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V6zD3ltlt5xk/VscOFiDKOjv6gyD73uiYVEac4xAqo147OBXUOfBkyw49u6KnV9evT/E/sB5tis2aGEaWg/x3i7MNDpetuiH1vDAk1PLcpJhltStuD/HDAauRhqCLLIh3Ox3xCHRzILOHogf18mAm8FIZ8q+WWOT7zGHW8StzonDMRt5mTT8OUny/EXTf67J1xWmMUAsmWIG+kw7htBBEyg2axan3O820dLeaZNx8eyBKowa54CspDk/KFjY7f7TeEFupqT5NIYL5RbJo/0WNr8MRbsHqMSD4NoM8E84VVBwgye3H114MqZBQq3S/KOkLjUlRQ2qAVMXGvLTlLgDMg== 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=FkptuwPkZvm+k4HZ0KmqkduaVwiBlCWTjivfPMQ/Z1Q=; b=DMCmQb0skZcw0U+Aowkptw50rqOCY3smDyES3o2CgJPwZNHNxoD3yxQkhgz4wb5c/wFx82YCuyQRPAjgYvuch9eX8nbVNXkJ+q5ogyN/ITn5OtWB8XS7SBV6IJcYr7H5TcbgQCx6HTgE8qWeC5O9I4IgJOziQRQhmpTNZQylSk5n9K4rrkeYuyQj1atyutzQStgqge3UCEHpMArUAuU8FVxjK941qnB+I96jqzVmvxY+uWEt5vFS6bfNMo92mpC9217Du30m7e6xqq8CGXIGz6/Rh/dyPhJypshsj7UlFEjjbby76lfNZOY3AVx43EhYS58Yl03n35XEsYF3DeDZRQ== 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=FkptuwPkZvm+k4HZ0KmqkduaVwiBlCWTjivfPMQ/Z1Q=; b=UWXdZi8DNu1LuTAIyTrY16tI+IxmGPNl1sLYLMVkd0AVnpF8b7uBM8QNWJ0Z4bXt3Hj9w5uv49/UZdOYUZTWYj7d8xg77GdUjy0bdqOvq4fVn7Jnd7eVVihGAWnJzVtlF/ZYIeVAFA5M2D9wK7J9MOxhFISTBqJm3a15oiwT2F8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) by AS4PR04MB9338.eurprd04.prod.outlook.com (2603:10a6:20b:4e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Mon, 8 Jan 2024 23:22:28 +0000 Received: from AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469]) by AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469%4]) with mapi id 15.20.7159.020; Mon, 8 Jan 2024 23:22:28 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v8 04/16] dt-bindings: imx6q-pcie: Add linux,pci-domain as required for iMX8MQ Date: Mon, 8 Jan 2024 18:21:33 -0500 Message-Id: <20240108232145.2116455-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108232145.2116455-1-Frank.Li@nxp.com> References: <20240108232145.2116455-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR02CA0063.namprd02.prod.outlook.com (2603:10b6:a03:54::40) To AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB7511:EE_|AS4PR04MB9338:EE_ X-MS-Office365-Filtering-Correlation-Id: a1ad3ce0-a9e0-4df8-3436-08dc10a0ade0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y6x8x4TemKOl/uvK0ZJQqWMnZqlR8HbRKOQNAMb9MBs+4m6CP4Ye39/8FAvd8LMLRhVVcuDKTpKM+bu7EP4U6ylVt4mc+Zj1onMrQnCzistfFXheNlkq/SVm7M6m2blF+QtfOBNwSAP2eDbVSoEVTYeHoAn/EPesDt2lhtlwiWpHUFkEJBnyKyoPMEZRIUd4PhAwjWUTyaEQVLknIAKkbDsGQ6A2WIBHS3GsyHNtXqNDoPHtSG3mc71rkJqOXJgajbC0aO8aCJi3rdn9LCDZLRo4QK+RVRdQ20aNbOrdCDMQPOba5Vp6A3qQoL0bHBTa8XTJNZE2Ryqjg6hIyZMEdvvte6CeWyzrOQlhENLRB7dIGhiz7c3WbJHZ+jMLC4vM0+iHU7yypqwcY3Ys2GNeuxRyh+PXdS5wFC9xTOjVDyEanoipZHeyY0kmVIIthzvqvFhctmiSZ43xU+EgWKfSMdmjuvfpAik+kjmw9R6CbrihFwBPaBoXkc1+Y9eyIcOGfMl5ZI9d7fUW3aXtIG5KDCReKTUDwme0Apo03bq5iMyf47eQhR6rXuNZRbDcZq5oOC28HLtrNh8SpTji14H0RUo/oW+WAOK15e9Kd7/1PNjAjLIKuNfiq5WAYv9A9LmWOJnURM7wF2wc1uXQF0wNLIj9x/C2IZ5MNLnf4sL/yP32Vlk1tueBb5f6ULGavwND X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB7511.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39860400002)(376002)(346002)(396003)(366004)(230922051799003)(230173577357003)(230273577357003)(64100799003)(186009)(451199024)(1800799012)(52116002)(6506007)(2616005)(1076003)(6666004)(6512007)(478600001)(26005)(6486002)(38100700002)(86362001)(38350700005)(36756003)(41300700001)(83380400001)(7416002)(66556008)(2906002)(316002)(66476007)(6916009)(4326008)(5660300002)(8676002)(8936002)(66946007)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FSK64xFEJOgbXMH8cm7u6wehPJSg4/BhxILGSojWi4OYKriMT1qgNe/8jHWftoiLCJ4DCqCRwBAldavy2DGS/N5GglIfCYoq/usN1ebS6OOEODIV1DKga2euJGRrKehbA4QB8lQg+8dBqxkVgKdYZOREzomROOge10SNcyTR4/F3K+DLQPwd4wjLU5xBYQkrs6n1n9gfTyGCDr74J7xkTGUVoK91pfHjeVn6vE/BDCYB8g6DK7KPg6R+Q/OsrUiBjB4DbeBInzhGB3Bo/oU6u44oYVupmzBne7Insa5r0mxMEe4OBq6VaoSJh8uXAYJnREO/Y73RZgGruXCuxrldWJywmNBqLb2pjWsR+c13nqkBfyRkhmb7rApIkfCtjy9oaSEGVCW6au0B0fMMP/zz3Z+Eidvj1FQD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CqUOiz4erSHjEb1W0pwIs8fQbSMxTOsay0gBbwElDgh34jqXukqyg/kx9/YXgvn7K7bZHa+oQet7dEy6M3ujPNNs6QNLLBfEuzvP/7rd68 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1ad3ce0-a9e0-4df8-3436-08dc10a0ade0 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB7511.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2024 23:22:28.5845 (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: svPx3IpPcFKVt/J0Ke5+UW6FAaDbKmIvQ55BcSmkjJFwAZSp4F3VE6oX0bHfe/txH1cEAJDEzyOjKbDao0xnqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9338 iMX8MQ have two pci controllers. Adds "linux,pci-domain" as required property for iMX8MQ to indicate pci controller index. This adjustment paves the way for eliminating the hardcoded check on the base register for acquiring the controller_id. ... if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) imx6_pcie->controller_id = 1; ... The controller_id is crucial and utilized for certain register bit positions. It must align precisely with the controller index in the SoC. An auto-incremented ID don't fit this case. The DTS or fuse configurations may deactivate specific PCI controllers. Signed-off-by: Frank Li --- Notes: Keep current to avoid DTB_CHECK warning. After these patch merged. Will add linux,pci-domain in all dts file. So dt-binding can remove condition check by soc. Change from v5 to v6 - rework commit message to explain why need required and why auto increase id not work Change from v4 to v5 - new patch at v5 .../bindings/pci/fsl,imx6q-pcie-common.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml index d91b639ae7ae7..8f39b4e6e8491 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml @@ -265,6 +265,17 @@ allOf: - const: apps - const: turnoff + - if: + properties: + compatible: + contains: + enum: + - fsl,imx8mq-pcie + - fsl,imx8mq-pcie-ep + then: + required: + - linux,pci-domain + additionalProperties: true ... From patchwork Mon Jan 8 23:21:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 760836 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2047.outbound.protection.outlook.com [40.107.8.47]) (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 E42BE5732B; Mon, 8 Jan 2024 23:22:41 +0000 (UTC) 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="oqIIBBsD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ltnhsRaY2dnTi/y2abv69gjpdzVpoDIDsZm/2uK7L4TgBA6urg3kC8ul6P8/QCG3p18ctcN2M9IfhM0zIu3r+6Ty2FIMkmqP3IEbtJdx8s8tQ7nLXeWMBtn3CTmhelFT0tuXZvpC4pbYkyCF1EsKUKfFqVF+v6lSo5cGeB/WmXFoWtZiTNTd6Rv7m71NN0Hf0FI3ahscyBRInMw2oRIXSpJD/1IVSl+yptFDZMJStPmeinD8EtPs8CaefSBo+2IRN3SP0ZcgwwBQXNr0ARKSThf+cg5182DVAxndtujrdoQ1xCBD/a3pvMnHuuwX5sdgQuc95BlwuYOllKxF45qYSw== 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=CsvNnu8SlEkTdDeClAfZIHbuLoehsz9bDSDrPJk5scU=; b=A/TgQb8CmuJR3jsOg7QwKEwkDgDQo1hJewVoPtq8i/a3HSw2TRDRI61kGbnFoJsul8PbwEdNKt+rlRgRsyprsPsn4H47U/Xt/mvJM9HUuXSgXXrjbbpeKJPVaK+tRX7E9M824LnC8qvuotOk1e8F6hYCjx6BDXaf2Gdj2MbLAwIv5QFey2xztpPvUBOXiY9r36jDPi2t1ZZzkSG3bfJPFZ37zeApQ876WNzze5XPB0350wVDaRFQ1FnRMvzQCkTrMsk4sO2y6/hbiLnR/PVVPU2vHL074vNKVndLmUF1OiFJJ6bD9766z3JoFqgeevA25lCgYymHlLLszdc0eK07Fg== 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=CsvNnu8SlEkTdDeClAfZIHbuLoehsz9bDSDrPJk5scU=; b=oqIIBBsDSYiPc2jwzA8h3ZwqeOFsHov/EnG5wuSb+mpdmJIPcm9VJ2cuZOI3p8Klu8tUpCJs3hmxievF0NF0IM5Z2tOwPSPkqc9r/41oMOglyBH+ICc+IT9nLhL+pZfgwuLIormMKXLa0yK1e6h6VyzIFsnYD342Q7U3Tpd+Fjo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) by AS4PR04MB9338.eurprd04.prod.outlook.com (2603:10a6:20b:4e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Mon, 8 Jan 2024 23:22:39 +0000 Received: from AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469]) by AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469%4]) with mapi id 15.20.7159.020; Mon, 8 Jan 2024 23:22:39 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v8 06/16] PCI: imx6: Simplify ltssm_enable() by using ltssm_off and ltssm_mask Date: Mon, 8 Jan 2024 18:21:35 -0500 Message-Id: <20240108232145.2116455-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108232145.2116455-1-Frank.Li@nxp.com> References: <20240108232145.2116455-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR02CA0063.namprd02.prod.outlook.com (2603:10b6:a03:54::40) To AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB7511:EE_|AS4PR04MB9338:EE_ X-MS-Office365-Filtering-Correlation-Id: 11a4b0db-a1d9-4905-515e-08dc10a0b48b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8yIvxKu+dGd0lJ+C80MYCakjw9kPZNYk8jBmINOhtBTu+bYz32Hstg3YIeUgnodZ9D6O8Na+knszqRtODUERBXFb8eZN6azHOOMLdLl5NWFU0jxwah1FODoZpUK7NCwFMIqZsRS9UBRn9F8cfUtkLlFfkMjKRgfibDAhS/DHrVsvqcm0APggYFzGtqJDzhTM15knKIiSY6AAZstppSabqqJ81u2Bgi5eQ35EEN+6eYsR6rVC+8/2xD+LVHijo2jHlh0H+udmMnPnYt1+m7jUiuALbBSQ4kUkMMbOWD+hICZygFAIm9To7fJTwxn9QSxrWg0I0XZhfscMsksAmU9hpz36YiJT5I8lQLH3gQXyfExHxkkCE0wJefm85sWcyGzMHbp/70JAuJD4vpYQRUFJaDeSRZbQZvL6x/7TNnjNloTYUg3sHn+i6vi5hV00PI8wnKKACLHtKkJfPv9EaKNCxe5rwqdcUlxN+Zg3MNHSPYNUKVEEYRIWQic9UcYdhdqPOWc3H0pdH3FKgfs36VI0T1VabxJeGZf/lSjRCDBuXSGJAJaTP2v4SVm5/J2aSzxfO2I85+Y75fuyxST1KtE6l2iroUQuMQk3NoeU1sZd9UsV+GKwm2XGRxwpQxeAuw7h X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB7511.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39860400002)(376002)(346002)(396003)(366004)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(52116002)(6506007)(2616005)(1076003)(6666004)(6512007)(478600001)(26005)(6486002)(38100700002)(86362001)(38350700005)(36756003)(41300700001)(83380400001)(7416002)(66556008)(2906002)(316002)(66476007)(6916009)(4326008)(5660300002)(8676002)(8936002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mTycPkRSzcD2EW8h9Eku25Bbid34XHuowzGQ1wRAD1hAWiHq831BnUP/KsmjwtaKMVk3DUVSZKlBODvFqK0NdF+Rug8z7zHcusW77aAkQjHG/KBSWS84aXY7WL01IobtDTXHzHKLD6L2ZDXQ7PCAOpP3tkepWCgN+xWBa7lOMBboYa5dqiRTLjRG54fOVU+AL8+VSF2q9AwWMQd4c7v32FbL/vBSdDVUU0JYi+M0KvNFb0GBLI8ErNpbOLJvORlq3G5yOtN74VhodlA9fFkiOT+lwzLIjqJdXJ+YML5Dek9y1ejXeehrr9t4mDGNHYpBzdfkU1U3ECKQgO+nsA0QO9bMq6wu1/J/EIwuhdIuPuxKye3PuUDQk2kPYE2iRm2YhC6Jv/UMT8m/RweLttCDht2CfgestYS9tPccqqyhKLEZMr/CdMkYEoBf8QKQO/2d9RJzjfVemr8OPtH2qV34OsAsEZso8o2m0WKUEqUbgcErYrskhhhI7mn3HcfN7LsKF0GexXwYeZEaoITybhVX75eOByjMRHevLQGH4n+SWIqWE4Bgc65ZBf597botGkG56qDIXtMBtkEgAdjwf2VcIYmaYswTq2Eq7xCgcBR/7x3ztSRU2DSYIEpkM7vdAawwzceKZD9R0g1jRcMP/3t8AirbABQRRNuyqLeJqxq68CLdQ8jd1sgWPsOvsXQEIfphXb2m5YdKQWVBJjvT2P0GyjKOnpjx6jZzjwHIbbPS8Oc8Qrwr/mjV9drxGf79KlwkeMSUNTWzdauBS3hXv46HH/d4W40oXMoV08j2e3SCBwq0BQKi6uvlwvWMoG6aSdpdRaOqeljCXaQu+k4SSncrVb03acShIO5Oo2NmDl5CEYbFcPD7l9q1Zbxy2v2ABQQh2Sfiwsnt7Smai+vSa4+vOhtRRcaXcLpBNLixmJUhsUsMxJJlbC+e8T9ndXwjNF3c1uImMqyZQjI45O9dxQMxo1/AxwF2FWfg9Uqm/WByb3I5KdbTpoScAHbJbibqDPzEQyxPqqX8MofzQqB+D5n/EPZFbvxvZcxLW70kWbpoPw3rCdiNxMsXSlosZpdI23Q+OgcWdkEQwleN/eoRz6xF+llQsm4o53/CaXIOpkwrM1P05GFUj0FiUcN3tlpzZovcX1dydNDOkyPmZx4iCCFKLrLeBbchpzvofseMODPhwNHDrzyRKbZd1UWuqPa3MAw2Tksk5ZvxftFB57PTWwdjLH7X5Hnkw/U/9Rrvon9PyROiMCbn8BrxXNOO5J1ZJVa/zVZ4ev17kZ65pNbPJa6DP8MRHhtw4s0B7UOnc2sk9uZKXkpx3dTAi59gKnsNHLu83QxKVmKUiNsFH3SE2mcS2HQkHG8aqL7r0zqAeTtp1/v0Fb5XTJMpbfotHEwmSU+E9chl8coz6qDM/bBBfHvnnFdn3gLowdSilUA8Ij4su8U8BcQdDwJ/3dbvwUSolKC5VBRiPAPghsAmY5Efg4FC7b2yY0gV4Mj/j4NTl+EXn+Or5a1ZapuM7dr3b7E01FQOKxY+z47ptJW9giMVrpq5u8cFkWRt2Q1eBXfg0lWZdqoL3ftjgGDRrX4p2JFgYY/S X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11a4b0db-a1d9-4905-515e-08dc10a0b48b X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB7511.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2024 23:22:39.1423 (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: brh+GJl0Hp1MJgcL+3IWGdmxuXuwWYmBhoIEHYCK9/zjPIGnJKP/AE/s/By3C5jf4EtKqRe+zAe9SNt5yvbMuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9338 Add drvdata::ltssm_off and drvdata::ltssm_mask to simple imx6_pcie_ltssm_enable(disable)() logic. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - Add Manivannan Sadhasivam's review tag Change from v1 to v7 - none drivers/pci/controller/dwc/pci-imx6.c | 37 ++++++++++++--------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 06aa40a185283..818e73157e724 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -76,6 +76,8 @@ struct imx6_pcie_drvdata { const char *gpr; const char * const *clk_names; const u32 clks_cnt; + const u32 ltssm_off; + const u32 ltssm_mask; }; struct imx6_pcie { @@ -775,18 +777,11 @@ static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) static void imx6_pcie_ltssm_enable(struct device *dev) { struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); + const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; - switch (imx6_pcie->drvdata->variant) { - case IMX6Q: - case IMX6SX: - case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6Q_GPR12_PCIE_CTL_2, - IMX6Q_GPR12_PCIE_CTL_2); - break; - default: - break; - } + if (drvdata->ltssm_mask) + regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, + drvdata->ltssm_mask); reset_control_deassert(imx6_pcie->apps_reset); } @@ -794,17 +789,11 @@ static void imx6_pcie_ltssm_enable(struct device *dev) static void imx6_pcie_ltssm_disable(struct device *dev) { struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); + const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; - switch (imx6_pcie->drvdata->variant) { - case IMX6Q: - case IMX6SX: - case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6Q_GPR12_PCIE_CTL_2, 0); - break; - default: - break; - } + if (drvdata->ltssm_mask) + regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->ltssm_off, + drvdata->ltssm_mask, 0); reset_control_assert(imx6_pcie->apps_reset); } @@ -1398,6 +1387,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6_3clks_bus_pcie_phy, .clks_cnt = ARRAY_SIZE(imx6_3clks_bus_pcie_phy), + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX6SX] = { .variant = IMX6SX, @@ -1407,6 +1398,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6_4clks_bus_pcie_phy_axi, .clks_cnt = ARRAY_SIZE(imx6_4clks_bus_pcie_phy_axi), + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX6QP] = { .variant = IMX6QP, @@ -1417,6 +1410,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6_3clks_bus_pcie_phy, .clks_cnt = ARRAY_SIZE(imx6_3clks_bus_pcie_phy), + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX7D] = { .variant = IMX7D, From patchwork Mon Jan 8 23:21: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: 760835 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2074.outbound.protection.outlook.com [40.107.104.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42D6C5787D; Mon, 8 Jan 2024 23:22:52 +0000 (UTC) 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="huWoye28" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CUwxrW9lGeLQOZ9pS4WtM0jVcnZAiv3joFjDnHgtrJGgf2kgG3oII6Oju2ss6HMEuYr56rs9BlaTvz2g8W4iegno6tLn1T4ZWAiypbLV8MD7hrw88hLkSqhp1vDQM3Yqa9i7o5Qg3AhO+NYMSD4tkv9G1MyGZaTPu8p69QuIVnTnz08wIY7K84fzWjjatVZvzZqHT6OpuGYlaBULcpSQn7kt2VfajIldHkcRz8f/TVS/tJXqext7rQYVvLvqN9mCAvtaOe0uI5WSfQaX4ReQfDkBbg2IVIC7sx5At4m/8SuiVrbn2MvGJ0Z5e5/GF2OD6BjBOcCLqTIWEbD5uminYw== 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=BXE707XeBQjXalsNVVxh+UpXuEecTt2NAkDr4BSPf3w=; b=ifjEM1rgEKx4iOSHOBqfVHp6xf82w78HX+DX/0/78uD6KSlwNXTBqI0fsDRPJpXH6cBnsGExEbe7obbN6lP97KQ6B+xv7ngGyiA4ElK4YLfp1Jc1nVZd6qUksf/WR+sR9G4PjTgMkS0biVZeIAuoLfDs7YkBp2/zcMlj8Wj02/aofw8JnM9oaQjZnDjDRzgX4b4gsG+hKhD8T9eaLAkvcQn+E6OhOZjbrVaLwwczo0rzASDy/VJz7pJjK1bj+krzQ34NS6vEGm0JrLGAF0pAn9kLFatc9pD3lA3xYZmBQqoa+aU+u3NKVDLqr1miOExv249nGY/GKLQiYyENK8O3VQ== 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=BXE707XeBQjXalsNVVxh+UpXuEecTt2NAkDr4BSPf3w=; b=huWoye28jHBWI8x7QOQaSsrJkZUP2Yd71CQ3u34GkR3tVVELKYRKDQYaNPmQ+p6gcaD9LAI3eJciBwKdnorN/d7+depJ/3GGKKLnPmYmJ56uph/5D3iMibDox3En7hwLZpB1cb//8Akk0z0/AMxrC2aBfKenY6tIYGBobWBHsds= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) by AS4PR04MB9338.eurprd04.prod.outlook.com (2603:10a6:20b:4e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Mon, 8 Jan 2024 23:22:49 +0000 Received: from AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469]) by AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469%4]) with mapi id 15.20.7159.020; Mon, 8 Jan 2024 23:22:49 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v8 08/16] PCI: imx6: Simplify switch-case logic by involve init_phy callback Date: Mon, 8 Jan 2024 18:21:37 -0500 Message-Id: <20240108232145.2116455-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108232145.2116455-1-Frank.Li@nxp.com> References: <20240108232145.2116455-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR02CA0063.namprd02.prod.outlook.com (2603:10b6:a03:54::40) To AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB7511:EE_|AS4PR04MB9338:EE_ X-MS-Office365-Filtering-Correlation-Id: 280a0842-eca6-4481-113b-08dc10a0bab8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VOhr5GZoncRi4GzVk9J2L9YNfL9L3LVVvJjxOdclFV0MRmduL3Z88tvSt0vNysQSuPi30nmprjPmUSlRgYirIA5Wiq0WF/DJW8FfKIM9yctxVTQyBsuMEbhxmmkb2o4EbW9N7hQLlDCngCF0chUHIkrZVg+IjUfi9Sg1ep4xT/l1+SZhnAW7zncDQsu7nGxYWhvT4grN5k+pPX3Ok4PHlcrZ59f1lzZX61LQo06yv7J8Vi2UWDwg17piTLf+HSUwM+WMQzeT4NXHTgWVvqRFqrAUxLKsZzd2GaaLDGJOjtnl4TkVgvvVUgzmWGssV5ohvt+BNcKHIHJy4yHoHlFCEP1bCCPj1IF6IX1A5AWB6nSLC2LkNFxMTS8eWqxuVeDc8WJn02QVTuZEB8Wcapr0s8Z2X5RDCrSbk7xPY2KT17qmmIS4Yveo2KZY1InBWgQ9xeqwMT5tdQryLJu/qExtGuKaPbwGNL7odNBNl5q62jDiqmoq70kD37FCEulMvz4BRvuQq02v2k9tJZ+e8p8Mhg+RlRI8/GoVTmc7+eSHVoG8TZot/eMJS3pvmJziTLBoyCeMzvnorW2/9uyCzy8hMifn1ChtJATyE3AUaXUl4xPLRXjAo4HOqmvNjFY04UB7K8lQWXuZNe1TNiZPE0+IlP8ouTREwbq6upOWBMk0LDQ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB7511.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39860400002)(376002)(346002)(396003)(366004)(230922051799003)(230173577357003)(230273577357003)(64100799003)(186009)(451199024)(1800799012)(52116002)(6506007)(2616005)(1076003)(6666004)(6512007)(478600001)(26005)(6486002)(38100700002)(86362001)(38350700005)(36756003)(41300700001)(83380400001)(7416002)(66556008)(2906002)(316002)(66476007)(6916009)(4326008)(5660300002)(8676002)(8936002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FcyHl2RYZd1qpNSEb4wRIqJPaI8iw1BBHMVwxjI5rEtgi6UR6vShuQyXYSQUZpkZey2dzEPkmThi2ayZJlf0kj8AKMLFUquYM3Cbe3Z1Uwsf0HlxX5/tn9gGGJlP6WMJcsYNjUTtnx/6lq+yjr0VpxmNHAqz8yZdHeo6lMaBpZlhE0tQ1QYEiyb76JBON2lfQTj75tZfBu1hT/nmYOIjCDzwtM1R17V6F2tsFO+Gh/BZbiOZtaNkOiGB5uuRGgaLB8DIQkaJLj1s6pht2jt8z9gNxCzOLiGv3df+AKPQgaUIu3MQZqwJS0ghppADXhvJLHA7b06Hl7Qlx3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3U512WrKV19ScSfhfpI8GvBE20jCbVVNYnaVmhKNTLgr5eoE27sCC7ST9lPivwNSyCz+gQH/C5qr63QPYKZMMRp/w7x0++pjlBhvDYvrB5iptmwZ5HolBpkgzV6Uy9oqPJbRmP30648klnSTVM3TOaKLeW9LYiQz7XoOEujB0Cmz66gbu2Mba+rHMDrW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 280a0842-eca6-4481-113b-08dc10a0bab8 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB7511.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2024 23:22:49.4936 (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: f+9ETk0IBiVQQn6tMARulnMptZ343XtcHOXgVxxOLz4zsV/NRQ6I4JCEsLsgX/DvXzL0En6X73cqHjrO1dPaXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9338 Simplify switch-case logic by involve init_phy callback. Signed-off-by: Frank Li --- Notes: Change from v7 to v8: - rework commit message - wrap comments to 100 chars - return 0 at imx7d_pcie_init_phy() change from v1 to v4: - none drivers/pci/controller/dwc/pci-imx6.c | 134 +++++++++++++------------- 1 file changed, 69 insertions(+), 65 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index fd83af238fa60..ac338a88fe21e 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -69,6 +69,9 @@ enum imx6_pcie_variants { #define IMX6_PCIE_MAX_CLKS 6 #define IMX6_PCIE_MAX_INSTANCES 2 + +struct imx6_pcie; + struct imx6_pcie_drvdata { enum imx6_pcie_variants variant; enum dw_pcie_device_mode mode; @@ -81,6 +84,7 @@ struct imx6_pcie_drvdata { const u32 ltssm_mask; const u32 mode_off[IMX6_PCIE_MAX_INSTANCES]; const u32 mode_mask[IMX6_PCIE_MAX_INSTANCES]; + int (*init_phy)(struct imx6_pcie *pcie); }; struct imx6_pcie { @@ -322,76 +326,66 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return 0; } -static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx8mq_pcie_init_phy(struct imx6_pcie *imx6_pcie) { - switch (imx6_pcie->drvdata->variant) { - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: - /* - * The PHY initialization had been done in the PHY - * driver, break here directly. - */ - break; - case IMX8MQ: - case IMX8MQ_EP: - /* - * TODO: Currently this code assumes external - * oscillator is being used - */ + /* TODO: Currently this code assumes external oscillator is being used */ + regmap_update_bits(imx6_pcie->iomuxc_gpr, + imx6_pcie_grp_offset(imx6_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), - 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), - IMX8MQ_GPR_PCIE_VREG_BYPASS, - 0); - break; - case IMX7D: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); - break; - case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_RX_EQ_MASK, - IMX6SX_GPR12_PCIE_RX_EQ_2); - fallthrough; - default: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX8MQ_GPR_PCIE_VREG_BYPASS, + 0); + + return 0; +} + +static int imx7d_pcie_init_phy(struct imx6_pcie *imx6_pcie) +{ + regmap_update_bits(imx6_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) +{ + regmap_update_bits(imx6_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, - IMX6Q_GPR12_LOS_LEVEL, 9 << 4); - - regmap_update_bits(imx6_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, - IMX6Q_GPR8_TX_DEEMPH_GEN2_3P5DB, - imx6_pcie->tx_deemph_gen2_3p5db << 6); - regmap_update_bits(imx6_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, - IMX6Q_GPR8_TX_SWING_FULL, - imx6_pcie->tx_swing_full << 18); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, - IMX6Q_GPR8_TX_SWING_LOW, - imx6_pcie->tx_swing_low << 25); - break; - } + /* configure constant input signal to the pcie ctrl and phy */ + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX6Q_GPR12_LOS_LEVEL, 9 << 4); + + regmap_update_bits(imx6_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, + IMX6Q_GPR8_TX_DEEMPH_GEN2_3P5DB, + imx6_pcie->tx_deemph_gen2_3p5db << 6); + regmap_update_bits(imx6_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, + IMX6Q_GPR8_TX_SWING_FULL, + imx6_pcie->tx_swing_full << 18); + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + IMX6Q_GPR8_TX_SWING_LOW, + imx6_pcie->tx_swing_low << 25); + return 0; +} - imx6_pcie_configure_type(imx6_pcie); +static int imx6sx_pcie_init_phy(struct imx6_pcie *imx6_pcie) +{ + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX6SX_GPR12_PCIE_RX_EQ_MASK, IMX6SX_GPR12_PCIE_RX_EQ_2); + + return imx6_pcie_init_phy(imx6_pcie); } static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) @@ -902,7 +896,11 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) } imx6_pcie_assert_core_reset(imx6_pcie); - imx6_pcie_init_phy(imx6_pcie); + + if (imx6_pcie->drvdata->init_phy) + imx6_pcie->drvdata->init_phy(imx6_pcie); + + imx6_pcie_configure_type(imx6_pcie); ret = imx6_pcie_clk_enable(imx6_pcie); if (ret) { @@ -1386,6 +1384,7 @@ 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, }, [IMX6SX] = { .variant = IMX6SX, @@ -1399,6 +1398,7 @@ 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 = imx6sx_pcie_init_phy, }, [IMX6QP] = { .variant = IMX6QP, @@ -1413,6 +1413,7 @@ 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, }, [IMX7D] = { .variant = IMX7D, @@ -1424,6 +1425,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6_3clks_bus_pcie_phy), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .init_phy = imx7d_pcie_init_phy, }, [IMX8MQ] = { .variant = IMX8MQ, @@ -1436,6 +1438,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .mode_off[1] = IOMUXC_GPR12, .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, + .init_phy = imx8mq_pcie_init_phy, }, [IMX8MM] = { .variant = IMX8MM, @@ -1471,6 +1474,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .mode_off[1] = IOMUXC_GPR12, .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, + .init_phy = imx8mq_pcie_init_phy, }, [IMX8MM_EP] = { .variant = IMX8MM_EP, From patchwork Mon Jan 8 23:21: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: 760834 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2080.outbound.protection.outlook.com [40.107.8.80]) (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 B03245811C; Mon, 8 Jan 2024 23:23:02 +0000 (UTC) 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="hmD77X1K" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wk+6uQ5d72MeFQz0cZROYjes1HqwSFs8l+0jkBdzjNeppj+j7I9osDS+689IMY6n393apbXBg79elWd/xtAhNv3O1JoEgvCdLFEPGHsGRVQ/4PRsBVWOESI9Id1NqOyUhvYgHeFfMByaQ/8EayixNwCOFVfu5mxZxpwjMJbSULWeMnKMxKFbb/fOaD/iogHdmbLYgyLk+kEH5BaxUzRzRMG8E7sE7dlTdy7xS3tSCLlSRf7QSpAb9bYJBZQagxZjnv7IO/84FJd9UGWCwbfRbbP+piQcBN2+lyZlZIebegQjYL0wQrzLi3nrR3LPl6oWC3OBd7+ZP9C3bbbwPEXBjw== 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=ZNuEqwnvrUxPSqcjCvVLoRsw0bm7wK8OqtVGkt+aEeU=; b=lqpqnubsFBshAjutfJhzaXf4sjib1mIVarmuKPBHSC7AxhjMVsllc51fn1TLRb7MUJo8jYnqMPXMyOvHX6gseheENpLsl17KF2vnUOKwlYcf1egvCcp7sRiXeefl1zKecTBiWKRPvz8BD20Kr6euY0O2ibyR3E6jANmNdaC/iSup2gRgFDfwo01e9IiX6LS5FgPmsn36ZlQBa9eym5ospkfBd1WkVR0AsacVcSQftWpv4N0WUkFlM0dvqPvHlqU4gVdydp8Nu995qgsGzoY3IGdnPSM23HP4PJRHLcIKg1iRkmlZ4/aIrlTJjOAGaPGC2lyr6tpsZG/69hLJfU8EDw== 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=ZNuEqwnvrUxPSqcjCvVLoRsw0bm7wK8OqtVGkt+aEeU=; b=hmD77X1KijJa11HJKZ3Rj5LVSJ1GmDoEyyDqahudBzncgCVJiNbKd2F1L6YnlQmXTOM83PmvB2s50Q7LJQiJxjcGbmllIQEbb5orpEzS56xw6W6kRxHndWKtm4lSOMKFo1dRcuRDZSEwCc39slsZWVZvLXZT05aXEjWu1YoZSFA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) by AS4PR04MB9338.eurprd04.prod.outlook.com (2603:10a6:20b:4e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Mon, 8 Jan 2024 23:22:59 +0000 Received: from AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469]) by AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469%4]) with mapi id 15.20.7159.020; Mon, 8 Jan 2024 23:22:59 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v8 10/16] dt-bindings: imx6q-pcie: restruct reg and reg-name Date: Mon, 8 Jan 2024 18:21:39 -0500 Message-Id: <20240108232145.2116455-11-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108232145.2116455-1-Frank.Li@nxp.com> References: <20240108232145.2116455-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR02CA0063.namprd02.prod.outlook.com (2603:10b6:a03:54::40) To AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB7511:EE_|AS4PR04MB9338:EE_ X-MS-Office365-Filtering-Correlation-Id: 2238b683-6a34-4274-0db3-08dc10a0c0c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a6yQvceb/7bYiRKHMg7oIJfOzdVHiK22SUcAUrZsDSLCTsLWkBMlUsZcsTzZNsRkyZJuAAcJDQ44U8OxsTHWb+ri2nzWdsh4Eewz/ZCKCmiOSVrx4meuEDVKXlFj959fO8HD0N6pHtlu3nJvOC1C/mF0j8Ail+NWaHHzGQ59OGymmRp6e5XJ6/v/pYFZNqcTID62cYLIIjx0Q4YybBKeaGDUuW6u0KLpYcL6eDsM6Ig/pUohnUYN5DTItqpecjvt3fZfsq0co+EJCz+KQH0uFXwrMdfW/aaCrc1081bcxjyu+0cD5whz31nuxiL4wiMP9Vwa2OmqWdB9XttqXUzWC30YlDi+d9MeJ9HFmLcVj1iTvzsaBiA+Y6VMUFaR5Q6pztBBQgVUoLcBGLM+51QONzSXO3p3pIma7PZMpGf+9TPDaC33kM4yAsPHsVlb6upJKCTfTT9M+FT6ONabDKnn8eFeiZ7IelqUAZ866BpHTzzVlEhyD92Sywf4s2oMP8r0TVDkMfQ5KlmXMmn/VAIKDzVajMxd/Vtf+3gu8BkUrwwzWeLkzzVXn/W/PZnsrGCiZ0HveUVT7ZVnUZlgQFB63YTHJ52NqFa/Nb3g4OT3ZPWWgE4JATmIONNjdCv1KlJ8KhzX+ppB/T6KJLnwelgE3w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB7511.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39860400002)(376002)(346002)(396003)(366004)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(52116002)(6506007)(2616005)(1076003)(6666004)(6512007)(478600001)(26005)(6486002)(38100700002)(86362001)(38350700005)(36756003)(41300700001)(83380400001)(7416002)(66556008)(2906002)(316002)(66476007)(6916009)(4326008)(5660300002)(8676002)(8936002)(66946007)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2hEgMfSVz5bxx3fGHNrUp2wbjqNwQJHrGrRHjoI4rw7ucfnF0AlfL0mmhNXycm39ckY+A7jkZXBR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UYyKAt4gGPPhIFMm+qjjWM1pBwh/KvuL1IPjHYIh/nrW3qJ0VLvo91pIig6OK2Yjt/xtHk21GckhCT2sBnD7buFBHk9JVbjcE5yytoDW8pO0bCyYu+zp3Wr95xQjqzvF3UQ9QDvwf8hDtoBE6lsOtMFQC3uUvZXeAJfPqEcuHOEaKwJ5SLXZIKI9F28w6zow7Q+T4MrMaKczy6u7YJFBj/9lC67Ouavl3ZfzJZp8WrMbaiA5k4qVPW1L/JkD+2u+eY3guQKlbkDV1Mgy0suNgAallHC0ER0EdJY8onA9fHipDCaE3OqdcIYqoPwwPQZXhHQqBQ4TcQZLwQSO0RXBpVOb6He8OIuw1XeHPy34CuAYLgIK+DJF2zn30WeDME8eej/jIYzlxHJEjl9UwkAXE5QsrKdmVkNsULRWEPbnDWK/2RnTPYT1AYB1N5LDZubsEZ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2238b683-6a34-4274-0db3-08dc10a0c0c1 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB7511.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2024 23:22:59.6857 (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: swTA9rZtHSVJvN2GUODvypuxiV7HcpUx25jwH9LHA/+n04NC4qqwPQTPvBptelpd+ARueqTnY+G8x3OJchFMlQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9338 snps,dw-pcie.yaml already have reg and reg-name information. Needn't duplciate here. Add 'if' check for existed compatible string to restrict reg and reg-names. This prepare to add new compatible string with difference reg-names sets. Reviewed-by: Krzysztof Kozlowski Acked-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - Add Manivannan Sadhasivam's ACK tag Change from v6 to v7 - add Krzysztof's review tag Change from v5 to v6 - Add if check for existed compatible string Change from v4 to v5 - add Rob's Acked Change from v1 to v4: - new patch at v4 .../bindings/pci/fsl,imx6q-pcie.yaml | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml index 81bbb8728f0f9..eeca6b7b540f9 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml @@ -30,16 +30,6 @@ properties: - fsl,imx8mm-pcie - fsl,imx8mp-pcie - reg: - items: - - description: Data Bus Interface (DBI) registers. - - description: PCIe configuration space region. - - reg-names: - items: - - const: dbi - - const: config - clocks: minItems: 3 items: @@ -90,6 +80,26 @@ required: allOf: - $ref: /schemas/pci/snps,dw-pcie.yaml# - $ref: /schemas/pci/fsl,imx6q-pcie-common.yaml# + - if: + properties: + compatible: + enum: + - fsl,imx6q-pcie + - fsl,imx6sx-pcie + - fsl,imx6qp-pcie + - fsl,imx7d-pcie + - fsl,imx8mq-pcie + - fsl,imx8mm-pcie + - fsl,imx8mp-pcie + then: + properties: + reg: + maxItems: 2 + reg-names: + items: + - const: dbi + - const: config + - if: properties: compatible: From patchwork Mon Jan 8 23:21: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: 760833 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2074.outbound.protection.outlook.com [40.107.104.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECEF656B6D; Mon, 8 Jan 2024 23:23:12 +0000 (UTC) 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="RYV971yz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=buzasgj9RScfTZstEexqLRK2EPu8XwHuP4f5rWX6zz8OE8+0Oq9714cSnkjssulsfyp0uGJoMLrxPQLScS701WjROO+LznSmuJDlfWWTGB3rKhC/WLlxTiZP1BoegWc05SeQXMS4OvczA8hneyR4icx6eeCIeKd3efpi7UvsSxAp0E0fRWVRmkJP46cW2gkm4hybq6CHq3mBScKcN+M91CmQ8KwdamEvouBCJaX9S+pBcygpXLtzyLBWI63bhdqSSE7sYbR4PqPAQJ11Ob2evg8kvwB27rPo56vTnWvOTbXHdZ4IMOa4BgoNic+p3HlxvpFwiDcqM0S+BMF5tDpZbQ== 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=LdD8uaHjaK8xfe3amqxin92H1r7qx0tEe4Ql+H8eJ6o=; b=FpkoSiyVk7d/Q1ckU7nvvJ5WbXtxCBiBAZyiFLidT1MLmWHPF8YJdZW3eH9f4tAYAimIIXb0cccecIbfBgfitR2xDaoenK/CivakG2/mRrFTjNRVsJpM4fjcWwmYh8dZxAzOh7BoCSPuWjpEoSw2FX9XUhkaMKd2nEs2G45kvxx51pIb4b1s+4kvvhrRK5vsJmljXFrqHveSZJjIVqk7sIX7Ch07mBRbcbhKaP0uQpCt91N9WYfj3hVKKiT6QIoYaZlvO7H7pI8MTqiUuHf5rSdrC3kmlJlux869vDk9uMSvNAUWyhc1IY2hvodxAYlsAkXBKjkMHaNpaIaSgi++Dg== 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=LdD8uaHjaK8xfe3amqxin92H1r7qx0tEe4Ql+H8eJ6o=; b=RYV971yzLbSD/u/ESKbWR9zGCJS/suovUq7tc3o7yoTZm1JVO3I15x/DLH2S+QpHAqwIzj0uVvmck9hJPO/dBdV/20CNzQ3sOOVjlF1wMvm+gZMFKlXxPCQgV8mqrJGz+m2OgHgimPvMRmI3mvuigUV4cPkvPEGzkUlm5ebXB+Q= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) by AS4PR04MB9338.eurprd04.prod.outlook.com (2603:10a6:20b:4e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Mon, 8 Jan 2024 23:23:10 +0000 Received: from AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469]) by AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469%4]) with mapi id 15.20.7159.020; Mon, 8 Jan 2024 23:23:10 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v8 12/16] PCI: imx6: Add iMX95 PCIe Root Complex support Date: Mon, 8 Jan 2024 18:21:41 -0500 Message-Id: <20240108232145.2116455-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108232145.2116455-1-Frank.Li@nxp.com> References: <20240108232145.2116455-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR02CA0063.namprd02.prod.outlook.com (2603:10b6:a03:54::40) To AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB7511:EE_|AS4PR04MB9338:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b4d1fd0-f6e1-4924-7d64-08dc10a0c6fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T/aW018NafQukXTrgZXYgDlFyxvSau3cahCzwUa+i5fK0Uy1C5VcON84SouHb1uFIU/ZIZDgRH//yM4ZYBISuphQZbr2tAvCSVup/O+vJ5a8wCmNSrA3fY7SDcmdRXYB7wrp41jI0Ee2CqINfgBoQsQY0HeXmaYcfFx6p52sQs4RL6vamrJJ1RPY0KlB2hiJLwKMNT+KLUkF/qv1ig3KLCDkY0ra3xUSJJMCFm7B4pUdoKGSgFt7qE9t23z4Z+/KRRMWtXLauBMN4hooQngZuIZFQYHr3sQLePcOSm75nClxJkkdbjCK8FZz8dPWiqh87P2qL6ksBLSCI64UrnDxzLCpab2Kc7x8Ar7LzbINul9X2ZHU/UTRV3Ul50MHgwHJP1GRnlrINnMNdlUKsfQJ3k39ZXy71xNrhPMQ9aFP5CNkDNaTDZ3o25+WP4iAnyYG5pMWVvd/14f2+78GeFO6OPqfXCyCYEfr9wP04fqCR3HilWo4k/hOv1oMywEumuch0e+uq1FimRUrsce3xUKw/QyolaeogIZsyG/5OWyPrQcL/yqPrq+tgbrcJNftccdXOzcxB4qQsZEQNdg9VAJF2gtR6HpINiKzFVEW3wFXUlA4MJSdQferlE3ftBK9xdA5 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB7511.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39860400002)(376002)(346002)(396003)(366004)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(52116002)(6506007)(2616005)(1076003)(6666004)(6512007)(478600001)(26005)(6486002)(38100700002)(86362001)(38350700005)(36756003)(41300700001)(83380400001)(7416002)(66556008)(2906002)(316002)(66476007)(6916009)(4326008)(5660300002)(8676002)(8936002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DoCM2deA0j4TxzsmGy+MR22sgfZIGjFRtq2R1Ffdk0FJ6W+kHjh21bRKaKyPuhAQIBcWrWNyvqUSZcXCVO67hUmMbfrO6wg8f8qayREpmR155J9jmcoGPLNVOco/4bnX5F+FB803bEZe1a5Owdsh+HzlG2wXtwCSVC9N876iU0S3vCeweYCFaa/YtwcH00KyIVXDUlaQl2rx4XyFD/gAIdBY8cpFtfhcv7fAqNH13pxADy4JNwUC25BQby0oNZcDl0ruHn0dmPeabxymZEfmzWkO17gSPMfGnWSoK98APr1rgwGZElCxXmDPL7O7oLeJ36jE5hI+wbpOF5i1prBCQE6JksZwLrebATGVNTa4foOQB323Pfi80m2W0GcZzP4frDbCOskklTLP3OUlC24oR5nL2z+1N5tYjN3D5RQwDewF43xbGSXKEBsUNRi/u8uEDFZM+gkN0PEs+jWqbOEEYB+nkXkpUeUgoID6oNv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Zi+mw5cr0MK9S/B3zGZkTMftAPqRXJIXK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b4d1fd0-f6e1-4924-7d64-08dc10a0c6fe X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB7511.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2024 23:23:10.1073 (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: XErCRRB4Ky9U84DYNYhGSMTqe7PsZaiQK25Q5Ai4IA4zlDmd1ePvzb4KIQKp6EIvxxAKmc2FplGEfVvnQU0Cfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9338 Add iMX95 PCIe Root Complex support. Signed-off-by: Frank Li Reviewed-by: Manivannan Sadhasivam --- Notes: Change from v7 to v8 - Update commit subject - add const from regmap - remove unnessary logic in imx6_pcie_deassert_core_reset() Change from v4 to v7 - none Change from v1 to v3 - none drivers/pci/controller/dwc/pci-imx6.c | 82 +++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index ac338a88fe21e..c0d08cd55d681 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -42,6 +42,25 @@ #define IMX8MQ_GPR_PCIE_VREG_BYPASS BIT(12) #define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE GENMASK(11, 8) +#define IMX95_PCIE_PHY_GEN_CTRL 0x0 +#define IMX95_PCIE_REF_USE_PAD BIT(17) + +#define IMX95_PCIE_PHY_MPLLA_CTRL 0x10 +#define IMX95_PCIE_PHY_MPLL_STATE BIT(30) + +#define IMX95_PCIE_SS_RW_REG_0 0xf0 +#define IMX95_PCIE_REF_CLKEN BIT(23) +#define IMX95_PCIE_PHY_CR_PARA_SEL BIT(9) + +#define IMX95_PE0_GEN_CTRL_1 0x1050 +#define IMX95_PCIE_DEVICE_TYPE GENMASK(3, 0) + +#define IMX95_PE0_GEN_CTRL_3 0x1058 +#define IMX95_PCIE_LTSSM_EN BIT(0) + +#define IMX95_PE0_PM_STS 0x1064 +#define IMX95_PCIE_PM_LINKST_IN_L2 BIT(14) + #define to_imx6_pcie(x) dev_get_drvdata((x)->dev) enum imx6_pcie_variants { @@ -52,6 +71,7 @@ enum imx6_pcie_variants { IMX8MQ, IMX8MM, IMX8MP, + IMX95, IMX8MQ_EP, IMX8MM_EP, IMX8MP_EP, @@ -63,6 +83,7 @@ enum imx6_pcie_variants { #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_check_flag(pci, val) (pci->drvdata->flags & val) @@ -179,6 +200,24 @@ static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie) return imx6_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14; } +static int imx95_pcie_init_phy(struct imx6_pcie *imx6_pcie) +{ + regmap_update_bits(imx6_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, + IMX95_PCIE_PHY_GEN_CTRL, + IMX95_PCIE_REF_USE_PAD, 0); + regmap_update_bits(imx6_pcie->iomuxc_gpr, + IMX95_PCIE_SS_RW_REG_0, + IMX95_PCIE_REF_CLKEN, + IMX95_PCIE_REF_CLKEN); + + return 0; +} + static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) { const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; @@ -575,6 +614,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); break; case IMX7D: + case IMX95: break; case IMX8MM: case IMX8MM_EP: @@ -1280,12 +1320,32 @@ static int imx6_pcie_probe(struct platform_device *pdev) return PTR_ERR(imx6_pcie->turnoff_reset); } + if (imx6_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)) { - dev_err(dev, "unable to find iomuxc registers\n"); - return PTR_ERR(imx6_pcie->iomuxc_gpr); + 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), + "unable to find iomuxc registers\n"); + } + + if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_SERDES)) { + void __iomem *off = devm_platform_ioremap_resource_byname(pdev, "app"); + + if (IS_ERR(off)) + return dev_err_probe(dev, PTR_ERR(off), + "unable to find serdes registers\n"); + + static const struct regmap_config regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .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), + "unable to find iomuxc registers\n"); } /* Grab PCIe PHY Tx Settings */ @@ -1462,6 +1522,17 @@ static const struct imx6_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, + [IMX95] = { + .variant = IMX95, + .flags = IMX6_PCIE_FLAG_HAS_SERDES, + .clk_names = imx6_4clks_bus_pcie_phy_aux, + .clks_cnt = ARRAY_SIZE(imx6_4clks_bus_pcie_phy_aux), + .ltssm_off = IMX95_PE0_GEN_CTRL_3, + .ltssm_mask = IMX95_PCIE_LTSSM_EN, + .mode_off[0] = IMX95_PE0_GEN_CTRL_1, + .mode_mask[0] = IMX95_PCIE_DEVICE_TYPE, + .init_phy = imx95_pcie_init_phy, + }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | @@ -1506,6 +1577,7 @@ static const struct of_device_id imx6_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,imx95-pcie", .data = &drvdata[IMX95], }, { .compatible = "fsl,imx8mq-pcie-ep", .data = &drvdata[IMX8MQ_EP], }, { .compatible = "fsl,imx8mm-pcie-ep", .data = &drvdata[IMX8MM_EP], }, { .compatible = "fsl,imx8mp-pcie-ep", .data = &drvdata[IMX8MP_EP], }, From patchwork Mon Jan 8 23:21: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: 760832 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2059.outbound.protection.outlook.com [40.107.8.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 27CB058AAF; Mon, 8 Jan 2024 23:23:23 +0000 (UTC) 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="Y2CGO/oI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mOUpjtHOUJcs/nOh2QDhIRhkKRjOkIfmA3l45PdhryT16kDci9flWeISB3+lfGycM3GMPvaVjfoh15nNeieb7MrcA6FMi2zKEFOz2txfUymCQJaqPQpwzfMJzYEOeyU+gSmOALVijKqCY8YYo5KnaTuX7fdCS5Lr5caU5uC+Dp1wT/sNeIYL45rXNsOgOeXiSc7t/Kk/P6/Y2Pm5QxqE5JHNRmOaZNlZ48uWDHXJk8CRLlkVPqAiX1oQI6bVLp1HPKTixuN52i87qtHyE/Qpu4hkFKDzPl6dwrWtv7FlT3s+OSuYGX3pyLLFuzTo7p/vvA+Utyb9QeuLroL0B+fY8Q== 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=kNhX4RRQTn5X8Wm4GXmBWpdCt/K2/H1fcxxALLTJjwY=; b=LYYEhBQqOJ/YvtbE4iMXoIO8YQ8/+Eg1+K8QX3QXdoSRi1Ky9ckck//OAuD2CdSAkQCCHnbhHFN5599arEBBUlHU8BP1MpH6c6tU2AKDT1emNMp0zs0KtqiLNfMzxV/gVpU/YysLztlkWkEAGepIfZtHlyjmEbF9czVmeQKunCNLA3M32N84IZQmq7CgxNEpeQmIxShiIOxQlOPNPDgrjcMxp/uf1H6Qfp1EhXET+cHoB5RDDzZpDb1OULYDCAHWznTV3o4MsiAF22lOlrN/+Kk20jjCRchi1GpjKicTMIzzb8CgkJfQ6ZFXn2pBr5PU6TOiQ4X/WwUfbgtD5eh/lQ== 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=kNhX4RRQTn5X8Wm4GXmBWpdCt/K2/H1fcxxALLTJjwY=; b=Y2CGO/oIgloMG6QnUC97qHusm1GTOtRrR3AV/wnLdTAeL2Eb6dcacguqrdV66HqMp0ytmzTUkha+Q9B5d+ev1B6eKUfzPqJjF8sOv5zKjikpEgwrC5Og1+XOnJYOXZFUkp3Toa8nz6a7NKBGtoDs4fBTIm0FkP43W/FEHU/DZ3s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) by AS4PR04MB9338.eurprd04.prod.outlook.com (2603:10a6:20b:4e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Mon, 8 Jan 2024 23:23:20 +0000 Received: from AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469]) by AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469%4]) with mapi id 15.20.7159.020; Mon, 8 Jan 2024 23:23:20 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v8 14/16] PCI: imx6: Add epc_features in imx6_pcie_drvdata Date: Mon, 8 Jan 2024 18:21:43 -0500 Message-Id: <20240108232145.2116455-15-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108232145.2116455-1-Frank.Li@nxp.com> References: <20240108232145.2116455-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR02CA0063.namprd02.prod.outlook.com (2603:10b6:a03:54::40) To AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB7511:EE_|AS4PR04MB9338:EE_ X-MS-Office365-Filtering-Correlation-Id: 48f2818b-75d4-45f4-dc0f-08dc10a0cd09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rt6pq07D38XiBgLtse7Dn3RaSgvGLkEZPEQ6IihpEUgkc6t/8zKEr8IWIdulmDQbXF2pX3bWNYyzavg7y1VcYif7bcOh7SVFJOG2Gu+jA9u/Mk94Jm9L57wqFyuZjS23rok0w8uydPoiJY3rs0xl7U3Tw90KTqElaJuz+H7n40CqAegWBVsQhwnp6u36I/6B/vWRCBZx51k4k7iVo85EfsfCX31mPp+iutq/VIgdz3P4+mqqfkLlYGevoSwcqhIVJoHofCuw6+LoGCfIv3g9ji5B8c2q/iT0KJ33+Qu9JecBiw5JDrzR00FEoWZtjhPXlZyCI+KfNeJazFSBP2kG6fW2HpEXoPBJd9AsdIwTFOxMMGILM2c8mUsaYq5JAJ17uINbCLFOpt9OdOSuAkEbNVtJertpwtVazSqWIuJNJKhsA3h31pAb/zdC/F2ZmWGqB6+S6pgsH18q8IFld4cxDk4hongJDwHQvzC2N/SytFWKs30o7XITREAuACplOzg+0PWnh/9F1lBdt1mHiJAAXeTouNj1jLZd2R0XvuIhycHiN6x91CNH9lKuN1UkuGDnMukkrA9ZDleW/ATZ18MWwCJ4yvxDfChTdElzzVYG5RiDtzpsjAfCc+rv35SALdth X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB7511.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39860400002)(376002)(346002)(396003)(366004)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(52116002)(6506007)(2616005)(1076003)(6666004)(6512007)(478600001)(26005)(6486002)(38100700002)(86362001)(38350700005)(36756003)(41300700001)(83380400001)(7416002)(66556008)(2906002)(316002)(66476007)(6916009)(4326008)(5660300002)(8676002)(8936002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cx+BYG/CuVgqc7fLXMPFdBjDXKYGdbuKcxtMIZettM/exC6ae6yJiTuUw3m7VVeonXf5DX6K2XKgzMyUUbDKKBWVQG9eB/ETAyAtpog8cS0atoG0jbOA32A6HCG3vr04AKM7Cq7dl+SmMcurqi4nAOrxUZxxe5yTG/PXGsBHNIwjpk/2kN7CEJpmZXi7B4mNoFcyjRGNVhIRXeE4Tw83kyFNKs8fwapBhaPJ5JgfzZ3YF5tJJafXTkBnI6gCf+k/AHwH2PTxIDxy+Z0gV5xKUQBN6MRy6b5xYovfVAkgaNp2dvD6rP6S7cQzYxIt9rCgfh4ZznbATZqYzcRfkiilFDQTBfVoMS3E/+4CvNSd2J+YjGJxB8aftB6VvMmNQr+zVx5rgMXBcewphiTyeJX0xXqhxTS5KBI87ft+CxYWd6m9YGXYkpjit7XodcmPnRbKyGjvKVZLdRKYSm6I9aspgNVJs3i/IJKjkcOnouaIY05sD8RNj2wkImhd3T7rAagiyuvVs9ylKO4ykkcFLo6vEsEAmOCsnr8kB04n0y+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MS-Exchange-CrossTenant-Network-Message-Id: 48f2818b-75d4-45f4-dc0f-08dc10a0cd09 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB7511.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2024 23:23:20.2099 (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: jop1WxcGZUtASie/Yk+lCXXC2Gw7tbwBHfVK+Ood4CXPvuQ3mLh7iclxmnppmCcQeiH+5i5jCz55H0UApeBFxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9338 The i.MX EP exhibits variations in epc_features among different EP configurations. This introduces the addition of epc_features in imx6_pcie_drvdata to accommodate these differences. It's important to note that there are no functional changes in this commit; instead, it lays the groundwork for supporting i.MX95 EP functions. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - Added Manivannan Sadhasivam's review tag Change from v6 to v7 - none Change from v5 to v6 - add missed maxitems. - add comments about reuse linux,pci-domain as controller id. linux,pci-domain have not defined at PCI endpoint side. Change from v1 to v3 - new patch at v3 drivers/pci/controller/dwc/pci-imx6.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 1741af88040be..3f474d4749dce 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -105,6 +105,7 @@ struct imx6_pcie_drvdata { const u32 ltssm_mask; const u32 mode_off[IMX6_PCIE_MAX_INSTANCES]; const u32 mode_mask[IMX6_PCIE_MAX_INSTANCES]; + const struct pci_epc_features *epc_features; int (*init_phy)(struct imx6_pcie *pcie); }; @@ -1052,7 +1053,10 @@ static const struct pci_epc_features imx8m_pcie_epc_features = { static const struct pci_epc_features* imx6_pcie_ep_get_features(struct dw_pcie_ep *ep) { - return &imx8m_pcie_epc_features; + struct dw_pcie *pci = to_dw_pcie_from_ep(ep); + struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + + return imx6_pcie->drvdata->epc_features; } static const struct dw_pcie_ep_ops pcie_ep_ops = { @@ -1538,6 +1542,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .mode_off[1] = IOMUXC_GPR12, .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, + .epc_features = &imx8m_pcie_epc_features, .init_phy = imx8mq_pcie_init_phy, }, [IMX8MM_EP] = { @@ -1549,6 +1554,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6_3clks_bus_pcie_aux), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .epc_features = &imx8m_pcie_epc_features, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, @@ -1559,6 +1565,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6_3clks_bus_pcie_aux), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .epc_features = &imx8m_pcie_epc_features, }, }; From patchwork Mon Jan 8 23:21: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: 760831 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2057.outbound.protection.outlook.com [40.107.8.57]) (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 EECE459148; Mon, 8 Jan 2024 23:23:34 +0000 (UTC) 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="U/YYGQFL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nLXtFdx+M2btqOrMR67fDRHhGG2z5U6iLNDr3e71C1wEeq8TDi93zfipGPFMMDZcfXtJFyvn5qJMZ8O+XWakIgFsjE5I5/a1xJRoT3F1WqYNUoMDN05hRn5XWzk9UUNzLXaReW5MXu/eAOxTnVjtqmwgGKPLYSX3K0+yHTvvLD8OfERnHOqHLDoTIGUGuWwue3GV3x8sQQ03rzBFsJrMKjbGOJRQ1/H8zI3SS92qklwJHZ/edDi+dwSmdVSfuH1BNu0iG6Aa1w3pH+iJzIzSALk+XqPpyvnHTCmpIM9FOC8V3TYqpB6FK9bhnjgnHzSmpj7uT92cVlV6mKrf8Ndobg== 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=ex0NRJz1s3XkmopQ66EFlSMsjJr6NnBSpyJnaz+J2ec=; b=l2afhn7K/Wg4Ug3dWAMsCyXVM6z0UCsIeRXOWL2wNGI+eoOJqIeWeMpop4o1BPsm3EfBn7cpiEv3F/fPiPPswnVm4rMK++zifUjEHqNk/WQ7Pze0U2rbHfkoFyultE8TBBEPzUWfA+t6BmWHf/GAShhsrrvUsoYetPqUbcKMCUwGqfDuzoAlMDbX75kZ2V2NzhzslXpg8smDiG6rfdyYP1Lz+RIGwti+Wl6QarmM4zrjR7yrovQ8WTIdbkl14pknY/w6zaILXwpZ/Y9oJAayyJjqnUOcMVhYC1mo2OkjD09cEUonD9JH5oZZWiD48n1FIaud6i5cn8vKHqqbLoANEg== 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=ex0NRJz1s3XkmopQ66EFlSMsjJr6NnBSpyJnaz+J2ec=; b=U/YYGQFLfJczEPCzbS+uinm/VFkqR4lIxATV3GialI9NN+/c1h7YT67zl69fF60N3KoNpDVTOKyPJE3z1p7mdK542Us8dzM83nRRsaG4GoNxJEFWzhxwO6c7yQxucBDbCnSMY5iPjJYnbywvlI+D9IOJ+hOcLo1XoHD//f/HkLE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) by AS4PR04MB9338.eurprd04.prod.outlook.com (2603:10a6:20b:4e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Mon, 8 Jan 2024 23:23:30 +0000 Received: from AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469]) by AS8PR04MB7511.eurprd04.prod.outlook.com ([fe80::8ee3:bac5:a2da:d469%4]) with mapi id 15.20.7159.020; Mon, 8 Jan 2024 23:23:30 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v8 16/16] PCI: imx6: Add iMX95 Endpoint (EP) support Date: Mon, 8 Jan 2024 18:21:45 -0500 Message-Id: <20240108232145.2116455-17-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108232145.2116455-1-Frank.Li@nxp.com> References: <20240108232145.2116455-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR02CA0063.namprd02.prod.outlook.com (2603:10b6:a03:54::40) To AS8PR04MB7511.eurprd04.prod.outlook.com (2603:10a6:20b:23f::5) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB7511:EE_|AS4PR04MB9338:EE_ X-MS-Office365-Filtering-Correlation-Id: 76bfa3e0-ae2e-480c-d7cb-08dc10a0d312 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2CcwRfqxkBDtGiBVU/9cWsaW2HqdL1e1i3Rx4BivEheTeH02klpL3Bwrkv3gdTNt6P87J6fqv5JBFHwZOawSbpg9gpak2TVUf9/yYzXpA/WJxCzMHKLs/hHP8WkUHgfO/XVLr6o5ePznEyJgMYz5ZquHPKAFmUYJfEq758J2hLlndPZXsyuav6Gmcpm2+oRHvqmE2tblTScQE7HnzKvpAP6M/ruJs2Tkqxza4DJHholXKJI3ohcd302D7oQh+zHgWfbUMqYWvNERRqbgZmEzOPAfwVLXuJcxw0Bf9usJcixOUuevsFZNuryYIjD2vcxiioyGvC8nLfJjmkj49/dUU+sTRDuePH6cJ9XG+fvoXi63yorNnxgjQZF9NKJqvHdOXHm4/ITh1YR1zqy8NzJi6vKY2Cg0mj2JRvOCdooEaQQE+H3VUThy4930CKMQJeKIif/fwrDqFo/rGxsoBoZAfRSI+bhVC0E+EV4APppPWdQ6mvGvxtYhZ2prCysA3jG2RT9uBvLdheTeX3T5FoNR4TbhqFIIgypxFZwWtRN6CxmAYdPHuXjkowMJStnkXsHf5UpOcmVDFN+RS/QmpCIqS8aQJg2alXvIVgJOVUHRIDj2qBhlQ2HLf3tuh0bDsSf2 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB7511.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39860400002)(376002)(346002)(396003)(366004)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(52116002)(6506007)(2616005)(1076003)(6666004)(6512007)(478600001)(26005)(6486002)(38100700002)(86362001)(38350700005)(36756003)(41300700001)(83380400001)(7416002)(66556008)(2906002)(316002)(66476007)(6916009)(4326008)(5660300002)(8676002)(8936002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z4qUdLbxxC6M850aU7g/Kp2pR44GQr+R9JidUyBjPCa2T4GcS+8NNl7O2bdu2++KN35ZmiIxjeme6B5hQUakLv4ltfsRRVIbrvJXSQHTKit+R/JAbo38OeOdZLe9M0aaLXwLIxmmNXy98LBNAkmmWQPZm2fdKv9rQJva8wAHPzYDVGfHj4lWNOmXYCBcPyeNSUpqUVYQULx2W4wTeZUeDvy+89JBYbU9lddlt5PlFCuCvkU4YJ/6OPfX4PRrfHBevD2Nb7GBcr/pObfEsRmdj8BfUvAXzXlpDVhUDJ0CcGgMRkzll4M5n42MkvpfeINJT43LycOD2WctH0e9DB29jeaiZT8XdBd6qVyNgeQq4wOmhkI9J50kiypyGyqxW0DgjgeN1ormL+5mTShV+1ZN0wOYamJH7SaQRvU0Pmq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44vKZCZ8aQPDSe99QKqsV1X+m8o/1LIdZ/AtatsJvbXTrMuYDhul2p+abbh1UnyxSwYzo1/+mZE3YTHrZHouz52sXjPKqPs8P X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76bfa3e0-ae2e-480c-d7cb-08dc10a0d312 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB7511.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2024 23:23:30.5805 (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: domPJ/hD2jfiG2bOMNnYKFQXoda/XHnN+gkYFNi8lhC9JQR2eb/qKCE1EejU69vPRYRvjVuduiAjeJj7kneDDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9338 Add iMX95 EP support and add 64bit address support. Internal bus bridge for PCI support 64bit dma address in iMX95. Hence, call dma_set_mask_and_coherent() to set 64 bit DMA mask. Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - Update commit message - Using Fixme - Update clks_cnts by ARRAY_SIZE Change from v4 to v7 - none Change from v3 to v4 - change align to 4k for imx95 Change from v1 to v3 - new patches at v3 drivers/pci/controller/dwc/pci-imx6.c | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 3f474d4749dce..69ba72c3a9c9c 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -75,6 +75,7 @@ enum imx6_pcie_variants { IMX8MQ_EP, IMX8MM_EP, IMX8MP_EP, + IMX95_EP, }; #define IMX6_PCIE_FLAG_IMX6_PHY BIT(0) @@ -84,6 +85,7 @@ enum imx6_pcie_variants { #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 imx6_check_flag(pci, val) (pci->drvdata->flags & val) @@ -616,6 +618,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) break; case IMX7D: case IMX95: + case IMX95_EP: break; case IMX8MM: case IMX8MM_EP: @@ -1050,6 +1053,23 @@ static const struct pci_epc_features imx8m_pcie_epc_features = { .align = SZ_64K, }; +/* + * BAR# | Default BAR enable | Default BAR Type | Default BAR Size | BAR Sizing Scheme + * ================================================================================================ + * BAR0 | Enable | 64-bit | 1 MB | Programmable Size + * BAR1 | Disable | 32-bit | 64 KB | Fixed Size + * | (If BAR0 is 64-bit) | (if BAR0 is 32-bit) | (if BAR0 is 32-bit) | As Bar0 is 64bit + * BAR2 | Enable | 32-bit | 1 MB | Programmable Size + * BAR3 | Enable | 32-bit | 64 KB | Programmable Size + * BAR4 | Enable | 32-bit | 1M | Programmable Size + * BAR5 | Enable | 32-bit | 64 KB | Programmable Size + */ +static const struct pci_epc_features imx95_pcie_epc_features = { + .msi_capable = true, + .bar_fixed_size[1] = SZ_64K, + .align = SZ_4K, +}; + static const struct pci_epc_features* imx6_pcie_ep_get_features(struct dw_pcie_ep *ep) { @@ -1092,6 +1112,14 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, pci->dbi_base2 = pci->dbi_base + pcie_dbi2_offset; + /* + * FIXME: dbi2 information should fetch from dtb file. dw_pcie_ep_init() can get dbi_base2 + * from "dbi2" if pci->dbi_base2 is NULL. All code related pcie_dbi2_offset should be + * removed after all dts added "dbi2" reg. + */ + if (imx6_pcie->drvdata->variant == IMX95_EP) + pci->dbi_base2 = NULL; + ret = dw_pcie_ep_init(ep); if (ret) { dev_err(dev, "failed to initialize endpoint\n"); @@ -1345,6 +1373,9 @@ static int imx6_pcie_probe(struct platform_device *pdev) "unable to find iomuxc registers\n"); } + if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_SUPPORT_64BIT)) + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); + /* Grab PCIe PHY Tx Settings */ if (of_property_read_u32(node, "fsl,tx-deemph-gen1", &imx6_pcie->tx_deemph_gen1)) @@ -1567,6 +1598,20 @@ static const struct imx6_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, }, + [IMX95_EP] = { + .variant = IMX95_EP, + .flags = IMX6_PCIE_FLAG_HAS_SERDES | + IMX6_PCIE_FLAG_SUPPORT_64BIT, + .clk_names = imx6_4clks_bus_pcie_phy_aux, + .clks_cnt = ARRAY_SIZE(imx6_4clks_bus_pcie_phy_aux), + .ltssm_off = IMX95_PE0_GEN_CTRL_3, + .ltssm_mask = IMX95_PCIE_LTSSM_EN, + .mode_off[0] = IMX95_PE0_GEN_CTRL_1, + .mode_mask[0] = IMX95_PCIE_DEVICE_TYPE, + .init_phy = imx95_pcie_init_phy, + .epc_features = &imx95_pcie_epc_features, + .mode = DW_PCIE_EP_TYPE, + }, }; static const struct of_device_id imx6_pcie_of_match[] = { @@ -1581,6 +1626,7 @@ static const struct of_device_id imx6_pcie_of_match[] = { { .compatible = "fsl,imx8mq-pcie-ep", .data = &drvdata[IMX8MQ_EP], }, { .compatible = "fsl,imx8mm-pcie-ep", .data = &drvdata[IMX8MM_EP], }, { .compatible = "fsl,imx8mp-pcie-ep", .data = &drvdata[IMX8MP_EP], }, + { .compatible = "fsl,imx95-pcie-ep", .data = &drvdata[IMX95_EP], }, {}, };