diff options
author | Christopher Pascoe <pascoe@cvs.openbsd.org> | 2006-08-22 01:34:09 +0000 |
---|---|---|
committer | Christopher Pascoe <pascoe@cvs.openbsd.org> | 2006-08-22 01:34:09 +0000 |
commit | 05d967276b6b43a3f9d9d15b208097b25cbe9a20 (patch) | |
tree | 33e13974c50bb2202534d3f59b4a9d77aa01f3c5 | |
parent | 22d5fd5e677c2603663a7a19cb1f79ab1a76a600 (diff) |
Be more aggressive about waiting for the host controller doorbell,
re-requesting it at half second intervals for up to five seconds.
ok dlg@
-rw-r--r-- | sys/dev/usb/ehci.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index 598447a9cf8..7a0364e53fd 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci.c,v 1.65 2006/08/17 03:44:56 pascoe Exp $ */ +/* $OpenBSD: ehci.c,v 1.66 2006/08/22 01:34:08 pascoe Exp $ */ /* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */ /* @@ -1512,6 +1512,7 @@ void ehci_sync_hc(ehci_softc_t *sc) { int s, error; + int tries = 0; if (sc->sc_dying) { DPRINTFN(2,("ehci_sync_hc: dying\n")); @@ -1521,13 +1522,17 @@ ehci_sync_hc(ehci_softc_t *sc) /* get doorbell */ usb_lockmgr(&sc->sc_doorbell_lock, LK_EXCLUSIVE, NULL, curproc); s = splhardusb(); - /* ask for doorbell */ - EOWRITE4(sc, EHCI_USBCMD, EOREAD4(sc, EHCI_USBCMD) | EHCI_CMD_IAAD); - DPRINTFN(1,("ehci_sync_hc: cmd=0x%08x sts=0x%08x\n", - EOREAD4(sc, EHCI_USBCMD), EOREAD4(sc, EHCI_USBSTS))); - error = tsleep(&sc->sc_async_head, PZERO, "ehcidi", hz); /* bell wait */ - DPRINTFN(1,("ehci_sync_hc: cmd=0x%08x sts=0x%08x\n", - EOREAD4(sc, EHCI_USBCMD), EOREAD4(sc, EHCI_USBSTS))); + do { + /* ask for doorbell */ + EOWRITE4(sc, EHCI_USBCMD, EOREAD4(sc, EHCI_USBCMD) | + EHCI_CMD_IAAD); + DPRINTFN(1,("ehci_sync_hc: cmd=0x%08x sts=0x%08x\n", + EOREAD4(sc, EHCI_USBCMD), EOREAD4(sc, EHCI_USBSTS))); + /* bell wait */ + error = tsleep(&sc->sc_async_head, PZERO, "ehcidi", hz / 2); + DPRINTFN(1,("ehci_sync_hc: cmd=0x%08x sts=0x%08x\n", + EOREAD4(sc, EHCI_USBCMD), EOREAD4(sc, EHCI_USBSTS))); + } while (error && ++tries < 10); splx(s); /* release doorbell */ usb_lockmgr(&sc->sc_doorbell_lock, LK_RELEASE, NULL, curproc); |