Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp57961lqo; Tue, 7 May 2024 12:03:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWhZLJaIbV5L8S9G7ETDYkUb6h0ryilaLgrxXlYGE7IhFaVixuHkUwDDdnVkvELM0Vu3HYqVFDob4oICSM7GhyPWdf+yjM5p9+8fQJukw== X-Google-Smtp-Source: AGHT+IGLQgt7MJU+ybZPV2z8kx+j58zvlsQBpEv2/W/hU+nm9cG0eVzi9l+h9jqD7Ifv/Dz9GkB4 X-Received: by 2002:a17:90a:a78f:b0:2af:c4dd:f61e with SMTP id 98e67ed59e1d1-2b616c04676mr455413a91.46.1715108588468; Tue, 07 May 2024 12:03:08 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w9-20020a17090a8a0900b002af32a75492si10837284pjn.32.2024.05.07.12.03.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 12:03:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="UCaex8/p"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-172003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172003-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B7722B258C5 for ; Tue, 7 May 2024 18:48:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C04EF16F0DE; Tue, 7 May 2024 18:46:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="UCaex8/p" Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2051.outbound.protection.outlook.com [40.107.8.51]) (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 0FC3B16EC15; Tue, 7 May 2024 18:46:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.51 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715107614; cv=fail; b=OCyHRuMMW5QUzzYFLT0gsUu32jU+yKBtD1Fvo87Js1zCU7m0AOBL/jGJ0MEIdLuCNR1OR6T0fdq+If2iup58wFolxichtigmcKJadRkumwzktMqpG82WB8lkXsqnhBgCyowCM8N/XqprSbB30hR+h841PvbQkA+3w+plB0HSZaU= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715107614; c=relaxed/simple; bh=Cpqug5G7k49MqW0A3NFncM6Y5cYEpxavVt54pyo/9Qo=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=tIJiDmCWHqoTLbGpn2wxisFb5Fz4/Ryfe/ztIKvK2RqfgTcKWV6Mhv0ihZ4wTtKVAzNmBGt6D08NsLA5QdN7K3iTwEOcKggW8JyacQGpPnzs1cy8+jSpLQYmqMG1m+TYK8HwHdEEYOVUsyocIBB0TKIxH99SaZpGsfPJ5ZNlDAI= 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=UCaex8/p; arc=fail smtp.client-ip=40.107.8.51 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X04qXaaiC0595okiuRTgeJ5h0C7PK5co38cw1HDgZRpSWJ36ERX+Qh3nR4VOpSBT0Cty+3NGfllkQlOK7FJbqAJdTpfvx/DxXR0XYmU3FplNGemT5+86TTLdkYcr8NJUqSvaQdsQkBEk4hfpSagS/EUMR2kSEsOuXLt1araawdnkbH2chFTpgc8PoVlSFFHkEmVACl2r06AMwiKh3osudeNMQRPLaGg5DS0Ztsh+ja0vMUdYb2kJ4b0whr8U1tqGFZTzr1uyDXr60Oft6wpqnKNKPWy7uKvZo5Sj/jd2W6nUhnAPiNr9J16IJX9F1vesNCmLSJbvob0Vyn9zTQ68ag== 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=1nl/ELpxThlz8kTl1lbs0j8zTFjcylBahXo9Jv8iXEQ=; b=STE0mmZDrX9hhAOVD7lrmzGPyjuRCS0Ij0oRy60OFv8peYGqJvmHr4DQJ6tEo9neqeJaBOEBMEerFgq/7Shb8dfmggiBLhCiCNlvBGg54aUYHW6GBessGHwqXWeWZNyxpoIfEOQfh0OG3FSS17hBHKcN8bMgDdS5qzfo7uLQ2RaGJxgQ4rabhrQPT3VOrE+zT72mpUiIXsqZ80Qvy6xzXZEK4wvfr+ie+TspltnFzHv92pIrau1gg8rkp941vg62EF7pgmW9fSt0/gOvwKyi2r3IBCRpJFxU/n9ZnkYcL+tFhiSQpzh6fOJ2giNtK8QvzUpnHFoMoiqTYEyKDAHPRg== 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=1nl/ELpxThlz8kTl1lbs0j8zTFjcylBahXo9Jv8iXEQ=; b=UCaex8/p1vPPrz21votM0zO6eoLEhHantCIdjlBf79AjJ2ODzaDtXAAiK0GRRF7c4D4SqrzRVuQPWSEx2dHXVPQ6hH7VszRRDULYYFreYt/ks9ZBkA3Idja3tPmJkhA2SgR+4pimqfmtQjfa84IP5W58kY6Qp3z1/ZMrqhGhz70= 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 DU0PR04MB9636.eurprd04.prod.outlook.com (2603:10a6:10:320::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Tue, 7 May 2024 18:46:48 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::1e67:dfc9:d0c1:fe58]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::1e67:dfc9:d0c1:fe58%7]) with mapi id 15.20.7544.041; Tue, 7 May 2024 18:46:48 +0000 From: Frank Li Date: Tue, 07 May 2024 14:45:43 -0400 Subject: [PATCH v4 05/12] PCI: imx6: Simplify switch-case logic by involve core_reset callback Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240507-pci2_upstream-v4-5-e8c80d874057@nxp.com> References: <20240507-pci2_upstream-v4-0-e8c80d874057@nxp.com> In-Reply-To: <20240507-pci2_upstream-v4-0-e8c80d874057@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley 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, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1715107574; l=7027; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Cpqug5G7k49MqW0A3NFncM6Y5cYEpxavVt54pyo/9Qo=; b=lEu/WKLevwLBU+GsXyEDwvrd1ECLpXCE+545syYEZrWi459n2RA8Kly2lP5zalZ9HTiR+1r5W Fea6U/DC0OED4frS1NOFa2IqxnLTcpo54e9NgZsJt7QhU/DJh5OAcP7 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0026.namprd17.prod.outlook.com (2603:10b6:a03:1b8::39) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU0PR04MB9636:EE_ X-MS-Office365-Filtering-Correlation-Id: c0271a42-03b3-4e7e-a494-08dc6ec60d0f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|7416005|52116005|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?B?QVU2WFczRVhvd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WFU0Mzg5MTNJaXdrUnN2WVVN?= =?utf-8?Q?O3Cnw8zQsyJX2lbcdVTXLz+gW12+3Je2FU/us=3D?= 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)(1800799015)(376005)(7416005)(52116005)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?L1hwUDh4MXV2TzZNWW5naW5JVURjOEU4OGswNS8rZFlzUExteVpRZTZuc0dE?= =?utf-8?B?V2NpTlJPa1ZZM1FNeUpkaS9yWm52TWFYTG0yME1UVUNzdGt1V2xQamM3dnFT?= =?utf-8?B?M3JaOHVGMUpOSDFJTXZ3aVhIRytLM0EzVUFtWGM0VFB5TFhrZE9BdzZxQVZx?= =?utf-8?B?RkVGbysrWVlwd0l6aTFuV04vMUlCOEwyM2hpczlNeEtVSWpURzd4eTVhVTVt?= =?utf-8?B?eDVPT3VDRWcvYUIvZFhiOXg2NU0wSkI2dnZBV0FPbUkxZ1BFd3RRRlY4Z3JZ?= =?utf-8?B?MWszdCtxakJ1bGg0TlFSVUh0cWc5ZmFrSzA0bjMxcHpSdXFVbVA4RFRtTEtv?= =?utf-8?B?VE52dFJHZThoWHVEbTBKcS9sUGk2RDVhcVhqV2lzVDBrYmU5cVMvOVBaVlly?= =?utf-8?B?aGt4QUQvcG9GZndSdzY2aDc5eEVuYmZVcUNNSzMxSERnL1Y4M0xRSlpudUt0?= =?utf-8?B?UENFZ1ArMUNSc1J3U3FzeHRNVHdOMTdIREpXdGoyM2hLQ21PdkJDOG9MSVlq?= =?utf-8?B?cVc0U0R4ZTdyNkZmSzNvZGhVQ09tdHN2MFo0ZGJ1QUhKZnNIcHB1dUJMUnQ3?= =?utf-8?B?LzhoeFQxSjB1a2R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B?eEl5RUt4QzBpdmhKRko3WGttaHJyTzNUOE9JZFhFdjZMWU5BTEdxNTB3T2xO?= =?utf-8?B?bGxSNXYyMkV0NDFWOFpBa1VIdk5TVzEveGlWaXBRSFhyMWdxUGs0Q3lCOEg4?= =?utf-8?B?RmxzMEJGenhqanJsZlJOM0hsWUpYS2NFbjdpMjZZRjF6K3VDNVRqaEJCZFVk?= =?utf-8?B?a3g2UUUyMFJhbnV1NlVJU2wycDNkb2tvU3JTK1lDYWI5OXJMVTE5dEMvK3Ev?= =?utf-8?B?L3dPQktFendydnVLQ09QaTQwSHpzZU1RRHpJQzI4MXRGZTd3WHFacm9iY1Bp?= =?utf-8?B?Y3E3cDJFbW5aM1FDOGNDVzdDUy9tN1gxUTRUaHp2V3M1c2hCc0hNbW1LclU3?= =?utf-8?B?R3o3ZDFJNG4xUWdJZDB6L2w0aHRuU2UrZWlORjBRMHJ6azloWW8rOE4xenMx?= =?utf-8?B?ZHJ6MWdXV1J0TnFwNXRERzlqZXA3ZVNzKzMxNUdSMGtCMzB3NzhJcC9pVFpo?= =?utf-8?B?Z3V3aDZnWWs4LzNZamhPNDJJcW15R0NPRTVnR1c5QjZSOGtGQnY2NExkTTVz?= =?utf-8?B?WHFkdS93VlZnYThzeklyTXpsM0JBZ3haWFYrd1hOZ3ZTZ0dVaEdlNDQ2RDVM?= =?utf-8?Q?tqx+4JnWUwjg43WGyMGnHUcig?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0271a42-03b3-4e7e-a494-08dc6ec60d0f X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 18:46:48.8087 (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: KszmCK5zHC0m2Q4kON4cTUQDZIzGZsS46RJEd+26QsyJ++wbNQaLlOBUmvv9dUcKGVniQ5Hf7ptSsEifRBgRyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9636 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-imx6.c | 134 ++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 63 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index cf1b487b3f625..7396f0d51119a 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.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 { @@ -672,35 +673,75 @@ 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) +{ + if (assert) + regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX6SX_GPR12_PCIE_TEST_POWERDOWN); + + /* 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) +{ + if (!assert) + return 0; + + regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_TEST_PD); + regmap_set_bits(imx_pcie->iomuxc_gpr, IOMUXC_GPR1, 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)) @@ -710,47 +751,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)) { @@ -1448,6 +1452,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, @@ -1463,6 +1468,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, @@ -1479,6 +1485,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, @@ -1492,6 +1499,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, -- 2.34.1