]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[xhci] Set link state to RxDetect after disabling USB3 root hub port
authorMichael Brown <mcb30@ipxe.org>
Thu, 2 Jul 2020 21:53:11 +0000 (22:53 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 3 Jul 2020 11:10:04 +0000 (12:10 +0100)
The "disabled" port states for USB2 and USB3 are not directly
equivalent.  In particular, a disabled USB3 port will not detect new
device connections.  The result is that a USB3 device disconnected
from and reconnected to an xHCI root hub port will end up reconnecting
as a USB2 device.

Fix by setting the link state to RxDetect after disabling the port, as
is already done during initialisation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/usb/xhci.c

index e9a7f4c6524af63a5e1f85628ca8b2c0bf4b72f4..21c3e00015aee72ee59d9454ba8e8e5e152df216 100644 (file)
@@ -3051,6 +3051,19 @@ static int xhci_root_disable ( struct usb_hub *hub, struct usb_port *port ) {
        portsc |= XHCI_PORTSC_PED;
        writel ( portsc, xhci->op + XHCI_OP_PORTSC ( port->address ) );
 
+       /* Allow time for link state to stabilise */
+       mdelay ( XHCI_LINK_STATE_DELAY_MS );
+
+       /* Set link state to RxDetect for USB3 ports */
+       if ( port->protocol >= USB_PROTO_3_0 ) {
+               portsc &= XHCI_PORTSC_PRESERVE;
+               portsc |= ( XHCI_PORTSC_PLS_RXDETECT | XHCI_PORTSC_LWS );
+               writel ( portsc, xhci->op + XHCI_OP_PORTSC ( port->address ) );
+       }
+
+       /* Allow time for link state to stabilise */
+       mdelay ( XHCI_LINK_STATE_DELAY_MS );
+
        return 0;
 }