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

Simon Glass sjg at chromium.org
Fri Oct 12 03:15:50 CEST 2012


From: Gabe Black <gabeblack at 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 at chromium.org>
Signed-off-by: Simon Glass <sjg at 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")));
+
 /*******************************************************************************
  *
  * 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
-- 
1.7.7.3



More information about the U-Boot mailing list