All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] PCI: qcom: add runtime pm support to pcie_port
@ 2018-05-18  7:07 Bjorn Andersson
  2018-05-23  6:15 ` Vinod
  0 siblings, 1 reply; 4+ messages in thread
From: Bjorn Andersson @ 2018-05-18  7:07 UTC (permalink / raw)
  To: Stanimir Varbanov, Lorenzo Pieralisi, Bjorn Helgaas
  Cc: Srinivas Kandagatla, linux-pci, linux-arm-msm, linux-kernel

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

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: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

This patch was posted 18 months ago but was somehow lost. linux-next recently
enabled PCIe on MSM8996 and DB820c, but the system stalls as the agnoc gdsc
isn't enabled. This patch still fixes this problem for me.

 drivers/pci/dwc/pcie-qcom.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
index 5897af7d3355..3f35098b71b1 100644
--- a/drivers/pci/dwc/pcie-qcom.c
+++ b/drivers/pci/dwc/pcie-qcom.c
@@ -1088,6 +1088,8 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
 	struct qcom_pcie *pcie = to_qcom_pcie(pci);
 	int ret;
 
+	pm_runtime_get_sync(pci->dev);
+
 	qcom_ep_reset_assert(pcie);
 
 	ret = pcie->ops->init(pcie);
@@ -1124,6 +1126,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
 	phy_power_off(pcie->phy);
 err_deinit:
 	pcie->ops->deinit(pcie);
+	pm_runtime_put_sync(pci->dev);
 
 	return ret;
 }
@@ -1204,6 +1207,7 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 	struct qcom_pcie *pcie;
 	int ret;
 
+
 	pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
 	if (!pcie)
 		return -ENOMEM;
@@ -1212,6 +1216,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 	if (!pci)
 		return -ENOMEM;
 
+	pm_runtime_enable(dev);
+
 	pci->dev = dev;
 	pci->ops = &dw_pcie_ops;
 	pp = &pci->pp;
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RESEND PATCH] PCI: qcom: add runtime pm support to pcie_port
  2018-05-18  7:07 [RESEND PATCH] PCI: qcom: add runtime pm support to pcie_port Bjorn Andersson
@ 2018-05-23  6:15 ` Vinod
  2018-05-23 10:10   ` Srinivas Kandagatla
  0 siblings, 1 reply; 4+ messages in thread
From: Vinod @ 2018-05-23  6:15 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Stanimir Varbanov, Lorenzo Pieralisi, Bjorn Helgaas,
	Srinivas Kandagatla, linux-pci, linux-arm-msm, linux-kernel

On 18-05-18, 00:07, Bjorn Andersson wrote:

> diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
> index 5897af7d3355..3f35098b71b1 100644
> --- a/drivers/pci/dwc/pcie-qcom.c
> +++ b/drivers/pci/dwc/pcie-qcom.c
> @@ -1088,6 +1088,8 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
>  	struct qcom_pcie *pcie = to_qcom_pcie(pci);
>  	int ret;
>  
> +	pm_runtime_get_sync(pci->dev);
> +
>  	qcom_ep_reset_assert(pcie);
>  
>  	ret = pcie->ops->init(pcie);
> @@ -1124,6 +1126,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
>  	phy_power_off(pcie->phy);
>  err_deinit:
>  	pcie->ops->deinit(pcie);
> +	pm_runtime_put_sync(pci->dev);

Wondering if there is a reason for sync put here?

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND PATCH] PCI: qcom: add runtime pm support to pcie_port
  2018-05-23  6:15 ` Vinod
@ 2018-05-23 10:10   ` Srinivas Kandagatla
  2018-05-23 10:46     ` Vinod
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Kandagatla @ 2018-05-23 10:10 UTC (permalink / raw)
  To: Vinod, Bjorn Andersson
  Cc: Stanimir Varbanov, Lorenzo Pieralisi, Bjorn Helgaas, linux-pci,
	linux-arm-msm, linux-kernel



On 23/05/18 07:15, Vinod wrote:
> On 18-05-18, 00:07, Bjorn Andersson wrote:
> 
>> diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
>> index 5897af7d3355..3f35098b71b1 100644
>> --- a/drivers/pci/dwc/pcie-qcom.c
>> +++ b/drivers/pci/dwc/pcie-qcom.c
>> @@ -1088,6 +1088,8 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
>>   	struct qcom_pcie *pcie = to_qcom_pcie(pci);
>>   	int ret;
>>   
>> +	pm_runtime_get_sync(pci->dev);
>> +
>>   	qcom_ep_reset_assert(pcie);
>>   
>>   	ret = pcie->ops->init(pcie);
>> @@ -1124,6 +1126,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
>>   	phy_power_off(pcie->phy);
>>   err_deinit:
>>   	pcie->ops->deinit(pcie);
>> +	pm_runtime_put_sync(pci->dev);
> 
> Wondering if there is a reason for sync put here?
pm_runtime_get_sync() call paired with a pm_runtime_put() call will be
appropriate here I guess as per 
https://www.kernel.org/doc/Documentation/power/runtime_pm.txt

I will respin this patch.

Thanks,
srini


> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND PATCH] PCI: qcom: add runtime pm support to pcie_port
  2018-05-23 10:10   ` Srinivas Kandagatla
@ 2018-05-23 10:46     ` Vinod
  0 siblings, 0 replies; 4+ messages in thread
From: Vinod @ 2018-05-23 10:46 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Bjorn Andersson, Stanimir Varbanov, Lorenzo Pieralisi,
	Bjorn Helgaas, linux-pci, linux-arm-msm, linux-kernel

On 23-05-18, 11:10, Srinivas Kandagatla wrote:
> 
> 
> On 23/05/18 07:15, Vinod wrote:
> > On 18-05-18, 00:07, Bjorn Andersson wrote:
> > 
> > > diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
> > > index 5897af7d3355..3f35098b71b1 100644
> > > --- a/drivers/pci/dwc/pcie-qcom.c
> > > +++ b/drivers/pci/dwc/pcie-qcom.c
> > > @@ -1088,6 +1088,8 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
> > >   	struct qcom_pcie *pcie = to_qcom_pcie(pci);
> > >   	int ret;
> > > +	pm_runtime_get_sync(pci->dev);
> > > +
> > >   	qcom_ep_reset_assert(pcie);
> > >   	ret = pcie->ops->init(pcie);
> > > @@ -1124,6 +1126,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
> > >   	phy_power_off(pcie->phy);
> > >   err_deinit:
> > >   	pcie->ops->deinit(pcie);
> > > +	pm_runtime_put_sync(pci->dev);
> > 
> > Wondering if there is a reason for sync put here?
> pm_runtime_get_sync() call paired with a pm_runtime_put() call will be
> appropriate here I guess as per
> https://www.kernel.org/doc/Documentation/power/runtime_pm.txt

Yeah for the get call sync() is mostly appropriate as you would want hardware to
be up after this. For put most of cases people don't need it to be bought down
synchronously unless you have something specific required which was my question
here. Looks like that is not the case :)

> I will respin this patch.

Sure..

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-23 10:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-18  7:07 [RESEND PATCH] PCI: qcom: add runtime pm support to pcie_port Bjorn Andersson
2018-05-23  6:15 ` Vinod
2018-05-23 10:10   ` Srinivas Kandagatla
2018-05-23 10:46     ` Vinod

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.