* [PATCH] usb: pci-quirks: disable D3cold on xhci suspend for s2idle
@ 2021-02-05 11:32 Prike Liang
2021-02-05 11:50 ` Shyam Sundar S K
0 siblings, 1 reply; 3+ messages in thread
From: Prike Liang @ 2021-02-05 11:32 UTC (permalink / raw)
To: linux-usb
Cc: greg, mathias.nyman, Shyam-sundar.S-k, Alexander.Deucher,
Ramakanth.Akkenepalli, Jack.Xie, 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.
Signed-off-by: Prike Liang <Prike.Liang@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 3feaafe..8ecde66 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -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)
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index ea1754f..fafa044 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: pci-quirks: disable D3cold on xhci suspend for s2idle
2021-02-05 11:32 [PATCH] usb: pci-quirks: disable D3cold on xhci suspend for s2idle Prike Liang
@ 2021-02-05 11:50 ` Shyam Sundar S K
2021-02-05 12:04 ` Liang, Prike
0 siblings, 1 reply; 3+ messages in thread
From: Shyam Sundar S K @ 2021-02-05 11:50 UTC (permalink / raw)
To: Prike Liang, linux-usb
Cc: greg, mathias.nyman, Alexander.Deucher, Ramakanth.Akkenepalli, Jack.Xie
This has to be with the patch revision number, i.e. [PATCH v2] , [PATCH v3] etc.
On 2/5/2021 5:02 PM, Prike Liang wrote:
> 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.
>
> Signed-off-by: Prike Liang <Prike.Liang@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 3feaafe..8ecde66 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -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)
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index ea1754f..fafa044 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -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
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] usb: pci-quirks: disable D3cold on xhci suspend for s2idle
2021-02-05 11:50 ` Shyam Sundar S K
@ 2021-02-05 12:04 ` Liang, Prike
0 siblings, 0 replies; 3+ messages in thread
From: Liang, Prike @ 2021-02-05 12:04 UTC (permalink / raw)
To: S-k, Shyam-sundar, linux-usb
Cc: greg, mathias.nyman, Deucher, Alexander, Akkenepalli, Ramakanth,
Xie, Jack
>
> This has to be with the patch revision number, i.e. [PATCH v2] , [PATCH v3]
> etc.
>
> On 2/5/2021 5:02 PM, Prike Liang wrote:
> > 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.
> >
> > Signed-off-by: Prike Liang <Prike.Liang@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 3feaafe..8ecde66 100644
> > --- a/drivers/usb/host/xhci-pci.c
> > +++ b/drivers/usb/host/xhci-pci.c
> > @@ -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) diff --git
> > a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index
> > ea1754f..fafa044 100644
> > --- a/drivers/usb/host/xhci.h
> > +++ b/drivers/usb/host/xhci.h
> > @@ -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
[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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-05 12:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 11:32 [PATCH] usb: pci-quirks: disable D3cold on xhci suspend for s2idle Prike Liang
2021-02-05 11:50 ` Shyam Sundar S K
2021-02-05 12:04 ` Liang, Prike
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).