From patchwork Wed Dec 27 18:27:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505441 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2040.outbound.protection.outlook.com [40.107.7.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 3C83647A4E; Wed, 27 Dec 2023 18:27:58 +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="GPLuXs/p" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YuOmKwuU7jQ0kQ3Ynu6Lw0IzyOCgL7j8MOmfuIA9oNYQrP9RNGwjAobVlRUGjIKi9zZR0yBpfW2vk6AV85fxHXeSPz5F642RWbPr1DlzP9jEcOefFx2nnyqpFNlVGZQSWeeIG+GCUzAszOq532fhDE3SyOEX+LjZtLaFKIViQ7fXgnN9o4K/9Tc+/8YAngN9tjTDh5JAlRAdCDLCMPDdx1Zbhy3LnYqOkNGLuMuz9EQgkiZ6s3YWuA8XRjUABcD00pFeamko5iH9kVYFDf8FmWkvEwi2ATKfr4ezSTOJYso6IGUxWJDt3dSOLngDCaC/A1/TEZC8nywb17FO89zFfw== 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=X4KkaZLQuQiwrU5lb/57ZGEergFzle9h7/Ft6/ys3tSg331+obLljd7Bik4XOICFifo9svqgGJSKsv2mmApK9bKKMoPR4//aPXgyczEDgZxL9exjxvnJmyLa+RrWoXDUyYmrftCTvlpphIwoq+rbaXxO2W1D2lWn+myy7cmvzz7SixoaCQSm4DOcilCCTdYfa7YzEXgFm0hszSqUNf2bAuhMoXqmOf6DRywtRb8neyKWSzbhdCoW9oeysIBZvFwQkLxeKOTJ5OWMsaHLD1ESAXc+FlJ8NzqPADTRgGvMmNvfqpXlOftYDQDIsQOkKTUwvw43Z4/zfKtWGZm63FdKgw== 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=GPLuXs/ppBoIrTy14dlWJCVKrPWZWgKtB5KFhf34K/bhpLxw1piZ1K1IY9zPoUgjPIjx2S893IAy8XAqMMI92vq8itxei7VADqCxAkhXR5ShXbt1HNa1GfNfJr0C0J0g5d6gaQ63dVTtuIMitwDR5GtpISTRZlBEWx8uYK4I5uE= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:27: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.027; Wed, 27 Dec 2023 18:27: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 v7 01/16] PCI: imx6: Simplify clock handling by using bulk_clk_*() function Date: Wed, 27 Dec 2023 13:27:12 -0500 Message-Id: <20231227182727.1747435-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: ca149d39-283f-4b11-3868-08dc07098ad4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8IrBct6uyGR4g04ZZpbPNAquLOXP3avVbwZxRMmuZOkhzn2Tq0XP2m2mXlCHyMSXcVgRXGp4elLbr4h0SE+Wfm/HTIkteuP8AeVNhPA1Gy3oY42wPrqctlg6IyIGGJO1UQRxayAbO9s24g6in1gU0knALwa3ID1gMD1w/7SPdBY6EvtpqT51MQvSoHsqjzMvHxTMp+YMrgO7WofdW/BKI/dQKrdfBHnamOY/Od1g9jN3vuXudAVpIe4exYN5tIoGPdao1ZsiUEyJ6uE374Hlzhqc/3FAZyJ7EAqF3usZV2k6Pc6NHVkdi/cz9nO9f3bAMqpNBMs2IEu/B67v23bbkqwo7tTxRz3tRy8UAh2sO2z4yMyilE2yI6uZwlQ3VvtmKJC10VKZbqAB+4aFKzuNXidHii2jtQAza0f1ocBRuQA63AuIwp2rr1EHS9YKRFszrLDu+gamMMoHWw6FdCM666A9cbHWHP+8ver/rC4sQL5Vf/47CdCukbCiOIJ2cEGcgpFHTitjVtKBY9JWD5soYMVja78721YENws9qcDEOmbhkcZPBJhEbLRyfaZesQQIIUbvn3r8Pcvd2Q0GwGU1vBrs56xrFc9/1EmB71UxRudbqiQmVbMVGNWW2FUbVIZM 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /X89HBIY44INsZco7sK8ltLxC2iSOhex2EtIjPEl+CXFj0Qdwszqi4lnxwC+sZlx7ojAoHBysbkxw6sIrrt88n7uvlV5qCxY7mvGCKj8zF55lJpbosWvCV9/UgbYU7qP4Z1NAtSsgjf8pPy0aVupQNFwovsBpgp/DKtdFLnDnSNSVMgyONn4uzaNUxzCuu1Ona5LQdhnq+O5WkYuYPoaodkJA7GbjCH7PC1AuWmYLVSz+8bsdtr76xK1/Qds4++1W0d9SyVmbm/A0HlNYJPRqOUuigsiqFcejrfxb3cPpF+3l01ChqNTUApbSRvo32wQ529tNDV6+WCZyLZ4pHSO+85HSWkeUGxaInNwUOzX942RrRJ0cK2NFYimX6mM/126H/XDyn1HfC67Oytc0SHgjR8jpmahafnZxt3V087DhCmo+B/beOtFiF+Qw8zVj/TqIAzq+UH77h6eZ0LDwdB09OxPdf2QAYnJVaLqUPA7GL7Johzqk8CVWOKsZyQ7V9t7bXHrXgzQfK5dDtxBGhyTmmLG0oPXeAISokrvtNcOc2q0l0LdBcY8474naBYnkYmQUKZD0emPN96l9PwU5NDCKCKpbbjs5Sfo2yIPcLEnzixcZpjifkReapjTAKWBXqWQEWRRSG50XeHi4xTAcXkzBGyQ/EDVyNEjP8iekINbbxVSxrj9q5jaWjhOEXS02J5aPLabrrfaN0zuwX0ixnHrHKIUSevioD9hIV7VTM0yJQE8dTa9wj9OosZYBR453RQIyAXylcy9Q82EweIQ/c7DngTXSmexTHKCkjzKOD1fM6lxUZ9XoLfT7+p3tk3SxaoO78YegB7i+Bg73x/tiaOZZ56aXDTeHdyVKjkh6+nzFrqoeNMRtY/gzxelzrO5Is1ZZaetK75oh2v+YPOXsXRDrkiY/qcap5+Ehb8rVS26bTyIrbEXgCatIvW/G9Fq4TP2irIdabBtjCiqfHQk/i6KT4HphLSS+v0OmPunrlqI2LBX4+tv+603RLHV+ueb6yq6STuhxyaSoOaWMq7nVMBVW25ok3oS2eXRTpy0bWmzxP91CY+0WvRkgCFU9bRenSBrjgBVvmemw+zO7bWKh1aQvZd92S1+dHblefcLbuzmRZvB9ZlI1dLTEDzGU4drbV3pNVr/SMX52huv7981ekgUU8lT1ZajhbghPYBmH6OveLSjgRDJDzo4tBNy6bELukrPCGP+fcVk/aXJNb7MpITvCz386YxoiBDQe71iYyt28p51/DWBwJ+aHiEVA/e6vZcqW9XRirb/GGgrNk+oETRzKBzGtVrW43SW8V58UwKcuIiYBsAV7bWI5J0eLHnBd4U9AXg1X56u5KBRyf2TMR/T3n8td2uZUu42GekjdmbOWLdXG/Hf/+KP+9O+ABsVZYSTs/JWrneW/nLPA6OJXmOmLSQ28WdBiipIQmNIHegjHWX7FwJ9BciLbLZf3MASY+3IGJkzMo/RR2+DiXjXWimCxpPp18P0XhK5KBbLPCmm3ZZxJDIWt3PnXPZ5kKNAChwYc4MMCpzBfwEikSXCzfhZty0LfVxr+m2e/6j1ew8KA+s= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca149d39-283f-4b11-3868-08dc07098ad4 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:27:54.7986 (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: UnydRHcGo+LBgVDn6q4ln91Dr8PZReiutZvWJUWGoKcBsWfcKkPOvZ9JcDV3Q46nzax+Kap7ebecFrNgsAAwjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 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 Wed Dec 27 18:27:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505442 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2059.outbound.protection.outlook.com [40.107.7.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 521C547F59; Wed, 27 Dec 2023 18:28: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="ZbBE7JFV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A/wrnYWzBXWArttmvLKxi3yRDPvMvNmH6aFUMr/tuY8pGg5+fmamknEns2yn8xYVNdN42PZ4rRUfpDRdjjedqfvmtct6+IPhJ2uNj5TUBJc1yJ9JjPKFlSPO3AasLYm4C3p1TklRpk3musbsiX/RIxd5RIHoW5KaL2KziK3/wl5o54lJJU1WAI/sDxiJEFgNpSpwEdELtfZY5MlxL15/mlafSKMiuG2rdyCHcWROdojLswhEecdWJN+FLSOKftpITNxlxdE7TteBbduQq2TYj0dQMS2mgoW8z7PDNiUhKaBRVTcejEHK76j2Qw/0rsr7CGwRE/3tJekBsbH+qW60xw== 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=b5ChtR1ensu6ie9S2Rtxwls6LsbYghP6BPoJnGouwBu6zitLBT7H6AY+JI++rU+cC6zYyjXCsGA6QuNIwe2rA5W+UeW92kR2tR9ywXWhST9rzhQILbw+yep95fJdykJujv97S8Qh6TBn43wZEeRiaBfLVMgK7z1NdZ/AR+Q8qmstpN19ueJGpzccOHcoIrBz+V2UBwe++ZAfjZAaESX84ot2V0q3kZB5BItGGd22VO/x9khjOdPSez/QkSZypeelu2tjHVbCHsrUBJOif/XyDxzifpA5jKu5fMnapidpvHaut/RLb+3MXIPWvXXwN32bplHa1m3HAGntsmGvOY2mBA== 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=ZbBE7JFVhJO6wGoMxXxHklAOobo1bWHxn90SPuTnbIzYSt+AtpA0ydbzybcbKl6Vk5ZKlbaus3k4c+0cVRqsBoPfcFXfCPSIWukE1shUuTMbfdMwNFOTDKVkaOeuIs5vxVRgz/WCdEIrP/+iCGPY3vHO+PWtzxmRfk4UQn0uUb0= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28: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.027; Wed, 27 Dec 2023 18:28: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 v7 02/16] PCI: imx6: Simplify phy handling by using by using IMX6_PCIE_FLAG_HAS_PHY Date: Wed, 27 Dec 2023 13:27:13 -0500 Message-Id: <20231227182727.1747435-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: 4433da78-0951-4cd1-87ad-08dc07098e0f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XLi/DPC1XElr3fbE0kfERG/bgWdJKYvwq8lBke83xcuAItwq9fg2h3QGHWNP3xBTW4yDTpRz35D11Qo0SuYDLH7L6dLOGT21pPf1TFgkiScMpAqNBiaqYyxe5ctSAGMA7ugHnrMOAZgnind4IDO4GAt24IxCCa/Ji1InFdg8Yul6gA4OIoBWZO7MUvBclpM+wjzmCLsoqoUW5EwjufEJ65MXw0Gx+wP9aCqT7TXj+vv7NB7BG3lZQHzaMMoaXgwgj2D8Tfm76muy2m+QK2YBmnic0LVUD/gHCY20DbtvgqzauAS4ohhuTksBRL9V3d2pBqw4F50rm+fCcJZ63pPPjWaMTT9qPfUDBGiCY3PyJp8pvp8ehZ5gwEhDF5YJKi22ePT1RzBrA4CeqdY35Hg/q7VJGGHSrmfO+eI1aIZ/kbPcovWiXTI0PHzPoNh5gnpNetMVPNORvuU/C+Trchax/Tf7iNsuPordq3xXqd2pehwU/aBp96IbRKW0+/fPBs/LYGppMGrTCgoxU+hc4sBrTCpS/falRil377PgS4Qyl/VLUpgtyQT02p8vL/uhseaQpsYP64n5oV++LJUFPY1UfxhC2da0J3xvVHERGMy1PYU9io8UImOKiH/URLwKNRr9 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BtAvRiQxKoFsrNlmQVrWDWVlNRAghzmNOKZGha45FySnZUFBQuv0Nd6tElAU2xGaNdQicM015Y4vEmkWCeq/YjWG3DU/1MDi/4gHBiy7R9TA3yjJ2qyPPDr+AtHURqgh5M4JWaEF5/rZ9sLddhAGLQWxbBPzE4vlNbdn6Vk9uJ2YeHyPzBI9wTB4uDvHLYkLPpPVHPnLCnLLgL8NVfa1SxS1tsVuDUnUm8AloPY5hyfikMeaRLkAGH4zDh2o1QIX+Yp3iU3A/f3mXZQOZcAbseO61bGE02OBuACKNQrfzjhsq5AC7umR6pNPLuAbNXcr4kYITHIz9WKLkfW7nRJB7N/nSPkJffYftnpS5Sz986PpkLkrzfVopUukRWdhIzJWsE/MzZL7+lyAOIWL4wwGIalreOhK7LYCsy/Q6bcbEMFssCjCZjFondSJeA888pYG+PFXdqP47qbBFtNLUFpyzb2l+3d/87EGPTCh8FRdJOhsDwlnLS7jlTIThb94Ev4rn+ha+jrGJfW342T0iTwuzYy8S2HVoF78Wkp9rFHDQf8isey/eJFLLnvGri7O5DczgS4yGnSHPVfhnYVSzaAgXfeE/hYvoUIZ8EfEOkD531B0956v0Gn1SkgXanwCkUxExhs5Uk8rK3eX7q0QHxrT8YduaKwojGRSmFvXlYykSSU+F3I6d8BIgPmTVD2tl9bqqTx5inJoH0uIjokf6SIexbK1z6LBdu2gTN4K4tcQA7//52cOHNvQR3xoYKe/aba2cawFjo2yOsA6/TzFazTzrQEMx8+9i95FDCscoAmpD4TytG+tlZwdVuW8dVJwzWbrHOIC6EQcxAGjdyfPuX4fWDjQCecaGsBsSRGwtPg0wgFOsxG3Xl26nKeDH5Q+SwBnr8wwQ7D5RYrGqnjHpG/gX3fLGkV/ypR+Khs2FX6U1fFuowfFjybAWrsDkt7JikNYdWUevh4DO1QadllhiOvtvgV3gQzEtwjesXvkej5rp8jHuRKHcd72dlWOCOE6l5skmGj8FW4P4YJla+S72mWjIArF29ljejdPkzccplUFQD9HOIZiEBZYenbeNp/Qv9F+XJyJ9fVBIDy2w3pfsu1Klwx+4xXd2ChMqda+5itbYVY0u/OPKip2g1qFJgYRuPJJDrDmlukoC+qUIcRZ0dDeqtyyK3YbE053Vy4RmZKlryIpyOtDKnFCmLp2vrgXB+mZguE8nM2NAQislGg44yf0ySuczmdI+6iqV7DnadZ0XmmfKURciCIC0ziSGUdU9iZNe9hq85HpAlRJZ2WKwJXYStAITGZQEWTMDp6f9L2t2fzhB+4qwgi2eMS5Izu9y8oMLG8RfB1054nFq/UTg6n8YRelNAsbBhyxZPRMqCcd1zvsiXbGo25bykjX6ZYB0A5zu5LLwp/2uX/OnEVUQLHZcuryCZgCyWeG8mBjtL9aLQvI1CsEX14HEhjCX2qVupQXYjT7MsF2KpV5O8ZrRRtlNk6a2VjCHU+JXtVX6W7WYejkGMJUmOH87o4VX4C1SA+lLxeYhC6gmcsPQZ1bRRcTWpQd4Cr9oQ//YfK03Eyu7Lc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4433da78-0951-4cd1-87ad-08dc07098e0f X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:00.1915 (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: u0VLNrNOedlG1hJFrvsJ1sZxbdLxrn2ocsaeElti/S3dbI1734rtSJTspIG5AW7JE5l+49YqASU9V1LqLeMNSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 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 Wed Dec 27 18:27:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505443 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2089.outbound.protection.outlook.com [40.107.7.89]) (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 A214A47771; Wed, 27 Dec 2023 18:28:08 +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="fgO6asKJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y1N9rD/QYhGQq0LiiPJDtAScB/31lrsSqjWVKZqdBtuRHvzaABBPyy/ja9TLUDuslWXV8DGfdQY6Kce2AkeJJK/tPMxd5HP8CcAsqfDmnYci8y/f4kmFF67eodaBWW8qsgDRJ/EGONr8zmnPOHOj4A6crTLxgMgLfYZGu804LNJRsiCfjXh3LTDHMbkz4FuHo8c2bQx4nNoJJRuEzGLufJb25H7aSxruQlcO6afXDPNL5o8lrg97lcvr0gN8JxDY5KCfYrDLJEbbOrNu/k0ewbuxT4y6hEqJ064mCpH25I4BHEYI3DjL3FcF8FnUIh7jpBC36L7iuseDv10lDmZW8Q== 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=FDsoJpjkkkVnXMY8E2wuz3GMzmFuJF4wV0DhL0655leXFt6KiU1g/7D2D3NRJtLyWPjg4hqXPCKwCtKm3NiJVl1oebEsnEB3bNoouYFzsBml9y1gc9Mm00OGn08PNf8wi9Mhzz/fjo1K2xhSPeKc7vMOma+flzi/6nbrPpLpzRJWYlJZ63NKXlrFKrTQDeM/oRb6LxtInNLc+hAh9zcC3r5AY5CTE4YjbFeplpddKahDXykmAqkOU5ncX9cDSTx8Mrxq7aEO38gqyBPYTp5Zkg/wCgyWY50QeNkuK5iE0JxfVFJ8I3xoxssHfZZcRhOCR/YDQa6rqIByHnwRkhwfmA== 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=fgO6asKJ67uEFxYYXUVxzmsou9sp7JmdpAYsLl2vhOWiOgx0k/AVDzVtXdq3ar1QCI9aEq5h4xa1gY+7lfeucosH4M8VM65shLEEWIPKo3jRngJ3AFMZiCawSA800uTg3A1UpE/gRP8vAbscjRPNd42vIOw++GpTiavCDP5tk6A= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28: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.027; Wed, 27 Dec 2023 18:28: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 v7 03/16] PCI: imx6: Simplify reset handling by using by using *_FLAG_HAS_*_RESET Date: Wed, 27 Dec 2023 13:27:14 -0500 Message-Id: <20231227182727.1747435-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: b6e641f5-cfe8-485b-120b-08dc07099146 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zAnA8Gj3TRLWmnqsrOeteb2KDzFslKmLtO9jo3umbneI+poGkbCc5I2PW5ikNQqaJtDYXLQCNUAlXBJKB1ijBf1PfTuNwgZRc3QsHL1OwvqZH4J7bfGJC/+Kf5h0vto3R85VviVSSKcmSsqzj8EuIhjBWu0xOh2zWRDg51PDA4BqM75W6TxA7vTUTNrsB+4li3vBx4F8RA1+w7QKgBPK2e44R3jWgF2PaeGIcAjGKlKNoIyjX1nbTSg0xSPpSyMuY3z7ee444Q3PgRQno9h39mdGvqTb0/2R976Hd7EQOgE2/auQbn0j/1WzGiDCGQqUk2pneLgUPnIW0gSF9dwrgbqRIqOQ4xvUCwYTlNfjOOYo3pZ0JQiKckG8AP589Ckoy4P5bZja2tT4gWjxnLlC874W9UIeK+6qfSX4JsQP1kf9pwH9u2p0ZgCPEzTMBwmSx3MJquqrayQfkWr0LOwgkavVLZW6giw2Wytn+oPpiPESSCyPwDU4WwFf2bvEES5chYVtMARXgVZXKOH5owq2XPRD8gde6cELYeDdZibHXaKqMj6eEF2p3Z9Jc2TP7xES0FINXt4kC9q54VGETcDzc5ScQQlizKJl7bWzB4C66gcm8/M5/VkIOqxs3fYnsRVx 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jqoyXje/A5JaC0aqxXtpNBaxc/EpE23a8eyMnDeHQTAWIkh/X0BmO0F1VIcjcGpHXcs8xYjcF6OeHyqoyQ/HpHOax5rvogLgx9IAWETID/8HQGlsI/mkq5M9b6dE+duKF+N3ADyB/tBrpFdj8S72c8BBi7Wg65+k5Xlv8sxZkZZzi1cOC8v2LVtY5Hi+SCzO6Kt/NQcaAzjWzmCQX8GsuY0cB8txvzBKJFQm45E52osAv5puFBjEo1E8D7kvrjALtWPTxVtqvYEBdPS8AEI5BKtsCNIxQOSLZfzhmAm5pmMIpIlY7auAlaNbPUFoAzpqPVmTktwD1BP2FUiyp+M2K+mpsnTEBrVU3Suck1V72P6xlyx1SFj5zGDoMwqzKkdDvyQACNJJ3bfDKvnTRlv2dl0fK1MeY0m6ZO51R9E3woP7GsJLXEPICSqGu6DJkO4Pn+ICtllYgHZa/ThEqgaRdDnU2b7YQMB/UhCTFz2C+p1laEs6xzo+ia7WoCT/Kv8sqb/3bKmjORCkeZiXMx7WY/piWz+r/7ZG1kuSro5KcVHVZjP/L6E9cnXBtV9ypyh2/D06RaRp0uwGxl5YmyPj9e/SskCaL1Fw0xK8NhBJE7finAh44MYQQA0+DkiiVmbXX0p2MFi7l4mg3KZ66laD4WzOlodfZZ5dfIsOYIhbFz9eY4bONX4TYHfkiQiEP3bdq0V/kyjCs0lfFFb/Oaxjcmh6ybIcM3EThcFj+VSFTOa/RIeYtcjDAR7JAr6byKjSWoqzONk23U5Om7Og0L0p77W0THErByAmX6WWhLdclHYduLS5/EeFUZgxisYck2D6T9itDZxS22nmosHBG8Bj40F7Xt6XMRdBApUSshildCFoUizGAsoq2xO4dZVSt0ta9qiSP2coC/X4DjSaebru7PDYw+OAzsyui0DSrQnjtS/XVt1Ay4XyesQRdQastFC6XHPRsHnBsq6XFmxM0pPOpTiTQZhAbB7D547xnGn3F2/rRNCODA04YlETY3/Xq6RwouWyZHuOIcPGcKkHwDtBigEVqM96M9tceKG3bwpQSLb33stmFs33bw9/3wUpQhWjt1gSFoUVosof0opbkZJm/gi08a5YcQAHHSvbzY0pouJ8aTyRpg+3p/1NWHV+LKlXlGALvobFcLeYY+YS8bvj2SSxJq3QblVx0nmf9FJy/lqNSkj1t+G+53GEaxPh2t4n3GslHZ3LPc4ekfEw0Uy2TM9ZbLmHWeiF4aao2+66pMPi5YU4geyXtscIzyg9P7QYjvGFQyL4whUiGnfSy04Z/+H9xy4fBnVDp0NqSWSAHm/TCe6C/tKa1Xfw2oDj/GiEpsYZSd6QY4NXQIgiPjBejZ4h4TVvpoJBjjOOJ8QZbZCFzH1X2gttKSEhYiVVQIjJiXBTVnkuAbyEQELKB+pLUcjKhhRYvi7v+QpY4G0JSJtdnPCCmy8cJEB7wlZYGJR+0ndOvnDnAoXp/N7+27xKqHfafOq2R5Esx3ANtNXlT9FZmBlYGMRxoznl6TNPmOk1gVnAw1rULzX7f+ePt37f5ZdNbZShME6nxn3OLBPe5jg= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6e641f5-cfe8-485b-120b-08dc07099146 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:05.5804 (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: oMypvFw7fA8q4e15XNrcUVIa5D+NSh67h7MnhkYmfavPbS33IGRR2HXvsIMtJwBbPQ7ogU88gDKHchPPwtBmUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 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 Wed Dec 27 18:27:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505444 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2085.outbound.protection.outlook.com [40.107.7.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 AFC12481C1; Wed, 27 Dec 2023 18:28: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="CChl6rWY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=alNXx3VVpvUUx6ji/Kr/PCl4okzwfcnTyYkVshlt2lJjox6nOpEZ+H+mZusjVx5N9liAJt8P8eYUzFjI/sNlJcHq9A2cZXr8wnxeJ4G4SZNXLtN/klyBs4FUV9d3nAnBUKJZSDNx9VTgXFbyv96/af8NQc1qQ7tOwPZKs2U4fXxrFzvlRLMB3GMZBXCFzrHwbWnJULDy8A7KzJRcZG0DdpuUuka8pajN8o9h0a0Idtt0wWRHNj7Or/IhQ4R+UQACcJVy/HNcKOrJHWlzciyLIF0VxgMwjFgAyuAYS5WeA9zPEmHO1VSQquUgA4R5x7XDRvwrYJDp5PqFlRtxotnPCA== 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=m5XfGjSuLYLq+2xcL3kvQACtAfdEWT/epmFiAo5sJlbNWehcXbybyaaEpxea8iu0w0zmygKwMMP/S3MAp5SFAh7bX1LoADcq1N3ohAVeiIjnA52Q33l42aXok+sLRwAx8r09X+32lCwjs5SU6kBQ2UCoJ071Qf15tRAV+ZYMFSFMw+vdYYGtFxdNMmkEn5oZ+4k9fMRzcJOcRyVDePwOCvz6N874eyUdwJ2uOw/os6LOFymIEplRS0WcBGh6hK9xsftuBk1OnrEx2t5IAsLRT390nD/ph9bTDTD6joV9ZlKCiJ17xXV8g844iEh6FQgGL8vvo4nTfXkKM4BWJZ04MQ== 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=CChl6rWYme68bDkgcuNBSDMT/MFXYj8fXVbbQ3KSr+YZ1GhsbGKodEEex7fVz3Wbad/WCNuA44NuIxI9kBU0ulMfJyY/I1AFiXwTe2h9QvXGvG1XI3+ta1qEdKFRdfqJtgoYHamMJT3W+p2MHuk+ODYaZDYpQLkzgz34ihlkQ5k= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28: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.027; Wed, 27 Dec 2023 18:28: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 v7 04/16] dt-bindings: imx6q-pcie: Add linux,pci-domain as required for iMX8MQ Date: Wed, 27 Dec 2023 13:27:15 -0500 Message-Id: <20231227182727.1747435-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: 897c047d-ba04-4f56-d7e4-08dc07099477 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HbRILfcstCUCGRdaiXE9MoFvzdaZskfs21b0Q8y5bWSjabtRnxBEOlekwMNhKxBuR1dQeGo5XXNdUIg1EzmeIpnVqCKdGPHk3tFFSf9BmMTVJLSaAYo8wRH+IXN/UmKxkz0QgJXOkSIs4/eCrV3U6FFdvH6SdL6ddrD1rv+O4e4r38ZV7zCyhx+1iMZSzh7GUj0i8JP3dEPKd2vvq+RgSXF6NpC/+36VZyUPEnSElBQHo7JRLrmyrC8/z7c6KPFJut9BPj/cO+xFD2C0ygp+gU48xJvu8YfWE60X5jsNYSmnkq5IB1EjQv8sr0BbHvStohdp45tTyeT6beb32Wnba4jHMeQIxiLOhD5gcFR/WPXtLG2ovMHQW3Z21jROCyO+Ec7b3mYuo8Re4wKD8lxDbO247QYfFjQIOn3zG2q1BdrQiAUFFV56fy7hJhjizfYTIFLWhN5jsTDLp0t5oSzFFt6angfkasxpVWocNgNNJ/pZor3R+6O86CTnAZR9zeNbxsNslZGV9ihwfD40A7EgdyvfUL+3jC71lVZ3aZbvfZnThDyX8N44RxRD41MwDG5uCGhXOXTFfVhZSlgIeVtPGQL78wfzneGHnNwInaRoF82sba9KwPA45EHh0kQgVsiPaj7RYaOxpDaY5Etx6RBDvg== 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xD0tJjjLNketT5puMGBZrvxrpeeOOYJybZzEewBeFnUZdNyRsSe5BKP0F6cxCvQrANtyudOoOQJzsUptoEeCl6uMto9vXC3YFfYRkVbrjG/0UnRKioJXYXZVClHJYWKSujtnZlhXLpC+S6UVaQ9RHnWROVX4R4Bev7j1HA6k3r+kABwYenV5SQPoSMrWVtEjIq1+s2KbdgKa55xUNl3PGlM7zFWum48nnxMRYtB2aXOPvog6vla11qMaCnIqFyM4OPP25OtoTKq1kVmocaYHttukUj/GNyypKC74yztWEB4Z+1/B8XX+sw1To5HBw7L+iYGLvvlwSzx/ccBj7x5RJ/7v1dAEkjCO8vEHrbFurAKQVwHq4tHxFLRnXlkjjW9HT+H4QeD4uj2loYGAXBPtWmOCXL9jIeJBYItjiXZKEraQiHr9AeH/y33j2LaWcOFnA3BswBGzYW2JEEvzKj8Ti+NBbkhKQvx0KlTCNME6eaoI4L6lFtEypJls1zIxv7ZH7cZM8iyNHLNzbWz8Q0lvsLh1sWdahWg2lkmyC/maydGedP8uAY+UnpncAU8tRlRU+6+MlULtaKSbPA7uRUhzU1z9EyFhMtRvZ+dQK0BCZMwoo9PmKYKI37cy7aJtFqiYAA+zoWtod1ymM2t5xqDtnqXnuLRIUr1PQp2hjy8SXZlBQ4VsNSNs+ZvCixKodi+zuc1eJ10JGsJw0J5rELhqghdLsE3IroagPwnat8EGmu69M/EfEtrMsyAOJG7r4mAph10mms9nNIrMjJAr/EvYdG79HrnguEvGr3DeB/4oIGgIZ/h8JRvlXSO63P7PHujKvQxITLshh4Ne/RGG8WSuxAic4YmqfkQrVz9u3jYc2FXqlT3p6QyitGErlogGZvLFLSl6W9qCuvio7ja8wmWLsAMKiwjSVe8FIgC11GqNCj9dUucWUdqgimUudMrND9TN81c6kDPb/E1KcPxI8OzzsYPnZUvFI0zyDnhgwziEeW8w9iwE0YvLUw6K4VP57W7m3B4d7h2PcJ7EUPP+pCBtqV1JW3DmwTViy/W7QmwSgGiSIgQIju/+AL1NvLzh64G9XvDHWD65tamx5GCapr8y2RZ8dVgdr4conZE+Q1kXKeSU9whNJQqzrLYFTgEh6X6S4iJl4Hg0P7Cb/Tr6piyhlLQAC/u0Xlu7xWnl+Obx5hf2YdZ+zqpgsqOl3ONHe6Q8OLgg3s5pQox6vVXHhn9yJOVohznVzozLIY6IJwBp+7GWk/iDAT7i22O+QYANuXtHN1zLIzj/IsHmwb6ChQ7VH2BCC+XUq0OD5+HW1qBQ2kPX9+YTQNvCN7njII6izQ+EKqsiejiFpuPWhRsbXRaGsmaJtGqp6Sec+68b2DhsFx+DiSJUEnijQFn33M7YaMdgT+UBHmBWkzwZ7hHXzAD3ryRKUOwKu7x6uEBRAUVrx5G1LJ3veeICTSnoB06JWR9WrqXGZMJI//+3Rq7foGjKo5lrl4Ss4z80jJMM5U3lbkBW5A7uOyXsb6bFBvdHqewGAAueDZc5iqIakAaP37cwjmj0AD5vKS/sKGOdIBA909Y= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 897c047d-ba04-4f56-d7e4-08dc07099477 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:10.8447 (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: MnFey9Gyjnb1sF6iCLzGWx1wrP7W8Qs8Vqi+lRzDUdct5Ag9uXSaLief/mwoZqn7u+vhZ8wYYDe5T6s3aClGJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 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 Reviewed-by: Rob Herring --- 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 Wed Dec 27 18:27:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505445 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2045.outbound.protection.outlook.com [40.107.7.45]) (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 06167481D6; Wed, 27 Dec 2023 18:28: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="n5TxEjPH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XdwYhseCLSeSpPa5ribMcvVE2P67xusRZr/Lu2/eVx9aQyLEz7zzw1pjfaPRK00tuSfR+KIYQXM7cXRe+Ak4RryLhLOUF390YqOYauqcfmSgnwQ1m9vYX6Jc8h3tl1r6wOpfMLfOz+/Xd3iv0LIUciieXZlFKFifau6YBKDl25sV013HPONkGuwH6LR/t1B/vQWF3G/LqcLL5oTfjI0AZilIbAsUcpg1IN/KK00HJXN5zpxN+PJ0kXrXWcPN4BWxcjk4aKJORyZG5AfGXYG67RKePvH0V+GV4Ue1qVbDqaR1AvaQvNF03Ne8nZ1E/vCITeR5IZWjLj4k+zYqXPRTFw== 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=oAN6iNz3k3xJhl79sCP7MBjR3RgpwBfFxaqqq4GgCjrNZq278KgA4GYVD04xUjTxXJqYnl45aTYf/OpRNGLQGHI5703HkM590Q283VDi/X6/RP/8pNPMzT71ucdjUQ77OmIfQ+clDZC7k8rtPwkhFj6/9eKoZ0Yzy6lR5MV5+71FnD/NxdsKRlsyzs9HYoA+k8wX4PNmTx4xKs8MedIe4TEoF3AbXDNYfLrt+HczKCtn9HPkmvaVOjDzA69QZJnGrNjomkYqqHF2jN0UXyskQjMiDmy6tgZ8Eh/zUHao8BhW4YLhPUXFWvOzDOBHAoFZRSqIrr+CN+EEamS98bc9pA== 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=n5TxEjPHD0YZyriXR0s+E1mhZq4oo3GNFArC3mTcutNbuNUHFBxR3cfy2dH/ViIjQG4eD0D4U1v50F6+eIa63iejdPCIJN7QLVEGz4zxGTv6M7k7JtWQ/vseioUUgzEO1rgaOxF8GNyGx1Fn9Fp4s1EY3xOpsjUVKudDNh4b1vc= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28: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.027; Wed, 27 Dec 2023 18:28: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 v7 05/16] PCI: imx6: Using "linux,pci-domain" as slot ID Date: Wed, 27 Dec 2023 13:27:16 -0500 Message-Id: <20231227182727.1747435-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: 15a90c3b-fdca-4c00-4fb9-08dc0709979b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2nx37v6Qs2mL7y1jNiMIR3/AhXq6UgxLE1cMR5/mNm6cmsGfsMBFABCiRiVZqmiw54ScqZIS0SCBfXCw0d+Vo8AxRr21d5Jr+qrxQj3YcthHs/bX5E84N5ci3b1dIGj9B7aFWboCyNKrsXTPTePfltMBrkG7NE6TS7wBJLP84/4v8wocRsA+rzIRR+NWdOxb+ConAthMyvaGhyc+eQHT4/U4aXg4dtUcexC1swBBOaCbu98/5sQ+Jo7Ryp2rGzTITuCQis9Ps0v495O1Lcm7jt/RjZVnyu3YRna8SWGjT/Spg4ezZ/K+QSTiWAxhTHekYaYDwM7O2s2wLhPsMw/JvtJMCv4hxXcBxItx6/JhSHdjKojl5OR4mf97v32kNDcnYI+yj+fPDmLqcyw8ugyaqqvuRnsiimyoLdTw5z3lY+cJihNfxl99RocZbcBeq8khHxWdYJhY/BPwFCLgl6ZwZpFI/R4mDYH9O3szJcY7eqsmDZLAz7kLAyQSGR478JkuJWSK5G0epnsEXQv8XfkRwRKgbfA0MJKhrRspw2MnhWLdopQh1uvITkzRm1zwhFKQyvYNGv6mGlH+2YocuT9VvZn79rtG1sY/YPo9g2u6aiDyy4+1k3rK4vI3tl1zR5Gs 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5OuciWYXMu0zddc8RrreJNJjPR/Sa2gFoFSH+ZUzr/IUdzZeVz5sHkcIKz69YdN2busIWZg55LEhVyq1/Ri33tM7wFvgYW3DyobH9YwuDYTB7Yp/3oJon8zHwlBUDGENdeoLTmn30KGH2hacJ/mhQCVU8GrFnLHvd+YW0w3u/+d5AjoBM4prXCdniN1cLrfpwroRK4MLFPJBTADhfR5zRU3nEOpg1lmSFkyxYkoTMaG3udEzxLb90W/cIxngoh1NKelui5J/BIK5vDgthd7KY8kAAosoR2Idlcfo5wywk8UGrXOYzrOT2qQqiKyMdNujPZP3/ujf7j9OM7QlBYDAn6SgS5N0uEZiiZk3hu422+pwA8bhePzCJzEuPW3hUQ9qXWAPVw/gytqX+HADEl+b1BAdfvTnvOwqY/CyZQZfyUOnnyLIqIDNxgjc568QeMg1bSERDO2hGkd+n26VhxtH1k6OScNGy8LnEkMRV3jR05tyyTNS2txxfQuaSVfPmYGKq3DSEHf5hyfAtayHholmRemHf1EauG99wvinrmZu7IVmXGMpglD4ZJOI7yfLRV+U7SgxYtBJXYt3Ree7IG5CB6mv7f+uaPNMDLwJMoSzClH5dUaCZBSx506oQAiiT/KFvplQNy5pWriaDPyHxC0bvgSQFXD5Xx24T0gwTsVPi+4uG+iOzcWPb4LHhEF4jRPFRdh6YW6C4+q3rcSQkY3r6TFGctOvAtzAgis8RyuPEyHXXdEfmcR/bec9DJK10DgHGwHJDFxQg5MIiLr7kKK9Ko7JezNHPivztI4zw69cra12qofnIynhsHNbKI3WFuLExk3Nf9L2z4BviSkbNEsp0vnr5LUM8JApWPu1smYzzxRbsGBGecxJYmH2lMi/XTmRXtrt9EJ7fb6ewg8PSXOMZJwtRgftgPEUO+k6Q55HlkUhSXg0Yrf4+GXyEOaaIHxJLFRbiYho3WxFZPiLLssUy2C9gqOa8scv34zpMSrHCZWSHGx4JMv2Rxf3pBg2tIiiEShDH4XU9LFpQAw94zLE1jJc5vjaVCXcrxM08RN1LVQVe5x/MqNsFA48y+nTQnX386jyjJnZT8au9RXrF/4/u5EbKySiQaj39wSeXMve3qMnUrKd7pQ1dsIDzHbaSla8WCAK1qtO55EgrF64kdRrmFNXKa1Q48InQj3uF35KsXYebvhtRuw95937bbwaSF/sRRC1cAxa49RiA4MYsaYYerhv4RsmWMYmgZpKdnxeR3TzARhf27k0+Nr65unTzow1UZMx6Nqb1esZPXe0ar7JA6Nm8e0iK8DaDpyr3bieZxXTZ41NGBV4jDDvsfDw5FXLGWgra0eKO0s4mVTed3G0r5982ezotsqC9hpAhEVVPm+7xbnsEOkw2cvh+ftOz8PLo4XAFfPD/FxFymSUTzGM6RiORQcRkniqkCACZfyONFZzMNM4172LNEJYBIG3QV0J3bh7GZyWf5KKU2zae9D0ad3peiTvvXZG90dWwkDUNt1J7Csg2vTl0crKdkcuDPuZdPKiyMcmRiEVnCe8YTO+o3mgRu5cJVte9a00OGERu/g= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15a90c3b-fdca-4c00-4fb9-08dc0709979b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:16.0969 (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: JqDoQDJQwgvkj8U6cPZ66V+VWDqpdhjOMVWM0T7vsRChglyGtM+CZLQdO+Ndz/aHbj8nbfAnb0aE4KQPkSwaLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 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 Reviewed-by: Manivannan Sadhasivam --- 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 Wed Dec 27 18:27:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505446 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2050.outbound.protection.outlook.com [40.107.7.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 24C83487B2; Wed, 27 Dec 2023 18:28: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="CcjyTLLu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aIbEh69gWqweV5G6+bEeZXk2ZgGevcDrQRNWvGaBZ6MtGdAYbDia+IiwgX9UXIDVw08p9m5ThlVd+diFqiWmiwrpEu8Gsy4p5UZvThyENuygi3wYj/ltWGUxiGof2WpF3H/qr8piD3BTICFfzlvT7J03dq2ZHn2mOXFP8D9hgT/GTHKRnLREzH8/A5sMJW1wm4HXFH3tkgC/BDfWaIiAnDO6qSyh1MFuEaSnZL04UFlj58shKvRvM9VagzGTosT0ma9Gw+NkVeRaE4+CAyYY2R3XnTvogu+HG4XWjllU8hQuKZPOlW+p1eB6sSzcSbSF1YDBGdKCb/Sd9j8dCWPCpA== 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=kkjvfnQihqENodYxdoKZOgKLXwc13Zdh/DvG7L5UcheQDCFYtlGdLFbsr4nWwXj4WsSs/OyKjcOjGLm39bPh67xAOj6MR6EbRPUbx4e2kaxCGxKO9dFLtKc5jbWciRhSGNK3ZRheVyHr1Fi9CaXNhQT97aXRdTNHrqmI4IUc9o2ftKi5MxB+AVAomIo2GQ5NAmlVW2bfzXsMnnaeIQr+F++PtsT3Y3MNAQiGopyKS2njgxRIVjkauFkfaIjBhW0OtStQFGuE6sXZt8sIlZ5nhDTzFRxlKoBhhvsuMCIYPaM3vJt6Va0AnghpXJjoj+oMkTbanowKDJWLyLlPA0xMWw== 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=CcjyTLLuSXTEDDmh2UF5SplDgPTPg3qv0RBnCk4w+/cipjnIsUyCF4jksFKG7Tq3OOr85NF14+qpTYG96ogS4d5GuFISU+rdT33YVfK+FGCM3cv1Ibl9tB7eMT47A7+UzE7xoUGSWy+GY8sJwpsYCHJlBqMXT2QB9K1DOUl7qx8= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28:21 +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.027; Wed, 27 Dec 2023 18:28:21 +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 v7 06/16] PCI: imx6: Simplify ltssm_enable() by using ltssm_off and ltssm_mask Date: Wed, 27 Dec 2023 13:27:17 -0500 Message-Id: <20231227182727.1747435-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: 25d55067-661c-4e20-c793-08dc07099abe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zvIUMSX+RdycHrhZIghNCc1SVBHceTSGD3iDVND6bBiP9CG7M9sn7FdpsvExcFAyl0kW/FULTYDpUhTP3+vQbeCaKS+OpdtNspLqKbJjXx4MyJS1UL0SG8kgT3LFQ4KX+OqbSyhEew/IbsOzvhJ4BAmBicFPaBk7LFocD9rWjdx2R5NTaxAdHNLYESeGg8AVxJJbUUdFtoNJ8z7LHqAtQy85y7nL6VDsnNXyo39VDn9qE+YUPoW0sFFkxuKn6SHfmvbCXF7nccDGZjL8focdeFz5rA32QTQFKEFWAuLr6z5cLMe4ejWN7H/WN2ioYASbKrPwpr/Oi3efIENEz9WhWaRkzL1MOVYRHMqgMl6MUGRl0MIMG6TTmaWac/ZzQW35HDe6O5dsd8E+7eUI3iRMuvnwgR7foJxnxr7X4k1U9xGUd+pyrlNCL/Mi9JyB/ARD4LW/lgJXybEafwyZ23e9sUsnah+RECqya+CmZWUc/YDTbROZxbwte0w9kutYaPjzCpDEjvv1Ks8oygPyxhOAuE+kXtOppL6MhxdTP7d7KUCLRCZFqB7MwiHUfXXrqfoAp+dZdF+zv2GPWpArsqyMCe6AR04U9mWUi9QIOw2spWajlNY/aHG9TjwpFs4B81rL 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TdCj42iROTYpVDoq+Hlt1mSW0vH2GoHk/lfSmG7zEE0FyOZLaefAHKsVvLeVEylUhFkpkpKwIX/KJ3iwM3d0F7SOp8hPUMNaIob2MQfzw7PxSn+hq952qXMqqOvvyfCUANqS3HJdgwHCJbJDNyVjUc0C7FDTcVjDeceHdov7dvopdtjMPxx1aSyISc0jVpAxF8K8cSAGuVYZwATh96gYGrq+XHQkPZmhyEgT6u1GY0876RTrWOyLX4CDZ2PdYlyYxtjy3WtvwDfzW2bmZAunphQwTqdeksXlSWitoJ/ogPvJ2t1exq0LjhpsSWZuH6WY2czOyPk+10620uNqhLftTJuAbLvQk+rs/3yi0iFFfHjiojGL1fJ0DmvDOwo53aAiHFzGMnfZrXlSi1/tulGBEDQ0kqWyN0nKhY6MwhA/7DsFWy0oSSNqm7OaMocF8KXgFvjGg81kUfM8cbwBOmY8bkfax+/aMiNycBhe5u3TGT+sqg4VYoyrLUmGvZgnt4T495L8j6ISxEjavXfzTcSRVp55YKilTTcDKSqbdMtRiwAdrEttleeegNjli+gw2sCHpKh3/JEdQXjdt96uRYtllTBqDbf4lHYY9lnmp+y4RfkLmZonKiXlV88Y5Pa6/HYql3rX/NHwxA64uWldLUVjxPrbJD+c1vplfLBGx6HuMLyTtnaHmY4xL8wpgES9OTDfuAMHRd5OSYeB0psejJ43D2+bqbbrbss73quWaABStXW3oHKcfpoodiCcOb6D/OdEP5tLrNHvQWuLlRKw3zHLfxqWHc0QLEYloujpTcoGNEHnoQ8VDLafdNj/ac5k081YEpDhmEuNtwEx+kz3at7foeWKx3ikq1J3uBhT/sZYU05nfgrlFuojLbQoUKzV4gmnJYSqZvmlw9ucrqjZ82Gssn+R3m+TAQJyEouVfJO22JaF2N6ziv/LKsWJq5hGbGPc7gYWxRDir2dUfz2D5kzMn7LeYSwunNLg1aTFTMPoHtwmwteGfUMxdCVMiYVlrAwwFrMek/nbMs0iRV3M4n2Ww910SWgoElPaRoSLyIV3shiSYdRZfX+Dwf39hQuGgG1SU8aoNtwj9VwvGhvoY6sgZrLRDwBw05mYkPfrGzhTgxiQFEgycCqrdZ0RfQHdcw1E/K3xyIW0lOudXw/FA5kPiPSBt3cdTDmcdMm8fOfxmqBu8MirMPjAVg+n3Q9Q5KuQofmv/apQPDu1rl/ODoVevyvCP4EudBc8jcXBdvyitkFChQzPrC6kMbecgF0Tzo3N7yV6s+fS26tYqr8xa79pc5nCQCAYU/YlyUO6XNWn1fyLPdDRRJY5XelTcPD6wmzcG/etudmRzPTtYhoZcozNnPpy1HnuVlGCcOOQ0YsJc3yZzm2CjVCJKg65MZdkVkcF27Gtu45ZID6/dbMyRPg7Z9Yk63OCyKrVSjFqe726LueJDdIx2Q8GxQVgM4xtLtpvxN1Ajj4dutTA+gxLApL6xY94pf7ulI2eQuNCm7oG+NVEHIjZRBn4hpApsK4o0fB/gC1vEAa6F7CeoJuqZG40Fkfh0YS3oPC4XOcTRjsPCnE= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25d55067-661c-4e20-c793-08dc07099abe X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:21.3563 (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: H0dc1HGVArmJRONNA+T5/w7vrVrrLtvXwQzJUjuvLQiPAwSDLOt4rQ0VZCrySe7qWg4OaTxMHISE+WMFIzgebQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 Add drvdata::ltssm_off and drvdata::ltssm_mask to simple imx6_pcie_ltssm_enable(disable)() logic. Signed-off-by: Frank Li Reviewed-by: Manivannan Sadhasivam --- 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 Wed Dec 27 18:27:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505447 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2055.outbound.protection.outlook.com [40.107.7.55]) (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 7506F48CC2; Wed, 27 Dec 2023 18:28: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="E0rxngrk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AZmtmSr1r8qGHtDy8F5XS6GVjof7ls+p4vhAeyR0KZxr7z1eCnlkZMrjDLfkK8jB+5KhuaojCF2DF5jK1uVoy1FucwaPvl3QHCvwNcJG0fklD1XmI6WHfb4WuajhaHsjUIh6l2NcOcaWBK/z8f+dWXwV4lJenfxsuTRX4Gd7Ikq/REXXTw9lkWJdi98k19VbLfIY7xA7JgeIyoeCfwalNwA9FQ9Yj1HFmbg8S7Fo675D0gbi+QjjRa4fBeaGIE+w+mWz2Jn1JqLpNk4j+jnwN8ilTRb9sHF9mIHXhvX+5k3hG4WnTTHCRXHZWQeUBChI+MDczGyobcVaPXoCxFTakQ== 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=Fap+7N/RSJ/XURwu21o7owwBAtOy99SS3Pkcziitwd7PZQWK0/Fj+0EP9lguvWL0AoVml+8Wp8NUuwIN0Tmb43IlXPdv51G01f3/r11WTZEIPw61L/hrStqGbB6BI1pBFvof0kOP/a42O+sT3kxreX/BKEDh0yXVrmRhdY+iW6aomF8c+zKa7mqkHcST+8avhWuaKk//q9zAlkhUrW6HBO5heEssQLwJhMTHeuMO0Tve5kVRoNvzRxV4gJakfI5zrd00W6RYMEgbngpLEEbRToFZ7a9GT+JP9JOtWdlmOHbO+XdNuHalWzs363cF4Wya3hz9DXmtoZq+64UqPXFzEg== 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=E0rxngrkuTxOs272ubqlVHHz13F13LfsDOeRgmgB/fQZdTwSO+D99lsM95pY3uI0lhHGEXyV/a1PIRxx73NSFTRxxQNpB91+VAOsmsyB1KuenlevU/6rx6CKs011bv4dj3ChSUx1X9bJS/FAFwG5OWiLyV5Eh8M+lnQqA9F2VrQ= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28:26 +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.027; Wed, 27 Dec 2023 18:28:26 +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 v7 07/16] PCI: imx6: Simplify configure_type() by using mode_off and mode_mask Date: Wed, 27 Dec 2023 13:27:18 -0500 Message-Id: <20231227182727.1747435-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a9706ab-457c-4b87-a1b5-08dc07099de4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HIhCqb1rZKYb/0ednvXZTsn95tJklk0mNxaMC8tLRLMwLaPNu2csiZ3XokOrJmtGyeo+Ihim6eOP2rdMDgVvnCPHHvA3VMghNhdNmXYnFogmKLmfzTy8bK8OIf+/w6ae1r9fRQXBo8wvKXJ6Uy9ex7UxNFZl0WAbI2nOluC8vaTV0pZnWjJyP2T/l/3CfdV8+qTpP+9LlfZySVSYi0tTkIT8P590LZ+QrezGuT3Ll7eefgKyjaUbie3R65i6o+cO5ErMJmyQseV8Jre2vC/LHmcFeAUG6klAzTRZ2vHa7jEWTqNc36LBHP0d58cpJV+F/kFYDu3+/sdm0mctikx68zdWX5kbRcvFydlMJf3ZWFYRRWTafmlfy2YC3NOlftjhpVbGqA7jfGt32Ae+sxqXoMuoijYbs3kOTmSHyZ02iEO522BNw7LPR0diU8D/QdDUrfdF1bujgebw8pmTmi25jDv/qx8rhhQzaNEB0AadlD3j7LyFJdxitB8hfvGF9BOwByzvCSzUgU9/CAnM4ductYWqQGYwpsgudB2/IwmzSVuYgSy8+LJK3rdGCSJYwOn8jlD3KXSdLewepSIh7rO5+PsZYQQLZCC6ilgPAvgmntUDYDd7oOo+F2S0VIfZt7Jc 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SOv8KpG3Zr6PuouDNMZRt/HlWbbjJ5P4+ngw2po6VMRZtfCDrSC8rc+Xa0UZH5mK+Eda/bOFSyk3uKpn4mO7u4L5E2amOhLWZMYnY7J09/vS0exO/bZuRd8UGobzmxdNnCUI5f1Pqwo/KPL3r6eME0UHLEaMmLcUPpr5vfKfuLo02yvBMOtN3Oa/I/W+fUENMGmk1eEygwRUoJ6NHyk0SYwmGr7GalP0iGd8Gdnu89b0vj9cn8l3ZeiUgDx2b7xEgzcuXjFYezvg61JIb14DMY6I1Qh99pz33f3FK6QHySOiPHk31F5bqtOWtO7Qgh+8xx8elgYlY97EN3jBOQol+ajlTRC7nz7cyNI/jSPt/WeRjwrHUWdHjNkPwJnYrqN1aEOOrvXN9HDZOdv4zR1UQ/Mx21fAnvLXvsz3kf/no1tG4bl1rampvaa4a93L/yMfZ1hJBvuuRbGKIk+S7zXlgJaiknssIcFfH0F1coij+XdhugpSodZNWhxIY0VYIMF1zZEnYLumj0xSggsjThY2EOlliT7YFjOO95CsyKZ710b5tQCFuQCQPK7p8/gVnLWS7ATNHFpySC9rA0XknORBdZO7CLYEk7NhMpZpsdt8CPLgPFC/XyGV7CXzSLddXNhnW02p5lJGiHeLKvqOB9QB3CIcpZxukSHXdehJs3Q6yfHVwvGh5te4BM/8pi/EYPr1ryPJVUX1HLsaJz2taphWXgTMdVoBkpqvXO9KlSgmVLVp1HFQM5EKFmorxLNchxua+pyZYE95m2VOrLQ066X2YqcU4g+nLqtwqL/Rfr7wMNaqRYA5PUQl896MbKrgJuKSoBQMtM9TOBhL+G4E/1DrtNIos17I3p5wDa/AFClE+neJnOkftetUufX+02niPh9c23eaPcflxgmfQaVG1fqH4bFad7vhmB7fqDN3qMOTcZ5ZF8s1l7kjfFTHrOy2zMlN2dCHSrjGNVicbj8opSuYT8P5PUayctQ4t9ie0Nlh/K2VpDMN07EGmpb7eArjT/ItbdGIeU/52G8lG15F+PGIvnZAjBHx41Pegk3bsWY812GdWnmOhXm4r6Pq7ENul/4kUXIgvrnFeQHvTyM+J5I216fAxyv/vLTDOjz0/Aw/ekqQtWsADFEX83VX8+jka9JhdQhTeWX31ocGnifnaoLQUJ1mi90HBVNWCCNI4LgQlxdHl7GeEmJEF4ebmwcz4syt1PGBX71xH7EUhrv+BiBM9YIUH2EVriMbvLy5fKvrgnSSzMWv/OfmiB3HLcDAqV+7JHz1D/ensjjC5AjBRPArYdTd4yOz6HR7xxop9w9/d6/ZBjgK8SZG+XFasI/5tnEyOTpyTKs6qZY+reuxuQrNzDmFY/f8q2RddcSc68b6uHVIi3CmMmwCb1iheOji8I6Jqr7R4XwIK+lq3/QpmsOqXIOIYd2a88XB8o81fX2hFTbeAuB64iz6aSfKOPB9Bernl2/bQ50FZ7UbXjbO/pjsg1jONRznQ1y+t1VCblQqgkZ9PQIrBdM5iKj+8worboRz3yiD7nrMN+vYRtKUMLw9Kdr43Sg9CoAgHzU+++mvpBg= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a9706ab-457c-4b87-a1b5-08dc07099de4 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:26.6499 (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: 9XeHYQJFX4iGO8o8+FI9EFFPSI60f1TDUhGzWqvhrhagZvOjRkWUyBk8l1oOHS26xWuS95+uNKzkHMor6gNc9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 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 Wed Dec 27 18:27:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505448 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2050.outbound.protection.outlook.com [40.107.7.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 01D8D495CA; Wed, 27 Dec 2023 18:28:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Ajq+igAt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ChzPXeA4CorLw9BBFcP4u6BORwXRPD89Hh7rXGfK/8KItGcdAemnydVqXFwnMUUze1v/14wBy9awCpt8pi9q1LtMYymsxFeYUPxDO6gcBidwHCFMzlF5iwWHYRDEIQlOXMJDY2hECdQwodF/Z/7wQVSg6UeqlnB3PSPdeVistZkbOFXXKk006xyikYtoAYPseY+UpcWTxpsXQzD4kb0ZNtxNbxe3gWq+uE3opWaQFGBvk04Bj2n0wpCR5eiUdfayuXo+//e7Koka/4qUWPCX1zDDPYyoC8g8ZIzm56Z5FNTRd7HQHn89Bt4ra6ZNScp1m6tQ5uAz6TRl7g6esPPFGA== 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=P3Hx4Dk7vCHB8/zYwgJpur9Dm5rN+h8ueEvAoEyxiWeNLgmxqbxl3ApdhpSxleY2tmlbO+Xd/egPr3QMSd4qSQTrKMyhJoanKSFUzTsWbOvjss0S98r+wiy5g4LoOA5ZIwU9X2ce7Q1LYvJbHnZFU/nYHsulriDTQw0dlFQm3aVZCMFP5oB37soo2By9erTlD7jFAFmE4u9d7Yhy3xCLoHmXuBlFCtVTaHMlR9SjJw/WSq8VLZDYIJIfY7Xz63N46f1Goqs2DsdjtQ1u7DTRymQwmu51p5q68RiwyJFvQR3Lzp1/24N6OZyQOBSYdTQdr5MbVDYFg0rMmFlnc1tn3g== 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=Ajq+igAtQLweR98V3Wr5soikvRCUCb08o/lJm830zZ+iqcEA2h7KVicHJghxHqLD4T76iAZkkFI81hkRnAqCHJbOtCZNeYHb4HUVKKib3PEK/XxxYuhRTq7S6XkHuYgCQZ/X9VESLEO4eSUrZZGPp/4GXxdEO3vc26bUe+nbjpY= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28:32 +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.027; Wed, 27 Dec 2023 18:28:32 +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 v7 08/16] PCI: imx6: Simplify switch-case logic by involve init_phy callback Date: Wed, 27 Dec 2023 13:27:19 -0500 Message-Id: <20231227182727.1747435-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: ed89c456-39ce-47a5-7b77-08dc0709a10a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mkl9GlonfLQC6z3+HCjBsO9khmUs2+plaVwbO5pbAuozrRlyjCCPBcItkqdhOMVmaplOwbVeOnkojnx9wOhgo6XwFaOZX1XACE3e/g5toaz/R80VYZFa1lSzpxwXcojgoBXslX3GZ6k/vJCWO0cOvk/nm0KuTAlDLTK1q18BeLaWFw2ZJM7iVivcONWYYOb0T3c78jMutsdshAxCFFfwYG6s4tYm3jihowilljqE1lixxlasNq09EPe+WG1jMSG5qOnYnJo5yurGuIZiyrgykgfXZ+gLuoDApMfiNX9H41oShNLzJ755Iu027yvAhS+kjRUUROn1OQgeGnLDxON0Z1vjKPeXRVKmeAMXBaqpEjNhVBb2Fiy0dUf07hpk35Ur5akC3+bb58wsA7sfpoyFI0/BpD0uF7VcU/aN830ifB5By51N9UI34RJWz51+SKTiATXDg20rM7T8jgjM8E1y+zsAH74Pv1nbS1hcQvFwh67is6HJuw/nbt75ggDZ3Fv6ci57yCJK8wb1VfFH7hOI4soJLPlUKYj3M0WSOdbkGYVfYeNnrQqBDZdjOsNxJolLNY9+zniCbdxn8ZYpcp8rZAF+AhiukIAMUvBLF7CgR+hrTKl/NDBR+N8GjIJdXfbwuDmo83KZedACQcUItSH1xsv1rmF7qbix+5lwCIGBYxI= 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(230273577357003)(230173577357003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mPlBwcsOK8siQFIowW95reUkAdsWiy7WFYuxTx/AjB4TG5NFDZpdjuosYVNAJVCSrK7DtS3U6wBC3JBOtkvk+FljEcTjgCP0rttH1xPJ621SNJPYqIZJpaP4HLA+0EgWGpigs17whjws3KMdj7WQco6VN5ZW/rLHqK7cEX2TXESjtzvrkkROMDjGflzHPH1hYGEGTttuC+t/kmj5KNO7FKWA67xyVDmYoboBHfN/MiS2jbk+8Lub0vSTY6Ss5xxCJyp4cOhL7LxdKb8PFfH2IBm+zf7dPYIlPlgvXqcaXyQkvXGVpBX+boqWpVGzsZkGvPpxk5tjab1TVZ9uubju98W6msn4UHTKcOxeqvEklF0iTQcnntqfHWuBA+yvS85efZNrw9AltMrZwGihdjhx9goEai5S8HLfNe3ruh7XuOsl+QMqrcnHCBf7l6k26u9rx85FbpH76p0c2OmA2uO1BwYxABnuorLJsRCL0EHzd3wPZ4jhvrrATv8XOFC2Zmo0cUF3vNe3ZtNQOKAuZmFpS/4wZQSokIyUuyWQuYISGdl1eyhvEBryoE8vqbzEKuNwN9q1R5oZAKs18Xq0mQ4a3bKxBapo7B/jd0ThL90jiFK1CSXBY1L3Tx0xTVP4T2nrY7mCb3W1dFOF02gxvnlQpOVbFyKq5eUZ3jk3fOQCizQkjm1TFtXcO2lI+50ya4xDaPzm8KtYq3Loz+luXqByOEu7iLZL7yGE1qim0/uHDb1Tu3V5T9N1iqA/9pz1WWSEy+a/qW0S0t/AVQc/GHYluap0HrI8PhIEbszW3PblUb/uBBZsoBzjZcOP9ZiSwgnn1Agx/9U1bRCoXWmRTzkzPP6QXtIXVl1YJ0SInUbkfCfjxbkGMTuHUbDsw6Qe4cPN1kGvTMe5/gMh6eNv83DrueRQUsyST/G+tZQFxAGjVubpqsA2VW5WCI/zEw1OztNA13o6cxp/9dOHY4D+KHKgtd8E1m8knFzSqJk7MjvDHmZz4PY1RpkmFl0p15kJfsMgr6Nz/xzJ0ltEgPtjUtpXp1IaglfhlX8gAe92Io93sn8VffTbY8xz7H0gzQ99oAPR/C2ZiWx7fMJ7PWmgwNfUsFia0Kims9HFV43fRoGVXmj3nXzjevlAfzkgP4bEyp+96qIQbPmV/9oKSZLUMK+S9OMk92gx7L1/Ynwqmm6iq7o+22JPxEqOrltNiy9Lt+zKrCE+7e4XL4QvSi+hr13yMD/ladnPZr58N4T+RA16QeqLUPv4WW7WHXhtEAd156hwWqNndc6PJnrms9SPTi+LDEJ6h2jNsXO2Kd1lGiM6eeP4jwUYC+hVHPq1ED2gZ2d33CLgUomHA+rOQiOgfC+IimF8CflcmQzLzaL3g5+5DRMyUziI7/v1c1pT3fGyoL9WKLwvhoFvkAjkPRboGl5/m3xkM4gWUWd8HtWRJokyKKmrq07IHvuALOm22AVXrsp+8hxyFG+DHV21WP4mBnvs1SbinlkljSmx9jfE17/8ZgxEGLhFnnos0OCHk8u0eHf93K8mo7DO84R4TFRUQp/ynkeFNvbddUax1BnyWt+jDDI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed89c456-39ce-47a5-7b77-08dc0709a10a X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:31.9288 (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: WwXnZcFgzdLsGKJjqlEimLB+soT/GuNSFuYnkLPwnGGu9kPsbDIbTJJs31BllL6rUBXrU4CWhMXZTjTE9gOvKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 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 Wed Dec 27 18:27:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505449 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2080.outbound.protection.outlook.com [40.107.7.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 B390C495F7; Wed, 27 Dec 2023 18:28:39 +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="LupW/Qws" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UcRTtsAotYO0fhBbIqzNbnsv/v5Q9TtyX9gajlm8mkTFYizBmh0Gj+B9DCldjpATSkLD2tg1dfdVoTEUUu9xjqsQC5mh2QqkTkT1QOrpXbjiXlZsxArIAv6EdL7X+aW2efv7jkxMJM2gwoMptY3GmP8LwZ2BqfcYnVtUUiRQ1g4TDPJvSjWwdkfabw+U400weqCkoiVJHH5wT6mRvOzjA5dtS6hPAAIt+QDlxn7yuw3eWLHFg6eo0gZm/FBV0Fs3iicszFNp3J/Ol7+bZF/pR+ePW/gevK08uLQSMqxoNO+uTE7V8ZM9QubSGiI/fj7Bu5S8+8rZ3Ean69ffA49fhw== 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=tJkTHzjCQwUmpxaPt2WdiulHlG0YMJvncKXbLMUyMrA=; b=ldu9sO0W+Uzm3U1bd7A/cW9D/zjYstkMvT+03HJhKAoGSEQs9VUlJYA81niyXkkb6TfOqOsNDhszucxQcsI41O2nuGB5qYLNce29wA4b468xt6pr8IMaMzAS15zRzGWzSxNql7RmQ0QFOCiXeCDIkQqwIyAcWdJKMa1IcuWIg7OEW/dMSwxjfeDtjX6Ue8fB9TANox6XQMiNI1INi0JClDqKLM68SQGkT8CQAS1LZwrS/3zHWBG5cw1XTiiRdWZVFeX4cooMv66DUAXmUZBTjrk8bEK2A0bDjoQRfuKrRNoE/dNl/1Y11BQutu7CCq75jaRQ9GnyQxoFRs0hFZWRvQ== 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=tJkTHzjCQwUmpxaPt2WdiulHlG0YMJvncKXbLMUyMrA=; b=LupW/QwsTphEci1ZeYJbxQoPBce3mxxofMmdcRlvQZidrsBZ3a07pXLiGRj80XPANrnzYPtfgcbBCpPatP2SF8AHRR+WTWiieeEWXmk1kVK5APLHwts5qj4JdxHz0weR8xHWTWrC/Z8KGKS7MymK11IFwXwOWzFxPp47F636/+Q= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28:37 +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.027; Wed, 27 Dec 2023 18:28:37 +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 v7 09/16] dt-bindings: imx6q-pcie: Clean up irrationality clocks check Date: Wed, 27 Dec 2023 13:27:20 -0500 Message-Id: <20231227182727.1747435-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: a726d24e-9f97-4aaf-f32f-08dc0709a42d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: leea3dxdhVtoEjK7n0ANVlbBuzM3Z2/n7MQ2z1OyDevmXA8D79+K/n5QrFF13SsjIvdkiZ8sp373C2kNKq04mO2ONT1AteciskjpLM0Bqoy++YCL999iVa70+zPpU5ZOj8xBzgcK3TrXHJCXDmg7eFOHdH7ZRgKBPd9YjVeb9orcAADeqf/bOArl4mWWSji1pt6IMw5tjPk1uWTKD7rmVf1y2RYExP21FsA57ePLE8nFDc3acWDAtrSZY0dBgIM1NrUDj5H8U2ZKtkWwn80zuAwbFUK3LMgNLRCAeGLtUmT5JhLgHabq3b+y6usKd7W1bgOZEBtbftqfi3Snl19QtEy0pwQrhOeRi6UHcjOyCXXezVyD3qT9DWMzFFZM2OqKeuvOk3nPZ31p3edrg2NCDr4VkXH8CLILwgUl0pjhwcbv+KwQqT+8V7DwushOUfpgeQzgf+S69HQHXcl1xWu+KWqTOa8hfLc+nLlVkBBha6fw7xGsn0e3va4c+rqkNSab2IEbT1oEHItqM2at68onlOwo93cPr92VKsEZA8CRE56SZUmjcyoWscbYbmJLOad6/2Eswcin/7ahoAlgt9Npm7fUa0J229uMAY+AhvRnvMPYFn3GQpppIDs/Kxy3RA62X9qMV8zvzRqZ4p9iNiRoPg== 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: i0h5YnM4dVaqfu2fgubgsXAiUT8wyN2stgVoVZRIepeC049Q6OztF52R4LsUvPmFOQ8Ge7xgLF+1kzowiRkIJd+PiaNFaqkAHeCj1pSh6xiz5uCnmwpTHtFydESjPyekglbeQLchZENaq52ti/NwWMjtWi8oN1iSjXWg+tws253kYxeonWvskxTN1mGmFa+CrThfLMNEudYY1J2vqKS6YNDTbXTcy/wF7hVm5hIdN+C5N7ztu5xD5DXPQfRxeJ6yKAStGivFTL7nQEb+hgbvekH0cbMVXamqa1h7PBQEYx1fnODo585cD6FQlkDSSsvRpAn9970+v9cj77MU0BwRyjfLLLqM+QYxKS/GQVrsXSed5mlGEIUxEQWUwoqVSewKDnO6nobISxM0Pbi1G72xGNzLrs2GzDW3sOlD5/nKRF+GK9k0cP3pvzX/DC5LDnlDNOzJGt1YPc15wQVrIzSCzUeixvYLKZXOvQXwtPGpBly3vglrMh4LmgBTqB7B4B6DjYqvMBO9Fmqclgg9y1Cuxkg6CpaNJww1QZ6mZK6GHpm21nuKNqY6fTj0BGUyTi9CEsx0C1PQz3WdUdu1hPV/zKyAffKFdz9WSacKEMILobmiwtbDU9AAUYVOXGCxHpxk0yB43FoqqbHBirNY76qt62tudIxOzUBOuYjGVOeN6NMD+xLwzT/1oxCLzfi7hxXXwCHGTj98m/bSThNOgmHgJic8GEOJon4tReNXcBCNC2+Gz7gkU1SoUsOs0iITukSUdDNyOHFJ4fWd5I4aLlrWG+wIp267tuCRc3hGKq6Vif5UWxL8rT51YF4qBkTrsk4in9g9Ih1aYUhzOtvaINfT8ANCfbtoy1HsdGvJsThTjWMiOSEFkU7+/WSdnrjV8Pq8vOgxyCFVf6XLeKQHLxMEF9toxQmxzhhDc4zF6Tvc15W5Bc4BZ1CGTHDzSItv2xr9lHg+9TKaRLWPV36JyFvW1frw0SPgn3U8wdANxUZH6dmAZjmKLIAY3BHM9ZvkyAgYCmtOVwG+8jQLMZweMafKci25nTq+KQ7RScfxAZ4/YILICiZcgl7lGlE7/HtP8oFO9lp5KW8xk0CI0SyWgVsR6uDW4g0FvcYAzjSLYgQmx5wxZKXI+8zkHqKav383q9W0W8ih8XkMx4i4CtyPuyOAoygUizSiK5tdlc0NsImXzS62bh+zFt6DunGs95a+/YN8nLY+8AkasuIIANJ8F2hA2+MeGmD+kuwZ6E7HG6V702VqrTtf5rGQXZJPrggilW0edOQEULgQAGOKBokueGm1SUCcfFjr8lywfpz1Zoi2iVT0MBK5A+HELn0Ha/mpLB9D1PG2z6ISLvdpBnBRwDVXDTsow0CB2feraEl5aQx88g/f9aYnldQPvAyzM47cryXYKkPcUhsD5nypm3lDaXG2zKl2SBI1CuQf7/WKBckJ0bP7fqcmffslhm/YG5IfL+ptlz7psSR9X9lyzJI7cQMRVz0SSz65yRKPUx2WXisJa+drzmdmTFQv9dYq09ZkKGZzuz7FJg/bX3hysWNigliDo/6h58RSjlpRrKJ+sKAHN9k= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a726d24e-9f97-4aaf-f32f-08dc0709a42d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:37.2036 (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: Db95d/lzb77iinjp/w3RBmVSWUOFtw1GPFD82EO2dqUGomuIA7VcXLg+sWoHbGq9UY+MHYWxx9lMHnH6VziMnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 The bindings referencing this file already define these constraints for each of the variants, so the if not: then: is redundant. Acked-by: Rob Herring Signed-off-by: Frank Li Acked-by: Manivannan Sadhasivam --- Notes: Change from v6 to v7 - rewrite git commit message by using simple words Change from v5 to v6 - rewrite git commit message and explain why remove it safely. - Add Rob's Ack Change from v1 to v4 - new patch at v4 .../bindings/pci/fsl,imx6q-pcie-common.yaml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml index 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 Wed Dec 27 18:27:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505450 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2078.outbound.protection.outlook.com [40.107.7.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14AFF4989D; Wed, 27 Dec 2023 18:28:44 +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="JrKaOuiD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aDC4YmQwZ1jsHjVXrhYo8fT125Aa9d2x92RBmGuKPRzUJpixDPes91uJ4E9agwVUjX52hxABiib6hr4lyynC2qOa7/zQOfuLZNYbdiPUTm8a/fVIorxPKDO7FQVvRtmB5cKpDEKVyK6rM6Y8KrzCz+S1Z3WgHJ2Xc1B6mzekHnMw/0UgWLLpL1A3CGg/l3v3dHj6R6Ss5uFZJtVREFXRsUgR6KsAa8yClBMmNolwPHqbz91DuA+gXFb/nWtGG5yDXpbMnl1k0Q3jquOB9JmPPgKAYJmVmGDfgbvEplriqvRTFhhA8DIOuIpDVgQaOns/Ub2ZIQsGUHjG+PU6LhceDA== 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=kzT9xQDWHyPkja52vLXfmsmvSsExDWiRMIup4s/pdkY=; b=ljR+ajbyZH7ntsp9+uHanyh8/cQpjdWsImYmePLVPtg+5sNfXnHqTHdIQEnWrPG92sIBwFv3WwXKSV8tQKPONLihsLZZwv34lUz9QZ1qiF3mDMuDVwEFaP8YwzfjTV9Epzg4X6nVIio6QBOXd26NRIwoTIJLjWyt7N0nWPDgELU0RjL7EY7rnx/5wAOFi2wDNKzLRSpj/mHTMwhlaK9Oxz4CmGa+h8uan5KEVADpJPF0dC7YP7pFBuKT+cUt8qO8QMI4Oq5BIICqSwj0gtCETRNETFKz8Ksejwt2HmnzCnQAnZmMpGTmsjdZm0KOzauCEI1xKZu8mQtbNnkBViQQ6Q== 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=kzT9xQDWHyPkja52vLXfmsmvSsExDWiRMIup4s/pdkY=; b=JrKaOuiDzHXLM3Pii44VCbfcbC3Jon26mUynUZ4hJfVhIi67cmLxqHvk7OymV65dOsKM1eyhdBsQsS0OdVtbA4w73wMHxckyzS1mlm1GfEWd7ZGH9yHON7YFbx//Fi65bI3yzHUlt9YOyCcE/3rrt3eeQLv8UIdxSrKSglvVhdQ= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28:42 +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.027; Wed, 27 Dec 2023 18:28:42 +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 v7 10/16] dt-bindings: imx6q-pcie: restruct reg and reg-name Date: Wed, 27 Dec 2023 13:27:21 -0500 Message-Id: <20231227182727.1747435-11-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: aaa79a36-1a21-4b8f-cd47-08dc0709a753 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v5+qGfBjbffR79AZ70wli1QtM3+7+74kyeOLj+qIMNFWNmsRfkDVToHhvX+1BMCSxAnRTI0E42nrfHBL560Eu26x3DNjyr/YYiHny5W1QgC/TUc+PSAQf/s+1uSBnbaA62vdj2jJmlRSJpfMNWz+HejXkIm+a3PBa6c+QpPMMQcZu5ovSjO4grnlWoZLa1pIjALOkLhWnijFDDHk+neIZ5/BQEiGLVG91fGb/8qIpLP9hvXnijHxsWMLoLV/5znLitlAI9xvj+NspkvQ4SzOsoxDeegIjeTnn3EhtD9Jqa5HDp4h3EKIkvH8ZGqUgK1TjniKAQ2ArKPo0uOrxAdfrsxL/7VqsEVmbAB7l1JMG8rnximITm/Fy7atg0O+UC+xYpKLWske99Lioj6MumPG6CjUhzJ9zvXP+xJqW4rDjDqIF3AheuvLe8rOHRNkKE9a1bVa/+8oiZYtbwkPSk5xkbd2ekAi6XBlg98X63MJWt+WJ3/s6c6Un9uZwVOrnqYVa8XOLyjaKWyT6e7CfSfPfwWLu6P5JCo+A+dtxXz8PyQ6rF22BhMlL4Zyy4FCpoCfr+Sf4J0wigf94OLuvCY7L290sa2p+QcfuMJyD9NZxQFnGM8YqshAK0+LtqanuLYNXQxQUv00Cmd+A40yWJenrA== 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ET+R20b4fC+ev2vP1L7qEYEMlODkyVR2A8A5CZoiuh+VWePBB2RjOy8XPJ4KlkcN/OgkdDv8enc7bkPmbxNFDGV6lXoHURkCdkyw9qXRuUhUqcbDFfLATKcMyzOI4DfWZ8EB+RFOmzOTcPu5Cyex+IkjIOaVhVVBfLFPHsB2CoU/XGaGKF59SJJj5UooYypQUtPvr+Sji649RheHMAaf9puANoj2hdK8gGOR4TLwYuh0H7gO0zFFtMvq+dTwvASwv0Vj2FCay+ufTl6sy5Y4XzspyDpkt983Tek7FofG1zN99N01yYEOwamLiudWv5p37QOOT7CXLVKNtilDv7xYpNI6/i9UF7SplIdFOR6C3hSNF5GeFho5NTSvMCYLdd8hjjxLVTvVkGxx1eZMv3hxp6keIGGTMCcw0/+y5o4ntA5Q5Vj5fZcbv4/sYsgQRuHSN9sDKUAxfu4KdNYV5z3BkV+K2q3n0nHqQJ7C0OYZjjGITJTtA7RLwAJyW/ihrS2GknzpmIFP0lP66R/FTOuCHSQytRmFDYpiT64+W7HDldi/U1K7Jfu+i/6ke3faW3R0ZfmwuaCO3W0OpColfZqefGh2sujY2vOtUhMVcQf7ZEu6jGD8l5HsXBsQfSKONoxCkgYqxzTBI+n+04aYQD9JeieetlELA1HwDHHw1+ubP9vHCILCtycriAiw66AaIBJ/93IGfKBw8CcHe5HrcbyRirO8s0lxYorCxsjxOp9Z3hL7F32OHItrLMryg2JxH1wZIuoR0zsIWnGGD+2xYJdAby0Yc4j4aCy+AyydYs+gakGOgmBkvgVKmtj7J3YptLsQONrkfFeWwKQk7FoHRVVY8hpTtw8JGS5ILIB72tSfqUzQpbnOHJqV3TDtIDN/UjyZlQacTwAD9X+7RvknIC7UqtNrPCTj6Dl6aqf7d+h2kWstjiJSAtW4ik1t+omjckfvx46UlS7eGakPuaizar0tGEqoT2RoiIQWDZtHk5PosZMTJ6avhYigfPA3cgO2cOfswEyuXqkN92oPrBczHKmiutjG+g5vDsi6lEltsP28SlNB/hfziP2RVMXsWzCPz5XrqMTUxM7qTTPJ2Akz0pX8ATyoLo9n5Uy00em8YkX+cbV4YCdoX2zEXDk2Y+rRveObvUlmuQSMzmO9LgMQbRfVyuRLzkeyrUcCBuTpn6XLVTp3LTQDsJBcLY7bq2FoXDv/UkhGn8Pa0/8Ug0ib8ZXxt7YDCU/9iEe22RCvle5sjc7PagOSve/i10Xp5U48rQtBdgBsOPT8u+pIOnUzUMlUX/9KkNckvKL/YdCg1rtZDEBLMdLwc6eNacs8RdNAAtol6eJbR/rxPBXMwc4GKw7+Ks5iyXuh3E2XEfKw4DU6k2CSr6VwTML708HYeKqpXWeHaEi+wTN2iJsQYbtsjUo+AvthvMUbGPywEB7FLEAJT5E1lOQ9t+FrD0bHUQMNtwA0OeddOlaGGSPVPa7xWlZBJ5Mdo0sBc5xky+VSc4ZaFRc81rFp5mTyHzoAwLRQ9ugb8PdKiqFGtrDDKnGGbvEHSZ63FpNcJmfSM1Batgu3CFY= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aaa79a36-1a21-4b8f-cd47-08dc0709a753 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:42.4806 (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: WV9N2OLfF7P+WS9AZRX7v9Ificpb9aKqj1xg3b5Fy8qU1x22lUTYM7CnEIrJm7X+/FJWrWIOFmPSbwCYXF+nGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 snps,dw-pcie.yaml already have reg and reg-name information. Needn't duplciate here. Add 'if' check for existed compatible string to restrict reg and reg-names. This prepare to add new compatible string with difference reg-names sets. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Frank Li Acked-by: Manivannan Sadhasivam --- Notes: Change from v6 to v7 - add Krzysztof's review tag Change from v5 to v6 - Add if check for existed compatible string Change from v4 to v5 - add Rob's Acked Change from v1 to v4: - new patch at v4 .../bindings/pci/fsl,imx6q-pcie.yaml | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml index 81bbb8728f0f9..eeca6b7b540f9 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml @@ -30,16 +30,6 @@ properties: - fsl,imx8mm-pcie - fsl,imx8mp-pcie - reg: - items: - - description: Data Bus Interface (DBI) registers. - - description: PCIe configuration space region. - - reg-names: - items: - - const: dbi - - const: config - clocks: minItems: 3 items: @@ -90,6 +80,26 @@ required: allOf: - $ref: /schemas/pci/snps,dw-pcie.yaml# - $ref: /schemas/pci/fsl,imx6q-pcie-common.yaml# + - if: + properties: + compatible: + enum: + - fsl,imx6q-pcie + - fsl,imx6sx-pcie + - fsl,imx6qp-pcie + - fsl,imx7d-pcie + - fsl,imx8mq-pcie + - fsl,imx8mm-pcie + - fsl,imx8mp-pcie + then: + properties: + reg: + maxItems: 2 + reg-names: + items: + - const: dbi + - const: config + - if: properties: compatible: From patchwork Wed Dec 27 18:27:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505451 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2049.outbound.protection.outlook.com [40.107.7.49]) (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 D0A0349F68; Wed, 27 Dec 2023 18:28: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="M/WXM2n0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JRFnMMQTwBVJkKIEjxq6w2mH1j78MxW7a0hsnPn95QHPATPc2WiEfg2BIiBrstf+pcS+JwK6X1u5pAxsIuJYh7I3sbcUSGUE8u9DSPpKAvh9N1GdSN/VklpEMCOMlizSkUfDR8HoRsUvwNPCzM2t/P6pbBiS3Sr81VapZwZtpSFoAzclHj79o7jtfom7DCcChxaiBwdT28TA2zSbdVp4dcIaOo/geu2MAY1tvoy+Wu2gPvgIg8SeflS8QLMxtJUF6oZYoH654TIF00HZu2xQnPqNWTQI5PDapQ6TYw9UeXHzWexFn5vWaG9xWwG7WlEhDDAT3JCmRK+6wTsy9M8Fig== 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=JbWvqYteYvr1zWHZKqAAJdl2+jva0a7FHdVtrlJj7y8=; b=cJyJQgyfHSODFGnjHr9Eu0U1Lw6rbNZUYJFsX4fzp/bG/3wVjmI2VHefRu87ZfYN0pRkQQHUUz+MrN5huCwUU1A0bIx3H6UbzZQSt2MaFzsK8Fy9Bf3Z0dB5gi5jOYkbYFiv7UxMPsUV5MyofrT8ckkjV0QPuZceR/rSzfiTr5rrETGPt0nE7rKoQ3OyRiZowGiEdXXgN48nfw5pys82iZJ+1bcryrTjV2guCxERjHXIS/HFDMWgeBGlszQz16e68P75ewOJxCUIoQr6z0VjKjVq2dy1aZwIBLDYEnNEyW4FDMAl6X22bJbpOyY+uUy5rmz3n9MmyzYXVWRW/rjT4g== 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=JbWvqYteYvr1zWHZKqAAJdl2+jva0a7FHdVtrlJj7y8=; b=M/WXM2n0NHXDsxTLeqZVsODyaMbmW76ymg2ahzncyP7YnIl5o0jju3xPY+RAjH59bhJDVsWExlXduBLp+G2oiy4rz3S9y1UbVcNgnPlSObD7wSVWEjMcVg87vZHHwiX0O8mSwyvzpSf3Uc8aAZtL9SuDOvk4q2LJ0MQ2uIHuwWg= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28:48 +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.027; Wed, 27 Dec 2023 18:28:47 +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 v7 11/16] dt-bindings: imx6q-pcie: Add imx95 pcie compatible string Date: Wed, 27 Dec 2023 13:27:22 -0500 Message-Id: <20231227182727.1747435-12-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c2d6d39-4fa5-4663-a77e-08dc0709aa79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8h95sDOQFsm9H1g5rRZsWQ0hw9GKwO+OYmnOtz9colibmrne/xU7v3p8/Dk0LYt8kIY7QC5gVv8c7T73BWP67x0MRaXXQK+FBSR0aUBtML0EuzbwE0O3K+XkjezFY3xmblAE53vK0X/il3aECLnNqnfqfd8ee/AKtXpeIrLLE53q7PGQsBJxi0OZTMcQOADxSDh6gB1ALIEV0n6aPHDrXJqBXmpNGgHpUyMzKTjfnTrN4nDLuN3NKGlwcKmGVyCJsyYXBTTJK2nfWxs+2NtFXGg7xmHoUUmdLngi8yDJP/YQ1nFEESRPbJ3B6x8wMHnWpBdut48KfBRODTpzKKmmfTqHE5JjwYhV2YXN0s8O6Md3rsDLrHHx29OVtMLMEZvEgprybdll0Lnh6EDccWCo5IpEwF6fdff/xtY9aOLwPX0cAutHDwoZTmhnpaHqEKn178WZLb9d940clIR7tW7jdiW8djAloBPzp6jMSKN+yS1u87jpf5USHObZ6X4VvQxiyIIQ7rz5fjf7P6JBqMJEnkRT2Z9lQR0hkwulndEXee/7zUlDnWaO6OdM2G7tg2a4MmZTRdttG+YWQNtEMUAx0v1K0hKP30SedrUj8PMBVGYuxeaU0YpxPQamapVFQSj10da6r5SCGVJ/KpikxxM4cA== 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eEj0Ka0i6EDImFpi1t/1VDKqmgYFKtTEwuzEYcTryoLaC+Sal3A7w5i8pNU9dsnasy2PUcKbUopuHWemnxYDHblmeSILtEQkdHqvlAcvuCSMkac6ZmP6vGx47svgVazqTszKgL7QF1BIc3GlG0Bu+PzbVWH8ihhKtqzZbuZLnAPuzaCr2+3hqJPVCrmlsn294zF3cJSxlalQRAY43Gpt+3nfCFYUF8ePVYKCrWe9KRkOxMhINercohRaRKKI6mTi+gBgN5BVroflk7fCOmVRNtJrEGycEscIOMaubG/A/6beULRraPkaEWlGqCfV5mKXOB/nZ1Z7HGu1w00Fi1cTzWsnNYJUCZm1kdBzwx33q7/KWTeGqRvHS+Ohf7e711x3jD/u0oFTzB6NYee0wABqjwDSwcxOj7NHmTjCC41WIksDee+QBGfiKz3H4trzWwIs2KzAuRjR0tvY0Wb0hf7lmAvMiQLVw8PbNg5a2gJOlHIGvysDlNs63tizKJiQZOm5L7DxsAQuvOOReV+pSHJJrI9zQWJ2WM0Q3sTvgie9eGgDreyIqi2GggiDLvRaZMkTdE9khYzNz4MbCwrHFlSTsjmK2ymfcC62ZEdb50JS+q7vnc6z2W25jjAxvTZFe00bMtNKm9xYdfOzqciMAvOmraP/1u0DukN/KessMEKeBhtYmqtuZQSKW5daNQNa5c790ftnNdpPC2VGbmxgqfGDR+GZXP+idQuA39IWgLWFhEYz/Nk+uhpYaJevBs5ek00b3BwxgNaL4CFfXUowBmMRBlIDacIzceVc1lSc+tBkrEWRq2VJh8jqYSPRbP7ySDyIt/2yk3ulbwtNgJ0Fjdpa69FVA05ittgVE392p779+1XKkudQYY1qE1TB9/DKrv9fI9FLXqvnKNUeEQBNVA6gwfdDGzReNBKUXeSeFFVOpo4CHgKCe8nQbsgKS1MWrhFxHvRGA1tp4gkMaGnY/ndzlgoFv24XMarr8EzpZ1qcona8yWRU/8bHukDSReAwMzWxiuVggy4V29aWThhe+pE6NYaKdWNCTQ57JzPMrIt0+X8l5ejrS3nIFsFkvV7WLIevOMdeXt2/8dn/d7Ha6b4CZDtEduwvMp9qoE+GIztSKxxBkVHPVmEv3GmGNDDgPLIxnpLm7zZygsEq5iaQqgZbR0ESCd4gwhkaoR0zF+veB/rcYS2CcCh6FrONOTUpmhqR0YuJV3s4s6SVxGZwqJD5wbFbPQ4S6om6PZw4hx4NXbprbSPYx4L70VPL2cM/4TGmjzfJRX6wA+/gbqULU9eWztkfz3k6+hBx4VQCyyd6kRgxl+/qv/ivzoN79DkdHnmLH18BD81rQze+JhYSrTuW+oXJd5AhicQcYfK0liJMhX9GANLHKliahhLGGz9cVSBcnmhLO1NhVx7klIeNtc11VRy+UaVqUj3XHCB3ZygY0flvTHvkTEpQOMcWgkaO7nr3wDESXaXkzA/iti3A5+5OSqEM7kkQGxrrsC/ahArkK+ZLy2CjOJOJI3J3P5UBqXasunUFg0Csah18xxrLp/dYtLrFD+Cy2tMUgjKvCexJ5TY= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c2d6d39-4fa5-4663-a77e-08dc0709aa79 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:47.7697 (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: /JEfqonJivWpiS517OXcF3KvLu0lZMHfctlT1NnPW/N764nsAhjruqap+dPvK6Vb7jGrnEgK1mlw4cPfLiWEUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 From: Richard Zhu Add i.MX95 PCIe "fsl,imx95-pcie" compatible string. Add "atu" and "app" to reg-names. Signed-off-by: Richard Zhu Signed-off-by: Frank Li Reviewed-by: Rob Herring --- Notes: Change from v6 to v7 - Added my sign off Change from v5 to v6 - move atu and app after config Change from v2 to v3 - Remove krzy's ACK tag - Add condition check for imx95, which required more reg-names then old platform, so need Krzy review again, Change from v1 to v2 - add Krzy's ACK tag .../bindings/pci/fsl,imx6q-pcie-common.yaml | 1 + .../bindings/pci/fsl,imx6q-pcie.yaml | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml index 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 Wed Dec 27 18:27:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505452 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2049.outbound.protection.outlook.com [40.107.7.49]) (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 19C4547F73; Wed, 27 Dec 2023 18:28:55 +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="XbsupIrF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FrF6R8QM3laeYPT1RB8eGiVUXiUASH7d7Xuhi+P0ip5TwCqu94v9h4ZnDlCTLWIney3Vs8HzxAQVyokaBVm9stI4LPfZqoQyx80cWQnPrRNw1Hw+WjktkY4QEtrAmH8uU75H0w6/sb7McnY1Yv9srOCue2AqXbrwqOCjY57JA3+ZHGweykGiHWNmqPtJYpzf8fUqWFlGhjKHsWfkGE9VIDtBTawSmruI1lHeGc7baq1qHfTcZeqG6PW60UX9dKIA20ZN4Ne9UnxrWrroYmvvapdGtJpQfPaCO1Zth98Z9wYLcihCMZC2yNlCrBEKjlLFX8CdfmUNGptSJlUZCPKoGw== 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=Zl//eFJX8KncF7srzpA547VFCN6+nEsS/ObtOxEq+66f6zbCKiNtxA6xbefBdB/eRh6BFDGGZy36gh9uiTBNkX+9TMj2oW3v0WlEjXldh8eBUgXPBnAR9mB21jV3jlhzLvLuE/fJ/tHt6fFNTAqmbeXrIv3NAkU5FCS4L8NOm3AtshhpnBj1Kl9SFypD2Q5SCHWIK7/I1PLkUWvpTUZOm2wKZqVdG9l6LgmaPhU2VCg9tQRTPcL42oxIrzYrYqO870Ov4b2WITi50uoCj9r0tZ62JqI626oABwWbVLCk7RDNyhe11FNGlUw0942rzXm46nDbepBW3W/7xIFLw1GGyg== 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=XbsupIrFvDKzvAd5+co88prEJ2nQA2TQA2F15CuukUdNlyLk+ToFWk1ta8RbiJp9h+tvrXX8zdyqp2wTuNDoptZvabcUnvJVcwE334ZlPiVZ7rh3OLSz0qMg6cda9S+TzH6XZirwi60ZCCmHRsoeTVCTcM6bdosd9OiPWva76vA= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28:53 +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.027; Wed, 27 Dec 2023 18:28:53 +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 v7 12/16] PCI: imx6: Add iMX95 PCIe support Date: Wed, 27 Dec 2023 13:27:23 -0500 Message-Id: <20231227182727.1747435-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: 63f1a733-7a25-423f-816c-08dc0709ad9f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 78A6wyKaEfUydDIPGsiaizZVnVWBVlR87Rhm1AtXFTX9udUp0hiX6/4qRq8KmRq7Ix/IQwFtTeOk7SFa9wOEBcsKiXvvVD36kddRbnYtE+ht/EMUW9huDezXlgDDxb6CvdPkxA5ToBn0n1W84BW4UqjfxatrsTHsuDay+wAyW9kYkT3V7SSy+KWxzKD/TFk5x2RYLU0dGcK4GKALB6+ysDnSzmckFd8CS+T/ByWC/y1cilCk0GM0eYF+D12bAY0036yqncDof/skUTxp6B68OhGOT1iivV9G9RYc2dXkjLIn88P14+QktvzWHVD5hzneYFF+VR09NPyG+L//n9cFzdpGpEZWrriaEapon51cUmNgjlHHOHSf193c5HmkjlLXj/XxS/JCQ3XCtNZrd2pIOxT5aYgbaf9n4bVzpIJZ4gJnbNj8AFQV/tnajOdmkd1MKZyQe521rOqiaF/3ZdNRvyT6KUkbJmEzguxwPPTwbBTA859ui/xumY9nwZ/MYMkJg909sI44kEYdDoGwl+GUlEneDJpEAowNQPhmrGPeKKYGpjtgRV/drKFGFW2UPO6LwVw0jRUcJegHVxMENGsTm34rf97zUKEte/4EKz81T2fDXR5xkIxIqB7AK2KRMRsz 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XAZRxNuLdas/AagOutqy4xrGUGTFYC3uGJAI8S1xLPkqhWACJuyXP8TWnESty8c0hzbjg3tP/dzFLyIfvSO+kkR3847m0xTBChMwNCssI0o3GHKKivWl7nq/EQMDt414SxSQ1layqfoPytwEFHZh7kSQ+bBVA0Wfnq9OpljTv1E81J1k0DbeBfv3KWL9jh4RT3RU+N/M9zhBI7ERXoEAIVT/+tsEek0JXDvtla61q1IikBlBMQ0pD8FqzmEXDEtJ+Ow5hkNdRqrQ+6ykh1m+MOljn53HhtuTd8gNAR5UufZT9zCz+9Q4hlGJpK1ItxT6C6XcptiSGGNBz0S+GywHNGFeSmdNytCtNpwSjBZso8bhIYxwqvAu0TRm4N8WgH6IFjDfnUAxT0bwjHQqauZbOhfD+uZ1G9Z+LKDscEtA8M81K+kiKteC7+oLBEsXsZwrJBxlEhoqgr4dxU08/7Cg7sciB1qKnmF7mXb+n2eivt7O3GnaPRI9ejxy9oe5vlcabEVdw9n7CmQiJEdNmLNd/ShguS2NgJ8TRp26UoHIX/3iz3pMmwdayfmugfFhTRnmMLShfj4iabdk3YsQAoV4V1vphyouXauuLlfqabc5qX7nnvrSNsu77QKRCDg6ox4RX/Nnere1IE1qKU61UDHikLKXWFMdv3TOM9A2qRg+V86SSOYFT1fvjM85bhSr36VOtFCgbwyqDEnSwudvCYELaUivyaL3IVwBDfmPDB9kJ5BxI0aGzCkmZou66tlLGwSOcaW3XiR/08y1OwIouovomr9THPWV8hklxp+SypqeMulOpz9PiFg/U7b/4WG41nPG7E8c7gYvmdCuBOigUdFguqm8lFN2eXhLhUxcyi7dv11jn7xKQ4vvVHf+8CJp9Z9MYu/IuFKtnQWawyMifXGDRJoAjIWmtrLH7UZDfDmowhbfEjNMAdF9DKmqJ/IrI/M1V79+1u/Wv5hw/9rRQh2arJH7mx4KKkvCOioKSf6omJ9fdi9UTD7n6gM0j9IphRs+YZarFd7LYRRz8lcQEwUDG+vvGicRLWSHgZoUOLIP0wZVjeTLCNBf92ZbRTQutzoQ9//C9CaBoy0eQTa4SUXdPRI1CMc/LAjbOcN3cSSbikKZFwAqcNsH1uTnn3dn3Vs3drYBXijmjsSo3ZAhM1qZa6oTpYorAWQeAY3STGUb8kLdgpdnpq2dBYeu4DqodPsnnarVtMUvlgM2o8lKdvKuzJ5gqgqiXdiv/8+Ruh/wsReT6C5zAIdEbJpW+jPZ641rPlGoAXhUZeaayci9LcTY6xHnXIGDhotM/Sq2V51kDBlm4pux6RlYMxXveN0/dJEjLqxlh1nQlLLRHWBQVmjyah8Cv/bY17ilZkvkt31FcRa3Jsg+Gg+rhFuD1lvGsmbZOEy5Y1QdvXJj0tVDaOUIPNHviUMvpVkO9yy7KXqBhb3P2wyMRUSTiUvc7BdweSlrrC7LD2O9G4GwDZvakh9iVBKndrhUXsY4VvoZsxF07m3W5OfYxvw/V2RtQiGjX4ehGX9A+WgNe7Ikacs+slVKjUJ2C0jQk6azBSptNrN78Yc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63f1a733-7a25-423f-816c-08dc0709ad9f X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:53.0454 (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: g7pofAS9Amwgekcu5CjhX/Y0mthWNDBEHGxnwMEaYgBvbh/PX24yFddzR1SRC8JDfvXUEogL1nAYZEc6YvPsiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 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 Wed Dec 27 18:27:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505453 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2075.outbound.protection.outlook.com [40.107.7.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 3CBF647F66; Wed, 27 Dec 2023 18:29:00 +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="e/QdcYeI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WLWqnPXXqj/+Tx208pO1CddN+VCrmKkAB924WdJcoyweTAgRXxLZTtNMGO7SzB8JBdxTyRYaD/Q6mJ35zTRVATAOkG/A0yiaY8LO13i0LYr/sOSYXHu1f89HSSFxK8SkmHyEuz79xAeSFgZrw4F2LzYV9iwzx0lLhbHKd4Tt4Nstq8xKk2P9WPJ1Wh/u6qfQeGb+yWHC1g0c4PwCvRmEMqSgL0wOeXugxB4pKciROpHsAZwmHmL+g+dV/F11I5Zqia3dVrU+iiIPfBCZE8fYngezdR2IjtzqCBCTYbbebguGCrJbp9lgOQUotFzgh5FOr8DbIkvSuZhXHUiwAjDRbQ== 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=ToEsJ0ir63eXajvlNUxOZ3wSsDdQTj6XV1DA5GEfl5nbjuVRi4AeQXuEkxNj1mCx0AQMg8uirM4TpufNhdC5jGzQyUq8QUAzQ37mWfxN0lUnp8Y/oJTRWlFU7p6Ezjsvzj68e7KJR0kwJhRBXffdNR5Ah/wRZvQ4lpnilLkNtyxtmP3Qf3IOcy4QVprmizMbckIY4KQz8dvh/Bun1wg+y9qwbokaY79yGPtbKHR1y1p6hub5M7HmpTL3Yzom6KyeXMouFsVN6LXW63tZG7tZl0fsBLKAJLSiribANhGQqxSERfAHnM6tRs/ypPlZnO4W1g9SJABGnCl951a/N+rmLA== 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=e/QdcYeIoBZ/rUqYbaL7PW4aLL3wJciFxbCCSQmN5nzllxWdQ/wCt66PWCOh0eVl6g1/cxhlRh8ZE58gVQO2kfgin4uwnxBGr7G/vIAtsLt8f5CbdU0fx7roaKM5I+p7K4Z2/uFDyDrsQOkqVyv6gl0VIqsNFdKVSwyHMbAOTMc= 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 DU2PR04MB9050.eurprd04.prod.outlook.com (2603:10a6:10:2e5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:28:58 +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.027; Wed, 27 Dec 2023 18:28:58 +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 v7 13/16] PCI: imx6: Clean up get addr_space code Date: Wed, 27 Dec 2023 13:27:24 -0500 Message-Id: <20231227182727.1747435-14-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DU2PR04MB9050:EE_ X-MS-Office365-Filtering-Correlation-Id: 2147a8d3-9d2a-48df-5b84-08dc0709b0c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JCLNRTPv87Qrst+9KLNGvKXi+S8oXe4EyK4Lh7bmb+cv4ebm7Xt77azr5SAmtgjoPJ+F22SbczWqkRVK1OXgOzsirFeHL2EBbBmdoDpNItflMMUztpw2SIWv3RNK8KlOWW17BPq8pa3HcF7rkBoufZfCwY+MtKovKCvl5ZihQ1keH7meZH93T0+bclKSjMNg7Y12yPNaa2MDj2MOfVtq5KqLUVnA2ZbujAnyqAycmFmWy+Zi4P2/Z5F3nefRmZhRjEcyjyQ6Mwdq5TcYmBgQsaANoaNeetp54+J43Xevla6+z8mgoB+nTo7B22kOs46aW4onRVhrTWQ4nMrov3QYQjm2hDUoXx6nFasU0fvtnuLjXOzxyn/ltSW3FHYagA+tcNtg9csjFU8osnA/7hHHSOvOESlWyTiPW9pdS4Ub4IdWOZlwaf1ViMCBKwxPL/SZ1qt0nU9FyG0agGWsnSWTmtkHqkRd2ZNBochXH9qpIUNE+vL8WpdoeyvV+Qpr405LImtbKjPAVU0Nx9Xdso+GCMSqnX9TToNGUwiv+Djb45m4LrczyXxMEww7E6igGG0tTV5BQ56Y4a0BN9kLd2VlVTvEP6yaO32Rf2bJcErvofyJmeD49CkwazxvZoMZ/BZU 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)(366004)(136003)(376002)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(5660300002)(2906002)(7416002)(478600001)(38100700002)(2616005)(26005)(52116002)(1076003)(6486002)(41300700001)(36756003)(86362001)(38350700005)(66556008)(316002)(66476007)(66946007)(6916009)(6666004)(6512007)(8676002)(4326008)(8936002)(6506007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fCnbbb39zlxNL9IHmBiOxmmOFakr+IqIZSNgXEqK7UZsapjaOK63gyC912TgYQFA9wiw0/tJaem8x5NFm5IKklY0ySDsElED/2jAzYRfOoy8lsJLfOq/e4POG0yukyuSOp0En17/OICfotDy/yuJXQ8bJjI+jAFiBb2yAf4Gs77mgFEuJ/NT40YMxA02DvlFguW0w9GS5OxsoZPP5+6LpK20tS9oJuqewcUtFN0ZwR6eAsEbm09wGTU55ngwAQkEjStFs4bR9/rcg1MJc9qh3h3inFX+mBsjkROXNoLT3CbBSxeomi+ruPaRHmO2E4Z5H6eVNt02cZCOlGA2Njl6vNwQFhd+KEHrlGRm/iMaJIQp9LxZsu0pg+HJl9POtpsi0nnlSDZGI+ef0ILU9zPN19YCJU1k+w4n7JGSxLZQrYHp2lvMVaYIZ/W2xcxIbSQyXPm7afjixIMXu3gYzTBU0lNKEM0EGYIk1PyOIU7yHcS4JDHw7Kt5vt0sK69pEJqi/W5/O3ER//bM+yWD883uY4GxplRTp3OfBnDUVRSlGqLfTNQQxPDRHql8+YUOoDI+yfwglgzN+G989abUBtu/QTGscpGlBGGSxSOBVaEUXi4DrR1CUSn3M7LGRA0UOBMSWLUb2YVhEhlZelMn7vblcy4SI22uUPtj+9TVJAWE0+bN9r43myl0txRcbndtxMPn8Op/hCTsFSBgSPKG9j0To1DMJ7L/ijNSjtg44C2k1/8STorJIC7WXDxECOCxGwT65BYhb9r04T0/c9uMlbcbRvUdj9yJM7ZPPeiauBFTVmImmP1LNJCbLRjN2mwWo+bGMs5hG4UTrop62yWJDqzfF1aXH1Il0mDrhBM0uI5rW2mhVLqp7gjzOP+z+GkdzQRDTjQNX0WBvmbnNlJgU6XbJIt45WlXC/4VeH2CUX4T1Z2ZVOpQPQD6aCksP9t631rTcSEsk+07NBw3Lb0A7sfqy7zg8Si7niEywY8ZE/080zGevhDF8xdLSwn60Qm4DMo/ubTWcgn0qlqCqWQ2Kz3NeFW0x+Th0z38uH3qhWCs/MPhTCot0b/IWeLK3l4Sw132GBWbJZs/GlqVA2vPzRouvN5YGPpbwS/wMEyOKXvdut5mzK8NgPAIIMIFYbnQYty8FMXpPCPSlfq/Q6UTEE/62j6oEm0ys5JqXyCweSt0BO3fdXv67IOxQhbLiwWhrwnZMfoU9337+Nte9PUTEhX67fb9eE/2u2pRDNcXkNCv+N4pc75Sh+MZ8AEBY/S4rAeGLkOEV/Alq2eSlv7ZA6E0pcRQlu+X4IAm0K3girviajH0TaYMiDuRocHLF4SV2u/9WhKaw4rTYK5mWEBLoWqidqX5xzpB2R0cu3eRdBRXkhsNQ/qmrKGl3/ZkGvlmsS43wJ1S5Q4CSj5R6gc5v+yvSX/0CbgCdbCJLyKA2BEmNNzk98TNU60oal8uiEzLEZuBoaQqPIPm/OI+zFs69v4McZcyWUTJszgkC2PELxZ3uCfSS38VXnjT/q0DB/nKa6ZlKiSR87r/GkN8ZwMIuloRHHlfuTf96NApvJVivzowgwc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2147a8d3-9d2a-48df-5b84-08dc0709b0c5 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:28:58.4517 (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: BbbWFmsxdDyDS7Ce0g/HqvoIUpfY3eTv+KFFnIr//vDpEUy+ll4j5wYN0dN/lbwIBWDEYQRDcR7HeR6wgAVg9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9050 The common dw_pcie_ep_init() already do the same thing. Needn't platform driver do it again. Signed-off-by: Frank Li Reviewed-by: Manivannan Sadhasivam --- 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 Wed Dec 27 18:27:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505454 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2047.outbound.protection.outlook.com [40.107.104.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6F044AF7F; Wed, 27 Dec 2023 18:29:06 +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="DX7tn6mD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ApX7n1gm+M4bjbRJqTXkGiRStMjX3QffupNU71iLHrlXGhd8UETDZD7ry7hZX/VGVi8MBH3I1ItzWxN3JAH7Q6DG3iradNNk+XgfSDzoAC0aHy9m+VnkhltFV2+AZVtRpqeyI7kyMaPaqgRhz5efnWFyabuMufrfejsM8f24oIZ9sPWCpi/UQe1xMrwA7/w3OnD1CSUXNEMWvRtxzrZ6/N+FvsPgiwr1Lvtz2JQhkkQEKq8yeyJc9HhIjFHFPSW3xKbjIGsTVlBXDa0pZKDG2BVNRKX4PTqRGZbTbqamIMiqYEULtUhWSSfYQW81iauGwPxqjLX9pJMITL+K9TalzA== 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=gwlfqjAX/bJm8kDQQyaHKohZWfUbxWlgi4hxX39gwZS8R+kG9P2fYCQ/4ytGuBMuQYO6embQIb2n6PNbLM6mT0GXNpkV+f8s6/m1kIpo/TXu7CDRiIp3NzkTXkhDLBbjK1NQ8KbwFRNFcT0orJnLlhdntPMwVfmFTLV+lmuVKdBm4FtjbhxSBhdQ25sxTj49qUohGagjr3xpyKYr0dC81cllYjGie+2AXt/heKPgc9P5jW1RJSf5arCaBL3lZrWPlFqrN/6rbL5Az6F73m9AOCOlzf3DN+qQNHgYeHA8Hu8gPfVK0uQPYlygqfKIcDU2J4cPVrbNc8kocaIqYwVodg== 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=DX7tn6mDunehZo450N/sAXCGyL1DydmdeD195lbVfEp9EetDeMtZwd4pIwUbRoLDitbNaR7KAOxtce4N7CeEWSBcve3Y4H1PJH3c0X6TtlsZ6DnpaDAzrxMeRMFMJZB0qshsiAkbliauHsKFcujSfrX6lDKyAVG+uw7Jjyh7hBo= 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 PAXPR04MB8271.eurprd04.prod.outlook.com (2603:10a6:102:1ca::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:29:03 +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.027; Wed, 27 Dec 2023 18:29:03 +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 v7 14/16] PCI: imx6: Add epc_features in imx6_pcie_drvdata Date: Wed, 27 Dec 2023 13:27:25 -0500 Message-Id: <20231227182727.1747435-15-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PAXPR04MB8271:EE_ X-MS-Office365-Filtering-Correlation-Id: f07a7711-c5bf-454b-4841-08dc0709b3fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FOJG+DyWS6S74BlfG+fXvXrGvN1jb9fs7GzKEH0j2ULP76MtX46DsEr53iu86SHdqBCPd94lxWU1eHbT7A4Q+LXiyyX1QNdyY/EQk/Qx9r5ksPpDzQ01RV7Y4ki+U6NSwUNtKQF2DkGzzywQWU+6j2yIVQ20AAiIpLEbS+vi1kzkvUbr82HTo+7z6WEG2QjXj+odh4SmKbVsY6seOFodBjOP8q/d5EdEDwQRPZm8t2Sb5Jj3C8dpwwQBIFw3ZI66PTQFdcTQ3UlPV1baVyR91l0y/am74xSVZhXQy5wYBo55tuBBBIsxmsN/HsU8T7Qc0mmH/8aPBu6pY+BHTr/sl13g/HtzVx1fxBZh5D4ueLQ9pploU/B89mrAytH4vT8rR4cqUG2zeta2X73F33T6NJ0MzNHtFK7q2zDDcujrHngKjU1CiwQ+X67HCvQ/XUGS3570LWZ8iwaOR64xyAe33HU7zAnf9LvSOLo5jNBCqAajWQaUzof4HTHZiLBRUIfsKANWMDUdYik2xwuWczFvMNt9Cxn4jAWdAn0np4VCC+/Js6nNSEDgNh2C6DAjnNffJgpx/TFFI9ZoKa/hYi714vxJh6ezW5GooAW9izyQMxI2TfpVd03s/gwmO4Qvr6ro 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)(366004)(39860400002)(396003)(136003)(346002)(376002)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(36756003)(52116002)(6666004)(6512007)(6916009)(6506007)(6486002)(66946007)(66556008)(66476007)(86362001)(38350700005)(26005)(38100700002)(83380400001)(1076003)(41300700001)(2616005)(2906002)(5660300002)(7416002)(478600001)(4326008)(316002)(8676002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NvyqK8ISlswTG03y4kdQCBDYCEYB8NMm3J2Mtmw6lIdVL+MJhDEyxQ1c7sLaW3BCU1itnIj4F+022DBorYsqmsQE0lnLYJRaGLePUgiomiq9FOgfku3YIlNsgTS68l0jsbv444Z5p10lWlat4ZvEyIB5lOTXdeCcG50Q+viwVM8XucZVWxj9yRdwcBJI3YfFWgklyBcNhLbdgNOQ9DPD3JtWcn/GUoQBfJIzdtF4v1GAIiUzmS9q5l3IP7SHbc0psUZDD1Hbk0m9iBU2NbiajN0EFAHtM0pScCUtlMTTG2fFYOWgjO7Pk+yOkFR9YnEI8fQBvW5rzkW6+xddyHZ0/KXRvpVLSl6wBEPEnITMxGDVxxIZp8oKCqYz+rCaB5CFEs/h2OjnshI0O6i47scSL9TuFuXD01qjdmQAa1E7ujQsJMHTNR5PC5jLODjxZm+/b95ynu0fsmGFBzovbm7W1PG85OdvbEosZjX8mTv/TZjfaZeS6rIlgOdcctzk1UU2TwUWM18dWx5NfDBnMq7aAc5h2LfgkSupFckG5FVIlO2VHCx7OshnsGXvXd5am+rbzUUTRF0GeNcekqrQbIz2Lit2t6rFNmkvpw6V3q3e2Z3NR/DKFeLaWZXWN76scQWwYjwyHNb+qYx7qllxP5EI6ARaQA1Pe2aYYeEwYkhnjuo7qFzxtqUtdacla05JYsPDmWcuw6W32wr1O/cbvH2jNodluZTbcd3h/6N79iTDf6ET9soMbyVfcyJmA32sQz+RJcYYzIMYKQGNBMB+m/9Xqbj1/nlCqIvNzlRcaaCXbB8tqsnbrZDoMt33NMIIgKW5HHXG2PyCteI9AAvci/9lQKJNbN7Lkk6bYRtxTAZL/XlxuQ+ogGhgJMORIzks+oqGg/6qb7ajiXj4HQfe0qLNhHV7v2WirQI9wGThLBIIM2+w1yS94+py9NqVES348soS1Qhm8gEqyZ6FUc+D6TYkTTCIzJXANJJzjHROhvreFN+0Tc1a8xmwaOMbt9ecncYknwR7i3l2gPtLiErWDrT0ofs1V86fKeh9/kMuxv1cLmanfEunCxusM/vtxl93XLsrf9zn+cfJ8IinMEssK7gWr7xeoVSm4wJkBRx+LTpklKc1z0qsDydJDLjO4bHRagJr6Ig8BhiZDkj+ZX3aFygR842ug6x1sS4NaefEExqqy7ZAboZ6hAmTWVyI3JY4rr9M/2qe4RSZHlq13lBnCJvS7Dp4p8kIQbJ2CzpI0p4rnqa6GWjhIqFHREiuO4JqgDoNVUC8D5POY2mO0+/TFYhsPyK43gOLIscH4F+BiBB3bj04eMWCFtZxLxfPgZKK81XX6yBBS9tdTXnlGkImx2orrLEo4/bp+PVMMcOXlEa+NEec3OSbMXdysCLi8XHJRrZKs5m4HdRYlO8qjjYf1ZyQam/x4bIOanElhcvZP3luId0FBQl1moMa8gEAqXvwv0jjKGB376VtJPitzsRDITVA0GLWEbyOWzRLyImksY9t8PSXoJ5P/6kEh+y/kPSUQN8bnQEHX+ioFAHO+D+ls+/63FYubqlgXILWXpXfvKn5QG0= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f07a7711-c5bf-454b-4841-08dc0709b3fe X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:29:03.7128 (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: rzs3oUCiUEAYmIUi5by6VpwMUmSK8zHXPN1FSf3K9/Y9iIJ5DHUb4TccBhWoYzfY+Npdi7FRykQdiZf3UAf3Kg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8271 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 Reviewed-by: Manivannan Sadhasivam --- 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 Wed Dec 27 18:27:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13505455 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2068.outbound.protection.outlook.com [40.107.104.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 758BF4C3B6; Wed, 27 Dec 2023 18:29:11 +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="gDw2mRSX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NNGNthzRo1zCiRmU8NAocUUQzwNMWzp9nVdcj48cByh981VLfMb5dLVNLJVR6CO+JsYaNEDt0eDFIQjJSJOJiUzU042Sofkb7098PvFaJmCKQ/faarA36LDQLARcQhHaMC58PUo8/aiuDvtSdhXXj571rQmFOm9NeLILNRluP0ColNt7oz3zbIjmc5ogJd8VvJhOKLKzXEZOi8KL+VweqymNuP2OqVUpNI5L9Sv648co9+mgyQwkwVc3PoOFKq9M0tkGcWpHYpZSxhtUFWC0nsV2x42Mvl90AF399VisJDvJtKSIlVicf6UCWF1DkAecBNb/NCXv+csEZtTMN7pOOg== 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=RYREh3KJ5RVQdNX6PZ6jcGYkGV+M6aawNQ0DgqLRmMpeGHNtNxaItXFvYid2YuXybYVwH07V4ah1XEf9/MBa3sjjga/T7SrGBW46uUR39XaH1sjGXH00vXnK5BB9BJh7nuVyz7PDEX8dh0FNoOKupxkkY4IuLuHuRpFtjzr5/4KwNTTRVqmGE99K+16A4cZcZhdD1MN1m9Zs4e/mepTY8WqgF0wXajvnaUs+Klh9LAwc3vS2mxbkQSICPLT9rnfAtIxUx9eBwYkQBix38F+o6Gdj9+xQwDLX/al61i3hpgMl5A1WjTl0S/tNUIsLmfOrmmEsLp02eB9WClOC1230tA== 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=gDw2mRSXqXN5GDJ1UK1XRGex4WTEF6nLDD9L5ePXVr9D7USdSDRUxx9Zu8tx39hwwd9FlYQAPxiWtUhdzinXAeit4zuOW1BcONMV4oxc/YpiVcAB7BceHU87I+YIti+MdTuOikgQqw0rwZOlPO1WIi3HML6vjedCOnpyoIPbVAI= 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 PAXPR04MB8271.eurprd04.prod.outlook.com (2603:10a6:102:1ca::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:29:09 +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.027; Wed, 27 Dec 2023 18:29:09 +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 v7 15/16] dt-bindings: imx6q-pcie: Add iMX95 pcie endpoint compatible string Date: Wed, 27 Dec 2023 13:27:26 -0500 Message-Id: <20231227182727.1747435-16-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PAXPR04MB8271:EE_ X-MS-Office365-Filtering-Correlation-Id: 4cf2aef7-f2dc-417f-2290-08dc0709b724 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NLLQGUMP65t8rDxO32E/O7/2YAB5RPElre0m46ytZW5fzcNMqnHhe2G1affeudrSVeQjeW8v5sY37AnpuQIL0Dxkg4Y0N+5DW9N14AeNNVYZuXdHv2lsKaCG2EPIAumXPIVzbouRka9KIQb2mLauW4U9CH5vN40wYMZVAqhAWgKf+tQsESupxiJQHtyb4icQWGSVtBSEz1syuc8voCPnRyUSSAHMKMnQQmxUDC/pwITT31H6MEszHnr++91OhR/6HsNJUv4ejLSuUg4i4V8HiDtnSYhjvHCgwidmSNtIeo0kgENRiN/CEHgQUOCFAbHwjd855sncKgL+D79ZJVXWZIaOUsKvby3qhjWM040hZ6ED/sAJ4X/gHUzUa88HZwzRiAS816L5FyAFlVn2bEaUz1SDacmbgyE9li6OPRT5hgibbGy8Tk320ODyW+p8TJ6R0GBFNyE4gVWVOldvNC/tE6pjwp10OzP05vDyvp02pwCjW47c3dOtTlpB3xymCLJViaMD2nT72biikDiNrZyhluV0ggqbZmV/3KyHqUruI9XbEgVEBjhaxX0//EW1M7N9FFoopMAZNFrF/nYZyF/Ydzc79FpP/Hl63x03cAmS5eyYT+QiIYULKu14O42bKaone/rfStJfdnIUNCGxlrIkPA== 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)(366004)(39860400002)(396003)(136003)(346002)(376002)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(36756003)(52116002)(6666004)(6512007)(6916009)(6506007)(6486002)(66946007)(66556008)(66476007)(86362001)(38350700005)(26005)(38100700002)(83380400001)(1076003)(41300700001)(2616005)(2906002)(5660300002)(7416002)(478600001)(4326008)(316002)(8676002)(8936002)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PMN3hWb9CUOW17xIdSTIBYMMUDE3AWETA/YZ4Ipv1ySa6gJ25eMuwCl+yAUWshnKhf9o5261wgJidj2HC634K5xgId/VjQBxiq7QFvG3/KbUKb1TGmIWKi8z9s2/O0W3DodC30wfMHMYzXf7ZIvNPmkbAxuiWxoCUx/2hmHJl0dxlwVzM36wyqXYaAFWExLQCyon0gVvY2A4zIHP+fl7w+zAbe0d9OxkIUhnr+jS04lEnXgKDkq7qCPJCrO0V227Nb9O/NbMG12vFxFhgMn8XrQEPZXq74dnYfNyKHNDDb+HVKdbsEhKxpven46XgO/hWW2cLlObpSAEPST71U3eTtmr+SvMEJtom/I849//ToQYOCCxH6OamrOd/l5wrKx7xp9K4AwHkhXvdhd+noxkYhRGu8P1HT7rEvvYFo3n1x2iWwLBo1fbLVHtV/+YpTXLT26Iln5TcMVGWxHB6mOQMDfNt/OtX0llCDNv1mya8z6iaooi2Sq4xVuIM/RcALkIev5XH0Yi00Oqm2mr+nLIrXACnNfwsHZ/a2ct2IUDw+ca1tY+z6AVuneGgaZYfX713PI6CZxsEtP2L2C/87NIiQEUs5MSbFVEaupzenJlxpUbe1Ss1Zzt92Ea0XwpMw5jRwOR9Y4MKpenv+7Xntw1feqw8GvJxf3myhCo07m0E/HeHBQUOdYVV+HMbzuF5YyOHiKoPqcivXI6Ij5CMv/RmP4qTg8anx8SITTRr4SJcpsd/5yXs1QSnP55vFvLVrdAdHwKmrwcmCN/4XGxhKx9kQ8CuYSMiAbwnP8zcI3eM8DANCYF8PhyE5u+EWG5ARrQwE5oo6kYorTzB6XmTRFT+GOdS8YTtJCKbw2XPs5SCIzXWLsisZj+JEaaFzqSOVV6dqIHJIUphp2cjoX561qX57X5CK2FboIv3wp6OHf9Csb9qfQdMmUv808GWUYEuJTJkuocUmCOHREjn3J7PM4uovx43GhrOF/K7i9q3l/9D9xNCVdJ/I+ChLNBqiZ/cQrddw9R/ka7GnuKp8TdR1ybVZ4z4w6f85dGMz0TDT7MK53MO56kMcforCHEe/S0HSBYCGkKl+fd/Fvci9DM1aeFW3dyZwXGynIpAT2TDWlJibN+nE449sOFX7RCnS4SjpHScVvSv6Ot/2ecmPNl5qY0nAsU+nOxJJzxkag5cr/p5RM5VkuOpql2pcrPzkINnFF/SfOB4qApldoZMB68uGL2VaN1OTPiCQW+IlpsTPSdQvGU8xIUMiy7n3MxzjWsnuOBqfBjg6g1hFsnkhKXiwIKaNjGbzC011KDcndRefw7sXjCZWQD40GUSQ6AclIsPa/w6geFnJaFOwZ7or2C4hgpZ5YCC4nG5nDDrmMpQ9fwYOJUt3bEF1LM9g8DAR0U5og05uSj00U8oAGt9jp6t3rrILjmkLVCscv/izDSrKTr5LqE1YvFty9hTpLBCWFSGe4qGw5nr+DJ3A2ank2ShAI4GJn8iRbDZr4NzHJpnEqTlo2mMNsfgPZzCuJxC3+N5cdJ1uvKm5fydVo5bNprjGKlmdwCJ7oOHQBDJSJnvjrNYIM= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4cf2aef7-f2dc-417f-2290-08dc0709b724 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:29:08.9995 (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: 5ePVppjzaezBlAenKsjz3WKXFS/48oBEdsrC7kKP/Jd8AfW34K2lfxHvsjh99KYVvlE4T1X4xDSMTenzYFu0dA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8271 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 Reviewed-by: Rob Herring --- 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 Wed Dec 27 18:27: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: 13505456 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2044.outbound.protection.outlook.com [40.107.104.44]) (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 7915C4CB52; Wed, 27 Dec 2023 18:29: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="dik2c5+l" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h5tahfWqbujAFfY9r4pxAesioXDpe6bS+NDprALCZ6TSnQ89oG/d0WImnd0egeDcfMti53WPRzj/l/797FG9g7yWmYbYv8pzZqNg1yWYMMD9NJAXAIwR7tKYz4ZyTV4auW+Bu+R+aJbQrtVt6bv+JtZ83P36Qu4Vgmo5jC/GpiSYudlALvlEnNyCOlfN2L28PEC2RvUjm0Nt0bjzwtNqth87uD04gOoByTeX7cl6e2pITET0w2jn6NHYzMniTeOuPJZvuArGmnQPuvcDrpQf7wHPfAfGwgYkefbLS8gZHNufEHcN5kJlwZtcctH4+hFY78hHZoGwBfkFoPGHBf2QKg== 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=lyPxgh9XgJ8yP5T9FNNh5l8kHcTTJj1/VNF2OK/m1k/k83RVAONBxthvlCSZb4Vi/UY7OHgfufD9ILuqmzvWWi2M13wVxYX0WHy0PMzmcIbHijmdpmFDFgkh6M6y5Vi6WpbMUFw8y3ekSGafwfWYm0KWD4x6j+N8/Xv1K1t56RpSimzpA8Up/l0OFHUD8kQTZt3GFQ0gt5wjGI0oIWygH/CCS2WBcsRtpz0KSkW+MGpggDVth3CyXomgsmNy8XEMKasDfydXRyKAIf/njgqW5GbX81TwqxdF+BmoMFoQTmkd4Calw0TOnI8Xh8N73FyN2RM0TgnYacVc9Yrr3cIMTQ== 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=dik2c5+lvc7D/sNIx/LbnKs5mJxhTZv7QGyAVZrPHVx2AcNaai5u9EIqokWqBBppiGPxs9w/GuSnsulp9HQIBIWhQ5X8Th3T0naT+pDRh4V1tupPLPt0enja+mFOKkvafHfxECCJ6LWOpFJMxo/qodIw5sjI5ltfwWpqeGWcvLo= 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 PAXPR04MB8271.eurprd04.prod.outlook.com (2603:10a6:102:1ca::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Wed, 27 Dec 2023 18:29:15 +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.027; Wed, 27 Dec 2023 18:29:14 +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 v7 16/16] PCI: imx6: Add iMX95 Endpoint (EP) function support Date: Wed, 27 Dec 2023 13:27:27 -0500 Message-Id: <20231227182727.1747435-17-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227182727.1747435-1-Frank.Li@nxp.com> References: <20231227182727.1747435-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0018.namprd07.prod.outlook.com (2603:10b6:a03:505::22) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|PAXPR04MB8271:EE_ X-MS-Office365-Filtering-Correlation-Id: 90c2cc65-335d-421b-fc67-08dc0709ba49 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vCt3+gXVP18Qy50gV9C9icewQCdaLpjt7Cie4XYDQKAKqsGCac8YCkzuujJb2ZxjR+Be8E853oIkGIaXQsm+2ZJochgSuMhG8/ySnf+emYpwvbtB1+s+1Poy8R4I6ItR6KPexwHMJehJ6TV146dPWj3xC1MXGVIZEJGA0QPDNX8bW/i1GxJ4xO34x3Huk7zgUugWBz08HG7mGmyWaq9HnURwQ0OdBKk/T9fnHlggBIHcJ6Xd8u4NTsRAr9oFULOtciCvJRaSiN12xBmRF4onHrLOLbnM8k/VOk3Y4/g8jPJQ4oRaIf30djd4aBaOxv5yoQWN3pqXee1sf/a6qnwiClni4Lny+nTqZDH9RJekjk4+jODpD8EHrK879MBnEx+81lNglnP2wfdRUHmajopKLqfuhwXxND0MKmMfBQRIs0qjdOiJh3g4c2+hIQWWUdiYOKwbW6taxsQFHGQf0HahkF6eqFBoQWFZbicBozG5COoily7qs+Ysj8JrnIUI2TXl8mvGeLFEMAdx5KSp5BIPGVfUOQqh4HWklCCXZfoIFeGpCDbfEtGyCSKIEOnrqqXwztkOxaZF7tgJDVRwM1nFZWm05v3AMYSKK6dUpcT0W9uWNhfhCIf939jUvx2R6OvR 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)(366004)(39860400002)(396003)(136003)(346002)(376002)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(36756003)(52116002)(6666004)(6512007)(6916009)(6506007)(6486002)(66946007)(66556008)(66476007)(86362001)(38350700005)(26005)(38100700002)(1076003)(41300700001)(2616005)(2906002)(5660300002)(7416002)(478600001)(4326008)(316002)(8676002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BGDhlxISj9Qg/Mi2OHKaySCVE+5YTKOjxQlH3g6Z83YoeqzUTxAdtrFiwjqWhzYfhf9Jati2A7vU+h65ccqzeXE094qVsdrOr5trHyU6fV9w79BDN29b8rx629sL3WYKpGkAbjYc+rpd0olV+5NEI1UhTxBJrzbf4XlmsGxK92rsqJ2pgLfMFIgz24p7RhjrNQTJ/v/0JekNOFU4ejJ2Av0ZlqUOX4H3tpJrmWxjgmchDiP7htNq43O81ywO6F8JsMq5rM6gynEedGgsgRF5LMyIZ9XqTrlMMtGaMAUHorcWFkNEEma6Z07ZuQwdNEZlsXWL4IxlEBbmfvOU6KW9ynd+el8LI+4hxwfcLlDFgQ/ChWNV1tdC6AthvhquRLrJgp0QsoWiSKB7dLku5eS/0gChJI32/JT5Ph/Ql4OuGwEQZ3lcI0qt1516r5W5q/6C09TpfCmE/ciOqEbuy7KkRK9kubXyigeucNxO/AZwR2RQx0LbA1YCuJTl+dIUs8dpGDByT7Aeu78Xvk/bVJVlNkBcoMifWXlqVMKnYiabRPPzGM6a384nYaN/n0/aCtG9aig0GkiPu7fFxr2uZxvSxShxmZbyzbT6ZKeycFkUnw8K/JmWEg4wi6xHhgMtzJAtuEYGTW8eLfbr/cdaMq0GhaHW8CD7ViuMcrdeRE0SLNCmxF+IOXFeUyFi5r4B1+jZUk8g9h9kCMXwX0RrdVDMqZ3visPqbjXBDaFbCGUiJyv3CLdf9P/UjU22PbwHnar1g/HXvXV70vn09t6F+QHLVSRS+t83BShhJIJZIilYd5708HzB6iw5F1xYmUWIHNFAFiMTuPuVJXaTKUpmHye1xYV1yQtu+pSA/9Udcb/6j5WKOOBkrd8DehKBhGseo/3+5IQ5fmm1l+Sgj0pYJ6C0updBU2lvByotCgiGHkZwzDlAPeBwFaQ/SaWTsWmLXIDfjbR4wiomjiUWyKHQwlJN7SDWkoI7og2Acf+xrDviXHaL6LCoYEp9r49mreJX6+k7c4hJJj8/e/Dp/JkUYWlcxSZHunvvDFUIfGHTquHfH5zkW+YpOKcFJHyW75B+9qV1A1qVGYtKhyRCOrcShmoQGZPswq8FsOwpJnkSzKFtPvyzptQcvlgKokXmufQ+m3NMIyfZjbMfOzX2N3gw2nIJr8YZK6X/f/Cx4gLcuomC2BSoLvHGx+yW65XYXd8R4chFmfp8ayGQmc1cEqCEp7r3ysOUbthXAn+aEBtUOcwFnOgHEr00z+s8wiKQkmp9mAHdbo+/8oUyXHFQmCDpYJ7zjUJkaEV56LVVYenh0uRgqm6EGUkArM1/8hBAYZXSKea6P4tvuNBjkb3ry6q+0MnwvERYmS8IvC39Z362RGAxEHZ/gJMP0lPH/pA/D/0J1X7UBo3cPAVlVi0bD3V5nJA4kufO2iIJw0Vj9npw1kbDVWw+Uq4FWiuZ4TaChaASghvsvVSyZoTl5kwCgYJMHTfLtmErqX1+wARO/is/6y6G4z0ZNcKYswUEUPuVKhBZxghWAoAacIdiJJqLDIcFAynBL++RAOqwuOptmiAhjJM7Wvw= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90c2cc65-335d-421b-fc67-08dc0709ba49 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2023 18:29:14.2933 (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: nBzqDje0MZ7S9t+ou6A/REfesmugsM5eLq7YJntk1dFAd5uuZJbb/MsX0r5Vi5GsGeFUzyFoF20l/pBX8YxDng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8271 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], }, {}, };