From patchwork Sun Dec 24 18:32:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758289 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2085.outbound.protection.outlook.com [40.107.22.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 75424D27D; Sun, 24 Dec 2023 18:33:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="K5OhLWYe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=egAEcy7WSst4vCAKj5UXpksY96PSLN2JyRQ3eDTWA+kk53LhgM3yBlwexjJg25YRT+PPlLMo7KQfD0wIHquzGLOU/uXnmIzGfZeABEmtV5nHTwu9uYd0HYEiRF3HLSbvOU2nIQYZGfxHuvH6ZZ3hJwUxy0/oVec3yNR1uVWiStvkPxc3AeuxANThxiEl9XJIEaSR3TP6qsocpwvxCx28kITNcelsRYh3UoPnLzBYj3V8Z037zzGCysW8T5AN0PqYs0XKPMK26fLGYc0+Jv4qoHX0fCI5IrIKTESabSR4wyAJDYNp6C90LURB9qjdtDNG+k5XdS3LJA+X4MSmA3T8ow== 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=1LAXOsM+n+ieruYA80YmPJNWaLohdzjp04MJ2htd6vM=; b=bF+GmWzLQvuZcqpZCwGaEDyPvzkAZWUXivzrVM34pOnJmQi/oQtQ7vnr1zQsJ3+9TaY2yPlWagajj9G5qKqjQMK3Pq4WRFbGwtBVf57UUdUTzj2iNrVTiaguCnEzn8fX8r0Il3JGT5Tuspxp8IWjSST7vzmtbeEX/dxx5NeOoOj7G05VcTWWkEsrPUceetTRZCmxc1KzD+D1e+fojjoAKFy3Jfzdu67p9G9LpYkZ0ie9YPB9+F5pXVTmPNnUyecvpoI2SE77A9U/EWPiLkkJ0wk29StYPLjn4vzEaidvEZ/HeOXGn9IgLdIPwFUCsDTtGNF2/mCAeNDEwT9+wwFFfA== 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=1LAXOsM+n+ieruYA80YmPJNWaLohdzjp04MJ2htd6vM=; b=K5OhLWYelcwgJF09hzTJ3QC2NoKztirxApHZ/7g94oR4CnpsifmxrrKOxA0Ht632zcH3Q9nNeE3jk6TGSZp7M1Y+wPEJJbgwJ5qSeA+1R12gUQi9fn/er22r8oT40MnrVdfPvgFpJv+x6F7DtN/fZwv8Vs7lKIYuC5YdfOQx0us= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:33:06 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:33:06 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 01/16] PCI: imx6: Simplify clock handling by using bulk_clk_*() function Date: Sun, 24 Dec 2023 13:32:27 -0500 Message-Id: <20231224183242.1675372-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 62772701-a91d-4703-f834-08dc04aec51e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QK1CXcuan5bFmDBGfcuB2dq0Bil6ZwDaKL2U26TvBgeG32cwmgqquEEbYZuFLmUqhimxq7/CVkn56La8/QJtqDG4+Lt28TXqWqsOQ0kv5kcwzlfbmeaY8mZ+6j5u10iYcYyWYoOfO1CHJIjatb+gKn5xFV47LSrH2vBsDYjHXmgCtnJx84/lnkK53NdvE+/RiLo6z+dTZegKVarqYxyL9og8CWFl6sQAI2G9WosgliSm/qbnmpgHXtKL6IuLxKyblBaVs3cjDRB59EPXxygnK1YbVleDrWUuAakN3mN4lJrrycgPdvRuXvvCR07gjHQw62SYTp7AK8MVP9S1LeSgApxJEsKb1W+sLvSKAdj3hURN+WC1t+otJDoPcWicqLqbU3nonkJ+OkEd26YNrZx+8CWdSyJGMofkFe8JeZyZHbtIbOBCp6YQdp8Zzqe8MVohxdpPEeczBSz58H4sWDo/0AikjV68vOrECppMQ+uJzY6o2StN0qOoFS1Lx2PDnIeerIEgFUnFM/EmPDxAOIOOK+zIHwqq0S+7yIcIhrvtQzzZU47/I/p/zkhTa1jrtFj44MYg2A/jsFpCEoIhHtvD+A7ncGfHJKaPRGu/Z7Yd/q/S54DaXr/wJwGCAk49iW57 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ax9xzQB+Qs3dw6pgTcbltkdhFQ97+pvdaAX/T7NPsByRRzyPXI59x9KT0Qjr947gkjmbQBKVYiIKMUoirMFwDojb3XM0CcsqvbrCk4WFE16g9qhwacA4CpPMSr3VwfXImhY9Wku8muX6aB1Y+YI859xsJesvqbkonx+XHov2VbI3LpKbKZY4aXVJBjD0LO0dxSt/t4kyjGCSyTownY3gkhoA3Fx6kn6GEIiBhkr+6nehtAcr3HH0zCfdSCa9rqSjfAJ9YqHX9UJQswYoUsxgHjfWknxnHz2tQF2qOWwtv3neVg5U9oTMwxA9va0ipqzghQW67nVJdt+/ZS2lbS9VOUJoaMps95rGi2OJCnR2sLNoqyjTU65LQ2gcTkzg6fHI45LB40162EOGKmN4UC2PshVad8eQtEvdfLwl6WfHa2TegeIpK5E7n1jMqxOcHu7gsivy5wyS2N7wtpuRFb9obg9OJ3lEiLGR7mI009C+kJQktNWhSbug1Cq7gbZt/zJwdhI6hkJIx123eM1W9YaGUkkVG/pMDIs8pNhpYN6Zwju+KjDX0BYcsl9Iviy2ilpva6odU43mCLLY7TLZ0avEHoPSL8SBrtghdD86zwoAZ+nMEP6n0z7gzfmRShIGjqhux14pTEPKDVY7Xu54yFJiXQx/5EQGna/GfEo6YB2c/EYIq7pHZdKa+oSCHTxaJ29NfG7BiBCuLkeSyTKZ0OyqwIZZlk4lzZ31oNN30QrcQdVghbLf6sShzXgs9FxSrk9txGXk2XQZgifejOjGKuDw3Ij8lM5MHhgakYKj+w5VfMgZjEKs9M0RI1ddpe+No4hvyrphwd14lKB/qHDTAknktNunH7V33SeD3DBvp45VCv2yjUjzoBjx39Ntli5ByQ/u5R7XZKYTjtxuZyla6/p2GQTTgAdLLbwDTT+wZZiGGNmZWKsUVyrZekgXsmJmcYzvvMJGbSejUK+PS7eSuTGqvpeBC6d678NijB2XIClrQgTGfC9ymSbq5cJyVLhZiWLYFsaywSiiNOLt9ARBdBKvJ3ABXOjAAop4b9QMREznB55z2q7ayvnNSri138MNzu5du6LNXX1hIJCv/FOt3+eSHGPu0alHS3qU9s+c+ZXs+E+opVnu5cr0Lp+zHlpUel7zQ2QWVJH4s9Ff6Wj+7+ySlP0T1NOUcrkSipIYs4I/4EF8iHqp9CNXfjDEp1tLZpV7YoIdcNAeksbbIOt4hU31PJrXvksJxQR9dIrjpOB08OiaCqJn08QmKftv+7TRQy3lHf93t350Ey1IS4Hia1nmYy4tCgyTXUHvL0VxxUYmHAsLJPiUKHa5PnnA7hU761VTlOlqbS+OrgU80nWTiY+yfpjQzfdXWZL/21LnpneRsfrONGeHJm0BPpzTZ/7G7+XBJo0pN8kPEpGJPda7feofZyw5Z4ZrwrobEWyZSX4vo+M4KnWA1u1mghQsyrYzk5H+ulHDlUBsTSLFmxssvkL0NaZlAegvpY2nWEfRAzMrT3hCmAGFKun5/gAv6DhHxiOyQIvCHdGl5EXSi+hLywEShojnwzQX1hV13mauJuBGpE+uYvnpsGY4nf2fyRKi8Q6K X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62772701-a91d-4703-f834-08dc04aec51e X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:33:06.1059 (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: tGQ/+DHcJlrZYRmxw5E62aFJD46sftKmrSPTHeWLtX5H3PB6kyV5PZ4+P14/uayNrOp4Fxle9LXU205tKVO5qg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 Refactors the clock handling logic. Adds clk_names[] define in drvdata. Using clk_bulk*() api simplifies the code. Signed-off-by: Frank Li --- Notes: 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 | 125 ++++++++------------------ 1 file changed, 35 insertions(+), 90 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 74703362aeec7..50d9faaa17f71 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -61,12 +61,15 @@ 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 *clk_names[IMX6_PCIE_MAX_CLKS]; }; struct imx6_pcie { @@ -74,11 +77,8 @@ 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]; + u32 clks_cnt; 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->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->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->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->clks_cnt, imx6_pcie->clks); } static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) @@ -1305,32 +1265,19 @@ 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"); + while (imx6_pcie->drvdata->clk_names[imx6_pcie->clks_cnt]) { + int i = imx6_pcie->clks_cnt; + + imx6_pcie->clks[i].id = imx6_pcie->drvdata->clk_names[i]; + imx6_pcie->clks_cnt++; + } - 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"); + /* Fetch clocks */ + ret = devm_clk_bulk_get(dev, imx6_pcie->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; @@ -1353,10 +1300,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)) @@ -1372,14 +1315,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"); @@ -1477,6 +1412,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = {"pcie_bus", "pcie", "pcie_phy"}, }, [IMX6SX] = { .variant = IMX6SX, @@ -1484,6 +1420,7 @@ 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 = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"}, }, [IMX6QP] = { .variant = IMX6QP, @@ -1492,40 +1429,48 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = {"pcie_bus", "pcie", "pcie_phy"}, }, [IMX7D] = { .variant = IMX7D, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx7d-iomuxc-gpr", + .clk_names = {"pcie_bus", "pcie", "pcie_phy"}, }, [IMX8MQ] = { .variant = IMX8MQ, .gpr = "fsl,imx8mq-iomuxc-gpr", + .clk_names = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}, }, [IMX8MM] = { .variant = IMX8MM, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx8mm-iomuxc-gpr", + .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, }, [IMX8MP] = { .variant = IMX8MP, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx8mp-iomuxc-gpr", + .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mq-iomuxc-gpr", + .clk_names = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}, }, [IMX8MM_EP] = { .variant = IMX8MM_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", + .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", + .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, }, }; From patchwork Sun Dec 24 18:32:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758135 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2052.outbound.protection.outlook.com [40.107.22.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 04FF5E554; Sun, 24 Dec 2023 18:33:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="J+y+xypk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LCfShrJ3QxefQ8NTNSYgfK+sNbj+QRRoyZLJdfYrt4v+GN3v9vSzUf5+8OPZql7FeDmcE6SfiJzT3hmFJoFZNQ3S0/JYkcvqLqSVq/hwYiAjyaxHNqRq1Njjr3riUIYkyFUh5AG8QAh3ee8OuIqQRq1/ljqXXA5VKaVNyEQtpmZUbjx43tBzSQMyalfVA2PKImY91w7/HT1bV5hw5oawsFRR+YbSxEiFAncLu+TEtE72w1WYhuoi0UjUGaf7c5pstL07oLDim+nSBLtaIS00ohyR9UY8xb++t5MgjHrkGRhYSUfH7coZTfzg+5YbzzyAnt8cPHDBRSaeRmnC7oycbQ== 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=Mwdd+DiAZ3s7dB+tmBXPZ8hiA83HBFxwkXxyNbl3QHM=; b=cNnM7hmuSWEaJkAR6MvlltPIzfXV6ouSrwq72HWznkAlqJ3EMokAP4M9TpIf9xAqz9OGUSglevFsXbJ8OEFrUsTehMr+C8zSYZyEWhslDY9qOai1yo9uqaWYInp4Nnl3E4GSmdybEG6VqbvnfO3fyBWyVaxczNJGmbisGni8PpMdyNvvlNJZK61uTns3GvPaSiZ7E1ffELQoxZJDPOVzBaF0fA9jP7+C7xyTQQSKsafc9lqKWP88wOZ6NypreJYR71+mG2iEtFdoEphaA0k/tlouue1p0d6pZmz+undsoYM3xapm8T2jfq09pT9HoNRSLpmYaQh7LbBLjFrDPfpxgw== 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=Mwdd+DiAZ3s7dB+tmBXPZ8hiA83HBFxwkXxyNbl3QHM=; b=J+y+xypkB7EBiNNh4gZBqS5Xbf3/rG5K3W1m93/6gXQSCwV27oYpT36Lg4EmeMAzkhtAhIH07BZBIhhHPB3wzkRos20I6qY4oGBdhB7uKxlh8405MIU5H84qtEa42+KJiEQbilwHuoK9H1Y3d/N4KHSFP11LDKSCrO2+D4Fs6Gc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:33:11 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:33:11 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 02/16] PCI: imx6: Simplify phy handling by using by using IMX6_PCIE_FLAG_HAS_PHY Date: Sun, 24 Dec 2023 13:32:28 -0500 Message-Id: <20231224183242.1675372-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: f19479b4-e8f4-4ca1-95b7-08dc04aec868 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E/JJR0ZlKqqOqRtxrLFepZcaSHC5dCPYlyU8P89+PY4PxSwFoV9ghzhLe2xemPIyahe7GUYAT19JzKNuDeGnzn2FcEjpaOhtd0tpjZjwKbgAoh5Ye92IeGgjkjZwrNqmTW3b2+XsG/BE49Z3YALT8LrzTmcS06hsQaNugy3IsZhz3/DFeSm9gabKJYqhQsJvaqqk8eDDCCYeiLjNG+BxHmiSJK6h5tXwIBMq5IQbzL1GsGhlrvQtz4cY+tIPf65xI2DWTxOA7tngq/y9S856z+pZ8KQcvcDRZEvJgHyKyhIY+HQV5hXX8MJV0uI9HGaeQLFIz0m/LeTCJw2CnOTJWEBSAXK2h1UeGFJVE3hb4y4rsQyOWhy2swbU3GJ40Qn6fdtE1HEU6ewZns1oeboef4i/v23RwXsOEgZmG4J2bI1f9gzWYtFW/RidITzlKK1UJmUpN4qK8wwLFjPGcHW37/oz4hGiJckC+uCKpILC3V+pT+q+3/TnA7XNRy94R0B96EPgUNguukgGP3zZASaqh2kbPG3e/RFLdA5HksE47oaVyUJU67grkYG32vjRdjtghA/h00l/A0eRZuXGUzb0ybAJGGqn+ddxuYT8N+FHogaaN5q8zT1HLCht1PDwlMx9 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BdiT5AxciPfciKbBJl3FaoytZh6KFjy9DwjH+yiRyV/Nz/qaMhk939I3MXJhNzokyVtpROCWve1FZ8spFu+gDPgNbMSXH+tySY9yyOFcndTAJFxSWYSuNeT+exZraiViLttg0dTTOBBSKimuakrqedDiCDM7ONNEGimBrXxWKW4yLo4jWRlI3L85Ss5pDHs7MoBdGrgc765necERVTyzvk8cjcj1xl8iQAtJHOzPAWjCY9wQEM5mTKjhA3ggDSX7X3l8piRe/Kv/qfjFThuYPynsTBCSRRJRxnvtZZNPKa3P8Sv1AGdGk04QPdmj+V03DOK33v1FIVJ0HGiI+6OpRFXVDJUyU9zeJQQzuTuf1eC98PQky0XkZ4YWD6D+mej7NSQkx4/Rh9tEZu4zw2rOjfxXNP5OFZ3PgSoVhENAsYJ7MtQLJc3J+HL6cdf5YId+0Ksx7IPp8KhtgXMnUAyWDlgAFryHuJXeLP11+Sa3Gd2MC+WL8TUKO2upvBPDqgbzkR30Yn17DxB1kymQcV/tbqPOhw2J00j5gxzRp/q5rrUhBCE42tEH++yLBo5MJ7hCXMGO3tOEoR5l6z2Xd5aXvBFK/JzGJQNm1jBdxyT7R7ZRubRVGNsLO5xwBxiAaIwGqxIabO9saKfGeWCWI1WlFNlSvBcZgqiZQyfP/mtQFPllMXuksdiiTTQ/+NVk5XkqtItVr+GUZ1JV+NSADyThv3LNyZw7eprmfg9aYqpT68gzAETAJDE3m27xOr3omMCQU6ExJA5Ly0ouKYf/gw0boLonxSfuA4sY0oQSES6XFXJAXMHs1Na9QyEGgRIauPndgbmiMx799ztpNdjhQScl+zoPkTlSyFdGypuawgTGmtAFg+/zG+1xnmS8kowzT9b8XAK9HPJ6ETD7jyFKZOk+py2a6bhwLA+qVbGNrdw75IattBCzcacJvZmm/yCHdxh7HjcYoQGuhDaXBF3BJ7xsC+VlIHyREZ7JpLG+Ab6ST9kyy8W6vvuPhkzD2NbQLHwKC08+4LidLfcQHkiXxWdbh6wxDRu6CzxSNiRwFLonTtDOmzyNX6uEzxF8yP4QAXkBLBFF09riMRf7IzBpKxn6SVuTrxqWSkkLfFRTxXA8q8l2dB+TuhGoyWYemWoS6YpLQ3ilaLoxPKG9xZALKymY7K0/m4/imtKICzBgaPJblgDqMezJpPdou40hV4lxY0/i0UEUEv5mXO9aYsBA/JPYA6Osln8qkoAILbFwkdkyf+IGzIH+e92i2EMB8r8+b/WDqEqByBJ5ZDJbr4cSENVblhe6DdS4CPyRcv/LSr+QaYxE+Xiquga7IgyHxQPVPVZb9KFwE0Yc0nUxT80kmQUGcIowTRfukRO3GpepvludHDgDxNu9Pvft6XCCeM+yHgPk5V0ekau9UGIAUi0UaaoDaUeOLXgeeX25eyX1b8LyKXiKzGzhT/1NgFmRtRp0fNnV6C1JSzlx8j/lc1kWyO2esGoGHB095EP9HN4IoCPoRLClmr8TPgVMbC+IJxEpR+m4TugxfgUgq4nXco2Z+TicLgTdzDAC8ju3nPV0n6FADbg= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f19479b4-e8f4-4ca1-95b7-08dc04aec868 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:33:11.5356 (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: iY4yq561IsgttOs1jhJl6hn7Erewncnn4KGoQog8T0YfzAzqYKvGTKqma5jyrg8MOioc+l2CaJFlufZ/k7llNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 Refactors the phy handling logic in the imx6 PCI driver by adding IMX6_PCIE_FLAG_HAS_PHY bitmask define for drvdata::flags. The drvdata::flags and a bitmask ensures a cleaner and more scalable switch-case structure for handling phy. Signed-off-by: Frank Li --- Notes: 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 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 50d9faaa17f71..4d620249f3d52 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_PHY BIT(3) + +#define imx6_check_flag(pci, val) (pci->drvdata->flags & val) #define IMX6_PCIE_MAX_CLKS 6 @@ -1277,6 +1280,13 @@ static int imx6_pcie_probe(struct platform_device *pdev) if (ret) return ret; + if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_PHY)) { + imx6_pcie->phy = devm_phy_get(dev, "pcie-phy"); + if (IS_ERR(imx6_pcie->phy)) + return dev_err_probe(dev, PTR_ERR(imx6_pcie->phy), + "failed to get pcie phy\n"); + } + switch (imx6_pcie->drvdata->variant) { case IMX7D: if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) @@ -1306,11 +1316,6 @@ static int imx6_pcie_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(imx6_pcie->apps_reset), "failed to get pcie apps reset control\n"); - imx6_pcie->phy = devm_phy_get(dev, "pcie-phy"); - if (IS_ERR(imx6_pcie->phy)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->phy), - "failed to get pcie phy\n"); - break; default: break; @@ -1444,13 +1449,15 @@ 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_PHY, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, }, [IMX8MP] = { .variant = IMX8MP, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX6_PCIE_FLAG_HAS_PHY, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, }, @@ -1462,12 +1469,14 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM_EP] = { .variant = IMX8MM_EP, + .flags = IMX6_PCIE_FLAG_HAS_PHY, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, + .flags = IMX6_PCIE_FLAG_HAS_PHY, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, From patchwork Sun Dec 24 18:32:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758288 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2063.outbound.protection.outlook.com [40.107.22.63]) (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 6896DFBEB; Sun, 24 Dec 2023 18:33:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Cf687BAh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YDRsJoWIaQ9+hyuQHyJz9U7p/YCXruxKSIu7l1dg2kGZVcWqQ1ZRLVcebWzNoOpdOdRAL27WeTsrnYoWnvf2iynnSXuHkS8WgOCSARCsoflfxYYJNqoA6JzTCWVdMSRk6DrdomtIXiRWqNjFHkKHtyfCJ48LLBWALRLbMwkSCVRTzHjqaO5Sv2/fcaALQcFReXp6Ke6uY/6/onKW33FhFJkiigrqYTUraUcLEDS4BvCx2sn0UnCQ7De7fhfC1Ti1IoSidEpmpvNNxongsMnXBUcDua/OJXdvpbzKDpHnJ3XwlWivw8woMLQPkHY171hFxYABHwnaJRhvj0kAtye90A== 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=qx01HvuG0xZ04g5Qs1emA81XcCk2ClpOFDJT/IqUaUE=; b=WlvJ5kf3TTZmNI7IJu7bqm5BIPzBLE49I2npWUMOmtpaaxMPryUbgLeBpMW740HrRRbbWf1h3fa4RdwT9kseCNyZVm3Dm41ZqivoEp63CmpJPwf335IiH8k/2oDOf+22ag6ImB56f36bgu0H7XM5R7VM14CdT1E+mssQs030VjVYfYGsheSfYp75tP8+Gy5TJ0U9e0jlWMIUGICWROWUEW3bTFhtyWK8ObsK9qLoRfbIX3oF81AEQ36hq1zMjTlZ1tXpDo9JZj7dT3Qsj8LWkmyXNDNLY9sqqEdd54hi/ekjYHwE6ZWsfMfqNpbaJt9xzKpGemZycfKqRF/BRBmDcw== 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=qx01HvuG0xZ04g5Qs1emA81XcCk2ClpOFDJT/IqUaUE=; b=Cf687BAhoSIexO2hZaSJVHmtaS6/acaq3q3VCf4rfz2AhZNIPlLJUeNxxN1wAA0g3Od/eJSND4i21WlSJ/Mm+dSyoaYOEDU8xeSyYtRYSgqpwMzKkgnnCqJYYeVmD/GYTSf84LLgU8c8lGv5814GDfgvNQxEusav8X5D+vHGG4A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:33:17 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:33:17 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 03/16] PCI: imx6: Simplify reset handling by using by using *_FLAG_HAS_*_RESET Date: Sun, 24 Dec 2023 13:32:29 -0500 Message-Id: <20231224183242.1675372-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c3fa283-5594-45e0-475f-08dc04aecba6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KI3RmmbickV5X9Lgg0qQlircqnfVDvoxG2XuiKEQ8VwyFlkQhF7OLS/LSOouMTZnIxaW0ilnm4QTzi7520NkhuCD7qqtqAsAp5gggttod4qe1a7l9ZNh+csDbUIul4+3I2q0W20WZQbhyESrWbGJQLRZl9Qj0egl9plgjHrpFcBiqH5JKCUKaXteKE2lZb8vIxTLp5KRzCeSJX4PfTa2SbQkkad+WK5I71ogzHxobmdGr9PhcL1T6xeBdqzTKmrAT9MHWODnp55HEOYh4kw4YY3SVfz5sZSNRc6voXwBaKdry6tS/EUxK/rAc4CAvRuDl0WcauOIMk92bILhJWmY/S9uMDJ58n6gvspZk0wJZMmsg1yYRi+7bUxyz/HKRRwdbYry4wWpyQMoOFO0S/X8ND7BONBY+AqKi7GLjRxN18u9c6jP6F1DYNZADEZRmN4mSw6rRXw7g4hR7iJ7HHftgxT6es5aUUkXcowZ7iKYKVj70oE6gqHJXFENKu5fax/wqlr3EU7SKPjNF2quVMRY5tF0oJmnungDYYuI44Cnerg02ix9spntZ3ZZScJWnnabsgefzU7MqYmbB1YYOCK74BPaAbJg/6gpFx7MROPmUXaDiV8FulCLsDaauCvOvavN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +62e2MobEIdJ2BJp8DppPTmzdsnjhx4PGi+Ic5ouTr8ozRilx21tBPZtPR4QoeYojLrrnyG0c1amkQ2egkuA8TdhfahdNHT+XvK6g/Km2NdEIm6nrHUUsxt5qA2oCzT3Ts8rnoW5jFmM6gQmiMYoE96+tbGmvmdhDU0BKnsK0M415ZAF8qHCX13Xv55HPcrGz6jwCVNDG2q6IeGu69hGy/XaO8AWGGSbqahWRUYLHGHMvZF+cv7bDxKrIH3iJ2bsPILAKbeiOCF1r7edYg7wdCbyS9zf1ZeQO7vZp4sGgTcXKnVAdsh3ANd5DJZL2QAnyaPr7mvkWnqY2mTtM4/uJdDruuKjKcGMgJ/bzpCfGFtgyuU2EKBYbWcg2c1FZ1FYrdI5CrNqd8nZLZf0VrEPItxDPUFNZYx8zbkVfbWbb5oESf7qRlu9mF3dCnjLdL0EAKAZOqyCf5NzqrUHsDfAwIIzA0ca1m2XuAEnH5lui4xZdAnlSJaj+uvByKO6/OGeeUfdopsGbjLVMmuA+7zvheQV2R67HUSELF6k8goyRkJb0+btOiJYvJ7n/LLaFbxaPBfMYNxSSqc4XaULzpSf/EKOz3WTqszZjJc/CDDlGiNxdKnvbtpE6jlifIIhnrFmZjSM2LUkfQ3e25dgiKvyd9csn2PAjP2tDAkRt+0AOcc0SuFCz05QjozF6OeXZfk/9/3DWbFRkeXHjfM7eLKb25N5mlEUDOOL9VOUEmexRkn+8MaRXQwK0brqLq8KmL5n0ov1QTmaj8uREN+ftBOmtodkJmldBrJu8Fm1c1DkG0euRzqwJwYLdlFa7Bz/RCsDNE2EdbCNIHyn7T+5cFaABDIgk4Aq7U7/vYPQpw65njFby5may2XwCMDUtkCQmeOid+OYJh9cMoiZf+/sQXLL2MdEEi5sX6b+NiecF6E2mCEyuWD48KGBhH/7/bL0nnNBLILeU7h0ELC97J5K6tjF90TnZFY6M5i+saup7hCShiepSwJ/G5wBTMRtEqQ549nBhz74zzOmOO23Gnjr8HcC1Y0ks6DWt0Ht1b0/dkBDAo+et2ggbzwsIPyb0dc5KXX7Yo8BS5ckwq9MVB2pMUbVAnXICYHVY78oVaNLRZiQdidS3Ncygf+A6m1sCBarQbbZprynKyd0A1oYS1zh+6EOxlB2SjwkjZ6fABSUOQjAMsYD2g1+ifFZf4d/ZQ5dsz5F7pfv9ombccmyPJNyT49ykM4mcH9rSmrzcbCCVxlEibI5btN8AvrDt4jatKQLiEOHqZzYRjyNqf9DAuo8TuQowtM3v4O1ecbIfVtwXuwmtsZM7X1659/ZqOkwkIxcL1TDT2+q8fIuikDDVUmXKvQdoImlNMT5k6zlgBCzAaUUvWWLnoMNB9CkV66kYNrC2IA/Kzd8xeWN0quurvv9iXT7uIQfBC6BnONGxUVJTumJP+uG2R+8VUmx3BYLgmqJlgZ5RvSsVgvGBB3gfbnBoouuG1YlCQ429GqC0i2lkHxmtE1uvot4rTYXFTIYTHvpIdlMZ6OToSHqcheGx+navOWwnA5uDaasjmI/1HQiyjAK3EM= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c3fa283-5594-45e0-475f-08dc04aecba6 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:33:17.0140 (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: ozbaC3sEt90Tuv9vKgDZlfDzzzqTWDj63L2SJC8W4hgQHzDGEVothUwGdN963i9id1XngaVsrhkbsP7hUED5FA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 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 | 108 ++++++++++---------------- 1 file changed, 41 insertions(+), 67 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 4d620249f3d52..294f61a9c6fd9 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_PHY 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) @@ -1287,36 +1265,24 @@ static int imx6_pcie_probe(struct platform_device *pdev) "failed to get pcie phy\n"); } - switch (imx6_pcie->drvdata->variant) { - 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 (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"); + } - break; + 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 IMX7D: + if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) + imx6_pcie->controller_id = 1; default: break; } @@ -1438,31 +1404,39 @@ 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 = {"pcie_bus", "pcie", "pcie_phy"}, }, [IMX8MQ] = { .variant = IMX8MQ, + .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}, }, [IMX8MM] = { .variant = IMX8MM, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_PHY, + IMX6_PCIE_FLAG_HAS_PHY | + IMX6_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, }, [IMX8MP] = { .variant = IMX8MP, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_PHY, + IMX6_PCIE_FLAG_HAS_PHY | + IMX6_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, }, [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 = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}, From patchwork Sun Dec 24 18:32:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758134 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2040.outbound.protection.outlook.com [40.107.22.40]) (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 164AD101FA; Sun, 24 Dec 2023 18:33:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="QK/8RzeY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XlU2cDfUeXhKKJfuBxvH9DLyC7hK3c7b59LOMA0DPk+5HUR1SxkdvNOpNRA9A8v7R6vXoEwlQ5+JRFJrLkAj5fJxeMHo1Ddvx1X3GIavCdRU9X5G3Pzc5V2jZ6UI9nXSt/SPW4U2VpVh3PwCokALFHxfkdG0o/cB6sI5MBW3Uwq/XNghZGavr1nzaCpK92/RomgMg7t33SToJmRTHRurLocRjYRFBhuCJ+kVWzjFYPXYZNnuw7yskpGLuQTWot0zyWlI41stWnNseP9CCVa8L4ILyJ6O+i+xyVFTcqW+xkAZMksCYWSDonkp7hVY3XTDZljrzXxY99pYDwZn588AEg== 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=8V3HsfUdOclisMP+T8AUHfCndho4vH6otdg0N0F0yqc=; b=UbbRUD7M8nx3yhfmSKK87XVyncnI+01XBwUreZJEYQPNdNlyRhQBfwvMrxvWNaHIsHG5c32mC4Wx5rALoyruawh+cCrFdyhYTK7ffsjMGCZ/BmqxKyld3GLM+Bj+pWU3SjX3w8VHqSJ7AIJtWdddu3IhujXY6WwD/vbAFnwsmNp5FxjX9JA/onbWz9fgB9ak4qZKa/pZbLvBE9TBXktW5l/GYAiWRdgvnHEDFRpkXtNe59CpKkUePQDXyFekljqX37443fjmp3OzClkQxJgGQutWb7KJX7ONCjNcjGZ21eODeHpPKBTC+nvvjwXFPvbgR9IhPIB9KNoc8rHiOw0CiQ== 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=8V3HsfUdOclisMP+T8AUHfCndho4vH6otdg0N0F0yqc=; b=QK/8RzeYp/ffxI6KAOj0L4SJ1ozZWSRej9bwI2cOnZy0LqmV+zy2uXGAp6FXRhU/oL5FrUTm7kyv/ECs/L54QyHERmsAbTm+x3XvQiL0i8HVWygDvzSPSxIMGpzHUxPP91N3vzbZzy5unz281kEe6a4Ew1Hxw6g2RFUjbbYNxQY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:33:22 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:33:22 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 04/16] dt-bindings: imx6q-pcie: Add linux,pci-domain as required for iMX8MQ Date: Sun, 24 Dec 2023 13:32:30 -0500 Message-Id: <20231224183242.1675372-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 87b9a446-1e3a-4048-4761-08dc04aecef2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 66H73DdTfJjZssjK1JX0bNgEh60L0t71/ZcbcNo5qmZ7nLsw59vzjo9ZLnzdA0qr2BQizDyKTb+sFw5oi3dML9XP5GHphkr9gncx+KTxfhwrOkLNkaXI9bk1Y/CNyWbz9TheeHqACo8yXeitaR/ydm4jrNcyDULySxWwA7WCCksFwfrlZW4Jmuk9ugljJoy8x2DsmM0ezYm/RHhY3YlncJD/F35MqEihdBQVB37Su5VGY2nWuWpj/qvuxzIv3Sc9AqLuQGyyKeERNUCv7tkAguIYmSbMR6EWQvrq5GQKFAIw8Q9FuSGpmmE5LXKxrliAUmP/0+fDpHj4sDYtm9k1o8hwjdye6Ns7pJ2+MM+oUW36vEJSB336LvndAPsOiCPM28QBSm6GPACeSrWsd9PMsiwprCTBwjUjvkb/LixnISB21JVdW/bZQ+QpijCRpLmqhZ7KYlZPFTEur8mav+Gt/XBxKezdcLymwWyD11iKdqJV/UTdv1a5kN4FN9yapHCXzlqNxGpXUDJ/1oLiUD59I/9pId+wfU4CYt3rnu+8Gw10s8V75xPuGifQmaj0zmU338/LovJaDpfXkq/XSAd+lwDyCYgmjpGbTqNGNAcjsol3IjtowMq3UzRm4VJd9N4K2JWvW3b2QVr4etzpIHO/jQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Fs5JJ9bKnCwDg1cSlQJePjma8M7zSkmxUqAj7wObdi2IU1wjfSp1/BxDYU6jDcVGvaZLghcJPwp0uaabVk8EH5609Ly5qay+mDaHSa6mmglsizEMVSegqDh3WV5TLkb6wvcVO7nk5S8av7VpWLfZ2moTEOn9Ei7prwyP9AKYXdgC31p+SFEQ7PsUhfX0e3RFATFjHVq02pYyFRqj8TzOary7FM+APhcnXZ1RQr/ssajg0k6bTEXKe/r6gQkEPU4MBqsWaSIXNkXvnVs58oTYMbOVeJXZFNAfMFmm5tb+Tn6k61tivIFG162FMvtCCWiJR4u+bGmk/MnVFC+CCRekOKM9H4thuoF5KbJjaoyhZJvOcsiFqI+A6/ww8SHSQM3PUX1VBj+aaBfBSPHGgrBxDHIh39crqAUkCv0+jRGo6uMK6uJbNfaSqmxKgD7p+vybYXHVNojTOXVEkhXgu23HAEDt/HY1ye61I5WudIQdsM48J6wPH0DbWJDi1DzceuYAmkUP+SWLuTMJ8wCZxRuT8hecA7amHfy0ZtoiJahPzC7vh3VyTXGysJ/KgW1PsC8+Extd7pi8umLPqwehcL+SN8Gjd0zWIpfosy6OpO/wzJsCwI9Fr/pRFjK5r3Rbnd7csEyiUFB/OiCztitfUQZ90dXsTmJ6X3z1gXDYvx64HVESQWbKX0Aw15cSD36wscNdzgX4722tpvY6jsJVxFEfsnQhxLSZOhX4hV5Sa/4N8jHgR346k3E2mA1mhcesaWQGUhxZlVTf58PfJEal59e+u6qBO744P+7YJ4mQaE6DNhWEtyKNmtgYcnYO9hfjXpQHSuMbhJl/Fr6YC8OHWe9YsAaXlXgDgAIoAyrhWwUpBJNLP9t50QirXKgqSaSZY/ClRvZfMzZU1fLW54Lf7n9GfkbkPWHCPlAMKErzl3bUUIAwyB6AWXXuWHkajQdkb7eIbT/KVcbQLiJhrsm7Enfzc4YJ643ER9tTS81pufAdLpaTWfiWmJqDhVKyfwj4YMhMLcfkshIOo5vM+P2sYRtI1YketsEg3HT6GQah3JDZ5HbCHDM/efk6Crx3ChahRO9YfAM9Mpbc9pBZgmErjfvDnseZeDv/T7vztEm3reYOZyxkDEBHXd9Zz2yNcsp+Y1uCzDbmKkRF6rZFQGaygu7s2FRnRFfL1IoJH5MTle4n3SiaLmWxSZHeITZaf9rO/2Y7Kt86aX7lFikDiOw42lxQbpZi0zXEhS97PZDEQ+y0fJJOoSavpyzOfqZ2UkxAf89G7HhJigOaM2eHz4HyvLR8MF5u1vAsR5QnGtA9a7raVvNzJ8eLmYSi4zI/ZmOB7m5pHJ9lTqIOWCQtqo7yY9dfs9A/RY6ZHTjrf4sZW5UbNr/BU4GYyM0qssCWRHEL8qRpUiGBw9Hmb9COYgdu9KfbHh8FrA4ll6KS8B8oyBa+zLVOOR0M8Iy9AxorvZKiriU5lyYZ6TbRFnfMWo/kxHT1wNx/Qp/SplXLwK1hOfDwKT4bPX6Rqn+xK3I3A4qkM/JI3fxzIPYOAN0HTrtLDxHUw9pMJhVgZYlhi4CN19UN/CE= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87b9a446-1e3a-4048-4761-08dc04aecef2 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:33:22.4341 (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: +76GiThX+47bVFaROIGl93LoJYc+CK9z1fV3nuiY20JdDL9OSxYzzSz/vqHxPyMDpTUMk7dN8mG8onouLP8DeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 iMX8MQ have two pci controllers. Adds "linux,pci-domain" as required proptery for iMX8MQ to indicate pci controller index. This adjustment paves the way for eliminating the hardcoded check on the base register for acquiring the controller_id. ... if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) imx6_pcie->controller_id = 1; ... The controller_id is crucial and utilized for certain register bit positions. It must align precisely with the controller index in the SoC. An auto-incremented ID don't fit this case. The DTS or fuse configurations may deactivate specific PCI controllers. Signed-off-by: Frank Li --- Notes: Change from v5 to v6 - rework commit message to explain why need required and why auto increase id not work Change from v4 to v5 - new patch at v5 .../bindings/pci/fsl,imx6q-pcie-common.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml index d91b639ae7ae7..8f39b4e6e8491 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml @@ -265,6 +265,17 @@ allOf: - const: apps - const: turnoff + - if: + properties: + compatible: + contains: + enum: + - fsl,imx8mq-pcie + - fsl,imx8mq-pcie-ep + then: + required: + - linux,pci-domain + additionalProperties: true ... From patchwork Sun Dec 24 18:32:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758287 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2073.outbound.protection.outlook.com [40.107.22.73]) (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 393891094A; Sun, 24 Dec 2023 18:33:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="hqd3pqoE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FpURgq19hQgqAgS7jzvjrGp1+oKvtjrHjZM8r/uAlYm61/cSkQhyYC2tAxT1naIO5I8RWjyrQEBUcZaHMyMsHu/AUAyoXUp/slPtH+n/WqmewFKxiW39yAHMQaQSknmWhx/7gierY3jZuZH93MSm1d/x52OkJ6cSAVTqglxu1KTxHjRik9xaToT0nZg7+tQXhfDSV8xfC1WY4+iKsNzZ16c0CZKpD72eDxef/6RTiEBf/OQKuXY6AzZ4Vm3KlXaN7UyvZtc7+hEursZIQsb8oimkK3d05dz7ysolqCGRkoFzWK5ZtfUU9JfWy8EDG03UXuULUwZFnOr/Pf2t+y+D9w== 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=9RVrid8a+eD+TtnotxTbO7QIeCjkzOMmpoWCT3IQ2Ho=; b=jwNh4nDtyerMzA9aEacxs3I9EfY3VDmIfBfTKUbuQPF3/hvuz4no2CUfR7ntN4zEJQLz/dpttZX/ctp+eTBNHICNqu15sA9dZTZwPgyXXqoeQm6WUblza2bwnU/olUVkAhUQJ+g3j0dm/BWlyWltmKj5tDe2SvWJ6aShuqgLZapFYpbca00h0Y3VZmDPrD+T6YzrvBuirbe4YmtqBBiFF1POlcTzL31OEdJf06ybazuLFPc3rK9mXljaH+LiBUGGr7hJyUwubPCwjCKRTGFJzu86RsoR+SL/+AjXKQEfLDDcDU48VHZCdCutcEceTAoIUSmShwv6TM/26ZtbBJXWpQ== 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=9RVrid8a+eD+TtnotxTbO7QIeCjkzOMmpoWCT3IQ2Ho=; b=hqd3pqoEdqSardA4H3uIKgCmjomn42DuZJHSM5QLAldl105/n4q6MTrtkey1XFVJkNF0tThZSJeomU96Js6pBZSsvWDDpa6nGDhBamiYzad6nOQh3RMNI/20pV/6DjG0ys4397AU6pSQPziXQFtn7wFiZwcv6cR9t4YGYEDT71A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:33:28 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:33:27 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 05/16] PCI: imx6: Using "linux,pci-domain" as slot ID Date: Sun, 24 Dec 2023 13:32:31 -0500 Message-Id: <20231224183242.1675372-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ef71839-8de6-4cd7-6f7a-08dc04aed226 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8vXvSQ0hulp/YkZptRmZdfZmVriO8C+qGNFeLXn+6d3h5oe9NXqZOhM1VqQE1FAtdNHK1lI+ekRxFkFvhRV69BubIbnH2x0GB+papu7OmB93vmZCEJ//dLQZesyZj43HpAiTWt5GtzbFF5fJ9yT5IoMJo2nPiW14SGsJIJkhoOB4QkV7/obC9PoZRVz76ru4iBr6AYOT57JiiQaduT/TDPSIBdheGRWJAoTm2uZKYfHo5hzGZmAsMW343o/H2EhfYFEIlumMbbttUkx1GfWd0nX3zCSXfbVHD4urT1VmEQjZJf5rlS4wQ3SDyFzqWlRvnSVnSmvuQ3eBcKidhpz+oWn5oUf0Ke2bOZ9a1MQUUufG5hkk5xCqkcI7jpvctdbq4ib2t9jMWayTfJQOIXTwhjFa3s840KsX9Tl4atFtopUk+HSVtYK4RGt/r/6WDrBvltJhcWXfjXBb7zsYk9O3gDJK4Wb7kwcF4pcXhCan02JFVrgqJlbH0VsAIhUB6+3PJQrdIWBH7hQHSXZGLA08sFOjbnMSdVGOAUbv2FtsxHVN8Wze83QyHr8ThgzltxqGV/+lr5YJT1qC+EFcc9nQ6m0wiP8fHbuiVoIJFEW95qtBkYItAk/aCUESj5vFoaWe X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: umMUl1+SASAVuc+TMXzrdvpq1WpPWbEU6cWqTW8b8sqVPfYdrFs2iNroI34ohXyFYA2pGQ3NOzWQ6CEyL6P85zDvkKfDA3Gwx2m9YjHBXLcxps9IFVlolZNZZQxAI/XT3SpX+RDAxbFI7CHU+CNbrHuL4FB6+T2UCY7zfL9pQEAd850LvaDCSEUd/GdgrPRFqU70mS1Vp4rXxEo7/1ps1TfJHpNjL6Hk+qhVaGo8kJ7K+GMNcTwyVZIe6/Q7GtH2XqdkzJ5TVfUWD/vTl1W23n2sBylKjs8WczQkz59HCkmrrzSNocF2ALnqtfey7KF1YQy4q2D6L6YSbGxeapedigLpmE+XOE3i97mjq2nVlROFaNBPHHhKq9FpsQpkN4GJMo+tasiC3XodaRhLMTFmXiqVA94uH9J3fLH09d8SgAOgIQtCFHfnFULDBC625J5FdKbd3Pk3EnsbXypXT42CrGYfNeJgjT7DO5qZNNZwBI0jyQ7k4OGI7VopDHV5yjblFDpVeQDol8NHx9+XmB0LzaoTIJfmCsifjBdcVkilGCvqzEqIsFJ7Ns/6ReDcnU2QwvJE7xqp/GqeZOtX94HtI4iR/Yvh5e8Egg1x1q0Qt4psl19hlcBMa7A3LZwNNMft2uCummRZ/sPjgp5cve51pWE8EIjhvGSUx+kyUqECoN5psHK+T9mvqNd44bqSumrWNT4bfvcyrvcXa24DwtRFMvqwjzf58Sxca+ol8xXPhIIAt2Ece8w+6hcCg2IEe3liE4U4aIYyetdDhQQ1VcXWVv7wVtS2vhjqd0xv8QjXLWcLyu/1NSCiQN3KT9nzuRUo9rdF9RAySuip15x9hpTYeRxXMuNQ8cbU8p7XxcBmfuF7UaFqP5zhl58cV0svil+DuJqf7NjyCfXpYPrhrPwnoVW1EGXPczqJfAj2NFTUdXYCrb/Bbq3psCUPTetrieYPCXpPNTQkU5Xi11Wb7O9wAS+qxdSUbCOMZ1rgihoAxLS2EddVtVN6SfksrpeFNbVhWXWm10C5PiAl9KQdlFhdzX5hHwYYehDVoYNMiYW6p6Y4Ply3cmNygAKPh6M3xFNoSyC5G6NJBERC3P9AsQwzBuvbhf9BeuZNr/ZGWmEHeqCbJdL4jcl57lo7Jl2SkAuQ/+eYS1zZDDCJwhP18bHG868pPSYcC9wvm/a1qUyfed+sYd5d2+TvZXpRczB0aTEEf1nusfx109T2N0uDb3+rHmMZ/a/yFYVHgdFOVv4X6pMrNdZXvV7AyJHBgezlGRIE0Jp0Xu5rFnfzgJVNbkwQUv1j3ZkKCSm+CKpQ33ingHuey5t7xeStfPZ07hD8aOL+wsjpShZhz69kJY6wSb/KDl58aq8JSlz0HBw2n+W1qCU6FtlIghseWq6cdIeIlAxKVS0UUi/fn65rMFpMVBPD0WgHIg+Gc6mBhfeJ6tozpCYLd1Gu0IF6R+Ntxqnfbgz2HHXk36dTElcMr/JVZi1o802LAgWrqftYUrfBoAIYN1yFBbPjcYgmPl0gps/72IsNPtmTTYn4EC3dJ2zFOVWu08Be6rLyHgDr7L3Omhbz78M= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ef71839-8de6-4cd7-6f7a-08dc04aed226 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:33:27.8696 (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: PQ135vNmgpMXRQ4c+3g+xbz4Ss7EJgNBnJlAGvqWXeyvBR6K9Jj2stKk4J9obxwTs3q4VVYjy5+EkcKIq/dUdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 Avoid use get slot id by compared with register physical address. If there are more than 2 slots, compared logic will become complex. "linux,pci-domain" already exist at dts since commit: commit (c0b70f05c87f3b arm64: dts: imx8mq: use_dt_domains for pci node). So it is safe to remove compare basic address code: ... if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) imx6_pcie->controller_id = 1; ... Signed-off-by: Frank Li --- Notes: Change from v3 to v4 - remove compare basic address logic Change from v2 to v3 - none Change from v1 to v2 - fix of_get_pci_domain_nr return value check logic drivers/pci/controller/dwc/pci-imx6.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 294f61a9c6fd9..332c392f8e5bc 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -33,6 +33,7 @@ #include #include +#include "../../pci.h" #include "pcie-designware.h" #define IMX8MQ_GPR_PCIE_REF_USE_PAD BIT(9) @@ -40,7 +41,6 @@ #define IMX8MQ_GPR_PCIE_CLK_REQ_OVERRIDE BIT(11) #define IMX8MQ_GPR_PCIE_VREG_BYPASS BIT(12) #define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE GENMASK(11, 8) -#define IMX8MQ_PCIE2_BASE_ADDR 0x33c00000 #define to_imx6_pcie(x) dev_get_drvdata((x)->dev) @@ -1279,13 +1279,14 @@ static int imx6_pcie_probe(struct platform_device *pdev) "Failed to get PCIEPHY reset control\n"); } - switch (imx6_pcie->drvdata->variant) { - case IMX7D: - if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) - imx6_pcie->controller_id = 1; - default: - break; - } + /* Using linux,pci-domain as PCI slot id */ + imx6_pcie->controller_id = of_get_pci_domain_nr(node); + /* If there are not "linux,pci-domain" in dts file, means only 1 controller */ + if (imx6_pcie->controller_id == -EINVAL) + imx6_pcie->controller_id = 0; + else if (imx6_pcie->controller_id < 0) + return dev_err_probe(dev, imx6_pcie->controller_id, + "linux,pci-domain have wrong value\n"); /* Grab turnoff reset */ imx6_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); From patchwork Sun Dec 24 18:32:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758133 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2059.outbound.protection.outlook.com [40.107.22.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B493B1118D; Sun, 24 Dec 2023 18:33:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="LzmcCgGt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KwNXCvLqmGDy/R9EG/V1ghLBg+PDunQ+nKrSWeMhEXza774ZK2PYbiBn+nKDq5tmSprLfbL/LHuVE42imuoYPfUeq7B2MiUuGhnvwvgPOvIaMk4dSu5/Df/i0OZeXEcgp+qU73tcqzDtZDoP4Xkgw03azy1lq2sxo+V6H5DcIIXjHWHUcRD6xMJL4z+HLMfTfT4+V/huzv6loZGCSmMkHKFy4JhDzfWBnSPX5sMQjWu7j1I6AbGzJaKiyRvqLExrSUSecyRZ4ivghpEjGV91ipjHywAHFVEdMje6CelL96XtLlW8HNB12og9jCYokLvsWzrJw+sqY5BbpV9MlYbMYw== 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=K0z9pcHLjdXiH6wD7qmDtLqSR+u24DFRcxKpgzuOjSs=; b=lDJPtG36j7u4tMg/3lhub2lTayVb1YuEiqgUJgPK8V3G+6pfnlRYBrR9xJu1vYTumMMiBTJYW38ds5325eivO8GNuYRIc2XM+HaKfC9MSwG0Kta1Af+CPhbPsLdS9/OFq+QnJ29tCYqnDEVNns6xAeVIlWJT06XtQXMoXAx8uIk1JJFPlxEKPDLJOF52r44t+d8DWCsEmd94LPOvq476vog2Vng+YOPEvTmPMg5RWv3Cb00rJ6L8hQb8xBgkWhRf2kppVAyUFKMP9g4+lKrptTC0jcDQxAaTO/5QgXqVlpZxYEgpc9oPpCKQPsKYQfskl2J08qgzK7RrdcOTz7++uQ== 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=K0z9pcHLjdXiH6wD7qmDtLqSR+u24DFRcxKpgzuOjSs=; b=LzmcCgGtgKTPX45oE+ZDVt/nkq77Gl0WOhQWXJy9mz/uL5noAwwUrhEkywJY6cSWAmXoinOK0O1IUm8J3tBEmq280bVXutdbsfEzseJdljFE9yyyWvjmeAF7jbNJMTvRtiyWqwuiutPExlBHWH9vKVMb02C4IH9LaMdPla9JOn8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:33:33 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:33:33 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 06/16] PCI: imx6: Simplify ltssm_enable() by using ltssm_off and ltssm_mask Date: Sun, 24 Dec 2023 13:32:32 -0500 Message-Id: <20231224183242.1675372-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: b30e8385-6e9f-4bfa-f9fb-08dc04aed55c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UWApu2/u/OeTPuVLnQ+kM50gA2IIzIbrZ5nCoGtTqydlV+c3ibHoGhfNKO7PTmLnAiEjyqejyXDBiMORCJb31fF9M+PWRr/KBxCm+5s/JNcaXrq1ellecOMEY5bayKP0hswKmzUBBpRjaP/vCe3bMoONNeFjyY9KkYuMiRWJXMfvEkHghUWmlJqkaFl7G6xp1AsvWJTFdeKV/kIPwbw0lasPnqHRjo2hYVBMMtlmFOCf4xlGtNM8sZLRgijbKzj/1Pcbht1P9uv3hckku3+Y5uOLden76OO4An3aDdWMxbxxnfuEfXnK7WF4HEAai7Y6VOvxv974uLsFc8LX9WWhkTccmaWNuB865BMxBwRPYMXR00qLy7h3Mi4kxf4VEWxeTZlntdoT5IHXEjWKJJiNRXbVTFxNoC/8OWpTLnULiAHwApeuNZ4o2Q5pM43PnSJsbRP8j0QNjQ7rnu8ZmgO6/BTYvmY59nf0YD5OZMUmHNrioP/feEMvO77XhTKnMKQhUVDzoY8ItJrl2G176Nrd9Hfk5etwKohYfoXAlTH6esu+nT5lDppepQvUwiyXZ8VRFCWBPCCwcAyrBldTipNuvYG7RzPnliCGGtED04IDEYopRS0WT1vQjhUjkxYy3dJ+ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4vo67IKrMIMFEAArx+mWze+8I7VOku0IxjQGb5uRoNxY9kUgG8JOuIcNlVBc/XZFn9yGuTkMdSNcPnDxgUG2iBC5XVezOUkDjsrvv84ETEGBuSJgZHAL0WQ3i+Ykw7bitDOxk25DLy2TVRgv169k8ti5oZmakmBvwrHsWzTFdVwutHzTrk9S6GHLJxxOmpsql603Jyzf5wkz9F2qjejjP3dmnGpWcGWa0bXUVJ4ZQe7BiW158zvY+tRNtTyhRqiLPpykkjwkw5SJXgQE2Jy+L9UfMUTTPYplIzAKb4Am/o4W3s3fCv4uyytlD+32VnIkFxQI6yPmP1AoksADtRi6T2FBdH+43oIHn6Rm/7mLjBtsPzzNWDzl8zf0ctBg1byvyO49qPbtO9EPobAU95j3oVmfzgaWM9/IZuFxNdjHQmSnDvod96E05F0je02Uemn+rE/8JDSVvv4dK6TkpK4WKBgMlPSJ9bHWN+0edRWTEOWCyhFgZ2WoEq2BkOBDQVsE7F/A+s4o6VLzgYF2I3N3GMBc6AKtGGWu2MnFpaFc39QZ0dpoZ44Gq7QJHFpdvAmKFAiPjLlDbh6kVJdXTgYEBrv44CkiIDOnmrBbO0ZCPoZgTn8gc01WPh34y0Trt4jbFhNBX7Zhc8gXVDjfFxv3dZVVknPe2S5kbyLMnPn4tiGFn4sFYzNjuw2tBE3TATgE6F0Dosv38dnZl8iouUE/RZgtcOaMLmhRmqR40X1rqVSqzvDXZK/mDWMsUd96vsa4IZWeXxJRIpsvj3L9m9PmzVWm3P0OSbP6M6tB3GAL1k63oJlYIckxssjrKnY/Hf9fic2KcpAbbu/LE0t0z8ScEvWV7ujYdHfJCW0mzy7tXM4Om7FZPKH0pt90UrNARHSwXK3MmyONYs6QQHLen+8O4cmyrOfNBKAC3gdTcue7Y5LdDBGtYNbJWCb1CK8cNaoEA6NNdgkU1ZK6aR+QjRj3ick//VvYudB1aFOp8vtqXNuRFMmZaamVLTzeQ7yqbqe7CVd7PabdZcUwz7XKMMl8/N4bQa3C6E4vZ9KKBxyCHZ+U7BS52yjmi6gzwWUwkTInQ02MIw0Seslj8/O2awyN/QLyaVX0OieLde7PFBbtI1Csb3zxnwwNt1V4g3L4DfutplIrMXvDFHJpwS4oCPxqqpp3z8mJqSJ6UX1itacB9qk6ei8WHmaFqTcYz3c/i7Yj2UYLMOMNrxS57ViVP4F7b77X0pQzgZiiPQsDoaHe9YO6AsPHP8mzOvUQR5SfLWO/D02Lg8LxP2KUq2m2pb8wE4XpIFXSVsXk5ac1YvDZhw2Vs5rbJmbc5uFJ58s2SxW+TinNpNnScyCnHaCNoDvqeNnTAVJJFZDvsx7I+53dMSWjW0kEQhS8CN9h35RgtmEKxX5mh5P3HEDzVFS0PHVc7plwg7wrXVv48VdXzjylcZf412SvYcyn43rmjF6pBRWRDudrmpsaChyIbSYhrihc8BErw1XcqsclBQoo/KDCcmDFgv4cGdSVoNYpPb7WVSBqn9ALWOU6XsRfF0LhJiK5AGq5pz5abUe514DsZ9X3YMA= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b30e8385-6e9f-4bfa-f9fb-08dc04aed55c X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:33:33.2017 (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: SMn5Gdwgvxr5v4QtJ988/bbUe7APsODypX3Qqc75ly0S2Vr4lS6PJhqHcXgtJuVVilP/lkcwlapnZEqtKFl42w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 Add drvdata::ltssm_off and drvdata::ltssm_mask to simple imx6_pcie_ltssm_enable(disable)() logic. Signed-off-by: Frank Li --- Notes: Change from v1 to v3 - 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 332c392f8e5bc..588bfb616260e 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -75,6 +75,8 @@ struct imx6_pcie_drvdata { int dbi_length; const char *gpr; const char *clk_names[IMX6_PCIE_MAX_CLKS]; + 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); } @@ -1385,6 +1374,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_phy"}, + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX6SX] = { .variant = IMX6SX, @@ -1393,6 +1384,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"}, + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX6QP] = { .variant = IMX6QP, @@ -1402,6 +1395,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_phy"}, + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX7D] = { .variant = IMX7D, From patchwork Sun Dec 24 18:32:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758286 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2066.outbound.protection.outlook.com [40.107.22.66]) (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 24C4911CAE; Sun, 24 Dec 2023 18:33:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="cvmJhu1N" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W34LDyMjf8lHtioonc6trvEMF1A7smhEuzniylLvcHIiTKuhHQKdYOMH4JC5N8Dly4KKIZGaK4X356hxQhlUCwg4RW8ok1mDPMlyzv1b0jTo1gFPFWkVM9GVrjFppnzBOamRlE76B0wxkBwzAQrxe8BJbXaiC30RE64JYlt3F8HM8cetnyndZ9QTM/ySMiap05hYH2QrbMU2C0JTl7RHOkayDAMsrZdSyNaC5q0r0oCP+SpeKMUy4ikgwBf+DAqOebfcIDlmYpiS2z7j2/VqIOtLxHaX+hOz6sGabaS6K1MKQsD4rgv68ukgdEP+zcWAYnUTRVUqxqRbAYhVHX1IiA== 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=kVST7tU/jdCw6hjOhyZAUn8Z1JeHyuDnhtEpQSTZNgw=; b=U7U8SWCn8EZWtGLvL/hkv1meB2frkoaDC1++SsOVn7z+RnSThB2ZyhDKAkBxj4GbiCB7f0FCyH/aZ+LyCacZVHeEKmw+DNQY9h7/mKq39IwLmuDRk81U4qxxnCZnAwyLNyVoLEKqKnoyIU6gcP7WP7WyyWvvxMCmlUj6QWrsDJmA9tM9Vy+z1QgOESyfGZNe2SJDqdrQkC/Bl4xyPuZy5wYsC97LphBA2RPWxoA8hbqe0EgkXtPrzQPMQJSwYbIMuWJyRFT5s7vuktwLvWEP3nNMvV1wJHig9DRw5WZKXWi2bAjO8k+eMzxoXkABnFAz8x1BQLt5BTMcvcYg0b017w== 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=kVST7tU/jdCw6hjOhyZAUn8Z1JeHyuDnhtEpQSTZNgw=; b=cvmJhu1No99k8lZfAbWgPyPj6wVQ/IehEJ4fk0xmCCv75mDkIyKPi1IK5q3Q53uiIkUWjd8F9zeBcVyKraw8+gH7yY45a5i8Bj2sGInCDg8ZD4POXh8rQG95IfLdR1rUBMzyAFsFoHeEiJtLITxC2RrMvnVx/ZfUquNbt+UDmDs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:33:38 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:33:38 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 07/16] PCI: imx6: Simplify configure_type() by using mode_off and mode_mask Date: Sun, 24 Dec 2023 13:32:33 -0500 Message-Id: <20231224183242.1675372-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d6823c6-03c4-4921-c015-08dc04aed88e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C3R3AubczfXhxHx8A+KbEJ29VasoshynfKt1/0yl0B9/uX63/utqgduAZiDEbhDuY9VFP93BhpQ9UuaM9dwhWDvYxwyjsTsGD3Z3hULzlGNhsgYeP4QLOAZJT0sR5Bl8cd3nPseTILTEMLB3FPU2GFAgUf88J7RrC7Nbg7hpLChWfXWI4zodkbtj9IAUPtPXTNXLI9yd5NhTRLT+uikjozyMYMIa/ZkMpMfCt72AGXftik4xEDoLndhY3YmLTuZTam8nNvpFqj+2aN1IsDuZodLkDDHNMKJnTsNsmTZ2lPkvLlcX5nwk6qWqm7mXeKInW4J11MUSbt7enGk64L58wEo6W4P/vCypJO+++Y0AsnE7piRlQSgvJ8IBmai1tYR2AvhZd7wN3fVIZRIrOXAz8y8vzYQTHuAJU4oUsLQEYdtnjxbWL6WO3KGS58lDikIb6+GNma914sl8yWzY2udUyTmpfgNOWjXd/JBfeQ3padWmf2NjAsRtKjgOkwkA7g2VLXEdvw6wUjJq9JPqMA58F5Uzw/AMDK/r4TLkLTlElDZLR1i/pUk7FrshKUjmHApJh1dGoIYjNfWZVlXLr+wp6cJrtZzSKwjhFbkU8MsjERr5y3/YQ1Q6kNbEyMozsoZo X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pIEAZMFCXhwEIBfvqtxHcuNPgat2poThkfcfdSvpuiF/mDw7E0y+DsRTnXJ5Gr1UE8N9OxBzYsJNOuuhniUxXGE8GabSb5FTdBePjPR7/XooT/GF9XMU7CEYYBkiVKaSYE0BLqyGM7t/t+OBCWJYsO/p1FEtky271Ihu4QFqnm630Pt/wX0du9OpUiHMogkkCyr2YQk4L1QPG1SEv85EkALX3HNFqKlZpvaHVCPwl/tS5I98vjU0eOukhv8DdcFZSD41aaPKUO0DeLG2GiqPkHSVntc7T0frnFfAk+wc4iK1wLdrMR0EwXkdvXSD960iIfKuqebIa4fnBrYvh5krTUfIJFOh96sMw+y/7ChSwBMdafy3rB+VoWpxphSto2J7ikoCeXiZe9u6BvQag/OcPn6u8SUF7890J/ahl9BjWsFZQbl/2HBkn8xMEHp8xEkZgFdEJBLaU+jFl5Yxob0Rxfa0KpHl2Z7b5VQwNclORRlUl2PTaeO353N8yzWvVjYT942PI9VqyNENU4ZMbhvbmCz3cRoBAo2pUgG9KP8Gbls67mr1FBH2Fwa9ye97EzpEDKnghyq61xBe/6trjI31ni+k0dE6insmnUdpcjrF7d591C6cHcIASM1UmNWQ9j6ColDN/XvxLp0mnkwT7J6EIBTT+0SGDYj3VvjzTtgfp6iFnLPtHThxKl4ASORL922MIGdI0ja1kViOA78XIg2/3zKnZ4KkRIZazTpPftUntqGlP+03zlu5dbUx5vQifWyGQ57uJ0Uu3CxSfMP0Ph7V26hZHvHwNw1S2O9Wm+rQywWkw89f668hibXxn1FZRBt+Cr2GSvHWPSgfL7UrdCPZnEcEU/upIX1+AObfnHbCgtjeMYVjJU0uvscPYeHMsH07Z02g8/SlBIHTyG9kzaVM/8kjmUN9QrwVQx094gTGlkFfmWPKFrGVN7A0+Qvw+Tf2d8VUbJAYCB6sNpBmob47uoc2sAC1+qGU8fWIZLSqrP4CGqIZXAse7y/DI3p5pXsEuvl/7EJ+xMqRd/uxDdC1531nQyfGFDM8D6ThpwcSy1xHBDRlHazgVk14JMQVpsuAxKLd0p9/Ejr5/jtQKcvw3Z1QaIwSA01G5f+0/OX8nkZ0Kz8MHRwLb+erhziNK/xqGmuPwNjKmINB3mr3JcjPbyLFnOI9NUVv0bUuECIQcSvWmM8J+SmmcTxjEPImpWVLp0McqK6xJrvXBGQg7OcrHpn+KvtdKejtwwRNgcVauQxGyixlmbh2XPpYKAI3t4N+doYwJ2GPf1iMoP4Rj8xInYN2NzrxDheLF3o5blBeqj6+/EON30c8ovdYGCCrrwViGCvRlicjnbYyb7OWWu8j4QEWGkCIu/o2VinrjfPDxzih1teD1heqFbU8DTWAXRRUB0BM2GSd3gB7udOcIQG9WEagJwPmh+LBuyWlNYuxx+ekfrT6kbiOZdiePZXEXX9RNS114gRcPN+XLh5m6PmMFt5Kq00i+yyRzVPiTpJHo77HXfXvdzMrZdkSGVqYbgGMORwGGaDRkwIn2kr4EM8AXOUm014ugT128KOJNp/l1dQ= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d6823c6-03c4-4921-c015-08dc04aed88e X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:33:38.5364 (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: 976BeGMnTmsPW65JRbBU7G5eZHJ9pJ54813MmKMxa9AeBkvzA2ZSfd8bMLC1jyg6Y9Z6zea8Q/T8cqLVJ0AY7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 Add drvdata::mode_off and drvdata::mode_mask to simple imx6_pcie_configure_type() logic. Signed-off-by: Frank Li --- Notes: Change from v2 to v3 - none Change from v1 to v2 - use ffs() to fixe build error. drivers/pci/controller/dwc/pci-imx6.c | 60 ++++++++++++++++++--------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 588bfb616260e..717e8fa030deb 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; @@ -77,6 +78,8 @@ struct imx6_pcie_drvdata { const char *clk_names[IMX6_PCIE_MAX_CLKS]; 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,25 @@ 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]; + /* FIELD_PREP mask have been constant */ + 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) @@ -1376,6 +1372,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clk_names = {"pcie_bus", "pcie", "pcie_phy"}, .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, @@ -1386,6 +1384,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clk_names = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"}, .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, @@ -1397,6 +1397,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clk_names = {"pcie_bus", "pcie", "pcie_phy"}, .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, @@ -1405,6 +1407,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx7d-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_phy"}, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MQ] = { .variant = IMX8MQ, @@ -1412,6 +1416,10 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}, + .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, @@ -1420,6 +1428,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MP] = { .variant = IMX8MP, @@ -1428,6 +1438,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, @@ -1436,6 +1448,10 @@ static const struct imx6_pcie_drvdata drvdata[] = { .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}, + .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, @@ -1443,6 +1459,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, @@ -1450,6 +1468,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, }; From patchwork Sun Dec 24 18:32:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758132 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2080.outbound.protection.outlook.com [40.107.22.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 9F95F134D1; Sun, 24 Dec 2023 18:33:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="HCLF0jIE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XuLXfPNvp1s5QrfrTlrRANF52/+aw5qG+3iwkqKC2xzuglNX3UnSLiCBGzFfUWNh4lOkWqb32HY4FVabHX/KkvnFuCF7f7iMROjJi3hzGod+Eu1x3pgpIYzLIbpNHOoy8aClOzTx9FHbyWyJ8HviewRHQ5+yP1+v5/oe8YPdGhRJo1dkHFlVUoQgyDK4ZnO5A6L1JfyJyQA8KMlJ3ynA96HoRxWboSnzWO39pexEs5/DB3A0kHoBPNpcls5TQJuivGA2nKP3V69gg0LV+kuT0MGZ+dxBasYJwXrWMM1T85szSbyTBpzv4BAG7jdtJ7zAXlTgn53PKsxeK4NHFlYSgg== 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=xfBQoavpwzUAjcM4KwLeAI4dwVXf+6SQBsdUZVKowR4=; b=jX6VpIg6Ftr3SYiGwfMZAQVdmjLs/Zh5k9ns5LbgyChUsGsrzos/rVwf/wa08g9hULvHszc8Ovib2VM73fyb5fWBJF9YMFfG5NDG+PuEVc/cGDSa/3q15G5cz+rlG7/N90rQIEIMOvHwEei/erVXOp9gb50XMksesCV80p+qYybtDJFGR/Tlydj4KPGUzBOzVkIJdFLAPmRlVnJKKISx+FFogAeWI4lNpBGvzu2XPW9O+vZxfFxKEV6NNc2+GNAAk6ZoMVqjqnIg0IsALtb89IPGGGxDEwwS22ypCO6pL9VwEo3yq/YtVncqlLS48HZc5g84e1Wa2Lr7zwQoQ1KqYw== 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=xfBQoavpwzUAjcM4KwLeAI4dwVXf+6SQBsdUZVKowR4=; b=HCLF0jIEopvvo/0fQS0gNwVIv0otFc4xzNHnXEx6Z4XsIkF8SU10QWoMgm2dAOsmLW1/oJqa+b2nhedicY+TOrbVoInhxYpguwbcfjeBYG4PjjIqouFz/bn7kBmbjym+hOoYpAkHIHHxKzTXnUcWrD8Kf94eTqKzfVPvtSJdrEY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:33:44 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:33:44 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 08/16] PCI: imx6: Simplify switch-case logic by involve init_phy callback Date: Sun, 24 Dec 2023 13:32:34 -0500 Message-Id: <20231224183242.1675372-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: a9bc201a-13c5-4798-85f9-08dc04aedbc0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pvSc4ACCUZW8bhnPxogKM4gNSKmAP/5nThRD2/zZMau1ydE/DPxbLgcCyd9gyUy8llyuK6tVQyZTVLoeggvengCdGTR+sDezz+9uOnKLe6JiaE2DeB+m/pp9hZ57ipKlCppaAjQO/xCPCy4nKHjNg1b3bltXs6g3Ro8SAd7AxDII3pow9ktLnUv8AVjYnQ1aBxvZtua/k+aKbumEbEtwAj/saPKvuK2oupIQuWE19z7tSRmPpgxGINQXIzJaSLDMgmQxdZB5DarsUWuLU9Z+XdK42RJmKWFzVp4UJJCZPc8TADLTYs6CVoHJiArbBlE8g9ILLb7fjH5Zcp3k4w1y7EyUJPBYLXuE9TnpZ33J96Kb9axz83eEhPaD5DYnuE1bQnrY8yCTNJNNHS6AzQM+3lsxDwbinp9Fb4ItHbxvSaEhWH5pRJRU8NFMuaBExb1kxfzL2onhuWhr1uiKLzwPbHgjTz/9T0ULBcWDiN+KryjiqjO7SZtsps4Dp/59xLO/6p6iPm0WYnoli8b05HwHQ8entd1EvgK0oojCYnjgkNaOToWa+MeK+CsrTGCLqpt0IgBhRTK0txrVnMWgVJPafS8Xybtnnob5OyweY1q549Z6RHsMzN5csonRD3UrEhYD1CbFJnh3WnVCO+SIbKHMwJIqzH28taUuHbSaOC5UjYk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230273577357003)(230922051799003)(230173577357003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iljX0nTp5gXqvXfivtPAEz76csZmPaVSScOaYB7GdR6/JNHhqmyGU4bcnXBboyheofM45pGC63+gyZUtMthUTpxnW3nrJ6NMVDvrxkhoYlWh82v0O/U2axO1IhysKKWWc8NlvhRHl46vs+cHyB7EhFlnZuWUR/eZbsCOM/nnzYeKCBAVuFs4mBfyjINoCVRRMDN9bWV2VIkkaRXNxZrkN0meSXbZeMQlVKMc7CA/iBKubJIEZqm/7HP1PTKE/WTppAGxorCsFET1MX821mslamV/WCahCQl1+qjfsvVzYa3eqlAucXoyVA7klVOgazNYJ4YC3h6lvRGcXhgJ6SCUNteyecPGmFKxgP4NnihU3+cJQt6WYqqPGLk/Ifpqrl5BVE4q/E+VYT1/ZKfLK/rpsPFp69M5zPB6fsf/+CbW6p82E6evTGN03/XQ+BymUSv0VOVv+oAtSARSM5SuHi5FWpG4m4YLt21eiehnbVvSLHqYAvcNxA/Ehne30Cmu354goe0gGifXNMO9BfBa/9GH6+piePFRM2YDZs0jONjTBtk7MyPie7g8cFJSkhY0Y0iglH0h7RQSA0RAnDCFCnjba28DMxKfYIVA+I6oZkB3932zAPPsOaTSjX5PmGIjfNiC+NCQtkpfeAjS/xLAE0GuHP5RhAfUDay5O8bCsWYS8VgGudRrKk4ymxg7VLfUK+d0g+6lgLN0lu06231mORXJE3FNSu3IoyxOnkYtXtphorkliDF2CjnHmSnloRtz9gpCbMxXwFekrdfb5i+ifDix+uY0d6qEKizpZrwgtoBsho87FRHwdqZRT/dOd5/cVazzhphdX6JeUBYwxY4XcY4qj066OakpgfJw5MbJFFwI5OjbgKy9NXwJHdJxFMlRIX7HrlIdbJ3uPFFDMpF74HrCDTjXtTxZ0FRDBT9OY/Yyj3BAjdwIsA41HEiPG4i2UcylY1T+ssGyt8Z88G2zWrZ0JYI/sefvvRNtwtACkyjKhereth4Ts+U3hAFCvxLMtKU4wGrNWowQZ5J+r+nD8vuaSS5DiUiq5A4bnCGmOWcxM265Ztbb5oPm019d0hfcf75pkrg+jQySci9efooeEXA4/f84djqw94ZKB90M2jmPfs/rK34oyuSY3E/wkNuqDlhEdaAeCeNHxZ2DFl6xGCyZb95zrAlOipKx6+BilxwvVlMXa6iyG2xiC+MXKRPT4tLfb60bv6IT9vNW6jt4jycqxSSTz1e9odOIy17o98pmrSzx3R3ysqWT4xsitXnx7zS+6sSqIv4rEguR46smjEt0HbdI/BlD10FJRpjz7XshftnNgVndzw558jhEtxmHrgmBiTfUXSUPLhMyvmoxq3uO/1AXDJcsBzvU/KZr4v7QtSlysUcThepDw3ztQ6AzwckttzexZO7fSXQ6hS9inwQw4GjzuE8pOx/vdzOI24uuWclpe8uGn+1q4fO2VKtmHqcEhbOuJknzfUrHArZYxx2BNDrUeN0G/XZE6YSvUcEhmtKPPOaLqkO56jYTSyZo2rNXcBTzkq6jRdwT9C8Nf7jsMOoJsnJJ16vu41R1hvDzflE= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9bc201a-13c5-4798-85f9-08dc04aedbc0 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:33:43.9321 (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: YJHp3GLZDaB8PuhQyGaOwpnfOv8z6JufzPGXOk4ulEubkZIpPCFOBP//XPQ/kHKWxHXUn8UtmnUC8KHPJXf3wg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 Add drvdata::init_phy() callback function, so difference SOC choose difference callback function to simple switch-case logic. Signed-off-by: Frank Li --- Notes: change from v1 to v4: - none drivers/pci/controller/dwc/pci-imx6.c | 135 ++++++++++++++------------ 1 file changed, 71 insertions(+), 64 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 717e8fa030deb..d66a2db53bdb7 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; @@ -80,6 +83,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 { @@ -323,76 +327,69 @@ 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, + IMX8MQ_GPR_PCIE_VREG_BYPASS, + 0); + + return 0; +} + +static int imx7d_pcie_init_phy(struct imx6_pcie *imx6_pcie) +{ + return 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, +} + +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) @@ -903,7 +900,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) { @@ -1374,6 +1375,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, @@ -1386,6 +1388,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, @@ -1399,6 +1402,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, @@ -1409,6 +1413,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clk_names = {"pcie_bus", "pcie", "pcie_phy"}, .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .init_phy = imx7d_pcie_init_phy, }, [IMX8MQ] = { .variant = IMX8MQ, @@ -1420,6 +1425,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, @@ -1452,6 +1458,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 Sun Dec 24 18:32:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758285 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2075.outbound.protection.outlook.com [40.107.22.75]) (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 EDEEEE572; Sun, 24 Dec 2023 18:33:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="GbUjiP/C" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I5bF4DEAwBu+DX+/tqEUnK0TlA3g1w3paxRPB6EtOAa2+udM6tRjGcW/6Cz8yQk9keTX2MgAtH3F46cgp+IuCQCFw7OKPZ14wM+p9Ju5z6jvyAJZ4i9m7DqcTdXKpwlVgDndyYoYC4xUEYARH29/UWdvsEWqQHYgtutBIRIiBclbAqyKNzOUxHjLOQSjcdt35e+RX3oLGpmFX+zWN7J3oTSqVyA6ENl1JvIN+i9S3lqpWMeTLIyaLKglN2zHqUVWqN7PjOaXFPsTH2CGW1L1U5W3vk3GyQrprtRwMvrRztKxGDz9iXBEj/jXvq/Td57HiaSmnGiUvRCZGo9bQG8pBw== 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=DwGNcVVm9dRFaWrWACS5+4/Jv6HAxqd0aWPvzjOpLIE=; b=mlpbKulOXiPMrlukQb9yLWBOdEYGiKCgdZU03EYoCK+hM7DkP2LYELAA/gprTuJs4yejSY9P4rCiy/n8aIKXEmEaT/04j92QOs1Cm96Lg01OtQITOZRDpYUjqnibH6fzjpeTi8N6wQ21m6+hAA3Etj4k2AWmUEpIn7gkvQCQrOfriiOaP30TafpiSd6l+AneTtHCMqUfQAcM1Qf34fEpwDNjgJYaGHcOD3amHnh4rvM9ieuIr4hVP2J+00FFcVKJT7nzlLm6s3vg7XvQXEkc+2fCVpmRA0Ck9FLyOmJ74m+w0PgSUFvp7I1Nnni7dFEyt06SW0UfCEv5D5IkObpbAA== 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=DwGNcVVm9dRFaWrWACS5+4/Jv6HAxqd0aWPvzjOpLIE=; b=GbUjiP/CRd6WOzlDOvntdopat3uGtTKMlHfzJ/UAHf1qSVf44i4dTbSyDvDpkqcrQAbC5CvYo2PZWZJKjDI5IHVejjGrE7kFjix0PhuAqB2q3nVqaiRHO9U8u/wwkHL8BnhwwG8ajf2QrLEQlu4oUgvMm9nOyUE+fEQIMQZs67k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:33:49 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:33:49 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 09/16] dt-bindings: imx6q-pcie: Clean up irrationality clocks check Date: Sun, 24 Dec 2023 13:32:35 -0500 Message-Id: <20231224183242.1675372-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 8bd999f8-13b0-49ae-107a-08dc04aedef7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fBPOTqvr1QskLGfFmBlQsx8d00hBSH5PJoAAiEfln/hrTdnEZdDBJ5WXiAFqGXpiMe+lJ8cvO/bfDHrpkm1RIAZyvpobgIU9dE07Yieu6aktT3Lpmxy2RQrKA2lNF4XBUvQzaeVk2qp4ZVcnPhiR51rtuku5IiFmn7t6ohzwJfmONBMX+b5z3UZRyJyL8QY3CR5nTDA7hExmEbqNinle+/e/a63wMs2koqOhK16hEyEogBu7h/1L6P8FFVefyQdc7TDCZ0NzMNWFe/PIwsHcfEkKO44LoosHFz5OfDvhgJ9OLXxJa7fMA2na6QchorEBA9zpMScO0OeVC9dafmp8Rpu6ZO15QAmowXP37ANiyzXcmKtej8NBtHcCSPbmNPS2TLgX2kWLrp8hnoI3Z5dvJS/yaz5OwDo/8cfbtQSwtWuRPgfKllugOQfyX74IABIDVdkV53xD41v0WZNwo5jqdAiww3OO850UclSyOpJ7onW7t6DXLM35EtXm4KCDubXjXtjttX0LrnKtDJecawGrY2SCUH04c80tmk9mOIIBa/txzWoSwEZq8c3ATc8YAgpCaWV0j7ycHkwkMsAIWoMsgqelDImQp71ub5byDVuPZVVyaPmqhGtoXZY6APUFFjcoWQk5e1SWQ1hjn4AwUSQ+yw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mSjiI2tarp9sQ0IcxlsqsQM/VJwvE43kcxtaFuxSt9eoMIFd2Twy1UqZF0jVgx80kr+oxHL5d1jTrEb3jWFITj8Qw9DhGmiKDRa6LNTHNmvwptTCQ8vEI/rtCe35nqmc9dRpgwNs+gFSQaaKX3qcYOflVG+t/sJnFbhhRjU9RDnLXptcAiZbqycgw8qZCSan1Y6RmOGOUySIZShSc8wLgr78VmVJVvWa906cY4q4KGkngJjrpTNXgPHEFDYNYqq6o/z0Z0guLCAby3tWN1u6hnZiJHjW61mZovjfuImxirIF4LramVKsT8ui7WQLIbEm+JoKTQsdHkKWnlbdT6XDx4PAGbdYpseyKDwdMUi5CwL8dL0lBw9tUTWnqy4FHNuxu8wQtQCJVLboA4ETxYrGU1DMJYr+zNLnfpIac7v9MZ5e0jokHat4xtW8UwAzVYw9ewmDszBi2CF6n0z9nRNFYUAE8VlF6jdtQkI6SuW3/lxxrCK2x9ulrXVPsqhoodiMpICUN5ZJJdwc37wsZpDtc7iF9l3T4OYTmesNzsK7TFA81QGcyJjRKzNRXPV1QAqepZPAJGCKHEZcYeAd5LseotvIfKR24kRu9rEliWqfQeJPDg2UyQDEDIRYDma90hhIbySQMzpRou/0ZWKwi5jCjYGnmmSegd1QFp9TpoyPGzodmhfuOUZIAHdTBwWHAolh/AXaSuH4XFTe1xgfN+dY4rc3vjLUcaEJYJw5/A2Sd8BL9PV6jWvpvqx1FbV/ySKqsHo/Vg9yNS7lkooaD+RGimQ/p99r9slzJpqaUMTp5PZCFN7vDcmn/hIQjNPFxDIM3SNLbOLJVwAm3LfJuyJwHdPoWbdBflYgjApnPGZbBn+pm0WsTW2Y/JkfLxEn9nld3n7bABG+46ZfOvN8Y5NWYHFcw1nCm9NB9Anbwst9Q5IO1DNAirVPd5rw93MkFti+JYYnB7Q6NVsina5B2hDfHoKA1mdvlKusw482D8KPFf7cnDGypUfLf6uo+MMBt/QjLpfzTPz8Uag3S7XbOP9aTi2H4/nnRGNcrZfD/4alI6+AX8JCwYsyaHrYI7n79XSYF7JNY+yU8D33uzgiDK0JS+xCXP/3Tb5VbRtBgC9/u5B1CrOVW33zFOmzrj4MSJXNR4oSv6drgzLKsF5/pJbVl1cdYHovVWI18NkyMdRjMa/DJAdXapNWHLFmRSZRjjFJWczeIeysk6jt1NlrlLnR6MOSkGDPqXsquDzT85JxWGLcE1mGT2DhGxw565lpRi773O/D6YxvlDhlYC9FdtH5DPUOfjtF/kql9JsdryJxH+jWZ9Y984egTDFBqGISC5mqjxNt5orLOJKgfRRcMyA0e7/1YdLR+fL6NtDBXhg99A/pAt5ljiczqgIygMKW1yu2rp3qGYt7leyWNKI/iCc6hhz0NjL7dFQBqD+ANNiy10YWd3Fnr0n7zserP5bpGQD+aIzc7Qnw0T6HhakHs5P67lca1qt3j+QL20muC29OQPMJ5eFeEv2DBykUsM9ut17/bhGf//zzvgR1MIomoQ0b2J+29ChP10EGkA3PZ3fgkqE= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bd999f8-13b0-49ae-107a-08dc04aedef7 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:33:49.2835 (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: bbDiBuEK1YvC7EE4VLFTQbP4/tETqV720gyecPmmCJTcGuLzccBVAz2ID8nIV8WBoRBc5J5rI9tFW40lGKMZWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 There are clocks and clock-names restriction for difference compatible string. So needn't irrationality check again for clock's miniItems and maxItems. In fsl,imx6q-pcie-ep.yaml if: enum: fsl,imx8mq-pcie-ep then: ... clocks: clock-names: ... else: ... clocks: clock-names: ... In fsl,imx6q-pcie.yaml. There are 7 compatible string. Each one already have clock check logic. if: enum: then: ... clocks: clock-names: ... Acked-by: Rob Herring Signed-off-by: Frank Li --- Notes: 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 8f39b4e6e8491..a284a27c5e873 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 Sun Dec 24 18:32:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758131 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2067.outbound.protection.outlook.com [40.107.22.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32DD316429; Sun, 24 Dec 2023 18:33:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="MIi63QsF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lGm+6d01zSBgOJWdch0xt1lV0w9k9bS0tnNu9IFImZINoVwEn0nWRUDqI6dCzqtGGKpmxWdI/qAB4s3LiGON9R3cHsnvhGsDshcuzCqNt5zIRbfrPSwa4fiUQMtLL9IxrrmPhmsIs6NqEbCsjwcQl0b9/nt1YR9DSkp28AtBLVzYG/U2qGXwisCkllh+3sGmr9Ob+6qKG5KfRcY6i0ry3AakB3KagWM2zDxHULPRUmWC3MYTSUjlaiQ3tKVB8QjD3/iO6Z9XjJYfTL39IUAbz4cV7vX8WQBYIhZkJEMQIYXjPREuQWWgKGCuEC9uoC8UWRtShXQ+Vg0780LtKZkz8A== 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=KHpyHGEliWWrt/gcDy2BoVLigQmbfFhVRMGZwKdtry8=; b=NoQQUFphlbVjL2N74KRQ+Lh9qVfkuJC/ET4Y0EuVQxQmyJPB8Tp5bHYbJ2UoBdjbuvlVuHQh9G4fGeiCMI9kG1pJ4gv+HGRtlb5tu9LySyt8jO4JuaseZ0UykR7mkVCnHRWKJMxzLMmPoqJp7HHQvn37UivOXJ+6BXrkdQlWayaFfqmknX7AWc0moNSB88+apy9MUgi/t1Q0l9CqtDe2LG+MzCCZL8JOfzkE3UciORYTJqOzJoGX1kwY8uSL33zQdhkUj/hLVGar5yaXgpl4IdEnrzjwxfei/46haNWM9jraErcuJTCl0SYb42rotPd2f5MA3djbCAVwb1tfZqm78g== 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=KHpyHGEliWWrt/gcDy2BoVLigQmbfFhVRMGZwKdtry8=; b=MIi63QsF2To1UlcEn8bPaWmOv7reY6qUwe2fdQyljTx4BEWBFIq+9eLr/VP3VZ/kfIxH0yy9wqjBW+LSLZ94i8fnYXPOtbMyFmMAHbCWZHe/UNyE+FNkBPlZBfWMzh8NWQYmroujZfXFNpk32iejsPgoVgg9YqFW2hmNiPqF52w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:33:54 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:33:54 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 10/16] dt-bindings: imx6q-pcie: restruct reg and reg-name Date: Sun, 24 Dec 2023 13:32:36 -0500 Message-Id: <20231224183242.1675372-11-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: e79bd259-a255-4591-391a-08dc04aee22b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6ar2KW78zhj97kTqyn7DOsUgVcqjyxqAIoe+6VEDsi1b62LoFZiezjupkz5tmhk+vrxmrkz9+G/yMBTE5aumuXcI21M4s3puF+Mk2vtpYd0TkLNi+ETtS67Hmzp6A1bTnOquijW7/enI492/SxVv/K6ZbnZZATXSjCkh9aIqMPUhDAIMXnNnEKq2VcOKlbvp43BUY2552YnWxqrm+BJicYL82CaumW0pobl+1fZ3+NK7TmyFVIsRE3ijTTtuC6KqVw/ktarHCsub/rJqyxQ+D7wd8A2lFyFf9R6I9j1Fg//u5aBL/g1zHat83gsr8kzhX/nCTTW6cGubfDFskaNRA8s4YQH+pJM7+sXO2iF+gKXDpBg0iNy8C3OzvfBFvFA7uZNguIRZG0j2q04R8HF0CBuqp1pgDWAEnnsdAXUVwryO4+tgOBSvW6hQTMryrvfICw2bOSHTRCqZsCaVZdrIxcA4JiTeakvUCv4ZmH/1Fn5quKkjzHuwVjuUJ7kSchaEO9AAYNJa/v9vpfxhIFxjCZ2HEiBojds3edoPyt/6SiDg91HuKLuoxz5FAIOc//rmbxLu4LiyBnloK5tsH+JroqyBLrSLChOPGTB6KsxWs6sU4qE1/VGYb8C9cMKK6Htpyh3QBexl/qZ+umcnt0/CZw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: g8J6sZ7Rys7VklsUtdZT4mZaKH0E4yvsgWx9tN7ySNii5RKWj2HLKELBA5ugDFw9cdYAJFgGheT5CNQErLx4q0kjgJKg+iNXuO5wGv6dvlDWiO68eVMXo/1j5xj71zai31gLdYsaXmgz4/JPXw//XVosofHptrEFQm0KQlcCR5EfYb5fy0koIypQLbgwrPVIC9i1XrjsPBXY3kfuAWw6V9dQjTFRrwYFjevVsSCIr4rA847JxWQsFewiNU22Y7+QFrCirvijJnWAITAmZ60SjhlqcxNE9YJhHKgL29beZpWPEguLoikyPY15JmD9IofDfkYhfBReSc9yerbcqCYPkMa7YZZt/EJ4J9rZ/EI5JY7+4DTx3ThZKeAIlmuEnBTQzbQ6zjdxsHsqpbDvYYNotXktNu4/BWg09VxgAChv+Uc7KC4OpK9+3sJGQLlHlED5lSouKqUV4dPtXJ0QX2HXCI2Mx0TEcN4q6SvIiRyRMRSvyWPBcs+ZFNqaP0mqIfjHpGQp2VqTJPM9MiqpNNTOFJ4nV9ZfuszuC2jgjB22UFXnCLXTN+d2Nrgk/imSDrJM2QSc85PnCDBcCI/AEA4PCE8u/PIPsMBAVJn8CYou9A5EGM9VqD1PiJE8WZmClye9lZVxcGdHZD5QteCbd1UnMK8e+gtUgJ53sf+hpf3wXcMwuU26QH+Yfgyo+40BabrS1UwXsMyFezDZnhkhzJkbINldhfggWfMVu2CMG4gP0Qt5ufWvsLky4HcwPOTVqj5Yq3yS/PQKud9OOox3WgtCxX0A3p2aTkwMHVJXqrRVb2LLK4/4/C4+zqKpn6YiH3KWbEFXDLOurV7wK6LiKgehf+TRf33BlQK9oSOIIDv1CGPMZji9STkfMi4qEDn9sXF7aXARgirC3qm6XuUVT+LTxmrEalLM0noNT0QEZRRc0ST+CQ/4r7cu49gqYManETNJewRdC+YCsoTk/Q/Voc3xGcX0+g72MqHrVZDqac7rDV3v0q89IEkkIEDYeuR96ghewR14cs6Y2yMzB6XoQtnf/05jAlRuVO1XbCLz217uQ2d5Bc/qTywZBDOi5DcBakYzG680mggQRY9e86/J/p30/zxgLgvv3rKRITCDn/wO2MRht1UAtIc6dio4wWYZzyGK9KbijviNPHwFybMp9N+MU4Fiz/D8PQuhO4rBKheg4qKMzvLn6KbYbAw3BoMtw9MBkz8wNE5Eymybr5XNDBR+2isJhm0E+iKtEe4HB91U1oX4/qr6cQm7qvWEF5OaxvuEygaRzFDDikD2hwbU9kDWg0Yp8WBu8Wv1vfD1r7suqro2RhvVGDKYEUdUCYFXxSHCotCtP3Msy1Edt9pAa7E9WqMiUjPwST3OdSWgIRb/eTMFgJq/3D2WrNq4O1DlyUeLIsnFNNDgWHLZZmGhoWGz8wmy8N3rAYBRXvDYV7WLclRFDb0GWmoeK+MfsafP75HWh7pyHy6yHg+WRpVxLZhN6aS5xLURmwbt41Gks7oTjSeg4C7XZNGmjA+D2a6bZ9VbwH/duNmbYkrJdjhmLq/W2xerz9Uk8igPvqSE9fXPZFQ= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e79bd259-a255-4591-391a-08dc04aee22b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:33:54.6658 (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: B5LvCsOMtzptDMmANKKuVq9zbdeJMBIspwaq5efctnXr1pPu4LkuV6fbo1QppNne+SbyXrlIAK/rqpofWoiojw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 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. Signed-off-by: Frank Li --- Notes: 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 Sun Dec 24 18:32:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758284 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2081.outbound.protection.outlook.com [40.107.22.81]) (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 74AA217738; Sun, 24 Dec 2023 18:34:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="cLnB38u/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gGb/XwriG6+Vpi8/hX/3WQN2ZjhdT6Kqyq+DjvAYs6m0lD8RBbhLCL9UdUiZK2FW4IAIIek9se+G+0ln/4m4NtSKgCvdeoZaBsBR2Aa/3uNa8buUfx9Jdr/x7ysnTVSxMycl9fmPtbaHkGYLf62iO2Bzsk5CU6IK0dPE1gGvCxl04Qmp4NmhgZ14wOo69h9guPmtB4xMfwdk3bIqew0GIpExx48j1Ovm2u9QZYxB97Vw2SsMpVFb10iiEYokyWa64z5Gi79lenvvpzejJRK86LjYDBu1qwG77vdU/VQ0VS+qJQVKzBfCk7+AkN5Zk9u5IyrjKAW0ZK2Sd9X/4bj9dQ== 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=v9BJ7w54FLLy1r7idavEXnrdY5D9AgX0T+UheGxC4tc=; b=lEx5zOjJ5HDl4hkQwWD/AnQVhqJACQNqrIA3wRj7K4S5yJK4sQIJwJ6h4jg6qjCtKD5e+9xYF7ZTSsk/3RZnbpKzLD+MXh5EpU1UqKZQWLUYDeqydIRYc9P35GQIRN4wm7LSLg5HdTDpuerX8MlQuUBzr6V3srjSn3ltQKR7dy7quIzDAPy5LARME5TafGRLIvIrsN+IOsa+QmGZ+LgCr4z43LPrRkQgP2/CL2aNQ+8QIAcK3BHmhzjy600AyKATtQ3r/q6g4tVEnhlIVgA0SigdFSBXxBPrFg+brKVIeLynnbP2msXHZXcYu54T3XVQn9ZNv0voa1aW4MImmBJuPA== 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=v9BJ7w54FLLy1r7idavEXnrdY5D9AgX0T+UheGxC4tc=; b=cLnB38u/CtGPgWiM2rmIbLlDr+AQT6HooycXACbHOZFybT6/IIsP/ctuUPB2uABX65P2hL7lbohJX8LbdOUbqbi6rwI/gMh8G5A04z71BQ1JOSRO4e5dHhYeu9n0G9RmBzqlBdpN+Foac3Hlm0ttMD8akOjHEG7WzJCpSVyf4Ec= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:34:00 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:34:00 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 11/16] dt-bindings: imx6q-pcie: Add imx95 pcie compatible string Date: Sun, 24 Dec 2023 13:32:37 -0500 Message-Id: <20231224183242.1675372-12-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c8f6ff7-87fe-438d-9c64-08dc04aee55a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nFnH1ac2b3zwJ8gO1rqpGqoVowOEwh4h7z9aTvlcErYmTTsX1JzkLd3r+gSt5fjxMp6gMU8e2vMl8+Aczjyvj4j/YLR5D8cny6OBvNgif7xXtPDGjzssVlgSaA4B7oDoZ7TbkXrw9vBLD2voEFUwP9K+t9O3kTiMUNSXOGEn08yD9IEddxR+TcioxzPJsWBRatANy3ugXON21StZJI4s3d3g66TQpWM8BYSQw4ffXlmILzBPRk/qGGoobzxy5xuxSKVowaDd78seqvoSoY1YWSIErY0nsysxJjydMexL5/z8Ojp1jFaO22Z4Hex0Gv2DUG6VmhprgdnyPnt0Nvpbfng717vlrCBk51ULTf3S8bINbEMqtaMeFSt1UkbP0Q4EpALEas/L8VCJ+1+3UUT2QdyUT3j9xcNf4ZBeZ1k8abQdKdfceoGBCY8zpYqMFmypHekn2FNNe+GbZovahPk35bHw9woWLWT60vqGxDMVzcd9bB+HD47xeZFr6mfoA7xhCjLJ+QbzoU/57ROv/uFtacghlvuXxDEobPHvPwb/5tewOUJGO7PMfcwsXTs4C8UqhFk/dXTpUM4pvc6ybVzrqEtssyuUzWyUiWEnjZcDa/lf+ovgpRljkkZ6gtaT/pMlS9Kau8w3YHfEG2k+Xvszxw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ul4FYqSS/ur6qpzr50VVr3aI5KbxddzQ3sAYD90q6lbPGGo3PSjEyl66JKFvlqGYvxdIXrH183S2k9697cKjQSOdXGYJbJmWRpkLo8HvssEpo2IGlBpHxI2B/UZjTQjruL+smcSI9jAW3iK98HSNDd59uHa80BhLvPx+fL7pvwhT9Hyb7YzDcO45uNwhhyy9BR/W8pr97D8/Ks1m3a8KVxzIwFSPLgRuagVGLBUK29CPWru8VmGBAVkh2iJnjYYuPyZFUVRJlR8KzCBceXRCWq2XZgreTiGUA8yXbzPNXhAVN8MqAN3u6Gv1ioDPjPjHRiMeVbYtpjVnToAP5itJxsyHSga/SRmB052fyyW0fhfHAbbBdfRCtLgy7lUd9QsEsrDdQdnHXHlAhaHzmHfLCavwnBuStlP7HXGewAjrZwvaHsU/HVbN62qovRmotZ04Ru0D+JnFEHenQPpNwR7qSgRvttTmh9JR7nxORuCJvOkR862ozie1KZngnSfSRLoPTrbtOqDkbNxzOM+f3g1R2PhQ66FsmWRB0/PJCkg8+rTSQYIuYePRXb2GU1ThctDuaqGCSNVG9op5W2M3hvdim/IXk2Np/FDQHmRQHwrNXsyXHBW0UvRxfIKs4/EVCwDFrI5LbxZCs9PKK80NlU7AOz1GlYbwYcDvb9gtrMqGeN/Ou+Ee7qF+P8t7oEGSRibkczl17zp6FOLtBNGml0yEi7GaDxxU5xmK7kjgFTtwTfcxvEIhTP0Wn+T2JcCDIgTq9M96pfSmV2Le0AaxQhrXy6q0bSyyik2ES4mKyLLlrC6tH3aE42qI9XXJ8mwJN1++BhpywZTWjuUseXtDG63v3iV0CvRsku3nDZFldIvpaRB/LoB2LS8UkHO5295V3RG7P3+JZl0/tu4KPAsEgz9ao9kPBhwyJBjK6tGH3/jRCewpXsrAxft5lsi0vWBWrmD+YqIQ/GBpZr23sktcGezQ64Yn7P2X3hgeC+vk0jNokkMdPhE3Rdcx3rgpc2Ri5t9C+qRLQpBoa1EwQ8o8Vo8hozp7K/VGSzxeLgwa5hn/gNnaxJLzHq3JzuQQBoYQi7GvPD9o2Fipa8dzKgI1qTIf8cwWaIpI1sLCt5XqIPZ1nWJmq+HYBnSN0tUeJpb43/xRf3Uk2BqQeYWMvanAmQ6HnstpJz054UNqnY4MzdA3QSa3cQVMoDFg+iWZh+DPJGj5prdN4gOdnT79xsPKiwcYHjQ6ATg4jdLvnIl7Zfw2DGgeT41Rl2hrmJGY9zmqzm5jro2M7OPbK78ncfDuVB3ZoJetVmqVt2yPXtQ5p4FbIRK5Bdj9HiKBgxe9+mtAHBh1Ey+qINz79Oo3Ki9cU7Ji7y+AgbkDwNVi66lxf1W0aMt6yJCkeSOQdqbHd9zQt5IQH4vhndjXeeV4EfEwWXMKs4qOMHx7QHPQFbvj7ax3cjv0eYxCMJ5N82VGAuZlAd7kk1on8EfFKtCjq87zUxMGrdBIG01lZ2OFQYekAcz/GahzycWopJavy8A/7I2H9L0nFUmDkdfhOr25IkX3fR5P9JDcV1n7jQ71AHQTzTIi04w= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c8f6ff7-87fe-438d-9c64-08dc04aee55a X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:34:00.0622 (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: 3vI4fMBcbNsOtz7SRG+53c+cJ4U5IqsDM1Pdo8QVDyDc9X52gPzjUf2HBYU37alPej299UPU1ubNpPH7U0HKEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 From: Richard Zhu Add i.MX95 PCIe "fsl,imx95-pcie" compatible string. Add "atu" and "app" to reg-names. Signed-off-by: Richard Zhu --- Notes: 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 a284a27c5e873..1b63089ff0aee 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 Sun Dec 24 18:32:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758130 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2068.outbound.protection.outlook.com [40.107.22.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 1DF2A17747; Sun, 24 Dec 2023 18:34:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="CPpMUxKm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fvbZIU9/WIZfnApUKyPAES64O6OYQmw96oP/fCRCa6rHqQrAEI0Wrp5YZGpGWFc5u6iyvgey51UwbAE8m9BBuEgH1SSRuPafl4PLKHy4sPQ2vE8/rTuLxgUtGJcy0g5Z5jN76wn37rmL4du18ZaMNt8lWjwX8lVcBHqN6P6+GAnVaGawJRGm/M5Bm/AZiB50mAiYuEIJkwizmS9GVSwADSVWkkkLhctXl3gwEvGB5mIgR3fYFFe3Dc8S96cskPkr3wNj87UjSmIw4acTNYjMVATC3dnOjTtvOdSd7MbEYJsJ+84JA/DGXnDrhBuqWu30/rNUwZnpswcH0QIoiYB84w== 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=Z4dgn8M+Jk4NmcR2dQdTU9AyWvLkmV12/ZAFatSQuWg=; b=VVxyreY7VgB+RPZP4neznghC/dPz3zR27guh3LV1JZm5H7r83TOscq6JB3/UED2N92klP4+847Vt7rhaTr2C9hrdTmqlQShe6gbL9JEUpHs6x3uZgpMVJZ7tuxu0vAJTh53ojnzI6p4UzYnqt0TksgkDF+euA95BNc7bvP+4iATfxwb4VQsIHPlNHHcDt8M/BQ/XZCf6qCnz1c3FvscPodxOF5WN/7fOd6SL/WPoRc0MgIgw48PS0+StXwsEqNHfs0U2Rc8IDtGQfBl/Hhd5DKD+435731AvWYHsANQFhG3spVOPr8KHho4YYieg68Mno0KXn19FqS+xmzEFFmkZrQ== 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=Z4dgn8M+Jk4NmcR2dQdTU9AyWvLkmV12/ZAFatSQuWg=; b=CPpMUxKmds3KrxoCAHut55XKIdP7+vcLay30OaZQ/eedtar9WfX+DM9rby2TyczaBr1ZiUgYr/QstLpiR5M5f7d4FVgVV56QeQaFxhl6aasQIXaOLxANQ7Oo2ebhlNmYH3XyHzYusHDjPRLxJ3YTqp4MLfVCAtfq0nM/4h65wXQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:34:05 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:34:05 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 12/16] PCI: imx6: Add iMX95 PCIe support Date: Sun, 24 Dec 2023 13:32:38 -0500 Message-Id: <20231224183242.1675372-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 764f5a64-6987-4f5b-ebc9-08dc04aee895 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g1NFu/J70+1Nl1nyLljZIrbCC/HFWx8tS+5rrEVgoZgK7xDxu+fi6IdtYWJKAFz7TUtLmCA5EJcQMZr9DVZkVNe2rIqKnmq0PxUnFXorkA5YNWvHJb2DQan+6zRGY51z4Hehtl4dNUm+xjkvZrymip+aAeDncnKNAxdytMJHI3D2jZlrCHmKDdKqLPu3Atf9uhRP45OnLksQ4UDlRLHrLQov2EIKoSnIncDXoBwhnkMRCLOpCL0WD4ZwjNN89evy6d5oYvu7UVjTKR64oEAnxf9vtfBas9wpPw14cvfErbzbAYcO+6jw098DUWuUbYUQjbT9SSiEHT4yfwACxur7Jbpg7CWhNYaOKtz+LlBcwqYrqSP7m6UM17UJxMQRd7jrz2Bi2i2FtucWj7/tU149Q6WeMETQjVKhwCw1uGdY3qIlhcipv7pLyPNLyOe2vU3j35PAUVh+IinHEzxoWMA7Iwr9nSp3/TQ0oIUOUP44jRrb0ki+m/KpSDZgGnuIzxtwIVK89gtrEF/Wy7zQlyQv717DlXEVJbU9o/fC6yEo+tDqFarO46/5X4QLBpfkSEwwD70X2+wLlSxoKOupBdsyVOgtZQtA5OECcY7jyOI7ZYSKu58Zg+5fl/i3F32wmjwR X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kJa4oCeDr9BrcMR8JAWfee8GUiQ1DnOFdB3rMRmACmLcaSBUBbVlvGbgtEm78KsXUq06ZsVY29bI7UcLdfxZxNQkAHMH7EAXha3E0nn0bxsRymnUp7bxqLq8GuF2aLbAPoT+mRt+7nmNTwzOdfF7d4HwytgOl4FOHCEbX+hKB6tNsK75IxYq4JyJGW13BWyVOSawzdmHwa1CnYoaChsa8SRUE5cfVXjh+UVcOXNn4gdqy+V9MbbI5yNR0MDPVkQUQDsbQY9NyIr7b7Vt69e7BjtY3D/R6elbxG8uOWm3A+U6hNF9USKhkEixCNSbaIsnSKJ2ArJIqIdFITXMteIh1GqZSyAmD0TlPqX1qwNukqqrT2J2KDBRW+O/a75+Z9UV0aaMY8WZrImmrlhphcAI7AD2cD6oeTRF5w3L3mOhPhoQ6elEWHkLJqt76kFUwBlwv/vRPZBqngBNSY2HJ/6SAkliaVIMN6Krr7g8UUIB+vT5ejPlkI/z7eIW1dCuW8UlFfl4xf/0V3JfK7hsdgTe/YNYhNNSeGBZZWrfX75pABdha3+KjpHqNWGlRwONibWG/n1ahDkoQlSX1pLsCoj2F1cgEL60ZjLtsNo2HWQ5PKsdT5WXQvU4T2jkGpfLBlp0yQFFuy1gGsJUfDdPqEnxRclKGBwDUcSWRYNRZs3vGd+2YZOXjXDEWbXMzLLgQRpvc3TVc9ayNMwGOoRqgGRwjB0BwAKlHKuNtw1Co+UhmkWMhTttqiEJlQv0Vhkam8NrYk9suDIqJ2a1L47Iensjfk3Hp6zy36ZC6PpJAKsUj1d2MRwn0aP2bfKXq4EbgTcFaGnOfDa7SOQVda0CEF3RSIRHh2Y0VNGNgA6+m/9to5j881E/LSyotunwf/GkFsr277CDy3f38P7uOgruwg7WNuJ/OoH93vUkImVpHOVPqy6sEsPFT7lSbyNqNnnd0ie5zY/x4ntF0FigvDokP41hBAMfKcp7Z90o8B1Q+0wydO/vqCosOOa5xeJ0J1wC/VLagkm4TFrInhrzECu+SvNfMeBA9u7fIhy4hof1tNHCniul0fWkdWeKtnfCki1zekECfNhuc3adq0BDhIuuMEDCLSxmoET2CMvjZwXN4libpw+BH6batR5bEE8Jy0g85VUhEU7V5RQOnOkGtEmE4jq+L04yHFyMjzXkaQQbh1tZTA2xpt0fa9hzRbHOROFs07PUdX4T2pgzJt9iCObp04d4aEGiO7pe99Tz8LLmP90mF0kfhl9W6Btt4UJQSPd7Nj14dXD6pY4pBm8L15FoDlNtmU3FZ71srpl218KUV3lAL7ksJOX3h2narqTIH5/svCAp5NsqNYVu4EoKRrHeUFCk6YycTjQXAe9B2krm/x8NpgabWOeFgae0hljPxLkn7O9rbL0PGZyNf6fbvpQyWYqP2hBBZSK7R5/u1Bg35bfUjIhPKrhU189ZBjwcdvB4knay+8Njxj5hF227JHAkxTzWoaW8s73JecOWup3up6PtDJyR+C/NoL/rO8VN8EaWCd3k8DRhCvDVN5YT1CyxQxsFv3fWFoh2BVcmWWNb0Ajr4z8= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 764f5a64-6987-4f5b-ebc9-08dc04aee895 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:34:05.4387 (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: 3/aPwQZQrurhoCF3VLTQhiVzD9wCtT4xvz8YK64f5R5dl3wecVlIUrRIC06MxMTBYgeTlforJnZDaEqoEbr3FA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 Add iMX95 PCIe basic root complex function support. Signed-off-by: Frank Li --- Notes: Change from v1 to v3 - none drivers/pci/controller/dwc/pci-imx6.c | 90 +++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index d66a2db53bdb7..9e60ab6f1885a 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -42,6 +42,25 @@ #define IMX8MQ_GPR_PCIE_VREG_BYPASS BIT(12) #define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE GENMASK(11, 8) +#define IMX95_PCIE_PHY_GEN_CTRL 0x0 +#define IMX95_PCIE_REF_USE_PAD BIT(17) + +#define IMX95_PCIE_PHY_MPLLA_CTRL 0x10 +#define IMX95_PCIE_PHY_MPLL_STATE BIT(30) + +#define IMX95_PCIE_SS_RW_REG_0 0xf0 +#define IMX95_PCIE_REF_CLKEN BIT(23) +#define IMX95_PCIE_PHY_CR_PARA_SEL BIT(9) + +#define IMX95_PE0_GEN_CTRL_1 0x1050 +#define IMX95_PCIE_DEVICE_TYPE GENMASK(3, 0) + +#define IMX95_PE0_GEN_CTRL_3 0x1058 +#define IMX95_PCIE_LTSSM_EN BIT(0) + +#define IMX95_PE0_PM_STS 0x1064 +#define IMX95_PCIE_PM_LINKST_IN_L2 BIT(14) + #define to_imx6_pcie(x) dev_get_drvdata((x)->dev) enum imx6_pcie_variants { @@ -52,6 +71,7 @@ enum imx6_pcie_variants { IMX8MQ, IMX8MM, IMX8MP, + IMX95, IMX8MQ_EP, IMX8MM_EP, IMX8MP_EP, @@ -63,6 +83,7 @@ enum imx6_pcie_variants { #define IMX6_PCIE_FLAG_HAS_PHY 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; @@ -579,6 +618,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: @@ -696,10 +736,19 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) { struct dw_pcie *pci = imx6_pcie->pci; struct device *dev = pci->dev; + u32 val; reset_control_deassert(imx6_pcie->pciephy_reset); switch (imx6_pcie->drvdata->variant) { + case IMX95: + /* Polling the MPLL_STATE */ + if (regmap_read_poll_timeout(imx6_pcie->iomuxc_gpr, + IMX95_PCIE_PHY_MPLLA_CTRL, val, + val & IMX95_PCIE_PHY_MPLL_STATE, + 10, 10000)) + dev_err(dev, "PCIe PLL lock timeout\n"); + break; case IMX7D: /* Workaround for ERR010728, failure of PCI-e PLL VCO to * oscillate, especially when cold. This turns off "Duty-cycle @@ -1281,12 +1330,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 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 */ @@ -1447,6 +1516,16 @@ 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 = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}, + .ltssm_off = IMX95_PE0_GEN_CTRL_3, + .ltssm_mask = IMX95_PCIE_LTSSM_EN, + .mode_off[0] = IMX95_PE0_GEN_CTRL_1, + .mode_mask[0] = IMX95_PCIE_DEVICE_TYPE, + .init_phy = imx95_pcie_init_phy, + }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | @@ -1488,6 +1567,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 Sun Dec 24 18:32:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758283 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2050.outbound.protection.outlook.com [40.107.22.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 4F7DE182A7; Sun, 24 Dec 2023 18:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="EHmxOYAh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kujnsLJzML297aIYC9J/7ol75kkEJtNEfgSqblcJaKfodqNY65FuU9poQ2rEVtPYRJpvbPL/jra0OOyHFQLhgVDnDzImhrlaHSgN8SpLinBRy8OrKZ+Zx7QHtcNig/8KR8BJOGPR/xHHIyAAI/tPnChmBknjLsYMw4y7rJAwSrFsvrPjq9obddGwMr8owAj+U2k2/Ti1dPSXvpdvTt/ZwUpQdUm+6wtDWX53nf0q4a4hXjO/Luvy2hVHfeoA3xVlmbJkafa00QUWimTwJkhTm+Xswfc3SP/B++yIC/0auyCStJ1SaNJwim9PzhRXsbrOCpmNN8LDV8fAfuHPrP2pdQ== 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=pouqXGwboygEHGEyEH0UcBGMdn3xWvJFgCWv7qfcMzg=; b=lG3j29C7KXzS8tmW36+2yV6SOx7ud49kv+WcOA2qDpxtsQBuKULud7ancxsJyuulYDRvMp5i5eK1m6LbHG5m6IdyFhNu6M8Ej9JdAU25mLeWpEgZ99rCjiRV4Fh1sNT5n/TqevOqDhM6g1rwY0J1P7Uv+Cn8qKJeScgjXVXTT/t6k8wAVLnOMMf5e/H0LBuepG3thlwFQW/1yowqRtTfwjh7y8F3heH4xbpMPekme2uyNgLz+6T5+2owa4dP1ZA7zgpwdKcnMJEFZiYQPMBXSjJTpqUkhzVmXrUo59BzZq7wEgj0vXSXUTQfSSz0fOQJOtu6m+94LlTObQmcqXsAhA== 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=pouqXGwboygEHGEyEH0UcBGMdn3xWvJFgCWv7qfcMzg=; b=EHmxOYAhybhkAEcNPNWkuQGiQU2eywU0vzwQfQB4uvyqnu4QckA+8ef155bSLbVI01NoP6yHd/rcPeLE2mv5KrbiGT5+s1IP8/RkX/HzIG86nZkbRW1aKM8+zG4otk1UVqbdGCqgtOuiLan3lsKH0BrocaW7Ec/z2jtKezyYhAc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:34:10 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:34:10 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 13/16] PCI: imx6: Clean up get addr_space code Date: Sun, 24 Dec 2023 13:32:39 -0500 Message-Id: <20231224183242.1675372-14-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 269a5393-62bc-4ee8-ed00-08dc04aeebc2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 90DU2PkWJx3kv/VfXXnbrEAgPrcvMYV1eE9Fw6WVP1O0gP9kF2eN4Kl6Q2L+RolGsqJhJo8x9URiYBCO0spLjdUvJo5A7D2EezgFev6VUZkhafYpa235Db9B/TFeZ2knHNC/LeGMrBvnxQ3Ty++suQUQ6YQ4JAw1xOPBQQpdxBt551js4pPwVXKAURCHK5d7YNVWn5F11sdZHZF4gsImi3JeHrSnnsKKsyQx2ztn8uRHfaza4KE1C9y/Gd4hmhrk7OEQZaVExNVWCzH6LYoHfDsKGcuVDCHOeoknbD/HT1VASg/ZhN2FiFSIsIsFz0hHkblc0PnhPGEhT6bQDH1WeOuA+Ee9kqFgM3SLPboi98BG/AosjubKSMHZCEZBB3SUHfus0UsP5i4PtvHfsB0pENFHV2aFrsV8VykKio3PkulDlbEF817IChY342LROu0vVq0mays7a5QWfthqEF55nJi4ZgUXZT1to7rtJ/iDQ+fBbgKFDMOGc3twA9N33d7LQGUN9bOfN5abIsrUJDLO4qaBBKgOKiqg950hxyBhKA+Wf6VZ/uR0oxbl3ur5s0ljARFlLnNIMKI+q/7F3JCcNp6G3lxDufXzditzjwzBvsxXZQctA8ouZjAX+DXjUfEG X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xNGadCEpXySaa1Mfx5yRD02Bx+J4gwixPeZfxb79yYBn5zCtWMksG5LA+ULuVYmqarC7H58AkMK9eiiv+Kx2ju105I9YCG+UZ7AFrEjNGvRAIl53A0S7K6lRLSi4mFrm9Vg653AIIIGQ9obJ3UMmXeSwXwGAMR9086dDRzOLTlEubQXDw6SeSg6KRBjrFyHvZm2FBKES5NU6TrkpUEPIOWtyWXn3LJydlsacrV4/xhqz2+SluJa4V8akUb6Qq9qGHSx74gm4aEkCJhokwGve87pTuQCYlK2VtBPzVxvFABvl5IBrCzP2fApyrbzfnMM29XZacgl5RQJgAuql2HqS7YyBnUhcm2Q8RVXXpOLJN9VoCe8UFNyEfL2MABiMK1fcw6fWafXiKJvyLimjWtlg2d4RaSp/Jz8HJJXVmjMZ2h8quANz1ZNjYc7YC9PQmuoiHpwGsBgc5ihc88kKKiASRanYJAWcxAIoNHD05d+nLWHFBBhMMINIfFHBvbmpURkyjINU1CL+LywefP2ORddXu2ccuwndlzBossvB8XNR9fEKsLytE7GG9mX4FQX1LBpDcF4ADiwP0OGse+3L6OEfZvlRtpqCZ34ZpI3jnTV0t1S/Jqyt6391pq0PQUNjmJ6IdsbVE39YrkPTx9T9K55AYHbGXg+wY4bnAQCnnJLx0ZxuwdzziaWg6zAl/Jyef6KKz9ovQwg4bHa8vgy9brtjbCmhllfu7N2Egk2RMRP8Yy5NYxuAt1CEeH4L8hnbbgtlyVBJilLTTO4A510Uu1ICznaVgRuD515Xz+ABfpKTEuV0bQB2RVbTlb9dqLMgGNSBdQoEScWwUpLUdWGcDrRBjU3/OaxcoQhIezsDm3nxsvhLMu4atwyeg0EIpaDmWQCkgZ38lxAKZXjN3R7FjTTJ+fZoNF31pk0eyEhX7mXjr3JNFyydkQRCSLvHagBuJLbvuuQO6jzlO03NNTdGpNU8tT5p7qkzJPDirsvzUK0cr8M06HuOHMz7GVgpPmHf6biuCuFp+tqG/OwBhOBO/dDl5FVq7TnivwJF18H0oXitPxlEuD2tdMdqpvvxvVNZhSMAcM+OrkK+dCgl2fKOTs6VIel2HyoMspM1UPjkh2ZE9L4z9D0mpLVj+O1xxIV7FezzLLlvbKXGzuRSxTs8mQxWvKqLq21Cc4R4vzoiad0v2xutQlaHBhH1zFcwj3+0sKwZ1SInMCZFMpKToTZCUvB5RetuJuRog5X62Y3Gj/ry6W7q3Y4Te8C71kOM1SA8HigqgHo7JD2gpFa3X2y+VLc2/S2PLVyj8VBj2UalI9M5CNokZVYQQDGPrAkavXXNXnVS/L099h6S0Jlhjuv41DUBB6Tkq4aiIl3WOx17R/zhzSOgI4gJgFPwaZz7w0c3nSTnSNDtkII0hlZUqpQeow5vGwwwQIcIatXn21D2eIqmODQMUgYmdJIufxC1AeApQzuEkXUYkxYvkdsiv79uOaU03VwXpoi0omsZtvh6SfKTReYcCEq3o7FmysskosH0fLF9GMIttohQ446CL4L5oNfa5W/aQXD+5Gl9uzXMfTC/Ti4= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 269a5393-62bc-4ee8-ed00-08dc04aeebc2 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:34:10.9200 (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: D22rRk2JWjoqhVKOmQN4guxKt36/oP1G/gqOMm6UzY0VDQgDK6kerZ2xqdVFxkZyqiZMLK+SrOAiqscJUywquQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 The common dw_pcie_ep_init() already do the same thing. Needn't platform driver do it again. Signed-off-by: Frank Li --- Notes: 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 9e60ab6f1885a..4b2b9aafad1b4 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1080,7 +1080,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; @@ -1099,14 +1098,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 Sun Dec 24 18:32:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758129 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2075.outbound.protection.outlook.com [40.107.22.75]) (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 6D73A18C15; Sun, 24 Dec 2023 18:34:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="aKCPRhE9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NQ9tjf/9zXDS8pGSne7XsNKhqYY2tqHBwJ7bDQQw84XSoLkNG86wxdjObfclqQQZnlD0tG9Tt/gpfy8+1GWwotPI+S8CW0m+L2cpV1EoEMlkqBpmtomF6HkBli9OqdcKwe4Tc2KAVrd7wWuOAJYMEiSQPvX1SXqcNzK3eNStTs32nDLNo3XVbZSHdVpQqAFzQaTvdOhoLvvrN4BV4yIw+H+aPR3VxHxplMGCxHdIFNedEZTMh/ESStayuT90dDJNfic6bGFRKwp3yMhuHFPwZdoZDo4X7E6qZyJjhLWbo7KyCwr7FLDvL53u/K6ukAp+CDZYPAhctXYaFzkGnutLew== 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=7YQHpyLDTwT3wFqJLJaY+UXcCMsgHUVOZ1xcNx2P6fU=; b=Sh+fQD0SXdfDXWOzpz25tMyrByh+fGYSZ8S7zJcYWP8rDGBSlNLD2G90ytRtiSxPb2sWWcK68ay3SoJYiIbEUKpYyCvQ1uyR2rzZmAKvyNtitNXUJNoL2mBgyY9O7lH8hxuW7x7MjxkLxW3Qirwot0wJPA5b+cOVnVi/5rfxgsH3MKlJmBC6qNYSRLxA5kB7rPASwW0abndBAuzPUvzeijHxpfiSpLj28ELpEYc8r2lWHvc5K1x6X7eW0HIMNd3w65Wr73EFAESyQ8P5r9ie58Ywz0tpCSX/dNe9sQdL3AxyWeuHemL2H9IZK4XwHtnbYE6YoiYEcj+Bzq8tYh0Hyw== 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=7YQHpyLDTwT3wFqJLJaY+UXcCMsgHUVOZ1xcNx2P6fU=; b=aKCPRhE9Lfdlmr5UcWonXNvl6HULKG97ifZP2gQy3kTbeujBu5qSJziXnZ4tb79aRvi8CbDSw8WU45TFuOFuc3bftrWrDCy1noQadhfD1n81QJ5Ys9b2e1Q3K9Zob/R7j9EYu27YA0iEgg9yZfg0PMfF1Z0DOs2Ewdq/YDfP8KU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:34:16 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:34:16 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 14/16] PCI: imx6: Add epc_features in imx6_pcie_drvdata Date: Sun, 24 Dec 2023 13:32:40 -0500 Message-Id: <20231224183242.1675372-15-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: ec15b194-9342-499f-8a5b-08dc04aeef0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t+24VW9j+YOSLEMTxx1dFMCnYdIFEHQZ+LNsoGihKGgZ+8iw1A7hQIVxSzNgq94pFfYo4uG1lu662ViAvMYJ37t0wQzROHfsC6TejCnaiFhgxDSaS/oAzvnUZmbhaoctfom4Bfad49wsBMjyVJiiYg63iubu1sAMaABmTffKH/8Q7l9mm/LE1IxnabtSYbUmCVzKLeRdhHKzQgVnplJPq/FfwWUxe5w9DZtoBi4Mf1BbNs4tEvVl0TAR85TXo/8J0mPcpzxrlVljmAFbDM1ChqQfm7AL0gq5WrDRA441Wyl1gZMd8/8ICAN+1EKvctDSHTivtOWHcAldsOeiONE4yh/3fp1Rlfkfmk4iDoBXYi3m5sEd7F3tV8vrAvjenDf+vnCsQFYrC6DMURkYMQUdwMETNwB8qfRPU8PtcYh72P/U7fKlmmfjsQ05BfJGxmdwi4KssSTaoykfEd0ENh6RswWzhADiEkBoMci7ES8oYLzBcaA/WnJ1f8eBspuU3OjjtzMHqf7lq+0DzNJtstzHiHJOMkyoV1EOXJjmQkk7IIGV8LbmVTgCVIve/1uyS5gi8g6cpjK4DmreSS94vpUYsxzXfPZYloXuTEFD44jqGv7qvgxYLrpOGBGvLiODK48A X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vHWvrnsV2KSxWMuru2F8pbTxBjV5AkuOSzbmqmQ7LGvqikS94R/mWfreYH6IY15tlelyzu0zV198oiTqs1h7TWQcUFmPVXXFbhKkn530xgcl2l4jPwFmibBNTLbcOemzataL+IgQF72hAgXXa5HVg208OkYtlglwYodQeOEfnzQYeqfugwIet8meu2POmyfjoE2c3YiVUYoP2Mq5db0Jtq4e8+HWLSDPyP5nnYWaYVYyCJlLoLL6KuTyXIJJKjhXzgRkClPNFm/bThESDKfPqedU88yVX2KL+igfGsQF+C0NzRJaLR+VYsZGjriSbyAUr/A+Ceiu3PaCdBcwi2N/UkX27ymrs1jkPemV0xkHYsAzcQXZOt6VjlgE642CFRDL7yMPATnMLUvKI5SLdeq33TM/RCsRRn+depy3uA1QE4ywnlzQKxr0zhRfQWndnx2BnxfakrBUQUvrA9DTlK2JM+hyhA8oFOw5Hax4pjvRcgw4LAQSRFwOEIHXkLqsSyme39wL3nsBRY5W9wwrqO/YOAN5ZuOP21esAeJlqRxo8pOZpinODPMd12AhuJxLwR51o9jfSvri6mprz6xn8wctbA1EkrLiiUFmS9SbwGYYVp2rSj4J8Vdj1gM1jr75KKUpdZ1mSUbaJ75gxdZwer6nqWWsVYXhdaaKil+kAdUjKDaT5HlAnS4oR2aQCXrizDPOIIzsblwCzPyqU3hREVXWRgPespdYdXY5GniYhv3kcUpXIP8SYny15CCIheqCDXYQKj+db5/zOLELFQdTf9UxXxZqveBschAAR+7Xm4iQLe1sZRwW/4bkmps4BZptPnXUrXA2JoU2WgB3oqGLfqmK5i9rOOGOh2YbTBxMZifOfcEM3FO4jWPhUZN5ewB9bDl4O8lobV92UEtFtlOXu9x9l2C4o6V3LnCPMKXtDMHKzkWh7dJoNNAC6Myhgif87ARhvEAHDnKwdVbdYyOMnqAkMBxhOfGZIgrBoPl38jf3sjXkkLHOwkYCv3RBRITSoLlKqdjK5panSznPJm2l2PGQq3Tjb1xzc5L+okTvrxB9sYp6QLINsdEgqJR6snrZnK3UEuMaaZd9/Ov4HUipPRJgUkjulemf7i/k931QGJyi4rjiYVbTJFlFFDjFo5FfANiyv0WrZUQtBtEekjY+AKmtMf2sbKNWo5rk0linsozMW/iY49ljiTza/qbKcTPMYQ6gn6dASVY8xNzrYuubZyrJY19pOJNOHON/6ghnPjjntwP/1YrFtyFb2eCf2hofU9T72pojc0Zc7Tr2AcJpXAqZztPRnm5QVo4/l3zZZv3SJdq1ELhASZnlH7EFIWHVom+tGxIlgFImMWngM7uCi+15l/Gb6iYiBJamk6U7zBfTeDZAFhYjgAdGXiomliMbxaKqTBH+ezIYbZbZmGu4u7WWBOYnY5RpnFANNDK03O5U1saL5Zti1i+xwYJ2tFMotXLs8UNPaXyIYaiXgq4uLK2cyrEDuNAm7yriIeIgyHIsMnwihHznfo8UaNsQEDCkIdlmdn7ag/VJ+KTI8RS5MbuZZ/QnUG+hyJdD/MiR25p0LAc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec15b194-9342-499f-8a5b-08dc04aeef0c X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:34:16.2863 (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: FkTP6jDM272IYaOIDgX3toBJef+beMjbOn5GbmARCNviAvsprQCAM8GU8X2IwpHbJKYCbttSGeipB3QKMN9nLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 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. Signed-off-by: Frank Li --- Notes: 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 4b2b9aafad1b4..6a58fd63a9dd2 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -104,6 +104,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); }; @@ -1065,7 +1066,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 = { @@ -1530,6 +1534,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] = { @@ -1540,6 +1545,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .epc_features = &imx8m_pcie_epc_features, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, @@ -1549,6 +1555,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clk_names = {"pcie_bus", "pcie", "pcie_aux"}, .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .epc_features = &imx8m_pcie_epc_features, }, }; From patchwork Sun Dec 24 18:32:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758282 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2061.outbound.protection.outlook.com [40.107.22.61]) (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 79ACE18EB9; Sun, 24 Dec 2023 18:34:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="afnenlQr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MMBrhloQfU4HCnJ7Mc/Qlgo1x7tueOpKUSK26VlwZI/fczBnLBXAY0GDmFxioo0p9nQ7Vmva+Bmng92bGgKbOjnQtU3PWxMLMNMMx2Aby4h2MDmGlpvcEXuELmB0dvY9EDlRVd3Tb7bU1uPnf1IybRxmAb2HKgvmndrb8nWeTcLj936nI9WQdkFoSPtCMIND0zida8jfptE8TSN0Uscjn8SdYKaqeTvuRqcJuHwZhs+SJUS1roCvq1zMo6rfu+ZZs+vnQzk9E3hc7WLVmvhCjwbxv5a+6FP5bsJYJoIx3lqvMcDLnlkZA+2IfPQ2d3o6zhsnHDtsVFvd7+ioBFX9oA== 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=KqwMa6eMbLnQJ2/DnJpJInA1vRcpd1Bx4zYAn3HEDQw=; b=Dp4r80aCrLr2RJcJFvvb3bQzx3PgFxNC+6uJkkYrSTPd04kkS2wgejSNUkXam9hHgD9jkGbRaksub7hNgflQcQEyIV5rFa3yRLrWZEDHlhszj9Fnb74Pi0LxY3rhgpIhAL4e/KnttwvkFznqMtF9cM20tPkVQ5cex7NmXV3vhBkMNR6r6rwNV6wrYMnQfnAhZPmPBbap75MCTtibBVT5gtJTmPVoVA4RHRwAf/N6aFdDahiGc51v3Szm/GLaF/ALaTU7/q9yKn07KABJDSlcMVPzaqBFOl5/2l76VHC9lG0C6JK5fMy8a1gOAc+Y9Ao1bSQuY2M2MxYu+GYUbNuXog== 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=KqwMa6eMbLnQJ2/DnJpJInA1vRcpd1Bx4zYAn3HEDQw=; b=afnenlQrnPWRgibC6erFzYcN4qBIj/LP0IUy4x/E1aFsHAe+89G1K7xZI+ZfRQtzB6CVDdsxqSMEhk/OiPD4L5npfKtNAl2KNje2wUoFhYcw+v3uGb8MgsxK2P6CCmqaxlkbV+WY4NEfg1Xn2Ng9KMQid1ewDz/nWl1DjjDIzbU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:34:22 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:34:22 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 15/16] dt-bindings: imx6q-pcie: Add iMX95 pcie endpoint compatible string Date: Sun, 24 Dec 2023 13:32:41 -0500 Message-Id: <20231224183242.1675372-16-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 020576e3-213e-4456-11e6-08dc04aef281 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eOVAPqEk0BzFAm0w+lhAHrLyGygXCNaH0t4eTt4jmtu7nQNHul7L6jiQzKf3v3dXUxqeyj/rC3o+NI4N5Dem6rPokqXtWNu+A+/AsUQHMhlCLVrD3/y7lG/VWkrf9I8+q/sLfRuEK+9L9S6r0gNb5s6DZTbNTsjI3BhJtTdFmys14O9aGkPUM6iN64m1Sr8BQ6Df17IUJoy9LrQ1KAVRvpf0WzqaMOo4pEy3ZMxqb65vVxdUwD0qfaDObtbnf7lWVcEg+eu+uUBi2vpy4sxnOCVXTBrFgtUv8iDCDCQY8WwCYqRlHuqPzcJnTBCAscsUlT2u1VJmyWejE7c1w+8C4XZxbVlCCUcPLd8s3DwuQdS9uHKiWR+u0vZ5TcjzYcjtpn2CFjsAHzIWdkchPrMaIp6geB6K0WF0zHlovI81ZUBYqVU2f4dylmGiLQjsubxNW5FEd8Epuu/ec1j7xckJ+HuLBl2RjK6zSubBlS6zmjDq1t4AhW/lRkU0/f/JFW8JGEVxwmYtNQBJk0ntekPq3Fom9ZL83woQRp9To9UQhgearlkz/d7bPotA1ddQ2cKc5K2XAj2Ax2nZ07wubCIU8r48M57n3ZFn4szJtlJ2LQp0Bxp5OqBTa+TM5kSm7dIbnaSNiag3+21XZAshmcg7BQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(83380400001)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZClNXLJpOH+EwW/sSd3IB3IWHRyeM6vfGHhIvyjkFiz0EVXqprEC1fDmUCJ0/yv9NVvvkvmfUNer5QxTy2vtRnK/gkaobpdZpAcXVshg2F+io+2eS8QiYArkNeeA/wK4FPuDWnTIT+1oqibHbKeF1XK7QbadtymxtOx1NTK4DB6DBpE+/hV5Q4i4Hw3dlpJNLTGESq1dXYf4NLq2Dc25G3B6fFQ3HseYgRS+Fu/Aj8ILPz+ulj2ajZt/sQFJ6ZvAyZLRZhbBDnnK5E9WJjZ7GsXWc+nDJHIrbrHfwevgVpQm6UoVPflseW/MEBSR42A9QQTDOuqOtdYpb8tDAB/dbezGmG84kCCyLyhwsX8AC0fhEoilpTuFUYGp0J2uVmE86DYYaJsfZ0Ceqat7gDape8xTgDP4EhQzl5rvFWOwLh8j93KtuKR1tsknNJqD4fiZ1CNar74OjXIRVHXKxXDmn4STRJ91zjtN8al8VaexjxFyL9a6+1BnsUNKBlveK1K1q1Fah3cBqGLEY+YBiKLKp3YSAY6c/y34bU2gp6frYkqJFkXzw5UKQRQ3qziquT2aFVVZ1H9zbed2iyE1MiBQuCFQteqSRFQTrwevtOooos8HA+os1HwFU/Ay/4BukpIa61fQ3eyLWAw8KJ+n8dkZt0qSUzjGrw5bfZbwNJYE4q6Du2UPCJtixI02j/VBzeBFPTYnkB8bySkya9pmZw1+aaC+Jcee7riXdEHB0penoA/uFjcWsQRqezFJV+I8QiJkNcCd6yrhbfV2ORdGYktycclG/A2ToCpXgUrhW/Vwf1ttimg1CgDgNadtDrx3VBkj2FLwj7Gm3tyblD/LUo64qsoHV0hIKCfBBgBYP84PdWR+z5CEO1YFZNxJW/G6EDa1Vd95ymYyKUZ9ltDQNuaxnhlqAY4SQp3xHc2ThASrym4AvttUswmmZ1hT3hyc/whDh8rfyrNP+SHd5Cb5uNBT5wqWy6rk2ykpzaSyBMYY9OcRigbOgNjGuy7q1lLqZJYa17fycYutuVpA20OQLAbPS+w2ahMw+4xFaH1Vxb0d4NXfpMZO5VGIqTLc8n2FotfQUThExqyIY/mjIppjezeSSfHW2pg2lgYivlxJl+yaJvuFyNdk7u+fxGgpa7CQeGgj91nROfd0QsMTOVVqTizSmzRJksbT3CPTeBBX5QAge+qa5JdeCN+jaUDtTIWZVRPMhctg3mlzUS1TOy4+n8HLk/w4kM+kKZOF4/6j/ltyhj/ia2HerAAQg/WukNPBy19Z71wDv1tXcrmm9miRvRVrIqW3cEpVLGUT1stLkrDsI3PT+lHc4KMNF/iRVI04rV81CPeRCv54f91xwDqnFVAjvyeZQVALpexYHnMVmC1VrFYoO0zZnnAk4EktYag4ZyVVoZLScQ4pvm2ZcXCdz0gF2Yj+8jadSJ4r6idcrXUNsipFGzmzoYKQnQAVcgLClj2CxP1ev+7JOuFCP/QpZyHSuXxib4tB3VzQ0oGMtuaJiGiQ7e6YGzJSp0oNWOe0jlCqcPOjhkMMH9MXyHClxC1L4NfuT9bsKftYgC0iTD4Cno0= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 020576e3-213e-4456-11e6-08dc04aef281 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:34:22.0801 (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: 9hy08R4JNseBDA7EX2Z7bLIBwsuFRXtyv3ZpBVYh8hB3b2s5hD08AdyK+I3wZyfssLyi8K72WZVDFE0+so6TtQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 Add i.MX95 PCIe "fsl,imx95-pcie-ep" compatible string. Add reg-name: "atu", "dbi2", "dma" and "app". Reuse PCI linux,pci-domain as controller id at endpoint. Signed-off-by: Frank Li --- Notes: Change from v1 to v3 - new patches at v3 .../bindings/pci/fsl,imx6q-pcie-ep.yaml | 57 ++++++++++++++++--- 1 file changed, 49 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..f4d6ae5dab785 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: @@ -87,6 +117,17 @@ allOf: - const: pcie_bus - const: pcie_aux +# reuse PCI linux,pci-domain as controller id at Endpoint + - if: + properties: + compatible: + enum: + - fsl,imx95-pcie-ep + then: + properties: + linux,pci-domain: true + required: + - linux,pci-domain unevaluatedProperties: false From patchwork Sun Dec 24 18:32:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 758128 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2073.outbound.protection.outlook.com [40.107.22.73]) (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 0131A19455; Sun, 24 Dec 2023 18:34:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="fMXAw/AW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F5vWTRlEd9Qfzj1WH7h6eZ/eqaieK2GjhVgcZ04llBZ43aLb3lplmxKZ7lPuBkauIBVTZKbI5yyMkgoCTwpj4wpiSQP1p6rX+uiIyHBoRSLxAFzZKn7VE2UV1Wqxy3DOh/VaFdAIOp7lZADd7FtdkmcZizQq1EUrhXc2pu4u7z1lVVHimWqRxrYdUqfAIrpr0asGvJcrm6Jqgrbrdm98+sEyx/i70ghsDromX/2kU2wXtrFpXrmSBE78B3B61nA08VOA5+qV7UJMgwljjfRe0mF1OPDcUGbHzV1BKQ8SIwNcHhUB9cGYi1vcUW0Kt2ZCzXKF/5xOBVdlKU4XQxsWxQ== 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=q8vo+UQ9KtGvOP++Or5qDRIkrFEKvxts5Qo6V24QQ9o=; b=TQ+KFXKNH0lX+/zOhAUD1YXfoU6PVsaLeIkIUb+qKKG0mC4EVywtrRFIAdSvlhI3bwivfMy3E5Lz3Ciz9h4xMLWPTHbqwtr/xnPmwx+qBsm7sjHY0t+XKxUwbH/kvCwebNEVYEWjPixw0eYz86aVgzDv1H00aVodDTUdVm8wNkngtrOykMB/stLrOeYc6pBlXXIUN4VXuacbXhic1ubgs5p/cO9XCO0uLMDXtqxt1VpeOGff28gs94f4sjwzO3NkFBjrVpl9PaGf9Kfbq8il2W1tZ5Zb1qQCyHAPgAHcQeu2+jqdMz5clFrLwfXYFaCxaEDGgASIo4vvXThyJ0YJcg== 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=q8vo+UQ9KtGvOP++Or5qDRIkrFEKvxts5Qo6V24QQ9o=; b=fMXAw/AWQXq++Uce/TRRfjqrYfvj4XC6QTNQMTWugLxVzWcKzn11r770a6R0pUoQA4tyWd6eHmBND8gzLe/z5choBW/CdtaLgIsBWL65Vxr9hFHJicDAib5HHjWI4SxOhuCQ90a39C3o5AE26iSX7IKKeR6DveKj28LxLpZmbAo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10020.eurprd04.prod.outlook.com (2603:10a6:20b:682::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.26; Sun, 24 Dec 2023 18:34:27 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%7]) with mapi id 15.20.7113.026; Sun, 24 Dec 2023 18:34:27 +0000 From: Frank Li To: krzysztof.kozlowski@linaro.org Cc: Frank.Li@nxp.com, bhelgaas@google.com, conor+dt@kernel.org, devicetree@vger.kernel.org, festevam@gmail.com, helgaas@kernel.org, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v6 16/16] PCI: imx6: Add iMX95 Endpoint (EP) function support Date: Sun, 24 Dec 2023 13:32:42 -0500 Message-Id: <20231224183242.1675372-17-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231224183242.1675372-1-Frank.Li@nxp.com> References: <20231224183242.1675372-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10020:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c4eeb5f-4453-4424-c400-08dc04aef5be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WoRnJtGYAWZ4hBQ4pteBgytphDi4j3YROP58YwZW1gzE2tcAktjevdHswshpLW8PHm67zFuZ4Bmopfaol2dUEj07jqPSco7WDVo85zwblZyhW1xFGsugCny2D3aESOU8wgZMGF1ThOXJlX1xxefpIwvzXkinTreuCaYSms8SukxDOzFazyOegZv1ZPLunrBrayjF7RtsPUpQb+egLl1tJLY4Zg7/nuH3xxI9IhDFnbU5AsA/2gWC3vKro1Flt5yX5PAQjKKUB0SBQs7O4boAXJE/Vl0OIhRtm+vPm9Vm3e0TsZ16GWCm2n1rc6VFp71IJHBUzlqBTd//zEeLS9FixvY07aXkd0d+6aVUtiXBa0XSuADCeT6FzRsRrn3ykkqM4LdqpcFy7c4m+ekMEvUuk4FW6Pu+sKGMe2m922rR4fLVYlyck+JDv+qis5SZRc8GtAKLeodN4mGsh0xmXBDHqTPtki0d+OyJcznuSZ64F+FET+vo0QJweBLTQZDviusz0UvPhttnEnPe7/IU+XGaXu/hCuGjQof1C/Ps9C2W6GIMG5FDOQ4gBR9lagyb3jp087/mCVQZ6K8kxPAy3DuFslg6vKz9RRhKmrXc/0yYWc+Aq4ddMbdE7R2S9ZhO7oCe X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(38350700005)(41300700001)(86362001)(26005)(36756003)(2616005)(1076003)(38100700002)(52116002)(478600001)(6916009)(316002)(66476007)(6666004)(66946007)(66556008)(6512007)(6506007)(8676002)(8936002)(7416002)(5660300002)(2906002)(4326008)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4h3S7iykv+eelqByzXHz5B4XL6ExPmnhpL6/h1uwXLY9CMYnFcjtxrSL0onL6j4hNCLpyVGYjQTc3zL1GyHK0aVOOwd1QozIxLZO8cFgAqsnrPA9zqU2TS2bck/iAPvj4G/4OYzsgfPKqf9IVq4bRxoZLXhpDp5CxYwVcoSh7Hj0DmKodJxZYTE6bnaxnsnez6Le22niMRwdXdAJMbpUMmmVDyy719Y2+kTy3jSGGOWm6+FAarLQHLKt70rh0vhsySWZB8H5wdVHSPZ78/znl+qifj84RPPMqgOctVsomLvyXd5dR3IxQIr9ofHn4SQ4kWmZfgPt3wOvDoqiCifXYR4LG7mgF5w0LaReUGduiceeRWKykDFgtZbUIC87dUzWzqz5f5Gp5eEZlgYVDgbtYOxmnWYfqk4zer+kLOQypm+2QMhCo1sGP0a+FYvOU0Y1y8deTB8r6KJEsnDiCp5ujBR4kLJHbx55T7jYcWYG5vAkOc6xtAIAQRBxeH9NC5WC+rBIr9ReiXEliov6OqE/lYNn9WOPZbr9sx/+BUSEkYyC5D2BCyCm3sbWBEi9qMg32fPCBVAIgFZPi//8pjq/An0Ewpvep2iJHvmujxGiJjs3SNHhMRzml9NnxDMMLp3rPy9jWFHwyv540Xl2flY0TrHKPXn42hivHbkuMVd+TaaCyF0WLnqYvQgzMZ+BuzqOhPJisY2F3el8dpU9p1KEv6g1NLQ5C2PxwIwSI5oxYRhIG85uyld/LtWf9YPPvZZ5gQLt7CUTxEcdA/CEjQwTFsC5mGjshZUP2Vc02DXiG2iYr13nuHDXBjFOuzPAMe9MXAzqJ/u10Jzt4oWNBdLPd5cTtz/S7iDiC3RdIyhPmZEQ7hkBAhH//cERnU/WsgKbsnB4lH/jItWEi6aawas9ux343bH7EuSQtirYs0HeD86jA7orRlx2xaURDwaaZQwhviy88PG3RcCuK6hqIKLkaguysVTaFg1vHEtEKfNGQvuVBpwL2V5Agf3DEojaQIxrQkUqhp+lf/SX9ehCkxytkDWQ7gsSj1YRpOJz88nbutI3XJFVM2sXLsB+P1E5vDFWpHD8LMpSTfMp1IQekcDibuDZPEo3FgCEY7clEDMe9uxPFFcRt0ol7FjTnkwk4NEaLYC9jP/lALBo/2Q1cJZB/al18jknEwyiBi+sEvxyy6ZvagL6xNPWHSdcg1EOPUPDa6dmQUkjBBVr2czADEvzg/TYPt8kBa3ISzktp9jjM++rRJxqU3WCZeXZbT0aDUwM3hrhNIng5aDyvdrB0BEIixMw+0ouJhyQAHI7HRfHWCb9WRs69d5C7VSdbl0eloOaz8P2J4wCl7pg8cdv/eWTC+UnGNWz+5X2w2F4FSU9hw9EiM0WUrKY9Z8ThiySumXcRQd5i8OhA5nu4CB0Ae6ige96qHQu9HsY6YfFzHorxQcBv5zA0ztlFpj578NlRRfl+nQ7y8KKj7cKge7y5ivLb9Xo2HGsCJxiCZDsT7NIXdRtRPs2qYO403tnJaMZeU6TOG3kATBgNcq/0CnwycyY7gmQyzQ7divTYJBNgpBmdJM= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c4eeb5f-4453-4424-c400-08dc04aef5be X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2023 18:34:27.4965 (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: 3QkVbHuHej0zRXxns8n9BRiyUHPEu7WRq+0wElsdAZ9uOyAcUq+z89odmAEqV0lCtYHZc8RaUlxvjPSYXzcWww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10020 Add iMX95 EP function support and add 64bit address support. Internal bus bridge for PCI support 64bit dma address in iMX95. So set call dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)). Signed-off-by: Frank Li --- Notes: 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 | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 6a58fd63a9dd2..00ec59867c17b 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) @@ -620,6 +622,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: @@ -1063,6 +1066,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 + * | (BAR0 is 64-bit) | if BAR0 is 32-bit | | As Bar0 is 64bit + * BAR2 | Enable | 32-bit | 1 MB | Programmable Size + * BAR3 | Enable | 32-bit | 64 KB | Programmable Size + * BAR4 | Enable | 32-bit | 1M | Programmable Size + * BAR5 | Enable | 32-bit | 64 KB | Programmable Size + */ +static const struct pci_epc_features imx95_pcie_epc_features = { + .msi_capable = true, + .bar_fixed_size[1] = SZ_64K, + .align = SZ_4K, +}; + static const struct pci_epc_features* imx6_pcie_ep_get_features(struct dw_pcie_ep *ep) { @@ -1105,6 +1125,14 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, pci->dbi_base2 = pci->dbi_base + pcie_dbi2_offset; + /* + * db2 information should fetch from dtb file. dw_pcie_ep_init() can get dbi_base2 from + * "dbi2" if pci->dbi_base2 is NULL. All code related pcie_dbi2_offset should be removed + * after all dts added "dbi2" reg. + */ + if (imx6_pcie->drvdata->variant == IMX95_EP) + pci->dbi_base2 = NULL; + ret = dw_pcie_ep_init(ep); if (ret) { dev_err(dev, "failed to initialize endpoint\n"); @@ -1355,6 +1383,9 @@ static int imx6_pcie_probe(struct platform_device *pdev) "unable to find iomuxc registers\n"); } + if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_SUPPORT_64BIT)) + dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); + /* Grab PCIe PHY Tx Settings */ if (of_property_read_u32(node, "fsl,tx-deemph-gen1", &imx6_pcie->tx_deemph_gen1)) @@ -1557,6 +1588,19 @@ 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 = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}, + .ltssm_off = IMX95_PE0_GEN_CTRL_3, + .ltssm_mask = IMX95_PCIE_LTSSM_EN, + .mode_off[0] = IMX95_PE0_GEN_CTRL_1, + .mode_mask[0] = IMX95_PCIE_DEVICE_TYPE, + .init_phy = imx95_pcie_init_phy, + .epc_features = &imx95_pcie_epc_features, + .mode = DW_PCIE_EP_TYPE, + }, }; static const struct of_device_id imx6_pcie_of_match[] = { @@ -1571,6 +1615,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], }, {}, };