Skip to contentSkip to conversation

usb: pci-quirks: disable D3cold on xhci suspend for s2idle

PATCH Superseded Prike Liang 2 participants 3 messages Feb 5, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: pci-quirks: disable D3cold on xhci suspend for s2idle

The XHCI is required enter D3hot rather than D3cold for AMD s2idle solution. Otherwise, the 'Controller Not Ready' (CNR) bit not being cleared by host in resume and eventually result in xhci resume failed in s2idle wakeup period.

---
 drivers/usb/host/xhci-pci.c | 6 +++++-
 drivers/usb/host/xhci.h     | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +5 -1
index 3feaafe..8ecde66 100644
@@ -170,6 +170,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;
@@ -500,7 +504,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)
drivers/usb/host/xhci.h +1 -0
index ea1754f..fafa044 100644
@@ -1874,6 +1874,7 @@ struct xhci_hcd {
 #define XHCI_RESET_PLL_ON_DISCONNECT	BIT_ULL(34)
 #define XHCI_SNPS_BROKEN_SUSPEND    BIT_ULL(35)
 #define XHCI_RENESAS_FW_QUIRK	BIT_ULL(36)
+#define XHCI_AMD_S2IDL_SUPPORT_QUIRK   BIT_ULL(37)
 
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
Signature · 1 line
2.7.4
#1 lore raw

This has to be with the patch revision number, i.e. [PATCH v2] , [PATCH v3] etc.

Quoted 39 lines · Prike Liang

The XHCI is required enter D3hot rather than D3cold for AMD s2idle solution. Otherwise, the 'Controller Not Ready' (CNR) bit not being cleared by host in resume and eventually result in xhci resume failed in s2idle wakeup period.

---
 drivers/usb/host/xhci-pci.c | 6 +++++-
 drivers/usb/host/xhci.h     | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +5 -1
index 3feaafe..8ecde66 100644
@@ -170,6 +170,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;
@@ -500,7 +504,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)
drivers/usb/host/xhci.h +0 -0
index ea1754f..fafa044 100644

drivers/usb/host/xhci.h struct xhci_hcd { · line 1877

Quoted 4 lines
drivers/usb/host/xhci.h +1 -0
@@ -1874,6 +1874,7 @@ struct xhci_hcd {
 #define XHCI_RESET_PLL_ON_DISCONNECT	BIT_ULL(34)
 #define XHCI_SNPS_BROKEN_SUSPEND    BIT_ULL(35)
 #define XHCI_RENESAS_FW_QUIRK	BIT_ULL(36)
+#define XHCI_AMD_S2IDL_SUPPORT_QUIRK   BIT_ULL(37)

Why don't we keep it the fullname i.e. XHCI_AMD_S2IDLE_SUPPORT_QUIRK instead of XHCI_AMD_S2IDL_SUPPORT_QUIRK, likewise at all places?

-Shyam

#2 lore raw
Quoted 59 lines

This has to be with the patch revision number, i.e. [PATCH v2] , [PATCH v3] etc.

Quoted 1 line · Prike Liang

The XHCI is required enter D3hot rather than D3cold for AMD s2idle

solution.

Quoted 2 lines

Otherwise, the 'Controller Not Ready' (CNR) bit not being cleared by host in resume and eventually result in xhci resume failed in s2idle wakeup

period.

drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device *dev,

Quoted 12 lines
---
 drivers/usb/host/xhci-pci.c | 6 +++++-
 drivers/usb/host/xhci.h     | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +0 -0
index 3feaafe..8ecde66 100644
@@ -170,6 +170,10 @@ static void xhci_pci_quirks(struct device *dev,

struct xhci_hcd *xhci)

drivers/usb/host/xhci-pci.c static int xhci_pci_suspend(struct usb_hcd *hcd,

Quoted 11 lines
drivers/usb/host/xhci-pci.c +4 -0
 		(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;
@@ -500,7 +504,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd,

bool do_wakeup)

Quoted 14 lines
drivers/usb/host/xhci-pci.c +2 -1
 	 * 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 ea1754f..fafa044 100644

drivers/usb/host/xhci.h struct xhci_hcd { · line 1877

Quoted 4 lines
drivers/usb/host/xhci.h +1 -0
@@ -1874,6 +1874,7 @@ struct xhci_hcd {
 #define XHCI_RESET_PLL_ON_DISCONNECT	BIT_ULL(34)
 #define XHCI_SNPS_BROKEN_SUSPEND    BIT_ULL(35)
 #define XHCI_RENESAS_FW_QUIRK	BIT_ULL(36)
+#define XHCI_AMD_S2IDL_SUPPORT_QUIRK   BIT_ULL(37)

Why don't we keep it the fullname i.e. XHCI_AMD_S2IDLE_SUPPORT_QUIRK instead of XHCI_AMD_S2IDL_SUPPORT_QUIRK, likewise at all places?

Quoted 1 line

-Shyam

[Prike] Thanks for your comment and the primary patch with compliance mode quirk has been dropped and this patch
seems totally different with compliance mode partial enablement fix. Anyway I will give the patch modified detail in the commit. The XHCI_AMD_S2IDL_SUPPORT_QUIRK is a typo and I will correct it.

Thanks,
Prike