aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorKishon Vijay Abraham I2018-10-17 13:11:05 +0530
committerLorenzo Pieralisi2018-10-17 09:46:44 +0100
commit8047eb55129ababe38dd2f1608c4fdc6d3e75aaf (patch)
tree3adb68545ddf93a95f4abb74cd23efa0526d4d01 /drivers/pci
parent49229238ab47fa1852a89ee55d1e7fb251ee4eb0 (diff)
PCI: keystone: Invoke runtime PM APIs to enable clock
Invoke runtime PM APIs to enable clocks and remove explicit clock enabling using clk_prepare_enable(). Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/controller/dwc/pci-keystone.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index 5ae73c185c99..4f764ec49a4c 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -96,7 +96,6 @@
struct keystone_pcie {
struct dw_pcie *pci;
- struct clk *clk;
/* PCI Device ID */
u32 device_id;
int num_legacy_host_irqs;
@@ -989,26 +988,22 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, ks_pcie);
- ks_pcie->clk = devm_clk_get(dev, "pcie");
- if (IS_ERR(ks_pcie->clk)) {
- dev_err(dev, "Failed to get pcie rc clock\n");
- ret = PTR_ERR(ks_pcie->clk);
- goto err_phy;
+ pm_runtime_enable(dev);
+ ret = pm_runtime_get_sync(dev);
+ if (ret < 0) {
+ dev_err(dev, "pm_runtime_get_sync failed\n");
+ goto err_get_sync;
}
- ret = clk_prepare_enable(ks_pcie->clk);
- if (ret)
- goto err_phy;
-
ret = ks_pcie_add_pcie_port(ks_pcie, pdev);
if (ret < 0)
- goto fail_clk;
+ goto err_get_sync;
return 0;
-fail_clk:
- clk_disable_unprepare(ks_pcie->clk);
-err_phy:
+err_get_sync:
+ pm_runtime_put(dev);
+ pm_runtime_disable(dev);
ks_pcie_disable_phy(ks_pcie);
err_link:
@@ -1023,10 +1018,11 @@ static int __exit ks_pcie_remove(struct platform_device *pdev)
struct keystone_pcie *ks_pcie = platform_get_drvdata(pdev);
struct device_link **link = ks_pcie->link;
int num_lanes = ks_pcie->num_lanes;
+ struct device *dev = &pdev->dev;
- clk_disable_unprepare(ks_pcie->clk);
+ pm_runtime_put(dev);
+ pm_runtime_disable(dev);
ks_pcie_disable_phy(ks_pcie);
-
while (num_lanes--)
device_link_del(link[num_lanes]);