diff options
author | Simon Glass <sjg@chromium.org> | 2015-11-08 23:47:44 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-11-19 20:27:50 -0700 |
commit | 3884c98c32cd5fb5b5b42185d5d0575659434bbf (patch) | |
tree | e19f19bdea17ed69e35014aed74df9963500bb7f /common/usb_hub.c | |
parent | 9723563aa821e9c9b881dfe6a082f6301ca69826 (diff) | |
download | u-boot-3884c98c32cd5fb5b5b42185d5d0575659434bbf.tar.gz u-boot-3884c98c32cd5fb5b5b42185d5d0575659434bbf.tar.bz2 u-boot-3884c98c32cd5fb5b5b42185d5d0575659434bbf.zip |
dm: usb: Avoid time delays in sandbox tests
Currently the USB tests take around two seconds to run. Remove these
unnecessary time delays so that the tests run quickly.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/usb_hub.c')
-rw-r--r-- | common/usb_hub.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/common/usb_hub.c b/common/usb_hub.c index a92c9fb73d..e1de813adf 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -31,6 +31,9 @@ #include <asm/unaligned.h> #include <linux/ctype.h> #include <asm/byteorder.h> +#ifdef CONFIG_SANDBOX +#include <asm/state.h> +#endif #include <asm/unaligned.h> #include <dm/root.h> @@ -466,7 +469,12 @@ static int usb_hub_configure(struct usb_device *dev) unsigned short portstatus, portchange; int ret; ulong start = get_timer(0); + uint delay = CONFIG_SYS_HZ; +#ifdef CONFIG_SANDBOX + if (state_get_skip_delays()) + delay = 0; +#endif #ifdef CONFIG_DM_USB debug("\n\nScanning '%s' port %d\n", dev->dev->name, i + 1); #else @@ -498,7 +506,7 @@ static int usb_hub_configure(struct usb_device *dev) if (portstatus & USB_PORT_STAT_CONNECTION) break; - } while (get_timer(start) < CONFIG_SYS_HZ * 1); + } while (get_timer(start) < delay); if (ret < 0) continue; |