From 035d11fc5d215010b14f0c7dad041ad1c3425c50 Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Fri, 12 Jun 2020 12:59:52 -0700 Subject: 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 Change-Id: Iec1fd51cb0fa49e088f3b2489c5e94c8a4777a9b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242664 Reviewed-by: Andrew McRae Reviewed-by: Peter Marheine --- common/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- cgit v1.2.1