diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sys/include/io/usb/xhciregs.h | 6 | ||||
-rw-r--r-- | src/sys/io/usb/hcd/xhci.c | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/sys/include/io/usb/xhciregs.h b/src/sys/include/io/usb/xhciregs.h index ebaf5d7..85a8630 100644 --- a/src/sys/include/io/usb/xhciregs.h +++ b/src/sys/include/io/usb/xhciregs.h @@ -77,6 +77,12 @@ struct __packed xhci_opregs { */ #define USBCMD_HCRST BIT(1) /* Host controller reset */ +/* + * USB status register bits + * + * See section 5.4.2 of the xHCI spec + */ +#define USBSTS_CNR BIT(11) /* Controller not ready */ /* * Macros to get various register spaces diff --git a/src/sys/io/usb/hcd/xhci.c b/src/sys/io/usb/hcd/xhci.c index 8d3b0a0..f363bcf 100644 --- a/src/sys/io/usb/hcd/xhci.c +++ b/src/sys/io/usb/hcd/xhci.c @@ -116,6 +116,17 @@ xhci_reset_hc(struct xhci_hcd *hcd) return error; } + /* + * Section 4.2 of the XHCI spec states that we also + * need to wait for the controller to be ready via + * the USBSTS.CNR (controller not ready) bit + */ + error = xhci_poll32(&opregs->usbcmd, USBSTS_CNR, false); + if (error < 0) { + pr_trace("hang waiting for controller ready\n"); + return error; + } + return 0; } |