diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2018-10-17 03:41:05 -0400 |
---|---|---|
committer | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2018-10-17 04:46:44 -0400 |
commit | 8047eb55129ababe38dd2f1608c4fdc6d3e75aaf (patch) | |
tree | 3adb68545ddf93a95f4abb74cd23efa0526d4d01 /drivers/pci/controller/dwc | |
parent | 49229238ab47fa1852a89ee55d1e7fb251ee4eb0 (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/controller/dwc')
-rw-r--r-- | drivers/pci/controller/dwc/pci-keystone.c | 28 |
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 @@ | |||
96 | 96 | ||
97 | struct keystone_pcie { | 97 | struct keystone_pcie { |
98 | struct dw_pcie *pci; | 98 | struct dw_pcie *pci; |
99 | struct clk *clk; | ||
100 | /* PCI Device ID */ | 99 | /* PCI Device ID */ |
101 | u32 device_id; | 100 | u32 device_id; |
102 | int num_legacy_host_irqs; | 101 | int num_legacy_host_irqs; |
@@ -989,26 +988,22 @@ static int __init ks_pcie_probe(struct platform_device *pdev) | |||
989 | } | 988 | } |
990 | 989 | ||
991 | platform_set_drvdata(pdev, ks_pcie); | 990 | platform_set_drvdata(pdev, ks_pcie); |
992 | ks_pcie->clk = devm_clk_get(dev, "pcie"); | 991 | pm_runtime_enable(dev); |
993 | if (IS_ERR(ks_pcie->clk)) { | 992 | ret = pm_runtime_get_sync(dev); |
994 | dev_err(dev, "Failed to get pcie rc clock\n"); | 993 | if (ret < 0) { |
995 | ret = PTR_ERR(ks_pcie->clk); | 994 | dev_err(dev, "pm_runtime_get_sync failed\n"); |
996 | goto err_phy; | 995 | goto err_get_sync; |
997 | } | 996 | } |
998 | 997 | ||
999 | ret = clk_prepare_enable(ks_pcie->clk); | ||
1000 | if (ret) | ||
1001 | goto err_phy; | ||
1002 | |||
1003 | ret = ks_pcie_add_pcie_port(ks_pcie, pdev); | 998 | ret = ks_pcie_add_pcie_port(ks_pcie, pdev); |
1004 | if (ret < 0) | 999 | if (ret < 0) |
1005 | goto fail_clk; | 1000 | goto err_get_sync; |
1006 | 1001 | ||
1007 | return 0; | 1002 | return 0; |
1008 | fail_clk: | ||
1009 | clk_disable_unprepare(ks_pcie->clk); | ||
1010 | 1003 | ||
1011 | err_phy: | 1004 | err_get_sync: |
1005 | pm_runtime_put(dev); | ||
1006 | pm_runtime_disable(dev); | ||
1012 | ks_pcie_disable_phy(ks_pcie); | 1007 | ks_pcie_disable_phy(ks_pcie); |
1013 | 1008 | ||
1014 | err_link: | 1009 | err_link: |
@@ -1023,10 +1018,11 @@ static int __exit ks_pcie_remove(struct platform_device *pdev) | |||
1023 | struct keystone_pcie *ks_pcie = platform_get_drvdata(pdev); | 1018 | struct keystone_pcie *ks_pcie = platform_get_drvdata(pdev); |
1024 | struct device_link **link = ks_pcie->link; | 1019 | struct device_link **link = ks_pcie->link; |
1025 | int num_lanes = ks_pcie->num_lanes; | 1020 | int num_lanes = ks_pcie->num_lanes; |
1021 | struct device *dev = &pdev->dev; | ||
1026 | 1022 | ||
1027 | clk_disable_unprepare(ks_pcie->clk); | 1023 | pm_runtime_put(dev); |
1024 | pm_runtime_disable(dev); | ||
1028 | ks_pcie_disable_phy(ks_pcie); | 1025 | ks_pcie_disable_phy(ks_pcie); |
1029 | |||
1030 | while (num_lanes--) | 1026 | while (num_lanes--) |
1031 | device_link_del(link[num_lanes]); | 1027 | device_link_del(link[num_lanes]); |
1032 | 1028 | ||