[PATCH v1 2/4] PCI: dwc: Add quirk to fix hang issue when send out PME_Turn_Off Msg TLP
Manivannan Sadhasivam
manivannan.sadhasivam at linaro.org
Sat May 31 10:50:15 PDT 2025
On Tue, Apr 08, 2025 at 02:52:19PM +0800, Richard Zhu wrote:
> When no endpoint is connected on i.MX7D PCIe, chip would be freeze when do
> the dummy write in dw_pcie_pme_turn_off() to issue a PME_Turn_Off Msg TLP.
>
> Add one quirk to issue the PME_Turn_Off only when link is up to avoid
> this problem on the PME_Turn_Off handshake broken platform, for example
> the i.MX7D.
>
Why do we need to send PME_Turn_Off if there is no endpoint connected? We should
skip PME_Turn_Off and L2/L3 Ready transitions in that case.
- Mani
> Signed-off-by: Richard Zhu <hongxing.zhu at nxp.com>
> ---
> .../pci/controller/dwc/pcie-designware-host.c | 16 +++++++++++-----
> drivers/pci/controller/dwc/pcie-designware.h | 1 +
> 2 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 0817df5b8a59..a62bf7e0ade8 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -956,12 +956,18 @@ 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 (pci->pp.ops->pme_turn_off) {
> - pci->pp.ops->pme_turn_off(&pci->pp);
> + if (dw_pcie_get_ltssm(pci) <= DW_PCIE_LTSSM_DETECT_WAIT &&
> + dwc_check_quirk(pci, QUIRK_NOLINK_NOPME)) {
> + /* Don't send the PME_TURN_OFF when link is down. */
> + ;
> } else {
> - ret = dw_pcie_pme_turn_off(pci);
> - if (ret)
> - return ret;
> + 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 (!dwc_check_quirk(pci, QUIRK_NOL2POLL_IN_PM)) {
> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> index 05fe654d7761..d752af660e95 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.h
> +++ b/drivers/pci/controller/dwc/pcie-designware.h
> @@ -283,6 +283,7 @@
> #define DMA_LLP_MEM_SIZE PAGE_SIZE
>
> #define QUIRK_NOL2POLL_IN_PM BIT(0)
> +#define QUIRK_NOLINK_NOPME BIT(1)
> #define dwc_check_quirk(pci, val) (pci->quirk_flag & val)
>
> struct dw_pcie;
> --
> 2.37.1
>
--
மணிவண்ணன் சதாசிவம்
More information about the linux-arm-kernel
mailing list