Patchwork [U-Boot,2/5] input: Provide a board specific mechanism to decide whether to skip i8042 init

login
register
mail settings
Submitter Simon Glass
Date Oct. 12, 2012, 1:15 a.m.
Message ID <1350004554-18506-2-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/191029/
State Changes Requested, archived
Delegated to: Tom Rini
Headers show

Comments

Simon Glass - Oct. 12, 2012, 1:15 a.m.
From: Gabe Black <gabeblack@chromium.org>

This change adds a board overridable function which can be used to decide
whether or not to initialize the i8042 keyboard controller. On systems where
it isn't actually connected to anything, this can save a significant amount of
boot time.

On Stumpy, this saves about 200ms on boot.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
 drivers/input/i8042.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
Tom Rini - Oct. 12, 2012, 4:05 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/11/12 18:15, Simon Glass wrote:
> From: Gabe Black <gabeblack@chromium.org>
> 
> This change adds a board overridable function which can be used to
> decide whether or not to initialize the i8042 keyboard controller.
> On systems where it isn't actually connected to anything, this can
> save a significant amount of boot time.
> 
> On Stumpy, this saves about 200ms on boot.
> 
> Signed-off-by: Gabe Black <gabeblack@chromium.org> Signed-off-by:
> Simon Glass <sjg@chromium.org> --- drivers/input/i8042.c |   13
> ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c index
> 99254e4..cae2d0a 100644 --- a/drivers/input/i8042.c +++
> b/drivers/input/i8042.c @@ -320,6 +320,17 @@ static int
> kbd_controller_present(void) return in8(I8042_STATUS_REG) != 0xff; 
> }
> 
> +/* + * Implement a weak default function for boards that
> optionally + * need to skip the i8042 initialization. + */ +int
> __board_i8042_skip(void) +{ +	/* As default, don't skip */ +	return
> 0; +} +int board_i8042_skip(void) __attribute__((weak,
> alias("__board_i8042_skip")));

Please add <linux/compiler.h> and use __weak directly, thanks.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQeD/QAAoJENk4IS6UOR1WVMsP/RJTlWaTvF56K6H75WbjK7l5
xE7zeAeCS4gbM1CS0fEv1X4296L7oWUUUkw73gwSEAxd2CxOj96HrhJI0WQIqZ/a
m6ysfwswzY92oqXJGxnWnLiZzd0JUR/QHZAM7U0tX1yHFsYrycEtuq+JvfMm5BU7
1ozqrN0SoFPa8ZBq0GpnXhDsGdMApucDBkbDv3cgHTYPkOlfh3gLpbz/dkWKxrCv
NBwKvZgVMtEPf9hZf5CLuB2ghfWIRyP50Bf99nKhV+gdLGtrEbboHkMMXEc2Z1ex
foEMqpmSiMVd9yMRqVEIM3sWwnapqAZVn3wQLoq5Kz+YGS/9e0c9t95ck+CmndiM
kJmrx/LZ/XSGzjLrKC3MWLWC/KUS2hHqj4AfYUf1kL5lPuHM24c+oSRfOjogkaqR
bMJZ9ii/kYcQJry/dAYTjFyEa120X48y46e2bNcMhWVZh48A6VpJkFILb1Ga4tEo
ss+hMBX/tiMNp8eoOR7y1n+A+94r3ABKUrLapjfVKg+qXeufrMyotBVfPY35hWnP
qLNVlPpdEF7nP1Wt22OB9s6bBcI6dCrNuL75Ym6wJ3DYnpqU8Y8f3HihwL7cBy7F
o1Zpo0bzazNfy722IYphWu0O3hihIQ11fRpAndVemUzjaXP/kKxaVhiDCj28xHup
9zGuTm7SW/liJTXp4cc8
=5tNx
-----END PGP SIGNATURE-----
Simon Glass - Oct. 13, 2012, 12:03 a.m.
Hi Tom,

