[PATCH 03/13] input: Only reset the keyboard when running bare metal

Simon Glass sjg at chromium.org
Mon Feb 20 20:49:17 CET 2023


If U-Boot is not the first-stage bootloader we should not init the
keyboard, since it has already been done. Check for this.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/input/i8042.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 3563dc98838..e2189726674 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -6,11 +6,14 @@
 
 /* i8042.c - Intel 8042 keyboard driver routines */
 
+#define LOG_CATEGORY UCLASS_KEYBOARD
+
 #include <common.h>
 #include <dm.h>
 #include <env.h>
 #include <errno.h>
 #include <i8042.h>
+#include <init.h>
 #include <input.h>
 #include <keyboard.h>
 #include <log.h>
@@ -132,10 +135,12 @@ static int kbd_reset(int quirk)
 		goto err;
 
 	/* keyboard reset */
-	if (kbd_write(I8042_DATA_REG, CMD_RESET_KBD) ||
-	    kbd_read(I8042_DATA_REG) != KBD_ACK ||
-	    kbd_read(I8042_DATA_REG) != KBD_POR)
-		goto err;
+	if (ll_boot_init()) {
+		if (kbd_write(I8042_DATA_REG, CMD_RESET_KBD) ||
+		    kbd_read(I8042_DATA_REG) != KBD_ACK ||
+		    kbd_read(I8042_DATA_REG) != KBD_POR)
+			goto err;
+	}
 
 	if (kbd_write(I8042_DATA_REG, CMD_DRAIN_OUTPUT) ||
 	    kbd_read(I8042_DATA_REG) != KBD_ACK)
-- 
2.39.2.637.g21b0678d19-goog



More information about the U-Boot mailing list