summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2011-12-07 00:18:39 +0000
committerGerrit <chrome-bot@google.com>2011-12-08 09:08:26 -0800
commitfeebb63ce5a7031bc7b9e6bbfbe7f52c864a3af6 (patch)
tree68d1552ff2022fea7380717fa86963df992f2a1f /common
parent37044352d10b38aa52ce6572b40fe81fdd83df97 (diff)
add USB keyboard support for vboot.
If the primary input of the device is a USB keyboard (as defined by the FDT) and we are in developer mode, enumerate the USB devices at startup and get key strokes from USB keyboard. The keyboard reading is not working correctly yet on the recovery path due to the USB mass storage polling code doing continuous re-enumeration on the USB controller. BUG=chrome-os-partner:5752 TEST=tested on Stumpy and Lumpy, with and without usb-keyboard set in the device tree, check Ctrl+U, Ctrl+D and space are working as expected. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Change-Id: Ib46d6086ae5e5ce631d5f91b467f7b2bf90644d0 Reviewed-on: https://gerrit.chromium.org/gerrit/12543 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
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 3ac7185065..bf19763d0f 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);