summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/cmd_vboot_twostop.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/common/cmd_vboot_twostop.c b/common/cmd_vboot_twostop.c
index 3ac71850659..bf19763d0f2 100644
--- a/common/cmd_vboot_twostop.c
+++ b/common/cmd_vboot_twostop.c
@@ -23,6 +23,7 @@
#include <chromeos/hasher_state.h>
#include <chromeos/memory_wipe.h>
#include <chromeos/power_management.h>
+#include <usb.h>
#include <gbb_header.h> /* for GoogleBinaryBlockHeader */
#include <tss_constants.h>
@@ -111,6 +112,18 @@ str_selection(uint32_t selection)
#endif /* VBOOT_DEBUG */
/*
+ * Implement a weak default function for boards that optionally
+ * need to initialize the USB stack to detect their keyboard.
+ */
+int __board_use_usb_keyboard(void)
+{
+ /* default: no USB keyboard as primary input */
+ return 0;
+}
+int board_use_usb_keyboard(int boot_mode)
+ __attribute__((weak, alias("__board_use_usb_keyboard")));
+
+/*
* Check if two stop boot secuence can be interrupted. If configured - use the
* device tree contents to determine it. Some other means (like checking the
* environment) could be added later.
@@ -731,6 +744,15 @@ twostop_boot(void)
/*
* TODO: Now, load drivers for rec/normal/dev main firmware.
*/
+#ifdef CONFIG_USB_KEYBOARD
+ if (board_use_usb_keyboard(boot_mode)) {
+ int cnt;
+ /* enumerate USB devices to find the keyboard */
+ cnt = usb_init();
+ if (cnt >= 0)
+ drv_usb_kbd_init();
+ }
+#endif
VBDEBUG(PREFIX "boot_mode: %d\n", boot_mode);