summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2007-03-22 05:45:58 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2007-03-22 05:45:58 +0000
commit24e49178717ca01e2548985701c1ba971751050f (patch)
tree78ff1d444f1d7ca12d3b39201712a7f1e6da24a7 /sys/dev/usb
parentb93fdb088d782a58fa4cf8574f67f6e2b426d4d4 (diff)
Reapplication of rev 1.36.
Wait the stable power delay on a USB hub only once per hub (not per port), and defer the delay for root hubs until the host controller event thread starts, permitting some concurrency. Speeds up the boot process dramatically when you have lots of host controllers. ok dlg@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/uhub.c8
-rw-r--r--sys/dev/usb/usb.c8
2 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index 631607cdb14..31f0990b9ab 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhub.c,v 1.36 2007/03/18 20:14:51 mglocker Exp $ */
+/* $OpenBSD: uhub.c,v 1.37 2007/03/22 05:45:57 pascoe Exp $ */
/* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
@@ -338,10 +338,12 @@ USB_ATTACH(uhub)
USBDEVNAME(sc->sc_dev), port,
usbd_errstr(err));
DPRINTF(("usb_init_port: turn on port %d power\n", port));
- /* Wait for stable power. */
- usbd_delay_ms(dev, pwrdly);
}
+ /* Wait for stable power. Root hubs delay in their event thread. */
+ if (dev->powersrc->parent != NULL)
+ usbd_delay_ms(dev, pwrdly);
+
/* The usual exploration will finish the setup. */
sc->sc_running = 1;
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index b8012f31e27..3c18886ff01 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb.c,v 1.37 2007/03/18 20:14:51 mglocker Exp $ */
+/* $OpenBSD: usb.c,v 1.38 2007/03/22 05:45:57 pascoe Exp $ */
/* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */
/*
@@ -304,9 +304,15 @@ void
usb_event_thread(void *arg)
{
struct usb_softc *sc = arg;
+ int pwrdly;
DPRINTF(("usb_event_thread: start\n"));
+ /* Wait for power to come good. */
+ pwrdly = sc->sc_bus->root_hub->hub->hubdesc.bPwrOn2PwrGood *
+ UHD_PWRON_FACTOR + USB_EXTRA_POWER_UP_TIME;
+ usb_delay_ms(sc->sc_bus, pwrdly);
+
/* USB1 threads wait for USB2 threads to finish their first probe. */
while (sc->sc_bus->usbrev != USBREV_2_0 && threads_pending)
(void)tsleep((void *)&threads_pending, PWAIT, "config", 0);