summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2020-06-12 12:59:52 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-17 16:24:42 +0000
commit035d11fc5d215010b14f0c7dad041ad1c3425c50 (patch)
treece7e4acad993321058826d7ff0141f07dfba83e5
parentd327b1b94317f4cfb73401c3e2484a7d31215202 (diff)
downloadchrome-ec-035d11fc5d215010b14f0c7dad041ad1c3425c50.tar.gz
PB: Clear AP_IDLE for recovery boot
Currently, if CONFIG_POWER_BUTTON_INIT_IDLE is defined, EC_RESET_FLAG_AP_IDLE is set when the system enters S5. This is for restoring the power state after power loss or blackout. This can cause a recovery boot to be blocked depending on the timing that the hardware resets the EC. This patch makes EC clear AP_IDLE flag when a manual recovery request is detected so that AP can be unconditionally booted in the recovery mode. BUG=b:158802935, b:37536389 BRANCH=none TEST=Shutdown DUT. Press power + recovery. DUT enters recovery mode. TEST=Shutdown DUT. Replug AC. DUT stays off. TEST=Boot DUT to OS. Replug AC. DUT boots back to OS. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Iec1fd51cb0fa49e088f3b2489c5e94c8a4777a9b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242664 Reviewed-by: Andrew McRae <amcrae@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
-rw-r--r--common/main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/main.c b/common/main.c
index 7f1cbc265d..e749c3e21f 100644
--- a/common/main.c
+++ b/common/main.c
@@ -201,6 +201,14 @@ test_mockable __keep int main(void)
button_init();
#endif /* defined(CONFIG_DEDICATED_RECOVERY_BUTTON | CONFIG_VOLUME_BUTTONS) */
+ /* Make sure recovery boot won't be paused. */
+ if (IS_ENABLED(CONFIG_POWER_BUTTON_INIT_IDLE)
+ && system_is_manual_recovery()
+ && (system_get_reset_flags() & EC_RESET_FLAG_AP_IDLE)) {
+ CPRINTS("Clear AP_IDLE for recovery mode");
+ system_clear_reset_flags(EC_RESET_FLAG_AP_IDLE);
+ }
+
#if defined(CONFIG_VBOOT_EFS) || defined(CONFIG_VBOOT_EFS2)
/*
* Execute PMIC reset in case we're here after watchdog reset to unwedge