vers = EREAD2(sc, EHCI_HCIVERSION);
device_printf(sc->sc_bus.bdev,
"EHCI version %x.%x\n", vers >> 8, vers & 0xff);
+ /* Disable all interrupts */
+ EOWRITE4(sc, EHCI_USBINTR, 0);
sparams = EREAD4(sc, EHCI_HCSPARAMS);
DPRINTF(("ehci_init: sparams=0x%x\n", sparams));
last = new;
}
#endif
-
- if (EOREAD4(sc, EHCI_USBSTS) & sc->sc_eintrs)
- ehci_intr1(sc);
+ crit_enter();
+ ehci_intr1(sc);
+ ehci_softintr(sc);
+ crit_exit();
}
int
OHCI_REV_HI(rev), OHCI_REV_LO(rev),
OHCI_REV_LEGACY(rev) ? ", legacy support" : "");
+ /*
+ * Make sure all interrupts are disabled before we start messing
+ * with things.
+ */
+ OWRITE4(sc, OHCI_INTERRUPT_DISABLE, -1);
+
if (OHCI_REV_HI(rev) != 1 || OHCI_REV_LO(rev) != 0) {
device_printf(sc->sc_bus.bdev, "unsupported OHCI revision\n");
sc->sc_bus.usbrev = USBREV_UNKNOWN;
OWRITE4(sc, OHCI_HCCA, DMAADDR(&sc->sc_hccadma, 0));
OWRITE4(sc, OHCI_CONTROL_HEAD_ED, sc->sc_ctrl_head->physaddr);
OWRITE4(sc, OHCI_BULK_HEAD_ED, sc->sc_bulk_head->physaddr);
- /* disable all interrupts and then switch on all desired interrupts */
+ /* disable all interrupts */
OWRITE4(sc, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS);
- OWRITE4(sc, OHCI_INTERRUPT_ENABLE, sc->sc_eintrs | OHCI_MIE);
/* switch on desired functional features */
ctl = OREAD4(sc, OHCI_CONTROL);
ctl &= ~(OHCI_CBSR_MASK | OHCI_LES | OHCI_HCFS_MASK | OHCI_IR);
sc->sc_noport = OHCI_GET_NDP(OREAD4(sc, OHCI_RH_DESCRIPTOR_A));
}
+ /*
+ * Enable desired interrupts
+ */
+ OWRITE4(sc, OHCI_INTERRUPT_ENABLE, sc->sc_eintrs | OHCI_MIE);
+
#ifdef USB_DEBUG
if (ohcidebug > 5)
ohci_dumpregs(sc);
done &= ~OHCI_DONE_INTRS;
}
sc->sc_hcca->hcca_done_head = 0;
- } else
+ } else {
intrs = OREAD4(sc, OHCI_INTERRUPT_STATUS) & ~OHCI_WDH;
+ }
if (intrs == 0) /* nothing to be done (PCI shared interrupt) */
return (0);
#ifdef USB_DEBUG
static int last;
int new;
+
new = OREAD4(sc, OHCI_INTERRUPT_STATUS);
if (new != last) {
DPRINTFN(10,("ohci_poll: intrs=0x%04x\n", new));
last = new;
}
#endif
-
- if (OREAD4(sc, OHCI_INTERRUPT_STATUS) & sc->sc_eintrs)
- ohci_intr1(sc);
+ crit_enter();
+ ohci_intr1(sc);
+ ohci_softintr(sc);
+ crit_exit();
}
usbd_status