From 95b4e4bb8a106f916d94be8efb3ca6dacfc79466 Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Fri, 28 Apr 2023 12:39:38 +0200 Subject: PCI: imx: Disable vpcie in case that the PCIe PLL does not lock If the PCIe PLL locking fails we also have to disable vpcie because it was already enabled before. Without this commit we get a warning when the kernel tries to free the vpcie regulator. Upstream-Status: Pending Mainline for i.MX 8X does not support PCIe yet, this patch cannot be upstreamed as of now. Fixes: f6bf1945c5d5 ("PCI: imx: Do not hang if REFCLK is missing") Signed-off-by: Stefan Eichenberger --- drivers/pci/controller/dwc/pci-imx6.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index ef6492f3fbbb..814003db2c9c 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1217,7 +1217,7 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) /* wait for phy pll lock firstly. */ ret = imx8_pcie_wait_for_phy_pll_lock(imx6_pcie); if (ret) - return ret; + goto err_vpcie; break; case IMX8MQ: case IMX8MM: @@ -1354,6 +1354,12 @@ static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) } return 0; + +err_vpcie: + if (imx6_pcie->vpcie) + regulator_disable(imx6_pcie->vpcie); + + return ret; } static void imx6_pcie_configure_type(struct imx6_pcie *imx6_pcie) -- cgit v1.2.3