diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-11 19:02:45 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-11 19:02:45 -0400 |
commit | 0552d8126be3f2ea9f03098afb5cb77049c8d606 (patch) | |
tree | 28f3392944b63e5c332a259cd85e9bf7a38acd24 /src/sys/io/usb/hcd/xhci.c | |
parent | 3fdef4036ebde968f13567288fa96d79e9670611 (diff) |
kern: usb: Poll USBSTS.CNR after reset
The host needs to wait for the controller to be ready by polling the CNR
bit as per section 4.2 of the spec
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/io/usb/hcd/xhci.c')
-rw-r--r-- | src/sys/io/usb/hcd/xhci.c | 11 |
1 files changed, 11 insertions, 0 deletions
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; } |