aboutsummaryrefslogtreecommitdiff
path: root/src/ec/lenovo/h8/vboot.c
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2019-05-05 11:15:25 +0200
committerPatrick Georgi <pgeorgi@google.com>2019-05-08 10:27:36 +0000
commit25212117534f0cb29939a7fc6c1271ca0fa083cd (patch)
treebdf96becfdeb8543554ec840135ac8eae44d7802 /src/ec/lenovo/h8/vboot.c
parent2dc00fab7c46369bffdedf3afea2af720e4add80 (diff)
ec/lenovo/h8: Add VBOOT board support
Use Fn-Key as recovery mode switch. Tested using Icb7b263ed86551cc53e1db7babccaca6b3ae2fe6. Change-Id: I2c682431b3f09839db265259205104bd9ef4abfc Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32607 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'src/ec/lenovo/h8/vboot.c')
-rw-r--r--src/ec/lenovo/h8/vboot.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/ec/lenovo/h8/vboot.c b/src/ec/lenovo/h8/vboot.c
new file mode 100644
index 0000000000..3b9f74a117
--- /dev/null
+++ b/src/ec/lenovo/h8/vboot.c
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 Patrick Rudolph <siro@das-labor.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <ec/acpi/ec.h>
+#include <bootmode.h>
+#include <timer.h>
+#include <delay.h>
+
+#include "h8.h"
+
+/**
+ * HACK: Use Fn-Key as recovery mode switch.
+ * Wait for sense register ready and read Fn-Key state.
+ */
+int get_recovery_mode_switch(void)
+{
+ struct stopwatch sw;
+
+ if (!CONFIG(H8_FN_KEY_AS_VBOOT_RECOVERY_SW))
+ return 0;
+
+ /* Tests showed that it takes:
+ * - 700msec on Lenovo T500 from AC power on
+ * - less than 150msec on Lenovo T520 from AC power on
+ */
+ stopwatch_init_msecs_expire(&sw, 1000);
+ while (!stopwatch_expired(&sw) && !h8_get_sense_ready())
+ mdelay(1);
+
+ if (!h8_get_sense_ready())
+ return 0;
+
+ return h8_get_fn_key();
+}
+
+/**
+ * Only used if CONFIG_CHROMEOS is set.
+ * Always zero as the #WP pin of the flash is tied high.
+ */
+int get_write_protect_state(void)
+{
+ return 0;
+}