From patchwork Tue Feb 27 21:47: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: 13574457 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2088.outbound.protection.outlook.com [40.107.21.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 7AD07154BF5; Tue, 27 Feb 2024 21:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070481; cv=fail; b=mKtNa7dVYxzv1NTFdV3GvNX2ACoGQACCuhHDpgLNrbLIZi8UGWtMGRMjlJwRGqghh32Y5OLnSBB+jhNfOzybD8T/5rM4/DQdf56693S0T48CAN3hRJpSzLszToi72TBA7iuPDMzxg4zINGfI3dRwFAdXhTkzJVHamONVLXxrB7M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709070481; c=relaxed/simple; bh=G9EHK/0mVHaUz9zEpQNHxMoHdNZEcg1Av5M6Mp8X4CE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=o7A2g4MgRL1Zbf2B/Qq0svjiqh21VKiPM0IfdtBlxm7QTRI2n/v113oPcdu9yBTT67NqOuQFeFho+TNfjEeFAIFmpTTgyUSDwa/VhKOz4yZWLvMiHOvCIDHstBlHMbqFerzP1ftCaGiJ92FO2Z5KjBrmwAIHLryJbGjuP4m2Xlo= 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=gCw03z1j; arc=fail smtp.client-ip=40.107.21.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="gCw03z1j" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R9ZmV9JNz6zsI40rC6f0hbEoKHqdSUFzK8PydFXWZFhsb51OLO/uDD1d0OUCr6tOgFfsq/89vcB7yVfsa7HbpREprhyKowBZLDKKPo4vZBvMqGBRDXhj2n51qbsmKW/Y0VPzGE4dCMIdL2cIMG4XjaX0Muy73ov1ytBAwOWxskbsW+g+CnZGcsAHrmn/knGhJJzWdCmZOS88l9icbo6sHeSq1TOneZeQfZsJcJNVJe6VELizgLeR0f9k/AJ0nGGTj/S3fv0ZmPnxIjieMc7rc/2bQOaQUXa0WNYi7dCidjkT9EESwSufCsQQXRcXz39p/x5DgafJkc5V499kswij1Q== 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=zdrOYJZj22EFcaBPN4ILSseZjQCAK4Lfh/z6ZIVrliY=; b=lq0L+AWgiMngMUSNQ4HykBnGNC1XEOiZH6D2id2YMxvwNoNbJEJIacSLN/2qqPwyyqSIVDp1rvGaFsQMwGvx/23xE7/48T58w7LwklIOBrVKz/9F6/tX9wQYKR1gZvS/VbebnUZA/X4v6j+4Ba40F2BdAqSrZB/k6mNjTlKvEtRAyoCwX+9anu5zCHezdkrX/KgKE4sQ8ZnDG3rt3l18WMsRWvgcOfPPOxzfdvaE3PNkr26yK5idMmHlSsUaBKfwrK0iFprtqeBFaYPmMGe/KguwGywVu73SWcCzpRbNq8lgDe5z3VGavLnahgnH/CpxY9qnqA4txrfaxqmbilCn4A== 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=zdrOYJZj22EFcaBPN4ILSseZjQCAK4Lfh/z6ZIVrliY=; b=gCw03z1j055XG39Fyz5nxfVoMMH2nfn/HCrn4z5bMm2iW2g56PPlwH8aKCcNG5pRPA3JA+6q64MvoJZOid5zd0PUIPWVOHCkHmUPTRGTYyNW8rMw34V7yej7suSTsK+N1dDxnRwE6Q562QIutKV9IuZBefjsBaay97pXZ1DTWrM= 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 VI1PR04MB7056.eurprd04.prod.outlook.com (2603:10a6:800:12c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Tue, 27 Feb 2024 21:47:56 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa%7]) with mapi id 15.20.7316.035; Tue, 27 Feb 2024 21:47:56 +0000 From: Frank Li Date: Tue, 27 Feb 2024 16:47:12 -0500 Subject: [PATCH 5/6] PCI: imx: Simplify switch-case logic by involve core_reset callback Message-Id: <20240227-pci2_upstream-v1-5-b952f8333606@nxp.com> References: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> In-Reply-To: <20240227-pci2_upstream-v1-0-b952f8333606@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1709070448; l=7121; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=G9EHK/0mVHaUz9zEpQNHxMoHdNZEcg1Av5M6Mp8X4CE=; b=K+bYLRnhH0hLmty0PqWm//qiHkHDSiODBa1PtVdMj+cGFjNezoYzFmDhnDb7e3sHhOl/B/mkj kS7rUDR6uFeCcmL9ZDUXQakhwoh8Hh0a5MRaCJ6jHZbyMEGSrwaxWH1 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR11CA0050.namprd11.prod.outlook.com (2603:10b6:a03:80::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: a63c23e6-4fe2-4d5d-4237-08dc37ddc215 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e0FRoCCgKe1LhdiEoOz0xHuFVLBuVc+0GoRp1N4M7XTP44QjughPCPWo0ymx0hvQAl9tmUfV/+xZF6ozjX1WgTfN3tc2rejxO5tauxpVlpwGR42t+L58hBX/GuCTc1QLpx/DnlMYgdLY9PlE6YLHfH8sG1uab1fFmai0OivYJ6bHe4b9khwTIsBvHJrUQ193z1qo4eWwjA9e3JSrPOUjZYlQ534MffTm2Cmrhq0LOD7v5pXBoWwtMRSEAqVly/Tom2bkSFhqx+rGMMm/RG3E5G76Xrd7rE9enFcqsHTX3jaBPq5Lwg+iO9A1tJ7GDwBPEb7dRhQBdDIcthH+Omyefn30nZAorWC2vbWxbflS+MKZ2eJqIdnudNfMydZW1rIbBmUX9cDJtB2gp90L/iSaTqgsP43GvOMXOZRdFSgxqBx6XF+YudOFGZ033mnaTzVk07gSFTrn3kaLiEBadLB0cfADaMETyHM4e+EEiyYCTCiz/f5+i2iIwB/5qixHHqwhyT1HxSw2ZbiBiGJqmEI/aaRWEiPOKvm8nm/LEuMqPrdUW9cqch03JY9AYJlpyUMBqkwo+PxFK7tAf5vzJBPW+ECCLM0wjtHn5XrUgNbt1fHIJP0EisffPWdPWPq+MCJVzVS6/INIAvNzVpZYZefLQxiDQ5yjRsshFecVKzWR9J25w780bqqIjGqRH8/Md/35Ux1y19Ml3XWoQpd3d0yKyx7b7GD1d4z6S1YuCGXL9CQ= 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)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?yjyEJeU/2neelYYgG1fBtN4bXE8K?= =?utf-8?q?f4pbyjfW/+iC1+ju+qcV8Y20DyRkEUAU3aRyT58agQJt0gNXHRwWC6c1/bQ8T88aM?= =?utf-8?q?qi8zUOL0uE93VdWv9CypWQ4ZTImP2U6uL4UulfB+egDjlBbpEuzdWmauPr/bgPd1q?= =?utf-8?q?s8UoPoU/Ti6JTOdJPce1KkD+OOOlHfUsZs7dx7sRN3x5M08BkOli8B1oN+hUA+9rJ?= =?utf-8?q?Mqjt9bh097hZ538ylwC2gYXXlZxB848IMC+vbgpYFUkTuna0llnZ3j89zQRO8KSjk?= =?utf-8?q?nY0+Ys1y7lSBZUFazW7AtN/GAPgYjesQ8gslQplYWwmqPh6L99pcGQRlPVs1WalbS?= =?utf-8?q?te2pKsuL1k3+1lk+lAqP6NPp7t6DmtfJMFFhBI+k3Jp5AMV8N+b/E6OmgskDqYNB4?= =?utf-8?q?KbBHyZU8YsQ5S7uopQOUvMo73WQZKMGufSlZ0jtVMhK1N6a9ntAbNUa2KX/xeT10t?= =?utf-8?q?Ch7vzP8SvSrjwoXiVFGgaK89dNplYKAvM53r4qJ26Rfj5PolqahiU5bedlwsJTj6A?= =?utf-8?q?l4FMRo7SzYwtgg3ioSRTI1mrN+oI7DoKQSAeSzlZiy/CM7M6Vh7lHR+C3DUO1Or2F?= =?utf-8?q?GjD3Z7UqaehajSMZMXm+EYXQp6SntJwnmGXE+AVDCXWneTdC0ZGlHNB5jn2Qw0GD1?= =?utf-8?q?HyRT/d8bHz2qHf6eqbnf7mAhuJtPPIQiKQ8bRZAnXGDqXozOShUM5M/ndBQsGvl1t?= =?utf-8?q?NHsGlyA6O2lxPCRPGf14XpkfSTq+76S5qfw3GBJCtph9JSwFxoKwfDTsxaXvaaUJL?= =?utf-8?q?BketI0Ucf3m86Fyw6vZQ/0cWcF0yUgW32uUeL78aI2lmJyNE8PcMTKD1HuuQwpopB?= =?utf-8?q?vx90zUkLp5MbGTO5WEjpK2ChG3J6aHs4PWdUYgDqmpq+LQwvA/GrvzrmKWh+36QLj?= =?utf-8?q?da3uDUhfCAsHrPfqfzEtJrEu+44/sQb3E78oFEfhcXAmuZRntQvRmCXlbJOw965S1?= =?utf-8?q?8sG94yP3vtOL8w+P0cc3sl0USLAzqdOmm/Xx6OHp6Zg+MrgcJEa5iXyhL24PCxrNK?= =?utf-8?q?7V4wCZHljTYKN1Kgr0ybOnXuPSUrrhhQ8jZtquHIDbstC59XQwK3iVHPo7tPY2duG?= =?utf-8?q?BbQwAIHdCIOyPAjZDdY2tIIAJ2b7Ptx9vUYZc4HnU5KwA5KrRyp5K3EUA+kdbCNn8?= =?utf-8?q?XV5vXUR/veenwhAsjgkDHXqnBmOsir8FkGl79f60js5mzC/ZMuccIAYM7+5DIJrCS?= =?utf-8?q?Bzb7+A8iTdEItmLvGpcODMHhYzktmWHgZaOLVRmH03v39qVgCVBgciD+5udgaPWjw?= =?utf-8?q?RpX6eb2KvewbbN5lanjnDJHpUbEk3PcTJpvw3upWn/1TWMzvmbpKFr4HawBtK4QUY?= =?utf-8?q?J+WeGMUOAtF9WQR5bEpHmCQiQ/yO4hDMZ3FvEOqMOHCWR+CzijA94+JI//1qW8aCm?= =?utf-8?q?oGZdYCrlg3yGZax/LLBaFF2KYkWgzHQ3/1ulZIe3P8Ly9T5P2/unjciXgRj+WckuC?= =?utf-8?q?gfttr3EaVm4NRDkdRPzj7O7rXndtFy0ORwU1r4FslqOQiBQR1Rv+iuH+HzCAcLSaB?= =?utf-8?q?6+CjRdnS9Ffs?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a63c23e6-4fe2-4d5d-4237-08dc37ddc215 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 21:47:56.4482 (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: raxxcEE1xBBdwBPf/0HjDCRJHeRrm6f9M+hjpL1G0u/EXoidgkRDrzZkU13h5nYP6EdVMnUoRzzW7TM59wnS4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7056 Instead of using the switch case statement to assert/dassert the core reset handled by this driver itself, let's introduce a new callback core_reset() and define it for platforms that require it. This simplifies the code. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx.c | 131 ++++++++++++++++++----------------- 1 file changed, 68 insertions(+), 63 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx.c b/drivers/pci/controller/dwc/pci-imx.c index a63ce171ede8f..460d40115935b 100644 --- a/drivers/pci/controller/dwc/pci-imx.c +++ b/drivers/pci/controller/dwc/pci-imx.c @@ -104,6 +104,7 @@ struct imx_pcie_drvdata { const struct pci_epc_features *epc_features; int (*init_phy)(struct imx_pcie *pcie); int (*set_ref_clk)(struct imx_pcie *pcie, bool enable); + int (*core_reset)(struct imx_pcie *pcie, bool assert); }; struct imx_pcie { @@ -671,35 +672,72 @@ static void imx_pcie_clk_disable(struct imx_pcie *imx_pcie) clk_bulk_disable_unprepare(imx_pcie->drvdata->clks_cnt, imx_pcie->clks); } +static int imx6sx_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, IMX6SX_GPR12_PCIE_TEST_POWERDOWN, + assert ? IMX6SX_GPR12_PCIE_TEST_POWERDOWN : 0); + /* Force PCIe PHY reset */ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, IMX6SX_GPR5_PCIE_BTNRST_RESET, + assert ? IMX6SX_GPR5_PCIE_BTNRST_RESET : 0); + return 0; +} + +static int imx6qp_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_SW_RST, + assert ? IMX6Q_GPR1_PCIE_SW_RST : 0); + if (!assert) + usleep_range(200, 500); + + return 0; +} + +static int imx6q_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD, + assert ? IMX6Q_GPR1_PCIE_TEST_PD : 0); + + regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, + assert ? 0 : IMX6Q_GPR1_PCIE_REF_CLK_EN); + + return 0; +} + +static int imx7d_pcie_core_reset(struct imx_pcie *imx_pcie, bool assert) +{ + struct dw_pcie *pci = imx_pcie->pci; + struct device *dev = pci->dev; + + if (assert) + return 0; + + /* + * 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. + */ + + if (likely(imx_pcie->phy_base)) { + /* De-assert DCC_FB_EN */ + writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, imx_pcie->phy_base + PCIE_PHY_CMN_REG4); + /* Assert RX_EQS and RX_EQS_SEL */ + writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL | PCIE_PHY_CMN_REG24_RX_EQ, + imx_pcie->phy_base + PCIE_PHY_CMN_REG24); + /* Assert ATT_MODE */ + writel(PCIE_PHY_CMN_REG26_ATT_MODE, imx_pcie->phy_base + PCIE_PHY_CMN_REG26); + } else { + dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); + } + imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); + return 0; +} + static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) { reset_control_assert(imx_pcie->pciephy_reset); reset_control_assert(imx_pcie->apps_reset); - switch (imx_pcie->drvdata->variant) { - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN, - IMX6SX_GPR12_PCIE_TEST_POWERDOWN); - /* Force PCIe PHY reset */ - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, - IMX6SX_GPR5_PCIE_BTNRST_RESET, - IMX6SX_GPR5_PCIE_BTNRST_RESET); - break; - case IMX6QP: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_SW_RST, - IMX6Q_GPR1_PCIE_SW_RST); - break; - case IMX6Q: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_REF_CLK_EN, 0 << 16); - break; - default: - break; - } + if (imx_pcie->drvdata->core_reset) + imx_pcie->drvdata->core_reset(imx_pcie, true); /* Some boards don't have PCIe reset GPIO. */ if (gpio_is_valid(imx_pcie->reset_gpio)) @@ -709,47 +747,10 @@ static void imx_pcie_assert_core_reset(struct imx_pcie *imx_pcie) static int imx_pcie_deassert_core_reset(struct imx_pcie *imx_pcie) { - struct dw_pcie *pci = imx_pcie->pci; - struct device *dev = pci->dev; - reset_control_deassert(imx_pcie->pciephy_reset); - switch (imx_pcie->drvdata->variant) { - case IMX7D: - /* 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. - */ - if (likely(imx_pcie->phy_base)) { - /* De-assert DCC_FB_EN */ - writel(PCIE_PHY_CMN_REG4_DCC_FB_EN, - imx_pcie->phy_base + PCIE_PHY_CMN_REG4); - /* Assert RX_EQS and RX_EQS_SEL */ - writel(PCIE_PHY_CMN_REG24_RX_EQ_SEL - | PCIE_PHY_CMN_REG24_RX_EQ, - imx_pcie->phy_base + PCIE_PHY_CMN_REG24); - /* Assert ATT_MODE */ - writel(PCIE_PHY_CMN_REG26_ATT_MODE, - imx_pcie->phy_base + PCIE_PHY_CMN_REG26); - } else { - dev_warn(dev, "Unable to apply ERR010728 workaround. DT missing fsl,imx7d-pcie-phy phandle ?\n"); - } - - imx7d_pcie_wait_for_phy_pll_lock(imx_pcie); - break; - case IMX6SX: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR5, - IMX6SX_GPR5_PCIE_BTNRST_RESET, 0); - break; - case IMX6QP: - regmap_update_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, - IMX6Q_GPR1_PCIE_SW_RST, 0); - - usleep_range(200, 500); - break; - default: - break; - } + if (imx_pcie->drvdata->core_reset) + imx_pcie->drvdata->core_reset(imx_pcie, false); /* Some boards don't have PCIe reset GPIO. */ if (gpio_is_valid(imx_pcie->reset_gpio)) { @@ -1444,6 +1445,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, .set_ref_clk = imx6q_pcie_set_ref_clk, + .core_reset = imx6q_pcie_core_reset, }, [IMX6SX] = { .variant = IMX6SX, @@ -1459,6 +1461,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx6sx_pcie_init_phy, .set_ref_clk = imx6sx_pcie_set_ref_clk, + .core_reset = imx6sx_pcie_core_reset, }, [IMX6QP] = { .variant = IMX6QP, @@ -1475,6 +1478,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx_pcie_init_phy, .set_ref_clk = imx6q_pcie_set_ref_clk, + .core_reset = imx6qp_pcie_core_reset, }, [IMX7D] = { .variant = IMX7D, @@ -1488,6 +1492,7 @@ static const struct imx_pcie_drvdata drvdata[] = { .mode_mask[0] = IMX6Q_GPR12_DEVICE_TYPE, .init_phy = imx7d_pcie_init_phy, .set_ref_clk = imx7d_pcie_set_ref_clk, + .core_reset = imx7d_pcie_core_reset, }, [IMX8MQ] = { .variant = IMX8MQ,