summaryrefslogtreecommitdiff
path: root/board
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 /board
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 'board')
-rw-r--r--board/chromebook-x86/coreboot/coreboot.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/board/chromebook-x86/coreboot/coreboot.c b/board/chromebook-x86/coreboot/coreboot.c
index e633f3b4b2..8574dad4ca 100644
--- a/board/chromebook-x86/coreboot/coreboot.c
+++ b/board/chromebook-x86/coreboot/coreboot.c
@@ -36,6 +36,7 @@
#include <chromeos/fdt_decode.h>
#include <chromeos/firmware_storage.h>
#include <chromeos/cros_gpio.h>
+#include <chromeos/crossystem_data.h>
#include <chromeos/common.h>
#include <asm/io.h>
#include <asm/msr.h>
@@ -194,6 +195,22 @@ int board_i8042_skip(void)
return fdt_decode_get_config_int(gd->blob, "skip-i8042", 0);
}
+int board_use_usb_keyboard(int boot_mode)
+{
+ cros_gpio_t devsw;
+
+ /* the keyboard is needed only in developer mode and recovery mode */
+ cros_gpio_fetch(CROS_GPIO_DEVSW, &devsw);
+ if (!devsw.value && (boot_mode != FIRMWARE_TYPE_RECOVERY))
+ return 0;
+
+ /* does this machine have a USB keyboard as primary input ? */
+ if (fdt_decode_get_config_bool(gd->blob, "usb-keyboard"))
+ return 1;
+
+ return 0;
+}
+
#define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
#define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)