Commit 9751f65d authored by Richard Zhu's avatar Richard Zhu Committed by Bjorn Helgaas

PCI: imx6: Propagate .host_init() errors to caller

Since dw_pcie_host_init() checks for errors from ops->host_init(),
check for errors when enabling power regulators and clocks and return them.

[bhelgaas: commit log]
Link: https://lore.kernel.org/r/1657783869-19194-8-git-send-email-hongxing.zhu@nxp.comSigned-off-by: default avatarRichard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarLucas Stach <l.stach@pengutronix.de>
parent 835fe229
...@@ -708,7 +708,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) ...@@ -708,7 +708,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie)
imx6_pcie->gpio_active_high); imx6_pcie->gpio_active_high);
} }
static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
{ {
struct dw_pcie *pci = imx6_pcie->pci; struct dw_pcie *pci = imx6_pcie->pci;
struct device *dev = pci->dev; struct device *dev = pci->dev;
...@@ -719,7 +719,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) ...@@ -719,7 +719,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
if (ret) { if (ret) {
dev_err(dev, "failed to enable vpcie regulator: %d\n", dev_err(dev, "failed to enable vpcie regulator: %d\n",
ret); ret);
return; return ret;
} }
} }
...@@ -784,7 +784,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) ...@@ -784,7 +784,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
msleep(100); msleep(100);
} }
return; return 0;
err_clks: err_clks:
if (imx6_pcie->vpcie && regulator_is_enabled(imx6_pcie->vpcie) > 0) { if (imx6_pcie->vpcie && regulator_is_enabled(imx6_pcie->vpcie) > 0) {
...@@ -793,6 +793,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) ...@@ -793,6 +793,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
dev_err(dev, "failed to disable vpcie regulator: %d\n", dev_err(dev, "failed to disable vpcie regulator: %d\n",
ret); ret);
} }
return ret;
} }
static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie)
...@@ -911,11 +912,18 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) ...@@ -911,11 +912,18 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
static int imx6_pcie_host_init(struct dw_pcie_rp *pp) static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
{ {
struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct device *dev = pci->dev;
struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci);
int ret;
imx6_pcie_assert_core_reset(imx6_pcie); imx6_pcie_assert_core_reset(imx6_pcie);
imx6_pcie_init_phy(imx6_pcie); imx6_pcie_init_phy(imx6_pcie);
imx6_pcie_deassert_core_reset(imx6_pcie); ret = imx6_pcie_deassert_core_reset(imx6_pcie);
if (ret < 0) {
dev_err(dev, "pcie deassert core reset failed: %d\n", ret);
return ret;
}
imx6_setup_phy_mpll(imx6_pcie); imx6_setup_phy_mpll(imx6_pcie);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment