=== sys/dev/usb/controller/xhci.c ================================================================== --- sys/dev/usb/controller/xhci.c (revision 254832) +++ sys/dev/usb/controller/xhci.c (local) @@ -320,6 +320,12 @@ device_printf(sc->sc_bus.parent, "32 byte context size.\n"); } + temp = XREAD4(sc, oper, XHCI_USBSTS); + /* clear all pending interrupts */ + XWRITE4(sc, oper, XHCI_USBSTS, temp); + /* clear and disable leftover interrupts */ + XWRITE4(sc, runt, XHCI_IMAN(0), XHCI_IMAN_INTR_PEND); + /* Reset controller */ XWRITE4(sc, oper, XHCI_USBCMD, XHCI_CMD_HCRST); @@ -385,10 +391,6 @@ sc->sc_exit_lat_max = XHCI_HCS3_U1_DEL(temp) + XHCI_HCS3_U2_DEL(temp) + 250 /* us */; - temp = XREAD4(sc, oper, XHCI_USBSTS); - - /* clear interrupts */ - XWRITE4(sc, oper, XHCI_USBSTS, temp); /* disable all device notifications */ XWRITE4(sc, oper, XHCI_DNCTRL, 0); @@ -462,11 +464,8 @@ XWRITE4(sc, runt, XHCI_ERSTBA_HI(0), (uint32_t)(addr >> 32)); /* Setup interrupter registers */ + XWRITE4(sc, runt, XHCI_IMAN(0), XHCI_IMAN_INTR_ENA); - temp = XREAD4(sc, runt, XHCI_IMAN(0)); - temp |= XHCI_IMAN_INTR_ENA; - XWRITE4(sc, runt, XHCI_IMAN(0), temp); - /* setup command ring control base address */ addr = buf_res.physaddr; addr += (uintptr_t)&((struct xhci_hw_root *)0)->hwr_commands[0];