diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp b/src/add-ons/kernel/busses/usb/xhci.cpp index 44f0e1050c..5babbd1430 100644 --- a/src/add-ons/kernel/busses/usb/xhci.cpp +++ b/src/add-ons/kernel/busses/usb/xhci.cpp @@ -516,6 +516,19 @@ XHCI::Start() dmaAddress += sizeof(xhci_erst_element) + XHCI_MAX_EVENTS * sizeof(xhci_trb); + + // Make sure the Command Ring is stopped + if ((ReadOpReg(XHCI_CRCR_LO) & CRCR_CRR) != 0) { + TRACE_ALWAYS("Command Ring is running, send stop/cancel\n"); + WriteOpReg(XHCI_CRCR_LO, CRCR_CS); + WriteOpReg(XHCI_CRCR_HI, 0); + WriteOpReg(XHCI_CRCR_LO, CRCR_CA); + WriteOpReg(XHCI_CRCR_HI, 0); + snooze(1000); + if ((ReadOpReg(XHCI_CRCR_LO) & CRCR_CRR) != 0) { + TRACE_ERROR("Command Ring still running after stop/cancel\n"); + } + } TRACE("setting CRCR addr = 0x%" B_PRIxPHYSADDR "\n", dmaAddress); WriteOpReg(XHCI_CRCR_LO, (uint32)dmaAddress | CRCR_RCS); WriteOpReg(XHCI_CRCR_HI, /*(uint32)(dmaAddress >> 32)*/0); diff --git a/src/add-ons/kernel/busses/usb/xhci_hardware.h b/src/add-ons/kernel/busses/usb/xhci_hardware.h index a9619d9d6b..b10240fb24 100644 --- a/src/add-ons/kernel/busses/usb/xhci_hardware.h +++ b/src/add-ons/kernel/busses/usb/xhci_hardware.h @@ -91,6 +91,9 @@ #define XHCI_CRCR_LO 0x18 #define XHCI_CRCR_HI 0x1C #define CRCR_RCS (1<<0) +#define CRCR_CS (1<<1) +#define CRCR_CA (1<<2) +#define CRCR_CRR (1<<3) // Section 5.4.6 #define XHCI_DCBAAP_LO 0x30 #define XHCI_DCBAAP_HI 0x34