xhci: the command ring must be stopped when setting its address.

* send stop and cancel commands.

Signed-off-by: Jérôme Duval <[email protected]>
This commit is contained in:
Greg Crain
2017-11-08 19:02:33 +01:00
committed by Jérôme Duval
parent 5ed6ef8e18
commit e344167824
2 changed files with 16 additions and 0 deletions
+13
View File
@@ -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);
@@ -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