summaryrefslogtreecommitdiff
path: root/drivers/pci/host/pci-imx6.c
diff options
context:
space:
mode:
authorRichard Zhu <hongxing.zhu@nxp.com>2016-09-02 16:42:26 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commitfdc68786f13cd94395780980d24a87fa7c5b486d (patch)
treefb94f02e7b5a4c5a285bcd95a9544447e1ae035e /drivers/pci/host/pci-imx6.c
parent3ec4732ae11b8f919412a89b0376be2bcef4a4ce (diff)
MLK-13178-2 pci: imx6: add one regulator for ext osc
On imx6qp sabresd rev b board, there is a standalone external oscilator, used to provided the clks for imx6qp pcie. Add one regulator into pcie node, let the ext osc work. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Diffstat (limited to 'drivers/pci/host/pci-imx6.c')
-rw-r--r--drivers/pci/host/pci-imx6.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 9aa57ec30005..c76e631024e6 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -74,6 +74,7 @@ struct imx6_pcie {
int link_gen;
struct regmap *reg_src;
struct regulator *pcie_phy_regulator;
+ struct regulator *pcie_bus_regulator;
};
/* PCIe Root Complex registers (memory-mapped) */
@@ -512,6 +513,12 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie)
IMX6SX_GPR12_PCIE_RX_EQ_2);
}
+ if (imx6_pcie->pcie_bus_regulator != NULL) {
+ ret = regulator_enable(imx6_pcie->pcie_bus_regulator);
+ if (ret)
+ dev_err(imx6_pcie->pp.dev, "failed to enable pcie regulator.\n");
+ }
+
if (imx6_pcie->variant != IMX7D) {
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
IMX6Q_GPR12_PCIE_CTL_2, 0 << 10);
@@ -571,6 +578,8 @@ static int imx6_pcie_wait_for_link(struct imx6_pcie *imx6_pcie)
release_bus_freq(BUS_FREQ_HIGH);
if (imx6_pcie->pcie_phy_regulator != NULL)
regulator_disable(imx6_pcie->pcie_phy_regulator);
+ if (imx6_pcie->pcie_bus_regulator != NULL)
+ regulator_disable(imx6_pcie->pcie_bus_regulator);
}
return -ETIMEDOUT;
@@ -1000,6 +1009,8 @@ static int pci_imx_suspend_noirq(struct device *dev)
/* Power down PCIe PHY. */
if (imx6_pcie->pcie_phy_regulator != NULL)
regulator_disable(imx6_pcie->pcie_phy_regulator);
+ if (imx6_pcie->pcie_bus_regulator != NULL)
+ regulator_disable(imx6_pcie->pcie_bus_regulator);
if (gpio_is_valid(imx6_pcie->power_on_gpio))
gpio_set_value_cansleep(imx6_pcie->power_on_gpio, 0);
} else {
@@ -1185,6 +1196,11 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
}
}
+ imx6_pcie->pcie_bus_regulator = devm_regulator_get(pp->dev,
+ "pcie-bus");
+ if (IS_ERR(imx6_pcie->pcie_bus_regulator))
+ imx6_pcie->pcie_bus_regulator = NULL;
+
/* Grab GPR config register range */
if (imx6_pcie->variant == IMX7D) {
imx6_pcie->iomuxc_gpr =