summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--payloads/libpayload/drivers/i8042/i8042.h1
-rw-r--r--payloads/libpayload/drivers/i8042/keyboard.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/i8042/i8042.h b/payloads/libpayload/drivers/i8042/i8042.h
index 643167ef40..e864ac9263 100644
--- a/payloads/libpayload/drivers/i8042/i8042.h
+++ b/payloads/libpayload/drivers/i8042/i8042.h
@@ -63,6 +63,7 @@
#define I8042_KBCMD_EN 0xf4
#define I8042_KBCMD_DEFAULT_DIS 0xf5
#define I8042_KBCMD_SET_DEFAULT 0xf6
+#define I8042_KBCMD_ACK 0xfa
#define I8042_KBCMD_RESEND 0xfe
#define I8042_KBCMD_RESET 0xff
diff --git a/payloads/libpayload/drivers/i8042/keyboard.c b/payloads/libpayload/drivers/i8042/keyboard.c
index cded638380..fea9e718dd 100644
--- a/payloads/libpayload/drivers/i8042/keyboard.c
+++ b/payloads/libpayload/drivers/i8042/keyboard.c
@@ -317,6 +317,13 @@ void keyboard_init(void)
/* Enable first PS/2 port */
i8042_cmd(I8042_CMD_EN_KB);
+ /* Reset keyboard and self test (keyboard side) */
+ ret = keyboard_cmd(I8042_KBCMD_RESET);
+ if (ret != I8042_KBCMD_ACK) {
+ printf("ERROR: Keyboard reset failed ACK: 0x%x\n", ret);
+ return;
+ }
+
/* Set scancode set 1 */
ret = keyboard_cmd(I8042_KBCMD_SET_SCANCODE);
if (!ret && !CONFIG(LP_PC_KEYBOARD_IGNORE_INIT_FAILURE))