From ef94f7fa64190876c08b68eb1b067c5e6d3085f5 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 12 Oct 2012 14:02:01 +0000 Subject: input: 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. Signed-off-by: Gabe Black Signed-off-by: Simon Glass Signed-off-by: Tom Rini --- include/i8042.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/i8042.h') diff --git a/include/i8042.h b/include/i8042.h index 13952899ba..aeb3f090d0 100644 --- a/include/i8042.h +++ b/include/i8042.h @@ -39,6 +39,12 @@ #define I8042_STATUS_REG (CONFIG_SYS_ISA_IO + 0x0064) /* keyboard status read */ #define I8042_COMMAND_REG (CONFIG_SYS_ISA_IO + 0x0064) /* keyboard ctrl write */ +enum { + /* Output register (I8042_DATA_REG) has data for system */ + I8042_STATUS_OUT_DATA = 1 << 0, + I8042_STATUS_IN_DATA = 1 << 1, +}; + #define KBD_US 0 /* default US layout */ #define KBD_GER 1 /* german layout */ -- cgit v1.2.1