From ac58358d545f15ff5cfb9608d0ee17d51a0dab3c Mon Sep 17 00:00:00 2001 From: Hasso Tepper Date: Fri, 25 Jan 2008 08:49:47 +0000 Subject: [PATCH] Speed up uhub attachment considerably. Rather than powering up each port individually then waiting for it to become stable, power them up all at once and then delay. Don't even bother delaying if we are a root hub, as this is handled separately in the event thread. My laptop boot time is cut down from 30 sec to 25 sec with this change. Obtained-from: OpenBSD via NetBSD --- sys/bus/usb/uhub.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/bus/usb/uhub.c b/sys/bus/usb/uhub.c index 7d90b2984f..c96a4df261 100644 --- a/sys/bus/usb/uhub.c +++ b/sys/bus/usb/uhub.c @@ -1,6 +1,6 @@ /* $NetBSD: uhub.c,v 1.68 2004/06/29 06:30:05 mycroft Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.69.2.1 2005/12/18 15:51:31 iedowse Exp $ */ -/* $DragonFly: src/sys/bus/usb/uhub.c,v 1.19 2007/11/06 07:37:00 hasso Exp $ */ +/* $DragonFly: src/sys/bus/usb/uhub.c,v 1.20 2008/01/25 08:49:47 hasso Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -345,10 +345,12 @@ uhub_attach(device_t self) device_get_nameunit(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 if we are not a root hub */ + if (dev->powersrc->parent != NULL) + usbd_delay_ms(dev, pwrdly); + /* The usual exploration will finish the setup. */ sc->sc_running = 1; -- 2.11.4.GIT