public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/5] input: Use finer grain udelays while waitng for the i8042 keyboard buffer to empty
@ 2012-10-12  1:15 Simon Glass
  2012-10-12  1:15 ` [U-Boot] [PATCH 2/5] input: Provide a board specific mechanism to decide whether to skip i8042 init Simon Glass
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Simon Glass @ 2012-10-12  1:15 UTC (permalink / raw)
  To: u-boot

From: Gabe Black <gabeblack@chromium.org>

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.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
 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 c3bc536..99254e4 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -607,11 +607,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;
 }
@@ -625,8 +624,6 @@ static int kbd_reset(void)
 
 	out8(I8042_DATA_REG, 0xff);
 
-	udelay(250000);
-
 	if (kbd_input_empty() == 0)
 		return -1;
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-10-20 17:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-12  1:15 [U-Boot] [PATCH 1/5] input: Use finer grain udelays while waitng for the i8042 keyboard buffer to empty Simon Glass
2012-10-12  1:15 ` [U-Boot] [PATCH 2/5] input: Provide a board specific mechanism to decide whether to skip i8042 init Simon Glass
2012-10-12 16:05   ` Tom Rini
2012-10-13  0:03     ` Simon Glass
2012-10-12  1:15 ` [U-Boot] [PATCH 3/5] input: i8042: Provide feature to disable keyboard before booting kernel Simon Glass
2012-10-12  1:15 ` [U-Boot] [PATCH 4/5] input: Fix i8042 keyboard reset Simon Glass
2012-10-12  1:15 ` [U-Boot] [PATCH 5/5] input: Add ANSI 3.64 escape sequence generation Simon Glass
2012-10-12  3:55 ` [U-Boot] [PATCH 1/5] input: Use finer grain udelays while waitng for the i8042 keyboard buffer to empty Graeme Russ
2012-10-12 23:44   ` Simon Glass
2012-10-20 17:42 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox