在 2021/3/29 14:31, Artie Ding 写道:
在 2021/3/26 下午7:23, LeoLiu-oc 写道:
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.
v1->v2:
- Use quirks instead of vendor id.
Signed-off-by: LeoLiu-oc <LeoLiu-oc(a)zhaoxin.com>
LGTM
Sorry, We just found a issue of code logic. I'll provide a V3 patch to
fix it.
LeoLiu
Reviewed-by: Artie Ding
<artie.ding(a)openanolis.org>
> ---
> drivers/usb/host/xhci.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 326dd640a5ff..4cfad3b8b574 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -5065,6 +5065,7 @@ int xhci_gen_setup(struct usb_hcd *hcd,
> xhci_get_quirks_t get_quirks)
> */
> struct device *dev = hcd->self.sysdev;
> unsigned int minor_rev;
> + u8 i;
> int retval;
>
> /* Accept arbitrarily long scatter-gather lists */
> @@ -5119,6 +5120,22 @@ 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 (xhci->quirks == XHCI_ZHAOXIN_HOST) {
The above sentence should be"xhci->quirks & XHCI_ZHAOXIN_HOST" not
"=="
LeoLiu
> + minor_rev = 0;
> + for (i = 0; i < xhci->usb3_rhub.psi_count; i++) {
> + if (XHCI_EXT_PORT_PSIV(xhci->usb3_rhub.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",
> minor_rev,
> minor_rev ? "Enhanced " : "");