On 2021/3/25 下午7:26, 丁宁(富邻) wrote:
Please use quirks instead of vendor id in generic code.
Ok. We will provide a second version of this patch soon.
Sincerely
LeoLiu-oc
BR
Artie Ding
------------------------------------------------------------------
发件人:LeoLiu-oc <LeoLiu-oc(a)zhaoxin.com>
发送时间:2021年3月22日(星期一) 18:45
收件人:cloud-kernel <cloud-kernel(a)lists.openanolis.org>
抄 送:TonyWWang-oc <TonyWWang-oc(a)zhaoxin.com>om>; TimGuo
<TimGuo(a)zhaoxin.com>om>; CobeChen <CobeChen(a)zhaoxin.com>
主 题:[ck] [patch v1] ck: xhci: Show Zhaoxin XHCI root hub speed
correctly
Some Zhaoxin xHCI controllers follow usb3.1 spec,
but only support gen1 speed 5G. While in Linux kernel,
if xHCI suspport usb3.1,root hub speed will show on 10G.
To fix this issue, read usb speed ID supported by xHCI
to determine root hub speed.
The patch is scheduled to be submitted to the kernel mainline in 2021.
Signed-off-by: LeoLiu-oc <LeoLiu-oc(a)zhaoxin.com>
---
drivers/usb/host/xhci.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 65cc362717fc..6b67b58ef304 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -5035,6 +5035,8 @@ int xhci_gen_setup(struct usb_hcd *hcd,
xhci_get_quirks_t get_quirks)
*/
struct device *dev = hcd->self.sysdev;
unsigned int minor_rev;
+ struct pci_dev *pdev = to_pci_dev(dev);
+ u8 ssp_support = 1, i;
int retval;
/* Accept arbitrarily long scatter-gather lists */
@@ -5089,9 +5091,25 @@ int xhci_gen_setup(struct usb_hcd *hcd,
xhci_get_quirks_t get_quirks)
hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS;
break;
}
+
+ /* usb3.1 has gen1 and gen2, Some zx's xHCI controller that follow
usb3.1 spec
+ * but only support gen1
+ */
+ if (pdev->vendor == PCI_VENDOR_ID_ZHAOXIN) {
+ ssp_support = 0;
+ for (i = 0; i < xhci->usb3_rhub.psi_count; i++) {
+ if (XHCI_EXT_PORT_PSIV(xhci->usb3_rhub.psi[i]) >= 5)
+ ssp_support = 1;
+ }
+ if (ssp_support != 1) {
+ hcd->speed = HCD_USB3;
+ hcd->self.root_hub->speed = USB_SPEED_SUPER;
+ }
+ }
+
xhci_info(xhci, "Host supports USB 3.%x %sSuperSpeed\n",
minor_rev,
- minor_rev ? "Enhanced " : "");
+ ssp_support ? "Enhanced " : "");
xhci->usb3_rhub.hcd = hcd;
/* xHCI private pointer was set in xhci_pci_probe for the second
--
2.20.1
_______________________________________________
Cloud Kernel mailing list -- cloud-kernel(a)lists.openanolis.org
To unsubscribe send an email to cloud-kernel-leave(a)lists.openanolis.org