summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2007-03-18 06:00:46 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2007-03-18 06:00:46 +0000
commita4aa20bbe39a4ed79d63cfde14fc8c13f34abe59 (patch)
treece3c1fa69677b5463ba0c4047aa7399867b9de5a /sys/dev
parentdda08a757bf5626de461e2fdf58d05bae67b4272 (diff)
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')
-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 035e20c94d1..056158408e2 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhub.c,v 1.34 2006/06/26 19:12:38 mjc Exp $ */
+/* $OpenBSD: uhub.c,v 1.35 2007/03/18 06:00:45 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 ed01a21d29b..c8256f255dd 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb.c,v 1.35 2006/11/01 03:37:24 tedu Exp $ */
+/* $OpenBSD: usb.c,v 1.36 2007/03/18 06:00:45 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);