summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2017-05-11 15:32:21 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-05-12 20:58:01 -0700
commite95cd1f347c77365611e761037de544172b0352e (patch)
tree15fe2768eb44a17957193d758cae6394d15e8382 /common
parentc2f640c159b65bf6595714f24c316f2553c986e4 (diff)
downloadchrome-ec-e95cd1f347c77365611e761037de544172b0352e.tar.gz
button: Recovery on power-on reset
When cr50 detects recovery button (not keyboard) combo: recovery+power, volume-up+down+power, etc., it should (ideally) hard-reset the EC. This patch allows power-on reset in addition to reset-pin reset to enter recovery mode when recovery button combo is pressed. BUG=b:35585326 BRANCH=none TEST=make buildall. Tested on Poppy. Change-Id: I15aeef99d21ddc774441ead56fba56d459595cc9 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/503573 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/button.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/common/button.c b/common/button.c
index 079b26acdf..a536f16a2b 100644
--- a/common/button.c
+++ b/common/button.c
@@ -131,7 +131,19 @@ static void button_check_hw_reinit_required(void)
button_blink_hw_reinit_led();
#endif
}
-#endif
+
+static int is_recovery_boot(void)
+{
+ if (system_jumped_to_this_image())
+ return 0;
+ if (!(system_get_reset_flags() &
+ (RESET_FLAG_RESET_PIN | RESET_FLAG_POWER_ON)))
+ return 0;
+ if (!is_recovery_button_pressed())
+ return 0;
+ return 1;
+}
+#endif /* CONFIG_BUTTON_RECOVERY */
/*
* Button initialization.
@@ -149,9 +161,7 @@ void button_init(void)
}
#ifdef CONFIG_BUTTON_RECOVERY
- if (!system_jumped_to_this_image() &&
- (system_get_reset_flags() & RESET_FLAG_RESET_PIN) &&
- is_recovery_button_pressed()) {
+ if (is_recovery_boot()) {
host_set_single_event(EC_HOST_EVENT_KEYBOARD_RECOVERY);
button_check_hw_reinit_required();
}