提交 b7823489 编写于 作者: L LeoLiu-oc 提交者: Cheng Jian

xhci: Show Zhaoxin XHCI root hub speed correctly

zhaoxin inclusion
category: feature
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=19
CVE: NA

----------------------------------------------------------------

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: NLeoLiu-oc <LeoLiu-oc@zhaoxin.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Reviewed-by: NLeoLiu-oc <LeoLiu-oc@zhaoxin.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 46bbb3dc
...@@ -5066,6 +5066,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) ...@@ -5066,6 +5066,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
*/ */
struct device *dev = hcd->self.sysdev; struct device *dev = hcd->self.sysdev;
unsigned int minor_rev; unsigned int minor_rev;
u8 i, j;
int retval; int retval;
/* Accept arbitrarily long scatter-gather lists */ /* Accept arbitrarily long scatter-gather lists */
...@@ -5120,6 +5121,24 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) ...@@ -5120,6 +5121,24 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS;
break; break;
} }
/* usb3.1 has gen1 and gen2, Some zx's xHCI controller that follow usb3.1 spec
* but only support gen1
*/
if (xhci->quirks & XHCI_ZHAOXIN_HOST) {
minor_rev = 0;
for (j = 0; j < xhci->num_port_caps; j++) {
for (i = 0; i < xhci->port_caps[j].psi_count; i++) {
if (XHCI_EXT_PORT_PSIV(xhci->port_caps[j].psi[i]) >= 5)
minor_rev = 1;
}
if (minor_rev != 1) {
hcd->speed = HCD_USB3;
hcd->self.root_hub->speed = USB_SPEED_SUPER;
}
}
}
xhci_info(xhci, "Host supports USB 3.%x %sSuperSpeed\n", xhci_info(xhci, "Host supports USB 3.%x %sSuperSpeed\n",
minor_rev, minor_rev,
minor_rev ? "Enhanced " : ""); minor_rev ? "Enhanced " : "");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册