diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2018-04-04 20:28:44 +0200 |
---|---|---|
committer | Bjorn Helgaas <helgaas@kernel.org> | 2018-04-04 20:28:44 +0200 |
commit | f3c91098a444c905b69a83a4947d9dbc774f986d (patch) | |
tree | ba8bd093f099c33c09ad5f9743c3eac44e54d30d /drivers/pci/dwc/pcie-histb.c | |
parent | Merge branch 'lorenzo/pci/altera' (diff) | |
parent | PCI: histb: Add an optional regulator for PCIe port power control (diff) | |
download | linux-f3c91098a444c905b69a83a4947d9dbc774f986d.tar.xz linux-f3c91098a444c905b69a83a4947d9dbc774f986d.zip |
Merge branch 'lorenzo/pci/dwc'
* lorenzo/pci/dwc:
PCI: histb: Add an optional regulator for PCIe port power control
PCI: histb: Fix error path of histb_pcie_host_enable()
PCI: qcom: Use regulator bulk api for apq8064 supplies
PCI: qcom: Add missing supplies required for msm8996
PCI: designware-ep: Fix typo in error message
Diffstat (limited to 'drivers/pci/dwc/pcie-histb.c')
-rw-r--r-- | drivers/pci/dwc/pcie-histb.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/pci/dwc/pcie-histb.c b/drivers/pci/dwc/pcie-histb.c index 70b5c0b108bf..4cef0a514944 100644 --- a/drivers/pci/dwc/pcie-histb.c +++ b/drivers/pci/dwc/pcie-histb.c @@ -61,6 +61,7 @@ struct histb_pcie { struct reset_control *bus_reset; void __iomem *ctrl; int reset_gpio; + struct regulator *vpcie; }; static u32 histb_pcie_readl(struct histb_pcie *histb_pcie, u32 reg) @@ -227,6 +228,9 @@ static void histb_pcie_host_disable(struct histb_pcie *hipcie) if (gpio_is_valid(hipcie->reset_gpio)) gpio_set_value_cansleep(hipcie->reset_gpio, 0); + + if (hipcie->vpcie) + regulator_disable(hipcie->vpcie); } static int histb_pcie_host_enable(struct pcie_port *pp) @@ -237,6 +241,14 @@ static int histb_pcie_host_enable(struct pcie_port *pp) int ret; /* power on PCIe device if have */ + if (hipcie->vpcie) { + ret = regulator_enable(hipcie->vpcie); + if (ret) { + dev_err(dev, "failed to enable regulator: %d\n", ret); + return ret; + } + } + if (gpio_is_valid(hipcie->reset_gpio)) gpio_set_value_cansleep(hipcie->reset_gpio, 1); @@ -276,13 +288,14 @@ static int histb_pcie_host_enable(struct pcie_port *pp) return 0; err_aux_clk: - clk_disable_unprepare(hipcie->aux_clk); -err_pipe_clk: clk_disable_unprepare(hipcie->pipe_clk); -err_sys_clk: +err_pipe_clk: clk_disable_unprepare(hipcie->sys_clk); -err_bus_clk: +err_sys_clk: clk_disable_unprepare(hipcie->bus_clk); +err_bus_clk: + if (hipcie->vpcie) + regulator_disable(hipcie->vpcie); return ret; } @@ -332,6 +345,13 @@ static int histb_pcie_probe(struct platform_device *pdev) return PTR_ERR(pci->dbi_base); } + hipcie->vpcie = devm_regulator_get_optional(dev, "vpcie"); + if (IS_ERR(hipcie->vpcie)) { + if (PTR_ERR(hipcie->vpcie) == -EPROBE_DEFER) + return -EPROBE_DEFER; + hipcie->vpcie = NULL; + } + hipcie->reset_gpio = of_get_named_gpio_flags(np, "reset-gpios", 0, &of_flags); if (of_flags & OF_GPIO_ACTIVE_LOW) |