2023-05-06 12:17:58

by Weitao Wang

[permalink] [raw]
Subject: [PATCH v3 1/4] xhci: Add some quirks for zhaoxin xhci to fix issues

Add a quirk XHCI_ZHAOXIN_HOST for zhaoxin xhci to fix issues,
there are two cases will be used.
- add u1/u2 support.
- fix xHCI root hub speed show issue in zhaoxin platform.

Add a quirk XHCI_ZHAOXIN_TRB_FETCH to fix TRB prefetch issue.

On Zhaoxin ZX-100 project, xHCI can't work normally after resume
from system Sx state. To fix this issue, when resume from system
Sx state, reinitialize xHCI instead of restore.
So, Add XHCI_RESET_ON_RESUME quirk for ZX-100 to fix issue of
resuming from system Sx state.

Cc: [email protected]
Signed-off-by: Weitao Wang <[email protected]>
---
drivers/usb/host/xhci-pci.c | 12 ++++++++++++
drivers/usb/host/xhci.h | 2 ++
2 files changed, 14 insertions(+)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index ddb79f23fb3b..3fd73fceb678 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -527,6 +527,18 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4))
xhci->quirks |= XHCI_NO_SOFT_RETRY;

+ if (pdev->vendor == PCI_VENDOR_ID_ZHAOXIN) {
+ xhci->quirks |= XHCI_LPM_SUPPORT;
+ xhci->quirks |= XHCI_ZHAOXIN_HOST;
+
+ if (pdev->device == 0x9202) {
+ xhci->quirks |= XHCI_RESET_ON_RESUME;
+ xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH;
+ }
+ if (pdev->device == 0x9203)
+ xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH;
+ }
+
/* xHC spec requires PCI devices to support D3hot and D3cold */
if (xhci->hci_version >= 0x120)
xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 08d721921b7b..5fe1238eeb2d 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1905,6 +1905,8 @@ struct xhci_hcd {
#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42)
#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43)
#define XHCI_RESET_TO_DEFAULT BIT_ULL(44)
+#define XHCI_ZHAOXIN_HOST BIT_ULL(45)
+#define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(46)

unsigned int num_active_eps;
unsigned int limit_active_eps;
--
2.32.0


2023-05-08 09:32:10

by Mathias Nyman

[permalink] [raw]
Subject: Re: [PATCH v3 1/4] xhci: Add some quirks for zhaoxin xhci to fix issues

On 6.5.2023 23.15, Weitao Wang wrote:
> Add a quirk XHCI_ZHAOXIN_HOST for zhaoxin xhci to fix issues,
> there are two cases will be used.
> - add u1/u2 support.
> - fix xHCI root hub speed show issue in zhaoxin platform.
>
> Add a quirk XHCI_ZHAOXIN_TRB_FETCH to fix TRB prefetch issue.
>
> On Zhaoxin ZX-100 project, xHCI can't work normally after resume
> from system Sx state. To fix this issue, when resume from system
> Sx state, reinitialize xHCI instead of restore.
> So, Add XHCI_RESET_ON_RESUME quirk for ZX-100 to fix issue of
> resuming from system Sx state.
>
> Cc: [email protected]
> Signed-off-by: Weitao Wang <[email protected]>


I'd split this series into different logical parts:

patch 1/4
Set XHCI_RESET_ON_RESUME quirk to ZHAOXIN host to fix resume issue.
cc: stable

patch 2/4
Add XHCI_ZHAOXIN_TRB_FETCH quirk flag together with code that allocates double pages
cc: stable

patch 3/4
Add XHCI_ZHAOXIN_HOST quirk flag together with code that corrects USB3 roothub minor version
cc: stable

patch 4/4
Set XHCI_LPM_SUPPORT quirk together with code that sets tier policy and u1/u2 timeouts,
Don't add stable as this is about adding feature support.

(Accidentally replied to older v2 series with the above comments)

Thanks
-Mathias

2023-05-08 09:40:53

by Weitao Wang

[permalink] [raw]
Subject: Re: [PATCH v3 1/4] xhci: Add some quirks for zhaoxin xhci to fix issues

On 2023/5/8 17:01, Mathias Nyman wrote:
> On 6.5.2023 23.15, Weitao Wang wrote:
>> Add a quirk XHCI_ZHAOXIN_HOST for zhaoxin xhci to fix issues,
>> there are two cases will be used.
>> - add u1/u2 support.
>> - fix xHCI root hub speed show issue in zhaoxin platform.
>>
>> Add a quirk XHCI_ZHAOXIN_TRB_FETCH to fix TRB prefetch issue.
>>
>> On Zhaoxin ZX-100 project, xHCI can't work normally after resume
>> from system Sx state. To fix this issue, when resume from system
>> Sx state, reinitialize xHCI instead of restore.
>> So, Add XHCI_RESET_ON_RESUME quirk for ZX-100 to fix issue of
>> resuming from system Sx state.
>>
>> Cc: [email protected]
>> Signed-off-by: Weitao Wang <[email protected]>
>
>
> I'd split this series into different logical parts:
>
> patch 1/4
>   Set XHCI_RESET_ON_RESUME quirk to ZHAOXIN host to fix resume issue.
>   cc: stable
>
> patch 2/4
>   Add XHCI_ZHAOXIN_TRB_FETCH quirk flag together with code that allocates double pages
>   cc: stable
>
> patch 3/4
>   Add XHCI_ZHAOXIN_HOST quirk flag together with code that corrects USB3 roothub minor
> version
>   cc: stable
>
> patch 4/4
>   Set XHCI_LPM_SUPPORT quirk together with code that sets tier policy and u1/u2 timeouts,
>   Don't add stable as this is about adding feature support.
>
Okay,no problem, I'll modify this patch series according to
above solution and order in the next version.

Best Regards,
Weitao
> (Accidentally replied to older v2 series with the above comments)
>
> Thanks
> -Mathias
>
> .