* [PATCH v1 0/2] Bug fixes when dwc generic suspend/resume functions are used
@ 2024-09-25 5:48 Richard Zhu
2024-09-25 5:48 ` [PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on some platforms Richard Zhu
2024-09-25 5:48 ` [PATCH v1 2/2] PCI: dwc: Do stop link in the dw_pcie_suspend_noirq Richard Zhu
0 siblings, 2 replies; 8+ messages in thread
From: Richard Zhu @ 2024-09-25 5:48 UTC (permalink / raw)
To: jingoohan1, manivannan.sadhasivam, kwilczynski, bhelgaas,
lpieralisi, frank.li, robh
Cc: linux-pci, linux-kernel, imx
Two bug fixes when dwc generic suspend/resume callbacks are used.
The patch #1 is issued before, but it's not applied yet refer to [1].
Combine these two bug fixes into one series and send here.
[1] https://patchwork.kernel.org/project/linux-pci/patch/1721628913-1449-1-git-send-email-hongxing.zhu@nxp.com/
[PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on
[PATCH v1 2/2] PCI: dwc: Do stop link in the dw_pcie_suspend_noirq
drivers/pci/controller/dwc/pcie-designware-host.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on some platforms
2024-09-25 5:48 [PATCH v1 0/2] Bug fixes when dwc generic suspend/resume functions are used Richard Zhu
@ 2024-09-25 5:48 ` Richard Zhu
2024-10-03 6:04 ` Manivannan Sadhasivam
2024-09-25 5:48 ` [PATCH v1 2/2] PCI: dwc: Do stop link in the dw_pcie_suspend_noirq Richard Zhu
1 sibling, 1 reply; 8+ messages in thread
From: Richard Zhu @ 2024-09-25 5:48 UTC (permalink / raw)
To: jingoohan1, manivannan.sadhasivam, kwilczynski, bhelgaas,
lpieralisi, frank.li, robh
Cc: linux-pci, linux-kernel, imx, Richard Zhu
The dw_pcie_suspend_noirq() function currently returns success directly
if no endpoint (EP) device is connected. However, on some platforms, power
loss occurs during suspend, causing dw_resume() to do nothing in this case.
This results in a system halt because the DWC controller is not initialized
after power-on during resume.
Change call to deinit() in suspend and init() at resume regardless of
whether there are EP device connections or not. It is not harmful to
perform deinit() and init() again for the no power-off case, and it keeps
the code simple and consistent in logic.
Fixes: 4774faf854f5 ("PCI: dwc: Implement generic suspend/resume functionality")
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
.../pci/controller/dwc/pcie-designware-host.c | 30 +++++++++----------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index a0822d5371bc..cb8c3c2bcc79 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -933,23 +933,23 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci)
if (dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKCTL) & PCI_EXP_LNKCTL_ASPM_L1)
return 0;
- if (dw_pcie_get_ltssm(pci) <= DW_PCIE_LTSSM_DETECT_ACT)
- return 0;
-
- if (pci->pp.ops->pme_turn_off)
- pci->pp.ops->pme_turn_off(&pci->pp);
- else
- ret = dw_pcie_pme_turn_off(pci);
+ if (dw_pcie_get_ltssm(pci) > DW_PCIE_LTSSM_DETECT_ACT) {
+ /* Only send out PME_TURN_OFF when PCIE link is up */
+ if (pci->pp.ops->pme_turn_off)
+ pci->pp.ops->pme_turn_off(&pci->pp);
+ else
+ ret = dw_pcie_pme_turn_off(pci);
- if (ret)
- return ret;
+ if (ret)
+ return ret;
- ret = read_poll_timeout(dw_pcie_get_ltssm, val, val == DW_PCIE_LTSSM_L2_IDLE,
- PCIE_PME_TO_L2_TIMEOUT_US/10,
- PCIE_PME_TO_L2_TIMEOUT_US, false, pci);
- if (ret) {
- dev_err(pci->dev, "Timeout waiting for L2 entry! LTSSM: 0x%x\n", val);
- return ret;
+ ret = read_poll_timeout(dw_pcie_get_ltssm, val, val == DW_PCIE_LTSSM_L2_IDLE,
+ PCIE_PME_TO_L2_TIMEOUT_US/10,
+ PCIE_PME_TO_L2_TIMEOUT_US, false, pci);
+ if (ret) {
+ dev_err(pci->dev, "Timeout waiting for L2 entry! LTSSM: 0x%x\n", val);
+ return ret;
+ }
}
if (pci->pp.ops->deinit)
--
2.37.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v1 2/2] PCI: dwc: Do stop link in the dw_pcie_suspend_noirq
2024-09-25 5:48 [PATCH v1 0/2] Bug fixes when dwc generic suspend/resume functions are used Richard Zhu
2024-09-25 5:48 ` [PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on some platforms Richard Zhu
@ 2024-09-25 5:48 ` Richard Zhu
2024-09-25 16:47 ` Frank Li
2024-10-03 6:09 ` Manivannan Sadhasivam
1 sibling, 2 replies; 8+ messages in thread
From: Richard Zhu @ 2024-09-25 5:48 UTC (permalink / raw)
To: jingoohan1, manivannan.sadhasivam, kwilczynski, bhelgaas,
lpieralisi, frank.li, robh
Cc: linux-pci, linux-kernel, imx, Richard Zhu
On i.MX8QM, PCIe link can't be re-established again in
dw_pcie_resume_noirq(), if the LTSSM_EN bit is not cleared properly in
dw_pcie_suspend_noirq().
Add dw_pcie_stop_link() into dw_pcie_suspend_noirq() to fix this issue and
keep symmetric in suspend/resume function since there is
dw_pcie_start_link() in dw_pcie_resume_noirq().
Fixes: 4774faf854f5 ("PCI: dwc: Implement generic suspend/resume functionality")
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index cb8c3c2bcc79..9ca33895456f 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -952,6 +952,7 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci)
}
}
+ dw_pcie_stop_link(pci);
if (pci->pp.ops->deinit)
pci->pp.ops->deinit(&pci->pp);
--
2.37.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1 2/2] PCI: dwc: Do stop link in the dw_pcie_suspend_noirq
2024-09-25 5:48 ` [PATCH v1 2/2] PCI: dwc: Do stop link in the dw_pcie_suspend_noirq Richard Zhu
@ 2024-09-25 16:47 ` Frank Li
2024-10-03 6:09 ` Manivannan Sadhasivam
1 sibling, 0 replies; 8+ messages in thread
From: Frank Li @ 2024-09-25 16:47 UTC (permalink / raw)
To: Richard Zhu
Cc: jingoohan1, manivannan.sadhasivam, kwilczynski, bhelgaas,
lpieralisi, robh, linux-pci, linux-kernel, imx
On Wed, Sep 25, 2024 at 01:48:37PM +0800, Richard Zhu wrote:
> On i.MX8QM, PCIe link can't be re-established again in
> dw_pcie_resume_noirq(), if the LTSSM_EN bit is not cleared properly in
> dw_pcie_suspend_noirq().
>
> Add dw_pcie_stop_link() into dw_pcie_suspend_noirq() to fix this issue and
> keep symmetric in suspend/resume function since there is
> dw_pcie_start_link() in dw_pcie_resume_noirq().
>
> Fixes: 4774faf854f5 ("PCI: dwc: Implement generic suspend/resume functionality")
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index cb8c3c2bcc79..9ca33895456f 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -952,6 +952,7 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci)
> }
> }
>
> + dw_pcie_stop_link(pci);
> if (pci->pp.ops->deinit)
> pci->pp.ops->deinit(&pci->pp);
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on some platforms
2024-09-25 5:48 ` [PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on some platforms Richard Zhu
@ 2024-10-03 6:04 ` Manivannan Sadhasivam
2024-10-08 8:25 ` Hongxing Zhu
0 siblings, 1 reply; 8+ messages in thread
From: Manivannan Sadhasivam @ 2024-10-03 6:04 UTC (permalink / raw)
To: Richard Zhu
Cc: jingoohan1, kwilczynski, bhelgaas, lpieralisi, frank.li, robh,
linux-pci, linux-kernel, imx
On Wed, Sep 25, 2024 at 01:48:36PM +0800, Richard Zhu wrote:
> The dw_pcie_suspend_noirq() function currently returns success directly
> if no endpoint (EP) device is connected. However, on some platforms, power
> loss occurs during suspend, causing dw_resume() to do nothing in this case.
> This results in a system halt because the DWC controller is not initialized
> after power-on during resume.
>
> Change call to deinit() in suspend and init() at resume regardless of
s/Change call to/Call
> whether there are EP device connections or not. It is not harmful to
> perform deinit() and init() again for the no power-off case, and it keeps
> the code simple and consistent in logic.
>
> Fixes: 4774faf854f5 ("PCI: dwc: Implement generic suspend/resume functionality")
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> .../pci/controller/dwc/pcie-designware-host.c | 30 +++++++++----------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index a0822d5371bc..cb8c3c2bcc79 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -933,23 +933,23 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci)
> if (dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKCTL) & PCI_EXP_LNKCTL_ASPM_L1)
> return 0;
>
There is one more condition above. It checks whether the link is in L1ss state
or not and if it is, the just returns 0. Going by your case, if the power goes
off during suspend, then it will be an issue, right?
> - if (dw_pcie_get_ltssm(pci) <= DW_PCIE_LTSSM_DETECT_ACT)
> - return 0;
> -
> - if (pci->pp.ops->pme_turn_off)
> - pci->pp.ops->pme_turn_off(&pci->pp);
> - else
> - ret = dw_pcie_pme_turn_off(pci);
> + if (dw_pcie_get_ltssm(pci) > DW_PCIE_LTSSM_DETECT_ACT) {
> + /* Only send out PME_TURN_OFF when PCIE link is up */
Move this comment above the 'if' condition.
- Mani
> + if (pci->pp.ops->pme_turn_off)
> + pci->pp.ops->pme_turn_off(&pci->pp);
> + else
> + ret = dw_pcie_pme_turn_off(pci);
>
> - if (ret)
> - return ret;
> + if (ret)
> + return ret;
>
> - ret = read_poll_timeout(dw_pcie_get_ltssm, val, val == DW_PCIE_LTSSM_L2_IDLE,
> - PCIE_PME_TO_L2_TIMEOUT_US/10,
> - PCIE_PME_TO_L2_TIMEOUT_US, false, pci);
> - if (ret) {
> - dev_err(pci->dev, "Timeout waiting for L2 entry! LTSSM: 0x%x\n", val);
> - return ret;
> + ret = read_poll_timeout(dw_pcie_get_ltssm, val, val == DW_PCIE_LTSSM_L2_IDLE,
> + PCIE_PME_TO_L2_TIMEOUT_US/10,
> + PCIE_PME_TO_L2_TIMEOUT_US, false, pci);
> + if (ret) {
> + dev_err(pci->dev, "Timeout waiting for L2 entry! LTSSM: 0x%x\n", val);
> + return ret;
> + }
> }
>
> if (pci->pp.ops->deinit)
> --
> 2.37.1
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 2/2] PCI: dwc: Do stop link in the dw_pcie_suspend_noirq
2024-09-25 5:48 ` [PATCH v1 2/2] PCI: dwc: Do stop link in the dw_pcie_suspend_noirq Richard Zhu
2024-09-25 16:47 ` Frank Li
@ 2024-10-03 6:09 ` Manivannan Sadhasivam
1 sibling, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam @ 2024-10-03 6:09 UTC (permalink / raw)
To: Richard Zhu
Cc: jingoohan1, kwilczynski, bhelgaas, lpieralisi, frank.li, robh,
linux-pci, linux-kernel, imx
In subject,
s/Do/Always
On Wed, Sep 25, 2024 at 01:48:37PM +0800, Richard Zhu wrote:
> On i.MX8QM, PCIe link can't be re-established again in
> dw_pcie_resume_noirq(), if the LTSSM_EN bit is not cleared properly in
> dw_pcie_suspend_noirq().
>
> Add dw_pcie_stop_link() into dw_pcie_suspend_noirq() to fix this issue and
> keep symmetric in suspend/resume function since there is
> dw_pcie_start_link() in dw_pcie_resume_noirq().
>
> Fixes: 4774faf854f5 ("PCI: dwc: Implement generic suspend/resume functionality")
> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
- Mani
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index cb8c3c2bcc79..9ca33895456f 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -952,6 +952,7 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci)
> }
> }
>
> + dw_pcie_stop_link(pci);
> if (pci->pp.ops->deinit)
> pci->pp.ops->deinit(&pci->pp);
>
> --
> 2.37.1
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on some platforms
2024-10-03 6:04 ` Manivannan Sadhasivam
@ 2024-10-08 8:25 ` Hongxing Zhu
2024-10-16 18:18 ` Manivannan Sadhasivam
0 siblings, 1 reply; 8+ messages in thread
From: Hongxing Zhu @ 2024-10-08 8:25 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: jingoohan1@gmail.com, kwilczynski@kernel.org, bhelgaas@google.com,
lpieralisi@kernel.org, Frank Li, robh@kernel.org,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
> -----Original Message-----
> From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Sent: 2024年10月3日 14:04
> To: Hongxing Zhu <hongxing.zhu@nxp.com>
> Cc: jingoohan1@gmail.com; kwilczynski@kernel.org; bhelgaas@google.com;
> lpieralisi@kernel.org; Frank Li <frank.li@nxp.com>; robh@kernel.org;
> linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org; imx@lists.linux.dev
> Subject: Re: [PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on
> some platforms
>
> On Wed, Sep 25, 2024 at 01:48:36PM +0800, Richard Zhu wrote:
> > The dw_pcie_suspend_noirq() function currently returns success
> > directly if no endpoint (EP) device is connected. However, on some
> > platforms, power loss occurs during suspend, causing dw_resume() to do
> nothing in this case.
> > This results in a system halt because the DWC controller is not
> > initialized after power-on during resume.
> >
> > Change call to deinit() in suspend and init() at resume regardless of
>
> s/Change call to/Call
>
> > whether there are EP device connections or not. It is not harmful to
> > perform deinit() and init() again for the no power-off case, and it
> > keeps the code simple and consistent in logic.
> >
> > Fixes: 4774faf854f5 ("PCI: dwc: Implement generic suspend/resume
> > functionality")
> > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> > Reviewed-by: Frank Li <Frank.Li@nxp.com>
> > ---
> > .../pci/controller/dwc/pcie-designware-host.c | 30
> > +++++++++----------
> > 1 file changed, 15 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c
> > b/drivers/pci/controller/dwc/pcie-designware-host.c
> > index a0822d5371bc..cb8c3c2bcc79 100644
> > --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> > @@ -933,23 +933,23 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci)
> > if (dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKCTL) &
> PCI_EXP_LNKCTL_ASPM_L1)
> > return 0;
> >
>
> There is one more condition above. It checks whether the link is in L1ss state or
> not and if it is, the just returns 0. Going by your case, if the power goes off during
> suspend, then it will be an issue, right?
>
Hi Manivannan:
Thanks for your comments.
Yes, you're right. It's a problem that power is off in suspend when link
is in L1ss.
How about to issue another patch to fix this problem?
Since this commit is verified to fix the resume failure when no EP is
connected. I'm not sure I can combine them together or not.
Best Regards
Richard Zhu
> > - if (dw_pcie_get_ltssm(pci) <= DW_PCIE_LTSSM_DETECT_ACT)
> > - return 0;
> > -
> > - if (pci->pp.ops->pme_turn_off)
> > - pci->pp.ops->pme_turn_off(&pci->pp);
> > - else
> > - ret = dw_pcie_pme_turn_off(pci);
> > + if (dw_pcie_get_ltssm(pci) > DW_PCIE_LTSSM_DETECT_ACT) {
> > + /* Only send out PME_TURN_OFF when PCIE link is up */
>
> Move this comment above the 'if' condition.
>
> - Mani
>
> > + if (pci->pp.ops->pme_turn_off)
> > + pci->pp.ops->pme_turn_off(&pci->pp);
> > + else
> > + ret = dw_pcie_pme_turn_off(pci);
> >
> > - if (ret)
> > - return ret;
> > + if (ret)
> > + return ret;
> >
> > - ret = read_poll_timeout(dw_pcie_get_ltssm, val, val ==
> DW_PCIE_LTSSM_L2_IDLE,
> > - PCIE_PME_TO_L2_TIMEOUT_US/10,
> > - PCIE_PME_TO_L2_TIMEOUT_US, false, pci);
> > - if (ret) {
> > - dev_err(pci->dev, "Timeout waiting for L2 entry! LTSSM: 0x%x\n",
> val);
> > - return ret;
> > + ret = read_poll_timeout(dw_pcie_get_ltssm, val, val ==
> DW_PCIE_LTSSM_L2_IDLE,
> > + PCIE_PME_TO_L2_TIMEOUT_US/10,
> > + PCIE_PME_TO_L2_TIMEOUT_US, false, pci);
> > + if (ret) {
> > + dev_err(pci->dev, "Timeout waiting for L2 entry! LTSSM: 0x%x\n",
> val);
> > + return ret;
> > + }
> > }
> >
> > if (pci->pp.ops->deinit)
> > --
> > 2.37.1
> >
>
> --
> மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on some platforms
2024-10-08 8:25 ` Hongxing Zhu
@ 2024-10-16 18:18 ` Manivannan Sadhasivam
0 siblings, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam @ 2024-10-16 18:18 UTC (permalink / raw)
To: Hongxing Zhu
Cc: jingoohan1@gmail.com, kwilczynski@kernel.org, bhelgaas@google.com,
lpieralisi@kernel.org, Frank Li, robh@kernel.org,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
On Tue, Oct 08, 2024 at 08:25:32AM +0000, Hongxing Zhu wrote:
> > -----Original Message-----
> > From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > Sent: 2024年10月3日 14:04
> > To: Hongxing Zhu <hongxing.zhu@nxp.com>
> > Cc: jingoohan1@gmail.com; kwilczynski@kernel.org; bhelgaas@google.com;
> > lpieralisi@kernel.org; Frank Li <frank.li@nxp.com>; robh@kernel.org;
> > linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org; imx@lists.linux.dev
> > Subject: Re: [PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on
> > some platforms
> >
> > On Wed, Sep 25, 2024 at 01:48:36PM +0800, Richard Zhu wrote:
> > > The dw_pcie_suspend_noirq() function currently returns success
> > > directly if no endpoint (EP) device is connected. However, on some
> > > platforms, power loss occurs during suspend, causing dw_resume() to do
> > nothing in this case.
> > > This results in a system halt because the DWC controller is not
> > > initialized after power-on during resume.
> > >
> > > Change call to deinit() in suspend and init() at resume regardless of
> >
> > s/Change call to/Call
> >
> > > whether there are EP device connections or not. It is not harmful to
> > > perform deinit() and init() again for the no power-off case, and it
> > > keeps the code simple and consistent in logic.
> > >
> > > Fixes: 4774faf854f5 ("PCI: dwc: Implement generic suspend/resume
> > > functionality")
> > > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
> > > Reviewed-by: Frank Li <Frank.Li@nxp.com>
> > > ---
> > > .../pci/controller/dwc/pcie-designware-host.c | 30
> > > +++++++++----------
> > > 1 file changed, 15 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c
> > > b/drivers/pci/controller/dwc/pcie-designware-host.c
> > > index a0822d5371bc..cb8c3c2bcc79 100644
> > > --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> > > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> > > @@ -933,23 +933,23 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci)
> > > if (dw_pcie_readw_dbi(pci, offset + PCI_EXP_LNKCTL) &
> > PCI_EXP_LNKCTL_ASPM_L1)
> > > return 0;
> > >
> >
> > There is one more condition above. It checks whether the link is in L1ss state or
> > not and if it is, the just returns 0. Going by your case, if the power goes off during
> > suspend, then it will be an issue, right?
> >
> Hi Manivannan:
> Thanks for your comments.
> Yes, you're right. It's a problem that power is off in suspend when link
> is in L1ss.
> How about to issue another patch to fix this problem?
> Since this commit is verified to fix the resume failure when no EP is
> connected. I'm not sure I can combine them together or not.
>
Fine with me.
- Mani
> Best Regards
> Richard Zhu
> > > - if (dw_pcie_get_ltssm(pci) <= DW_PCIE_LTSSM_DETECT_ACT)
> > > - return 0;
> > > -
> > > - if (pci->pp.ops->pme_turn_off)
> > > - pci->pp.ops->pme_turn_off(&pci->pp);
> > > - else
> > > - ret = dw_pcie_pme_turn_off(pci);
> > > + if (dw_pcie_get_ltssm(pci) > DW_PCIE_LTSSM_DETECT_ACT) {
> > > + /* Only send out PME_TURN_OFF when PCIE link is up */
> >
> > Move this comment above the 'if' condition.
> >
> > - Mani
> >
> > > + if (pci->pp.ops->pme_turn_off)
> > > + pci->pp.ops->pme_turn_off(&pci->pp);
> > > + else
> > > + ret = dw_pcie_pme_turn_off(pci);
> > >
> > > - if (ret)
> > > - return ret;
> > > + if (ret)
> > > + return ret;
> > >
> > > - ret = read_poll_timeout(dw_pcie_get_ltssm, val, val ==
> > DW_PCIE_LTSSM_L2_IDLE,
> > > - PCIE_PME_TO_L2_TIMEOUT_US/10,
> > > - PCIE_PME_TO_L2_TIMEOUT_US, false, pci);
> > > - if (ret) {
> > > - dev_err(pci->dev, "Timeout waiting for L2 entry! LTSSM: 0x%x\n",
> > val);
> > > - return ret;
> > > + ret = read_poll_timeout(dw_pcie_get_ltssm, val, val ==
> > DW_PCIE_LTSSM_L2_IDLE,
> > > + PCIE_PME_TO_L2_TIMEOUT_US/10,
> > > + PCIE_PME_TO_L2_TIMEOUT_US, false, pci);
> > > + if (ret) {
> > > + dev_err(pci->dev, "Timeout waiting for L2 entry! LTSSM: 0x%x\n",
> > val);
> > > + return ret;
> > > + }
> > > }
> > >
> > > if (pci->pp.ops->deinit)
> > > --
> > > 2.37.1
> > >
> >
> > --
> > மணிவண்ணன் சதாசிவம்
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-10-16 18:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-25 5:48 [PATCH v1 0/2] Bug fixes when dwc generic suspend/resume functions are used Richard Zhu
2024-09-25 5:48 ` [PATCH v1 1/2] PCI: dwc: Fix resume failure if no EP is connected on some platforms Richard Zhu
2024-10-03 6:04 ` Manivannan Sadhasivam
2024-10-08 8:25 ` Hongxing Zhu
2024-10-16 18:18 ` Manivannan Sadhasivam
2024-09-25 5:48 ` [PATCH v1 2/2] PCI: dwc: Do stop link in the dw_pcie_suspend_noirq Richard Zhu
2024-09-25 16:47 ` Frank Li
2024-10-03 6:09 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox