[U-Boot] [PATCH v2 2/7] x86: i8042: Remove unused codes

Bin Meng bmeng.cn at gmail.com
Fri Aug 21 09:18:52 CEST 2015


- Remove unused routines i8042_flush() and i8042_disable()
- Remove unused CONFIG_USE_CPCIDVI wrapped codes
- Remove __weak board_i8042_skip()

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
Acked-by: Simon Glass <sjg at chromium.org>

---

Changes in v2:
- Split the removing of unused codes into this patch

 drivers/input/i8042.c | 67 +--------------------------------------------------
 include/i8042.h       | 13 ----------
 2 files changed, 1 insertion(+), 79 deletions(-)

diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 1769c5e..8401181 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -10,16 +10,6 @@
 /* includes */
 
 #include <common.h>
-#include <linux/compiler.h>
-
-#ifdef CONFIG_USE_CPCIDVI
-extern u8 gt_cpcidvi_in8(u32 offset);
-extern void gt_cpcidvi_out8(u32 offset, u8 data);
-
-#define in8(a)	   gt_cpcidvi_in8(a)
-#define out8(a, b) gt_cpcidvi_out8(a, b)
-#endif
-
 #include <i8042.h>
 
 /* defines */
@@ -305,54 +295,6 @@ 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 __weak board_i8042_skip(void)
-{
-	/* As default, don't skip */
-	return 0;
-}
-
-void i8042_flush(void)
-{
-	int timeout;
-
-	/*
-	 * The delay is to give the keyboard controller some time to fill the
-	 * next byte.
-	 */
-	while (1) {
-		timeout = 100;  /* wait for no longer than 100us */
-		while (timeout > 0 && !(in8(I8042_STATUS_REG) & 0x01)) {
-			udelay(1);
-			timeout--;
-		}
-
-		/* Try to pull next byte if not timeout. */
-		if (in8(I8042_STATUS_REG) & 0x01)
-			in8(I8042_DATA_REG);
-		else
-			break;
-	}
-}
-
-int i8042_disable(void)
-{
-	if (kbd_input_empty() == 0)
-		return -1;
-
-	/* Disable keyboard */
-	out8(I8042_COMMAND_REG, 0xad);
-
-	if (kbd_input_empty() == 0)
-		return -1;
-
-	return 0;
-}
-
-
 /*******************************************************************************
  *
  * i8042_kbd_init - reset keyboard and init state flags
@@ -362,16 +304,9 @@ int i8042_kbd_init(void)
 	int keymap, try;
 	char *penv;
 
-	if (!kbd_controller_present() || board_i8042_skip())
+	if (!kbd_controller_present())
 		return -1;
 
-#ifdef CONFIG_USE_CPCIDVI
-	penv = getenv("console");
-	if (penv != NULL) {
-		if (strncmp(penv, "serial", 7) == 0)
-			return -1;
-	}
-#endif
 	/* Init keyboard device (default US layout) */
 	keymap = KBD_US;
 	penv = getenv("keymap");
diff --git a/include/i8042.h b/include/i8042.h
index 58c85ec..e68b8d8 100644
--- a/include/i8042.h
+++ b/include/i8042.h
@@ -59,19 +59,6 @@ enum {
 
 /* exports */
 
-/**
- * Flush all buffer from keyboard controller to host.
- */
-void i8042_flush(void);
-
-/**
- * Disables the keyboard so that key strokes no longer generate scancodes to
- * the host.
- *
- * @return 0 if ok, -1 if keyboard input was found while disabling
- */
-int i8042_disable(void);
-
 struct stdio_dev;
 
 int i8042_kbd_init(void);
-- 
1.8.2.1



More information about the U-Boot mailing list