On Fri, Oct 12, 2012 at 9:05 AM, Tom Rini <trini@ti.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 10/11/12 18:15, Simon Glass wrote:
>> From: Gabe Black <gabeblack@chromium.org>
>>
>> This change adds a board overridable function which can be used to
>> decide whether or not to initialize the i8042 keyboard controller.
>> On systems where it isn't actually connected to anything, this can
>> save a significant amount of boot time.
>>
>> On Stumpy, this saves about 200ms on boot.
>>
>> Signed-off-by: Gabe Black <gabeblack@chromium.org> Signed-off-by:
>> Simon Glass <sjg@chromium.org> --- drivers/input/i8042.c |   13
>> ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c index
>> 99254e4..cae2d0a 100644 --- a/drivers/input/i8042.c +++
>> b/drivers/input/i8042.c @@ -320,6 +320,17 @@ static int
>> kbd_controller_present(void) return in8(I8042_STATUS_REG) != 0xff;
>> }
>>
>> +/* + * Implement a weak default function for boards that
>> optionally + * need to skip the i8042 initialization. + */ +int
>> __board_i8042_skip(void) +{ + /* As default, don't skip */ +  return
>> 0; +} +int board_i8042_skip(void) __attribute__((weak,
>> alias("__board_i8042_skip")));
>
> Please add <linux/compiler.h> and use __weak directly, thanks.

Yes will do,

>
> - --
> Tom
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
>
> iQIcBAEBAgAGBQJQeD/QAAoJENk4IS6UOR1WVMsP/RJTlWaTvF56K6H75WbjK7l5
> xE7zeAeCS4gbM1CS0fEv1X4296L7oWUUUkw73gwSEAxd2CxOj96HrhJI0WQIqZ/a
> m6ysfwswzY92oqXJGxnWnLiZzd0JUR/QHZAM7U0tX1yHFsYrycEtuq+JvfMm5BU7
> 1ozqrN0SoFPa8ZBq0GpnXhDsGdMApucDBkbDv3cgHTYPkOlfh3gLpbz/dkWKxrCv
> NBwKvZgVMtEPf9hZf5CLuB2ghfWIRyP50Bf99nKhV+gdLGtrEbboHkMMXEc2Z1ex
> foEMqpmSiMVd9yMRqVEIM3sWwnapqAZVn3wQLoq5Kz+YGS/9e0c9t95ck+CmndiM
> kJmrx/LZ/XSGzjLrKC3MWLWC/KUS2hHqj4AfYUf1kL5lPuHM24c+oSRfOjogkaqR
> bMJZ9ii/kYcQJry/dAYTjFyEa120X48y46e2bNcMhWVZh48A6VpJkFILb1Ga4tEo
> ss+hMBX/tiMNp8eoOR7y1n+A+94r3ABKUrLapjfVKg+qXeufrMyotBVfPY35hWnP
> qLNVlPpdEF7nP1Wt22OB9s6bBcI6dCrNuL75Ym6wJ3DYnpqU8Y8f3HihwL7cBy7F
> o1Zpo0bzazNfy722IYphWu0O3hihIQ11fRpAndVemUzjaXP/kKxaVhiDCj28xHup
> 9zGuTm7SW/liJTXp4cc8
> =5tNx
> -----END PGP SIGNATURE-----

Regards,
Simon

Patch

diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 99254e4..cae2d0a 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -320,6 +320,17 @@  static int kbd_controller_present(void)
 	return in8(I8042_STATUS_REG) != 0xff;
 }
 
+/*
+ * Implement a weak default function for boards that optionally
+ * need to skip the i8042 initialization.
+ */
+int __board_i8042_skip(void)
+{
+	/* As default, don't skip */
+	return 0;
+}
+int board_i8042_skip(void) __attribute__((weak, alias("__board_i8042_skip")));
+
 /*******************************************************************************
  *
  * i8042_kbd_init - reset keyboard and init state flags
@@ -329,7 +340,7 @@  int i8042_kbd_init(void)
 	int keymap, try;
 	char *penv;
 
-	if (!kbd_controller_present())
+	if (!kbd_controller_present() || board_i8042_skip())
 		return -1;
 
 #ifdef CONFIG_USE_CPCIDVI