diff mbox series

[v3,1/4] xhci: Add some quirks for zhaoxin xhci to fix issues

Message ID 20230506201536.7362-2-WeitaoWang-oc@zhaoxin.com
State New
Headers show
Series Fix some issues of xHCI for zhaoxin | expand

Commit Message

Weitao Wang May 6, 2023, 8:15 p.m. UTC
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: stable@vger.kernel.org
Signed-off-by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
---
 drivers/usb/host/xhci-pci.c | 12 ++++++++++++
 drivers/usb/host/xhci.h     |  2 ++
 2 files changed, 14 insertions(+)

Comments

Mathias Nyman May 8, 2023, 9:01 a.m. UTC | #1
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: stable@vger.kernel.org
> Signed-off-by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>


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
diff mbox series

Patch

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;