From f0275f1b2364648f26bbfcd58ab6a214d4ab1827 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 3 Apr 2024 17:19:48 -0400 Subject: kernel: xhci: Fix cycle bit handling Set cycle bit initially to 1, invert cycle bit after submitting command to command ring. Signed-off-by: Ian Moffett --- sys/dev/usb/xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index 90d37fe..a433fb9 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -112,6 +112,7 @@ xhci_submit_cmd(struct xhci_hc *hc, struct xhci_trb trb) /* Push the TRB to the command ring */ cmd_db = XHCI_CMD_DB(hc->base, caps->dboff); hc->cmd_ring[hc->cmd_ptr++] = trb; + hc->cycle = ~hc->cycle; /* Wrap if needed */ if (hc->cmd_ptr >= XHCI_CMDRING_LEN) { @@ -368,7 +369,7 @@ xhci_init_hc(struct xhci_hc *hc) } /* Set cmdring state */ - hc->cycle = 0; + hc->cycle = 1; hc->cmd_ptr = 0; /* Allocate resources and tell the HC about them */ -- cgit v1.2.3