From patchwork Fri Jan 19 17:11:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764880 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2064.outbound.protection.outlook.com [40.107.22.64]) (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 B8B5243ABC; Fri, 19 Jan 2024 17:11:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684314; cv=fail; b=gq+MaH5RdMopSrdlqKsY8uB06t5iKXO2Q0++HDd74zExICFXtBwampEDQ9MqauXZ7d/bwGc9oExJrLoUyxoOmQC4G7EOddFvQAhvTOXnft4QYPEQmPiH6EhkeFU1ZeO8zDhpr1LXwOW9ja3d1IoAJLl9+KxEcdvRnWcQZstLOJs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684314; c=relaxed/simple; bh=7Bg1aeS6e8HAzNXIUNOmviXfjwm5EPN3eyCeZhDffps=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=rD07wYDjYb5JNwHP8ue3uKds0Japvev03YjaUmou6mIWXyeEPNsx1mCIODmTnyLpLj8axT2XOX1ZI/s4qpyOncluzo/b78TC3z30Q6V6YpJK76A6VSikROmH7fXgkRistB0VwWfdeDJmraqa+FpxOsIXJJzNxP5sCeSN1OeiWaw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=ofCqe6Id; arc=fail smtp.client-ip=40.107.22.64 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="ofCqe6Id" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BRJULRAzniMvNEunWl3XdoQbne6rkbmFdX6uKR3U7IQRxZjJBJU9+XndoIr5RYqmZqpAN7aVh9MOmn1Taw8m+rKc63xaHmzJCwuKwTi2nTWDjQfXStF47HPJFfzTduq6h82p+yRaU9vmFaFkxOlkExdIZjHZRS+SJICicj7IiFGjPoYzEmjS88dE3LpsnMmvGO4WUCo/GCWiancUAlqdlwoAM6P1gLiNYAOdxIwJjzWKkZ/X2Y3c58TCyqRUnez35hreTVprZsl/EbFcgvJ9t8AM1GNnPzGitQWyLId7Lo+pHUOuyb0obolHPRfmVZKSPolyGckszCFaydVrVLVZVg== 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=gr7XTXpX1v3wRL8OEuZrVLOd9tGwreVS0m0WZGupT9M=; b=WBKY8pl5ngOz46rObew8QNVj7teG/L75uS+58wdzfdg0f/tdkGzyDmb/R7ZTrBkQFT9OBueZwFjJWwaHhnMB9GCSZG9RDwv0sJnrc8fx91P83D4O0CSDDTqecwAp6sH9NpZ5ImHp96kV1ZUEFaGe5jeQ2rr9IRuwDHmYPDzrjucNI8usgvrrrrlsSzuwc1fa6CKkhpTtA4cYZPHP7MRmFYXeHpuA3ZWoeUWzvWqj3T5utOesT8nkYjCS6MJ/bbXZ+8VmHfUZkcdI3Hw+6I+OkplO1eHWDy+00ZtYyp6f6qdqikBAo2+X7v876DaiEPmv+xZJdBJjvQyUBlSSdDHW+g== 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=gr7XTXpX1v3wRL8OEuZrVLOd9tGwreVS0m0WZGupT9M=; b=ofCqe6Id08BdzPTIsGiW2LpbDFGXg9MTrYxLwN+ov8cBsSsx8zy9XzA4N36MedPttYVnBSEMKsCOMc1f4VRcGqtEaSILUaqfVVQfjFORmo/mHvOTJpEERYChD7icPWhMdb6wRYGikC/Dl5sPWhEm2bU2aLjPcs3+jQcoqNLIwVk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:11:49 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:11:49 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 01/16] PCI: imx6: Simplify clock handling by using clk_bulk*() function Date: Fri, 19 Jan 2024 12:11:07 -0500 Message-Id: <20240119171122.3057511-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bf45ef9-b3e9-4e02-c3d1-08dc1911b910 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5IwSZfDqnRTeyEh0/e2nVcPPXYpx098E21/0l8gS8PmJ8jfbKvh3ZbWUPDF3Jp7Mz7+mIulbcDe3AdSIfqx43AHuB5N+cbzTAIFvHPizkgX6nTdzSetJdmKD5tICe5NiYRUZjw7dro5bHwcqB9ju4kO/G5UqLHImLqRQ77pURoVFP4WBUt5QjXYg0sZ6DcpS1UB+TeY26HBKQOFf9Z1r6smi/ykt/mOHWrH7vMR8+ek8I3HjoTnH6OCFShWn0CSoWJQayVpf2clBm6/bol7xIAtNkaEacmtOUbMV0U6zbvvxROSLemvQaddfTVSlBnQ8GxuPJp9hGCiNRsVjJLzFLq5FHU4XA6N5J6a0cAe4i/SZTf6teQfNqUxSaagL9wd9Ti2XqpxhTqFoc1d5w+FuMqTtVuM7BoWwJ2huScGx4/hhzCiHMIS8uDMTS151nVmq36uliVSYlxn81qTcvBOCd8ImJO7+bMeC773u1pDVHNM9lFkRBkV+w/ZuM5KCaD+JudSxh2DMPCsP3DXjcNLRQqkmEWMr7L9C86UcPJmM0cLB00bq4BMZ/Ml8olx9KZbP7riS/DBiCaZkL1Js2zl524Cv/rJ7oI9MvTnq3+zFhPsWnaVPjs4AZ9S6BnRG25uR X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(30864003)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mzfqRg008uVNMOdwGlMTJPS3Jx2xeHM5TcGBzzo4+CRrh33W0xrbq70BKj3hTvQXpxbkcf0flli7jFfYS97tDtGm4zQY9ZNJiqHI+ACe6s12IQ7AVvoA+B6f+/5uGlnJR3nfORWTr8SQwZrnWZGRP21qKTOonO4Mku2XWt76p5zw/h/RViNACE/sNsZR7+BeMOUaAwZCaS2I4DyxMOj8QFr++OokwcBlTePbqD0Vk14semw9f2ApDpdFFpSUDlYfAzY7fUPSYx0p3QmnhHMvUk2AocDl/6dl7Iq0svj1zBTB5n+doEKtXYf2dxLoWODHa/gk8ShKNyVUMsUhv+rSaml/nP9K+z6i0BXI8x8La3CFn1KQCB4YlOanZ12fk8qlGgZPVdoyoNaVAmti3mxQsuDhw4vWlQCpnbonswLuBpI/Sqlo3FMNc1aKuWpRJc4bKJcG7imAnYpJufkUbHn2xWx5B/KXsPaQ80Qqivm8LuIXaJay/ekxhXEmy41xC25IE6nSUVI0FgU8j2hgb6vRw6SuKHZhZ0yfw8UCE/WD17k+Z2cpKLtu1AJSnYTiDehL8ehWLLeuCF+u5IZ3kedmRSRynxN59NFwLSTW7O1T1Fr4ATN+JA35XV7R3vUrxSbU7822HLmvQ17wE8oyGSgPXRIKzysNlayp0tcM/L5e2zSKTpRQlBIWSFdruX/RmsH89TGicmNwagbwIGReTk/QEKQwGGgmTCdb47uNMsNTqeZSVp7XFLxotoYeJ64b4CQnM/NL9PXJ6RjG837k9iDv6EkYLwG9/ZM6v0et9YHVfqHQBiQpUOk7sV+bzf8SydWHO8Xr2HQp7Py1kGNUf0FMeuJoaKAPHy0KDze1n3lMbbv/zX3ybGxzevTdFX0UZqoyDpgMqUN6WXaUMBYArUqX2ygIvXGdOeWnkGLFbjFQN3sFbfEneEtJ6CWGQY+qRdVZD0i5U5ucYCHFO4+MkeFfcbrxuwsjL2zFpJWBZUh5MwSs6AAOq1K4rcWg3loTjdsTPFWtCwKyNDj5xb30VwGGx/jg/1leW2HYsV1zCO5F8iE7orL6DUIP4k6PpQ4hYvBv+N4cW7rAEq6jPLbVAHeq+cGps7J9L2tzqUvS417uDLnmiqhb67GgaSF1Q2FpQ4aFaPoOXODcrwgIaGiOz1+tqY1AjMOjwajvSkvpyuj/RPMJmDgFrhWFspnvId+jE1TSyRWM7wyS6iUY1IbVTp/GeldHS/h81pL+x+CkTOesMiYSytq9vysKnd94jw9Dgjw9djWzpFAAmeO4MtkefOqOPKDrxKM/Dsohdym8bzeE15B4UWcVp61IYmzHoBzFv8xMhAHNhe/sCAXNJVCbXsGgdofrRQZyItkgg0xUWvs781g3WwgwM5s1/kAWhlsZTH06YNLIxci+BHVfVJL4sh9hXYM7HgzEz/lW4vULTzfy0bFM8l2PsJpOa72zBiMfYFPAhzSdBqcBObuUeilQHS17smxHi7agQwWusmTjjtZkMwneD8S4VTC0U8r1FximFweZI9oa+fnAjBL20jsH2IcQ6zOwP6zktD0ZxAkoog+Q3OY= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bf45ef9-b3e9-4e02-c3d1-08dc1911b910 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:11:49.2578 (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: vpcig/nGpXMCI3dqsWMnTVRQ/WL/dhGhOnqb48YvS7R6hgWad7sAOyTUteYWgvUe22F/zOm9bhuu34cHi9hh/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 Refector the clock handling logic. Add 'clk_names' define in drvdata. Use clk_bulk*() api simplify the code. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v8 to v9 - change clks names - Add Manivannan's review tag Change from v7 to v8 - update comment message - using ARRAY_SIZE to count clk_names. Change from v6 to v7 - none Change from v4 to v5 - update commit message - direct using clk name list, instead of macro - still keep caculate clk list count because sizeof return pre allocated array size. Change from v3 to v4 - using clk_bulk_*() API Change from v1 to v3 - none Change from v4 to v5 - update commit message - direct using clk name list, instead of macro - still keep caculate clk list count because sizeof return pre allocated array size. Change from v3 to v4 - using clk_bulk_*() API Change from v1 to v3 - none drivers/pci/controller/dwc/pci-imx6.c | 140 +++++++++----------------- 1 file changed, 50 insertions(+), 90 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 74703362aeec7..0997dd7d901a4 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -61,12 +61,16 @@ enum imx6_pcie_variants { #define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) #define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) +#define IMX6_PCIE_MAX_CLKS 6 + struct imx6_pcie_drvdata { enum imx6_pcie_variants variant; enum dw_pcie_device_mode mode; u32 flags; int dbi_length; const char *gpr; + const char * const *clk_names; + const u32 clks_cnt; }; struct imx6_pcie { @@ -74,11 +78,7 @@ struct imx6_pcie { int reset_gpio; bool gpio_active_high; bool link_is_up; - struct clk *pcie_bus; - struct clk *pcie_phy; - struct clk *pcie_inbound_axi; - struct clk *pcie; - struct clk *pcie_aux; + struct clk_bulk_data clks[IMX6_PCIE_MAX_CLKS]; struct regmap *iomuxc_gpr; u16 msi_ctrl; u32 controller_id; @@ -407,13 +407,18 @@ static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) { - unsigned long phy_rate = clk_get_rate(imx6_pcie->pcie_phy); + unsigned long phy_rate = 0; int mult, div; u16 val; + int i; if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) return 0; + for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) + if (strncmp(imx6_pcie->clks[i].id, "pcie_phy", 8) == 0) + phy_rate = clk_get_rate(imx6_pcie->clks[i].clk); + switch (phy_rate) { case 125000000: /* @@ -550,19 +555,11 @@ static int imx6_pcie_attach_pd(struct device *dev) static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) { - struct dw_pcie *pci = imx6_pcie->pci; - struct device *dev = pci->dev; unsigned int offset; int ret = 0; switch (imx6_pcie->drvdata->variant) { case IMX6SX: - ret = clk_prepare_enable(imx6_pcie->pcie_inbound_axi); - if (ret) { - dev_err(dev, "unable to enable pcie_axi clock\n"); - break; - } - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0); break; @@ -589,12 +586,6 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) case IMX8MQ_EP: case IMX8MP: case IMX8MP_EP: - ret = clk_prepare_enable(imx6_pcie->pcie_aux); - if (ret) { - dev_err(dev, "unable to enable pcie_aux clock\n"); - break; - } - offset = imx6_pcie_grp_offset(imx6_pcie); /* * Set the over ride low and enabled @@ -615,9 +606,6 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) { switch (imx6_pcie->drvdata->variant) { - case IMX6SX: - clk_disable_unprepare(imx6_pcie->pcie_inbound_axi); - break; case IMX6QP: case IMX6Q: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, @@ -631,14 +619,6 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); break; - case IMX8MM: - case IMX8MM_EP: - case IMX8MQ: - case IMX8MQ_EP: - case IMX8MP: - case IMX8MP_EP: - clk_disable_unprepare(imx6_pcie->pcie_aux); - break; default: break; } @@ -650,23 +630,9 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) struct device *dev = pci->dev; int ret; - ret = clk_prepare_enable(imx6_pcie->pcie_phy); - if (ret) { - dev_err(dev, "unable to enable pcie_phy clock\n"); + ret = clk_bulk_prepare_enable(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + if (ret) return ret; - } - - ret = clk_prepare_enable(imx6_pcie->pcie_bus); - if (ret) { - dev_err(dev, "unable to enable pcie_bus clock\n"); - goto err_pcie_bus; - } - - ret = clk_prepare_enable(imx6_pcie->pcie); - if (ret) { - dev_err(dev, "unable to enable pcie clock\n"); - goto err_pcie; - } ret = imx6_pcie_enable_ref_clk(imx6_pcie); if (ret) { @@ -679,11 +645,7 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) return 0; err_ref_clk: - clk_disable_unprepare(imx6_pcie->pcie); -err_pcie: - clk_disable_unprepare(imx6_pcie->pcie_bus); -err_pcie_bus: - clk_disable_unprepare(imx6_pcie->pcie_phy); + clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); return ret; } @@ -691,9 +653,7 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie) { imx6_pcie_disable_ref_clk(imx6_pcie); - clk_disable_unprepare(imx6_pcie->pcie); - clk_disable_unprepare(imx6_pcie->pcie_bus); - clk_disable_unprepare(imx6_pcie->pcie_phy); + clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); } static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) @@ -1252,6 +1212,7 @@ static int imx6_pcie_probe(struct platform_device *pdev) struct device_node *node = dev->of_node; int ret; u16 val; + int i; imx6_pcie = devm_kzalloc(dev, sizeof(*imx6_pcie), GFP_KERNEL); if (!imx6_pcie) @@ -1305,32 +1266,18 @@ static int imx6_pcie_probe(struct platform_device *pdev) return imx6_pcie->reset_gpio; } - /* Fetch clocks */ - imx6_pcie->pcie_bus = devm_clk_get(dev, "pcie_bus"); - if (IS_ERR(imx6_pcie->pcie_bus)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_bus), - "pcie_bus clock source missing or invalid\n"); + if (imx6_pcie->drvdata->clks_cnt >= IMX6_PCIE_MAX_CLKS) + return dev_err_probe(dev, -ENOMEM, "clks_cnt is too big\n"); - imx6_pcie->pcie = devm_clk_get(dev, "pcie"); - if (IS_ERR(imx6_pcie->pcie)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie), - "pcie clock source missing or invalid\n"); + for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) + imx6_pcie->clks[i].id = imx6_pcie->drvdata->clk_names[i]; + + /* Fetch clocks */ + ret = devm_clk_bulk_get(dev, imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + if (ret) + return ret; switch (imx6_pcie->drvdata->variant) { - case IMX6SX: - imx6_pcie->pcie_inbound_axi = devm_clk_get(dev, - "pcie_inbound_axi"); - if (IS_ERR(imx6_pcie->pcie_inbound_axi)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_inbound_axi), - "pcie_inbound_axi clock missing or invalid\n"); - break; - case IMX8MQ: - case IMX8MQ_EP: - imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux"); - if (IS_ERR(imx6_pcie->pcie_aux)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_aux), - "pcie_aux clock source missing or invalid\n"); - fallthrough; case IMX7D: if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) imx6_pcie->controller_id = 1; @@ -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"); @@ -1470,6 +1405,11 @@ static void imx6_pcie_shutdown(struct platform_device *pdev) imx6_pcie_assert_core_reset(imx6_pcie); } +static const char * const imx6q_clks[] = {"pcie_bus", "pcie", "pcie_phy"}; +static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"}; +static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}; +static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"}; + static const struct imx6_pcie_drvdata drvdata[] = { [IMX6Q] = { .variant = IMX6Q, @@ -1477,6 +1417,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = imx6q_clks, + .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX6SX] = { .variant = IMX6SX, @@ -1484,6 +1426,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = imx6sx_clks, + .clks_cnt = ARRAY_SIZE(imx6sx_clks), }, [IMX6QP] = { .variant = IMX6QP, @@ -1492,40 +1436,56 @@ static const struct imx6_pcie_drvdata drvdata[] = { IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .dbi_length = 0x200, .gpr = "fsl,imx6q-iomuxc-gpr", + .clk_names = imx6q_clks, + .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX7D] = { .variant = IMX7D, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx7d-iomuxc-gpr", + .clk_names = imx6q_clks, + .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX8MQ] = { .variant = IMX8MQ, .gpr = "fsl,imx8mq-iomuxc-gpr", + .clk_names = imx8mq_clks, + .clks_cnt = ARRAY_SIZE(imx8mq_clks), }, [IMX8MM] = { .variant = IMX8MM, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx8mm-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MP] = { .variant = IMX8MP, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, .gpr = "fsl,imx8mp-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mq-iomuxc-gpr", + .clk_names = imx8mq_clks, + .clks_cnt = ARRAY_SIZE(imx8mq_clks), }, [IMX8MM_EP] = { .variant = IMX8MM_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MP_EP] = { .variant = IMX8MP_EP, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", + .clk_names = imx8mm_clks, + .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, }; From patchwork Fri Jan 19 17:11:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764058 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.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 6296155E68; Fri, 19 Jan 2024 17:11:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684319; cv=fail; b=koiRBOFg4iU+ynxuSaIu2SxYggyWC776IzV8pjkBRJksQTzgidppEOpjTFfHzyMv5hJf4SQaxcIU6NlzSrbTuSjvCKoBzXQ4UWqhc1cxdF25M1p1++UbCB0IPXEpDKQOYkR9JyYFvCRVwTxckQTStBhdqd7jXa0rUzAFYVooamQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684319; c=relaxed/simple; bh=tfuLbcIgFcHc7j++FYuDUuiDZ3JpWIsbttnlS2OyvOA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=T95aKzAPgE2xZVx56iaek9p6SgVvnNHrhhvFrFjy3yZILajDbLSovnYZEXdfpLMqQtRzK0Su5x3qOy+wxoju02SP6KpwEX+IS7nGZqffmWeFFWBD7FKeQkIy0czuFeL41HnzdfGUIRgJYPGwk8J+Fxcgwxz7jIcRxBbqo8Q5ai8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=a6opdY4y; arc=fail smtp.client-ip=40.107.22.45 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="a6opdY4y" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R6RnWYD/YeHCINQZW+n/ge9Ddz+ayzXALjJwLnqiM+hLTInXatXf6mBEIO9hWzZE1WD8j6l6ZcgzeA8AnFhgqzSIAsYN3KHV8o82Mtus4AuuxpQ9uKYdwlkdhFtMNxTyD7aOzTp1IEXOcC1ZkFXtrQuPBemts1m4N6eXOv5KS8V705sHsTy1tUTLlxp6Qwfuclb4XVEQjsUYVIPlk3SPSfxkyyBZL/iyiqTtbrepunnne5YFGHsd6s/Jh+KDlLGXHS+9iMAyOtZQK+HRBPK7+/vjrwWj3R+0NwOucT8tnRQdC3q3NdOBY9twIKMzig3f9awieqhnVrpJsqwIFDmTZQ== 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=oHMPZXiMQDwhqebqwROEQxYmGUPya7OaqiGJ2sdPpc4=; b=W9vZKB+csy983DBQ6Oh8TAgbd9edU5H5leRKt54qCf8lXkl00GEByM2QNfYYDAOsjOi39+g1/C5XIfIskD8sthlAEfDj9LBK9BGQJz7qXsSxs2h1kBs3KpAY2U6T1hKPBoOxmZ8fJL9XbIA7pYvtWoiFrv33qi7YF/V9BxoZq6cA/kiKxrYVJhyszStcU4gL7x+UgDMzzcGp4wuWrGiHM+2z1v6q5MWTgI7Psn7pc6kRJSDltd2jepEACvxYclL2TQ1231aCxCJK6l+0OdGG3ztWxgMLo74JpVYh6K9Hjk/+juTNpyC3Bp7uuP8K6JJkVGSx8J7rNelqgT3ivQ7aTg== 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=oHMPZXiMQDwhqebqwROEQxYmGUPya7OaqiGJ2sdPpc4=; b=a6opdY4yK0msxpc2ZmZaGNtNv5E+oWoD/aWDGcPTvzrmSbKYtoWifD1HsJvEfHYklSpK2zi5yMzKMlX8W4Cq2VuZgJJUSqzkyfOvwIpTWzLWiNYwkRm0AkkBVr7Gt8vVJTQBkGQrbvDU1NeuZs25loaU3ks2X3jPe2yynxWYPY8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:11:54 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:11:54 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 02/16] PCI: imx6: Simplify phy handling by using IMX6_PCIE_FLAG_HAS_PHYDRV Date: Fri, 19 Jan 2024 12:11:08 -0500 Message-Id: <20240119171122.3057511-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 20663744-fcbd-4ffe-059a-08dc1911bc1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /bJ/Gzpls1pG/P6aa29X+KkCDibWobaq1gXwkDdvvrujreHIotRjzm8osDwlNhHRsDP8E/3PZ4sAMsRGsMUjydJ/4FGFshJlQThYzACAAOv6pcAqHNu1c2hkh4SF5wso/lhlb/je4ojHIed1TSrTIeOMttj/cl2759Ji0vje/lFbuUh32UlBobv+h9f96kHXF23ZoqEOV/IEyOSpzc3nz96edIW3EHjLULJTjq4mPX5NkcfwIGw6kNu26i08lecnazaWiimRA1p0aQZO3PP0ea3KWeI+K5+4qtKQwQnFjmrey6sjawSuhYa3v1oI4AvlkESFJloX/N5kdrWD8SchWCNnoRqDv9g/OaD6MUIQUXUX3fJCXwrEztf/U05z6un3nh9EVWg2+UoFVT4hFCnyTwWtRgITyJkXgUAGvwsUTyqxrJGN0nPexd7TD/InGbzPfe9L2SoIBZ6uI8zNZlzVx2SlkDKg7OEknyOiOW+tRSQalJ2fQBzRsO25HlQumNiEZcXmn4KmHFdyY0A9HDy+mqjT8Pbl6jzbTR61Fh+K/n0cUelwiIwOLq+d1zm1OgAwA90tfI/eWR80qS6keowgMaN0AkycOXOaLuYKcJoZjxBFjJRWEWAW03ErCdJ0zeVK X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kMKmIYZXpnauVVooWlZYWh3l5bkikUawcckoE0mgADfkK6VDanYK5w/i1WuwmuDbNYiUOITbZAR65COKYOJL+wDrmvlRyo0+rBlqCsaffA6D7O131gAcPbUQsV/Ore1UmJfMYfIWU2gDvRY3JzBCCD2JWLRJS1kdkxXoxoREAVKoB+izU1U+n3o47LsmrjpNV9jktLdetLKSwyzMzwESjjO9ArrB9AKi5IovdJ8FJKbSY4fSdVDCx8BjssfgBOl1y+reu/8dzEtRsQbXo5fRX5F1wOZrVii2phwZaTz0QetbGGQs1BjgbDOgvCDZSTcolhuBiLtI7NP8c9jNbN1DelMoo+tT7P4S5mkjpsjAIZjlgCFUmpQP7+6a6NhD67PFParA7P3Pz6c0ER6pe+fbOGpANQvvD/4UzsluEhP2u4JAkDXsrmzEHOWcqaSV3Bdkh9vsq3l+b0G7S+JwLlPhBJ+JkBd0I9XP24SapUWkEfQVqT+bfeURfBWKdyTFsUhzul7NdwDF3LGvipYwWQUJandqqoMJuPE4NEJW7OMaT8wkXn6Zx6h/F8Iu803VDaKXo2Kzyk0xXku7JOZGAFYum6OBwegwKwsAuGU27d9UFfDW0mqXdFAbMdjTyyG9hUOCWd2Jbos5nLZH0ubzSrRS7A2t61+kGPLYA5ZBDO2O7lo8aI2UPIRcUGRAnsv9yNzpYQ3j5oUXI+Cd6Fi3zU7fbg6IjF83qg9YLEG4YzANgGSA3yeilL/eax2+DEQtMFNHagQc9BRmkD+IPsRp/VCbUk6+zkgQhKitbKzZFmebQs6EJCYhN34o+duKAhTT0jN3rrE5FfegjKb/uMobm41ESDwYr3gVYk7uDBQOy7RLxwl3vvEi8jV16CCEAdoPKVPC416DdJWoBstL8KlSiGaLnpwGm+dV3mDEwwj1BfFB/O8Mjt2A9/dw3unObEdXOdBxd7Vb+ncjptbJAcTIGgzQmIY0+xW7JiKHdLis8nDoU7dMSNF8qNZ81z8FXhKAHmtojSK0t+mxqldgYqElqKlmfeHAiNLSGCAkO2/n4ODAoZ4IvpsHC2M24Zfhd7BY+r6zZ9a4NhJwD/SLDmPyUrm3kbvkEee33UVrbTXT2QJnv8Lb2tEKkaxv0rsuUfy3YnUTk77xQXf7eKVKEA+c2giT/cQ6GYd6CT6rqrW35VybbCLO6bzvmkvPK+PQ32C0XTDmOOn2XjSUKp84OggqWAKk4hhjkacBBSXpn66QPQnSXIMUMuPyGz73UAc8GWJg4Zw76alDWl9HUEg3VC2IKDJ3HuD3mhyWMGqJArnsobiV1ICrc+7S/NXQcnv9b9oKsoNYNY05fKC/uAi14TpuLPN2r3wcNpNMhG1BMpVBovRjOdg175e8pjfALW5e8rbQLqwQ5wHvnH8kIPG0gkFFdjC/wK0yp2jBStSDql1chrnkRhgu4wP1MlVCH8SIARlg48dzMvEMHAgzhjWI1R3v3queGPfCIZ/km5JtZ4sJNLr+ZTio37XmzjKS1ZGJBnuIRM1fHBqf9qw5+0BLwn2u5QHiTxubvWOGsMGG+M/GaFcdeeA= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20663744-fcbd-4ffe-059a-08dc1911bc1a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:11:54.2131 (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: P0RQtp2+AUuPUUQNyNlncGAFHNOz7Yr1tUNZTe674/Rta/dKS6B5EYoQGgFRvazpg/YxzzH/HyiFs0UdHnsMvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 Since some i.MX platforms make use of the separate PHY driver, use IMX6_PCIE_FLAG_HAS_PHYDRV flag to identify them and get the reference to PHY from DT. This simplifies the code. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v8 to v9: - change commit message according Manivannan's suggestion - Add Manivannan's review tag Change from v7 to v8: - renmae IMX6_PCIE_FLAG_HAS_PHY to IMX6_PCIE_FLAG_HAS_PHYDRV Change from v6 to v7: - none Change from v4 to v5: - none, Keep IMX6_PCIE_FLAG_HAS_PHY to indicate dts mismatch when platform require phy suppport. Change from v1 to v3: - none drivers/pci/controller/dwc/pci-imx6.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 0997dd7d901a4..a33ec006660c8 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -60,6 +60,9 @@ enum imx6_pcie_variants { #define IMX6_PCIE_FLAG_IMX6_PHY BIT(0) #define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) #define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) +#define IMX6_PCIE_FLAG_HAS_PHYDRV BIT(3) + +#define imx6_check_flag(pci, val) (pci->drvdata->flags & val) #define IMX6_PCIE_MAX_CLKS 6 @@ -1277,6 +1280,13 @@ static int imx6_pcie_probe(struct platform_device *pdev) if (ret) return ret; + if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_PHYDRV)) { + imx6_pcie->phy = devm_phy_get(dev, "pcie-phy"); + if (IS_ERR(imx6_pcie->phy)) + return dev_err_probe(dev, PTR_ERR(imx6_pcie->phy), + "failed to get pcie phy\n"); + } + switch (imx6_pcie->drvdata->variant) { case IMX7D: if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) @@ -1306,11 +1316,6 @@ static int imx6_pcie_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(imx6_pcie->apps_reset), "failed to get pcie apps reset control\n"); - imx6_pcie->phy = devm_phy_get(dev, "pcie-phy"); - if (IS_ERR(imx6_pcie->phy)) - return dev_err_probe(dev, PTR_ERR(imx6_pcie->phy), - "failed to get pcie phy\n"); - break; default: break; @@ -1454,14 +1459,17 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM] = { .variant = IMX8MM, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX6_PCIE_FLAG_HAS_PHYDRV | + IMX6_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MP] = { .variant = IMX8MP, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX6_PCIE_FLAG_HAS_PHYDRV, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), @@ -1475,6 +1483,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MM_EP] = { .variant = IMX8MM_EP, + .flags = IMX6_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, @@ -1482,6 +1491,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX8MP_EP] = { .variant = IMX8MP_EP, + .flags = IMX6_PCIE_FLAG_HAS_PHYDRV, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, From patchwork Fri Jan 19 17:11:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764879 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2088.outbound.protection.outlook.com [40.107.22.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82C7A56456; Fri, 19 Jan 2024 17:12:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684324; cv=fail; b=IJHSV4ZK728RgkK+7KHA3duY9R18fOpyexnEcvm7LOgJQa0xd7zPHDBsiRyi5CxsVnGCcl8r5wh9GLnd4iQUbKmEuc4yOrD0fRsRoGxHTv1hkXC6pDncqPCltdwrd90smMuchSWJltJbwfgObBzZgmSuj5eWdAeVVz4w2kFQoIg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684324; c=relaxed/simple; bh=/K+umSyaDuMeeoR5ZVYhXf+ntQ9XDdoqSQ9j8Rnw1RE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=o3krAbS2nmRYkF6Sm1y6VuxCiMGQjbrQd/dgkAQxKiv2qpTVkC9zL4LlhAtZ21qik2RA/NY9mytrocCqj57eJCbAIuapdD7e7tTOxnCdpQwfZ3I6FMZfSTaGso00VwjLJP8zpN3PQLGgaZ396CbiYV6JtZhhWQVAq1QXQlzJQH4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=VHMI+8Nc; arc=fail smtp.client-ip=40.107.22.88 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="VHMI+8Nc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e1/9vWR/PuHu9o5qIeygFYgaob6fwNi4Ml00eyPU/bz39H+4JIRO13a77/IoYD7pZfg5wrXVEkTihV2BPOpTjk/V2mK358NijAlv6pyHTeCD3HGVValMUvnTOEqozGYUifUXdALx6LSHWASDSEhb4OdHzV8wdoSG7y5lTL5LSKYGXk//GVLdkCIR7n/5+FZ6oDRkswVu0HxHo+wMSmUcF3d+1Sp+8h5ELTf9288mOiL3ECcEX+sjsjKbLwtL63Mh58JCQITKigLaDBeabWl9hkWV5fWDUWs9A3nNAhaKHvlqdNVwV1yyf2zpKArncoqlwqbcZxvZlHoSfDQRVILPPg== 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=7UAqz1QDijfOU2wgMSfbq+ZQRvWPtiX7cCjXhCYScZY=; b=iGS5STAUuwBle3QN6+yflxOsTb+wJtVrQGRc/nBCk6inM+IFLL8kjULXtLiYs1yK+XNehwtovkINU3IpGLLcefcFTypB+wNjt+50ev/+gxMM+Yv8hAqvM3/9IlRMqQWidsc4nRuk3Vqw1DQlMqI0f/kh3JIVxy0FvSaZuYmSwgsfxgGG51yFXWDlKXowK82ElYzGALYeJ/TTf+flbCYx0xOO9o6A91RblpofaaN+Ew4QYejukU4qwTfLwEd7TXvauHSSbwNShlZY2jfD+K7t8zRtWAIaVRWB7dwbtQ6LMQeshR5FA7IkQYTr/GA97HnM6pBtu3YEsn+kIjHalgralw== 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=7UAqz1QDijfOU2wgMSfbq+ZQRvWPtiX7cCjXhCYScZY=; b=VHMI+8Nc/F+yNgBFokRvNLqoNJii7qUbreWDepZWMZukHyzWBZbpgvaIgZj4ebtbmPNQ7eiNxSaa/jd0R0Q2r8pRxApN9poTLB7dbdtwAAFgWdg32zQ1G4np8oLUgJjn2w25GGyIB1I3Q8Wl2dNUfuetvZRxexskGjptzXlATIc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:11:59 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:11:59 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 03/16] PCI: imx6: Simplify reset handling by using by using *_FLAG_HAS_*_RESET Date: Fri, 19 Jan 2024 12:11:09 -0500 Message-Id: <20240119171122.3057511-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 499abe61-e0e4-4fa8-6f98-08dc1911bf0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o9+5H9mhgZIoaVSM52dpG7sVqSLMgmGjZbOOUtAl34Y3oljyyPFLdpb8nEqc8ZI3RX0qNK1C6cYg05A0I2tIqMAJfTqGog6c/SiOFk1O7lNdSqyF0dKDskTGJhd46R6uhFhiG6pNxECT1ea1Z4ux6iPDGeDGQHeV5Lb8NyTSACUkMglF9KG640O8Cf76wGR98LcEOJRc2b4cGfuf+d50CEZHlX84z0s/MRjKUSvTrZUsFdlxpZx6rPoSbal0r95a78Yuwa5nPAjZhR4uGfef23TFgSwJM+j1G9r/1MN3YAE3f45HG24oaXCL/3IByBCR2mNHWPXf6DPpP8L50kBCkGTBwiTaMTDj1BINamFU7Xi18oRY+plLuQYE6oPQuOZv2B0g9w9xxx2v0AxlvTotjdp6QE42gxGXLv1s2PwkN8yeilDNx9bQtMciccQRk5C/vcmHVefu4VGH0/4g6YXBFuMZiFfJewESiwyWsGBO0qF4+wy2J6/TIewnMyImgycUHjQoDU6B+PqW/e9WLdxH23wzTKGuR6Mpogdx322rE8Hs2dJ4iAfWf0dESEdkRzhjzAoXy1Jfg8AkNXISCn5j+nJvstvPzElwVFBKUZ2jGZnyn2sGtj4VOCtybtIPEdL3 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sjhbNHTDHEHoV3iDwDrTraJsf1Df8mqirYYkRZrhHlg1N0icNmRpxHPyEUsaA8QTKmU2qwaZNXhlclWazAdd9BRpze9B1YF50lIU8gAF1aZWtmSU32WvsD/gICeU6F4Yl4H0juJWEBRWL74UQNZPMxOD3MjJutmUyU9HPUj4gCzXBtN+RzXUNOrFPI4r/BVZd9K94NXFiUkf23lBeeQIie0IoVfXRXAgXhxEcCyjj5GoDCsQpno71wmEWDg7a43UKPwA0dque9EvHH/6eQwPEfGsANIeTKpHskIIcumpdRDgfnScFEE+SmWAUX4mjdPR4ns/dY6dGoqhOtD+pT4V3gWZRsk/fFYNTfLrz3B9n1Rk0z2BuzZ6mUrwDwOsUZ0636sFi3Zk5MYTOfV0ZyX/eFCvGiQkV7vVWhu1moZrgOTdDKfFyjGdJiZISPBYmw/Ic68g8wX3hCM36YqC0Qi7qKkzDht0Xp6o5hKyAJ2sK9ooCXU6u57MLVIAdkpwcuYhmmpOFKZVw8N/fNU3LoDugKmw1EW9eVO2rFkvRzNoTyYeHO9bFqZpNRXFFiTpQZxqOx1t+cnpf2tXjNenmHLwhUiByY+z9Kt7fd/G88lRKCk6tiRbNGRniLwOnrqs8tS2aHr/z9NWVmArd9G3x26Z1ZDnJwB84eqig9/WETRiVxT8Av8mtWwIEfCs1yLzLvNULe6d/6ctEd0kTo4sWwh2TgEv61Icv6qW9CFBDFTfBrizwb1f9jkqjAT5PNNfgKXBt8mUI4qQQ/M4LAaZwbxlhmr7/08BXlUoSLDGKbz4npSwdl0Xn6CdtL8A1b8xd1IRhYLVSm54vTnInjvKDzVZUc5vMeTFWCRT/gLnjcvVsniq5XVpyVm7WG5048Vdc0SQcQifZSYH2Fnwz7xJo9JnBIxdgFmv9CodyrR4u+z64MRqaDkEVHrqFNrNEEJ48sr5SQLIAOoyoaFuN/0YcUBLVqASEgfXM8dm+Bzn09+frmRT7i/BQu+wB9hB+SAUMW+ycoHLjITifCGQ8LVWHHObc628xzswnWURQTE6USQB39XbtzknBkUb61FJ8oCUgBApVh/1+uZ8I3z9tBIOimeRrKJIYjrgSw0D311Yq93Fjwm22ft/3gBx9/X8unTq/nUeNET9mWr7IE0Atd+PYdhqQKK5EKiTsxKlKIq8iOsFte9bZYpM8toMmXifus3mbsP5wDq7Ob6AYxx735+6co85MsCL7wk/N4B2TMpsP3AojdmlaW33ApyyoeZt2wjmyBweka3Ft6DR06Neagp2eoKoffEUN1MXJXeCxO4a2TPU16p0j29gjs0ScxdtjNG4rae4uKYG9MWH8x8khuj8NpAUrXVWmRhj/XbW95C9eyNZt/6uTRxIpiPQVgeQEEwKSZV2accPHWfEg7png8bMdL4qmZHuWM5WjlqHm2D/GHMczWFJMmxytRxE+5h/jB3oK51OyXcHEYk4TPYeXtUUv8POis+dQGrlALcN5MX4F/hGh5ksgCwwIxxfaZx/HgnUmOSzfq9tnzKfpz797C1vjvjvtCfrxKKj73WPXdnSXZ3Cux8= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 499abe61-e0e4-4fa8-6f98-08dc1911bf0b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:11:59.1810 (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: RVvjuzmlUhH1mcYPYtobDxDYdYctLhm373XnlKZA0EnpoI3N8GUrknE0MfBHv//M2nnCLPdExlpu7MAwx16ENg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 Refactors the reset handling logic in the imx6 PCI driver by adding IMX6_PCIE_FLAG_HAS_*_RESET bitmask define for drvdata::flags. The drvdata::flags and a bitmask ensures a cleaner and more scalable switch-case structure for handling reset. Reviewed-by: Manivannan Sadhasivam Reviewed-by: Philipp Zabel Signed-off-by: Frank Li --- Notes: Change from v4 to v5: - Add Mani's Reviewed-by tag - Fixed MQ_EP's flags Chagne from v3 to v4: - none Change from v2 to v3: - add Philipp's Reviewed-by tag Change from v1 to v2: - remove condition check before reset_control_(de)assert() because it is none ops if a NULL pointer pass down. - still keep condition check at probe to help identify dts file mismatch problem. Change from v1 to v2: - remove condition check before reset_control_(de)assert() because it is none ops if a NULL pointer pass down. - still keep condition check at probe to help identify dts file mismatch problem. drivers/pci/controller/dwc/pci-imx6.c | 105 ++++++++++---------------- 1 file changed, 39 insertions(+), 66 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index a33ec006660c8..eda6bc6ef80ee 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -61,6 +61,8 @@ enum imx6_pcie_variants { #define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) #define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) #define IMX6_PCIE_FLAG_HAS_PHYDRV BIT(3) +#define IMX6_PCIE_FLAG_HAS_APP_RESET BIT(4) +#define IMX6_PCIE_FLAG_HAS_PHY_RESET BIT(5) #define imx6_check_flag(pci, val) (pci->drvdata->flags & val) @@ -661,18 +663,10 @@ static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie) static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) { + reset_control_assert(imx6_pcie->pciephy_reset); + reset_control_assert(imx6_pcie->apps_reset); + switch (imx6_pcie->drvdata->variant) { - case IMX7D: - case IMX8MQ: - case IMX8MQ_EP: - reset_control_assert(imx6_pcie->pciephy_reset); - fallthrough; - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: - reset_control_assert(imx6_pcie->apps_reset); - break; case IMX6SX: regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, @@ -693,6 +687,8 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16); break; + default: + break; } /* Some boards don't have PCIe reset GPIO. */ @@ -706,14 +702,10 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) struct dw_pcie *pci = imx6_pcie->pci; struct device *dev = pci->dev; + reset_control_deassert(imx6_pcie->pciephy_reset); + switch (imx6_pcie->drvdata->variant) { - case IMX8MQ: - case IMX8MQ_EP: - reset_control_deassert(imx6_pcie->pciephy_reset); - break; case IMX7D: - reset_control_deassert(imx6_pcie->pciephy_reset); - /* Workaround for ERR010728, failure of PCI-e PLL VCO to * oscillate, especially when cold. This turns off "Duty-cycle * Corrector" and other mysterious undocumented things. @@ -745,11 +737,7 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) usleep_range(200, 500); break; - case IMX6Q: /* Nothing to do */ - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: + default: break; } @@ -796,16 +784,11 @@ static void imx6_pcie_ltssm_enable(struct device *dev) IMX6Q_GPR12_PCIE_CTL_2, IMX6Q_GPR12_PCIE_CTL_2); break; - case IMX7D: - case IMX8MQ: - case IMX8MQ_EP: - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: - reset_control_deassert(imx6_pcie->apps_reset); + default: break; } + + reset_control_deassert(imx6_pcie->apps_reset); } static void imx6_pcie_ltssm_disable(struct device *dev) @@ -819,16 +802,11 @@ static void imx6_pcie_ltssm_disable(struct device *dev) regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6Q_GPR12_PCIE_CTL_2, 0); break; - case IMX7D: - case IMX8MQ: - case IMX8MQ_EP: - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: - reset_control_assert(imx6_pcie->apps_reset); + default: break; } + + reset_control_assert(imx6_pcie->apps_reset); } static int imx6_pcie_start_link(struct dw_pcie *pci) @@ -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; } @@ -1446,13 +1412,17 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX7D] = { .variant = IMX7D, - .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | + IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx7d-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), }, [IMX8MQ] = { .variant = IMX8MQ, + .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHY_RESET, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), @@ -1469,13 +1439,16 @@ static const struct imx6_pcie_drvdata drvdata[] = { [IMX8MP] = { .variant = IMX8MP, .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND | - IMX6_PCIE_FLAG_HAS_PHYDRV, + IMX6_PCIE_FLAG_HAS_PHYDRV | + IMX6_PCIE_FLAG_HAS_APP_RESET, .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, + .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | + IMX6_PCIE_FLAG_HAS_PHY_RESET, .mode = DW_PCIE_EP_TYPE, .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, From patchwork Fri Jan 19 17:11:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764057 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2064.outbound.protection.outlook.com [40.107.22.64]) (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 3173656476; Fri, 19 Jan 2024 17:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684328; cv=fail; b=Vm/Us+uZnrfT3z1aJx498tPznoAqSAggUeCs8O9818nbAs3M1qBdQn0BuO4WBaqEPEXUYGSS+EwxTP/RsamyQutajLzqYJthUwFggrCU3G+bDQfxhgLDXmGnXT7JQqXer/4hON99mSU0t/nMlNMw/4eUY3qfCDFt7H/0e1mFJnE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684328; c=relaxed/simple; bh=FNUfEU2NBJdh/n7ePbKkcWgC89DpajZR7gZ+IIFZvVU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=GdhvWShC0ZhqDISlD3wCLvd49bL8oIupVFjcAwEj1EEUjtj8bN+VUW1P4zELTwC6uS5qqVw4+C3OrGgHckTZpFe0gpQS81BBZLMj33B6ZgOCoOm9C6LFk/AHjkVg2qRs3F88vR+zVBcPbQExW+FhRr7mwInCsaY6KE2COHJcpFY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=cWwVxj8I; arc=fail smtp.client-ip=40.107.22.64 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="cWwVxj8I" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XvRlYIGOliRt8QJT8Xhkk5U22FJbRymvelptUXtJPis1/Dec4LSdl2dLDufoET+YF1uMKTr+rQV1tiExAG+kizJPBQrYi2ltqBctVn/QrDSM1uyXsxmNV+P+wyavmtrXiOJdjwk/8ptI2CPn5l3J2hg/1rsrvR4iZYENG53FXF1xcwIW7Pwk3wq3vGtypLZDOTxzwsn63u15fw8xNafTnDTcari4F63xQa/7nDgadaxDCRfpiFlcpS8bLiWN8gscz6t3OOLSbMppX/a6+dKw9CHRGDvrf+xJX6/jqNBG0lgP2trT79SqudYxp1w/72dIQCgs9Onvzhm9MRFQByV2AA== 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=ZoxR+TinRacNV4SkOVSqNvChWq7u+ai+t5XxaquMaNg=; b=IwNwQFvfPBk9Rys5KxHPftxgDzlJ1Xe1kjR+qE3syc6JNDYOyUji5MIZIH0FxQD4tbeAT7XlKqxh/AVT8F2GrSp6pWrHawP4HvtGC/v8MVqK5zh/NgbuQ40e66PRoe47Ws4fkQsPIbO3rcixVQ69qfMXgMtD1+XmAR+MhF3FDMk5M9QOsFVSpqyfgb3d7ImxTgDTET7QCFuiEHMnZhVaPh7aM6/zCGbsjqFvL0nHssAlJTYhzRk5Gi3ZRilDl+VTwPHJmuNErBVgeIUMIkzyLjCRKf/vtJYHa7RSHfWqyj72vWwo5bnNoF0ZYMOd5W3OJoXNRTlG1bldWKm1lRsjtQ== 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=ZoxR+TinRacNV4SkOVSqNvChWq7u+ai+t5XxaquMaNg=; b=cWwVxj8IXC6n43Itwf2FNzvhUSMSbYjnzA1dSt79bXePSX16qowUanX0s+QJ8UPzkDINXaD2e3NsENXNgJ8xp04IGNIG30mZl3BR0uEmAEFcCy8EJzqY5B0RdcRUsJ8h+D4gGNMfYE0OlRvwbXu2CYVFhJN/FIu/ey50xepadAg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:04 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:04 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 04/16] dt-bindings: imx6q-pcie: Add linux,pci-domain as required for iMX8MQ Date: Fri, 19 Jan 2024 12:11:10 -0500 Message-Id: <20240119171122.3057511-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: eba96308-f15d-4715-9e82-08dc1911c201 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q6yUAmn/mmeVBiHZn8J9b10dovPZJKbyPCWdQ1eUnAcLDxu9MIPJGiU36Q+kgYXPyHsNb14a3fbruaSYYlZ8K3tmwyAdvV4lSjt4Hd/5Hud0MomO/DkSHfLAhyzMYCyH0P6Z55kwWAkjlDR2kUTQGD2h6q2X7vxf4w/a2iW+YJtugD3mVdYRXZ4b0anurJZs25DwVVEcGZHEuMbCHhFykTCicfiZS6swrJoJYN7o3zHrwaxyQ8cvHkGqLaMtUre89AR+78F3ur8r0qDIHYweSzR2/S4WpGwGShUloC8hf7yYkWob5UmR1OnXOfV4k/mcsPhjEbQI2ezLt4zp1AYGfB9+b1cYObTJg6hpJj84Qy/0SJYo7rdI6yOJ7Rl/41UILs25EkPsyTEfufLI6sEMQntXAE3x3TNeyWFnFo9bQnfwwaS7iZhM6kTbd1RKDWBx/3+64Z0q7eRnecVHPXQCohHDrIrOcrs4Nw64mbpJ9dEGfUC2iLw80TDYZgLzOI38h2yDtikZJ+7fAiJmiM0yHnLfSkVd6W0Bs+V/h37UoeNTN09ONsp0/m0Qev5lMu7bn95Bqb2M+ZoV4YUR+Luqgesneb9IUhLt9eWdQHbbRFUYcwVqmOoryG8S5lTsZ5258qAxLLGt1ZVqiaihU2gAkw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JqhHZGE9wxfYfK+P3CtSfw8ocbw3Au9YlF5QpSVh3MmakmobI+wlCj25ZnLuCyvMjffKEP9//FVxkat8a5hYALeNK1WV4A02IHouyPlkrnRw5SAp3NQ0RTH6XMxAm/HRds8LV3aBgLzfJ1QbumxoywrQER3arY3MGiyjYqSoh7IKOsFwdgf644kfhrgd0aZ3xTZbzls4g0Pc7KTZlOlgrfIbPYdGobsiohjOm6cBNFUDm8855wCY6OTTjq/ju/CgoNFcp+r+5ZY1VMhqTFxpy7MR4mG2t0A1WUa989TJ/x4dQRhSAA1SrcbZ71sJMM83eBfyQpivfNbMo6QLSReLJk46SvASx99P5cHbYiVw35r0+J6zevD6766YuO71KksGP3jGsScAXtMhwAmomzv6qXBXiDa8wUnmYnQghxh9o6yDqGGcP8/StFEH1TEnIXckhwoukxvZY1qpp4GFkxbu78B0ajYwO4omKPJ3LT+GX7KYGV3KMjkk/7VtuofC0VKA9rzyWQkwaFJWlCnY1jOXfVhidodLMOvoedlpip93pVZ3PRA0LPylgNbykxKqvUDxYWTvWLfB7Zm0Cd6pf1FlLv+sIwrWy/SxjzVO/c8Y5Q0nQ0jDLWhUTW0+DI5IFZH3wbspN0s/ThZoKLqqpcBhLRtIQnyiiz6iAPtlaCSTtpLXoP1e/NnshkzCoUHKbpIiy7AZv/AlkAgs02pkE1WgqQBU1X/iWtRSxeqORkd1ZUxfdkJDeuyVqfYGOFhfux5hf8cG3bEzMlEsV2vGSHQMMLO4UoeOqSl5GbMyg1Qwnd5WvyoqyjWd9BUQSBWQaBlGb71HBu3UCNAyFaBI8O/0hMpAhUnLMTHdqKi0sbf0+ZSJzOyhBgrN2SyjXWssLNiY99B05SbNJU1iIWbajfIAXlASQ0gJb/R9/jw+YvW9l2vanDK3/0MEBIOcsX1uTFR2uLvwm2rM0WRO+HgjseS7JTkoL3HdTyOzO1rBBVaeNWDcRmFeFxAu8jNnbAzjrGd+xc1myJU23sNMKEoEHovH539Wz8gLrF7XspzqzjlWiWNGdoP5VK7OUEtf6Mynv62UQp0OKnJwzzoF3d/VKwdmen6sDwU0O6mONwnxgADIYEro/UGqwUWLMAW27dcYvv6IDEdafFmzHbyuY69Mwa9fGrP4tr3Bj40hbfS0SnTOB9s7bwHRMYlleNYt6f3oBqPaYWBemC7zoXSXrOXWxrGegaZlZUxCBosHHlaxmt2G0kCUn/rJXLHWLjbsg2UFHcBbB2/vCW6ZgIQjfIBW/tYn1iekqkGArnxIIndvdFxs7gSoIu7kj5+R9msJIvlLivH6LZ+7ACaVilKujsqJ2vRt7ewsaoiMNY+OGu8cfTnRoHj+k7ooRt447Hf0W5+jl3O2sJ5GrBlcSQrIAiPuY92uSo5ytlt54/AFnVUjBiRv38EeL43pSjz7MWGgmIuTuCp6vD2qo9O2Bcn4/8ho23uyJshUazvc9Fni/nWRjoHzYweDS1sj8HB4ck92o0fPEM8xr8emrLTtkIkVOCpKTdIG0XW/LMauT1wSmbKYYJSHP7w= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eba96308-f15d-4715-9e82-08dc1911c201 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:04.1627 (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: TmNWKnRiyVp+RCZWXPXeGPonFoCuOs1IzRjXKX+6mTSOErcERvjvAMNXiIcgoCJp00fDmMeb75Pr6KcTW/axQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 iMX8MQ have two pci controllers. Adds "linux,pci-domain" as required property for iMX8MQ to indicate pci controller index. This adjustment paves the way for eliminating the hardcoded check on the base register for acquiring the controller_id. ... if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) imx6_pcie->controller_id = 1; ... The controller_id is crucial and utilized for certain register bit positions. It must align precisely with the controller index in the SoC. An auto-incremented ID don't fit this case. The DTS or fuse configurations may deactivate specific PCI controllers. Reviewed-by: Rob Herring Signed-off-by: Frank Li --- Notes: Change from v8 to v9 - Add rob's review tag Change from v6 to v8 -none 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 Fri Jan 19 17:11:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764878 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2079.outbound.protection.outlook.com [40.107.22.79]) (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 15A9A56B8B; Fri, 19 Jan 2024 17:12:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684333; cv=fail; b=lPY5fvmmM/ZZd+Aud7hcxnCafveOKFuruyBXDmRaM48Cto0ZSFREVVCW36w/pm51qf7JD25P6ZlQQlIufe6JrupnzFK9fcrY8JFuJc/zsr3GOhuVXjuwMBEJ2GzX61jZ4JIZqH2Ubu3yK/r+uiVWkxgBYQy0OxhKDG9aaNo68pg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684333; c=relaxed/simple; bh=+9kWdYC/LpPzVQIsMrtpit46ZIqe2HL+j2TqaHj+FzM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ZYRU22bpoSVMQQsRfjiIy7T8eDjFDdn8larOgCy80HCabnEcUpYu2AZ1R4lCdbcbhUnUkHhqkF5yLibZMtdFKtGm4Cieupf+WlBXyb5Zh5ecd4aDq9pOJzntJaLFSyKbozFkq1NmmtAeNRwpofFCeVweX6DFi+Fz0fSTwaQHo50= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=Ug77Bcje; arc=fail smtp.client-ip=40.107.22.79 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="Ug77Bcje" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iEOyLz8YwsE2HFkBT8PTJqZOkXko/gdbu2MZ09zW39Kd50qgKcBYRonOhY+l10frfL2eHTliCYYXSveQuy7jpmincj4V7TYehF+6i+a4jQKBPF7ZuT6fcQRQPa5QZPDurDS9K5H5eiul/7tismwb7ArSSepuAK7eAEVMx1Iutoczi9W/9O5lkkJQmC7Fdis3d+wtY/kyCVX6//iPUq27nfQ6M/RKkh2GYz797Xp3Pua9x29uE/Z6QybLoUv83nGVSJY+ZM2NcLoukBjq3/NKnifhnmTA5S7gGHlUxR8rLpUKvxJ4585d7MhmUs2yOp/ST1KYt3WWW003uA/3qTPO3g== 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=/b7EirohT6QhiK04U8yzpfL2SyTiOsPrO4dYhLXTLiI=; b=fNPZmmvTfd6lVYbXVb+aRNJBhS7zNrXRVLjvZt+glbzinQ1YjS5Y0OZlWNIQ2YZ8IleumQ6D/RRGpw/9RHMTDH8nEaPi9MNfnt0qWEQDou+iKTvi87JBmiuGa2WVKk8uFGjpc0T0rE8R80N6ZxX2swlBh7D2aChywPbsawCLPc+OoG5bm6f0VoomcTgz11bqb7VavKULg4o/yldcWvqzkAEx7atJpyhybEWU7XjAQiM+jzhv3ARKC40oFiwCLMCoT3sDJeaezlBANDz20oPZN0ySXtBrHKXfouROED4Yg5OCEdQ4TrgxaNYCHRjvsjo7qSxGrhHHGr1DKzfA5rLZAA== 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=/b7EirohT6QhiK04U8yzpfL2SyTiOsPrO4dYhLXTLiI=; b=Ug77Bcje/DzZDi+HChPP0tw0rZ8eTyPMJCPkNKA6aS4Oy+Ny7zoLRrPpCiWpHTDwvbEteBu7fO2XV1dTv/1Sf2uiwY/Pt6fWuMv320hnj72rv8GXbdO1syqAQ9vG6sCFXaR/sItEmjEJx8hvT6VzGmcMDfSdYftdYezTvzfAvvY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:09 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:09 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 05/16] PCI: imx6: Using "linux,pci-domain" as slot ID Date: Fri, 19 Jan 2024 12:11:11 -0500 Message-Id: <20240119171122.3057511-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 833e3fa8-1c76-4099-2f84-08dc1911c4fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cB0OVSKpOSLOCQZtp0GIfE16kJKeoz+vLhZhVZ/H4nEyUdlRpVOFpWxLNFbqBGAN5+rIz5t8i3h9sRGruGSem2BH0bP/DcUQ9TW3zfaS9aI287YS2fDlTmYKvLUWq/qX45kzhNXMilVZsPTkEHtCJK51t/AHb2TXyOJ1wqS9ZeHRmdJHLIDLtMH6cZJ6pAjfx96JOoSlEmJyVgRc/rbElS4eRW9Zdy3zBoSujwvmcK/VnVXdRHAOmkrZCDO3Sg9p0ZCTikQ2P/7HD9pSq7AKtz4bUDWBVZbwkP6jMcfQeMFctMi3FheHOnLcfHQo8VqLxZD5uTAj9vsxHV0cDSqIxk9yEBMSO6I74K1A+0ZSItQrwSO0TmP6ytOTymNsJ3ZmXhaO59LjTrr1oaWaibeU6j6jOyJxu35HyeHou1FEHLnTRwENNNGf67P/TQ8v5KNuSviKdo60XT8aS4qVN9JEe8szSXg7Wn6rnOVt923eu339wJSXPuuunt49K4FIlShtwrR6DXfx9hf37Z+mLqdlOXnPde1lVAuorjwEF8vNVG34S4NhnkCiZaPFD+pP6V1K+AlG62mN1DXoaGSb69KyAD4Wqx2sUm5HO7qbVs+NSLwt2M5UkIE/U5IsmwHh/X70 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RwIKRR5Jm96WHnR0mais9rv6pP2nIMyWMZKlphVuDXOYYIy7+Cr1k6BzU6AOLSIR6/wU0PS8R4aKXoFoB6kfWvEaZqC/Q2hYaEer//VMQ4s8rkrTflJbPG8nDKir2gq0rTC36E50i6hPO26jQ+tvcO7vq0Y0r1WnH1VkphT7eoRGP004IDehv8gSpURZlNCPHWVlucAKu/62ejXKCTCPaJ7DUHxb7+q6xS6rP+M6bCw+S48tmfEH4Uk7eWsba1N0SoJwQAWee2oYN7vzBaZao2M5wXTO0aX93ZhSRZJkxoTdaUiouhWQ5JcwiS9arVhBY0duEFStj+5MoKs3ku+MqUn+hmRsnSgMcNpNmcxIcON6YDCAPC85PwnOcWS0ZpIy6fTrDpU++oRb1RB4nojpgmDW5ejKYAG7yLsNFw6YnHhS/9VoR4uro396pJ0RGd+zEAL+5O7vbadCElS3kQ5KEHlaorUMcTe0Ge0z8uTnEowUngNnz/ViFHPPGmLx56s9ZFgYIpFs3a6oGmi4+cC/kpy9eu5KPebx2+4Q3/LSOgrjoSgtvjShfPBff1C2rzN1MhdqGCvEfze0Uh1vI6TASn5XjHwDxuadLNMTYRDNuQTNHwX9edWP1nUnLOT5B8PTZoCQO/n78c/EvAth4r/+yVLVZyvjJjYl3kLk3MPy/EpROvueBS+CU74MxCWMU6vpQ7xh/ETrmcV4lm4UQfAsfFl1fimPbdg/jexdIMV2ij8fv4sf/TVuF7KRw3SrrYphnl5RwpHP30G5uvrokR1WVaxAVR64r0dy2H9lgQyEx8qe+uC291Homc51jwgHD4Np+LyDhcpWPGZRh2GfvNiO6z7B+OHA4akkP9MT86xwf0Rm9j3Esgwwi2O3NfVjMPdnOSUGPle5CUQNEEyP25TNiqU23WiK7izOQ7Usu0xoD9hHGVMxUCbLvFAwbXXrRyN/MM6BCh+4j1iuPmJUz3Zt2PHeTWM4dj9EwTMYVT1W05LIC6y8+Hf/Gw+eFv9h+aAwDlWrfiNz+lzjqPe39HSfkDYKCUu9De3Fh2DhSN+cI/xsfCyPXbQ7ucJPrbvPgZnYAGejUu8d6hMGhfupmtpk1AMefTChkVaj5PimuYYFKPko9rQLKWw4qOdlogo5EfQYTg78eIXEGwxKearYlHzyUDeJxB2Elmf6ew2nXrG0PPm5enMMChQRt3kWRdXVDajQlYssRR4S4VlXO0l+43YtIpsalQy2OQvGWjmJKDFgfDWRIZsneTUI4R4ycG0J/fjTVlusT7DTcn2HYMKubfq3T9sxT+vpSkj3VRIT3nPxadLPQoHnQ+72WgJBG9f7hwNkqg/ivT1T/LYFwuqoPR3TYxR3L1NGjzPI0YkCn6OBiJ3K1gASD7mGloIzgMKba56xWfLKR4UePb8gG46umJi4Rn5k332Hr61RSVOct0ksLbZerCpCpD/Rr5O6dMmResqrQgsE6aFjBEh2a1mAtVKQOwIMIlfA0cFc7pqiVPioqtSenwk6btY9UBmU5NliT8USlM+yH5nsn1WAD9jYwHor3zMEfEk8PVTY2F/E0BRhAoM= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 833e3fa8-1c76-4099-2f84-08dc1911c4fa X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:09.0975 (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: meO2ZVmzJMitdrN2AU6Bi1rcKTsmkiO0LQgRuQ03CU9HCW+TbxSl5o1P6w53F3w2Jz4oIFvs9RPl397x1tqGeg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 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; ... Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - fixed comments - Added Manivannan Sadhasivam's review tag Change from v5 to v7 - none 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 | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index eda6bc6ef80ee..773411d20329f 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,17 @@ 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 no "linux,pci-domain" property specified in DT, then assume only one + * controller is available. + */ + 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 Fri Jan 19 17:11:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764056 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2064.outbound.protection.outlook.com [40.107.22.64]) (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 2554755E69; Fri, 19 Jan 2024 17:12:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684339; cv=fail; b=gS/KR2X40u9zp6Xkn5GSYiHYRUoMccgZFgzUTRGj/VuCXLBoEmAOCveZd1mCPj+7Rvu1HKfJR0Obla5sje9z8nRwlU2gWIYIPPi7lanbSTYhDwFxkNFxg3XVo5QOdYlz7z9B87jh+sTjAK4H3S9zQ+A3HG1TYtNfmrzSw2ac7Pk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684339; c=relaxed/simple; bh=h1orblFhLYQ8RQAO2+kcsj/uiCebOJfuN5yDnsv7hX4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HOmfew7JbbMCktV1KEB0o0pTzOcC8UvEeoZQGw01LXQ50YqpGdW19cDzlXAH9h4ruedobR5x3Luwpgq0z5M9MGJaxVCeV+t75UEhZkrmYSYMJh5i+nNnMI8IEksD9C0mMzYLvdf2rEi0lM6Ncs3158HSYKchafAIoS2hc9zPWPY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=i8z4gw04; arc=fail smtp.client-ip=40.107.22.64 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="i8z4gw04" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gmlIWKN8cQnNZK61pZfrJDm/6kiYvTdPjnypcxnMBNJ6ncpR0a3Di/OKGlKgpXxXtW3LLALAHlTRrsXpcncUkQ0ntukuL4Cw1eAQhpInIaYI691tJ2m5g58z4bJBvoNCJbdPBj9d5fDaPxL88wM2fFbUUqTA57QR72C0qKWADx0+ONicIVfsBPhNbfwCut342sPcJa8Hp5t9x7numbxxEnKcQt8WtK3C4ifvTZ0GgnCcmOBbMdn013eFF36q+KXf+mUMICFalPm1nMG8s0OEXPw/sICLEqoRqfjme2q0lmhaHjp+O4E+kUa0jkaVood4bWpP0cfm0ihShWJDlrErLg== 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=G1ml1SU3yyGgsAgBwKUHD3HTVAcSOfWRmvEJtlf/ZfE=; b=NrPID1Xdi8MRMfKGaUjaX+uV/Y1GTwzO1xEo8E6YIUZ+bXEL+qwtmU3YnK1eqd1HXZn7h/Ig2wBZMdWVO6rgktkYi2aikumkRpboAcXZiUTzHo8KVFns5FAnSbLbfblQ2iru6TAtJB8qRQVlA6UMvh7pApE5Ynt6/5yHQJhkLKpICWljlAHLxhIuPjhrdXIjeg1wEqWP3c9UFa+Pb3URtgQMkKv0CHuTkRJhGhr4AcrQssl85ToJqHrB5cXBBYVAcrBubH+fbbxya66ME2fgfP/EHGd4XlXpHmcS34h8oo+qNqPQ+rg62NO5Bg0d6VpqmSdAhjPi6dUG9as2/OGdug== 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=G1ml1SU3yyGgsAgBwKUHD3HTVAcSOfWRmvEJtlf/ZfE=; b=i8z4gw04RY1QQsDMCAPNsmYAmkMclRxuRtMUDR3ezGAnF+lnhhvcF/7UrAjzMcZD6rPGUrpoOk94pq/R4KOU/A5mLD6491WEyjnH2Q8FjR35H6/eS5cq0dcn6TpqVK3LAHfKOH4bmr8KqDyCVeVVi2Wznv+IPy/vYBvo5rMV5m4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:14 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:14 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 06/16] PCI: imx6: Simplify ltssm_enable() by using ltssm_off and ltssm_mask Date: Fri, 19 Jan 2024 12:11:12 -0500 Message-Id: <20240119171122.3057511-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: c61c5fb4-d65a-4d08-c0d6-08dc1911c7f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RUnUxF9l4ozSDpWjGWbCBC9QcvTBLRgNUfoH8FlGRiw7wo0kqMroFQQvqb1EpYptP3ysindBTK8YpLoTbDQguc045q/vNU8kBHF2kt66Atcvf5Q3Du6nlZ5aaWkweIfKBYxkXyRen64yy34luszX6Y6AAy2k8D46gvclodNZ9R1tmWau5kPqjl0l3S95AfoOXZHnRGfkCcprHM2TUuhqRh0+/ErEwNqdjM5lmgmWNHi3dKDqkGxdCPov4T+5xS3KyEnUnxU3YAM13RYL8jyxXFznFYOPJ+SF5L6gE/GZOAvvuyv8UO0TiKvchaKTTtfNapPI+j2FcQeF0ybZYi8RoYTA3fpE3FYl0uvWB1qtGrp0X81JSn5x1wr6rJxNNB7sRmr1fUmAuGLJaZLDoQwjxaXlSZtSM1XvDZn4gl7ieVIyy/q5s3Mtt2GvDyT6qTGFb2TrvTohsCBeJYPwKUvwO2V4N7VPC6Nn4jbFJsx8d5wLovdfUSzHj6jX20uQvKmq9R99QoBIRNkRfwFm12nGfo2Y4gue383KEU8v/0HeshXqrbAecWEaBar59wFIFjeDVaaMX+or312vFPwlRyG21Mh6HjKW5mQvyDVH2pmcWCed1lCfGv6UjUEHjPR3JHl7 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hKqC+9Bc+D2dvBbAym8XKcWc9FPwVaXiY6WUnYNPrp6kEvp6TVJk+S5RLEZpTNpFfhmEHGUBWlpo79rBtWDy1hmoIXPWybBGuhmgw29pQlr0bnm4HfbFxcZddnNvtkDYMlCs3NQgnUvrl8MuFQAWRubeKXAOkY3m8YJXRIi2BenAZYmywV3V4WU4evQU7PFOTkTbTSmbe65cN7a8yuSXukokir7v7j+q++e7f9Ck5ihBcy2CW1jWUe3ibZehOqeOagZSaAsTnW2jGB2PpBaSJyK+momnPxUjVQR7oxZf7RMXxFTNYgnrAlWrhUXA8oetsJQg1dV2nQzLczH8m65EdmZO4m83vTXOKHQys6KoRLGYQ6bi4oAqjh5pzUQlw9vWQ3tRIykBglhNczh6VeRWjxZLQMhlKBnJRZ7bLw0vHjovjFsJJQcPCaWXeqzKSB44MF1Qebs5yw9RMpRlQ2wjrRsGMl2GiDgsIS9jRYgR4hEn6qfzsKQww1yGyC8lejlFUpi2OszfZa7FbT7Os0Gcm3oab1ppbSlB7iDefPCGYdmFJW6XkovEtJ/Q+CScv3D5XCWfQpYOUqVoVVcvuwTfPZHHGvN+BL/7b5mr+9KRZvlkbHz1YLGFIdO8T91RwhbB+Hty7/hghrUzXPzwcOjsY63ZXgUPpHllGDQa2u8O/WLbiwllnHqcHLqxfQ2Y+10Obz/oV0C1zgjN5vatR6Ews9S3Gjfsb8JQcBbgG20Yy/tFc31ePoTfoOfzYiRCyyrtFMG0v1UexwaRKrzwYaBPLCFmQRfsMaapFccrhkWMq+wJo8QONXdH2ut9/aPcgcOBiSJqFVJEZNnhEtkVgLMjPcoImPxcXtwtgtWU7v32RHYhtSTPQMzqmkhrQdZ7A1dFRbxdjRFvb+kiSfGbWLHoEf4e99b2uhlPTIvgIfRr/BhPSW4yCNajaXdeDXwpzMySY5ozr0Gbqwp1zCwU2tKKQFnJHijTeD9tqHHRnpxfs1CLMorBZBWx6oWCaZN2NSqUqKXcRM0+N3zVFFbHjOAZF1c5xv0S2TQrfoaBB9XIgcMh41faiAiDoNvMS8xVXOe4b/K8Yk/m9TVAyKmBQ0wELcaoTSPfvykbTeQ27XjGvf+IVGxzge1gJ37W0xvjbAUtmLCbgu+9FhiRPepf7+iAi7W3JiErZPSMm3aElbeZFqSyJSuehkj9SdyQhqPpDxt7hpgDzXZ/Z6LUotqvdJolc3/UtvcwTSUnuwaCrwttWLyYb9Epdf/MMiZrB2gacjo1ZaRPCx1p1pCU5SHkjxoYAsRY28mDP+/kAcF4WNy9mZySfZ6/otavx3jGvlmnIZchrvdsKJInrYTy5wuW0+SWhP6RUlCC3EI2jvQNiLN7TdiNGg0EPYl03D4jIUi89D3llGVjPY2+b+fNs6ZdQyDQykaasO/nXkj47wn64VuOLazYWo9hEVLhdykuRPrXUActG3pg1ZGtSsW9724iQhWkQ94+RXJFpsrVHWlOTqfPU5j8ZuSnjyyMsf+FDJTmNAzzg7KMQh3hTBLFr1EhQFndlY34SaNwajKcbiz+lazIf78= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c61c5fb4-d65a-4d08-c0d6-08dc1911c7f2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:14.1225 (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: QcSeyhrAt5B56xPfgbQ0wZVmJB9+HiI53bNcBurNpe+4HAeN3ytq12Jle8S+m3LDYdrIEOlbCwXNUnptoCbjbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 Add drvdata::ltssm_off and drvdata::ltssm_mask to simple imx6_pcie_ltssm_enable(disable)() logic. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - Add Manivannan Sadhasivam's review tag Change from v1 to v7 - none drivers/pci/controller/dwc/pci-imx6.c | 37 ++++++++++++--------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 773411d20329f..d19fcb54fde0d 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -76,6 +76,8 @@ struct imx6_pcie_drvdata { const char *gpr; const char * const *clk_names; const u32 clks_cnt; + const u32 ltssm_off; + const u32 ltssm_mask; }; struct imx6_pcie { @@ -775,18 +777,11 @@ static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) static void imx6_pcie_ltssm_enable(struct device *dev) { struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); + const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; - switch (imx6_pcie->drvdata->variant) { - case IMX6Q: - case IMX6SX: - case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6Q_GPR12_PCIE_CTL_2, - IMX6Q_GPR12_PCIE_CTL_2); - break; - default: - break; - } + if (drvdata->ltssm_mask) + regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, + drvdata->ltssm_mask); reset_control_deassert(imx6_pcie->apps_reset); } @@ -794,17 +789,11 @@ static void imx6_pcie_ltssm_enable(struct device *dev) static void imx6_pcie_ltssm_disable(struct device *dev) { struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); + const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; - switch (imx6_pcie->drvdata->variant) { - case IMX6Q: - case IMX6SX: - case IMX6QP: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6Q_GPR12_PCIE_CTL_2, 0); - break; - default: - break; - } + if (drvdata->ltssm_mask) + regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->ltssm_off, + drvdata->ltssm_mask, 0); reset_control_assert(imx6_pcie->apps_reset); } @@ -1394,6 +1383,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX6SX] = { .variant = IMX6SX, @@ -1403,6 +1394,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6sx_clks, .clks_cnt = ARRAY_SIZE(imx6sx_clks), + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX6QP] = { .variant = IMX6QP, @@ -1413,6 +1406,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx6q-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), + .ltssm_off = IOMUXC_GPR12, + .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, }, [IMX7D] = { .variant = IMX7D, From patchwork Fri Jan 19 17:11:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764877 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2052.outbound.protection.outlook.com [40.107.22.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 322DE5788C; Fri, 19 Jan 2024 17:12:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684343; cv=fail; b=pMVeV50MAbxu6XH9mVkThteyJWNeWIfuE9xXYKR1AJuSdx/+B0Yg//S95Mef+Eh+EfJdDVgBjcSZOcZ/IxLGjMYVz4NzW7r1pYM5ctQw23ViWFCQL8B55z8DeeR5zvR1uQNEs0aKbG7y/DfLubWOONf13Z+0XHynYvmIcyRsO4Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684343; c=relaxed/simple; bh=tqqQO6zPYzSAQmrziKnypvH6MSbxbykgqrfwDHHhugQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=LAILS8kon9CY2+JWOGSdnpCSa1dT18lsOH6DY8hKzpXvO5+mcPzZholkUWjW5RDDssJFQU21oZ0sFN1SEZEy0zWI/0sXLSpBKLrwcnDiBtkZdtKA1ePTYJSaEJoyF9Kw6/Zk6szflBGjISPXnwrP/S47G3zbj7QKW+wF5dq5gPI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=L5TLtGSp; arc=fail smtp.client-ip=40.107.22.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="L5TLtGSp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WT7oKTKZFn1uz945Sfj3C+q+guTt5kdjHLjTxz5Pvd/+ShVDiwFaEqHXyVKF+g9aUw0JflGuf0wdPHzubspQTmLVrwVESycSXtEhONXzoYCV4y4PaaO3dUS0X+l4aWYOtRr+GpEguyEJm63lruEOPbwrM9HtzTX8aBofN4NKeujQ1mzkJygd17FM3UtXoKhI7SWVc38EHNApQwekTRHYKNHOXPriJJoEzpis60RnQrapKUZ6yQMSi1o0Xrocnqpln0wSL9sb5WZnRCmByuiHVfQXHQ9edmr0oHcik4T/IzMOirhLyM1fP1WkdZjqe1E8y234xBRV7Q9sYMayqG+wYg== 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=w2bqYwVm2k4EwolqOV+jgPm8xypDCufJg5Q3cQdyl5A=; b=TiKU67p1Vq6IbZ/Nv1eHZdCM1y2Y1z4ngtU2hYMloI9I7eYKZlyuZQ5K5GwgV+4aRBuDGABHuOyCMppgh8zzjsiE6P451Sx5geVW0v664w+ag3fpgtz9bps0hfmnJfbjs++3OLwi+PjFnC7LrjaYRCpRRXzjuntSQdmfXBjdXzTiY6AXEVL5kbL3HDltFkVxqbfd/97x9D7Oml8JW+17u0zBCtOLUNVeIbmC6yMHSuyLBIeoz0RIDy1GPc0iER6EOE/DtJqqO9E73UoMDOAfx/lB0T+muo9/kfmijY7Lq1yzqFoT9cuaeL29cvDelLHNeW0TByT/afDpbBiz1VEytg== 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=w2bqYwVm2k4EwolqOV+jgPm8xypDCufJg5Q3cQdyl5A=; b=L5TLtGSpM4XSBWE54RFWoTBqsjeyM9pSO9U1LdEY8B1m4m6HJ3iC4YcPaVhJowWIAIhBOWawcmJ06LcObXPmti/9Nc/Z7a5F8zUrgKjFRqhmBZlSdfmO0VLBBD1hi9VlkqRgxlVvIliaw3qhIKBh3GXg4WB7Zw1V1m821dIb5b4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:19 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:19 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 07/16] PCI: imx6: Simplify configure_type() by using mode_off and mode_mask Date: Fri, 19 Jan 2024 12:11:13 -0500 Message-Id: <20240119171122.3057511-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ff28796-fba8-4295-efa1-08dc1911cae8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4rIYcFlYWyatXECbk1dQkFA63n5tr/aZs10lFTvz4UQd4k9Ybpskm54HRbea96UqHYO1p78FCPxAtbU969gA04W9hyAVq+tJ9JFA3EzZ/TqzBKilXzzLeMKscY3NAG2gKRS0yxqCXNkTj7sIfoct97Bqfs0qIS4HWXDkA7mMcNU6G6rwb6tT69KE79hnOlRcbw3CK9cHqx+ICYOSsih8ld2toxCDUgrSb4e55Z/2e4qHf20IdpYGb1tcedBkBIe/aXhS1oJ8GiD3zYQAlgItCy6ClspZDVLFE3iu373D82bQsHcJQipziMD5GHjjHi/PHLTo9l8nMa/QgyCsLWEwhwMkAt+Qscp7iwrq0hL8CmA8SybFmips6yiED1MU4+NASl+sfGXZ43jKYVZ/yPq963heiEV1oV8nF4+uTTzceeJCcOvtwZSA/TIwq75PfU7jaB6itq0vNPkRgeAVUnaai+6169MDrZvBHEzSkpjNd+ZCfqFR9PezcF4xUfUBcv3mmuUr/oKnHiI1zqlkbNirxr9B6ZcfhnPiWxXFTDlcVrkJ9YhZ+kIx9xzottlpaJjg4GixdFFSvd2WHAISyZOwM1dWcOObc5RIHjWMwtgqZlXAK9PlFFWZHgnj2hjYHttN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VIEq/MpElqM6xiK1VC32ps7/3nAM52sQArtchuOHn/4XzgwMXRLuUByXV6escBZar/1ERcROoTpTexPFI7Xvqcg3ZoiIaXOSMTk23+p7NxyIpWqAE2z5HP22htI8A1I49ZEX2b2qg3OE1bMtXbyvuaIKTE1hSlD6lSwFj6nvLl62k7h4c5cZRVCPC/8Np7smz/U62ez4uh7rU5OtTJTjAEArEloY0frqgwzaxG7wGctIXPpVYcOOEOiJeJsLZazYdfG2ajJm1McTl0nIYymYPcybFe9qJQBicQ/9xF4QzOmi6we813uorhKrecS8zLhtbfwknZHIxBJlfzwndMb4+wPn5WPttIQODsdCA/ermvjklVAw8qAVN998A/MrAK2X9MCh0mPpmtbFD4KBMMZmVSAAi/IqoTzLLPyhlFFnRZOESnj3YQktpK/vOIvK+OETjYyp2j3lXO4qTGTwP9ZhTvcECC+XDtDTAxSg+fp0iMhcRF5UDw1t+kpnEZjR1piQsMqpLseliGPsHLmjSDjl7fdDacr8etp0hIpBzkctSO8EisopAptLhy+0kkUWqZY8El2Ha5PKhMDGnwCVUuL5qYj7O3rZmVjmdEvN/FYtVZs/l+0OPXNo7J8LuSorTU24P4nkA4eHNJwnTReRWXSaFcEjt3LW+a0piFkt3iORAaHELzI9C/tzqdGGlBia4KegIU8e7EJS5h7Mb0rp5e5PPBJq4JmPG2HOXFmXCEGC/J5qojuaBnSijq9jYOqP9KhaiaYQxS5MnQJCkXxf6nBR0A3wwJdU2pVF2W0bfov+wLW/rF5LX5/gcu2xqdGA2C6iayszxwBeivn1f45pMw1Rym8ZxUSXvQnbjxn+RjHSOsDKcCAgagglRxpBDfv01aKvM4rYmfAH5CCBOc0zQHuL2H2o4xKkg9vAsynfUUaBw0QNxaAJ1Xdj9o6t5Lzkrbss7/wmmDxvHwMp/PUuTcMzWOEcMHdJ3DOWJmLfNY3RExGuEzw9w0AdVJIdsmkM2/diAZZW87rUIkekLVy2PH2nPv60SV8fMP5oLIWV69AqL4gih27zLXEsU58lLdxcRQW8ugmZzwooLDvLqmFekOTICQrb3o4LGmYz1xBvm9iN1hOffv8PqQy58ud6Us7gQHPGJQ8YkE6gPCBZEi+sZLb0wjznCKD5+Sche8wOCDG7RYoqmG3yBgQigalMHCMMlBpYL+3uPOAry3Nh2IvfRMbOQjdp+/vP2Dv4cwPhGQw/S6RCdSkVcxGWRZUwQYh4iptyiENw/fDQszY0ONx/HYp8rl/eZhtcWcRjcHL14jTwf6iwW/F2TrGSWbhZNEh7UGUbwu/Kmb7cn4YJHadhgNnKsQrsu/BdU2LldmTAY4AobqH2q+1R6RtU+pHZl2X1z7dBnOaUjavXgcNPUnMWdJU9W54osRFAHauMSbYapzASn/DhNsCYq6IY7+846eZCTKVywuKNLjety3aOCZTn03z54F4YuBrBfusKsyqQaO+cpgjnYQ3vsOaD7gDrCOIqUquZan3eSgoGBQ/o+mAeDcIalPhlgLBiUE/TlgrfcadKDQ0= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ff28796-fba8-4295-efa1-08dc1911cae8 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:19.0988 (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: WPp5JriasvkZVsqLhdTDk67LeOGw/LMI42oRxOQ/KdolhQQK7snMXm573pdZ22HBy+5+O+4Ic6AQ7JOkmVRsLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 Add drvdata::mode_off and drvdata::mode_mask to simplify imx6_pcie_configure_type() logic. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Chagne from v8 to v9 - add Manivannan's review tag Change from v7 to v8 - replace simple with simplify - remove reduntant comments about FILED_PREP Change from v3 to v7 - none Change from v2 to v3 - none Change from v1 to v2 - use ffs() to fixe build error. Change from v2 to v3 - none Change from v1 to v2 - use ffs() to fixe build error. drivers/pci/controller/dwc/pci-imx6.c | 59 ++++++++++++++++++--------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index d19fcb54fde0d..8df07b71c93e5 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -68,6 +68,7 @@ enum imx6_pcie_variants { #define IMX6_PCIE_MAX_CLKS 6 +#define IMX6_PCIE_MAX_INSTANCES 2 struct imx6_pcie_drvdata { enum imx6_pcie_variants variant; enum dw_pcie_device_mode mode; @@ -78,6 +79,8 @@ struct imx6_pcie_drvdata { const u32 clks_cnt; const u32 ltssm_off; const u32 ltssm_mask; + const u32 mode_off[IMX6_PCIE_MAX_INSTANCES]; + const u32 mode_mask[IMX6_PCIE_MAX_INSTANCES]; }; struct imx6_pcie { @@ -174,32 +177,24 @@ static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie) static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) { - unsigned int mask, val, mode; + const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; + unsigned int mask, val, mode, id; - if (imx6_pcie->drvdata->mode == DW_PCIE_EP_TYPE) + if (drvdata->mode == DW_PCIE_EP_TYPE) mode = PCI_EXP_TYPE_ENDPOINT; else mode = PCI_EXP_TYPE_ROOT_PORT; - switch (imx6_pcie->drvdata->variant) { - case IMX8MQ: - case IMX8MQ_EP: - if (imx6_pcie->controller_id == 1) { - mask = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE; - val = FIELD_PREP(IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, - mode); - } else { - mask = IMX6Q_GPR12_DEVICE_TYPE; - val = FIELD_PREP(IMX6Q_GPR12_DEVICE_TYPE, mode); - } - break; - default: - mask = IMX6Q_GPR12_DEVICE_TYPE; - val = FIELD_PREP(IMX6Q_GPR12_DEVICE_TYPE, mode); - break; - } + id = imx6_pcie->controller_id; + + /* If mode_mask[id] is zero, means each controller have its individual gpr */ + if (!drvdata->mode_mask[id]) + id = 0; + + mask = drvdata->mode_mask[id]; + val = mode << (ffs(mask) - 1); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, mask, val); + regmap_update_bits(imx6_pcie->iomuxc_gpr, drvdata->mode_off[id], mask, val); } static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) @@ -1385,6 +1380,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6q_clks), .ltssm_off = IOMUXC_GPR12, .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX6SX] = { .variant = IMX6SX, @@ -1396,6 +1393,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6sx_clks), .ltssm_off = IOMUXC_GPR12, .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX6QP] = { .variant = IMX6QP, @@ -1408,6 +1407,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6q_clks), .ltssm_off = IOMUXC_GPR12, .ltssm_mask = IMX6Q_GPR12_PCIE_CTL_2, + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX7D] = { .variant = IMX7D, @@ -1417,6 +1418,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx7d-iomuxc-gpr", .clk_names = imx6q_clks, .clks_cnt = ARRAY_SIZE(imx6q_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MQ] = { .variant = IMX8MQ, @@ -1425,6 +1428,10 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .mode_off[1] = IOMUXC_GPR12, + .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, }, [IMX8MM] = { .variant = IMX8MM, @@ -1434,6 +1441,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MP] = { .variant = IMX8MP, @@ -1443,6 +1452,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, @@ -1452,6 +1463,10 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mq-iomuxc-gpr", .clk_names = imx8mq_clks, .clks_cnt = ARRAY_SIZE(imx8mq_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .mode_off[1] = IOMUXC_GPR12, + .mode_mask[1] = IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE, }, [IMX8MM_EP] = { .variant = IMX8MM_EP, @@ -1460,6 +1475,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mm-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, @@ -1468,6 +1485,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { .gpr = "fsl,imx8mp-iomuxc-gpr", .clk_names = imx8mm_clks, .clks_cnt = ARRAY_SIZE(imx8mm_clks), + .mode_off[0] = IOMUXC_GPR12, + .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, }; From patchwork Fri Jan 19 17:11:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764055 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2054.outbound.protection.outlook.com [40.107.22.54]) (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 3FFAB58120; Fri, 19 Jan 2024 17:12:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684349; cv=fail; b=jnWgAUbCn/pSvxfoChrmNBXfxuPRnRXyJY0PQxT2OU/B2MK8O2/s5wQqodzhT22XxG0IeDXkn/A3+aYxmQRIwEFs9sERTk3BnXwR7/HX9sgGQ6TQIl6MeHmGIZCgZSKdsIrf+7V0F5ibSuhtyrAZ6ZlZ33UyklAlhzdHNoGMkqg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684349; c=relaxed/simple; bh=XuJIizYV7C/PxO687u+1PgoMsekAR3XtwdptKJQrlkk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=iExO7bL6i2UrVnkdpcJ0d94BGL40+6/qUaQuoM5p+4ybG8x0vblWILxzBCTEuAhQh7/7NG0OsU5dS0Wl+N/2/7FiwFIYaxSg+iep3292ddI5+ibloHENMO5UbkOCaZvwA1IGy6HnGdpV7357icO9XbbCSA0fHOf3u5y1BVDotzg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=ZS1HULRb; arc=fail smtp.client-ip=40.107.22.54 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="ZS1HULRb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NIF9ZGtZPkGXcefrXCBVvTn/6msdI3v0w2+PGy4nc7ahc+7Yfh3PtIYRDoJZ9QslS6RB+E90rfc9njo02jeyUuTTdDB3w2mADgIHC+n/ISP0weryGqKaXG5Ff1Lh1PihGstznfjzlTmBRJ7KeKuhw4ELVxxUg696zRvZv6T9noi81Zw/XTVaToDz6ZyPeNCtTYspDz+KsSBrumXy8F2wbIoHqQijCCMSnRv7g6AjZnHBHjdXqw8QPl63UzU5xRKUr0asNsAqArSW+J7zEGkzaMLbwno+fPH+CBXV+SJ86kG9C4dtaSAVmm/54mVArYfiuavdq74hYWgO0e2TxVoWzw== 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=UPowD1fZYAo3g+e95PVHjzwdyYKOPoze8EZg60txha0=; b=T9OHLeXQ8x8JiwY3iqv0baCV3HGeB6IfL9jAiIHujhNjUM0JGOd/ebBkaJzmLMfTNnFSAt7V5HRGM4rWlV4GyDaCjn6PqAc7UJyPwjtNpngutSLdbPg4N3feginsKxKnfkL7Zf96uwd4XIFzuhFMTpm7zJk1Vv8c0Py25YtIvtz0YsGru3+MQbvqW3k/MudTNzNJivBtSttLWMRyzc4R9X17uqvEfeh2IPt6pkvlPtYB5JVgRF5tyDUzVMr6uArliEQOFRT3u6LfLfkKRX7Dbhn1cTWqeJ9QWBOThLakPRA4K/mtyxt4Zk09SkvrDUBy+7CoEBoV3iwq5nI6khVshQ== 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=UPowD1fZYAo3g+e95PVHjzwdyYKOPoze8EZg60txha0=; b=ZS1HULRb5SXi1hfoEZXWUfIE9YfTpEVAv53ZjhFdgJqmYKmmv6qLtISotGb9UUGu1XKIIByNiTy1aNzKxkDzysAGDUnANdCniM4gYl7PJVbRc1ahu8tv6yc32DPT9EGiVFcB0uW7LUq9lfWdLDkAffdWXB82gufHbLLsVYLU8+o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:24 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:24 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 08/16] PCI: imx6: Simplify switch-case logic by involve init_phy callback Date: Fri, 19 Jan 2024 12:11:14 -0500 Message-Id: <20240119171122.3057511-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: d7b6ece5-f347-438a-8105-08dc1911cde1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D/bT2waEiIdZRNGa8ykTE4/YMKraX9wQl89B5pnsPxh9l/0bi/+C7DKAYseCJxe+FQodzeOejSxrTBeSIBwqm/UVcsJlL9yPsNL6YxPMsR6fcvFrEOlWMl7CYoqPtfiLZc5P2aKf62R3KYCwJOS8NXrNUiSTxoXTkg0WKHct2sArR+QYM/T5ILOBcXf6CpvwcpP1gflSQGYamSMoZeZAWrTg8Ch6AKIt9wxH81VDiKwXFC+QUvGYXHTGIKplhtyHnDVOz4zKkrG+KoLJaer4PjQAVMRvgRsj9vdLSt7pDbvRNAjP0rqc+xL0fjBdEqJgYbdp+IGj+hCQLxKuH1uQvWjpRGFQdBmS+bxV0J8VLgxi7aV6K3WhCb8svS2EevxLKDcEKOOTy2rdxL9yyf+tV7aqF3LyoC8fLRCtFOgQ6KHxSFCt1NNQNkHXM0Jzgzh0nWRXuSbNVsnSElb+gBfhMI5hsHfcK2nGl8end52kWjIJ9uyazMZvKvb/W4zZE3/2wzk/YwnnPHf14szbK8lzlFQnWakLaegQSngw8Q6fknRp+QCzIlmDsKKf9iPVIkjsNQsux98R5rT3uiTGR7KNU+6uiTnp+ji+ABZ7fqbdPNgyrGMv3vv2I7PXRtxw1ggphDT+hlIt937Q80b3LoRwvEtPeLfUY/ORvQGj98EhT6s= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(230273577357003)(230173577357003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zTm6e+YWQRizjrU7LDQxQh9J4fWHAf8k0yCsRPPvM1+y0ppV3alKe/CHy3g/JOi+Gmaz0TyO+Da9+mV2s+SOChdfZh9TBIJkrTCON+hXA3RPSGVbDMzFyScpF5/lHy0VGa3PzXOc/kGd2BNUO4WUYviPP05+O/DFzhJQJMb13c83ohoacazgx01/lUoffVVUlDM4HWHO9iecjR8hYkxk66+RJPAZFRmzYTSXVrm8KQEjiuAzOMmn54CzSO4jZwdT03vMw9HdXjx+z/GTvJ0f2a0KuvqlTJuiXGJbS7o/hEq/twfpuMUAXpOCvERfVJH0xmelUVkFzfRhLYLn1i+hBZWBed/8k+RUfQ2UZyaXRRYSm2Dx6e6QeA+OcvFmB23mOiok70DlJ4RruUxCHUOPPgnt3060I/rjHbh///sF8MKMoxOt7v4HiHddWaXm6zkSuhzWMfry8eMG6LhLksgVNmLFZvemo1nOv84gnhbJ4qmoCVFoy5O3fLD0Arhoauc95dbZVl8Dnc9VP5Y3NJFr52hrdaYw10l16BDb9zhtim1Tv0023wtHGlcgTm3CyUPMj/0FEsXt3XYYQ3EAKhxD4ZCa4l/HamDe3rlGUTNR8lLwANsp95qwVDnb3KTAVBkR1di5FWpoF9yLveXwaDcTxBWuGBpzusaZPx5ccathlXl1v/BMWf3YeJy5CJsZb5FMJqdMjOmKg3o7vF4HPNRVkps+TG6Sl5xkuEDkLfs/Wt9K0Jmvu4NYmxJCwrgJ9YvZp1mr1e4C0AhbnXP+3inbxMyXHHhjU6AEk3gh1kV/TMR3gcGIlLUE+7DM82a/7T/Hg2A06IjuXIOIdUuKG/WcxuUYwxHtmj2QPNMnQF6HpeQ0c6a39dlupW0POb/+9u6fNe5l7OLzy7BTWQz3oIs9AwFteGW9qlqxKiShCSDs+tJMnNsHNnss6Nwhgn+1HJ6UPTFV8Y8koZ5xqBlA9i++q+WQqbolNA8t7gYrJU15KlOEPYIsORNZ+Yosw6EwChppFFJhbkkJlkFLgeHuANNp5+9c5f83WhpHEExCvus2wbIdqU6FI+w0GFjKGRT2pgmFfIawUj3QIctTfTbs77bEdC2dhlTvk22ihD1Vy514/s++n8y6LC5iqQWPG6pSkslMjWd+77yK4IKyVrP/oz4DlzhzabdpAWmT0usErXMidnabNM899gOId6/q9TbPmN1Mj2DJGsATjZbvrpVC94a4Oue8ky9aCMkFvNu86egv//7NUz7+CEPkr2CpIc3Kmb5nFxmom7rSpWH/vGyYrLMvRE3whXGgP9Inc/zY3oXm4obdgISibrSAfjL01HT89pWNj99qe9+ZqR7tDLNW4R4WWw5fxMPD5QPY3IrvHBgfDibP8qpj/EjZT1OWfEaYm0lumlt47JxB93Y46sLBuvU7wa4gXI8blUMg06y1kb8vy2IwL55SstwYmQDeLKvyp6ijD2c7Nu9nUoQItET5gnYZkqx70fyLRwnqiHndwHA0niM3kumc0tWNfi9KTCy17IkEdCBozBGRFTbf/jAeuDjsfzDVlDEez/w/9HL7e2QkTS4= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7b6ece5-f347-438a-8105-08dc1911cde1 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:24.1109 (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: Q94hOM4BfZauj2/sQgdLcPx84a/N62llm9i9ylgR+j6crSO3BOULCnA/oXPz+nR8W7Lj+DYfB0dbJusHxhb8TA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 Instead of using the switch case statement to initialize the PHY handled by this driver itself, let's introduce a new callback init_phy() and define it for platforms that require it. This simplifies the code. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8: - rework commit message - wrap comments to 100 chars - return 0 at imx7d_pcie_init_phy() change from v1 to v4: - none drivers/pci/controller/dwc/pci-imx6.c | 134 +++++++++++++------------- 1 file changed, 69 insertions(+), 65 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 8df07b71c93e5..dad192f38e702 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -69,6 +69,9 @@ enum imx6_pcie_variants { #define IMX6_PCIE_MAX_CLKS 6 #define IMX6_PCIE_MAX_INSTANCES 2 + +struct imx6_pcie; + struct imx6_pcie_drvdata { enum imx6_pcie_variants variant; enum dw_pcie_device_mode mode; @@ -81,6 +84,7 @@ struct imx6_pcie_drvdata { const u32 ltssm_mask; const u32 mode_off[IMX6_PCIE_MAX_INSTANCES]; const u32 mode_mask[IMX6_PCIE_MAX_INSTANCES]; + int (*init_phy)(struct imx6_pcie *pcie); }; struct imx6_pcie { @@ -322,76 +326,66 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return 0; } -static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) +static int imx8mq_pcie_init_phy(struct imx6_pcie *imx6_pcie) { - switch (imx6_pcie->drvdata->variant) { - case IMX8MM: - case IMX8MM_EP: - case IMX8MP: - case IMX8MP_EP: - /* - * The PHY initialization had been done in the PHY - * driver, break here directly. - */ - break; - case IMX8MQ: - case IMX8MQ_EP: - /* - * TODO: Currently this code assumes external - * oscillator is being used - */ + /* TODO: Currently this code assumes external oscillator is being used */ + regmap_update_bits(imx6_pcie->iomuxc_gpr, + imx6_pcie_grp_offset(imx6_pcie), + IMX8MQ_GPR_PCIE_REF_USE_PAD, + IMX8MQ_GPR_PCIE_REF_USE_PAD); + /* + * Regarding the datasheet, the PCIE_VPH is suggested to be 1.8V. If the PCIE_VPH is + * supplied by 3.3V, the VREG_BYPASS should be cleared to zero. + */ + if (imx6_pcie->vph && regulator_get_voltage(imx6_pcie->vph) > 3000000) regmap_update_bits(imx6_pcie->iomuxc_gpr, imx6_pcie_grp_offset(imx6_pcie), - IMX8MQ_GPR_PCIE_REF_USE_PAD, - IMX8MQ_GPR_PCIE_REF_USE_PAD); - /* - * Regarding the datasheet, the PCIE_VPH is suggested - * to be 1.8V. If the PCIE_VPH is supplied by 3.3V, the - * VREG_BYPASS should be cleared to zero. - */ - if (imx6_pcie->vph && - regulator_get_voltage(imx6_pcie->vph) > 3000000) - regmap_update_bits(imx6_pcie->iomuxc_gpr, - imx6_pcie_grp_offset(imx6_pcie), - IMX8MQ_GPR_PCIE_VREG_BYPASS, - 0); - break; - case IMX7D: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); - break; - case IMX6SX: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_RX_EQ_MASK, - IMX6SX_GPR12_PCIE_RX_EQ_2); - fallthrough; - default: - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX8MQ_GPR_PCIE_VREG_BYPASS, + 0); + + return 0; +} + +static int imx7d_pcie_init_phy(struct imx6_pcie *imx6_pcie) +{ + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, 0); + + return 0; +} + +static int imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie) +{ + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6Q_GPR12_PCIE_CTL_2, 0 << 10); - /* configure constant input signal to the pcie ctrl and phy */ - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6Q_GPR12_LOS_LEVEL, 9 << 4); - - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, - IMX6Q_GPR8_TX_DEEMPH_GEN1, - imx6_pcie->tx_deemph_gen1 << 0); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, - IMX6Q_GPR8_TX_DEEMPH_GEN2_3P5DB, - imx6_pcie->tx_deemph_gen2_3p5db << 6); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, - IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB, - imx6_pcie->tx_deemph_gen2_6db << 12); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, - IMX6Q_GPR8_TX_SWING_FULL, - imx6_pcie->tx_swing_full << 18); - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, - IMX6Q_GPR8_TX_SWING_LOW, - imx6_pcie->tx_swing_low << 25); - break; - } + /* configure constant input signal to the pcie ctrl and phy */ + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX6Q_GPR12_LOS_LEVEL, 9 << 4); + + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + IMX6Q_GPR8_TX_DEEMPH_GEN1, + imx6_pcie->tx_deemph_gen1 << 0); + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + IMX6Q_GPR8_TX_DEEMPH_GEN2_3P5DB, + imx6_pcie->tx_deemph_gen2_3p5db << 6); + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB, + imx6_pcie->tx_deemph_gen2_6db << 12); + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + IMX6Q_GPR8_TX_SWING_FULL, + imx6_pcie->tx_swing_full << 18); + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR8, + IMX6Q_GPR8_TX_SWING_LOW, + imx6_pcie->tx_swing_low << 25); + return 0; +} - imx6_pcie_configure_type(imx6_pcie); +static int imx6sx_pcie_init_phy(struct imx6_pcie *imx6_pcie) +{ + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX6SX_GPR12_PCIE_RX_EQ_MASK, IMX6SX_GPR12_PCIE_RX_EQ_2); + + return imx6_pcie_init_phy(imx6_pcie); } static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) @@ -902,7 +896,11 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) } imx6_pcie_assert_core_reset(imx6_pcie); - imx6_pcie_init_phy(imx6_pcie); + + if (imx6_pcie->drvdata->init_phy) + imx6_pcie->drvdata->init_phy(imx6_pcie); + + imx6_pcie_configure_type(imx6_pcie); ret = imx6_pcie_clk_enable(imx6_pcie); if (ret) { @@ -1382,6 +1380,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, @@ -1395,6 +1394,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, @@ -1409,6 +1409,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, @@ -1420,6 +1421,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx6q_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .init_phy = imx7d_pcie_init_phy, }, [IMX8MQ] = { .variant = IMX8MQ, @@ -1432,6 +1434,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, @@ -1467,6 +1470,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 Fri Jan 19 17:11:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764876 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2073.outbound.protection.outlook.com [40.107.22.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F1F658239; Fri, 19 Jan 2024 17:12:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684354; cv=fail; b=mn4WERltXKqSDom89iQs94QHXsSROXpZcXX/06kIAOOueF/qYBiPXKPtu7wsteVjLpfsJBmiFSHSSLWTCO5+DU9BbHISj2QXI7y4/CZ/To2LtnMCKCALQDHTH8727oLT/fr+k9nuumQ7GmwqUcg62awx1kQTLYaSkO6bN7N5GwA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684354; c=relaxed/simple; bh=4U0EXmDAhWt4Qi+hY0ZhmgS1j1Ag5H2B7cHjA0y4ur8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=BRyxec23nL/n4XLbAOlGUsHLu2OkhPpqHqA4sGBh934+Xjmh/2dxRA4m3WY1ypzwd0xDA7F++IM8N7sm3qhg6emWcbrRd9L5JrjJXkcj2m83uwpPldfK0uXQTW7TM1p0U7MV8iodMcY2OukIkirT58TB6mJzRPlkl72DP+QQVOk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=WWM4Vkvz; arc=fail smtp.client-ip=40.107.22.73 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="WWM4Vkvz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XR2YsnoRy3HhSWtfYrwAQXmRtqxy5UX/wUurqUnwuDZ87fMicWmJRt71LPexxvY1joLxUCJ6CUCZnFcwYRcrplnvHJ3N2mW8PgYq1SvjgUd3iZlCINMp9hoPSbGQ15Hn6cXUA2j1JE9UuaK63eQNuIPXMEhNFkR0KmaLJEbJ1Y3DI5XPC8SleS/Jom1+yNbD8KmE27p+ZXZICSVB+NfBigNZ9QKk2gVLYY3/DGnulYHB9UEU1dYlpjQZwxOf7nQfbKEwpAf1N5d1maOIkoZcz0IA1lzEY1iR6vEPICk3QDRJURb5lETXRp+4125g7GUF0fXM8sf657M4sDOeVtn6UA== 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=gV1LmGPihazQf9EcU7o32Xhyn4PgMLg/E0OO76MiU9w=; b=X79lsG7HdhqV0uM1g3iLFiOxhFRYvINgpr9qBacjCxX61TB/GzcS5G7Jyy4ZNEk0h3Qgf8oN/HqD016ShWZ0tDpv4foaJPLl0NMVeGV4KzxyogiKJKwP3ar3v6vWJYZf7lQCMz0bI4VAmG13odVwnroBvE/L+DjagNOv6bI69xHiVBNefqBLhxtWVyK3UvqyOdAS09yy/Ged4k6eN8ilVMKFYzbpRWFc/1vPXe/pEr7hJB2C/cbwq1PpqGHTyWwBt9ecxq852gFktJ4U7z7ZgRp0UxQjT4GH1cEX9/vNOQq9yeVJ3KACBXK8YqjmDkR7XWxZNjmrrxz9fnhPwSPrYw== 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=gV1LmGPihazQf9EcU7o32Xhyn4PgMLg/E0OO76MiU9w=; b=WWM4Vkvzb4jAoNpCdtx6UN/pB2J82TA26kg5GFGEcXk/6tIaLHIloV+ioHyLXZPo1J74N6iKs4zrtaLDc+B5ym2rTfvyqeVglbH2CtTQerDihUyiwi7yGkbwK1T2+86cNDHX+JPvC5Wi0deJ4yF+InMRQPQzBpAza9t0z0Bxoho= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:29 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:29 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 09/16] dt-bindings: imx6q-pcie: Clean up irrationality clocks check Date: Fri, 19 Jan 2024 12:11:15 -0500 Message-Id: <20240119171122.3057511-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: aefd7b9a-dac0-4d6e-747c-08dc1911d0dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rPPMIaSt6OuKzcinSaET55GwBHDrGkbGK4tAIcFUvqmDqzwodCTxZWciNQw0TzyH/s4dT/3WFGImygqWrWzkLmAHu3w+ymvMhbiAyjox/lG0av2meFqIs4EJrzc/T+ZqvXMLejng7Jf42Zkv3xzzZfjTPfn+zyueVQB5rrG2ueS7b/j3C9MxOwdWkRa3pfqBJKUFKZO6AbLyoS4VTYtOvgQPyHUNyz6p4R+FXyWVbJ2HmM570mBiLRXjir7QLrfZZxhhOOG87grvKO8NC4qqcM2iY8vyrMHBvlYI+vv2pIKZivXpCBg4ucnmiybCgMezFg17rgIabhSajP0FNgGwn11mPfn8HXzuC8JFlRnOD8OTQEewCnkcGyx95CkTEEls88z3g0RSvnow/3N9Tpix2oVf3gzl38T7RoExamZq0Sf5XPup/4jqZ/1GppPdyjdzH2+3bk+uYND0Q2eFgnKiJ7IMX8txeEGc2D2hHULU0kBM+IBixj1upzAXMJsL8YTV1syaviQfC+bY2KQnena38xNTBW6WfnGkas5FLkc6WM7s7abam57QnVHFgtAAWcZNPAJ17YXAhCADqHaietIWkNTnKoxfbnQI2mRJzGTShgd3fHwkLaC4rbU+Q20AE0jXKa8FQED33q7HEoXK3P55DA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 64phxPig3b34AMoqLbZ2NUyJ51kVlqKBKCdKyz2+SSZ81KgsgQzyn2H14YmZImAl9izqtVHXiXulkBTyCpbmd3pKvDIpYflU0tQRvVFfFgPrmpwNZNOH1IV9dnMHQp3rA08zT6dPCOgm/KSaOocMJvlYyBrdWE8qee0H8oQ2YDKhdu/uUZY53vpzAtfw7xNAUPOQ/zWwywfQiLQfPoQkgnLk7k8dpP5NAeTRnRMQlKvPZDz72Eadc6DKoCVYPbE7TuMR2+5Rvsm3yoHwSTq5iJxCPChUv/NtoHcsZRyCspSLdU4Zm4R2GY0D6Fa+WNFENBg2J/GYuiNT4Kamj0ye5CyDMD8vLekJixTlQWcAoct3P3mvZvIbZTnG0utqjqq+iJrBZWtGVmVTtUJce8OJEdPUVNXMON7N7DuXEdR6/n/+R6tERBLIZ2LFBnfAzfTCSLHZkJCp2+/G2DJp4yjc8yGahpInPndxFFCrnwIImxQjDD9oVBuXc0AWLffKF2wEf81iXiLDv7HsFqqtyxhGLu2OLRo7Tm48+tKDw/k6UQUrGqTT+qE7HBUpmhf7OOCna7SD1e0zaI7N1QrQtgUfRybyFGqhOvATWHUYnaAV+ZRSpyBbbv92IGRi7Qq1CBFWg1HHDYj5+eoRigIiEfVXyCkIezibJNAzmay+LBLQS8vnfMwDOJ2LU1vx82So236s8PFKH1UTZp2VbSP/U/+R29Nj7jomcuzGUUclRsno7w3miE3pUAdAq9zGLr0CnGzuAu9gdltTyvrG+yHOmI1S35uZshzBBrNQJlCWLaHfe+h4CKH13ckBzJzliD8LyypVK2foh+a2tW7PiKiQ4ZDBbCJFifKrdX/3qiPqr2c87C7S8NYe8Pb4k93lveqtJjAMLDodUsnmFD5MDAZXyJBKgHKwPvT/vvjSNW08DDy9pSvet9z7Rwgc8PKFm2OGisFpvK077f9Zqlo7dF+OC1pH4uyHvZ+w9mbyQV7I+W85rvzB1kMHFAJUK3+I/zoyeVlBxYcrkHN5D/CGo1zKI++bZ/yx4O5Vw8dH47UqxRLYoTOqybiznrJZDuz39/aS3tKuwKkauBncw1jymrf4ujWem6INHswpNYSWpI33TTDCzXEB/V6s6subF9aZD2rNzCbun3kVKX+7y+HgWyzlGspmfDuRZ0q3UVYpr7aVE4fs82J930s0TltlL46uHnECF37SQyqMEGU1HzW0HHzR47pnETNHrk3+p/Tw6uvikaMTnrZViUBgUEMIqK6JIQIuz4xqG2l6235uesgL7qy6sjUrkIlBBpVpSj82lwFB0Nobk3i5x0EWPShTK8IIUSHtUu7uNLLNloJVHTBUDB2PorsVu+2qVV8czWCmVGC6svp2UvsABspppn83bzrq58dNWXA4PenNKpVmeN4PP1NQchXfHddZi3ndhkDkPPZDxDhUzXKinQxkPv9pAn05rTChIUZTAdflqiFOmoDN8TPILLrTKybSLUgahzoD5j/MgpQxbE6lAshoNl7DhMiYlTBeXhkJiNycz7MKT0Jn6hcL25M9j76czZt13x9XNzfAQ/dIFdE= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aefd7b9a-dac0-4d6e-747c-08dc1911d0dc X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:29.0696 (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: lOR2yOzcGBb4OSYAHCylSwd9UILCIrTmzooZBj5wnPsWlkN9TZHwgVKekTGKKe5jVwxUZqURRUE8iYIPoBS3lQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 The bindings referencing this file already define these constraints for each of the variants, so the if not: then: is redundant. Acked-by: Rob Herring Acked-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - add Manivannan Sadhasiva's Ack tag Change from v6 to v7 - rewrite git commit message by using simple words Change from v5 to v6 - rewrite git commit message and explain why remove it safely. - Add Rob's Ack Change from v1 to v4 - new patch at v4 .../bindings/pci/fsl,imx6q-pcie-common.yaml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml index 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 Fri Jan 19 17:11:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764054 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2041.outbound.protection.outlook.com [40.107.22.41]) (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 D095358AC2; Fri, 19 Jan 2024 17:12:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684358; cv=fail; b=Eol4IuseVIH4VCqVrBn6LJcujuJSNiPhhFTEulrHi4zhL9V08uzJPWwJBMql9JXY/BBGDA36fUzf8RYDTUhTVJgSb2i8TME7REs8vLnPabQLli2ypIICM7L+q4DEJjaCv2KcGWsLispsoUBJR+EAyQAXL98WXu1EQ5DV0wYjp8Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684358; c=relaxed/simple; bh=Bq2o7cacWoEZUdgSGI6VUHYkWXIXMIAwSoRtZZ5o9cY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=cYFkjcN3SLAPQ/zPPwc36UEsJJzCs2OWEVpBNAYs5d8QzlXa0B4i2PDATqoVkRTI50DYZx8QeBJvNeB8HWMwRoDZbWMixdBK95jFB8yDgd+dZsktcvE2ZKaEk8i9gB1xRbHJrq05p/rnV4MXEEFgMmR8Jaa47i1rGkXjH7oIAJU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=X/PjSosK; arc=fail smtp.client-ip=40.107.22.41 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="X/PjSosK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OtxRnQ1MYkxuWbwUxiN8Jk0ZFH15T8bSIUoBSlG9ujIRAIkN+Apz8d+uiCbvd/pdsY7sQZZvPtyrQcw3IMxOjIhlBfpBQl+dtx6W6kOiKEvIY/7QmxcyNnse5hVOgJuKFZskLKOqn308h91drpOlHig7K9ZnCAcAvchGJwp86D+buCHa5wAoG4soF2RSAPRTBN+sqRaVzuthIl6b0zGMxIicAmPblWQ02Vl6PM5ZHX3igQuKEeI+Fd3Cs9LQTFE5crEfwxqMUCmwJlQZgxnNLdq1ewnaBISj00jutTx/QOjfCGyi6ypEsgwKxtXGHOSujv1BYHJB+oh5JYbTo7BkbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZNuEqwnvrUxPSqcjCvVLoRsw0bm7wK8OqtVGkt+aEeU=; b=m+ToNA09EI24AeUVQuF0oRyIWGlKWtmw/9ZKOPZM/XpTOVatUJgxlWTg+0IUH9jQHGCEiYiLvZvhsC2us7r8StXEBkEfwz1yQE62KRJQuC4IbdhOZjZtj3TgWLYzOkdBq/RXzK14wQnz+9gg1+EG0P8yFI68PGVHPoaUVMFhF3I1wQ3LYqSc1c/h8IiaX+j4dgaJ5baqDBlFIBRDFUI1oCXfOwj9vGdRDk9QEZ2YpxeWD05ng9mNEuDuOkgavCvfECptiqrbeO1pJINVB2rpl7XbFyho6/3wyq8/rXwe33zOCIK0yweO3t1bd6kuDKo4ebfZDBMfb45L7YdSVaeLSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZNuEqwnvrUxPSqcjCvVLoRsw0bm7wK8OqtVGkt+aEeU=; b=X/PjSosKdMT3MaxCaarFI4zGOyiZ0L4E/y3XGp0GiqUoh0PeJj/C8H7lrrjG3vLlT0mPybT2+anFURJUUCLDzptTKVh3u4/6x34kEnHI0QQ9HbNQm6C+j8WvdjRzOfijlpmWZWcubo1nuWSWX+YsjYPuZDs4BZi/Xr5raljvnSA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:34 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:34 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 10/16] dt-bindings: imx6q-pcie: Restruct reg and reg-name Date: Fri, 19 Jan 2024 12:11:16 -0500 Message-Id: <20240119171122.3057511-11-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 022bbb97-f736-4b70-a315-08dc1911d3d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lyO5IWMaPdbWiRBYOjJecWPxXtMSZC48CgICm4XWnz19p8T6+OV9+MmfG4dOlagiz4VCIVuawK4fMMygPjgrveGcvvT0HMIbTkEsqMiUyOY7Ztyl2lpFCRZ0EFGEuG3QPXPrp490wR4/85caCTqIISKkz+tA8L6bE/p59v41U7rvK4jyCTfZOCR9iFyPHO9zR406JqKnG9LnMbhv3ecLEMsIRh5GPFLYRAW5y61NxlWtUsz8vzP+iPE5pEx9Eww4XYf8WKko5yEqmKm84IdzRSXaF5vkGPl4hNH6LzaZkOsoGq4DcBgjb7EXAUzqjlHj5aOpS83BQ2AB3inEvSYLCGXgQ5t0+/xP7IV4y6eGnAFzN6l3oWGZzyxTcD3BtXM7wOwaZG5Jl+NLAbOH8wPVSG3X8MkVli56GK0dXQgBXzeqjJbzyyVO9ObCPEDV5A5sKpKSYP86PUc5SgnGZ6DvDTxGdpqFYSL07yaaDEITW/IHf6NbbfDJnBvXAbFsX4OXJgMFejUYsfIXvP0t5fsIujXOYITouut2YqTk0D91J6+04bqJKFSZArX5E/Y6wG/h5mSG3SGUAzvob4808VJTbQFA2zyPebzbVycg4FwIvqecaBjnSWkRHMHA18e8WNujqtrkzo1HnpkN5ETe0KWWVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gQUpUgsXu4dE6d7Yhv8JNVqFMT9lLeSea56PV1J/zUJQhjy+TUtRmccfHSuOFBcr/zTdHk+6R8Sc64RCCOhmZusHKeO7iuZMWkPl+VwXAtJAQ6bFfAWtlD7jss2DM1+P48fNX3uF7Ni/yQpI1iCO5kyLwAa2bMt3g+xu0Ms9o9aWNZQooDz9RV95OXS3ZR8Q0vuCmUmMXxZyS0NPiAbpkKY7w5M0B6cS2vwzTQv4nAQZMgUdov2swhcMaXpyyJXERCAA7WQE/PkN3oEYJubvK3CtC5XFQ+FKAG8v6ejemCs4z1LWkJNqvRQRQ/zSaKaFKS5IUAhepTDTfeKhH/EisxZU/cXnm6xcUq4CFBxMAur0Il8xkvwEDUHIZPHSeUrxl4LYJReYeRsLphaFstrD7U3ZHSSoVbxvlW/KYNtp+p5BzOaWMH+B3OFLnJQSHUKB5SrTmy96CO5glTb0xMEvW1CeTFH9Aou2URxIE+Flh+Y2a2RkIyXM9ArxXoKxMTyzJcoFZa2fUUwXkSxd1PFRmhTFhvogv78Bnh2qa4tGu3Ux+oMcOMyxax9ENtrRbUSGXuSQNSnFQEgl3DnGFcmunVVokJlrpccwIOzNdEjR6eNYjt9BuZtsjK6nYtkULA9wXGl16/HzyrQAQ8CKSrPGHl8KUmwINWKjQIoEeCWcl9eFmw/vCtwX+21k8xxcoeHaAkgjnf+5QryRUbc9Dz/VxvvZnrRla2tzYcsL15GgSwMH797velzyM9ZexXwzMpaSdk/US9xo1dqlFL09to120DJchS1G2WeZICqNlf0gF/UEWVabQTRdLE6OU+l+tsgX2cl5NduBpPMXYQcC0CHqwOZNukuKfq6hdd1yHU2AufwthqoefBuebycgfvU6w/37XJX2HPI6ogqq9QF7fjvQACjxxkXeTPLJvleYNTyHfz4H747iOwb2C09N1WbDX4Giu7Aj1ftzCYpXROvmb2yOkIZJVfK+6ybf16Bdag4OX2E5onYa7g9bvkxStvJxiroCYI8safWV+24cNzAUWO9lkil0NwZbC2x+3Yg/ukCViRTJ/Aa3QA3cbpaPZUnl0THt3zkpXZifWtWZd0HwQsH79O+JznqdJbn5lZm4pWUDXb/vr3HnGzt34zgS5+kyesZe4zUNf8cyZB6XWXzA70ia5wDoIkb6PVhboOAXRbd19GDUiTQArpu/6yVuUseKmP1D3dz6H2LPRg2Gj5Vfh+r5nFyKk8dJ1OT0HjAH6WTq2n82tPdn+ZU7bG91bgadiUJbX//otfTOGwqtlk8FeA1EIZVis51ZregFbty4iHZX8PlffMjdoiQAk5tH8NE3yTBmW9DtjkhzEN9dloN6HyIIkMODUzVe/8XK10eXko3MUKYD/lLuWDro/zbHP9gW9tqVH7MDk+qteIk9aHomE3vYOkZfj84ayQZhQsgIKN2ZO9cPWwkZl99LgrmMrCrTJqOSR+325uavfVuccSG07M7dhpm5CNGx7IpGTEKUXyh2FENGczhIqT7x0PdYkMRESmp7PbBa/PmikQ9EuzR9wocKosuELV59Ydte2c3CA/T6OWE= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 022bbb97-f736-4b70-a315-08dc1911d3d2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:34.0015 (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: Jc0WJ9DaBofutQanL/R9IhHsr/AQ40NgMfCkfVs/kcdcDeweEYaNFMCgT0fvV+GauoJGI3/YvkP5erZ1+Qskyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 snps,dw-pcie.yaml already have reg and reg-name information. Needn't duplciate here. Add 'if' check for existed compatible string to restrict reg and reg-names. This prepare to add new compatible string with difference reg-names sets. Reviewed-by: Krzysztof Kozlowski Acked-by: Manivannan Sadhasivam Signed-off-by: Frank Li Acked-by: Rob Herring --- Notes: Change from v7 to v8 - Add Manivannan Sadhasivam's ACK tag Change from v6 to v7 - add Krzysztof's review tag Change from v5 to v6 - Add if check for existed compatible string Change from v4 to v5 - add Rob's Acked Change from v1 to v4: - new patch at v4 .../bindings/pci/fsl,imx6q-pcie.yaml | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml index 81bbb8728f0f9..eeca6b7b540f9 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml @@ -30,16 +30,6 @@ properties: - fsl,imx8mm-pcie - fsl,imx8mp-pcie - reg: - items: - - description: Data Bus Interface (DBI) registers. - - description: PCIe configuration space region. - - reg-names: - items: - - const: dbi - - const: config - clocks: minItems: 3 items: @@ -90,6 +80,26 @@ required: allOf: - $ref: /schemas/pci/snps,dw-pcie.yaml# - $ref: /schemas/pci/fsl,imx6q-pcie-common.yaml# + - if: + properties: + compatible: + enum: + - fsl,imx6q-pcie + - fsl,imx6sx-pcie + - fsl,imx6qp-pcie + - fsl,imx7d-pcie + - fsl,imx8mq-pcie + - fsl,imx8mm-pcie + - fsl,imx8mp-pcie + then: + properties: + reg: + maxItems: 2 + reg-names: + items: + - const: dbi + - const: config + - if: properties: compatible: From patchwork Fri Jan 19 17:11:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764053 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) (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 541505916A; Fri, 19 Jan 2024 17:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684369; cv=fail; b=nDJTUnS52liW+IjEodcWxEpywcQ1HuD0NFPIXuM1mSf0LTPPS/zyVV3Nb+QpsvHJvdpHbCHnZ1I6i1ZSjFXTkrLhiHBNfalwpiTgdpSEnBfj0gUzBjm31QSjzBR+jk5zfyqTN3gkLJIP/+p2WSKBhRfNo8ld3nF94AeYbwVHKC8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684369; c=relaxed/simple; bh=Jpr9D7bCbA77S/+/IKSwybqJ583yF7AOkbKGaz6LVFQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tf9SQbx9PPOXxDVfCFw+9szkd7izESnYO9uP8E6zNbSsgUB3SpafUIx+jLlRTfIKJMJzMb0m7x2rqf2nHCPdjVBUwqc3nQEgXjqQ+bh/Mfw2raSKHFwFGNIhc/+DgJP7fps7IcSl1gJui0B0gZfFR/jd95XLJJOg7zlVk+XeBCI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=dibhZG8O; arc=fail smtp.client-ip=40.107.22.69 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="dibhZG8O" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WuwOFJYF+s0Kz8q+r4zhUGGTATRh6s+rzfv8Pgqub7ygGOU/rJz/GstrINzBG+xZrhKaR/zg1mDgoxtRT7HcqaL8zSmJkm6ZUi4l98ccxvfefKf012MVmSzPrJ5vD2+qPVJKXxGzSkh27S8Z57zHnLp+krFtabPRXfAasJvKylx/vvCpjONC+l0TUOVODeK0bjuvpXYMEEokQ9TnU2pYz8GUr2IJBMZZDW3Pf9u57AlZ4Q17TbrVtnUnazpXVAwcEJTUt+e7wnWoUR1+Foxv01M2qMoo8SiTGWpm4B9EiLtnEPCGGqJKzNrs8JLunz6MXjdPvnFodhzm3/ytC9xsfg== 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=Ue7Z7S/Gg23M28vNKSkjOcn0qRKsr0AUtEpnelHAS5Y=; b=PbqPGiv0dU811xBGsjxMZVZixfLkZLBmrjGZmBwFBI432NORKVuvfNUlukgJ6IXuooa42JXqeDbmkDe7zYvsVcYSI+kxb6J0uSqSbd4PMDDYWKjTPqRlp+1Azxl3Gdd7GA90KheFFyiNnJTxViiaapVhQlqc4etKXYOjUXH3zQi2eOstV0ff9np8vSOY2T03nI8ApI2iKbgvjdjNydpDtoVc8psjCQM+jh6vK1yR7A9AVks9+qBVHTCmzpwz+fcPXwuYd69fTve/Jn1ktWPQBIlPUZD2RtUHG7fT48kei+U9osLVkXdk4YX6DTD8G+p0aEa4wwdlEkUDCgKz/afzyg== 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=Ue7Z7S/Gg23M28vNKSkjOcn0qRKsr0AUtEpnelHAS5Y=; b=dibhZG8OIOiKTTm+oa448x4rQ/wX7EVc2DMCv1MRoJ8rXAUDOoUrbAz6EelvMAT52l+ue/wqtr7xOnlY6j4yExuB/fn7KY8PW4NMgI4/9XGs7NCsf9ud3pHsZaEiV8CFjTiiLLHO7aTcQ4lts2cFgGMyhcn3DRRemqXVJgx8x8k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:44 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:39 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 11/16] dt-bindings: imx6q-pcie: Add imx95 pcie compatible string Date: Fri, 19 Jan 2024 12:11:17 -0500 Message-Id: <20240119171122.3057511-12-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 436e6976-af4b-45b5-bb3d-08dc1911d712 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yP74r7Mk8Dm7EWNo/xKXhu2kKuytq7gpJ72m0ltkhM6JdXwZcnHxODBM1z/GFiSY6Dv/Yi5s6f2y9iz/uHXyO8KCBq51qBdZ8HuQQn9C3fNKLzt7duQqrkWTdf86Ya/Jzebwi4izNF5J6Y5ydK1TZOxGn0JmJnOwkzAo4KdN7Dx074EFOpet85Z+SnTuEfItqN5r8Zar7s2UIxroF17/qriv0k+yvW3xKfr4374iCXhKWPdJ0GtyZiqHP07XdbrZtC2K82lSVjEMfAVEMMvuwLFRQXFPfH0oVYfZy/xorMy5n9NNELuvKKAb4HOKqrr0rEWwHNwlByX8jtuxU+mZE1ZSSlzx+xQJ0WWMLtyhXqbJkYhCU3+bRnHfYdvD3srKwV7MIUr4fdo9RfUTLJN5RHXi4e7wp5KcaqieqYS+zjJz1RNo/8UjtcuP/HKFlAWonE5CfaqUh4KufKBzQR89EVQhmrSxL9KP53nNipb+2YJGuHR80rFBZGTEmq9IZAjKjEvjwvxnjyUzvjX24XNeTgWP15MBv1emLtuRsv5BPGAeY7+XV49TidQGx/DkoAMEnnUNbzABl1mSZQIRP1HpEgEdD9DY/0XXFxLNV9AHV2Usp65H48tdifSIv63Hm+7XnW7V++P1++WIJ7tYwmHJhQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bMWBTtbPdXfunKiAJVS41fwCjf5355AkCFxujpqvmKruuPV7BZOrmQmGN4fMjLxXTHRnOB0m3jOoeoSnrngkX317V6BmLBbHm7TRR/4I5ucSaurhXihlMJNfwkNMKte11vlClY+XI8jmj6wolEmiE7WFhtpLyfGxv85kccQ4VWcDbSc0kYIla+GlE/lnpgn5SO51Le7u3GLrr+GZ+5NjVIRckCbTZB7XHlLWXvOMVYlDmusKK6pqlwsmJYWapWkewlv+OgxXfCnCD/GsX0lqgSa7hjdFtLdm82Xbc+W9DaDqfePSBOwAJlrdxenLIcBDRzPoc4rDaYMkcH9oeRFGdb9hK2kZy4XgMZVvqlF2FsnE7DTze6lAdetqEo8W5jHlE52buxWWKuIfAd4xuv/L0aBsuCD+FGmEu7y6ZVnh+Tb9NsZj8yxBx5EDBK05sej8X0qvQzZbV/In5Arzp/oRcBXsc4d4EY7SO6/ZhmknOzaEovpYLMVSR9Fn/eCBcU/nEe5dEz4ycG75ScmxrpfrLUna6TG8RaLo2RgVIziQzRVvGPG2KhzWGfXjRWDgS3D06esgdQQ6JkDQMnVA5OWIGbggcGX12spu/Ko5nvqApx4E2jUf1H89MrgiVTuFIWVxx9hNmxOwqhx188M1jjw2cvH7W+Ck2hgpVFjDzJsQ2FRcNb1h/h5T+7BCJYERP6ZgS3agUb/fq4BabYVYavcrWk329RYVWHET/r5qY4FEoaYuK5r0Pb6lP0Y4exrxfRfKHrxdYDBWP4ESyg8WM/RAyAnMuCrdW2EKPMlofYH+VthG4IUUhFI4BhCnm9RV7ZUiBr3M5Vvlb7BkVttpxZly6bEbfr/BdB3fH+5WJsn5jybREQ3nUxFt0xp2MmSoIMSO7wdn/ITL9xyo7r9pA7KRyEyN1B2QMIc1huyH7ltwCAy6r8WdnkIkUikZpjTzHa59jEp7Ud8Ky6Q8r7uJTUQdZZd/kipilsSKrjjnW2lYKXa7jKWgQJT6fSTJzcSy9/A6TXpcy53RKtAbWgkrhcpQ1Xx6HoS+nE9o0jviLI35lKfvbzYFZGg3fG6LA3sVwrCW8HbLHRzJoKsuv4tdwRuLZ7GQ4KgSxWpGi1oBdRuLIcgAQ1KtBj85H8qCDJQeYl+Q6+PORR6ukVKX1VLbwDqEH3c+36bcHRfT/4EWTmjcHn/jUdAM3rtZJUCedeDJY1YBdTa36WfPW0pu1xTmHEjKi7rRHwaUw/sNL99gl3iqy3ss55VjpV/LuWxFxhRUHsUhk9Ywx7qT96EvQeOZa6WnNVR34dycmFRWoUKvAzUlOyt4gHmqlr/QcXNGuPUSLpO+SE2yQ9PmYBOq92xbT3iBpmqcQoc0qteE5P94zsbIgrzuIKNQpQ18iizL18gUjBpYZoG+bkP7H9OsVfGQ9cvBlEYiYFFidVd0eHSAXO2hGui/Oo/JtwIBZLri8mJuxaza3pUU9o1qgvJa1CKestTH5FgIMvyVWBlJWyMZ+/n1yZIhUMYGsQS7rk61b8XXZBDbSDBBGsyQbcYKSVkNDqQTjv6g7KLJ2+/BapUy/9XEPb0= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 436e6976-af4b-45b5-bb3d-08dc1911d712 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:39.4689 (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: ZrblkYMrg2u47cl0LcYfHnnisRlSLQGHb96380X4ovFEkXxiDeD+pY3QR7SfYWyO8tdJjZNqUbLRSmzuPl2aFQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 From: Richard Zhu Add i.MX95 PCIe "fsl,imx95-pcie" compatible string. Add "atu" and "app" to reg-names. Reviewed-by: Rob Herring Signed-off-by: Richard Zhu Signed-off-by: Frank Li --- Notes: Change from v8 to v9 - Added rob's review tag Change from v7 to v8 -none Change from v6 to v7 - Added my sign off Change from v5 to v6 - move atu and app after config Change from v2 to v3 - Remove krzy's ACK tag - Add condition check for imx95, which required more reg-names then old platform, so need Krzy review again, Change from v1 to v2 - add Krzy's ACK tag .../bindings/pci/fsl,imx6q-pcie-common.yaml | 1 + .../bindings/pci/fsl,imx6q-pcie.yaml | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml index 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 Fri Jan 19 17:11:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764875 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) (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 00E9C59173; Fri, 19 Jan 2024 17:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684371; cv=fail; b=vEnmbkuiRTj9kEvfhsefvTKJ+LDU9CitCg6/WZ2ReWVHp1T1Qt6F2eCyLK4Z3Mu2e1c7XCUr2kYGZQrpIuxSOp4ojPJvUIhBoSKfPd4ZRT45Z7ClgfqQi/AKoNfp1VRnGexkTSaDMojS0YpeP1Gr4nJmjCxsxpTBSodd0j3aIKM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684371; c=relaxed/simple; bh=PwdigawNSwFXittETsKY2xda25UFmd1MpTjyJmDvHLc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=N9IcrIlUNJgonQxrzme/NiugyMHsRkOMkHyX1N8+C9cy4S3hxin6F8JTcOZqEjn+gAuF9drlC4KdL1PvLDDqey3B70rJY+KCE3FV20oRAgXnWEIwLoH8D19me2m0GD7xxitdtWU296Rb3KIhQ7QmYaNw0aCNJuiUwGZWDDpcAUc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=cJhl1Ube; arc=fail smtp.client-ip=40.107.22.69 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="cJhl1Ube" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SnqsuF9EM8eSSYaok2z8vs+sYcIA3BjHcZRbHl6vZ0206t5CmlnK07WB+vzfN6/nfXxzU4eF0GrVzYaoffpr8/OAq6mt6zmWmytNbpVgAh9Mwikwac1HFCNKsVqvAcOjIVKnEBVzJ1/km0b/xvIpK2ZC9Nw/amPDr/4Sod8Xgmfc0psVI6QMn+6Aei43ud4NPZHdqWkcqUMRvswKl88wcYYh2pIOJ4WiYfSnMY7j18r1xlGzQNBu8+kCUxOtU4kXBwYBF6cKjtxDmQPw/z7HQJlhxTBuPaKNO8hXGldEvqP5zIaLkjaA0soREzKW1KIONtzDF6PvY5PIK1ha5t/yRw== 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=ef71eOmd1xG8RvGS0xJSuk4oSPBKqwIriymDxPvaRZs=; b=dF+9Urp7UjRvLMOERylsP+3SUB90LR8cafsY1KPNfCHVRLekSRzwmznuFNBmwljitxr+tCi8O8jkOQC3sgiq4gnupRmJc5Ecg0TFZTv4PZt9gll4l8CTeZPVkIZAXcSW1onEEIW2iXuwG2p50dgittbnAQUMkWNK7D91FBIjM2D8215omot8ka4PMq3ADbemYWHDrvFA38FNROZdImKhjBSvM82s8fwqosig14y8h1CIPcJD2xAa2uhrmm3Tg2jZHadZ019lTmzD/eeXsM11SjIGjf9IaQ9XtMmAKewxohnbm0zc4GBkstbsFOBp+4aNa9bpPaEC/ik6JRJh3Sj5sQ== 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=ef71eOmd1xG8RvGS0xJSuk4oSPBKqwIriymDxPvaRZs=; b=cJhl1UbeBVs2xaBaaTU9O3w6VXZkdvKrVToGyADrNMr/iEfW8v4FhI1lV8HMeztYQMrh1GXSmKWvcgQLOZJkT0l1LxRylVc6AqCPsvzVK91VmHZBkp/hCubVYY7WUvoP14LXVLC4JMeY/AuueSnPgRmtKDG1yyTY0AoACuzi8ak= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:44 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:44 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 12/16] PCI: imx6: Add iMX95 PCIe Root Complex support Date: Fri, 19 Jan 2024 12:11:18 -0500 Message-Id: <20240119171122.3057511-13-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 31df8c08-684b-4160-4c91-08dc1911da0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6lkD7y4kVeltio6KjLrMNoa5Z40GcXkwxqe1C6jwNrlWMEgLZV4drc5KMax4wvRe75bjPgtCuD050FRiwAUkgTeQXUFZnU9Klmtt4d4Z9IQtXjurHTkInM+CEgZVQ/3VZrnkQiZVsus1DUjNd4kziXmHVn36zcg/+RNP+LPQXKr9fPVOwZ6XqhIbaGTw7RUac2g2aGFahXoTrjle3EJrGR/KQFExu/0H0Dxid7V6zHOFiKsgoqFhIK4fCjtRoDSlLgPjzP9EFIL8gTcvgG2sFEuVtAiazJ3LY9ikSo3ImfRETcfpmfeanPQvsdWSmI7AmZQNSQYWC6maKk/j0rKFvLSZyrNxfnC+CWoRUo9WLrWvXaZ53elyhizcWHLftkbN/dVKKB43TdgyHvWgKTWFIAZF9mxL5pq/igVG9AlpRVIwHWMH64/iqXjmVN22al/RkwErLwMw7WyW1Fce6JmR8qdfVOCpanVEFtT6nT/mFnVcG3FJY+AGaylwOD2eiUOHqGGdoa1tnvGvMSJug8cOlFdBWTn0S9FxYwkLuEDfiuUMLImCM0YEFSMFEcJ5mjrpxWyB0R+Dom/M5t33MjZo4cHcSxF+tsixJ5IZ1nEtHMvYhctPx1ZGxC+Kwe0LwAoV X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eNFSTFmMWlCA8K3yrHx8ZZbYtpuaOh65mxgfd98+MHXCwnk+sUdR1roq0h1e5x9koIxQPuhcjb1EPsJ24XbegA3p8SIRvA9GqQ0g8QNd86qilGv+P6JVxly+8Ktq9pCAkVCetTeMQDThh85ISK6VCY607V3fHVISout7KZZTTFwHkho2Gk0KNYDyJ9jHnLl97YwURqH8OZGddviWVRMNylKiaRkw/Il2+MS3xEbR+vzh+7LpgRX3GThB/2a0pEnQHRl/nd+ekhbHiXC/crUGrBPsMRGn9lNHMLjMFOyzsnV1cITftXkoUYL2qGtMG2d+lYmrz0sMIDo5kF5Kg/0/rmkfJ86VzNNJ479Kywq+MT0lWUfcaych1D3EBgtZSDXd7WN/7d/itKnEVdvD27eroXUtQ/mUotcu6AWxpOCUMkM7oGqbiiMK/TwDXc9ynWri+dRq3+ppMKbrUwufTA2xWY6F3sMvlVhVobDvpm1w6q8qyTjBhaxplRFxv5BVI+zhXDsCuRbVmvC7+0hetsIH6JnBaurHTj3SNGjft2J+3xagPuMKBZelHKBIKYlaXrKxpCqdIOWyCIhlhTieT2ydabwDhsiEDXHpnQFMdBYk/t8ArUt+vHziK38DNjr7ssfXB8KZJ8I1ohLIi/CR4gH/+qbhHjv+RnrJ+RIK9UIjT0bQImgg3YXEoFHX26GDaBmPlortRiU3lIFS0PapWeTZwgu5snAm33iFLwOLmL96njs/Hejf6qH+yHa4GSMFY4c6OMSMGd3Jd7CN2aM30vEWoHDUfrpJHLFas17g5oQrsa88a+cd4ypO54AQkP3UHxK4cEIJjpnFGi0/bcB1xoIwRNAYFyV44G6S1RuMwnElmoPDEdducxnWuCZ3YWcW0Lm8T660oRg6ggFmJBpXmDcLnh1f9rDkBeAdPHARX6f8sBv1QApcIgZyfy77JGSzQ79ggc6Do4Noa/IbOj4R3pPo/FHTPlB0zVglWPwR4wl4CBgk7zR+QZAeeaW9AhZabA3eEfAoDQr9h+Fan6/0BprTI8+drwGwBwrZ27IcaNwmV7b9ImwGgJ+WlUdPESV/I//pCC5JYkRjKbgsyOS6+JnUHsKyQ4kyIooYbICmQfACTW9RV6vB6CA5jKcqQUs496VEKwbZmaDSySCv5epeRcLln4SaRCpWv1s6jTH3r/KA+c2eWJT1I/iJYwm9Peah1mj72zqAggnBztKWT9n6XDaniKYWS4lxY2heQ4/n+lhckICOoAMOloSJFHvfcRl4DU40XpyFGfmuUUJShCTKqPSPaIJX9ISCz//e5hBD2KnU1X6hjklejg4pRBAgjJpn29SZBSnJ7GScLQsVniDPttPZznJpI06/AKY2XL2jwZE1ledbqEXcT+5HW7yl5P5p0+4d8snMlcb4VOD1MeS6JsWSaj/ZjWo/LbWiN7LuuXEetwPh8I6RKi11ZLzWn7ynMHXEGsagzNmv6+gaav8wWpKSfVpx2Vn1RWDNy4h7nNNhnPQy0c9MiQa3O/zLNCyjI+LyZA8Tb1AgE+BdjoQ6LIhTo5hbSapH1Mgg4UV7eCyVE9k= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31df8c08-684b-4160-4c91-08dc1911da0b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:44.4794 (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: LATBRmNFEwXiX3Sbd5D2PyNfuJ9yuxzG0An5silopGiXg8Cqtsj6xqJrc5U7k2aE1ieijxDXQvJWyEenJP5Ntw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 Add iMX95 PCIe Root Complex support. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v8 to v9 - Add mani's review tag Change from v7 to v8 - Update commit subject - add const from regmap - remove unnessary logic in imx6_pcie_deassert_core_reset() Change from v4 to v7 - none Change from v1 to v3 - none drivers/pci/controller/dwc/pci-imx6.c | 82 +++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index dad192f38e702..1cfa5f14f18f3 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -42,6 +42,25 @@ #define IMX8MQ_GPR_PCIE_VREG_BYPASS BIT(12) #define IMX8MQ_GPR12_PCIE2_CTRL_DEVICE_TYPE GENMASK(11, 8) +#define IMX95_PCIE_PHY_GEN_CTRL 0x0 +#define IMX95_PCIE_REF_USE_PAD BIT(17) + +#define IMX95_PCIE_PHY_MPLLA_CTRL 0x10 +#define IMX95_PCIE_PHY_MPLL_STATE BIT(30) + +#define IMX95_PCIE_SS_RW_REG_0 0xf0 +#define IMX95_PCIE_REF_CLKEN BIT(23) +#define IMX95_PCIE_PHY_CR_PARA_SEL BIT(9) + +#define IMX95_PE0_GEN_CTRL_1 0x1050 +#define IMX95_PCIE_DEVICE_TYPE GENMASK(3, 0) + +#define IMX95_PE0_GEN_CTRL_3 0x1058 +#define IMX95_PCIE_LTSSM_EN BIT(0) + +#define IMX95_PE0_PM_STS 0x1064 +#define IMX95_PCIE_PM_LINKST_IN_L2 BIT(14) + #define to_imx6_pcie(x) dev_get_drvdata((x)->dev) enum imx6_pcie_variants { @@ -52,6 +71,7 @@ enum imx6_pcie_variants { IMX8MQ, IMX8MM, IMX8MP, + IMX95, IMX8MQ_EP, IMX8MM_EP, IMX8MP_EP, @@ -63,6 +83,7 @@ enum imx6_pcie_variants { #define IMX6_PCIE_FLAG_HAS_PHYDRV BIT(3) #define IMX6_PCIE_FLAG_HAS_APP_RESET BIT(4) #define IMX6_PCIE_FLAG_HAS_PHY_RESET BIT(5) +#define IMX6_PCIE_FLAG_HAS_SERDES BIT(6) #define imx6_check_flag(pci, val) (pci->drvdata->flags & val) @@ -179,6 +200,24 @@ static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie) return imx6_pcie->controller_id == 1 ? IOMUXC_GPR16 : IOMUXC_GPR14; } +static int imx95_pcie_init_phy(struct imx6_pcie *imx6_pcie) +{ + regmap_update_bits(imx6_pcie->iomuxc_gpr, + IMX95_PCIE_SS_RW_REG_0, + IMX95_PCIE_PHY_CR_PARA_SEL, + IMX95_PCIE_PHY_CR_PARA_SEL); + + regmap_update_bits(imx6_pcie->iomuxc_gpr, + IMX95_PCIE_PHY_GEN_CTRL, + IMX95_PCIE_REF_USE_PAD, 0); + regmap_update_bits(imx6_pcie->iomuxc_gpr, + IMX95_PCIE_SS_RW_REG_0, + IMX95_PCIE_REF_CLKEN, + IMX95_PCIE_REF_CLKEN); + + return 0; +} + static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) { const struct imx6_pcie_drvdata *drvdata = imx6_pcie->drvdata; @@ -575,6 +614,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); break; case IMX7D: + case IMX95: break; case IMX8MM: case IMX8MM_EP: @@ -1280,12 +1320,32 @@ static int imx6_pcie_probe(struct platform_device *pdev) return PTR_ERR(imx6_pcie->turnoff_reset); } + if (imx6_pcie->drvdata->gpr) { /* Grab GPR config register range */ - imx6_pcie->iomuxc_gpr = - syscon_regmap_lookup_by_compatible(imx6_pcie->drvdata->gpr); - if (IS_ERR(imx6_pcie->iomuxc_gpr)) { - dev_err(dev, "unable to find iomuxc registers\n"); - return PTR_ERR(imx6_pcie->iomuxc_gpr); + imx6_pcie->iomuxc_gpr = + syscon_regmap_lookup_by_compatible(imx6_pcie->drvdata->gpr); + if (IS_ERR(imx6_pcie->iomuxc_gpr)) + return dev_err_probe(dev, PTR_ERR(imx6_pcie->iomuxc_gpr), + "unable to find iomuxc registers\n"); + } + + if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_HAS_SERDES)) { + void __iomem *off = devm_platform_ioremap_resource_byname(pdev, "app"); + + if (IS_ERR(off)) + return dev_err_probe(dev, PTR_ERR(off), + "unable to find serdes registers\n"); + + static const struct regmap_config regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, + }; + + imx6_pcie->iomuxc_gpr = devm_regmap_init_mmio(dev, off, ®map_config); + if (IS_ERR(imx6_pcie->iomuxc_gpr)) + return dev_err_probe(dev, PTR_ERR(imx6_pcie->iomuxc_gpr), + "unable to find iomuxc registers\n"); } /* Grab PCIe PHY Tx Settings */ @@ -1458,6 +1518,17 @@ static const struct imx6_pcie_drvdata drvdata[] = { .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, }, + [IMX95] = { + .variant = IMX95, + .flags = IMX6_PCIE_FLAG_HAS_SERDES, + .clk_names = imx8mq_clks, + .clks_cnt = ARRAY_SIZE(imx8mq_clks), + .ltssm_off = IMX95_PE0_GEN_CTRL_3, + .ltssm_mask = IMX95_PCIE_LTSSM_EN, + .mode_off[0] = IMX95_PE0_GEN_CTRL_1, + .mode_mask[0] = IMX95_PCIE_DEVICE_TYPE, + .init_phy = imx95_pcie_init_phy, + }, [IMX8MQ_EP] = { .variant = IMX8MQ_EP, .flags = IMX6_PCIE_FLAG_HAS_APP_RESET | @@ -1502,6 +1573,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 Fri Jan 19 17:11:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764052 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) (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 39F5B5A0E7; Fri, 19 Jan 2024 17:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684378; cv=fail; b=gYUEat03yKw/zEDvMFSkLeuSp3z7i/2dP3zPt7H9NjMzJu4Cf9KNozEJQKkQ/hEf/1hPZpdQccCFcqlu263TuqEvMox7c9WUoy8QxzkAzGvso34SKlstIUwpwFzc3fAhIWqDCJ8CJcqkIyzILcDfFSwZ8CwlARP0xsSmjZQlxNY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684378; c=relaxed/simple; bh=WJ5hOwlLxUPz7ccFbQPSmigIZUPyDV2CuXDIcdOUnYo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=OhT7yVB/Xefxs/cnZpqaIWVO1b7tZyVphQBvuh9cRZLOwwTVOZnUKFreftSjOyalB1rfdH9WXfjPAhcP3vzcbnD1B0XB5UCjuHUbJ6woo9PnlVsS3KJo1yoKmBvh9YiF4kZL8DQfoov5wlMEpaFrYfzpKyvHd/OoGc4hnEbhZFw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=Xmb7Koed; arc=fail smtp.client-ip=40.107.22.69 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="Xmb7Koed" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jvj3VoymqojQz2LkV3WIUQo98+I1Yst0h1GvsMEq6RPTPcRYvaRI/aHDXpnYxH/w4e0/Z2Iljjl3LyGPORv1xzkr+dxfoEcYnfCkteMGunNEPOMA3fwQjLxEKB4oXI+2jOL+FGqmo1xArN6E63lHAXR3WxgLFOfOP7n5ZWAdhhOFxl1riysNRuwDW9oAM84M8cfpqZpjuPDVuVQ2E6P6c1RdAEs8F+f9Q8CrLAFOTVxyRKZlK61sqvvd0SJ9sRKLGFWwf7ovNxn5GF7ki4QY+uGzb2HtvCgL11ufa0gtG2Tv3uSyqEz9WSzxxWoFNmvwj2ZW6ZFYhU76nDNGsjfExQ== 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=UfflFd8vpq3ncG4cTELEUBRFQTZj//N1JoxgD6tVczk=; b=OhF/ajJgvqSE04iowbESpSJggRuQTjaNzbKrwSEF8ga/utKSsMgEh3dbrKu0GwQY6pCiTN05JqilYGhsZT/46Yl/1Hi9cjmrYMYzURzTB7Ye7Uuz5tCNEY4cNwBnqQ1KXnuB4mtVn1jt7E18OYBpab0bnRqHM3E7LSaompD34D9BSq/AWebRlr04ZolJnAkBXCXJJjtILScS/uBzmwlHPC1QSGFkEqJGo/LgDn9rY0JLufgyMzVLIOYusaW/20UmdxcWsxogWAwWl8V97o3HqwiQR6+MdfKoTz/82oRy4bff+wJLCyCrMlW0nxA3h0lRf9mpoQmWuvqzsVYClZB88g== 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=UfflFd8vpq3ncG4cTELEUBRFQTZj//N1JoxgD6tVczk=; b=Xmb7KoedurPLNDNvAFyKBW1hbWoXY5GVJ67EjsZY1vPvN7+ENKLr6CdW8LPXAoCAKwpfzcK1LbJsO2SVQwqe/XYCYmCg0U76g+6S96xBA7xUAElDkKEbJXSorLOwqw5n1GDPrCmH45TuCkj0dcMr7OZYYehWR1XFA8F4K0I4TA8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:49 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:49 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 13/16] PCI: imx6: Clean up get addr_space code Date: Fri, 19 Jan 2024 12:11:19 -0500 Message-Id: <20240119171122.3057511-14-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: f29ea169-680b-4a2a-3fcd-08dc1911dd06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ofu3pYIKhLbZTp0lIgLQlNJZCXD0I8/OgwoK7UJRfVd6jVmSKINhTfp7QWW/keOEBIBPydOqLyYHdT0aw1Gk7Wd5XnQb4cW44NZO5yU/FrDGzPY7U3xiije3+xM7GGfUiJzcH7e3G9TIcKcOQ+j9UI52487fktUF+MiecOnf5v4OMgc0gdaRfdi5RRwCWn5Iq1AyO/fcD6rh0+kX15yAWiiO2ehzcXWRIpS2UK9ulRVnqzuHM4vUlzTc6lFlssDvP71J8prEVqFNy/aH8pNDQKaqzMCB3Ucbw75zGZmQWl8hfuoVpE7W1Y7twexhKF9MAmy0wKrL7L1AxC2UygT3P7cbB4mO+8R09HT6FvNHw34XxOV3gDXN7r4nP/5xDn4Eklf/wAvMPhiCMUY87eTF7IqVhEIFnl67dDPZW91VoqCtLD8gwgIhnTQOyBmoZF8+V6gQV0R7xmC4oveN86d38hOLSjGjpmYX7Stb493IbNScZ64Llz+tzqlXkEyWPB1xf/cgMGoHUN31gXXVZXczruI1PnSnRvuoWOHhL2fzKglmem7eW0k5tQkd1SxcLPhVcRopOMVACTK3GkG4YpAHtzOvfpEBzybozMNUs6xq7t2gA4+TlSU6DcJdT7xt+A6A X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eHenKUmT2pgslIH4BlWv2dVS+fsKbeEzAfcyWTOxA1eA2eNxAghKH9HW8PViFJuNZvTrPvg1+/J119ZQZTJqHoz1/nQ8cfv7W3Oi1suf2+iMWC7GswmoSnASkZ68U8YpSKkf0iONyw5YPgKL8CYeIFsbIftvbtJsz9pVJxNqfPfcTTDODI5b6nUNU1u62BCP6/mM0C78M3PSMo0/k0jh1+TQ3zwR4hqhog/U/m4kqA183ksJEXyr42RewMt4oIkD9pLiHIoZSzqVuAZtiCCot7rvfNTNCz6nXcNWEVUpa9OmgmL2RThMj8+EvRFz+omAWsmj4h2vWKfV4Qfe6g/RUNdZ+pmcSqn5vXbohMDMp8WDNKXYtBu5iUv/xGTqTzMOGKmlMi2HNsdxKsMwJzv/GQsvfXOHbgItKIvpaONjE0XNU9zaCMX7YnhOI6lT8z9Gc+SVj/yBTnXA5kYJWIoSmJ1kr9quTB9L6dozXVye/V8ud4ZgIKKQM5DoF35/mi2e5Pt5ZAK6KtLgOH/GJWXGYA99u+pngwjVKsnQHaNQ3qqNK/sRAj/1hSo7esyE6z9Li78QP98eOOq0bt4peeGBdNCS3dXdpXd0rZVxbALYJTIFAA8/xeQ8FjGX7MkNKh9qJSHetk6NVSuAEkb1OylhDbvS1YOjsOAwE2yPoatMR8PIpqnsOd60BqAvTlM7pXxKBl/MILWcV3HdYOdGluFofR17DROqSRFI0m3fKtEyM3frYauh+RAMuYMrTaIA1grqgBkVu/ccvgzyOXz+Tj2PunJd9bWa8xf9KTL7cSn9PniV9kDnkVc6tvF1u6CxS5a+YVsy7AkWsbB/gkOwpgKfDeZjMSQ0mVs4dTXrBvxTVgIKZlQcRyXZ68DdqHOx7ltnyXPbUU2pslRoKMLqmbWhWTvscRiSSOvVa5GhvXl1SeNfF9NQkZXMY9tkl3VzSRW01/Z5Uz5miVZh4AYIJ7tvNOC2BoftdCp7kNTSdZUNOJsG3tDyFu7xFLtxh1z/AGur4bJbMueBeLKUe/eDUoiKlS1YEtmtHn09Fx3slvdeHR3Pg5OxPDRnn+kHRP5+ijOc5pji6Qht1KTV/SiLTEIO/jNCcZO4RM3KTZaKOz3j0ajuOd6SEtEN9ERUDGIw+zJXuv2hQkugs4lt9jIUx+5QRvQ85rQAjrw4ulGiM59fRxE2wVmkG9X9eyqVLlcftsZSVZSUNMN9q4kS8DWIxkWOAEQ4tuMHUpOLH1VGcjoZluK3MKaMRyLz6Tsd2nMgpewzLY6Rce24BnDuSVA86QnIgY06jTrToe/QR+VUziGGsBdJbDWs/AKWwAN6Xq7Ym7jlXSGeQnIiMQyiL9xah9sZ16uV8YU3T9TKcsH+er+/Wj0BtRmjoBUztBijrsQvXj1DgZm84IJu7y+8sfAOFV740H520U4otOMDo1S6jo0ZKx28iA0qxfko8rR9FLIAdb49la/i+2Y7SEF3pOn2csY38pOCMQ3jZyus/Yg+/vamqkpfUU+TfvVp3gm2ZYPnnq5nqL62sZfNpJh3cbJSdVmicWgYgo2KpoDJ0jTjLquenCo= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f29ea169-680b-4a2a-3fcd-08dc1911dd06 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:49.4238 (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: YHj+Sv53KtWDIgEzoKSN7ylHVlMDLSKnCyuumjelN9m02UhaMmPjrDeL1o+tEzywz6flSpb5ukKL2qxJcSJ2zA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 Since the dw_pcie_ep_init() function is already fetching the 'addr_space' region, no need to do the same in this driver. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - update commit message - Add Manivannan Sadhasivam's review tag Change from v4 to v7 - none Change from v1 to v3 - new patches drivers/pci/controller/dwc/pci-imx6.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 1cfa5f14f18f3..139ed618bfccc 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1067,7 +1067,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; @@ -1086,14 +1085,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 Fri Jan 19 17:11:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764874 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) (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 3234A5A0F3; Fri, 19 Jan 2024 17:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684380; cv=fail; b=lHZDlNHedQz47VmpBRcCMH4ZpRjmbX+2CWKmxBSpnm1QRJFNmgCnEgcG5kXTPAMt5O3ItcK2I/gupmaeho83W5RQc3BiLuoNLNbSPM3/qbAWPpGFmNZ1JSUprv1dLoAz/7K9BifaWgNQKaCeUSFXzmAVAIb/acinzWSTjTeYlv0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684380; c=relaxed/simple; bh=aX2kTfFTJOTjQdaIHXjavecSGExg6HdmtZPNEUTxQbM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=WdwpjOxf5tdIyTceR5/XuTMyqrgz2b/3T9zoio5x2yMFouWUP8MhD3c4v4LRykCToWnawiEkw0DNLwXTHpiGKp8e7zuFRv2OuX16KlMcEZT8SWTpoVMQwqksGQ0S0C7yZB6DzJsxvDdpLupZbonpDilhx2j2YTul6yuDByJ0nAE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=TMlt01eN; arc=fail smtp.client-ip=40.107.22.69 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="TMlt01eN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=io7KPmd5upo/kz9lnbAQjxqdfPlz2xjp9LPMmz0rRfe1cXv7KCxh9g+TXrEuUtpsyTCzZ6ZzsQUvata0wB5VWK3zADjHBQ8VWgJzMnek4kvi0UKzhmWiANG+lKSNbtcuYPtE1ALeXUsxxbsU5xEqEwp39ijxBuX9MPv25HuZDSkhdP24KG9TtMq78WP9oNOOYcgt5SN5eqU6ZJUP3GMleEAPgs+b67sqOSL3Pj91GTFcnW0bBy8Mv+PNto/ij7qrLaRcxbZqAjvFS8CyhlHHk+eSf0jdPQ1vafN0xDj/rUX34AB0J1GWNPCKiiF6L/Bkbc9KNAEi/afHh9QhRBAI/g== 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=mORbb/XK4m6oYgU5P0b5hJ5Fygw88yyPr9Eg3vUULhc=; b=GGSq8fdjLEEWSI2dp0irYnRv3pIfUH3SGPN3AyEY/gicbTLFCENh/BLQa1fMXUMJkSH7P3fShqo+XYdQ/BsiQlKdh9rQHNY2Mr8jImKvbWCiQc1GL81RZ4k/74UoQKSc3Qj4wwliJjlRfHM8nrNAc9J3qK0tHVZ6Lti2697unLbCzEJ3W8xM2qLXcDWiwZktxzxyhZUS6ebeonvw+Q1H2YNoW4xLf4arwsdgGaLV79e+65FqISa6YgQT+0AcO7ztetOhD+HtI8e3cdwq/Q8oL5+fmHhGR7kl3jyOuWAFHSsnXKtmdjO71EjpNb9o8GukjFEZDx6+dtrablmefwLFwQ== 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=mORbb/XK4m6oYgU5P0b5hJ5Fygw88yyPr9Eg3vUULhc=; b=TMlt01eNoQ1/BwWnhZumY5D8/5olICETlS1gDAVlxDTLTSuj7Fama9nw8W82GuflDQeoHmRw0Twc1QFi3S+0kpTKS0q3G68sKNsubm4z2ioa/t3vAx+2rIj18/Mb2ehNGf3v+Qe8sPClx7jIG6SGXjlzQusGrV9RseYBQDUEUfo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:54 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:54 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 14/16] PCI: imx6: Add epc_features in imx6_pcie_drvdata Date: Fri, 19 Jan 2024 12:11:20 -0500 Message-Id: <20240119171122.3057511-15-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: ea694171-f8e7-4a23-aa0e-08dc1911dff7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sYlVnyu5XdowAaHmVN9ji5aVleTdhhsKk7ajYvXJsxohWlMuLFM8iHOmnbx6M0xpr4zizcV8NqPRtYWEzgMrBa+ULTKPQoZj1DvR1z4OmoOAFJO8dmDDeWCgBb8b9i2Nk/2SjCo27qq2V1HJCRvkgUo+NluVohCzYs7vphSt6wDm9kaLOqgjfShUcyDAGpEaPkDFdzqSyWUa2VbuC+LxE5HGlddWIuCrYasomhN/Td3eheJuMgqqdEVPiFMHrfASY852nGS1Z94JU0WMqrLfq+YtSEazJ5QvZceq7HmPK4VSJxQf6v+wRiUzyzQAagQNdgaVzQcBvM8j1fT4JfJbjasVbCA4RhIULy7Eh0RbHF5REFISqQQYm7OqxdOTCgmhIH5dVfqcK3GxLHzBA+kCuiHhMM2u/TfJMrfvioRQrv7oStAcVJcFwb3gE+JMK8l4Pi0LkY5zOdJaRK6L7UkO+KafSqdIuxez1u5FFLc7edyJ5diM1WbzrXjELBI7uYkbRtJJ36l8+qXWavUy03b8qSGPLAuIddwy3vYnfTWTfYrekzx2Tll5rO5bFEmw+FzYMuErSwo5wOKLRUE6I2NmRNLo+97JAXLwIslW7BcvHDUWCJLkJz3Sui+4X9rQsU+u X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: u20wEspbUnU59aHyUVLqIo7SFojg7RlE2Yg/6o807aL1bKXriNoI/CAYMAi+B5XnC/rquZV5lAXbAaYqJ+Ko0oEGxiU9Rmy7xMNDmLwGhrnVZnGxg/5LbWBjDqPYI7ISkuuYFXVkqBeg1tc5KYIR2S4ejLDA3WIM8lYy4DJ+2hYbtzen+0q+TFeIyTHqjKIJ2zxYPWHVQd81xYT2rLbcggb1JpCmsysLVlQiyEVaYieRIgC3TALZLywLFXwyLIUQHz6ba/ADsFZlJKpV2tvsMg1BJqds5aRlN9Hb8+usy5L2RFeOKJEdzbacwQRK5o5IYHV+1KTeVZG5oZ6rjGXvR+1rzR3GBQeotXZfPPdizneZwGSgF6i4qdJyBVmD8j4j+tnb+FIwl+5hQsutVjA1+y53ToM5T5FTIdioM3Fj2DYCEvy0V764Q2sHd5Nyd3rZHv8WVm6dtYCXa8JykJg9+3msb1/ch51+GL4VELyxI1CKBySglz752tr0e/wjivWnQWjIRbUtnjd9C3Jz44L4yVs5QH6K42uqbFgvaqHBXv0t0jeABELmiad9NMUrziqAoTl6FGVvRHoFLXNpS+WLcbtGrH98Ef4ybqXCjSuxVkbT9LWG1FD9gPVvbSbgcaPvuOF2tmZSKGgFp0TlmYh3J+c8bCZuGpDhazzxEanUJ12HxJoyWxqqXAOrbwKzCGWD0qt0BMEFj4k3xeFEgFntn7D9WXCg2lLGF62O2x0isFPPwaWgqX6zYGRDNtMYdoi9CreOiaC4drVE9r3KM3U2m8/sWrVb1TKe2k98fFcOPkkdY0AfpyHu/e+Z7B+Wo14CUwMllQ0+8Et7q9CxyXYOoll4g24SIpWQBjIEdMe5vnzVhyOIKPkeQNxI050AJXrgV/3Er8BqVUQ944f1pqTMJ0HgOZ7kq691QfV79seWK0mmjuT7p+mv0+G7VZu48JfpCZUj7fW0vGbWQ2FQ8vr2rwd4+KGnsMiBXgEirMT1vrey7n9fyZHd61Ce27d7PIFGQKXhmnaKgwF02NSJP4sx0h0HBJVyo1Hc5tBNiS21XgN346DaixvnkZxXlHiahL6ZoVuGAPQihgIFYPQh9lzAhPTYpehUtY7HoJdAJkHftlm7w4yK9okN8QYbJUOWOdKsSY01DZdXhshlPtnoMi8Zw/cRitn5SLgyKhz5phQVW922yivt5HEhQH3h/oN1jvwhtSuaeZNMmm+ucDCq5gTkaOWXhqXZonDru8ZWKq7+PiCMDiiHlBF/wWeOOFYg8FfOjMNVNXZDddqkv2v1IC4J3037vdd3+eI0nvDt0i2BR1H+E5baoJkKvZrNrFfwvrjiHar03lW+sB9WEn/UACCD2QhOZS8l0JwuIXIOkpU5TAhVkfprp/1/1Vc70NkJdlrdtJni/ty8VJi6yHPUT03INDv5sj1W/eRFd+g9MCv9HNaiNEskC1VgN4BUXwSBD5tMYLWJrOHuwLlv/METFbITnhT0yrcQpsKkURfO3nU7FeAZspxs4D30r+8sCU8QvsM16eMgSWaS26b8TKCDeVMNWdA45OTIKNYivTiokfLFK0U= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea694171-f8e7-4a23-aa0e-08dc1911dff7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:54.3901 (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: a6BtqW11dPEzN+VoyFLGIKrnfTLP4ECBKlMtWeMuIJCs0J1d2YFD1cCllMNDpQDu3pz1Y6u1GCTmpLAN2P7bvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 The i.MX EP exhibits variations in epc_features among different EP configurations. This introduces the addition of epc_features in imx6_pcie_drvdata to accommodate these differences. It's important to note that there are no functional changes in this commit; instead, it lays the groundwork for supporting i.MX95 EP functions. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v7 to v8 - Added Manivannan Sadhasivam's review tag Change from v6 to v7 - none Change from v5 to v6 - add missed maxitems. - add comments about reuse linux,pci-domain as controller id. linux,pci-domain have not defined at PCI endpoint side. Change from v1 to v3 - new patch at v3 drivers/pci/controller/dwc/pci-imx6.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 139ed618bfccc..bbaa45c08323b 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -105,6 +105,7 @@ struct imx6_pcie_drvdata { const u32 ltssm_mask; const u32 mode_off[IMX6_PCIE_MAX_INSTANCES]; const u32 mode_mask[IMX6_PCIE_MAX_INSTANCES]; + const struct pci_epc_features *epc_features; int (*init_phy)(struct imx6_pcie *pcie); }; @@ -1052,7 +1053,10 @@ static const struct pci_epc_features imx8m_pcie_epc_features = { static const struct pci_epc_features* imx6_pcie_ep_get_features(struct dw_pcie_ep *ep) { - return &imx8m_pcie_epc_features; + struct dw_pcie *pci = to_dw_pcie_from_ep(ep); + struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + + return imx6_pcie->drvdata->epc_features; } static const struct dw_pcie_ep_ops pcie_ep_ops = { @@ -1534,6 +1538,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] = { @@ -1545,6 +1550,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx8mm_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .epc_features = &imx8m_pcie_epc_features, }, [IMX8MP_EP] = { .variant = IMX8MP_EP, @@ -1555,6 +1561,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { .clks_cnt = ARRAY_SIZE(imx8mm_clks), .mode_off[0] = IOMUXC_GPR12, .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, + .epc_features = &imx8m_pcie_epc_features, }, }; From patchwork Fri Jan 19 17:11:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764051 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) (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 147715A10A; Fri, 19 Jan 2024 17:13:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684382; cv=fail; b=hZsGFtp7PLcy6Z6qxwqSXwWQggWgbL7XjJZBMoc9GU4nzHHlxRlc1NZ9bsEWnd/7kASm7KyfI4nQP+idOA2/t5TMuw10OoBtxMdtzstmKqGrWRboFM7HqvWe1fQS98OSGPrScj1Eh+0Py+nqDvB0nrbQ+Zz7VEqAWWurUDpM10k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684382; c=relaxed/simple; bh=V4CkPmE5sJm/QKoZDeZ2XTghlJMzEDmmIDCJ574ZXAo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=NJrWryCHLG6GAsm7Gw6ZbPM95NeZnZ5LpJRUAcbpkv+3ucAJMyDgSkAFAWj6sm71KQsZf3nKRc0Ep10yiI5+I7UmB0Hf8qwFP2VHZzALlFpkXq0gWrNsMMmvjr/1dRIyuMTCvIKYRkz/dNSXc5grynATYt7cIR8G9KFTFGX35AM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=NS+WuN6i; arc=fail smtp.client-ip=40.107.22.69 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="NS+WuN6i" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZF3jV7f8Lt1xNjTmPIqeidGKZr+IOdAMNm7+uAuK87ymkCSoYzCNO2q17ETJH3rPUhTNOzk8pQCnFX42obCn85mhEFXZz5b2w6rL+5Lbl9o9QgZ2hkR0Xr7Im5oHP7Rje2GdQzMb8SoMpHD9C8XjQBT0QCamepPKhZoU8kqvbeDfSbwIknxsNb5wYf91iy98O3ZKCkd8bGuGZnQ6WyL0q3Qzx9UhR4IE4BOenHQQiqpkG9PUtiWzg5fpfaTVBzClQ85PEepAdWy/Xpghybar7Vz4YqTjJjr8UF88HjOaDh3yGhq3uozhkpCS/ZfRY7FiJAw+4aiMswEmrgAlRi0krQ== 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=0HX8b2YytgPKGFXPo6S0m3CGINW2GHZdmojsFID8CjI=; b=ZM+UuwSuFN+UUPQY7YtdsqyHVBgdkg4px5HdCKgnxgNqjBs43cY9JSpxiSoDTQ0uXlor8+s8VUZUvCn9XHFUzri8AXO+BGZS0Bny8E1SVZLSohxLG2Gbp5M72XtamuZKw34wsASeQ8F4R5RPdnkXc1S7rCIbwfb/Q/3tFmQgpao5wzy493GneZK27Lz14gXdVq5l1lmvAi/VSg4FaM3DGxR/d8IvT+em1czNaC01TGATGFemZLXLVH7CLQWRIUwcSz2bA5TklimgU1ECjO1TEIfag2r5hUyuowHlmGKQDofF3FanqXbbLKdghCfyOhPGXGZg/w+NvHQC2AQIidFGbg== 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=0HX8b2YytgPKGFXPo6S0m3CGINW2GHZdmojsFID8CjI=; b=NS+WuN6ir9GHfQxhYvP6tRx2652D0JT93JM4jyQKkv/yXEo12N2zTK08hbwZtyOEyPlT7iN1iuNaOJFxgOPjTFDSz0aTLLCxDujLI6yv0JlwpVNdJLt8IKvHpbRJ3WSDG6MIKFG68XrdVQrlf9rqQakUNGOoqp5CBEJL9fjFQIA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:12:59 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:12:59 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 15/16] dt-bindings: imx6q-pcie: Add iMX95 pcie endpoint compatible string Date: Fri, 19 Jan 2024 12:11:21 -0500 Message-Id: <20240119171122.3057511-16-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: ede17224-77ab-4219-794e-08dc1911e2eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FuK1+G4DMkmqjqvV5ZZWiGMFTAqKjv90mkVjRa+IOxya367GpcfuxqfbDaThVFb1DQ8n0geHFs/VCGDT0azpcDPMbbZIpwna11Epth9vR7bYY3Y+d6+eJnLzCrYRGHj0BtmE+fIDLHvX3faDCdE+jCKH+BFspJbAsIBZINaCRr2wWOrktv8SkYv51NYmsUT6Ks9B0q5A7ydkPxknc0qPlEzwVdBs1xBsUkWOlZGWdPdX3Oq2SYy1vwUZghtjSJPNuGWKNoQKIKaNAcNBP5ln6VQok2ERnLUx55h8UvP2+iwJ1Gv++7qIseqW5G/HSKEaEmT3HqzfFWtJiVl6VcSIsOhK0Dl4XvgqD5d/YSXpH1FSXGwwXr1qluraEZ892PQbZHZF5JovYBXsAy3kpBVgDJZhqEC1AhRSDZS+bP3s9enfExVLlvprLGwYQoRmmuIk8z1vDoVuN8gZ2kkwkJzkk9ydv+8Fxv05KbCya3f2sN9Dvp+dPe9nLnZuUHEFhs5lZXXHAkbaQus1IulUXsyNzcd2M3CYnboGvOf6Me2bhmFFFANi4uUKvNAwUctnl2qDG2pMagLK5kd+4JcxmWyOHn69GCKyP4PxEwHfdzTOS3ZWtrENTX4ZVMMvRrf12cv40SkakIqu//HqoECPIh/gMQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CGsbkh372Fur3nRijgfWjNjlWHYXkqrsaDzwnY2iIS6K1BdmdO7Kpr5ENC9W19yQJK9nqTxAIJEhUQYTvuwtZJRD75zxb+SMIQzcykgQWCWJN7stFMypc+hbO8Gr9KA0Ql4qWjqMVb5ACatz7/w2hD3xz3b156VBd5sMF1UcdBZwlKVis+IY1YemqI7cIIezD+7s4Y7c+VUjvgINHuhaREkoNtbaq+f9XfK1DxNZNslVAR4JDpX7V0VdapQmiCAxcQQBvLzYrw3xwxWpuVQ42500jSj7Gu633zzE7aieS2qoxc71N/0zi4aHR6fBimLnvnD+Ov+wpGpjHd0m7tpyAi44o4Efb5A1TIVv+jfTpC4U2Q9hOwe0WAsI+o/RFYQSEL+gyT0NZEhFiL34/whqim+MvAU1T7tH4LbWg+sUf+ptbVq8oJyB7bwZAgOiK4htDw92+BGVhnOsvyblXx/qElsURV+bVfOc+R8rwYbN0wM3jTDtn2Efno1jKNjK4wimukRRaqwnl0qpElh04sXVU9RRnZG/DPHhSplDqYzIktjic4IsoCkI0mTkpysCeKEu5Hoawn8jOp+v5Z7cc3TcVQAjN3GR8ZDePMRm/19LX7d5YFo/RDyD7Kfk840vEfhT90AGL4e5LFR2C3uBuA8Jd+gbrzkCTW35E7qf1P3mVtvhiareDMxHp1KRj7ksIChlcXYhzIN0h5C/48sXs2oLLYgwyGdWfd+h+cukW3Ue4SqQnTOG25yeJmTFKmE2g1cUp3A8REzDiqT7eTt56eQx4FWQkrOlFK+hQml7PHlVIpKZCWTtfhSqSKKDkizr3ik4mThrCp21BQJHfSBibybh6HT3L8NItKJpk+Zgfemr0prd5N8KDSEkAkyw/vZOYIO567tKTIB+Gh7gaWo9alkERAt/vtt1uO/vhJKyo2KilApxtsFRO506GQWI9MPBzddldMK65UenNQfDqZtilUYhelqYjqC+IvNCTYBFACwypfJNJ7Lx0MibuOsQ2UVJtS86pf+JUqcae5GD2Ca4pMpqkrdGh7iFKL8mLlNn4WTdYp7BLZ4ze9hU9JwToYHphnJgeT9gskX0BEOVSvQ4uKHiV2nFP0Gfh/RNczp9/FvDrsTC+1pNQ6IxlhwCHVqIj6h3eGiyp5Vv6fWflVyW/tXfia6gFh8f6tmWVVYvUEOB1z6opIy65MXSaAtCKdA5PjEpoKcQpwtm4cWkBx8Ti7LiTKzw1J8lTXnbRjkydJEwnx6udsN6PNcT6VtAPCvqAWlj3dlt0vr7CFB+54RWoLcbOd4iwPpmUSj0PwVdwVvR4FqQt75Sr+A+evS/avWApxD260PAaE1lDDMp6QwLSK4xVom12TaKJLKQuidcPPAZ1yZ98ADQVmRxmbTuWSrhYJYiqxE+t58NHRghkX42OJ+7Mb2xTbxP07FKw2OdKMyuYqfnR0B+bawJ1+ZJL+ArF3xDSciLP/xb6jRO2v7QYY7GpQdmpmsbWPzwM1szE1HTtrJ+/WY9JyGaoRbaXR6u/kFC+vlhczelgi9EoMGMX4x8qAQMwHPMfe5ZceKvzKOtWnQ= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ede17224-77ab-4219-794e-08dc1911e2eb X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:12:59.3925 (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: 6GOfU1gz7a6/r3G7uRw+n9wMFZDKwfVcvvbXBjqjZ/dgzDoyzlli6eXKohw9ACGbM3PGLL8b7YUC4M0fvDCwsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 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. Reviewed-by: Rob Herring Signed-off-by: Frank Li --- Notes: Change from v8 to v9 - add rob's review tag Change from v3 to v8 - none Change from v1 to v3 - new patches at v3 .../bindings/pci/fsl,imx6q-pcie-ep.yaml | 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 Fri Jan 19 17:11:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 764873 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2042.outbound.protection.outlook.com [40.107.22.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 475575B1FD; Fri, 19 Jan 2024 17:13:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684389; cv=fail; b=u9Pq3h8ydZ0oK+ht9p8uQqdzfzSgZz+l/AMjKdYZRUfu0aD5tKL/bHjdoTYNa8kr6GsSvCDeazpJYJ4wqFAFoFpWyeLGfVVbITVrIrJ7+hMDQziiumFvNG6W2D+7jqzXQvrDg3dfmTKZ7GwbSlsisr3AugDghRW5g56raUlw6/w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705684389; c=relaxed/simple; bh=+Q0IICt2ch3dBBw5kHVrr2Xz+fYGpsYBd5PjME2De+M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=MNIQzCvovTfubISlkNAZBudRc/XEhCMZIs/zAbUFPfW5MNfFP6sNiMgk5WZjlJCbxneOMLMT4xaU7PzR3mp00U0e7BijOurIlACL2owXXsLT6FddU8wiU92NbthvdEzz19uaejlfrILjzBX/XNHonana2/PA0daXxO1yzbQ+R+w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=d1AJ1HiC; arc=fail smtp.client-ip=40.107.22.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="d1AJ1HiC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kjigyip6ITVSPHtF4AkucJskwC5n1g7vrKxQku2M1i3MudemzL3nZM3hj02QlaUG5xctVsY5Ek4kAXHCXaIKVDCZYgRnCM091LtEgH1BNwc7jo/kCz/2NRkL+1s/lFoAgdNfiZGSLPP1oTfMFfXPstCuE3rAbTqwKfjC247ghI/xy848cxdYSm+BIfeBchr9rWykdCWDEBsXullQyfZVhm31pSAyxr+VsDRTVc4u5DeY4cjwSfCfpjBcsaAxVqkhnkX5Ly1pIKKGvEJi7gR1BxXzYOicaJ+oXfxGxApi8sw2jN59j088ybsWFL5fqu1lBheVk2eAtI9rfiBO91MEPw== 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=NDH7EfSahdgK3CnXM2YfNj0k4QQDERe30PCml4CE5Qg=; b=DO+LVgbusSG/fO/TnY+KDr+B8z+kbhqVL1RXUTtyBSppoCZGuZmrIzL60kkIuChWtOguU/Sm3BheznOz7LpWqgxWM7nT/c0WpiTV0QPXLjBXlePni6p2pUb/CZZl4lL0wFR8gQhFN0vHVbyh0Mz/v0O0F+wERcyCB+iHeu22hZhhZxs66IydykIRNm06h6R+TQaGNdTNki8P7XHdz1B4D4ePshQYuw9e9WpQdYYaZ95H1tfEJGUB490ox9I58FpDttVjyoLIOQhO79DYk+/wWbWLJcBJUECO32a0QBkPrqjmoqbB6+vYk3Twce6DXsH8JFEMvpA4W1nh/SYgQhgc4g== 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=NDH7EfSahdgK3CnXM2YfNj0k4QQDERe30PCml4CE5Qg=; b=d1AJ1HiCkYyhNC2LweaCjoMgFWrY+zAskHC0xD68/bfSE+Top7q9gDHwXiYNADohYXEIRRdee/9DtDwC8V4OC4tbkXcgY3zngczRPqsmlc1x9YTs/9CaCI+0OQM0ZHQpfS3ERNSUfJSgPKXdePBwB8JLZNE2XE0jO5/EyUXHfKA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 17:13:04 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::b8af:bfe5:dffd:59a9%4]) with mapi id 15.20.7202.020; Fri, 19 Jan 2024 17:13:04 +0000 From: Frank Li To: manivannan.sadhasivam@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, krzysztof.kozlowski@linaro.org, kw@linux.com, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, robh@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH v9 16/16] PCI: imx6: Add iMX95 Endpoint (EP) support Date: Fri, 19 Jan 2024 12:11:22 -0500 Message-Id: <20240119171122.3057511-17-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240119171122.3057511-1-Frank.Li@nxp.com> References: <20240119171122.3057511-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: aa727cac-0a72-483e-69fe-08dc1911e5e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bMLAXfGunQuVLQWJ0GVsnNEzk6Fwr+hmMJZ07b9FbP/r3NsUqfgrPohCLo6qiU1KoKlrGkhkBNBFFgAA88zSdhlLgtXkv8nGKjFVZFYZrR/fdferojpA9M5zqtArRBP2oxlYxnspkeQjnuLroj1fWl3SdWqE5opAC/ysU82yP3OAVqfIR2iotWgDFt6yGclH5rAt9Mud4OvBYOMaxctOmnB35OLSJ0CVQwNG4CWATLk2Cg3hPsq3r91OIBr9up4GzkbZyFq6dyVRe32Fa6iAUcxizuiEzj46H3FF8fXCqKz5b0ovzeid9CEicgm2DnmCbRGqF5UPmuXBL0DMZv6RNvQG0bzz7gTBkKJUQpPcPSY6zEB01orKVMLGl/RUIhzPNyplr/yQoeyHdNzCiRk7innVBzJsi3hd/kkHW6BLHObgRW1wIOIRdCij0jOzQRIZD0i87ef+uXf1zDaMvV+yEKWp8Mg/LhPD968IKKJYw30enWkBqGBFOdHwMPCxK554bKFmaCZnsrtYEhbQ5+s9Hh2ZFWVV2EHCL1JMVprOj/YeWlRmVJKbKbw70wtmINOFsmYIQX3/hNenX5XspLjfd+hDjmsYr7rEFZQJRhfpaV77R/w/o1uh76JsXQC0PmAS X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(6666004)(41300700001)(6486002)(478600001)(6506007)(52116002)(26005)(83380400001)(2616005)(6512007)(66899024)(86362001)(6916009)(316002)(2906002)(7416002)(36756003)(8936002)(4326008)(8676002)(66946007)(38350700005)(66556008)(66476007)(5660300002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Yymx+sZ6VJQU4KT6BHFE3fjklr0kHnfcgOpicW0FPs/iLQAqaHPBnyq6K7QQzNRA3HMVv67pTX5sLeFkq3eyPMtYKt48cLqb17HidHHp6AWZhmV1J5eYMulHCHFpIT5pvRvbNRD0R3N975KPxlC8fjOWjC+2BiylrNhVNUjpwbege4yot7YCC2JnO3Cu1uocSwZhfHkGkJxXzL8IcSxr62jwONHDP2s7XzWGF+PfcUSmtqqRXQO1ziDqX85QalVqe2XHF8FdBZwY7RCcrOzZKukISpxbvZf7uGtMLM4DxNtSHXlnHYyBaymUAtZ+N85Dv7+AKJkI+13Y9ANAukXqQjR65oKM8AGynAzLP/JluLY8LcTSWneQ6YQ2W4D6AA2w2zENV76I7SzNuNyyQNChpvyol/kzyhaOpnKht/GBiW0OUHumEW0FKuneOKbxWLblNDnsJE4TVI2h4Qrmcs5dO3kl59D9S7pSucCMnBZ0LENjtChkNCSyf93xxYc4/XTXEJWBHxNlSVmovDmr4Brh/z8vBy+kxpcUJ0cZ0h9QJTDuMIXA4Cv9RnDR0b6nTFC+QpjkkRyqAqesrgwKBEAGzGByVtLGJxF2yC0mBsxKWJOCkrou/Y816+yzYRfQLWS+OEuLh0tJYUXAlf2Aty5b0MKLQJMUU6DzTJ5T43GMhqUyIaYhYMin2SnnA+az31JtZC3KSoyWw937PEUmGFPSjHgzb3bnnf7lkLmEJmbhnsiemR4DQDmfGVm2uzAQzdtjc5A7050qCXbvEnGp8J81ROpgdwEzl8pr70MXgptx63diZ/wB7zfB5LQOJHZXUVgllyGBnXaGZniF9J93OTN5ldlJ6icfJyfFIB4RswvjL8QCms31tWq1A3vZAcFkvxbtVfcuuf6Er83lZExL23PxaK/aGSYAJTQjaox9d4RiJ4QDXSnkqrg7+A1K75DEzAhj27WlS+X6a+J+QaS4Kdv1ec7Ex2SKDAIDd7iSbuO7yFGnrES7OuTHCjUDGoqErFx+1fyo/NAm+uCXzdk5xBTud+GWhS12aXTzw5udb9LIw3zxg+pEauA6HSTkfcimXCFTb13gC5UBQzZbti3O2Sa66AF/5KznLDGmeXxYuSeMQBN4gKpYM3B0JT3yL0htsvHgJCF2EEXAjv40fmCeHUomi4Jn48Zb9KMnfn4UFjkxjYzWkG46hG/FKl0Pl0N8GuHqfNG2LByz9+atdxQGbwNe+/j26MjkpU2dMJHcyD7PdbXtDxMrYESlXHY0mG5psaKmNPgVdn2EvSNYxpSXh01S8xNcek0VlwNdIXW+SfOhiabkZdONg7qIRc5EanRYQ4ymyW+sB+hi0ZlrUjZ+9PUzemvajrqoJ05vbBd5oqRaRVY2Ql/FfsEwKv9lTRF0VixLYRi0vf7SjknQeb7EOMkQe5jU+EpImYuk90zxr1QbOHnP2YvE/0jNSxv9PRoMtUZ3YnCFVnha5YmnOvujSuM1Jjk8pDcK6+OB8Lkd9X0lvF+oRp5yXFHo6Jg1mFbF5Dg8sLiY0sy3a55SemH7WXLb//YYVpA9JyQ7Oa3w+zc4EUQ= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa727cac-0a72-483e-69fe-08dc1911e5e6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 17:13:04.3480 (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: ANFjF++TxNxBvSYoVvfUQbtSTUEXW51ifedSFunoqfU6ksG6K86VjLVU0U41PA6DJ9BAk4zllnDfgNRhAzwYpA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9688 Add iMX95 EP support and add 64bit address support. Internal bus bridge for PCI support 64bit dma address in iMX95. Hence, call dma_set_mask_and_coherent() to set 64 bit DMA mask. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- Notes: Change from v8 to v9 - update fixme comments - update BAR1 comments - Add mani's review tag Change from v7 to v8 - Update commit message - Using Fixme - Update clks_cnts by ARRAY_SIZE Change from v4 to v7 - none Change from v3 to v4 - change align to 4k for imx95 Change from v1 to v3 - new patches at v3 drivers/pci/controller/dwc/pci-imx6.c | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index bbaa45c08323b..7889318f6555a 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -75,6 +75,7 @@ enum imx6_pcie_variants { IMX8MQ_EP, IMX8MM_EP, IMX8MP_EP, + IMX95_EP, }; #define IMX6_PCIE_FLAG_IMX6_PHY BIT(0) @@ -84,6 +85,7 @@ enum imx6_pcie_variants { #define IMX6_PCIE_FLAG_HAS_APP_RESET BIT(4) #define IMX6_PCIE_FLAG_HAS_PHY_RESET BIT(5) #define IMX6_PCIE_FLAG_HAS_SERDES BIT(6) +#define IMX6_PCIE_FLAG_SUPPORT_64BIT BIT(7) #define imx6_check_flag(pci, val) (pci->drvdata->flags & val) @@ -616,6 +618,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) break; case IMX7D: case IMX95: + case IMX95_EP: break; case IMX8MM: case IMX8MM_EP: @@ -1050,6 +1053,23 @@ static const struct pci_epc_features imx8m_pcie_epc_features = { .align = SZ_64K, }; +/* + * BAR# | Default BAR enable | Default BAR Type | Default BAR Size | BAR Sizing Scheme + * ================================================================================================ + * BAR0 | Enable | 64-bit | 1 MB | Programmable Size + * BAR1 | Disable | 32-bit | 64 KB | Fixed Size + * BAR1 should be disabled if BAR0 is 64bit. + * BAR2 | Enable | 32-bit | 1 MB | Programmable Size + * BAR3 | Enable | 32-bit | 64 KB | Programmable Size + * BAR4 | Enable | 32-bit | 1M | Programmable Size + * BAR5 | Enable | 32-bit | 64 KB | Programmable Size + */ +static const struct pci_epc_features imx95_pcie_epc_features = { + .msi_capable = true, + .bar_fixed_size[1] = SZ_64K, + .align = SZ_4K, +}; + static const struct pci_epc_features* imx6_pcie_ep_get_features(struct dw_pcie_ep *ep) { @@ -1092,6 +1112,15 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, pci->dbi_base2 = pci->dbi_base + pcie_dbi2_offset; + /* + * FIXME: Ideally, dbi2 base address should come from DT. But since only IMX95 is defining + * "dbi2" in DT, "dbi_base2" is set to NULL here for that platform alone so that the DWC + * core code can fetch that from DT. But once all platform DTs were fixed, this and the + * above "dbi_base2" setting should be removed. + */ + if (imx6_pcie->drvdata->variant == IMX95_EP) + pci->dbi_base2 = NULL; + ret = dw_pcie_ep_init(ep); if (ret) { dev_err(dev, "failed to initialize endpoint\n"); @@ -1345,6 +1374,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)) @@ -1563,6 +1595,20 @@ static const struct imx6_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .epc_features = &imx8m_pcie_epc_features, }, + [IMX95_EP] = { + .variant = IMX95_EP, + .flags = IMX6_PCIE_FLAG_HAS_SERDES | + IMX6_PCIE_FLAG_SUPPORT_64BIT, + .clk_names = imx8mq_clks, + .clks_cnt = ARRAY_SIZE(imx8mq_clks), + .ltssm_off = IMX95_PE0_GEN_CTRL_3, + .ltssm_mask = IMX95_PCIE_LTSSM_EN, + .mode_off[0] = IMX95_PE0_GEN_CTRL_1, + .mode_mask[0] = IMX95_PCIE_DEVICE_TYPE, + .init_phy = imx95_pcie_init_phy, + .epc_features = &imx95_pcie_epc_features, + .mode = DW_PCIE_EP_TYPE, + }, }; static const struct of_device_id imx6_pcie_of_match[] = { @@ -1577,6 +1623,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], }, {}, };