diff options
author | Fugang Duan <fugang.duan@nxp.com> | 2017-09-19 12:09:01 +0800 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | a409552cee796f96eb8d158ce583c604cd922680 (patch) | |
tree | 2b25085a288d7287ecd8eaf61744754c0b0d9ae9 /drivers/pci | |
parent | 005a10fe3ace903574583c9e1bad4196a0b74999 (diff) |
MLK-16485 PCI: imx6: Defer probing if .of_get_named_gpio() returns -EPROBE_DEFER
Driver should do defer probing if .of_get_named_gpio() returns -EPROBE_DEFER.
And moving epdev_on regulator to be common for all platforms.
(BuildInfo: SCFW 3e70523d, IMX-MKIMAGE 0, ATF 0)
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/host/pci-imx6.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 6089f53fc73a..8a099fbcb08d 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c @@ -1789,6 +1789,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) dev_err(&pdev->dev, "unable to get clkreq gpio\n"); return ret; } + } else if (imx6_pcie->clkreq_gpio == -EPROBE_DEFER) { + return imx6_pcie->clkreq_gpio; } imx6_pcie->dis_gpio = of_get_named_gpio(node, "disable-gpio", 0); @@ -1799,6 +1801,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) dev_err(&pdev->dev, "unable to get disable gpio\n"); return ret; } + } else if (imx6_pcie->dis_gpio == -EPROBE_DEFER) { + return imx6_pcie->dis_gpio; } imx6_pcie->power_on_gpio = of_get_named_gpio(node, "power-on-gpio", 0); @@ -1811,6 +1815,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) dev_err(&pdev->dev, "unable to get power-on gpio\n"); return ret; } + } else if (imx6_pcie->power_on_gpio == -EPROBE_DEFER) { + return imx6_pcie->power_on_gpio; } imx6_pcie->reset_gpio = of_get_named_gpio(node, "reset-gpio", 0); @@ -1830,6 +1836,18 @@ static int imx6_pcie_probe(struct platform_device *pdev) return imx6_pcie->reset_gpio; } + imx6_pcie->epdev_on = devm_regulator_get(&pdev->dev, "epdev_on"); + if (IS_ERR(imx6_pcie->epdev_on)) { + if (PTR_ERR(imx6_pcie->epdev_on) == -EPROBE_DEFER) + return -EPROBE_DEFER; + dev_info(dev, "no ep regulator found\n"); + imx6_pcie->epdev_on = NULL; + } else { + ret = regulator_enable(imx6_pcie->epdev_on); + if (ret) + dev_err(dev, "failed to enable the epdev_on regulator\n"); + } + /* Fetch clocks */ imx6_pcie->pcie_phy = devm_clk_get(dev, "pcie_phy"); if (IS_ERR(imx6_pcie->pcie_phy)) { @@ -1938,16 +1956,6 @@ static int imx6_pcie_probe(struct platform_device *pdev) "pcie clock source missing or invalid\n"); return PTR_ERR(imx6_pcie->pcie_inbound_axi); } - - imx6_pcie->epdev_on = devm_regulator_get(&pdev->dev, - "epdev_on"); - if (IS_ERR(imx6_pcie->epdev_on)) - return -EPROBE_DEFER; - - ret = regulator_enable(imx6_pcie->epdev_on); - if (ret) - dev_err(imx6_pcie->pp.dev, - "failed to enable the epdev_on regulator\n"); } else { imx6_pcie->iomuxc_gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr"); |