linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] usb: pci-quirks: disable D3cold on xhci suspend for s2idle on AMD Renoire
@ 2021-05-05  6:16 Mario Limonciello
  2021-05-27  5:48 ` Jiri Slaby
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Limonciello @ 2021-05-05  6:16 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman
  Cc: open list:USB XHCI DRIVER, Mario Limonciello, Prike Liang

The XHCI controller is required to enter D3hot rather than D3cold for AMD
s2idle on this hardware generation.

Otherwise, the 'Controller Not Ready' (CNR) bit is not being cleared by host
in resume and eventually this results in xhci resume failures during the
s2idle wakeup.

Suggested-by: Prike Liang <Prike.Liang@amd.com>
Link: https://lore.kernel.org/linux-usb/1612527609-7053-1-git-send-email-Prike.Liang@amd.com/
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/usb/host/xhci-pci.c | 7 ++++++-
 drivers/usb/host/xhci.h     | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

v1 -> v2: drop the XHCI_COMP_MODE_QUIRK quirk and create a new one for handling
XHCI D3cold.

v2 -> v3: correct the quirk name typo XHCI_AMD_S2IDL_SUPPORT_QUIRK -> XHCI_AMD_S2IDLE_SUPPORT_QUIRK

v3 -> v4: Fix commit message to clarify and reference HW
          Rename quirk to describe problem, not hardware
          Add definition for the hardware to source
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 5bbccc9a0179..7930edf8ebd1 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -58,6 +58,7 @@
 #define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI		0x9a13
 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI		0x1138
 
+#define PCI_DEVICE_ID_AMD_RENOIRE_XHCI			0x1639
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4			0x43b9
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_3			0x43ba
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_2			0x43bb
@@ -179,6 +180,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 == PCI_DEVICE_ID_AMD_RENOIRE_XHCI)
+		xhci->quirks |= XHCI_BROKEN_D3COLD;
+
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
 		xhci->quirks |= XHCI_LPM_SUPPORT;
 		xhci->quirks |= XHCI_INTEL_HOST;
@@ -535,7 +540,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_BROKEN_D3COLD))
 		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 ca822ad3b65b..4e171099d2cb 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1892,6 +1892,7 @@ struct xhci_hcd {
 #define XHCI_DISABLE_SPARSE	BIT_ULL(38)
 #define XHCI_SG_TRB_CACHE_SIZE_QUIRK	BIT_ULL(39)
 #define XHCI_NO_SOFT_RETRY	BIT_ULL(40)
+#define XHCI_BROKEN_D3COLD	BIT_ULL(41)
 
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
-- 
2.25.1


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

* Re: [PATCH v4] usb: pci-quirks: disable D3cold on xhci suspend for s2idle on AMD Renoire
  2021-05-05  6:16 [PATCH v4] usb: pci-quirks: disable D3cold on xhci suspend for s2idle on AMD Renoire Mario Limonciello
@ 2021-05-27  5:48 ` Jiri Slaby
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2021-05-27  5:48 UTC (permalink / raw)
  To: Mario Limonciello, Mathias Nyman, Greg Kroah-Hartman
  Cc: open list:USB XHCI DRIVER, Prike Liang

On 05. 05. 21, 8:16, Mario Limonciello wrote:
> The XHCI controller is required to enter D3hot rather than D3cold for AMD
> s2idle on this hardware generation.
> 
> Otherwise, the 'Controller Not Ready' (CNR) bit is not being cleared by host
> in resume and eventually this results in xhci resume failures during the
> s2idle wakeup.
> 
> Suggested-by: Prike Liang <Prike.Liang@amd.com>
> Link: https://lore.kernel.org/linux-usb/1612527609-7053-1-git-send-email-Prike.Liang@amd.com/
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>   drivers/usb/host/xhci-pci.c | 7 ++++++-
>   drivers/usb/host/xhci.h     | 1 +
>   2 files changed, 7 insertions(+), 1 deletion(-)
> 
> v1 -> v2: drop the XHCI_COMP_MODE_QUIRK quirk and create a new one for handling
> XHCI D3cold.
> 
> v2 -> v3: correct the quirk name typo XHCI_AMD_S2IDL_SUPPORT_QUIRK -> XHCI_AMD_S2IDLE_SUPPORT_QUIRK
> 
> v3 -> v4: Fix commit message to clarify and reference HW
>            Rename quirk to describe problem, not hardware
>            Add definition for the hardware to source
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index 5bbccc9a0179..7930edf8ebd1 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -58,6 +58,7 @@
>   #define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI		0x9a13
>   #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI		0x1138
>   
> +#define PCI_DEVICE_ID_AMD_RENOIRE_XHCI			0x1639

Isn't it RENOIR as the painter?

regards,
-- 
js
suse labs

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

end of thread, other threads:[~2021-05-27  5:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05  6:16 [PATCH v4] usb: pci-quirks: disable D3cold on xhci suspend for s2idle on AMD Renoire Mario Limonciello
2021-05-27  5:48 ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).