Message ID | 1350004554-18506-1-git-send-email-sjg@chromium.org |
---|---|
State | Changes Requested, archived |
Delegated to: | Tom Rini |
Headers | show |
Hi Simon, On Fri, Oct 12, 2012 at 12:15 PM, Simon Glass <sjg@chromium.org> wrote: > 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--) I know this magic number was already here, but later patches introduce even more. Any chance these can be cleaned up as well? Regards, Graeme
Hi Graeme, On Thu, Oct 11, 2012 at 8:55 PM, Graeme Russ <graeme.russ@gmail.com> wrote: > Hi Simon, > > On Fri, Oct 12, 2012 at 12:15 PM, Simon Glass <sjg@chromium.org> wrote: > >> 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--) > > I know this magic number was already here, but later patches introduce > even more. Any chance these can be cleaned up as well? Yes, will do. Regards, Simon > > Regards, > > Graeme
On Thu, Oct 11, 2012 at 06:15:49PM -0700, Simon Glass wrote: > 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> This, or more precisely, v2 of 1/5 and 2/5 and v1 of 3, 4 and 5/5 have been applied to u-boot/master, thanks!
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;