Commit 854b69ef authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Lorenzo Pieralisi

PCI: qcom: add runtime pm support to pcie_port

This patch is required when the pcie controller sits on a bus with
its own power domain and clocks which are controlled via a bus driver
like simple pm bus. As these bus driver have runtime pm enabled, it makes
sense to update the usage counter so that the runtime pm does not suspend
the clks or power domain associated with the bus driver.
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: default avatarVinod Koul <vkoul@kernel.org>
Acked-by: default avatarStanimir Varbanov <svarbanov@mm-sol.com>
parent 074df251
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/pm_runtime.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
...@@ -1088,6 +1089,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp) ...@@ -1088,6 +1089,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
struct qcom_pcie *pcie = to_qcom_pcie(pci); struct qcom_pcie *pcie = to_qcom_pcie(pci);
int ret; int ret;
pm_runtime_get_sync(pci->dev);
qcom_ep_reset_assert(pcie); qcom_ep_reset_assert(pcie);
ret = pcie->ops->init(pcie); ret = pcie->ops->init(pcie);
...@@ -1124,6 +1126,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp) ...@@ -1124,6 +1126,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
phy_power_off(pcie->phy); phy_power_off(pcie->phy);
err_deinit: err_deinit:
pcie->ops->deinit(pcie); pcie->ops->deinit(pcie);
pm_runtime_put(pci->dev);
return ret; return ret;
} }
...@@ -1212,6 +1215,7 @@ static int qcom_pcie_probe(struct platform_device *pdev) ...@@ -1212,6 +1215,7 @@ static int qcom_pcie_probe(struct platform_device *pdev)
if (!pci) if (!pci)
return -ENOMEM; return -ENOMEM;
pm_runtime_enable(dev);
pci->dev = dev; pci->dev = dev;
pci->ops = &dw_pcie_ops; pci->ops = &dw_pcie_ops;
pp = &pci->pp; pp = &pci->pp;
...@@ -1257,14 +1261,17 @@ static int qcom_pcie_probe(struct platform_device *pdev) ...@@ -1257,14 +1261,17 @@ static int qcom_pcie_probe(struct platform_device *pdev)
} }
ret = phy_init(pcie->phy); ret = phy_init(pcie->phy);
if (ret) if (ret) {
pm_runtime_disable(&pdev->dev);
return ret; return ret;
}
platform_set_drvdata(pdev, pcie); platform_set_drvdata(pdev, pcie);
ret = dw_pcie_host_init(pp); ret = dw_pcie_host_init(pp);
if (ret) { if (ret) {
dev_err(dev, "cannot initialize host\n"); dev_err(dev, "cannot initialize host\n");
pm_runtime_disable(&pdev->dev);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment