From patchwork Tue Feb 20 16:19:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564227 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2050.outbound.protection.outlook.com [40.107.8.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 4CF777641E; Tue, 20 Feb 2024 16:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708445995; cv=fail; b=D5M72N5Z3G9LFWP0zgU8PSgNIGVrlsgGzF6rOLgBcDUlOW1m8XiAeF5GlHSLNRULHbFGpbJqWVbAQWB6QQwb8c8AZ7TSJrPGTV8Tyr0mshhh+cOwFr4F/ktH8wugbXdcQkNfAO0LbzwYfl8/HLerPnXOwRZV7JfpzG2Ael9iMyI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708445995; c=relaxed/simple; bh=3GFHlXph8FZLwOjpya4yMbsCQDSwXsg8pGdsQumdV94=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Q8kwbg71qAP6jjZEpS8es1aRu90n6ds8DHex+gKfTtGoae0R9HaEPVTxe5Q+5w+t5OYPtbgWLW1vO+gA8OLNXhmMCS3RCVrXKy1agdfQFa1hjiFrkbF/a8zvCe/Ke870ZX9/xalHkYCoIt83B6sxi9m57Sz8Rp5swWU2gNQ2GB8= 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=eFdCFa3n; arc=fail smtp.client-ip=40.107.8.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="eFdCFa3n" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jv5TNu8LKuX5v6663nJwY3Rx9mghkaWNekLbnT4tJLmfQphMGnse1VxjC32Q+biw0Waak9e1KeNjz+2HSPyx4FqP0Wvu8ly7F2311MUt+v4CfJ9B8tWcpFQU7Sai8hN/rGuxLbqHH7RcMDI8GuiegNbZEOYnpG42C1UehRhmZVnku1i25Hi51yVhNm5zgjJ/7UdsWRkGvf+s9+j5dqG9esrO7NFa56PKWJRFMbIapZXaCtqo4dtssUAjcOUy9aLS7iE5Ei69egLiWEJ/NHUAjeTHTf1rw7/FEWzz+rpA6Sd8gp5GomkSDc52J9j590s8KgOQyQDx2IYeUrSdmij8Sg== 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=emkIj8/DEUOMtq7zbxG+dxJfT7ccEYuS15XPT+OqsDQ=; b=hI3RHaZTpGQCjUnOpKNH41gU4sgpO8eHZc6rZxUc/dxAeHZzaBzPf2RACpZJDtYAcTvegNAISFbkeAy3cYI18EAzHNTIhsA2xJLs26cmf3egF8s2LyeiM12fzFLSMaa1R2TjNiYUE0WRB3rZhcKuNDLytE/csdObHHn47TsVIFtwEaOaNj4wh+abLQiYd88s62t4TVhfKmFtM4dA+RJLZ/jEJbfJwIJ9h926DLQSRaLwktp69QGuTqGeWuFhklajo/IkwuOxsw/TI+oDoD9a+I/jzNRVUu5YJuNIssgUjA+eSekP2kdVl9XVHyWm3ycE7/7n+Gd4fOvlrynD2IRobw== 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=emkIj8/DEUOMtq7zbxG+dxJfT7ccEYuS15XPT+OqsDQ=; b=eFdCFa3njhzgTCoWO6x/j1fYMsTfX5672qVnasscrBVEXXn2H2B7ifeBkNRuAS4vQYWNWofx9/e6DmIR3/BNtOCzxp1Jw3z+XM9l7sLPp24es/FMuY6jNXAHPsGlOt9pXu13Vz+PIAOibimVIq99dork74XI1bu3azRV7Q825LU= 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 AM9PR04MB8682.eurprd04.prod.outlook.com (2603:10a6:20b:43d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 16:19:49 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:19:49 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 01/14] PCI: imx6: Simplify clock handling by using clk_bulk*() function Date: Tue, 20 Feb 2024 11:19:11 -0500 Message-Id: <20240220161924.3871774-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|AM9PR04MB8682:EE_ X-MS-Office365-Filtering-Correlation-Id: f7b629b2-8cd0-4a60-be2d-08dc322fc2af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bXc5jUhxXDcIPhVCuDbTynJNcRbgYgYKP6wh8gIaf8KmicIyXhUYtcj70m4de3Cux+FQUeRrhEoD97diCwCfPnfxsyvEZY2X49kdnCcDDhGFavULFLJbPQrXdfTNu8tqdZ8c8w/hD7X6upOscFsOauaEboo2hHU79rKp2HYoWfKJ4SbQl+OtenkLLaBnNPAahDkOUXklWZyeiI55l5uSKDpvW5foyEYU4wF4DiuyVS+99YxE7phDpziwUDVYZblW9x6mAugkDYuP7+1RCkSzBX1Jx+TvXg8U31H3WckXMLBTlUDoDloeSp1BPOkKP/lMuMc2pDCNiC5yKd4ubNATo7bEABrxPZJSc90oxBnJbZ7OAJjSmFx4OV4qYFKvpFnwUzjMn0ZBesziivS+TBE5t+J9NhpnPYUMrSMIbuW/2avkqBy3HAwKnUOvJ747JNdA1KoGuLaOiAy3sa5JwN+qPRVJ1CjxYpzvSA1Gw62sLLgtG7ZRoI8dXgeQmJ4qy1YmjEtut+Smw1zs7fpfY/Bhw1lcjXK7wdFk1hdcmml1CoS5O3A5GEiMOeg8EL+0oEh3SyYt7UfXUwro78IBRAX+radkShg4kzQz99/6FAuWc1z9xbD3TubF5i1tzu0ZHH16 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: G8OzPfvjLFSVeNLCvp3C6J8vKsXbL69vazlE/y1KdHo+McJ0/70KugGGbBziKCUROv1Tf9ITFH2lwkAWD14U968TKPicH9mKVUi9zHXOrrW5fQ5d2t5OyzAH1WqtkcePxXBTAVFTlxNlnbWvEkpOHZOmly3yC+Buka7yih7SJRzNh62xLGjJZNo6prrAjrdjoIEfWgyTA+Syt4IhDY5lpAP3bj/xlCEUpDVseAtv24BojS7iScNyFG5zqa2/GyRDGMG6ZAY9FmEHK59H3h5R6UXxEWNvtctb6K1pgtgKRLGlqf0clVIsuhLe3WCAtbWEk+DK/i9xLazcMfwKq5T4fQ0LwRpofRqiyiJBzHqleZiYcIZKN9n1LLDwfI7D68dyxspXgFxsbhqq6RAzpud0TQ1e2h60to/oAD3ic+6pWRbxg2p/HEUwfBZkzgpQk77GYF8FPcWByFWnI75ICFHFSJXsyHe2YBpHMZU09vRJfN3E1V7nvXQN0K1hjzl0v0vjiXg0nlM2qCTgplYYTsVBANbxlMtlcS/eM/jlXHNlbG5B6k7DZDfYu+K6tTPdHPqVQbPjX9kLH2p6I5YTrTDh2Vgiy4cjvn2ilQthMOUBz2ec9dQgvdWXO70A4xl0ZyobLQuuQeNl3aWzQEZYwPg2p+g5AfJdW8+RDw36/yxWisCe27XRGRpYx6d8YieHfAyEELtPUYgMyVnCu+261jqiXYi0PKVsEdwwkUN3UHMBNiytFh4BWv3DkD+UWlWKOOIlPH53hpBH08bOKBHr7EKegWnElZw5ysu8zAeWBcvakh+5Mn+oVXKWqN/qECyPeetc8WJ+juiwTdIEMWljjL6gkUrkylDQwtKStdY8tLD9s217UKbAOmjLtTLMXgJ47aZWrlZ6jMrYgjHJvPZFhDwttuqK5cRVryjCEdV91zoygVfgcWSE9/Can5TQg3rMg2hXrmwJYkQJhuK5kkDqoralpCfVr25ZwaV3MvIFHNvvFRxqW+b732MtamSomJMzMHlCJboP6n1mGwhMLIC/Y3NFxf6RyQ87cIgTJ4bisK3zAREmb/0akDpboXbNO/twJUtfOFX3JrIfYEq0RNgNDTPp1mvQSHXaStTdrQdHq/+e9aW2j9zw/jswugrTyq2fJttoKVCMmV69XQV4phFwWCTT30QFBWt7AOOBBn+bzzak5I/zNOIlJuQeDeS1v7xKbVbF75x8uTuUjB4VCAeVLyGe/tmgx4pN/8jTSXY49o9gCz+M5wPbM8sdNsvRhc09UPKHuTpO0q+fK483ydc1mc+PZfbGmRD0LDzU75+DKs37ZO0zTNCIVqPpGi6Fha1KUD2hvvQXVVMlHVRv3fJeWbt0ifqI0OJDuao8i/wD9nTxsBd0SqIRSeM+5Las9tpHeMvO6HXi6qvCjzsiq4jpEPLS9sKFMKMCyjaVcnSPS6uj3p2zkF+PPen93FEbKumzPo0p79+mrdN5+0nr4fuTLAj0JlI/QWSYwb2LvBJ2Fh0y2eRcAiYUqCNc9JCK/In1YAnPxGV07XA6/o+edmw6t/EyN9nqq5TjWsK+15d/d7kotL9vuTBd8yy9MzZMGmrqhcKD X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7b629b2-8cd0-4a60-be2d-08dc322fc2af X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:19:49.2533 (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: 9hQ2TpvKV98wmyCm2mKHwRLjVCoGqh+9s1E3FPqouCHpXzyKcKPVOe5dwTx2+yjVGbFLnWWO69jrPR6CLo9wig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8682 Refector the clock handling logic. Add 'clk_names' define in drvdata. Use clk_bulk*() api simplify the code. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v9 to v10 - fixed missed delete a case, which need failthrough to next one. Change from v8 to v9 - change clks names - Add Manivannan's review tag Change from v7 to v8 - update comment message - using ARRAY_SIZE to count clk_names. Change from v6 to v7 - none Change from v4 to v5 - update commit message - direct using clk name list, instead of macro - still keep caculate clk list count because sizeof return pre allocated array size. Change from v3 to v4 - using clk_bulk_*() API Change from v1 to v3 - none Change from v4 to v5 - update commit message - direct using clk name list, instead of macro - still keep caculate clk list count because sizeof return pre allocated array size. Change from v3 to v4 - using clk_bulk_*() API Change from v1 to v3 - none Change from v8 to v9 - change clks names - Add Manivannan's review tag Change from v7 to v8 - update comment message - using ARRAY_SIZE to count clk_names. Change from v6 to v7 - none Change from v4 to v5 - update commit message - direct using clk name list, instead of macro - still keep caculate clk list count because sizeof return pre allocated array size. Change from v3 to v4 - using clk_bulk_*() API Change from v1 to v3 - none Change from v4 to v5 - update commit message - direct using clk name list, instead of macro - still keep caculate clk list count because sizeof return pre allocated array size. Change from v3 to v4 - using clk_bulk_*() API Change from v1 to v3 - none drivers/pci/controller/dwc/pci-imx6.c | 138 ++++++++++---------------- 1 file changed, 50 insertions(+), 88 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 1975ab74a5ec9..93c304899bd6c 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -61,12 +61,16 @@ enum imx6_pcie_variants { #define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) #define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) +#define IMX6_PCIE_MAX_CLKS 6 + struct imx6_pcie_drvdata { enum imx6_pcie_variants variant; enum dw_pcie_device_mode mode; u32 flags; int dbi_length; const char *gpr; + const char * const *clk_names; + const u32 clks_cnt; }; struct imx6_pcie { @@ -74,11 +78,7 @@ struct imx6_pcie { int reset_gpio; bool gpio_active_high; bool link_is_up; - struct clk *pcie_bus; - struct clk *pcie_phy; - struct clk *pcie_inbound_axi; - struct clk *pcie; - struct clk *pcie_aux; + struct clk_bulk_data clks[IMX6_PCIE_MAX_CLKS]; struct regmap *iomuxc_gpr; u16 msi_ctrl; u32 controller_id; @@ -407,13 +407,18 @@ static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) { - unsigned long phy_rate = clk_get_rate(imx6_pcie->pcie_phy); + unsigned long phy_rate = 0; int mult, div; u16 val; + int i; if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_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); + switch (phy_rate) { case 125000000: /* @@ -550,19 +555,11 @@ static int imx6_pcie_attach_pd(struct device *dev) static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; - struct device *dev = pci->dev; unsigned int offset; int ret = 0; switch (imx6_pcie->drvdata->variant) { case IMX6SX: - ret = clk_prepare_enable(imx6_pcie->pcie_inbound_axi); - if (ret) { - dev_err(dev, "unable to enable pcie_axi clock\n"); - break; - } - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0); break; @@ -589,12 +586,6 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) case IMX8MQ_EP: case IMX8MP: case IMX8MP_EP: - ret = clk_prepare_enable(imx6_pcie->pcie_aux); - if (ret) { - dev_err(dev, "unable to enable pcie_aux clock\n"); - break; - } - offset = imx6_pcie_grp_offset(imx6_pcie); /* * Set the over ride low and enabled @@ -615,9 +606,6 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) { switch (imx6_pcie->drvdata->variant) { - case IMX6SX: - clk_disable_unprepare(imx6_pcie->pcie_inbound_axi); - break; case IMX6QP: case IMX6Q: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, @@ -631,14 +619,6 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); break; - case IMX8MM: - case IMX8MM_EP: - case IMX8MQ: - case IMX8MQ_EP: - case IMX8MP: - case IMX8MP_EP: - clk_disable_unprepare(imx6_pcie->pcie_aux); - break; default: break; } @@ -650,23 +630,9 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) struct device *dev = pci->dev; int ret; - ret = clk_prepare_enable(imx6_pcie->pcie_phy); - if (ret) { - dev_err(dev, "unable to enable pcie_phy clock\n"); + ret = clk_bulk_prepare_enable(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + if (ret) return ret; - } - - ret = clk_prepare_enable(imx6_pcie->pcie_bus); - if (ret) { - dev_err(dev, "unable to enable pcie_bus clock\n"); - goto err_pcie_bus; - } - - ret = clk_prepare_enable(imx6_pcie->pcie); - if (ret) { - dev_err(dev, "unable to enable pcie clock\n"); - goto err_pcie; - } ret = imx6_pcie_enable_ref_clk(imx6_pcie); if (ret) { @@ -679,11 +645,7 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) return 0; err_ref_clk: - clk_disable_unprepare(imx6_pcie->pcie); -err_pcie: - clk_disable_unprepare(imx6_pcie->pcie_bus); -err_pcie_bus: - clk_disable_unprepare(imx6_pcie->pcie_phy); + clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); return ret; } @@ -691,9 +653,7 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie) { imx6_pcie_disable_ref_clk(imx6_pcie); - clk_disable_unprepare(imx6_pcie->pcie); - clk_disable_unprepare(imx6_pcie->pcie_bus); - clk_disable_unprepare(imx6_pcie->pcie_phy); + clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); } static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) @@ -1253,6 +1213,7 @@ static int imx6_pcie_probe(struct platform_device *pdev) struct device_node *node = dev->of_node; int ret; u16 val; + int i; imx6_pcie = devm_kzalloc(dev, sizeof(*imx6_pcie), GFP_KERNEL); if (!imx6_pcie) @@ -1306,32 +1267,20 @@ static int imx6_pcie_probe(struct platform_device *pdev) return imx6_pcie->reset_gpio; } - /* Fetch clocks */ - imx6_pcie->pcie_bus = devm_clk_get(dev, "pcie_bus"); - if (IS_ERR(imx6_pcie->pcie_bus)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_bus), - "pcie_bus clock source missing or invalid\n"); + if (imx6_pcie->drvdata->clks_cnt >= IMX6_PCIE_MAX_CLKS) + return dev_err_probe(dev, -ENOMEM, "clks_cnt is too big\n"); - imx6_pcie->pcie = devm_clk_get(dev, "pcie"); - if (IS_ERR(imx6_pcie->pcie)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie), - "pcie clock source missing or invalid\n"); + for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) + imx6_pcie->clks[i].id = imx6_pcie->drvdata->clk_names[i]; + + /* Fetch clocks */ + ret = devm_clk_bulk_get(dev, imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + if (ret) + return ret; switch (imx6_pcie->drvdata->variant) { - case IMX6SX: - imx6_pcie->pcie_inbound_axi = devm_clk_get(dev, - "pcie_inbound_axi"); - if (IS_ERR(imx6_pcie->pcie_inbound_axi)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_inbound_axi), - "pcie_inbound_axi clock missing or invalid\n"); - break; case IMX8MQ: case IMX8MQ_EP: - imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux"); - if (IS_ERR(imx6_pcie->pcie_aux)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_aux), - "pcie_aux clock source missing or invalid\n"); - fallthrough; case IMX7D: if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) imx6_pcie->controller_id = 1; @@ -1354,10 +1303,6 @@ static int imx6_pcie_probe(struct platform_device *pdev) case IMX8MM_EP: case IMX8MP: case IMX8MP_EP: - imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux"); - if (IS_ERR(imx6_pcie->pcie_aux)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_aux), - "pcie_aux clock source missing or invalid\n"); imx6_pcie->apps_reset = devm_reset_control_get_exclusive(dev, "apps"); if (IS_ERR(imx6_pcie->apps_reset)) @@ -1373,14 +1318,6 @@ static int imx6_pcie_probe(struct platform_device *pdev) default: break; } - /* Don't fetch the pcie_phy clock, if it has abstract PHY driver */ - if (imx6_pcie->phy == NULL) { - imx6_pcie->pcie_phy = devm_clk_get(dev, "pcie_phy"); - if (IS_ERR(imx6_pcie->pcie_phy)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_phy), - "pcie_phy clock source missing or invalid\n"); - } - /* Grab turnoff reset */ imx6_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); @@ -1471,6 +1408,11 @@ static void imx6_pcie_shutdown(struct platform_device *pdev) imx6_pcie_assert_core_reset(imx6_pcie); } +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 struct imx6_pcie_drvdata drvdata[] = { [IMX6Q] = { .variant = IMX6Q, @@ -1478,6 +1420,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = imx6q_clks, + .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX6SX] = { .variant = IMX6SX, @@ -1485,6 +1429,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = imx6sx_clks, + .clks_cnt = ARRAY_SIZE(imx6sx_clks), }, [IMX6QP] = { .variant = IMX6QP, @@ -1493,40 +1439,56 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = imx6q_clks, + .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX7D] = { .variant = IMX7D, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx7d-iomuxc-gpr", + .clk_names = imx6q_clks, + .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX8MQ] = { .variant = IMX8MQ, .gpr = "fsl,imx8mq-iomuxc-gpr", + .clk_names = imx8mq_clks, + .clks_cnt = ARRAY_SIZE(imx8mq_clks), }, [IMX8MM] = { .variant = IMX8MM, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx8mm-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MP] = { .variant = IMX8MP, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx8mp-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mq-iomuxc-gpr", + .clk_names = imx8mq_clks, + .clks_cnt = ARRAY_SIZE(imx8mq_clks), }, [IMX8MM_EP] = { .variant = IMX8MM_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MP_EP] = { .variant = IMX8MP_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, }; From patchwork Tue Feb 20 16:19:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564228 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2052.outbound.protection.outlook.com [40.107.14.52]) (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 29E01763F9; Tue, 20 Feb 2024 16:19:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708445999; cv=fail; b=beEiC+ZPaUS6JWiSAdk1Zkgnx8ZoLuXQCc4c2vzEr4On917fZEkKMdjWPPsCsVTsGF2iqvtgW4svBwTOw1Kg1PLkgLiE7zANMtPxAz0WtCoj2P2ISzVrNMnfM246Qeo020UOj2Ro8rhiQD+WpT8eqbrMG2oCFaRD8a+B5YVQmZ0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708445999; c=relaxed/simple; bh=vMb2sWNFRJMLzjqJkh5wdqpnEYYbvQoQpd4VkbIK0/8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Di7AEDsdTA47Sd7kL8GrmP7XSImy/98Hrkm0q7tg6ugrVuULOFFtGN+kg+9jas2+k2471rKDEUFShL5RRnGv6Wmz4nP1sRW0/vEeWzXdYYfaV3bmVqxldQReaxNfu5CXckcXF5h7tGQpi+Ue0ioIy+WGrc+iG461KAmwVKMWNXI= 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=guC3oY6D; arc=fail smtp.client-ip=40.107.14.52 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="guC3oY6D" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dAGpkKz45O/NdpffbguVKskfs+52WCSbLDywVIJ3J0ekT2qnkhYR09IVRyRRvAafG4d97o7Scwaukw9hfpHMLKyW7++OT+fgWpLDb4wJDFk3vlZN2jPSRDcsWNVboSU6yJFaP7cXQ0HepyPBKNfM4Co59IjnHes/WXHYFTYt07o1EAvAwqit6ZMSar3H7MXGATQ/aoAlb5j4t7AZ9N5rjQ2S1zZyd5up8s4IBu4yv8pje/YGfoDVFjfSvDcuewv73CHh5trddLkOKWTIv08qf6RRvWKuFOrtgxZhq+szJsx8B2u8GNkH3qt4g54592dWABReS6C6Te7fiajIhGqTtA== 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=rS6wW61yn3kurDuZwq5QX/CloU3gxnrv196QV5S3B2Y=; b=Ei9IS6IOOXvDNiQQmFPDKJ9L3XN+0SIIRP7k2QAfFBaashx2nLPo58fsMFdSQgPfL22n5Qj8cHcTQQMya++Jpm4H2f/q5UEcxjOdOJehRz/m2G7Z1So8NJ8oqh30wlQ/Uk0hdszFMx+ECc0cilnTNz/zLYX3P+ZeNjdi63s1lAnczE8gog1Zyl3X0OAnCT2Qe3E97nf9kzhcfdftymgOy5SD03F41bmOCxnUcBxEt87OjrG5OfxP6Mkrj6TSUlBYz8+5mKERiOKfOUpGQtS4PqfThpj+EqRfUGfU3O+EJ8KcRe0E/p6JL/WxzHiJyzjQhs7g+hSbbfhQF8LWGxeOPQ== 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=rS6wW61yn3kurDuZwq5QX/CloU3gxnrv196QV5S3B2Y=; b=guC3oY6DN/wlJFpJDMx/4yH+jD4Yn3i69270C6VzFVz2Whp4hqjGDX3h8uB+4MCJRVBkS4ihhyNAVzU+C/MX6vNtcYxcbeRCgd5Ys8KeDXr5XrYR1ukkOlDfSK5SMccOXlvI2aw0h6zcuF/wcYvrVThqbVz0QC9mZjEBX3n62Pk= 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 AM9PR04MB8682.eurprd04.prod.outlook.com (2603:10a6:20b:43d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 16:19:54 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:19:54 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 02/14] PCI: imx6: Simplify phy handling by using IMX6_PCIE_FLAG_HAS_PHYDRV Date: Tue, 20 Feb 2024 11:19:12 -0500 Message-Id: <20240220161924.3871774-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|AM9PR04MB8682:EE_ X-MS-Office365-Filtering-Correlation-Id: a428284f-994f-403e-7f1a-08dc322fc5c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +0AlcPw57tu7yBJp7dXvevwZKBeFvcz8SvwO9yjXWiO1asn0d5A7AufLwhKjg7oCPJrfhms4UVWAJLrmhd8rNHTyouJkK5OOtAGjgJHlqKFzrszMJqH+2hCz1Saw2x6xYVkUl9Mdx6cCEMxoD35JgWrmu1BY8FfNhcS3II0CVYNPsu25p98AH+xs6A4QkAWHqlwP9hYnS8u2tst2dMgjhfs7vxvpIdXC3MO/47JOBcm0k7GkeeBhbBLNU3t8zemUPITIV2EdK2IL1wTBlG3cOWE+TfqxnEz/1SRbtrdIGwUCj82E2qEQDA3cgVwA5DV0ejFTz5Z26u12JNbIig+j47z8Erp/0BQ3HwnDR4RLCaZ0ie8r4EQSVnKzs0HMr2bRLX9nSyIFy6rNVDY3D1rdlPNOTlWwIIg3gUHnKEj0NvSUNerDCZhnl9eAUSzbqhX3aSf8tyJHpywVlHy5tp1APtcnTwNzIrXwSfC7CAfQwkxn+WtP6jQJdfTR5mjctwxakweJH5DmiazBBawCN+WMV7yTZefqrA6w9kpevdS33//tup8SI087VWSMvKfsk2OcyCGJxnX3QBMbZJJxx5xNS0+g/XRBu+Jx9PdITihOTK2oy94EpaLRDh3gvVu2jOZM 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fAc4jgRit4jFx7mbnG/Qix+z9kwRBm1Va7iVr9SjcwFs9NsXpwtTt8TEF0KBD9puLlJC1mXRQmax/fJhczf4fZwPVWytRFOcUcekGXIIBdQJdvSS7SeUXKJ6D8xZ00iM09l6k0H4GGJAq5ph/rjcj6be90Nv80UaY3Jc/xuSvLHonBdAyfqqIUW5sIympkn0KMj8BCsAqNQc+1EjkvdI/SINEPZoxwil2kNrzVnCdaobfu6sg+XVg+WNK+xNzgnjNe10UE0e0wrOhJ/0u2vdpmwXBA1gbIgszalaPbDTlLoSiahuhKFFN1BPm6S/2x0yxRQHU43ken647sHGmyECQ1GDtCi6yK3Myqt0MW3tH0CyRB/A6flVIwlfyC5gAnI9Xq03axX08molyrPga1KvbFjYeokSyjPWFfGLo2kIYB3dWQGyf11aV6w6wybxhmYBgOlSFe8KstC6gTFYL0zF66Ysye5wbH6UwZBoUMyGjBvNazlyg12wUQOW0Ey15/h15C5WYWa6rZKWIiq0Kp9bUWuGadp/GdyU9E0kEd1s1N3tW8vHMkT/v9ED9RF/3c4Qu+Jp0QCzSumylSOxofS/P20OQDr6mCImIPdeNFPRaIUn2cPp8VGpHNTU+hrwaYvch9ESeeD43c8tn6cJwQh31R+RKhu+HtsfIk/UJ3hon8Qzm4P3oDrN1TxP50AeXFpMS7DHu/2JoUOx70BMuTz15XrjSBOVsTgBN1hJ2E+1LsQGnyipRffC/IbA69MEaUNy1Bl3kBXFIsRb7Kdqjt7EEytNhaHegD9gYY0UAxe7g5mfgNxVd/O9Qbssafh/ep2MJBlpo2Qpqni7RJ7dmIAXEV70N2pAYRJ8ENYHtjONBj6QPOUjj9ZWyRw6AuPOP9THrjLUiBH9aOpFkUfMJlv1md44mmbUB26IlsOB1j3pzRmQtYFNYXjzm67YLFT32+9LXQ0yR7iPm/igtkAPlXGx14Eu4+6yThU9bPhSCq2sG3hoc0DmizVEXdFPeDX8heOxXXQ3yxE/Zq4LvvIhv/377z54esAy/DC3dDTUMSNzzBoC0hsWvNk9FBqJZ7IGPAxFIpjP+OSb9tRdVh2En8zGnvfg/kucaGkcJTYWvwfc8TY6VfV01yOi61272VK7gzqDIUNl86U5XqZqAWE7uYyQAH1SYxoHpgpRoZLUO+votmFWeLbknMmchWGx7OdhAst+0T8VSwyn0rWh7s+m28Tp58HsFjGaHRzENYl8GIz0kO5UL3xFz7bN2+HSC0qDTLoKRsJ7etkWCu2ka2Z1pfTn/QmQvLTWtIOzkXUIMNvPw54lM34mYWZIJYR8fGetY0BbqIfNKi72t00pegg+ApliEiIZgu9yU3BpUZGEV/KhmQ2f6ulimHTeFry1DZZJFXF4rIDWZ+J3aIwJFwqm/WX2ebmBYVJY8RSvjyS5NuaP1y7L6iJMbykRXYdCWU8rZk86az2B+Uj6sNn7ccn1WU28XfPoIIwhvXJVSvUePDx5Ms0v8VcDNHlXZwWGAHBbewEmtNnCOeuApjDOvrTnqMNroeWxE5Mmi0sh/G8BivHwSqmoe1vawlK5iUSnK0AB0px6 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a428284f-994f-403e-7f1a-08dc322fc5c6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:19:54.4103 (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: GcdpCD8yPGMJYjRkD14IPaBRds+x7UV53PmkgOeQ307sCQVqSrCL2Ygs2emvjxBJBGUnzP7ca5ywxACCu2qduQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8682 Since some i.MX platforms make use of the separate PHY driver, use IMX6_PCIE_FLAG_HAS_PHYDRV flag to identify them and get the reference to PHY from DT. This simplifies the code. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v8 to v9: - change commit message according Manivannan's suggestion - Add Manivannan's review tag 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 93c304899bd6c..12a2bc76f0b39 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 @@ -1278,6 +1281,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 IMX8MQ: case IMX8MQ_EP: @@ -1309,11 +1319,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; @@ -1457,14 +1462,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 = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [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 = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), @@ -1478,6 +1486,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 = imx8mm_clks, @@ -1485,6 +1494,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 = imx8mm_clks, From patchwork Tue Feb 20 16:19:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564229 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 AD35576C61; Tue, 20 Feb 2024 16:20:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446004; cv=fail; b=h5glQ3RYRlUrHStjv+QzUHJdTBVTUphiCe/1t/zFvc1+UyItK+MbeH5nHJV2lscMMlnsvTUPU6wdB/580HpT8Y+bXmhQYKQP4CJ4/riZqjsC+/vegHigKTQkn0DjQ6Zrjruuj9F+9/aVoEHacTudReqKoskIy7MpQkSVrZFvoX0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446004; c=relaxed/simple; bh=+EpVZDXo/0s6Hyj/rFU84Woybb++Y5nA5YuD551JAhE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=p1HTLejrOKE0+JgoWKA6MoAQWCwUzc54N4MvSG9oaOj3ASdPmYOHKopAt8yDmmpYD6JaRTvQ7U/yG7cV3cwWzr+KpJ4kpFJlK2TouRVteyTn+Akd/JczqS0FII7Ee2pZFcN+9hlkTg77gr3+h04qepmy/MaG12oJ7mLjfVMbU74= 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=MM/JUnJr; arc=fail smtp.client-ip=40.107.8.80 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="MM/JUnJr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GaIbS4yfYj3OSchlPYjDSKvLBFDp3PsJy8wsAXpok20DbuqUxsb7gDp6CnfGnCHjhYEtTbDMkd6vyknjCDe9/gSXGv50n13BWIkWJgbzVmpDKocskRGjgfsSrvOYAXATruUeInM+gVqdiEzZlgWseQZfRXElrpkaBvrf6xXSPXkv/6JuKkJEBZba6TEZOaLJVJf7tLkyHYohYh5UQVp8vO1cajN1guM9a+ezwJ+RXnEuIOocyoZXSrolE11oECboSwRxaC6UENW/EJVCGQtLTHUXUw3AhXxq7LTaXXwG7CtLEKpzddCld4KIccV5ntHQIAr06CdZA0zYQFrjAwt/QQ== 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=iqzFJnTAEVcuV6BRzjyog/ErNzeCAxoaQRgtgL5jnnM=; b=f3PMPajTDq2BXhC82A9G7ed71qymn0J+28Cjq3qzhx8Ufbtb/0rWZ3pjZOU5H/aoUUFxyLLc+7b6L+qEvQ499ouTfi5faXcHtWGYHq8o51Z2We0iwuGjy0LYBY0UYitgB8JU6zPAR4s6s5j7epu64J11ap/lWzfTeJjQDwK6qj42AgLjPMZQX6dT5j1H1AwfUucYP35rETj4poTtTKkhaFAyfPKGzB+yI5DUW2zjmTKAg0GetenhgqF2SY0yGNDZDgH2LYHXmFC6M+GZqR2m3AqJC/ME7VgtqzFyQ29WItnrQ4QDaKB+4TZ0gcRnagssj83XBQriPIF/q9oJVfKtDQ== 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=iqzFJnTAEVcuV6BRzjyog/ErNzeCAxoaQRgtgL5jnnM=; b=MM/JUnJrJsZWip16QVpuO0DQ0EjKz7QsmTTjlfjsCvUOMkQO00TImqR0wO3xbyYZL94KZKG9GyzzJNh19/raVy+DC3uYzLQewtG+ThFJDou+BR8SH6X1kHqXSY3jTSejrJQEG2Q/lqE7ChdQbQoaWR0MHYdi9egzdl5RcWkINTU= 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 AM9PR04MB8682.eurprd04.prod.outlook.com (2603:10a6:20b:43d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 16:19:59 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:19:59 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 03/14] PCI: imx6: Simplify reset handling by using by using *_FLAG_HAS_*_RESET Date: Tue, 20 Feb 2024 11:19:13 -0500 Message-Id: <20240220161924.3871774-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|AM9PR04MB8682:EE_ X-MS-Office365-Filtering-Correlation-Id: c2b28092-64e3-48c2-bfe1-08dc322fc8df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LoF+kkA57LFsGeopuYNfOy+fUJ1L52sePzXsVaZTtG44zWZ1rR57QgpnzLiZky2Y4zd7KLLSIT2+swn2h9kt4pJD3c8QTgPfhb2AhADsk667qMx4LG8BauWAoE3F/YHRvD5T08Zq133DMtEiNIks7GxiMVjJbrL1oclbz+FpTnzovPFd5XoRL2pMgSJ69IF6Q2oXU41TAxFLDrqzcXOu0eAIm806cmsJ8yXIltJasroVDnPE/HVteLd85gmhOg5USBRofD5sLH//4ALds/J3Sx7TEDndzPmgvvqSgVhQFwExdToyyUD5rqWE6ks+uxL/9ootBh4mi4Tu1EcGedgqjx1M8OcXJNp0ut43C01TEr5V9ZDZ7KC4lAtnEiYOna16mRqfzFWkfOjNTVTjy80didJRCjuI1plHYtbk7plyqo4ZOZ5k/OL3hcMGPm+qoZBM+Fk7+Ah1TaowPJwb3lPdKD41BU4wLfZOqKLeTi+e2HLfRdgXNMAS+8XCtk+H8VA8i7ai7m9hbxafWoMlVbWowz5VU/c4kYPDybQgt3jChD6nC/7tlYEIEV6cGj8/jv2CRzctyFVGZl9RYdxbedGCIKvWkY1zt9z1t2RMvArvE2BrBP4pGLY1G3DMbXRrahSm 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IBckAOFcLk3Dnf6hGFGS8QzzxuRHQpIiwTNhM2xPjE10mtG/JJQdHjCfTRbYuRbCnk3hgVX0ViGDEoaklWrEv1hKImAEVbr6VY0fCZhDM1bqdEiihNcQxpkkd8vOWXMh8scuqjmEemBcHHB5HQiQ4sAxLHGZdYXnGSGj2Iwa7vopxq72jrgF/qXwFTkPdK0kQd6BzW6pNs7V6iUQOyaICWvFZjQq2dztcNwHkWDe5ASDtCwYqHLxcyTvmoBF5sktU8B8A8qfFldAeYvJJi+eBA54Jfzkj7OYQxBLpJ2tepcOkXNGm1PD+SiknmV8iIqiEeCZGnLgV+3Rv4L4k0APvSllwgzXgF/tQQlyLQxHEomNLxl1jjqc2DUZ8MQNjJUuun8OE3J0H4BhrgHZgTKtBaROInbyojepUkur/RY3iLpHRBrdNXJxJQSPNW3Z8ddBg1hpixuWPbUZ+epAtNQAsI9ur/BzX9yGaALk+6ZpiIgm0PjDu0O6u7FC9bAI8Y9Hd0eQl+FFES+vO9o1Rm6PpLKj0EL/eWkjpYLDH67vCbwJmvIO4Xrh3ftpNcnmubUMOBkFXPWSn2tHuEyyPq4YHbiTekJJ1x/9FtvfJIxqqYCbOzeWfqmAl9rjN/+wE8jAj3lqtAyWlL806e7f8r5JoWt9jYtiXVdpckhiqoz9HiR9YcFT7WzEdClgImqstm+4fV17eljQizI3u1tgMvba0qsVa0EPXwcC3b6tM4DagWOGcPsy/RmQWhqFUE+nD7CsZHbJuDNF2rCyVSYUFrH/teaO5WfP3sqkqZgQPjmd0pdu6/S7L2ifDw1rZPXqS5fEccZ6xsvauGUaZ2fqrkgXs7Jg2qIeL5UMrHPyT18a9nEwnhjSIthgCormxucGa0f7GHu+KcB2vphgOFYXiGR9qcIgvhAKJP8osvU5ALrP8ccHNI5mM3iTMQdcGG3IeaRKwvtROoIgGQ/m7umFwDGBHapi8hp8R5HaMsJt7hEE+4ggxL4YUAnbKunxG1lPXnSIxAvCnZ7k2sXh8tDIUS63YsX424Kgxv4XqxCP1IPCGYu1tdPxZOJ+qNfWTMo2pocBIkjUJv4JZi9CyOGzXoa0AWUI+1ueQmL1omDMQ2ZE2EWAqSX11AaifM9N36QnTJebraPNpmJszsQyshHyPCDzNLRWlXYaPTpOKjEjcbdceKPrCDRSzMVbkPxcgN5rphgtQpjDbfmowL0uwZp1jhN/0QLiIL00woaBGct7lQXhLGMqcyRJ2+4FLz+s6J90ErwUPiq7+7Q5Hp8AvssQpBUu6ZRoU1SntCF61XF0wqJqwPPwSFLKXQHu0kROtUWKQpFVEeR1HxujuO/I243ITUaramVxK11fDReV+94gEADn2CD2hvZNes6LwpkELD9o5JdmSMH+ZyyySeCSdUWCYaGcTbGm2oFGBKvvqCsVznOiIArPHz07ofYfdrS2RRJt/uXZKSTBxeybGtUslmJhyYXcmlLNeo25uVV4e2o/i0SnImNLY2V1OOMYlU+x6JYTQaTM6asO4HMEwBsoWEEwr58XhnOsXotMNbDwjZIhnbOhYxELzLoAB4pwX6l6yprUH+IF X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2b28092-64e3-48c2-bfe1-08dc322fc8df X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:19:59.5898 (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: Ht0Til53P0Yq84YQovZAFBaOUlxb5RP9nmeb9qDjsFtFsp7tLA4+4vVS7KrEEJKLlUgJsc3Ik78euL3pW+qwxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8682 Refactors the reset handling logic in the imx6 PCI driver by adding IMX6_PCIE_FLAG_HAS_*_RESET bitmask define for drvdata::flags. The drvdata::flags and a bitmask ensures a cleaner and more scalable switch-case structure for handling reset. Reviewed-by: Manivannan Sadhasivam Reviewed-by: Philipp Zabel Signed-off-by: Frank Li --- Notes: Change from v4 to v5: - Add Mani's Reviewed-by tag - Fixed MQ_EP's flags Chagne from v3 to v4: - none Change from v2 to v3: - add Philipp's Reviewed-by tag Change from v1 to v2: - remove condition check before reset_control_(de)assert() because it is none ops if a NULL pointer pass down. - still keep condition check at probe to help identify dts file mismatch problem. Change from v1 to v2: - remove condition check before reset_control_(de)assert() because it is none ops if a NULL pointer pass down. - still keep condition check at probe to help identify dts file mismatch problem. drivers/pci/controller/dwc/pci-imx6.c | 105 ++++++++++---------------- 1 file changed, 39 insertions(+), 66 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 12a2bc76f0b39..072601591fb4e 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -61,6 +61,8 @@ enum imx6_pcie_variants { #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_check_flag(pci, val) (pci->drvdata->flags & val) @@ -661,18 +663,10 @@ static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie) static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) { + reset_control_assert(imx6_pcie->pciephy_reset); + reset_control_assert(imx6_pcie->apps_reset); + switch (imx6_pcie->drvdata->variant) { - case IMX7D: - case IMX8MQ: - case IMX8MQ_EP: - reset_control_assert(imx6_pcie->pciephy_reset); - fallthrough; - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: - reset_control_assert(imx6_pcie->apps_reset); - break; case IMX6SX: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, @@ -693,6 +687,8 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16); break; + default: + break; } /* Some boards don't have PCIe reset GPIO. */ @@ -706,14 +702,10 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) struct dw_pcie *pci = imx6_pcie->pci; struct device *dev = pci->dev; + reset_control_deassert(imx6_pcie->pciephy_reset); + switch (imx6_pcie->drvdata->variant) { - case IMX8MQ: - case IMX8MQ_EP: - reset_control_deassert(imx6_pcie->pciephy_reset); - break; case IMX7D: - reset_control_deassert(imx6_pcie->pciephy_reset); - /* 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. @@ -745,11 +737,7 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) usleep_range(200, 500); break; - case IMX6Q: /* Nothing to do */ - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: + default: break; } @@ -796,16 +784,11 @@ static void imx6_pcie_ltssm_enable(struct device *dev) IMX6Q_GPR12_PCIE_CTL_2, IMX6Q_GPR12_PCIE_CTL_2); break; - case IMX7D: - case IMX8MQ: - case IMX8MQ_EP: - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: - reset_control_deassert(imx6_pcie->apps_reset); + default: break; } + + reset_control_deassert(imx6_pcie->apps_reset); } static void imx6_pcie_ltssm_disable(struct device *dev) @@ -819,16 +802,11 @@ static void imx6_pcie_ltssm_disable(struct device *dev) regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6Q_GPR12_PCIE_CTL_2, 0); break; - case IMX7D: - case IMX8MQ: - case IMX8MQ_EP: - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: - reset_control_assert(imx6_pcie->apps_reset); + default: break; } + + reset_control_assert(imx6_pcie->apps_reset); } static int imx6_pcie_start_link(struct dw_pcie *pci) @@ -1288,38 +1266,26 @@ static int imx6_pcie_probe(struct platform_device *pdev) "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), + "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), + "Failed to get PCIEPHY reset control\n"); + } + switch (imx6_pcie->drvdata->variant) { case IMX8MQ: case IMX8MQ_EP: case IMX7D: if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) imx6_pcie->controller_id = 1; - - imx6_pcie->pciephy_reset = devm_reset_control_get_exclusive(dev, - "pciephy"); - if (IS_ERR(imx6_pcie->pciephy_reset)) { - dev_err(dev, "Failed to get PCIEPHY reset control\n"); - return PTR_ERR(imx6_pcie->pciephy_reset); - } - - imx6_pcie->apps_reset = devm_reset_control_get_exclusive(dev, - "apps"); - if (IS_ERR(imx6_pcie->apps_reset)) { - dev_err(dev, "Failed to get PCIE APPS reset control\n"); - return PTR_ERR(imx6_pcie->apps_reset); - } - break; - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: - 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), - "failed to get pcie apps reset control\n"); - - break; default: break; } @@ -1449,13 +1415,17 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX7D] = { .variant = IMX7D, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx7d-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX8MQ] = { .variant = IMX8MQ, + .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), @@ -1472,13 +1442,16 @@ 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_PHYDRV | + IMX6_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, + .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHY_RESET, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, From patchwork Tue Feb 20 16:19:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564230 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2071.outbound.protection.outlook.com [40.107.14.71]) (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 042187641D; Tue, 20 Feb 2024 16:20:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446009; cv=fail; b=VyraizLRjL/+37sNmS3ouStGcCW9fjgos9U5ed+HqET7VJi89jtEi9oAqCfwoJtLQuYZwg8U7Bn3aKzoZYzyB72EhluCsYKmdx2sCFqNLaRdIM5LH9nfLwn3hzCTHmdts21D2BctTZYIx7hblO+G1ZctM4rH5fz5D2o4Xlp797k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446009; c=relaxed/simple; bh=9p+ivJq+lu5tTKqgv5gee2VgRPij3bQqMZ6BGQQYt70=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=WtktQtCLC8Oe4mgmH1/fS7JKQ8UJH36vuf4usn4jbCE+g+Engf0AJfnu9XXXcoKaAyUAS/rmtZaIrWySBXEsUoxKnQkFmLqKZZec6Zs4jAXu+rFPpefk4QmNDvBulrb6S0649brBJM016lj/nZxlq8BQbf/wtaEZY1SD9EKAquU= 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=XdMLPxiy; arc=fail smtp.client-ip=40.107.14.71 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="XdMLPxiy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hNT37Jw3EDI0BbtN3YAgyLk+wJro7W06zG7kHQYio4RwuqIhg4t1HWjzCTqloeC+KZy8+TFGcPglemi2SRH9ZOtA207HSeZoNBgo0adPEmzzZ/ycX0FMN/R9+gismIN52N5/yxsxEz1s6SF4N14pwS4qJTgoZ1wus3sOhR3g1xaLkSIaCcYFEFTfh2fAt08t+5ChtqRWC/JXVYEbWpz1jBVAv/xMC+UnpuhbowICyPww0akjqauztk/5XIxln+gjRdBg79NLmqrT7uMeltNI02vToKMCa44Toucn4yG7WZw7wiI33oHNwT3qFCQq6G6Qh/Wv99SjROqMFL0xIuO8wA== 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=2XeJx8UYItE1uv1JNy/igeoEqWYxTZP2ZiqB49qZlyo=; b=gEJw3GYlzw/f8C/eZWvVDgy3enQyU4mZMNiqnCY/n46vELe91hzz1a4uHB1QdrXe1AlIOZeSNrC27b4E7vAjWU4P18GBWDTdEQKqsus8se1er7cTpPeSzwhDqHZOef5vC9+AV6wR2TpjG8ICRoZgO+oqwERqxXN/ZSzNAbFp12CEo2QM3Lyv+9P9XCqn88nmFWDLNGpVRZj7n+RG9zajROi7x7Nr43j3r6Ds0I4aaskVQtcoAlnAiqjnTjqirNLiSB3fcv/VKhzSscND3U04DjO0GXupqAGQFCYWLTGgL2iRiGrVDeH8VmZ7G9UkjyKHX38LvFlL4+LvnqD+ZbQj5w== 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=2XeJx8UYItE1uv1JNy/igeoEqWYxTZP2ZiqB49qZlyo=; b=XdMLPxiyD/R+clsdomwlBtPpC8007qR4XUVGOFyFHcoT/bJTY0saWvb8RmMntWi31aSkmpb9+pH6CcWI3o1dFo2zas8cHI6schHsheW6IKgeLj0VB/UWFDQ2voRma9HUlPc4bV6DQYeExC+TQxvfj1iBF18Lff5vISAn1NvSPKc= 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 AM9PR04MB8682.eurprd04.prod.outlook.com (2603:10a6:20b:43d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 16:20:05 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:05 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 04/14] PCI: imx6: Simplify ltssm_enable() by using ltssm_off and ltssm_mask Date: Tue, 20 Feb 2024 11:19:14 -0500 Message-Id: <20240220161924.3871774-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|AM9PR04MB8682:EE_ X-MS-Office365-Filtering-Correlation-Id: 534b0445-0edd-4f16-4e2a-08dc322fcc28 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dH5sqKlOTZ9+SAPcJREoKOgDJhioxKz6bEC6mGPfOYeAW+iR8QxfDY89dkAW3t9X4DK1IsrdGCzDtPgowHMmbs0ijKVZjZRwXTPRsC5Rmydkl99K3jlP3XPBcVYhwZwGocl80OUaZWgnzLzNHIRHEZ0Hq3iM/nGQe3AExLEp++S4eWl8rqaoqQdEPK8KrZuX7C1eLbjaat31OCgt6lpVL2JuGB/Kblog6CU8DB7n1oxeTOYm0DNscELF6EJOTRgS8TR93FZNgZ9qVBfUBVeJa8MyqaIYcS3fGHlntHA+mtaGtJNa/mbLqp5fOk47AFSpuIRgVq3TRDbYVqRCtABn2HfcjGSMj4WioFfvQw5dbvdR6TEcS0pNP7NUYVq7kbzh58QpIAjVjWGoU+sHo23TrJ73l2IQ0BAifVspE0eLEXL+WaTWM33fnj1ByPho+hRb/kgjsLT9Ze5tDIW73Co7w2oz3/BOoaWZjNCYk4AvyTT3ukGUPSuWnw96gsaTFzw5YfTSbrSzZUEUpuB6eqVGn84kjNM7es1ZNe+gfpNCv9YGeXb7O/shalI9Es0x0xphod+3fKAODME47nyQOmxe3bgCQzIXFfqNQ5kAFwa7AySPklcuzmhLWeypJRh3y8tP 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1gyF4f5PeiOuKTd96JY7xwefE2ckqBWGMgRbC6omZq03KohQ12vBETLj47AB4f0o6nWEckPe6kBrInq+g6ozQxBTqpoIx3IbDn3c5Pwj63ai0Uld1dWqMX5PzBrNm9/uh3nCenYCTeKcILNXLFT75lJOF78uFb1ITPF8UM6flQR+BTwdEmobIlvX+go3WEuFf9ATiyr+CT1VQ1GQFe4ok690+UjGwKbH897VnIKwwN4YGgPJ5Ay0hFO86JbiFZEGv/lIh3Ch5HHr/spVpg7OgzsHyz5T6OyafW7a0szQMVZtkhjjSFP6tLWDjvbwH7Zz4Awv1TbPaig1BjWxgNMW/pbKEPQle+YGwEGe6IxD0mkjOZTO9RU11yhB6J9F9pyWttg3tyWzYf5WkVyMhfuS4E7owQCMRzaWLV3QduFAHfAzrk3prR4UIrMCOUrs5a2KN8524EOZfBWWcs22NAOQF8ej3lLMLvhMQ8QDpaLzZ2EtbALqnoqFQMLY2jjsVzoCRjWOf69XstLIQelqXsZjhNZ9m23MGJh+Itr9qSA10yO0SjtiO/T0cmp9+4Z7bxg+KCO2Hx28RuFi1zbOjwJhQzuObeu/wwJPxgB592WjaJ4X6rob/ND9Z31mEd0zmqNwjcvzzqCi6T0HdyqbH+ET0OMqdVo5apwkPjloxccR2Mze7Jsm1Avln6ljCFHA4IddUeFKpgTS9EM/IAl5rQfmRzutdzu33kmRy+ww1fg9My3geVdYuOKklC5tApQo0F7zNbjvIaopn2do8FQ9Ol+u6FhubtCRx75U1iGKNxNJRMX1I1d86TJDrhyqvEXrjo9BuQsBLRMd9729VjpRbPLiQ9MEp4WXG7764uctA52b+ssZ0p6FffaWYECrA1YEAECgURbWG/5IECYkmbzmVxEeFH2lv58+DSuSTjS/5DQ6x9RiYo0JQAEjckD4tJrn4YKRlIWg0rLYopVoz3gyYtukAqUo6fF4yVynRP3NITeJldX08CT/zFoMt3tnJk54+tKyvZwY4Vyog0ubd8VQuJSyTiEM/zbICj9p6v3I849i49D4dCntHQH1Q55EJRtYfk866uAnT6MtD8/UWJf9qV6OZYrEut00wH0siwv64nZufCK3b4y0I4c7H5jWZ5Wpw0bNHSc/N64f+PcOmlsj+/1uQN+aHYD+JuBffyQoPVgqtHbVCwtM2aSjKyKqSno34QiVmUWGlJ2TeX0Uvmvt3IVovg0mj2J7yxWt6OYwCifa4eLJH7JMP0T+G/YzaUgg0XIHcMHtcZJhztuBJwsgXNh/H2YZtL/zYTJpx+Da8hwXnkc72DaBs+pylFshhXEynDoniyHLqQgVE3KI4MzpiPGE0acjgz8IhKtnSbRLa8ZgwRFi+OJ9V7V1wbF40aAHAPZQh+9KGKODT5QeGjR/owT/WO6WWoWuiJ/bKNaiM2CFdQPTYuzJ1tftBXS2nk5ENaa23SUOu1LCsiYlSQD/oItXBfxR5shaQM5OezYOFUVc+Ynjut/dRwVhdvYGuvb1JazumYXMDoDnjiG+gAZ1s8hHP2jRvdpJihAeBpRbI8Ls0KJESvbEtyrSGy6I1xOeYrvA X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 534b0445-0edd-4f16-4e2a-08dc322fcc28 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:05.0788 (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: XaF6EhEgqFv5LlCZhpLqLVZ9caFaERkXoWCKM50coRV68US1FFX5mRhrOwxGv0ozG1IKI2k5+NOcQpHkBPDm0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8682 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 072601591fb4e..982aa982efd66 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); } @@ -1393,6 +1382,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX6SX] = { .variant = IMX6SX, @@ -1402,6 +1393,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6sx_clks, .clks_cnt = ARRAY_SIZE(imx6sx_clks), + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX6QP] = { .variant = IMX6QP, @@ -1412,6 +1405,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX7D] = { .variant = IMX7D, From patchwork Tue Feb 20 16:19:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564231 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2042.outbound.protection.outlook.com [40.107.14.42]) (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 2057777634; Tue, 20 Feb 2024 16:20:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446016; cv=fail; b=gaUb9Ac/aK34CgN/KjurqKn7z8CfOKIA8Oo9t+O3cREmAxTzslAt+grVFSyz9Uqei+kSxbE0lLiUIIL+OI/cKT4Jp1YFLJWyXmwVzBNJIpdrnR1BtSqCt9GTEhjHUgruRUVjDB+ClQ8mt2OdVGjN/V+JvPhgbMgnD0o1jeatt/k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446016; c=relaxed/simple; bh=DnhUGrgW55SFHrB4MfhIx0/E+bGSDFhXsZ5jLdy9yNE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=siyxYu9p2/7m9QX7zSLlbyRaZOwJ1K2cWTGtSwKNtET3oUMPwXqae3vKBaDbl4AyYBYYr0Tx/KxR6wzTiUsQeXKs35lVKhkZNeIdsoYifuBh2xyydilylfrrhi3aZUvzYrsTshDfv8GvrSIEj5m6hypwzeJVY95pilHgFnVDN20= 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=ES/GISDR; arc=fail smtp.client-ip=40.107.14.42 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="ES/GISDR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M7+5ZhGJe2I5z8ouZ6q1GPe+gCRg0GX+7TvMMgenN85uPoNbRxxs5JeUFF2d6jKN0WCRDXIGYG3EHXipCCzPgqT0Emsj7sV5kqWtSNsSXJdn52ZPYw/JHAIn4vhV7KZPFVFG3fHqipCxdOhkxZRSnHQy2dQk9erd22anTmtpdpy3IdpEwfoIkw3TVdkTyCf0hwmJGQmpl2zacFb4BqwW1Q+xRph1QglrI63e8rSKhRAimX83PccDyN2v7hgB4FvqjmP1EDc1XlhDMoP9FIO9yC7FFs1rjYlrtEuV3YtYlt6nDRq8gaDjUxMilaoHS7ZhqlI7rZFTdQC6Jkfsk/A1kA== 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=ubG4mKIFKbwh0O7BFeiS1Zl8HBUE3AYfeAX7MbKuFV0=; b=ETC4a4JNAyg2wHz3SKNgZCMi/W1XOu2n4t6OvCPrNjd2fNAtC3xu/AY1/DTdqhOVPl48fH6LutDdoh29dAbayFeiH9bLjsOgOw0erlm29q3VNLyd1ixkuvg2rVtWb7f2Em3Kl0HG5Fde0uRhH7LS/i6WGLrvt7B1256fw7+9lvePToEq0Iu0KXN9N6ODOlv3aW2B+jgE1j5Wghwb0Iy+mkCbRa7mZzZV/+06C05Lu1CjxjKZfN8RegN189r7s2UD0FnqXdhTT9fZqbPO6yP5MHQ4ilE3wQCA6YXFYpYhLr2bLTzSx9wUQQMd035VXZyfvxw0r+/p2i8KKMDQxweFKA== 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=ubG4mKIFKbwh0O7BFeiS1Zl8HBUE3AYfeAX7MbKuFV0=; b=ES/GISDRjQkt1ib85/7kERsuRZbRMBJlpp0bkPbOayJgWN6LlOXeWgHH2vHuoZV3DXDF/hc/sSzRvAMrB187MYeXiy8wEofCCZvqcWC56oLO8K2nQ4S5+twfsudG8Pk0Z6TCw3HPBLFPu6A+gC5+nktQOSkAUjhmAp5/jklDoxE= 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 AM9PR04MB8682.eurprd04.prod.outlook.com (2603:10a6:20b:43d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 16:20:10 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:10 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 05/14] PCI: imx6: Simplify configure_type() by using mode_off and mode_mask Date: Tue, 20 Feb 2024 11:19:15 -0500 Message-Id: <20240220161924.3871774-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|AM9PR04MB8682:EE_ X-MS-Office365-Filtering-Correlation-Id: 22dc7787-db6f-4173-6645-08dc322fcf45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WcwkMV1Bq6f09QTWVuYkU1cnY9mfXoXWjuH/9Bq4CY7ljh8OJR6ia8cxM6Vhq51ugH9Zh4mrCc2g0hkp0Hz5z7JS/x7o7198kVcNJTHwnPLEZeI1aSVw2FbOTEUU5A1dvtEVLlmO0u+lTdycZBockFOmP6zHHp9X+NT+E+QIijE3B8uzKFAsdta7gNUvoI8p/1BIvWUEcyQ8QAtj7G/b4+avg4zvZiIpAHXA5QzuHQQi5cMSgkxNKEwZW5tGkU9a+RU3XikGn8qDSdJhEMnuuy7TboopSKq9Ai99P5/dQupWdZva5ebbDhjRJ5gTzGoSzLozgglZyMr9f5CBiHpOy2t19eM8ghuxfFUqCGKWlmtD/AYnRLykQ24fUhTzv8w1+GrKqaNUduq8GdJ7Cs1LYLkB6LoxiAcYPO+jjZ0FBp/AHYmcFFby76m8p3gsoCTAkbLNECJcgGPHSzeQ2Ta7+irJuu04PJWT/ebKK3lOu5QexNC4FLM2pFkGXKqXkW9G6kmDXm4a8LP0yJuDNliL4aavY4vNdzqIEoFRHPDKl7BHvL8j21Wd2L7jrKghVgdDHBYlnlJikl9HUWRjdPAbaPqqz2oC2ctUXsyYlVqB2PCGyROw5bUJUCZPfnPxQHvP 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uBqYywoY2pGyrXugJVj/JNLKjf6anbZtd5II/6raP6Jo0iXYMcctTqmXvD1lifB6+THDXagfrDCcKlYiaimucOqsKwKkw/OD3ZTj0rqYWveZ+rUtzEq0CAsNrlLn4+irtP7utcyy4k61lC3dE8PtS4WBDuE6uBjQRj65xclt2H4UES2TDbY2LjavwQQD4HA4sfaJ7EOHMphsD43QxXSvbIamOuAgXB2zBQ1dhe4ikND5XRXJ8PGmAHcvSX9CB24nOtnukT+XAoaekzDVPVXfniL0y3mh0T88HEKIzRaaWkoroxGG6NAX2TXW8vuqMvx1BWF6UZR/aohwfaGLkgOfOQL14Or2+fOiWM9aCQOhrgwCeoi7o+M9f7ABHD07JviRrmwgzS8lDXAtZNV5DVkyU8wS8KmTk51DsA4bAqJWUKDQvJ20on3y12Lw/MEKa37TAmAzKQ3DRbc179239Z9w93WHKaM+PIm+om+GVjmlrISUXpzd+gTvoBB/Qes5ZSnkdN5imMVwwdPMcaAsdQUT8iuT6Iyc9eYntd5LaDSpa5MFC81wPELwFi8pFW46NP6HrL8KalwZTOaopXj2MXykgJMwM14jOJG38M+62IS26kIyPWnTBskWfyRaub1mQWwSGuADKVI/1NOxbLraZ6B1ofWCT4MmMNk1rvnwu89En/symyJxVwNb+jpevGNJThsbuowc9HIoBO905Z0keMSc8T4C1emlelv/+NBA9OcTqyJbsQsyV2eZfhF2WKuEJzEkyxZiVPNg5RA4x6wdnpdcpS6YUa/7sMdv/gNDkzc71PkVkmi5uTdA5DXoifH+xP/A+tkU/Hoqzwlqgas5jsPuME/fQSixggliICvdEd+lRIl8p0KEtWLG/wa7UyWDNPFtrE8+etZY+JWZZP1pVELFdHrsbXfNqnOj02ePfWMot46z6TNkwSiwp27OcGu/GIhD8pj5hAWRiVAQQhRg71HOd7WTZivXnf2UB73uXCFElf2mjy7NLn2DuXwbjWuszT4T26JGo0GgzAg5VIRuUkaCC2uJ24Ks/i336sF3FVNqAN4X9L9rJLXEf8f9urrMDxeT1HzsFKgZmuM43V7WZKKBt+Q+28+9h+dmgQ1Ss6u8OTgFlLD/BztJKOnQTAojiQQNbfIp8qbAQQKobFXOhr6sU3r3n5x/FUx5OzS7+hNGMJ3Rj/Fwkn0DLRKQ0amzFStqFNncLSLn3Ob3wLgPiU0gmmzgRMnxqyE+pZqoY3rXMBdOTVvK9degssEBFRM6j7yxRmrh5hjcCy5xPp49YMkVMhfVHF1UbXTT4Mlai/vFaEl5v71VbXcMujEpV0UACFEeJJyQimE9pNPaS4n8B5KV+mlZMb2ogEw+EvfPNYv5TIdzDVPIbsCQv7Eu9uFElAkWzjnwMSHHa+Hv/rcRQQsyDB57w3tbYkzQUEtQkMNPiz2aozblRIql0OqPz4TbPs1t4gj6YNUh96rXMdkF33ZzAcEQphefL16IGce4pU5RV5btMldmI+iYQNXY08yHeRB/fuKnEHESZI9tGEWLXJet6ZtdIPif+S+OPKBH3ZRmqJFwXJDL6wWn6T5DX+YwVkDu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22dc7787-db6f-4173-6645-08dc322fcf45 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:10.3577 (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: gsTWZ/HjQ9hWKJPM9fGHOAfdXKlvl684e3qIVyazG4odI0AuaHJXENfQSGdXHZQkiU4rahUZfaNGA/ZmKn6zlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8682 Add drvdata::mode_off and drvdata::mode_mask to simplify imx6_pcie_configure_type() logic. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Chagne from v8 to v9 - add Manivannan's review tag Change from v7 to v8 - replace simple with simplify - remove reduntant comments about FILED_PREP Change from v3 to v7 - none Change from v2 to v3 - none Change from v1 to v2 - use ffs() to fixe build error. Change from v2 to v3 - none Change from v1 to v2 - use ffs() to fixe build error. drivers/pci/controller/dwc/pci-imx6.c | 59 ++++++++++++++++++--------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 982aa982efd66..6dcff345939e9 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -68,6 +68,7 @@ enum imx6_pcie_variants { #define IMX6_PCIE_MAX_CLKS 6 +#define IMX6_PCIE_MAX_INSTANCES 2 struct imx6_pcie_drvdata { enum imx6_pcie_variants variant; enum dw_pcie_device_mode mode; @@ -78,6 +79,8 @@ 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]; }; struct imx6_pcie { @@ -174,32 +177,24 @@ static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie) static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) { - unsigned int mask, val, mode; + const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + unsigned int mask, val, mode, id; - if (imx6_pcie->drvdata->mode == DW_PCIE_EP_TYPE) + if (drvdata->mode == DW_PCIE_EP_TYPE) mode = PCI_EXP_TYPE_ENDPOINT; else mode = PCI_EXP_TYPE_ROOT_PORT; - switch (imx6_pcie->drvdata->variant) { - case IMX8MQ: - case IMX8MQ_EP: - if (imx6_pcie->controller_id == 1) { - mask = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE; - val = FIELD_PREP(IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, - mode); - } else { - mask = IMX6Q_GPR12_DEVICE_TYPE; - val = FIELD_PREP(IMX6Q_GPR12_DEVICE_TYPE, mode); - } - break; - default: - mask = IMX6Q_GPR12_DEVICE_TYPE; - val = FIELD_PREP(IMX6Q_GPR12_DEVICE_TYPE, mode); - break; - } + id = imx6_pcie->controller_id; + + /* If mode_mask[id] is zero, means each controller have its individual gpr */ + if (!drvdata->mode_mask[id]) + id = 0; + + mask = drvdata->mode_mask[id]; + val = mode << (ffs(mask) - 1); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, mask, val); + regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->mode_off[id], mask, val); } static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) @@ -1384,6 +1379,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6q_clks), .ltssm_off = IOMUXC_GPR12, .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX6SX] = { .variant = IMX6SX, @@ -1395,6 +1392,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6sx_clks), .ltssm_off = IOMUXC_GPR12, .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX6QP] = { .variant = IMX6QP, @@ -1407,6 +1406,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6q_clks), .ltssm_off = IOMUXC_GPR12, .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX7D] = { .variant = IMX7D, @@ -1416,6 +1417,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx7d-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MQ] = { .variant = IMX8MQ, @@ -1424,6 +1427,10 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .mode_off[1] = IOMUXC_GPR12, + .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, }, [IMX8MM] = { .variant = IMX8MM, @@ -1433,6 +1440,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MP] = { .variant = IMX8MP, @@ -1442,6 +1451,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, @@ -1451,6 +1462,10 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .mode_off[1] = IOMUXC_GPR12, + .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, }, [IMX8MM_EP] = { .variant = IMX8MM_EP, @@ -1459,6 +1474,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, @@ -1467,6 +1484,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, }; From patchwork Tue Feb 20 16:19:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564232 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2085.outbound.protection.outlook.com [40.107.14.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 9601477A05; Tue, 20 Feb 2024 16:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446024; cv=fail; b=K4nXeyA86xcVmu5G2wBG3i6b01tj81gyXqqdzb0/DnPEYRjkYqn9pLIoZCVGUfrNUYU7ZiUTNWuC6M5plQZqLQvQnAA5hs+4C5rnhGce7jWKELPtPV4onOM8xQKTSmkPopqGFii4dO2nNUd4mnpRf4+3t64kTMPNvYYaGQYFImo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446024; c=relaxed/simple; bh=FfrWfRcY/pOBgFORDJmedYBh7bQVG+cRLMpqCBdacKk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=VAP4gC1OE8wSF+tT4RusmhWlv0GnSw7m/puVjbIKuO+ZQIOld1dnEVArY+1DiTx8TcVUwPIm7CiB40BPTF7N/0Z9sdkPoGw3lNTMN2VNNqxD4VXfXvEDDgTtpG0m0JquD5UXfsrw7Fi6JP/o1xhuFfMMlSbH0p/CzHqEbiw003Q= 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=ZJSBhsTD; arc=fail smtp.client-ip=40.107.14.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="ZJSBhsTD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CV7jIaSZm0wtQMqRq7cEEQElPq8amdKorrD9ntbg+7DoDj/WPEb4pMhfPliddRUQtS+jISV3v1vPO+6Gp0Y4gmXQUfb+OW5JaQM5gFN1Ewsxyvl1mtUZORJlXNgOVq9d1AwCRHvv5itzfZ46yjxjD0x1kgPYJlrYFq3m9l4xhRxjk6S8Awv/SKrlrt55pcOUTLE90Nl1q13+6dTZXZd1FSH1ITwnIGt0/ZyysBkMReJHM1qzjNq8rjy0KQAGIksKk5BnXGJqVHR93nBUscdXWe9XhLfAeuyEgufI/zKqBFwZPR/L6HKoiSFYIyi9gk0xNtEXDa1Q/j1o6AuyJMtkkw== 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=O98JVAPS63GFVIgr7820vsH3cmjI9rQ/ShNngcs8344=; b=WACQ8u0SRMzfwcjB3VEvFzPgEAWGcGHGqe4RlBp8J6zZ5o0TtQIrjF8ZH8W9fx1x3GlWRA/xInqJtcauzicF9XmewucLpe6N4VLWlQhWKYineByjbW5kjHNuwBneThp5T+WW+6AVGgKKc8XnFuxZKq3qFxJlz+W0nP4Wd0yTnWSNMYsRWV7clxo1D/JkoB2V69EGZGir2kD38k6oPekgOffykyap+nx95//8S3LtAeFtojQ7oaBiS+V6Kq4Ewp9aCp4LuN5mIY78l0urGYUf3tMyz4/gpH2CEw1ggY3c7TOf0nxo8HYnXhPHuQJ+8RQZite4fiCsVe9nydbB/RA9Lw== 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=O98JVAPS63GFVIgr7820vsH3cmjI9rQ/ShNngcs8344=; b=ZJSBhsTDCST8vA8WVr/bqM97AsNJg/79+Ad04gBNIx2tTtJ8xI+bfGN47zGs7kAEnme871Fw7etljU/UaOQY4zriZilZm0Rsn7QqoXez6VtFVyID90WpH10dTT6Qma6qkBeB3PGwUZMZJU81NjFqLlhcfMRGWde4W61Xmwd6dB0= 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 AM9PR04MB8682.eurprd04.prod.outlook.com (2603:10a6:20b:43d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 16:20:15 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:15 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 06/14] PCI: imx6: Simplify switch-case logic by involve init_phy callback Date: Tue, 20 Feb 2024 11:19:16 -0500 Message-Id: <20240220161924.3871774-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|AM9PR04MB8682:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cfd2fa9-89b6-42fe-dc61-08dc322fd25e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jr4xGBS3a6yITN2LIeCWN1Qab9wHc2Q+zScyC+akmai+6TbLVOs07nPzsmKEbPT1joCED2MRlEEkt8LwiYfGIuBbQxkkBv69v+aLOaNMsbFLAm4I+Bl1/yPxrCto0ArqOHJNu5B+EfkgTmAOgo/RhtJqzppnpTRHt6aMzmcFIES+X9R9SmFOK6rANRhvLixAF0BeLOdoUVOG0TGvf5w3aPavpjJvoPVSka6uhIF38HlLpEpoCNuH3f4wWxyrY5XPrkywisETxMT4XiePgwn4ScJ3MWv+FtL63mNQeusVCr2NU4ltL0ZtfLkLfRE1u6B2zXm9fBnzsulaqIteJ4VDL/ZexoVo6nHZSTszQGERvIzn/4R7NTLnFlCFZ/Kg8a623MRB/AlJkDs8D4F0rbjrhrIE2Xfb93pP4TEWzwvoA11Po1OJBEKU9okCSarLNKZFfoj5GQNngzn4S992aXyVxNtWRh3SJkK1+7x7Qj5NZxP0jqZQqn3dhtDjJXlq/cRQGzIcU1YZZn1jX47i27F04knCODim1dqHeNoaf1kKrOgTmCQ2XD2pfGs3DQJD10TM0IqF5XleNiP5PwLEiI3659v6OSmq1Twne9Ew9PVIvnghbcyPd6pRfBu/EmfF+0IX 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:(13230031)(230273577357003)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DT5s/EL4TJmLufhAuvXng67J9+uJ6DU3Y2F48fNea9DKatc8xlDcNE2qHXZtrzZoMMlawop6TDnb+0PiY/vg7kMXibWRclIa6zgyywqO/q77UiRX8NwSZ709OAam74K3LvYg6/wH30JYFWaKr/DTmUIuYQe54x7fLkFAk0D1/MeP49XqVxhOVJNbJ3ShYKSth4wc1NVm8hERVAIU2pKpt5jCsO7G4+flQOu7KyVB7U5l/F312fuepDPbxIPYiKcU2NXWxYRLEEY8V3Pvs+dYhAsYtx1Au3Xh5E9bLzFh7/B+2lA7mbL9/G1AgCj22BatJMiz2S8XPinI2OJRhuszT9WJrh0TzCW4jmBpc0M9QHFHsF/LjvMuvixRZEHVtYgH4jjlH/LDKFJkYVCCGfM4HVd0313jHzS2siKjWMW0atQAa70tQ/5G5B28ePNpptUzdV0oLt4y42Bwf7/0yst5vCjKpWZvUUkxiaSPgzyHcXFo0tq8p/TaD2RQDs5QBOOxOy/esMF7CoSBs+NU/5MB87IgEuM5j6/+W2KPLlNPE0UUZofDDHmdRTkSrQomCgPly79L8LoOdZhPEnUODyTINJJRl5zHurx/Gdjqlx5SNSCclRiUA2xGRclVFSMMNf3kZrCHU1iRlZlBDH1y9fCZJ4XQi8NjDlunqojcYZXkFdKo5RfNp3N8hPyGn8OOY2VglhHBOMlmMEW9ITf9qnMUgjqPZzm4xCVTuiUVlVFfoT4m8bpDMzoNvKGz/66X0QnpJh+UCc8jVLmIkzWb1Bop1JH72eHGha5L7f1K1iOi1aPR1IBZ5VrEU+6/kdraDgm912TY1ZJJi1u/YhX85CH9+5vZgk8zuhlx7G4MmSmAKS3Ua+jQZ5FqOeDm2jOqsrUVLO03jvGf/z8S23EvGSlDEYFr2bWklHTzUqH86Xyn3luTqhcifAt0knJ0zdoyubhzuWRdikxDXgELkQhroXgTerfN1vEZzkdqR5xUd9qaGdF66DABHK8qNDC8iYZYyGCojmem0Vj4VdZzdf4Ra4U0MIpe3SQrZiAMkQxWOWmwjqqH0R4XQTgeWbyBUVw12dN47gdA+H5dNRNieSncMDc5ONTyRHj7tCc6iGHaSKqUOie7zM+ckR1EWwadK5g2rGU9KoJbX3PScOs5yT/1WV8l98D3Z3k64lVdybx/cd0WiWXt1qr+d82qX1sbKXMlKymmnVshh6xB43KIxReRVub/U5kh9NgnWIt8YLCK8YWLAaEUUXCKKYsLOMabpA7VZihlvVskH7czBmwn9Gilis7SpOwHO/sY9KLvpdG8PZQ6PeiyIK+hzhd3J6znMGImaIu7kXtGXShbl6UqCUNRkbfkP9ZdnYb+1ER9zkGtAL2GtZUpJ94QwqAqbcIuX+AwqlTE9xzeDoz0t9U9eu7dlLMP3meKzkA7dgstr48UNMSbGlk6lZFCQMR1klz5TWqaVvm+d8rZAJV4WE3N3hZ2nIVLv4maZN6sf5w5ti2kjzXU3pTdnRJrNlxoXGxEWJeXvKBFIC6tyOIiC6H2IB66pFC/YA0/fY7Hpu8bOLPWGEWC/ZGorAhi6sv/WslUqap4el5b X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cfd2fa9-89b6-42fe-dc61-08dc322fd25e X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:15.6613 (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: VoYZhLjWBEWLlaI9ZBdIkTWYkuDmt3HMNK3PJscH/0wcjqyVptd7qnAQg58Ywukx5fne7kLJM+Gz95pbuVvdWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8682 Instead of using the switch case statement to initialize the PHY handled by this driver itself, let's introduce a new callback init_phy() and define it for platforms that require it. This simplifies the code. Reviewed-by: Manivannan Sadhasivam 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 6dcff345939e9..71ce6b7ac1de0 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) { @@ -1381,6 +1379,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, @@ -1394,6 +1393,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, @@ -1408,6 +1408,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, @@ -1419,6 +1420,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6q_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .init_phy = imx7d_pcie_init_phy, }, [IMX8MQ] = { .variant = IMX8MQ, @@ -1431,6 +1433,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, @@ -1466,6 +1469,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 Tue Feb 20 16:19:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564233 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2085.outbound.protection.outlook.com [40.107.14.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 4B83A77F2C; Tue, 20 Feb 2024 16:20:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446026; cv=fail; b=r5ZkwSopYWbLcuYeDkTNLw+LNIQeQe1VNhusZMjtBS7c0l6hWUD1WOnnYWpSTLwp6DqX/kplG1FsVt0UOT7Dv3E4W9Kj1J3atB8kr2D4hsNNxWGCoYBgZI/DLNPJGuac6T2VQLFsodvoIFQPjAgxXciVhaqgT8hYPxx/tS2KVPY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446026; c=relaxed/simple; bh=T1x+5xu29RBCLNUbh74bHFYM8p4OyU/ZtMVQlC1iY30=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=kFoXFuN6UcxgmnvrZU56BwhXscmoB4SwSwsxlRzVBLWMSy0ey81mmwMNXQqtptLUzSDInEHKonE7VYraABxkLAb8kWbICNm5MAMSqP8uS1kk+jFik1aX9Kvn/0WDfnb0imx/MKQNs7UAt1CJTxr7FMs63N+Ebf0C89YZd8bpTiM= 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=DJaCvgbd; arc=fail smtp.client-ip=40.107.14.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="DJaCvgbd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UULQy2qlrcNLSKFB08fxrMs4QbzLNZznvyC5cVAGDb1yJvs1NazLbpR2iSauSUcVPtq5Dq1VMYEWUbaact+cF9XomTbVYxUGCKAhYYNNgPhoDjEMPkIwttpyt6IbePVeMERvbBOCRorGmCov6HiM4D/51uy2RForvoydS6yjc8h9y48c4WRddfxM6ziKPvRsJ8z7m70X82gtgjFceuFwDi90OR9XkWglHwtZ33dAbthZLQqEsdYLwAMYbmtXA+Oopd8ULsYn4ewXB9IQ4sxyd+BxebSh6BoMK0XMs0jWssIorttXRfhHctICkOtSil9eEcmX7q0OX8GBDZnSr3waeA== 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=zZNTROLn9E87k4rdmI3GuoHZlLbg49vzGd/L9dvhobk=; b=ZK/d5NcY4I63zblEtzo8rmTm1RH3ASn3+KvkFi5rs/Gdt3vz7GfCMezaQzeJkCjxSo33XJE0Uhv1YlZft/7fgs+mLwr+wN+rbNJdvLqLEu+C+LoWlfkAAZaBHMgBrPPs2vnahP4m76n1OfN/LLhN5Q1q9Iz9H3J95/Ii/1R+O1IzUxt1najl3r80fVLOhPUgSAd65nE/hes0Va9inN8H+wqgVHZhigtkl9WRbPYlDk93buYNRsmOoQ7xpZMBA348f3xttRgT6UwPyRkWSzkqwwuM46/Lcj/c7wBSLsr6gNOWM07bKNbfjXZcWmbxrwDMZVrqfI3HwWytZ3huugRSIw== 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=zZNTROLn9E87k4rdmI3GuoHZlLbg49vzGd/L9dvhobk=; b=DJaCvgbdG6C3+bt3fY+PJspUBIJHBnhfzptA8fljVbxdjyPafCvslxXrUT2DiVnA8ug1Q26Ftlc5mxQX80RQ4WfM1RuZnU3dO6YtVn23yM6vtvvgySkcl8S15WLFvhgUsT5ms/sLBNLWsrTMGFHrv9qvFj6NyiKkm03izW/+drM= 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 AM9PR04MB8682.eurprd04.prod.outlook.com (2603:10a6:20b:43d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 16:20:21 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:20 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 07/14] dt-bindings: imx6q-pcie: Clean up irrationality clocks check Date: Tue, 20 Feb 2024 11:19:17 -0500 Message-Id: <20240220161924.3871774-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|AM9PR04MB8682:EE_ X-MS-Office365-Filtering-Correlation-Id: b0cfa39f-63c0-481b-f133-08dc322fd587 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9qw6oVHnnhmlrfCg+Z+imr7+DLsSGQETNWr6UVFhWcbv0WKbvK+LYt06EMX2O950kjvwwlQJccngr9TzL5GOfppgSjpLtiJLaMaDkVnd5vwcu2VAHAJj6F1kJxqpB1PGGv0O5FVHnYZ+iYmC6wwNsfM9oJFFa7PIz9rraqIgU+YeloG+3mTG6aemj7v6TayKqq1BfTHKXr7Zg+ThfxXMOzqgsRg6hrJfLQDmKoy1ZhDaF4rHwBy5PaQ1ttc2g4QhC8pOXgpVR/hquQJ0vr3AgLk20K63yJTBgJIYklLiLoo3J5saO3u2nLSB/4QyqWJsCVK52PosmARDCNsJp2yKPmMfRzOAnlJy/edJcxEDLEEntCu6cGESkDnVUEFa0TEq9SQzt6Dp9P+Whgti42/E8c+KWOEcf7XdbFcGAhzbClsGvTaCyQlgoBoIVs+fg04ZIcDbnSq6MLQK4L8nPTlDOA6qMdzEZdKwZ29Ole5nNVKSTatzVEzIS5Xxt3P4PjCSjnqbI6GYPKLzrgAS2IEmpOL4sXqBqjSnllPmCmV4fF6NLF3YrAe3DXB4XGH0JvobhcEEFyRyYYHubGd2RTplOoVeYO8HuGMp+urOzpVtg3jYvjhhw4w413XITadAOLBt 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8b+sKsxVi8vyQWKDOEmiNdKX6uffz9GXuIbr+eO5lmqJjMUx+y5VUCNPVA53E0Edtn7YNvSz38Qq6B/s3wPrM68tYVtLSKdIl6T/jn6QFBDeOZIgsBzauWl3448SW1ZNGLT9EUikU0Qcy5QnPA6ZUPIMgODa0b4YpA8UfcbLvmFfd6+H8iUnS2XpOp4lLGkZQU1JIFKRVaJkLgNFLEJseNklK+z82E0pFhjDtMSDVVByPpZMYSu6FRc0YRa053Zyr8LMCpGpVBEf6oKfwdXgsRDoejC180iP2p42Z0A4AJ3Auwpf9aN3oTb0p1C2+NsotLzhV5F0iQTmGSs7a4cJBRb5KpWpcco0QANHeRBPP34gSNdTuvwBkSlq5X7c740X/Hgg4ZAXmvgrssaEursHBa4J6/eIcRBykuyXyVeiWFVs5i9d04N5JhOLTW4f8EVdVdaliUeHJllR+gsjCwQY0gnaAykHjS8z2vZ8e2aPKhmEZMdc2f9evu8Z25FJ0b9AAt2tHOR8mD4AiysiMqUjbeClR61B3Y92m7SWX5yb0tgbKdyMrtQ2meBohJ615QJMPLdRN+uY2egA4MNSOO6Vj6Lz9m84mU10nFp+aBoXHkmL8vw4vg0IioAmH6H1u9hwBoicjnjksLpAL+7r1IRekUTvEhi9sgbWX6zET7quMffOdi+YHNAYCakuIs4w/E8wjy9L4ftJxPBJNv9M/XDPwJ366twY3Q+lbuy6fAgB20taqZC1mM33olvgsPDLG/oXz6jrzYXNWXzWK69D9M8BMZBcHDHGPhsLKx2dS7NfFVyJJLYRJ77tm3CSMjB23W5I0QrjStVJ1d1hifZ0xKqB8KwQykQEPj5EGuYGoPdCuvQDSy2SIo+XvjaYsxZEMN01uWs8W/UjETCEio3q56R1ylnR7FPW9guf1CnNY6jyws1WNLFGno6p/ulL3/ja6Q4E4ksz4WR/NEFQAk1lCh+yaorpJmjwIkpy0MHWuX0YfMp53doPQyDMdTji5xaaRQ2Qp83Plq1MVXWjIUW0UlFpfS7s+MISBZnD3vbN/88BKdYdPXzATWc16Rp8Hm6SCkIILClrR7/clU8oi7YBGNDWv6irL3JxMrAjDMLZ7tMbNHoB5Ep1dbMPrSGq0+fLorelEi4RYH630T2x8ojIe2NUZvaSVxgLoMJoK8JKXJmLmc5nwOP7rdEZtCWTVvCthGP6QFAwDvN5zUL47eSc9vd+tscLifQTTkqJWcWfjNoU5UX7kEv/E3t7ZsQLLIVdwt3gcUMu3DBMlm2Vf60tIvKlm/lJMpJ5uqtp7kGi5CiidJz2WAlC9NpHZ4owa3FPpdjY4yO9BfWNXkxB0RXQKhGCoWk3m8tlMBexKeD/8OOEJHUy8kg08yQIqe3dl+V/C9oIcRRVTcVjYIRaV6H5ZD2pyVt9MtQHh80u5KutdiT7312Oe8pJPOP0IE2T+iKI+bHOoHrnkryo8stLB1WLCeg6V3gO2Hktla8JZC1MrygOPtddK32qCKzHuK1Bw5y6JAfLvIpdPE3+OK1G6HKX3G+iF1VtXjcQTZ1t6q0xZEbNs8b3dKTFXy9QuRBXXkHS4G4o X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0cfa39f-63c0-481b-f133-08dc322fd587 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:20.8925 (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: NmTcztQJFVerSRvstC/loneira9rkWlmha2Jh6NJHfXR549Sb14r5PvdgfM+4aqPnJjfbB+lmCAgwspwfBcwMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8682 The bindings referencing this file already define these constraints for each of the variants, so the if not: then: is redundant. Acked-by: Rob Herring Acked-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - add Manivannan Sadhasiva's Ack tag Change from v6 to v7 - rewrite git commit message by using simple words Change from v5 to v6 - rewrite git commit message and explain why remove it safely. - Add Rob's Ack Change from v1 to v4 - new patch at v4 .../bindings/pci/fsl,imx6q-pcie-common.yaml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml index d91b639ae7ae7..0c50487a3866d 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml @@ -150,22 +150,6 @@ allOf: - {} - const: pcie_phy - const: pcie_aux - - if: - properties: - compatible: - not: - contains: - enum: - - fsl,imx6sx-pcie - - fsl,imx8mq-pcie - - fsl,imx6sx-pcie-ep - - fsl,imx8mq-pcie-ep - then: - properties: - clocks: - maxItems: 3 - clock-names: - maxItems: 3 - if: properties: From patchwork Tue Feb 20 16:19:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564234 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2048.outbound.protection.outlook.com [40.107.14.48]) (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 2195A7868A; Tue, 20 Feb 2024 16:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446030; cv=fail; b=crNGsd8JHF+TNMEnZ33Ghcwiq0rm67A1OLtCSzjeA4SlxB51+H1088r5r3erEWQZdeUS22lWVWN+s5oYR22XBeXJmM0x/UcgTE99ypKdJQn2VRHY9EhxMFM1us3PetqpDuhBOW0qfzXBBIfWN2+wIHQjLGFTKJXc/PN8ZGcKRwU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446030; c=relaxed/simple; bh=v1qDlSDFc0Q9C33fJ+0C9n0DYjxe83RrxbWMbOeJ2Tg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UHvWIOSJjPeoiC0QzJvMLXyOHaSJR8Ydhsl6O5voJpuy0KwP5SwZApKSCi8+qV3CE/mzP6nZIpTC3ofEZ1FA7O1QiQmXssLXMas1TJohszg1tvzjNTs/PI1L7MlwzbMLHEM27CO5pOSqINL5T+/LkNFAeXqKqqI4eXMDX449d2c= 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=is9UJrRt; arc=fail smtp.client-ip=40.107.14.48 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="is9UJrRt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PVXLeudPaBJtka/abOAhiy5WvFgMa2867vANtoMHDO3PedKNiih5Q/ydUuAGEDl/4i8QKff1n+Kt5pvD9vRF9OGVAFsdFWIbpcbNQDqi+cJvZujcACKwSYiBym7/PRwdhcLUv2ZVd4FTR3nYnXJS1nK9HVyJXO13mrg6WKe+Mw/WFRqDpuaXBQ4hRNfyCefLFxeT+Ymt+qIR5dejTm9jF2h9jc+5SxfO9HK7QDssQzgoHL+GMbbjGStDSxicmpeaXhEGRUmh9WiNBMMPv33MkQdIxNaG12zWXrEGGo9IGuw4O4ymcSKJaO3zAN8k4PYLKewILe3kfgOeVE5hDLN4Nw== 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=X5vVO7HnDeTAwyeVm6+Wd2tuSRM6SgTSkBrfq99jSQY=; b=iCuWQJLEEizs/0GzCl/nFodF2li5wHdtAryxmtBuiUHOFixiffC5XBD+NjouRgldv2zwdWhdld/uuIfYY/XNoUwjza7JSsIyycHe8O21C+Hey4D3CmbB1QDPQn9z2EmoHwaaY15vZh0nhcFHORLF2/+fs/IMLwiPP2OWfvqdPkYsuh4xweIavlMzDmVIBCSyuXy5tbqw5xWll0b8kqirx4rZOb69lXQ1+JmZoxJq9ibg+xknjToPUxL/HG67r8GoVc9TSKk3uNYXxxNTdg4zKCSbMbNBvE5RfEU9MlU2dM3NHrvwMoFWn7xyf5eLVOTt1Jnqc22KurOBqNOy02Qrbw== 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=X5vVO7HnDeTAwyeVm6+Wd2tuSRM6SgTSkBrfq99jSQY=; b=is9UJrRt5btk0aLPhn0SGP2nlJqje745IvTpqfVS5p+/9S+Vh9FQS0dubfnDiNRiaosHhOoFnS8Tx//J/8mfDQbCXIgQZUN/Bt6r5ziulnJjDdsumG9TE3QsaU/a9eC6hl2kewCnP3ympQEacVzUO0WmPWTzRtYSO/BSFv0OM5A= 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 AM9PR04MB8682.eurprd04.prod.outlook.com (2603:10a6:20b:43d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Tue, 20 Feb 2024 16:20:26 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:26 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 08/14] dt-bindings: imx6q-pcie: Restruct reg and reg-name Date: Tue, 20 Feb 2024 11:19:18 -0500 Message-Id: <20240220161924.3871774-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|AM9PR04MB8682:EE_ X-MS-Office365-Filtering-Correlation-Id: 2260f168-8316-495b-b527-08dc322fd8a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sABSVqnQQrolHUWFwZYTBp87qJFNukwarQCulcK2DO+emXwwrhdI8n3evkyY40f02I8EjGjFwBuJXRrFFsBVgziJAcSLhdBqDaWo1jXE6CWrp3pCu/qwwGNRK6J33hPXyNrzDKrX3GKTrNj5N2mGdR5er2E1m4iEE85MnOLDurqy/5ytNFojJh0wqngVMjOgVLjXLWhDHnkYLro8Ax8Le12RDrldcfgrOwv0/rjnwpgr/LUJnLt+2RDpZDthOduMW9vYn5PEwRhpjQSlshcT8OFqenU3mHZ7dBAQ2mWtCoyZG34bKf+SvUFGoSBlhZfpjrBtIu2X2e0iPQGLmHRBBc99RROkT1+S5n5iAs5wr1ugO+VeXjsOSJKesMOap3EnpHEiHonYHX0x0YJile3mDfMDpij4h5wCrzaBzA0OkIgCM+Dw6prmxSbwPbFGMh8ru8V94KJt/mCTRsOVLZiObSFxv3aha7NVESLnMflmOexY5df76zfuYlrg5UngqzTL0TTT1C3YOPKmBJkZPKDlweHEJ8kSdpjN5X/dbdeQr6E2QapMrYAhOtrrpzl072y6Uvuudk/6CayMrZ+c4jK4x1re3mUTRxXDRlxKog/FOeLuSeTX/vH2U3Aj8+HvzCzv 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L5osfhO1UvA5PQUFXCbRtf3bbN7ubCttHt1N/6U4WHCE5Igzl8GHwLsuxNezHvXhXfSnvimsnvQZHLo+pRk67oSf0DmWMCpB1/q4ll6gIJwbMZMSj64+mijdzbVBd/E+NxK+M9LppTtseHR/PGBuW4eP7k+2iNyZjXuC0y/HFSzaw1ajTmt2NlNhG3Tct0All2VIiek+C93LOaTlTKhunSKoR6EFH666YVxoWup5MlPSTLEoigtPNlDliPsPELTgenDH34dPDzA+m5DYR34bPkXHJ0ehDxJrbTK+eNqwzsEEuBTXf4gvgObAMCSYrN7vAGxU6nPtqj4NZkBEdJFC9j2tlJN74ikJFUqVovcYELWaqRehzWI2Q2er0VBWT9aJjU2Wh6juJhoON2OW8EUBbmHZAKZWAhxt9UJTackbWGqfMU4NqmYNLcu/TvI2kwNaKit0+ZLTplkPpGUJKKhPYttOmCyvSV8rXjs91WBNxWjffJ0m8dMcFf9rMp+j3GDBtLuOZJPBRaem0G5Nb9iVEfObKdONch1aTOy3c9p3L6kDh8mZvkmvNXK5aR1RC0dDayDjOTb44sDa8Gi6joUpeHmvGXdfrnlLbmFPEmBGlJsTzGDpDnkVVhJbnRycBCMXx02wdbnBKS2YK60QxC1bHGWC1vF1z88iMr1oDVOCoVYKpDDzLYVZd7YD8f9b1xeObnXn16uOxoSCGOJvZL0jvf0Bc6z+PotGYUQU7fs28fmR7YuP/kb7g9+gX92+equS+pEXxOS3WuTLCkPT3yL4wTN3/6FcP7w8yb3+oobfyQ56CP7D5DXArYNzE8fbG8V8sx5I+sqnUyKcul0xBbgB0JfGUhZor4OBR7swnEERzQdmVl0gRy7UmnrcT26QSYUYZ8l6PRq96kFAvs9dWrExrOHu+J1WBPy2RlFHWnu8mvUT3ic5PdIQRXDxeLZeGD8PrKZOmeQXmsoXdOcXSg6z06VcQL8HTMzXOZwcD3k5LJkd/VUvEZRgTHSqwKjpEJ05cKQwhBDz8Ydzqjb3uHBTE2vFRVu31kV8YlRP0yLwVzlARepTzHuBWjBIOa/qZxxnMAnNGHEJbfjnQpbarRvLfHH/czP83EKnLkMld1fuHkRLdd626Dzo6uPpBWF4CBSECzE5T01MYIu0l7sMj2EP/ciU95cD2A2vXVaZ4LFTWAExsIU5wk1ZlSpAgdPn79Dqesi2HeQcaeYMzZb4dADUJel3KxaU3h0WF904I63YOQE3B/c0UDLfkbuHSJaBSJZY3gCcoxULFZj5lZoVgxSsSxD2oXhuOi6jFa98qMuscu+NLdRo7suZjEkG+dNbqabTaGpLM7HyrWg8QKGReLc5EJT5YY50hO2/ZP7dKiv9qVN2sicnsQV8h2NBZvLmqgXsJtKb5X1vLDOsWTKNzaufbTDZShDAVJRPdJexUkA4RZxzPkFiGgj7lDkO4mpL++F1mtHgL7Fk8d7i5LbfCd73uGoL0hxn7eVDeD4h418drMrECQNDAi6prV5MPRBJYjw4dvy2GqmeDzHRzYu4ZqQHoBp1ENA0TH4DAwkLI584EBtnJBy5hu9R5Stk1OwEn+Wx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2260f168-8316-495b-b527-08dc322fd8a5 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:26.0760 (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: ivNYQ4UxT/Iy1Sz7gk6MyprHzBT8bYNYaqO1j6Iu5xPdYgKAdMPr8tISWYLBBnq2uVqXr/VAW5kJEPthXqaRJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8682 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. Acked-by: Rob Herring 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 Tue Feb 20 16:19:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564235 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2070.outbound.protection.outlook.com [40.107.249.70]) (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 B286678B79; Tue, 20 Feb 2024 16:20:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446036; cv=fail; b=Z4+siRqGS6qRJURNYWBf4T/WmiJBGed0z59LP91zgxkfobQLa9bVyvSbY3LXbsl30o+DF0ttJ+cvGvrgumBmgCLYHwLyf6sdld2VZh7iezkSpPaSGqkrplWHxPmRVZp0mP9STtntwt+XW4V+sWbZqC7+22+yAH246XeRLJln+WQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446036; c=relaxed/simple; bh=ScTy0K4MQ+5/neKteBFZcAyY3Cy1DUs22TiBOkS+Rv8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=rzvnUuj6r8oNqb2lwuI+CoRqkbnS3F1ws8HqPNcDm3E5chtnTwlDy+cBkuCauBJ340hCiflYWN+rZykbzTHcBZb0WYl1mkcckuOE+Q/hdETb1uSGIZ11qQa06NPjL/7nSJX92LOrlJL4JbonI3JbhgmLEIXG5QnFM+A19Dn/T9g= 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=J4mt1Xvh; arc=fail smtp.client-ip=40.107.249.70 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="J4mt1Xvh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qn/y8xMVFGUwgHgDxfJwghvAmtPgTgORnBw5mV94eGUtQGvyGi3OCjBsa0FkpHsg43bsWIxExESuWZqJs0XIICzaOvDihw+sQXuCFX7xXqDzE+GYPfVNqsvHrmDN3rdxH0Ad35kC6eR+FpzY4nCK5d9Gz5jh/DFrff2Q59iywf1htjZyOBHFbXun/PlFdAXExmkKU0lzA2kna94m88LtyNsUtPNFORhj+GGVkpYjV92JiQ3voD0l0Seqi2/aD1xHnyRrwRjw+pTe44I5GbHGbrvpGKtYZr3dXNQpyEFrfI3sp5LoG4/+M02zRYXbfaBT7XiiWGnWjvUvR4C4Mo12Gw== 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=FVX7YF2nnMsn4TCg5IFrEsxcSGDvsICvYhMpzGmBmJU=; b=UV+asqqffwDPbyVzudWBUEtpcjaVjAd3xtzJGJhXjruISw47hSYUX2tf4x6E+cY1S1/qy2CjP9dZxvBGwNLgj4o5IZRi6CGlkuMFp5wJ2CfMfQQD6Hmv2d5tfLDRNlv5QV6pIxWcYgzrqGWteGoZfViqNsnhrg8ugSnLivfNTlMOWzizLU06FNHjkKYp0bH4e9YaMtp9/EFueKSGHO9mNVIdwdf/2MxBp8Z/aImxdLG8mHUTp7ybjErxRzjZqLr2eVwJRQmxzs8siG+ymKIbIWKI8GpJYWw/AnEp7RR0Lr7J0auMeHxZ4tli/GqQnzmF6Or8DyL6lkRrB5k4+BrGZA== 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=FVX7YF2nnMsn4TCg5IFrEsxcSGDvsICvYhMpzGmBmJU=; b=J4mt1Xvhm4BRQ21IRnVAf0xoVku59ISzD2JOUfqDV2NzM70CSUNounEm4mIQDk2z8B2CLfInLlvZm8OGQaLR5d+4e34XgD9022Swb9Oj8IK7OTNCxFX/xbn/KPVIKGcdJ8gpSzLgxSRbwkCsWlaDw1/tQvtk93aHdOJ/zwNasfU= 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 VE1PR04MB7295.eurprd04.prod.outlook.com (2603:10a6:800:1ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Tue, 20 Feb 2024 16:20:31 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:31 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 09/14] dt-bindings: imx6q-pcie: Add imx95 pcie compatible string Date: Tue, 20 Feb 2024 11:19:19 -0500 Message-Id: <20240220161924.3871774-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|VE1PR04MB7295:EE_ X-MS-Office365-Filtering-Correlation-Id: ad29e59b-e497-4ec2-fcc3-08dc322fdbbc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SJib65YVAFucroOMBqoSJTv8nb7s/z3Wk/JeEGqbN+bbY1qjz4EnWyuc9bFrS9PIhbNfgTAtSbPlHlIdwMWHCQ2qLDnAALd77a+4R0/Im/3WAhF9AC9KqzigGVOu+3dlKqRmrhd5EBPHRg7S6F0wxAC1J7fYonrvrjAWfwyu3OieBhOJq0hev1BmtVsNFpsl2QEfddEUpQr6EunF6aUEllYFbEJ9gtDpxTdLdJi3IOn0rVKEchruYlNEacgm+GFDHvogURL9yKEcFW1yRekGr//3vt2GRon52/vYQgJ4/bXarY1++buBTlwVu/0fLZczA0TBRnGtVSTtBRlK9TPe1tAWROXfJuKgHzjV0CKYuHStyQA8vR2YL/6ERRZxEMk9j+J01BgSf63LM1KaXGimS79tWrvcDu1vUySZ4l9irpGvWXGPkvctT6dcktUdiNVW/0puefNz5OySVvmDiwbsJTDzi5lqhknQW+n1C0fbJyPYIFFWa4T6b9ifQ05HFNM+1JltSE3EorGC9HVgLUe9IfqrwYo1nh/8KpOjAjem0QsoIiNr2Z12Ha5Mtw3XOlSD01n66Oc5m1/3D9774bCXT4OvyFECJcwe0P6Rw+KgnYjV+m88MUf36kH1xZSB0BJ9 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GjSDLiC7O63h2T5yz3g1knqVyhktNaJg8XTEJ0sbza4U7wRkHFhiEYsJ12xUUr/deDmvWWurwokPR8AClvyIIYTWKtT6d2n+slkuGfZQUbRFnN5QWrxUy2TrZjhoDvm3aFEzpgOiCygOnYh+ZsGPo3oLa/S5eCRHogRswUTRffVhd/5fI56v5h293zCqU/fQHjSqqWwW/1T1QnS2wOhaJIzFoCvlFb2sjZPrnotulWhlI0LgGl7IUAQ1vOyTL4lzGfPDzM53Sd0dlNdMbXG2aGNBFLaRvvkSQHKWK2WVRj+7sxc5kaRs1WU29K2Z2/PnEh4WuDCCYh7RskSy5Hi+RD7KAFSl3Hn4T1Gg9Q3PjZ1l2wZSRz/L3Z7gcHjxnoDicfLVfzhe+YJUqZZnp5iETsVeNmwfxs7mk4KtrnAWM9BtKQDG5t1sK4aeCQuw8HPEjN+j3CRoM0NjVZ/0YVXWmAFHXaiEaf38ZIi6Xtrf1lDIo0IZO4Q8mKk5Yf9exmbzaZYYzy+z/r6OXaaTue6pkpTeqO0SRYzfFq220VF2dUOsiOrxJi3lh5yrD30L16WlVfg3bUbczVPW1okxgcZb1DGu79CaoXS4qaLVwFtGYcqzGqWcWDkI5VTlslPeZql5IgfWsWjdlwcXME0ZkeSl32GgcXovXDDCyV6yA82ddjmxQ93OhR+GZsWJqr/9fVEhBwsMwzZ15dQ4KjcqR8F0DNkCQowPFwQRoaBqpJHhSM+jSz0UpcidgKnRt8l1BDFFJ08fLPPNk9mdvPcsqKCHOmgvYnctg4iHwB9i8nFY3A/PsOeEU7oHFJ5OqtjRHpaa73AC+3CjK+jzLSw+KQnh7c2croUuuHossEiCUJYlyklVlgXNplc48LAktiXMefZu6byqFWCtmrcf9otQE2PLmFfMSkLtnfkwzE6irLVEO9QmX4BMfOrJPpBEbrEwLoItezGm4p8CcNjmWj5of2Uj8HahuPy+aFqb+wQ6xQzozFJGc8WjhyWL/VvQIodkTrI8UhtvNA/+BpfyrnI+fjRTpG6ci6hc2FyVISgfJdLO/H3Kd+dL7F5383M75r8ObIa8Wxp9MPolNv5tTDz+oPjnIPKO8w0oPVwMmdRuTzS9Db9AJ1n70ZrLP/631GT4IUuvtFfmwHkumri+n1/M3WQ63EEjQGz3UOQ/E1ccj12zz5WwQUmSmgKmTnA6/rltNFOGHAgTa6VO1ud5GhyHjf5M6cU9IFqSq7GAMj9v0SQoB8aGngJkgBWpezoYdo8+VPwt6fwFkIqJMQIuuXIGQhi2qcEzeRYN8ijTGnwKTqwIwBxljcTiOttlCduiJlyy9TzcOogZ5dvwirlyybUmkCcexFGmLS2SyzNUcNgeS9GlxZYvumroxC5yUaK2B6nTJoKOL7Nqo6U7uGqx/y0OA9zOkZFJitNJ6PxZPnymzQE0JGoaRiKKr+rEypgLIRN8PfMnYX8bwyNvVlIIbFyQC+aD30RszUUYDAEhkc+zJjS/eAxoZ/WWgZUIIVpBTZ1LP2b9B1A8u6FS686RPZA+z0RWCD4L9ku4SApRsX6nNL1e9ITD6bXEyqtX5Jg21wgmXLiq X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad29e59b-e497-4ec2-fcc3-08dc322fdbbc X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:31.3640 (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: emlG4F0dDH2pXN05IjHQ8aR1VSALWZmRsv8tft50zGcMlxtgwFnDBkTNKTuu8DttRgRkUV0pXDjnJvLnon35Yg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7295 From: Richard Zhu Add i.MX95 PCIe "fsl,imx95-pcie" compatible string. Add "atu" and "app" to reg-names. Reviewed-by: Rob Herring Signed-off-by: Richard Zhu Signed-off-by: Frank Li --- Notes: Change from v8 to v9 - Added rob's review tag Change from v7 to v8 -none Change from v6 to v7 - Added my sign off Change from v5 to v6 - move atu and app after config Change from v2 to v3 - Remove krzy's ACK tag - Add condition check for imx95, which required more reg-names then old platform, so need Krzy review again, Change from v1 to v2 - add Krzy's ACK tag .../bindings/pci/fsl,imx6q-pcie-common.yaml | 1 + .../bindings/pci/fsl,imx6q-pcie.yaml | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml index 0c50487a3866d..a8b34f58f8f49 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml @@ -207,6 +207,7 @@ allOf: - fsl,imx6sx-pcie - fsl,imx6q-pcie - fsl,imx6qp-pcie + - fsl,imx95-pcie - fsl,imx6sx-pcie-ep - fsl,imx6q-pcie-ep - fsl,imx6qp-pcie-ep diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml index eeca6b7b540f9..8b8d77b1154b5 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml @@ -29,6 +29,7 @@ properties: - fsl,imx8mq-pcie - fsl,imx8mm-pcie - fsl,imx8mp-pcie + - fsl,imx95-pcie clocks: minItems: 3 @@ -100,6 +101,23 @@ allOf: - const: dbi - const: config + - if: + properties: + compatible: + enum: + - fsl,imx95-pcie + then: + properties: + reg: + minItems: 4 + maxItems: 4 + reg-names: + items: + - const: dbi + - const: config + - const: atu + - const: app + - if: properties: compatible: @@ -121,6 +139,7 @@ allOf: compatible: enum: - fsl,imx8mq-pcie + - fsl,imx95-pcie then: properties: clocks: From patchwork Tue Feb 20 16:19:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564236 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2047.outbound.protection.outlook.com [40.107.20.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 596BE7993A; Tue, 20 Feb 2024 16:20:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446041; cv=fail; b=qL+GTx52sk+VkiQWTcMng+eZVWE0BFdR3C8WYJvlbgXk0Bo1yKZF5FE13PknMQnrd7uEcCKXu5IXuhhykmHnlPcM9HtWNoYzCeSAPDPOtrCn8kzDA1kUKpdnU7Uz5a0Nq3aDV7TDu9GfUdhjppU4yGRaoLrjXOKLcxK6iur5rmo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446041; c=relaxed/simple; bh=xhaQDt1dH8mbJFbnLJjes8GhgtIg+cmj/FFsIwVBgAw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=G+l0rLv5b5Oec0HAHNqmG3QquxE1UEfzR0zbFJfq4H4G7SNpjpP9y3lE8fI2srrCKOCEGOxV6byTTSSjyFQ4h02kYvsTjNGOaceVfg3odwm1KIf3nvkY8z7bmud9MK00cwMeTy+vYF6xOmuH1UzGuipYeorQh32zOSiXN3ckwfU= 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=LPdIJ+Fw; arc=fail smtp.client-ip=40.107.20.47 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="LPdIJ+Fw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hSf9I/bn9o3a4F175jAhDj6FWcwl6uQk/H0w1lWLzQPE+FeO+TChvyt6QQGVndT10cTytKdGrPVeUvMR7z3hsmZdIjo52LDnQnO/4jUN/ddTxKtbtne6qFfiANqatfdqwg/Jbi8uLI/cRXyJzjIHkA9x2URb+cJa3DAa3zFj8jKUJWVJpv1FBr2Aqhg1utU3OkLiMtDDXaGaPbqAXFYyy1XV/4m5mddLoQA/Bj94Xjm4fBN8y0SdTllvaxOq75fYUhy5WSiCPxsZjCSv59VHKKQvf0uYgEtOQZqvIH8EybQPgcX22SzASynqSK//46g2oNQGA5qYQf8spqEQ2/I3Mw== 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=vQ78U91x1+bTEXalAnKotjIZ9NoPv5QhfHAtYdw+5+Y=; b=MdpxqZ3JJ5wCb19QJHkIc7wdd+EgjvO8NFadt7ZvS+Bf1buf/rokh562X3cMJyQKbXaFV5RH4V8oEA7Jf4vQoxyYHWfcJqTZTLGr+yfeoqND6j0ZhSsIX6eCC6/A14xkNhVxfDfk0oznaxBEbq6zALcoDSGm0JILVRP9sobnhtoLWvfBFRSLgMB3pif0AmIbAtvKXNtBrEkySYubAnAoUEirPmegOKoGMY+mA+OGZSqfbzQ2x8wXExjs29qb7Kg2baEnbOWD2dpHqk4q6JrguPXAVTDYzQvGYF1lcGBwKERIwV6zY8WRk1UjUdhpjIhppEc648NnUJrrNATU8/B7ow== 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=vQ78U91x1+bTEXalAnKotjIZ9NoPv5QhfHAtYdw+5+Y=; b=LPdIJ+Fwx2+DTf3X2XuVBZVlEU2IJhLSEm/ITHqvr+zKlLAQUA6euq59Si4Z683hWn+v6rNbtwn1syny87/M6tlYGQZTlB4vg8tUhdz7WzpUFv4O+0WT+FF+sW4xe/vIKHaicm56J1/XqKaOjHuaLA/rE7e3oT05w+TU/hl34EE= 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 VE1PR04MB7295.eurprd04.prod.outlook.com (2603:10a6:800:1ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Tue, 20 Feb 2024 16:20:36 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:36 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 10/14] PCI: imx6: Add iMX95 PCIe Root Complex support Date: Tue, 20 Feb 2024 11:19:20 -0500 Message-Id: <20240220161924.3871774-11-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|VE1PR04MB7295:EE_ X-MS-Office365-Filtering-Correlation-Id: aa727374-9860-4a13-6d4e-08dc322fdee5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: an2l4e9UPKWvAZ2Q73eq4kKdck2/SjLUFlrRmg9QY1wAmb9QHxqEnJgLprrKgy3zgOEtG82YMC4SI7adRIDeB54eFlAmMcaRZRHohPeQxYbIpz2w9HitAc4iCqHTN3yN82VRZWl0bcbY/deLqbH0apiHlu9mhg/jHCG2Izy5YYX4PFPsMwvuxwV5hRnzVHfoD5Tlbi4GqXBnPvmhB5HRNxzZHv0SkLrEkWo/fsImi3Vzwn9y2UvTvQ7dc8y1kjP3f8ldHxEnCtUiLJSsYLXnsoYlDuVGu/NdMlrNuPo9mgYEyGFMbgaqZ/A9DXhmfXt2lAaTkpwzPO/sjiljFhHUz6vPztzVZ4TwooBo87vC/Hklq85D2H3Mi0avsHS/kOFO/PyGO5r3Kug07gz4vI4xewffxuMnMPkLmaWAP36Tli6E4fgw7MRfwDjTDq3ZxANEGaSmHZ0LASrl61KceLaxk7+G++e/82EX2OsXHwJzz88NkSKTm/eIaW1rIUfieITHTvI0aZgVyXUM2ncc2sJZbLMi5TAAOeXfP6h2lmhEJKBJcAu2wacgMddEs4QpNIRPjTgtyTH8CWYcSEp6V8A3mcUIC17uzoAEUS6eXuEx4dpyPrSblrdwMkPiglwbOTlr 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YI0UJ/nZECsfOGAkC5y9Inh88Xa5dsB2bKeimluXnPOHTdddAJRlvHjYDhAvdaPUMnT8NtngyTizeIr+81It9rjsZlaCuArOWqk1UwaR3VjR06ffS/lpew7R+aCoXddioCqK1NU37uF5EdqQb4Y3qYm8R0WeMG1vuEZFEKpQgmw5wps+jj7gdcMq53ynpQuJtxZr4vkuhj7XYj0YGuY+3qYsL+MX4AhPjngLQ2RJQooFmEG7//1A341y6RArNv+FBARaXWNPx4f6AG83XC5t8pEIEXQeaE9OZGpkPlPHHEXFfmXsyXdVYjr3f9JdMyvd7mQwdu8dsCsT+uf0uLyONNxPECyTVKu0kYrTER2gDERC9RTHqp3Bzp73J/vOQmByghpKRGUeepzoSjIi8Q7QCp4cQvldG93Mk8bpEQrxGJW4rXTpHsXkctGZ18KHbokGO9qvLDOsY1wU7ZxO48oaTCZvImw2T0V+qTMbdPuz49KWmWMus2enXTGCXq1UC1EyPrwdXGj1SSZlHhEdLqKe9sahxu0F9jn6g8AxmOqHYM3fHu6/NnGkP006/Fp/0uCECl6BF8BA0r0HZkJ6B/ceNANVGk6BvPl+FcXTm88bxToLGMFbEHY8uUsXEACAtxkp5C6s5o+1L15f5U3YWEuLvmjJR5ZSdtU/+0fFcxJ38LQEA3cVslzFDUbG36ln1eY5GSFPnDcQu+DA0+1VoMXjoFw9ajHVi+IxCxgeOc+aklXc+v9NGn07iXtnWFl404NhcPPE61gqQGLBCuS4Z8cIY3Qfo+Sje6+5BJ9E4Ik/MpbpmiJQe5iThQgkWR49Fgp6qrPQ5pdtwQ+1H6jky6BCM4cGsA6ZVHzOXUPMYj1xCL/HYUfjbnWDP/K0V1sCTXw6QvwNU1YzMY5HnV3mjg7ygzlBvhDjuKvvvpebcqRHuAhWfamDq8m4m1dvkRoy81vJC1H1VVFaA6/ACMpmnYCOIRrHNaoHoeeLpIj3me+KfG5T3+IhRZTEKVs2za1HC7YY/pXOADkmeMmE8aGb1rqIFHx98ghuruk3L31SfP99g0YWjwI1l4SqEyXXS5uBolOtoCsN9POwAGwVr6Jc7Y3WzUpFZIaemCLmeZ8wSjJJmxO4DAdNHQP8cbrDaN5sWTfWECLyLUaG5pJn3mjIDPYAYoVpuk6AKHCMsmB1CW/kCB+skAYFuQquCBGbo/08mHlFivKR6wqPyMYVVF29eMdXZLP7fIy403ViqP/1tr5zPaMjnqnkKviTDH71QBtXyH2a8HpAljgMmkcpWIqWbme86SNsbt1D4CnJ+qQUvrf/oLQdoGZH+KQEdKlmtx6MSzmzP394+A12TXbajQOq1S84CAyGa0o/MQgh5NEns/5+lUS2Jf8mgmN4TgOp5kOpOojNsJtBw0ibgDGYsU2CM5fA1itqHgk8MvRPMy/Yfrx720YqG0p11bLn0OrXXBeXPyse4d3k79odntOfWAGzb9RdFRqm2QS4dt1TtaZP27cktLy4KbSf/w/W5FlPtledRod3mj+1e+22pg0RQrTtJoU4JjZ03/MYl2aHxKc71YW8MVUPW5m7VM/QnHQwALdSsPBK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa727374-9860-4a13-6d4e-08dc322fdee5 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:36.5440 (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: 3Z8rTCEl2kz6QKczF+FlPcI/DTV4a6hP+0wpsML6XJOwDQ65XdoirwEhKloGese0Nqwtmjh4ojXQwyyP+nApwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7295 Add iMX95 PCIe Root Complex support. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v8 to v9 - Add mani's review tag 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 71ce6b7ac1de0..582ba00d628a1 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -42,6 +42,25 @@ #define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE GENMASK(11, 8) #define IMX8MQ_PCIE2_BASE_ADDR 0x33c00000 +#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: @@ -1279,12 +1319,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 */ @@ -1457,6 +1517,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 = imx8mq_clks, + .clks_cnt = ARRAY_SIZE(imx8mq_clks), + .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 | @@ -1501,6 +1572,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 Tue Feb 20 16:19:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564237 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2083.outbound.protection.outlook.com [40.107.249.83]) (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 484877A713; Tue, 20 Feb 2024 16:20:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446047; cv=fail; b=NzupGmTkHkLLRx+2uVVPwvmOmb5Yf2cw0NY39iJJXuqvy/siIjoUbzijcASp4KjraJhKiDn8QtfZ+nkznz6AZsSxxGzs4kbRl30UbOoDfi+P54l72UsVjvYDoOFgOdBtuwFM7Vqlz64yUXf99WaTceVTkkinIAhkkRddzU8VfZI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446047; c=relaxed/simple; bh=Xo1DFZV/NdoH187fBr+bZ4zTQ3LPtufk2YnmM9cOJnY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=RmdnNxwvIZV0F+BDiUYN6hzFLUHq5ojaaZdHwh4V6Vj6LZowNsytR5Y+gO/wqyc/b5ngT8giKEf5Ajz+FPogNWcSaZJ9Y2vz3gOal1aPgxFqUEnJ796X3kQhND3XPbg+Cyvgeob5DxWNxE1eRR5N1aQ1u/rnYiM1xwqCGXhSCWo= 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=fw5PWf/R; arc=fail smtp.client-ip=40.107.249.83 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="fw5PWf/R" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bBvcaxF6van6IT4l3ZEY8H/dOza5dhgL2xnWzIvjhXEK4alIGFpcYzJrn0DXPelKVZE2aGUsJFZp2iFYKyfIMpnjkTW80mohHLy9nKlJ+p5/WkQEWZh71PM4DUfcHe6BiPXMjWdnZLsrV3fu+aezDMe11+rmlYlTeie77yvOIQw+r9WzNDp7yhYRopzhFHsZeSw3NKqWUa2LTaqzNnlyP9RnBXSWOyYXfmNmEqTz5S7MZD4TtB91XY9Ezq3+3UUG4a4lctVRrFXrrOU9JgNBO3craMn6DN+AqPt5J+qW2WDGRsvtGFsdKbf9rzlsYWGE21XQD9p/ngQvrhRoxbN/Kw== 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=jZ8rmPtlwKUlEL6m3xbs5MpZ8Ok5KVMQlceNwACttyk=; b=ZUTZe8FKCrnpIgx2PjcUU89H3wwE3OEbYQVe3NlpfgleLIh2epck7ehkQK3EoI3gTpUu9Ztfjl/GQyvJ9bSU7cioqXeSf7rAyjRGiNM22tTBYh/Q6rmTQ9HNDjtRCuVoaHldFNOj6exwEuMmPZxldhuWcaYOOGlfzGEZuZZEuuhKZbDKP7uP0u3ENIs9QiaSrTY6ClDvATGFYcxc4h7sUFel1kMlaAEF4K4/DqusJ1HSVPHJKwUm3xQqqVGTWH+Y7r5jVxJOrTkQ2rZdTmksqaar5X3lLozKQu3CuUbQUJMzNu6xon3Qdn6fVyKpLq+0kvz69t3j1R47oaGajdEJuQ== 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=jZ8rmPtlwKUlEL6m3xbs5MpZ8Ok5KVMQlceNwACttyk=; b=fw5PWf/RPw8faPUvtg+EZjIonT3uLX5bCAwUqBeNv1KF/0rALdy+LL1M3ZSb3h2Ck05p8y/oOsIN8tpYrE/wU90084kNOncNFRVnHAIa2ASP/rKFj0xCZ8CW9ZnLkBlEqk7r0a+4zJeYzzJUqGjk+UY5zkIMpdExRQiMKEB3Jq4= 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 VE1PR04MB7295.eurprd04.prod.outlook.com (2603:10a6:800:1ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Tue, 20 Feb 2024 16:20:41 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:41 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 11/14] PCI: imx6: Clean up get addr_space code Date: Tue, 20 Feb 2024 11:19:21 -0500 Message-Id: <20240220161924.3871774-12-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|VE1PR04MB7295:EE_ X-MS-Office365-Filtering-Correlation-Id: de002cf2-3ad0-42b7-b123-08dc322fe1fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 46O8jZjLC8PVNzzJumXuOkjOrAbYXaj3/aSY2iVSG5wVZlvmGi5X1SMneYgXJxALX1lmsgdg4J3hQtPKwm7QRdMMhMLG6e/4gKv1w/bjvvXCUeHW4vqn6N0QfbA1cWJvpnZlxcfNPs+7flXcjGvRyxNnx6zBa7tSlINYHQlRHCRSLBKbpXGMvIr4/xriRF4N7nhIlErsNcBWHdDo4H+Jw5lSyisvdUDFEsGL363AtAjrKUmxi81wh2sE/vgecQdAi3VEiOl32RdfMeEGfMLlAnlziSqREf3dcTocbBH3ia87Z7jo9s4fU4DStkQInGds1/3rKBd1zddfABLgwFRrO3DGxwvhwhmNo64mTFQ16s6Uex4/y2g2NwvooBXjkAhVnoeJSCpLw00HLNU3xp7rtljJUlMElQbKbuXUGH+pcpaBCrnyUUleLh3RSDRcVt27HTx1MHN+HAQUI9vcLk0rxNRkRDeA5LP+rC1NWs1k9EZm+JQWhyiUaCCrCZStKFUH5xrkxz+RgMkXBAtZ/cRDYP6kSTojENRtbkMc04lHOjBpNiLYqRbxMU3johZgVqjuSuV2+Afsz1ZmdF3A1xf5HtQUI3UvEBTmGVwRDzqn/7SRmqlDXvFUJbCGpD0/eHVc 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tSwQqC7dVQE7kYV4tzEHt4QM23TYCwGyZRLCE3EINUfgjiU3jiBwyRNukoRDEpRKSCrVijzuETIbe8edd7YSCYmoKHnuwUCgnjHUcOdUIHPdWt9OAvgeJauMJx3WhEf7PqMGofY+SVz4YKXmvcHn6lWKzhL1BW7t+J1MOC0PRgimdUDC5eyEWZqXtSVlUQRDAXVVSXRkQ0NX0FHXleK84RrxkrL5FVQd1XhfSWoMd4y6m790LOrud43ZNOEVKABDC69DcAXSM61PD1yjN1xpUGGRgzPFhYGjHErpeY96KEJdYQayuZbURTNUJu+X2D2F95+0xs+YUwZJF0xocEIvhNarM40ObnXCswt0EPGfPxJAGGxb6Pd0AJtPSRB5fIsXuaINO+KwOSV/LqtejVqmIRQKhpV+g02XWnEMeMV/LM8hlKKWGM+uooBuAgilHgUllgPaPv2jNihhhuPicfc4uo8667uXa9J0jEKVPnx37F7i+gievKKTdJ87mWiqe/R9XUVYOvfHDIxpKNjdU+AJzmmMAAS9oPv08+xN+8AF0+b+vDmcWoIyfxzPED5c0B0xc91m+8T7ogm+c5gyhPbG+8vLAUIcjtlJCIAQm2QqQJgaLjyKCg9H9e+ma7TCvOO2qMOQBfkKNJDtpl5FpkRP1hVVPFr2BkicsVwPPXXUJezLxon5bTvQfovD6jnWxLENgMuEsXgtF4k1FdfazNcV/L4z0pnAPX5YOVUiuYWip3v/gvqt1t8UXXIjjgW0n/R3VVF3Rt5iG7Zn3AOGEbtEkpPNB8ZF/yyQWGK+UfuCeln/BcPSZUOIcEkHlSiIgVxld8suYnYKkB+2yqb5tE9taiHAjQgAQiv4z7MjDI486V3OsFAY2F7kgSCgMYOneg04AOfu+TFU3AodFpzGbfJviW+2epA3+1fJdj6nipEYndiMDlA3csB/vTYGscw0NWa8wpIA5JkhHP0LvRI1v0k1cnmTjTO3DZlRtGeqrCBNeWvXKY69QLDCLenjrgQ7m2XTuswr83SY2WJojz0zDclruq3tRTWn++Ok8tnAfF9+fVPGVNJz5TW490NO8rcmn+SjU9Ua9Sd6IMi/U7tkGlmBkRYo6JpSPFTRsVSU1vvgFhfvCSuwCNOupRgOwsbD8aIfP90czHScwN/8mMLmQzo0WoiM8miEHvBzbv33pOLlhy1BGFbF4UYO+eayljO/ucMhZE7bdcv5/UnjxvO+f8gH5lR3l7YRTgg60wZahPK2W58U73sVobwXlxMtfvyfraFyLoLj8MXDI1/xzO/2SbiLvFD8anGZj/m3a2XS3fK3LsO7ctVyR5Qb0PH8W0l0OOoxdl6jtPJvCQf/B+TKYSxjU2t+Ebbv79MnvjrAlxWtQbn29C8tZArDO39FXeTrJvi/z0WPZbNmeJ31iLAQNbpcFR7dJ4W3XI8gB/v57jbyQK6BHllNUYv0mbevE520dVSOwV8TA7yfPayZf5y3ZMx99od/D6F53tKKDSeVpaQiC4CXG7wHJ0VLn25x22jonRdJWdTACMgd2WQ+ydHTTU0HTEtqx22B+owRD2rULChxld7hWfmGY6KScTJm/mXOuLNy X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: de002cf2-3ad0-42b7-b123-08dc322fe1fa X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:41.7375 (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: sG/quSK4CnUZRUq34zy1RQ5cgeOqNr7vV4ig1MVJof92weIY+svNRaKkxLWXBTAyfhHuDSoSdG67C2az/x2w3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7295 Since the dw_pcie_ep_init() function is already fetching the 'addr_space' region, no need to do the same in this driver. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - update commit message - Add Manivannan Sadhasivam's review tag Change from v4 to v7 - none Change from v1 to v3 - new patches drivers/pci/controller/dwc/pci-imx6.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 582ba00d628a1..3009c3ffa1415 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1068,7 +1068,6 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, int ret; unsigned int pcie_dbi2_offset; struct dw_pcie_ep *ep; - struct resource *res; struct dw_pcie *pci = imx6_pcie->pci; struct dw_pcie_rp *pp = &pci->pp; struct device *dev = pci->dev; @@ -1087,14 +1086,8 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, pcie_dbi2_offset = SZ_4K; break; } - pci->dbi_base2 = pci->dbi_base + pcie_dbi2_offset; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "addr_space"); - if (!res) - return -EINVAL; - ep->phys_base = res->start; - ep->addr_size = resource_size(res); - ep->page_size = SZ_64K; + pci->dbi_base2 = pci->dbi_base + pcie_dbi2_offset; ret = dw_pcie_ep_init(ep); if (ret) { From patchwork Tue Feb 20 16:19:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564238 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2068.outbound.protection.outlook.com [40.107.249.68]) (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 909267AE7C; Tue, 20 Feb 2024 16:20:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446052; cv=fail; b=iDPRMrpeEs0zvNfLAGD1o/upxknPOSmZRNC8TeQFtQV5WaQr6tYLJvhhhJ1sa7MQMBajSpfM3jHx9wn6qyhqSlolA/SabgusSDvVle+MLCaqePmjwEX18j3qF+Hk+UuwuiqliEUVpPD2zS3KvV1slhGoE1ZL55aRpM17n7bipAU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446052; c=relaxed/simple; bh=zBrnjyM3VQW0uVxKxfZ28qssPZISTIow7Y8BfuCA7cs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=cZbgMM4HOpzFgSuug2vo3OZc695PH89SnkG5VWafWipCrqTHOqI+ogflLd9dCgNUNZmN2hOcDWE22S1v9dh0YOM9ATzYFMZ+U9+C9LcrfYhl5orD6kGJ30M8W4pU/GXVrqDdzM1gFY4wBgLsCpcgTrliptWucGbbsYTSwj8WU40= 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=avu2VkZU; arc=fail smtp.client-ip=40.107.249.68 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="avu2VkZU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VVhzyQBJo05aiSahThm/U2HWm6c+oy49Um8MnuyiM+kiA3Uvyrfci50WXuD482rE4aI4iCn5gZyXJWsfviija5kP/ypWc/UeKHl2Jsr9MxqMOMGqXggTHJEr6YjPSlyiD+K8mZ/x/alAyv5jVFKc1JXQNwRkX/dszcYPRRhf4BDYzfDVbCyOJob2W0L6I0mlEIsRpUW+AAQQ5wvUw3NQg8PsgC6zbatZ+l2pW4W+9CNVpXEr82a5Pn6ovIB1y2WbPqiDhb5BtcOEpXk7Qwlisa/ud7kpVJ0pCiBEfZy7ZhY0KyCOkpR8vqLHfrBpvoLLaoLqdh+QY0+ZjFaiS+yDBg== 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=81mSYg5kAevXFgLjg+kio0OZY+mGG496YILz7kVVH+I=; b=ZKF9PhfjYxogyqcHv31/0igBkC9WaiMTqHE+5iEwv8aMxp16Xri2bmTOnHWPv6Sr8VHI7cJmhoLlZKszZN+iPgS+GEk8lir8kIhj5a9thOXEvgo4btPWkxLc3BHCbXxZaXlU2k83Kw6aa5sVs2Cu4tG7QSS95YvKCVxaKxo8DxHdBe9zMWDSfSlOacrr5eyaNd5kyGw/KabuxvCsr/LBYka2XrWFNvgX3ZoY2W+H7y7yz3AJyF17uLmofzWbBw3MmehUAUOhkhBUftXHbcuCPEC/DBQWOBeUdwMaftiHgPrFSXnIhLsOwV/oh3eP65ZrHXB0eSzRytAP2CF8Z/DF0w== 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=81mSYg5kAevXFgLjg+kio0OZY+mGG496YILz7kVVH+I=; b=avu2VkZUQwfXtQlQgGk8zYGHq9ZU87OWBnyhg2TNf9gYC/tyOozvifLU9eMcTEHHqLKPyzITsYRjGuD6Se7+RoajJIKzzubpnP8/vBO8FuW8Rx0miPonDFhEl3hFsQGQi8igaWAibJThU/vpNfAs6P3JvnG92HykgajeXkpXEKM= 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 VE1PR04MB7295.eurprd04.prod.outlook.com (2603:10a6:800:1ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Tue, 20 Feb 2024 16:20:47 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:47 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 12/14] PCI: imx6: Add epc_features in imx6_pcie_drvdata Date: Tue, 20 Feb 2024 11:19:22 -0500 Message-Id: <20240220161924.3871774-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|VE1PR04MB7295:EE_ X-MS-Office365-Filtering-Correlation-Id: dbdff3f7-e48a-4a07-7525-08dc322fe510 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KZQUCdv/T+OBKIW/1D49BiTB1Wl2NwEIgAoSboEDyGy3zHIfRjwogYAA3r4yFn37OjGnPHmuiBEOL5C5dqkYGDEVtz4Wo+j7s+XEmsyPuen34mnYQZVfcydCKlA6oY0eSVHBdaxP2XPu5+4omRmXZr3B4MdhFdWypPbtrChovtxHlX0KFPKENpbC/6GExpTQyLKhsfanpXU0MwlX222hlCK0ZJ6not7QNoFZ3KlUTcGmPw5Jm6ejsrUKsCQAyrlxinETWJ/57rOa914R0o/bwkOzjTnRAQW35FEYek6jzCsQv55g4SFDiYRQXgW8aKbqktRghf2BaG5P7S3gSRo0SSS1XKKzBRCqjHyUtJGrGEWTsu9PFJuBwQ1YvHkPlrjtGEPiAZgxmX1GmnIeQQK6O+03cWf5G6917QdTZIIMj0z3I2re55ghJ+73aMj7DZupyj0qLLndXgehF/5hM78IrMDWytcuDfsmWBYdLB9Z03tCPH/igHsnq2CezR/lZTzRG+heO1hsA3c9Bywv1X58gT0PyAqYb8PaD1kTtlj259gqaUZ6/O2MtFhl5wrqSqIbYr2RVB1rwaxcqOkZPFZAZnfkmAkANpP3L8+VNOVt/lrbWWla5a+r07JOMVDZzpnw 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yBp75FEf6vkHZCOkjsI0LWziylMygFjz+fSnjumYIFzdSz0MKlCmGrl79VTq/23fxkzOvhAkTx9rA4ms3BJlNuPNLg4D+ib0c9E1y49fEJYzfEE/LzPY3OI6nXynLuyWzdqSWa+6UXl9LhzExgqNn6HWc4wbaen6UnPMyjGPkhmu1l3egcDu26fAnTU+QRC6oQHEeUlAvTfr3KDrGZtJByQRQYdtGUEI9g2wg2xltSr/F9LtIViQylGi1mDWywIjb+w9dvb+YwMIYRbGLN/YAw/hq7X75RUeyIrd6HJD6CTyw2HbNY5jhfAIMYlDVkj0ejxcxLhOpM1W1nCzGTAHXu97SsBK+IhTrZF0cAbCwrZqm245BpfTdKMKOW95djEV+w0rRRQ53QoQkm0m+3b2Vi23YghdMMZX1Yy+IvThrKRcNtjsZXqydsmlE3kt25Ro+OFdpvoowDZQKKHFOfnesEBHjKKE2FOBLsvNcH/T4sdo8h7gWuAdvOTzc2eFa9VOo4ERGCHcSlWVsRfnpz7eMmT1D+ZRenAa5uE1YmTXpgbtql56JxWkaifaeO/keEXJBRluef8eyXW5IlG3X6cvm3/2bxMcBm2m2fkSmhCVNyX/LuEDYrlcA5Z4TOh0LYFCL4bKDF1j3gp6e0SChLezRh1tKWRTROGgJmm8EBnHCa6OIdvtx9WSYgH7ec1XalA20cgNtCVFZDlH2TsUdqHVMruPBB69EbFRS05INLj0DIGZIcn2ELHxQUCnyh5TW01jNe5a6NuhrJ8LIW39rPVnxPwch1oKbdMtdsS1slqH/afNYkT9cTexMk+odpLNlVj9qhP5jM1XvuCceO+dmmyJejzFl6MHWsIFO1tYMTYulkKPkoDUKzONH/q6R93MoE/F1hEkJbrsNf2wBdhtALEhQc88+p4qfG4dFTDT4nFD8MGC2xc81o4QP/wLI3PZ/tqvI7sfe2Y67AUT01GgEwqf/YaZGBNEHUhOPnodODfe8ZA6Ror7PKlc0LThuAyjdrTP8Aw6cw39sqiJsgG7FyXu+MmvUMbGlwaVZljMXuju0P+e9RMpOkVzOuhoLDhM9AlRuGpEyjXtY06PVZxNuTjd9TFDnOBgLXh6VxOGPKq9odbcbHWNw3qSQIncPEAgMoirLiMgsSBRkAt+BgIOKkK9HChjK68/qX0LpA+DN0ax4YYr3NgNtg/g+Do0B6k/TJWr07Vkwh1eOAeKIIAGRFkkyezwBIuqoEwvbuprjNzZydX4FY2vKhYK8FOLtNlCcY0hNoZihqP17xutaqtnGcENQd8ybCBibsqM5JIH71NsYPiS8FRofJbXSsLfWlFZFR/MtHdAXSPe4CnneK6+yXQWyxfor2JKJCZR4kpNl81oU6MleW9kqr9fL0k/1olsPWqQSMGaW0ZdI7FL9DDwDH6Ea3iFnC/x8T1erRCaZwH4VdrIT3W0hRydzp4CQAgrWbKwxQwHpgEzCcfYQ/2ijVZn7/ON0J8aI/FA+/8Zy7KEqFsPX9guz7JWx5DjxPQXtpr5/yJI9Y7wHtS6s5y31eXxc5BLfnv/yzOlD5Pv1rkEp8FARPuk5DPqpdzcD7WM+02e X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbdff3f7-e48a-4a07-7525-08dc322fe510 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:46.9999 (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: 2bXoHXpub57pCgSKzPX+XvI+hQqsP8NTGsWJDU9xtoizPFFp8+uC8U87ELwr9OrPx3ZuLzJKnd7HezHyYx+OEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7295 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 3009c3ffa1415..b714edac6d566 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); }; @@ -1053,7 +1054,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 = { @@ -1533,6 +1537,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] = { @@ -1544,6 +1549,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx8mm_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .epc_features = &imx8m_pcie_epc_features, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, @@ -1554,6 +1560,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx8mm_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .epc_features = &imx8m_pcie_epc_features, }, }; From patchwork Tue Feb 20 16:19:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564239 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2078.outbound.protection.outlook.com [40.107.249.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C3F57BAE8; Tue, 20 Feb 2024 16:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446058; cv=fail; b=qEB91mAHmPzdiCf7GW+92AAcvaZxhE8YpW8dsZtgVyTyM57lbjN/PrfuYOU8Ixc3GOWhaIrh+Zv1UV3ojqQpeJpMyXyDal7keCduN1UNbvWUMB1aNaIVZ2YDcz0IEaFgmGHWkfl84kkmTHFDUpTSP7x/6lTJfEs6fmh0MNf6UoA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446058; c=relaxed/simple; bh=iFUxdRN3L2SpjQUZm4S3F5xYleOwOVtp+4PH2WmXswQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=S8BQGO9dVCJBaKspV1u6uCl5iU2WvUZvMBGhaWRrrcwHek4e7rwM4h1dM25ngQ5h2fuNbA6VKIVO+iiyr7aNwN/CHsfhvpML4p3M/KyHblaF6HwIWOFnOTQojLUJ+rA7FkNeWx6Oo0skDzlG5A2PUMLag2VqHDl5Cfhosd7ln5o= 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=AcRJPtGs; arc=fail smtp.client-ip=40.107.249.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="AcRJPtGs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GMBKHeDCBBLb/tmfEKu23aJrPX7lIoDlf459H0FsShkWscMplX6pt3YgAji+udLW/+KYO/yeDC8uULXmp9N3lHKN72uN/JW2c/p7dYYOOq3dop63MIHP65PmwlnM/93/nz0I3QLy4KL6B7qWEqEarwKISw30nYGn3EHGAlKGKO7d2GKdAVmbQ8VTXAuJjFY96x3aFOHu9TWMcR9ceCeAptDhb1HaE+YF281azS7lRN4Kdfh1gP02Hmv5/YqmPv6GkGSWSwqV1opWew4WsYCzLfsM6z3H/AvMaZ5XIZLKWi9qB+gXKX7sihzyfF2EibDSTBbx1XJHvDOx84WkLs+fRQ== 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=rhNl3Hork5CmF1omBkGsnHlaO2lfUl4S/hnuftb6GaE=; b=I2cMo0325f3sCFAZ8x41nLzVmAGISCy05jJxMzOH4VUCHRf544S//Yzjvbnp4ENBejo7jjH5TvfrCsln9SXRVbJOC9Kl3E96fAEkrh3zPahAcygX2KNSXxy8ZP9X0gz2QaMfHY3dB5SNzNSB7N38eQSYcJtT8eNkRL2p7QjN+rchygfM2GMyB97B4JSm786y3hFxXp+sgt0u8RCFJ9lQP4Af7VgGn9g/z7Jhpyb9rCbG3OK4sLO5iFrdcTxOpaB1pRgZgNGcB6RHYT5ZhBgYdPiYjxD5vhDTzJfAOSqAPOUU2BbxAbk0ijMu9SLbnqmrbj/sHsuXlBnglxq+3rBusg== 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=rhNl3Hork5CmF1omBkGsnHlaO2lfUl4S/hnuftb6GaE=; b=AcRJPtGsTCWDh4JasWgrEZG0cnFvjQwlulIpO4ktMZP9cLJtZhujWQOfI9Xp+crveT6XHeRYDFgGVZS9ctFxvLVINCQ0uZ21IAvDRwHeZ846yDVPO6nu+ZLgeW5hx+h/ROyrtGzHLcrBm+vzRDJcsg1g/S5dsEWIqyO9eHp2plU= 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 VE1PR04MB7295.eurprd04.prod.outlook.com (2603:10a6:800:1ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Tue, 20 Feb 2024 16:20:52 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:52 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 13/14] dt-bindings: imx6q-pcie: Add iMX95 pcie endpoint compatible string Date: Tue, 20 Feb 2024 11:19:23 -0500 Message-Id: <20240220161924.3871774-14-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|VE1PR04MB7295:EE_ X-MS-Office365-Filtering-Correlation-Id: 1cf85f74-de10-4095-bcb3-08dc322fe83b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: knfRlstfuFKB/xoKa1IhYn/EVKgCtgwZDrsZlwgqmuTMxu1+9MNOwIxm9DIjkZ+t13p5ml49lipJasTWqxemtzD1at+3K7wCd6jQ3HF8XmXyP9O4j/BcXCX5EDgja+/BcfVjQtUGzutPoOXrtd1WfUCZlblobV4vN+X1Y8ShMT4eGi1H7aF0UTaqzdoh/dP6lw9u9FU/jCxTPzIH3V77UFFGmu65hDKmLjOz0Fl/pZuoh/H9tcaDKQxwyvtALJ9YOstkr8VsGrq5MdfAhEp1fU4BW314fz0ROznz62FamXTQtvN6EOtq4ZnepQ/bCBvEYsavqswD/CBMs1Bu4I2XnnzLB4/C+D476znkz/6A4l4IN2jWGybRjrO+/P7B4lu3eKbOa5Oo4+knbjIQ2zvEOlWQ5uE68TPHuKY6sBBIG6sMFkmbyAYZpqRkIMWSQZYr64gr6L9EnPos7BeFTMm4Kf73aPG0WcKH0/zQTDYwceTg+hAN4Fb+c8tzvfOjG1VgQhmUqkro7Q0+rD+hgU6pCGDvEzJsDmBClN/yKB4JYlws49Mas2y89Lp1nkjF4U703ry6LwezfiCoo3VXJkb/xnUWpM9djBmfWYCJmsNFzJzU9xXJAv8EHHIYoCPgSZAh 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KVRrh2RFV3ncZotTivR6eWpPpchrAivjyFlOMl29j2D18nGqBxvZo+OSrtzoSSTfcrM072TyD5qNCTN7sG0uTqm7skcmR1ApatrEdF9XypU5dg2mkq7JplnSnSGNlEdyRsZFBTCicTLEQBR44BWuSM/hyBLs5Mjj6ukdy9lbLH5pEviEtyA2kAzkQpAlphoErhzj1EJB1shGlnH64yzB1vyvSAX6cGFlTm4+9oDjvbFQ2oAAkIe3QC2lcGBAdjxTFoCO1sm+5RpRIsIhSurUTWT/XQ8RGTEeeYvyYRWr6zeRVjZfCRS8D8gsxCnL3YUYlSTHLbt/cTamVB0WUny0iojg7/c3cKkhVrjTxdyQOvoykewe5Zq89fLV3iGVt1Lz25uTg5o6Bef1kj4YDpNFppnJUGYkVZxzl1CiT3L711LWT8M9kunwKkra9f70mgs/OnQynQAKDmp31ABWVyiIF7SWsrDhfOSnIpEyhFFjW5Y6lEbzUyBWsRY8BYtdJ3UbUP3ldI6xt+Noj2S3kpbvM7oGtoxsLaHdyXSF+xEI2B1Qyef8+SKnWjmX2DJVgg4UWaDMjBnnOza5VnsHn7KVzLFqXvBveAC5s7ujl+3x61nNCnpQRc+GpSf7pON/tXF+jqKWf+ZnHBScvk9F66wuZJvmU5MT31kMm8Ucp3EAwHbtbu2wW6Mh0lpA8mYugv4eVtzmdQP1C9fDqoYOX3lM1W+4Cs/eTTLp4Gh9bHnopKFwX+0q9eIQzVZ2Fs86spif8EF1hrUdzom+ODQNefg+e5yJNElohR8711SBgKeukhejmM7lePK+4isbbTBCBmRCwf47bmwA8K1xrjEB2wFe4gIHk21S0l5zMFbQI736e8TlmTJi/aSzL0m8Tt4nN3LkvX25yKWj3LmzaXkmAPv2051GRgyY5fpCNvDAlSE5QUmucFQK9qaphRtpoFWbtA3Vt8F2DvEsfBEkREwXL/IDES7OwZf3hsyJ82QcYsyumjhdPoMuqef3842w6jLAiR398qdGLgX75GvoX+WOumjfVQ1lQRebt3+aEgSUcPk/A5g07YM0kexA/7zdfrIKKFiKCODzpuHaXM+ao4R5eu2BqjAN9cgoJtHAplXSYIC6jFOJlm7kd4c3Vk2DgCPujEW1phB3w52s8SQwE7p9KPhWQ7wVNDma9Ys6hw23qspN58oIhmPq+8rByJxKOUwQ+20GlWHLj6KNv0BJCjhazB1rfpm5A7gRm8esIkgCF3gclCYysBb7xZb93LVrps2qtEXYXYn+j7xJ0qDRVFiRPBwT9xj6nSBqbgc4cNgNsaTHMfYcATTM9A6ugh1EEL9GeztGbQCwVYGzfOcwgxMQ8f2mTtPS2PUDTJ0FSnKAIV/znVZK9BI9NwgeFuA+SciJpOV0gxEWq4BGFYUYbEaHPA50KbChxg3hf3YuPUsCbeeqep8G3bqF2HvUxA1VPF5mCNXQ9m4Fq3/3f3+y5INNRGFr63qK0pBfqHFDA0RXYXdCRB9+/OoZL4PcV8HOldlsF0MPSe8Yhlztrys32QE5elxotlCK0w5DrPKYuuU9OyLH4HuheheFAhonNXiXzlKw/x4W X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1cf85f74-de10-4095-bcb3-08dc322fe83b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:52.2031 (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: RJSTgjKbhHO/1XqbwZ/7vh0UP5r1zFFqXwxOO5JeiF3fzhydPjuuodbD+vWIotglChAmCuP98h9h6//qFe+JXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7295 Add i.MX95 PCIe "fsl,imx95-pcie-ep" compatible string. Add reg-name: "atu", "dbi2", "dma" and "app". Reviewed-by: Rob Herring Signed-off-by: Frank Li --- Notes: Change from v9 to v10 - remove "pci-domain" part Change from v8 to v9 - add rob's review tag Change from v3 to v8 - none Change from v1 to v3 - new patches at v3 .../bindings/pci/fsl,imx6q-pcie-ep.yaml | 46 +++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml index ee155ed5f1811..a06f75df8458a 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml @@ -22,14 +22,7 @@ properties: - fsl,imx8mm-pcie-ep - fsl,imx8mq-pcie-ep - fsl,imx8mp-pcie-ep - - reg: - minItems: 2 - - reg-names: - items: - - const: dbi - - const: addr_space + - fsl,imx95-pcie-ep clocks: minItems: 3 @@ -62,11 +55,48 @@ required: allOf: - $ref: /schemas/pci/snps,dw-pcie-ep.yaml# - $ref: /schemas/pci/fsl,imx6q-pcie-common.yaml# + - if: + properties: + compatible: + enum: + - fsl,imx8mm-pcie-ep + - fsl,imx8mq-pcie-ep + - fsl,imx8mp-pcie-ep + then: + properties: + reg: + minItems: 2 + maxItems: 2 + reg-names: + items: + - const: dbi + - const: addr_space + + - if: + properties: + compatible: + enum: + - fsl,imx95-pcie-ep + then: + properties: + reg: + minItems: 6 + maxItems: 6 + reg-names: + items: + - const: dbi + - const: atu + - const: dbi2 + - const: app + - const: dma + - const: addr_space + - if: properties: compatible: enum: - fsl,imx8mq-pcie-ep + - fsl,imx95-pcie-ep then: properties: clocks: From patchwork Tue Feb 20 16:19:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13564240 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2078.outbound.protection.outlook.com [40.107.249.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF4047BAFC; Tue, 20 Feb 2024 16:20:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446060; cv=fail; b=Eoo9aIyM2SFCHgdWOZLrJO8UuW5vbI7Rng0tRpSuHvco9kxFWPzDXVJK19miQuZ24Ek1uV1Xv+oYjoMyutkadoH8QDhil9+S7XQw9x9q/qJ2ojBdkTsx2fM39+NdDz+Fw4vITExuQXIFhDNFzYiOKA1KH5c8x5L0xr8BWp4rLnc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446060; c=relaxed/simple; bh=ytffS0tPC/4Y51iqw008hH9UdLpjjRhL18XmfZUUj1U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tvUHLD+FLDJmN/FsRYKGqeX6lBjuxHHYUCFAuvUUZ2sr7wToYvGat2uOxqAsHBu7X/g7LgYqw2a62NtmF+7J0MCXeoeYuDa5LriLgPKYLvjJEXECVc9MlTrBEW78DkPjQaevyPhdSLvZ4i5q8SMDbqYlS3C1qFU75dHZqSgmpEI= 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=cbpYMjK5; arc=fail smtp.client-ip=40.107.249.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="cbpYMjK5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S8B0J04s6svDBsY74L2UDhdpb3USWxeQYJOLhSsBqVNX44JJTt773env3+MKmTVpoxRcPQbPUUV/mUpL3NfHqiP4wthcvWQooo32zf46ryflXBh156FvdxvwwRvdl3W2/mwdtw6AB5KK6OtR2mWigNtw6hVkujNqluDEql3t9uTfX7FjNLIgSAosz/OSyU+aOoP51cn9OK5mm418jbWLRMTmqaCtj0NMNchzx9gzYjcqT992VCDTKHasRTi7LHG0FPLoKZeXG+kyaYgftimlMUlYZRFpwMeCtHpi4eJS5Vpmuip8q8vEfH/6sndsita7wSyhI8H4QMljcULSlhWQBg== 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=QeVKN92ghJ2swGK/lD4v8KOUX3YGM9sbkTM4Dort/oc=; b=VXpsTe4haXXS8h7V8KsHIu0jFe5QpVMdG3KgXYuNiBY9YC000IizQVdnq9/8msQ7hFDLQLN6XZx+4uJJRBoXXl+84HUMXVw4dhDjTEROPZEBC32V8XbVuopyKVwV2Siryg1oEFD6aPQOStHtuntbGOVB52KI9ZsP1z6x5TfQ3UaDWeMf53UmMXYmKNVtKzt6Hl2ARdrgerNFvhZh4IYVg8zut5cfDq3LxrfJpx4hVnwkKOK31XJYeMjuEUBUYV/M6ZIXR9MgU9Hn+spD/YnCB+IkRBjc6RM0hSaV7Stv8B2ZnZocO75aPmgubG9dFG6xqTGeWo2CY3Q0F6XEfX6ClA== 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=QeVKN92ghJ2swGK/lD4v8KOUX3YGM9sbkTM4Dort/oc=; b=cbpYMjK5ok4PTv/yKY6BqWHAH8VsHC7JK1XUWi5ubWXU9diJbbxpTZcZTsPadc9+ztEsaSwluEbgN97qVrpyfjPu06ispK29vgu8nfwRK1RhWcp86xk45HpGwg1/xQm1AU8P/7S5WEG6/5cjUpem5CHE/Oxfmc/+O/Nik2ww01E= 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 VE1PR04MB7295.eurprd04.prod.outlook.com (2603:10a6:800:1ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Tue, 20 Feb 2024 16:20:57 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7292.036; Tue, 20 Feb 2024 16:20:57 +0000 From: Frank Li To: lpieralisi@kernel.org Cc: Frank.li@nxp.com, bhelgaas@google.com, cassel@kernel.org, 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, krzysztof.kozlowski@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, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v11 14/14] PCI: imx6: Add iMX95 Endpoint (EP) support Date: Tue, 20 Feb 2024 11:19:24 -0500 Message-Id: <20240220161924.3871774-15-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220161924.3871774-1-Frank.Li@nxp.com> References: <20240220161924.3871774-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) 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_|VE1PR04MB7295:EE_ X-MS-Office365-Filtering-Correlation-Id: d83fcdb1-2934-4032-39c3-08dc322feb6c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BqJy8xfoqkXvZ+5E/AaQF/KClkWC0nl/t0V+6HOnsE8dNf0J+pR5/X0eI/MJJvM8od4M6EkE7yznugcaE3PKVBh4cKBcZVS1xYlUsRx3Lzu3nYVbx+MfEwRqMBPqnAfLVX0btaQCgmG8GARCSb2PN5cRlvtIzAgJXTOxO9ebbcO36ImIjSV6SAM4M+9RMzpTFjlykHvJ0oRAdI9ivBX/ZFFRHB4Wbq0UemHECwqckOdKEq5ibteEEvYGD35c2JppKLodE/NVGk7Vhgk9nhs1dh0BypxLwJ1oIpxIcjyYRNZZVcqiiEto/sEVEgsSxUqs4qVpPhnAPJ4ykeRLHXx9qsBozjYvmDFUZ/oEOgHKnjSrMdavVsn0fOOKabiGKu9rVLr0CdSjqHEJ9maoyNit0xukNSmOTCOGE9XIzCXzENwwgeZtRrdYkRnyx1YGGqG0IgHS2+bRMRvoq4FI8XSSMMI+7BjHdxGoF5VjNfUNlNfkBkD4IvRpKs06GFnT950AadNKjeSuY6A5KE3KjNFf/OBRMSTZxG/wPWzQ9f3rwXnzfXIJ5PhG4FZ737ocWyX6Zmiq1shd2WxuzHGsItGkbj5dWqhAUQ+/A6xx0/hydzUlzGSP9Ao52bUmDafeJ5P8 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:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 00Z2fA1316RyS33bAiCTRYhKKUitY5hkckWvW8s3UFCWwrcsCXM4sTrxjljuS0asVOtAsVbCuNbc7winPJPwD1IbijHVZVkaDZMdbAci9s0D3x5fAVgkOMVrNblF1NH87dX38VfLXK80aKrl4L26eRIe6u5vxs/ld69/PbRAr4SsxaEbis1JDM45GHSJ81gsd6zBamGa4ZauHz16aVaqA/Htzqaaipj3IdZON51eZWsi/S9LhPdV+hkrex2E1vj3MA+hbh2tgnlgHIcxQImAfY6TB8LRD45lvGud9Qz3cdcCPaqCo23zqkKkEZ9xZuhkHuWILFWeQcFO1gcRccLdUsDkY5kGgn2WbffSAiHuTOYsLQriKEMKebZDOeME0gekel93L1hR6ZfY32szdhh35Kcd8zzDkXuatRazgU+4et2h3Cza4093lwj+FYMZnIAdVr9HfDfGw1Od0MtX0FopK5KKYy0ESFpffQvGA42HRE/2obf338/EMKRNf2W8FucYQjXbofvp93jgwj7GFGGGMMF3+LruHpaQ8WNfUomB9QJs3YVyDF4DdTGAbvq2BNWwJVAGLJchvE/WGbvjpp4CNUS5dxLIA1ngphwKpIioOvHCXriiZJncvarsb2hF9JW8+TyMTGorWa+L37fwdlHIaQaRNMebkyofIaTZ/ta/a1VeZTPw3wSob/3AyBo6J35/BwUy8MOO6o062+RC3kzXElh/3tl6sl/iPu2JbNP8WkxrVXl/MraEWuodYizywi3A4IeNwvfqHcPj0mPS+7RqX77aDZEq1UOWc2vdUy6s7w4aIbP0/Z0DqesWVcNr21ovBCInfWnPpU86AEXhCS/pCKgqc/fbqfnNwT1rtd2pL1Q9JO8kBiHqAY1VH/7M71hSUuo+2vD0CUooSXPQWOalDObxLIHNDtzCW4mm4jQnNzKAY2dHu0TTqDobTAhA57X6baDv9JOGeRZaJZ1+X2UfT74IObi1SPwMj7rxFaqyRJgb5Il/fTSi/9dJFbeUetjS7ZVbDfUh+Sc+5riuFWNWMqCoGSUPoZjZsSXU2aVj++iqBUZIvLBm2a1bCZ1mqfMJWl96KfNWGsqIKzbcMydD5h9SfPinlZjh2dSvSAY2WDVKNG28+4VOJZRolgVw3s9AmWYPJAOIhxOYY1XrAPeSiAtCRQSCmG0A7BL7XgDmx2PjOmJwHxuFlcb8u3nac8wMq2EbKvCB+KZDoQsUA+lAVgbAvOiXP18nE6uGZaG7w9IMujv1oKJRF5K4TLErrasbP9250qPx8dARYT4AEr2Tv7tlIgUdbmzOAfbR+5LyKtt3gjJeXp+PeVPDPYqRopvVHdauWe7FSPaqCwNzmEiC/AEQRF72pR6Jppvq392zSDOn9JL0A2wQt+BoSaWJG/zYvpPM8hQHJKkwKXRIc8tELXPoKh/n/P8bW6MHmZAPP6A7Gqfi1MmtIXYXBmpNQZbrSzlbGhn6coP3/TuLK7Rj3TacDq6mVjESykIIG7/X1cMMrd3XbCytEO5Sz2gMmcjShzcx/SOkJKhk1NTxulbjHPbMQFsyrG+/S78832mxBaLiJVQrLgHkI0Tzw4hasgIk X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d83fcdb1-2934-4032-39c3-08dc322feb6c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 16:20:57.5505 (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: xWnJ1et+KoqQ7osfECCyomEs/q0p37HZjde3FJZzeDazsMm+O909hykSWdteuVTPiaQ7HS+KK1TV0lBkGPqAdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7295 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. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v10 to v11 - rebase to linux-pci/endpoint. - move dma_set_mask_and_coherent() to imx6_add_pcie_ep() according to Robin Murphy's suggestion. Change from v9 to v10 - using if (device_property_match_string(dev, "reg-names", "dbi2")) instead of if (imx6_pcie->drvdata->variant == IMX95_EP) - so other platform can stat use "dbi2" in dts. @Mani: I change to check device_property_match_string(), so I can update other platform dts file, It should be better than imx6_pcie->drvdata->variant == IMX95_EP Change from v8 to v9 - update fixme comments - update BAR1 comments - Add mani's review tag 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 | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index b714edac6d566..9c2ad803e1dbd 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: @@ -1051,6 +1054,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 + * BAR1 should be disabled if 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[BAR_1] = { .type = BAR_FIXED, .fixed_size = SZ_64K, }, + .align = SZ_4K, +}; + static const struct pci_epc_features* imx6_pcie_ep_get_features(struct dw_pcie_ep *ep) { @@ -1093,6 +1113,18 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, pci->dbi_base2 = pci->dbi_base + pcie_dbi2_offset; + /* + * FIXME: Ideally, dbi2 base address should come from DT. But since only IMX95 is defining + * "dbi2" in DT, "dbi_base2" is set to NULL here for that platform alone so that the DWC + * core code can fetch that from DT. But once all platform DTs were fixed, this and the + * above "dbi_base2" setting should be removed. + */ + 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)) + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); + ret = dw_pcie_ep_init(ep); if (ret) { dev_err(dev, "failed to initialize endpoint\n"); @@ -1562,6 +1594,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 = imx8mq_clks, + .clks_cnt = ARRAY_SIZE(imx8mq_clks), + .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[] = { @@ -1576,6 +1622,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], }, {}, };