diff options
author | Jim Lin <jilin@nvidia.com> | 2013-01-24 01:05:55 +0000 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2013-02-04 09:07:21 -0500 |
commit | b2f3e0ea3e469a759fd74832ce551e3384bc07c0 (patch) | |
tree | 4e3620ca59a127508cdff87bfae4f9c2af1984ef /common/main.c | |
parent | 3fd1e85aaa33c97edf06bea35ce1ae57accd1f47 (diff) | |
download | u-boot-imx-b2f3e0ea3e469a759fd74832ce551e3384bc07c0.zip u-boot-imx-b2f3e0ea3e469a759fd74832ce551e3384bc07c0.tar.gz u-boot-imx-b2f3e0ea3e469a759fd74832ce551e3384bc07c0.tar.bz2 |
console: USB: KBD: Fix incorrect autoboot timeout
Autoboot timeout defined by CONFIG_BOOTDELAY will not be accurate if
CONFIG_USB_KEYBOARD and CONFIG_SYS_USB_EVENT_POLL are defined in
configuration file and when tstc() function for checking key pressed
takes longer time than 10 ms (e.g., 50 ms) to finish.
Signed-off-by: Jim Lin <jilin@nvidia.com>
Diffstat (limited to 'common/main.c')
-rw-r--r-- | common/main.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/main.c b/common/main.c index 5d8454e..9e92687 100644 --- a/common/main.c +++ b/common/main.c @@ -225,6 +225,7 @@ static inline int abortboot(int bootdelay) { int abort = 0; + unsigned long ts; #ifdef CONFIG_MENUPROMPT printf(CONFIG_MENUPROMPT); @@ -248,11 +249,10 @@ int abortboot(int bootdelay) #endif while ((bootdelay > 0) && (!abort)) { - int i; - --bootdelay; - /* delay 100 * 10ms */ - for (i=0; !abort && i<100; ++i) { + /* delay 1000 ms */ + ts = get_timer(0); + do { if (tstc()) { /* we got a key press */ abort = 1; /* don't auto boot */ bootdelay = 0; /* no more delay */ @@ -264,7 +264,7 @@ int abortboot(int bootdelay) break; } udelay(10000); - } + } while (!abort && get_timer(ts) < 1000); printf("\b\b\b%2d ", bootdelay); } |