aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/pci/controller/pcie-cadence.c
diff options
context:
space:
mode:
authorAlan Douglas <adouglas@cadence.com>2018-06-25 09:30:52 +0100
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2018-07-12 12:44:14 +0100
commitee12c9efe685428ebfae1bf5347b5375f54ce44e (patch)
treefa4547e150a97e7dbf36fb55124f2ef3d9d157fa /drivers/pci/controller/pcie-cadence.c
parentdt-bindings: PCI: cadence: Add DT bindings for optional PHYs (diff)
downloadwireguard-linux-ee12c9efe685428ebfae1bf5347b5375f54ce44e.tar.xz
wireguard-linux-ee12c9efe685428ebfae1bf5347b5375f54ce44e.zip
PCI: cadence: Add Power Management ops for host and EP
These PM ops will enable/disable the optional PHYs if present. The AXI link-down register in the host driver is now cleared in cdns_pci_map_bus() since the link-down bit will be set if the PHY has been disabled. It is not cleared when enabling the PHY, since the link will not yet be up (e.g. when an EP controller is connected back-to-back to the host controller and its PHY is still disabled). Link: http://lkml.kernel.org/r/1529915453-4633-5-git-send-email-adouglas@cadence.com Signed-off-by: Alan Douglas <adouglas@cadence.com> [lorenzo.pieralisi@arm.com: updated commit log] Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Diffstat (limited to 'drivers/pci/controller/pcie-cadence.c')
-rw-r--r--drivers/pci/controller/pcie-cadence.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/pci/controller/pcie-cadence.c b/drivers/pci/controller/pcie-cadence.c
index 2edc12661e44..86f1b002c846 100644
--- a/drivers/pci/controller/pcie-cadence.c
+++ b/drivers/pci/controller/pcie-cadence.c
@@ -217,3 +217,33 @@ err_link:
return ret;
}
+
+#ifdef CONFIG_PM_SLEEP
+static int cdns_pcie_suspend_noirq(struct device *dev)
+{
+ struct cdns_pcie *pcie = dev_get_drvdata(dev);
+
+ cdns_pcie_disable_phy(pcie);
+
+ return 0;
+}
+
+static int cdns_pcie_resume_noirq(struct device *dev)
+{
+ struct cdns_pcie *pcie = dev_get_drvdata(dev);
+ int ret;
+
+ ret = cdns_pcie_enable_phy(pcie);
+ if (ret) {
+ dev_err(dev, "failed to enable phy\n");
+ return ret;
+ }
+
+ return 0;
+}
+#endif
+
+const struct dev_pm_ops cdns_pcie_pm_ops = {
+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(cdns_pcie_suspend_noirq,
+ cdns_pcie_resume_noirq)
+};