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-07-30 16:13:45 +0000
commitae99a842778b06750ce72e5b3262372e0e7df775 (patch)
treeeab6ce5211993476ede84cf4b65485298c994780
parent80baf72464bcdd2b04bc4b7f22cc73a51da9bafb (diff)
downloadchrome-ec-ae99a842778b06750ce72e5b3262372e0e7df775.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> (cherry picked from commit e6a74a364207fa0203294f6da3570baf067ff9f2) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2328070 Tested-by: Jeff Chase <jnchase@google.com> Auto-Submit: Jeff Chase <jnchase@google.com> Reviewed-by: Jeff Chase <jnchase@google.com> Commit-Queue: Jeff Chase <jnchase@google.com>
-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