summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Zhu <hongxing.zhu@nxp.com>2019-11-28 16:44:07 +0800
committerRichard Zhu <hongxing.zhu@nxp.com>2019-11-29 13:34:36 +0800
commitd1fcbc345b82cd86e6c288b984ce2da0004eaf1d (patch)
tree62acdba257c8ba7b788fdd4d0f18e7644a88f3d3
parentf503843f85d287408022a1e84f7a7485287a6e79 (diff)
LF-128 PCI: imx: turn off the clocks and regulators when link is down
To save power consumption, disable pcie clocks and regulators when pcie link is down. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
-rw-r--r--drivers/pci/controller/dwc/pci-imx6.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 54ec58135784..f43bfd6090ce 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1472,6 +1472,14 @@ err_reset_phy:
dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0),
dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1));
imx6_pcie_reset_phy(imx6_pcie);
+ if (!IS_ENABLED(CONFIG_PCI_IMX6_COMPLIANCE_TEST)) {
+ imx6_pcie_clk_disable(imx6_pcie);
+ if (imx6_pcie->vpcie != NULL)
+ regulator_disable(imx6_pcie->vpcie);
+ if (imx6_pcie->epdev_on != NULL)
+ regulator_disable(imx6_pcie->epdev_on);
+ }
+
return ret;
}
@@ -1504,7 +1512,8 @@ static int imx6_pcie_host_init(struct pcie_port *pp)
if (!IS_ENABLED(CONFIG_EP_MODE_IN_EP_RC_SYS)) {
dw_pcie_setup_rc(pp);
pci_imx_set_msi_en(pp);
- imx6_pcie_establish_link(imx6_pcie);
+ if (imx6_pcie_establish_link(imx6_pcie))
+ return -ENODEV;
if (IS_ENABLED(CONFIG_PCI_MSI))
dw_pcie_msi_init(pp);