From 8136e1e162edb67bbec76cb87d036737d65e948c Mon Sep 17 00:00:00 2001 From: Prike Liang <Prike.Liang@amd.com> Date: Fri, 5 Feb 2021 16:37:15 +0800 Subject: [PATCH] usb: pci-quirks: disable D3cold on AMD xhci suspend for s2idle The XHCI Renoir USB 3.1 resume failed caused by CNR bit not cleared during s2idle resume. This issue can be workaround by disable the D3cold support on Renoir USB 3.1. Signed-off-by: Prike Liang <Prike.Liang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/usb/host/xhci-pci.c | 6 +++++- drivers/usb/host/xhci.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 84da8406d5b42..068e5c13ecf27 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -178,6 +178,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) xhci->quirks |= XHCI_U2_DISABLE_WAKE; + if (pdev->vendor == PCI_VENDOR_ID_AMD && + pdev->device == 0x1639) + xhci->quirks |= XHCI_AMD_S2IDL_SUPPORT_QUIRK; + if (pdev->vendor == PCI_VENDOR_ID_INTEL) { xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_INTEL_HOST; @@ -526,7 +530,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) * Systems with the TI redriver that loses port status change events * need to have the registers polled during D3, so avoid D3cold. */ - if (xhci->quirks & XHCI_COMP_MODE_QUIRK) + if (xhci->quirks & (XHCI_COMP_MODE_QUIRK | XHCI_AMD_S2IDL_SUPPORT_QUIRK)) pci_d3cold_disable(pdev); if (xhci->quirks & XHCI_PME_STUCK_QUIRK) diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 25e57bc9c3cc6..309d71851f6f1 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1883,6 +1883,7 @@ struct xhci_hcd { #define XHCI_SKIP_PHY_INIT BIT_ULL(37) #define XHCI_DISABLE_SPARSE BIT_ULL(38) #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39) +#define XHCI_AMD_S2IDL_SUPPORT_QUIRK BIT_ULL(40) unsigned int num_active_eps; unsigned int limit_active_eps; -- GitLab