diff options
author | Gabe Black <gabeblack@chromium.org> | 2011-10-24 21:54:27 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@chromium.org> | 2011-10-25 16:02:29 -0700 |
commit | bf9c9866112e468699a17eb2128f4c8d59f503e8 (patch) | |
tree | 28ff27831e9421071ede8e46c4e6d237965a4d64 /drivers | |
parent | f9d0e1ed66643829ae641a4e32ab9efa53126ba7 (diff) |
Use finer grain udelays while waitng for the i8042 keyboard buffer to empty
On x86, the i8042 keyboard controller driver frequently waits for the keyboard
input buffer to be empty to make sure the controller has had a chance to
process the data it was given. The way the delay loop was structured, if the
controller hadn't cleared the corresponding status bit immediately, it would
wait 1ms before checking again. If the keyboard responded quickly but not
instantly, the driver would still wait a full 1ms when perhaps 1us would have
been sufficient. Because udelay is a busy wait anyway, this change decreases
the delay between checks to 1us.
Also, this change gets rid of a hardcoded 250ms delay.
On Stumpy, this saves 100-150ms during boot. Also, the total boot time I'm
measuring at ToT is a little higher than expected. I'd like to see what other
people measure.
BUG=chrome-os-partner:6585
TEST=Built and booted on Stumpy. Built and booted on Alex, and verified that
the keyboard still worked at the u-boot prompt.
Change-Id: Ic361c4e88ded8e57b4377790dd011a11a0ce385b
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://gerrit.chromium.org/gerrit/10623
Commit-Ready: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/i8042.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c index 3bdfa7d7f6a..8575d78d132 100644 --- a/drivers/input/i8042.c +++ b/drivers/input/i8042.c @@ -633,11 +633,10 @@ static void kbd_led_set (void) static int kbd_input_empty (void) { - int kbdTimeout = KBD_TIMEOUT; + int kbdTimeout = KBD_TIMEOUT * 1000; - /* wait for input buf empty */ while ((in8 (I8042_STATUS_REG) & 0x02) && kbdTimeout--) - udelay(1000); + udelay(1); return kbdTimeout != -1; } @@ -651,8 +650,6 @@ static int kbd_reset (void) out8 (I8042_DATA_REG, 0xff); - udelay(250000); - if (kbd_input_empty() == 0) return -1; |