summaryrefslogtreecommitdiff
path: root/chip/npcx
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2020-05-22 13:16:35 -0700
committerCommit Bot <commit-bot@chromium.org>2020-05-23 04:14:34 +0000
commit50b713567e7fef1c93f809ca2f82e919745a1aec (patch)
tree4a29f9f6e7a839d6d8f1ad5facbc7e16ac2c62b7 /chip/npcx
parent4622782bec34ef489c792d8834fb432cbcadd1c9 (diff)
downloadchrome-ec-50b713567e7fef1c93f809ca2f82e919745a1aec.tar.gz
npcx: Use AP_IDLE instead of AP_OFF to restore AP power
When CONFIG_POWER_BUTTON_INIT_IDLE is defined, the AP power state is restored after power loss (e.g. black out for chromebox). This feature is implemented by EC_RESET_FLAG_AP_OFF. When AP_OFF is set, EC forces the AP to stay off even if the AP is sequencing up. This patch will prevent RW from shutting off the AP unintentionally after sysjump. BUG=b:154778457 BRANCH=none TEST=Verify test_that suite:faft_bios passes. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I8f64023bd58d5679194dfa389851edf2234c58be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2213730 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'chip/npcx')
-rw-r--r--chip/npcx/system.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c
index 4bdf352880..64ba4d8e23 100644
--- a/chip/npcx/system.c
+++ b/chip/npcx/system.c
@@ -329,20 +329,20 @@ uint32_t chip_read_reset_flags(void)
static void board_chipset_startup(void)
{
uint32_t flags = chip_read_reset_flags();
- flags &= ~EC_RESET_FLAG_AP_OFF;
+ flags &= ~EC_RESET_FLAG_AP_IDLE;
chip_save_reset_flags(flags);
- system_clear_reset_flags(EC_RESET_FLAG_AP_OFF);
- CPRINTS("Cleared AP_OFF flag");
+ system_clear_reset_flags(EC_RESET_FLAG_AP_IDLE);
+ CPRINTS("Cleared AP_IDLE flag");
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
static void board_chipset_shutdown(void)
{
uint32_t flags = chip_read_reset_flags();
- flags |= EC_RESET_FLAG_AP_OFF;
+ flags |= EC_RESET_FLAG_AP_IDLE;
chip_save_reset_flags(flags);
- system_set_reset_flags(EC_RESET_FLAG_AP_OFF);
- CPRINTS("Set AP_OFF flag");
+ system_set_reset_flags(EC_RESET_FLAG_AP_IDLE);
+ CPRINTS("Saved AP_IDLE flag");
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown,
/* Slightly higher than handle_pending_reboot because
@@ -357,8 +357,11 @@ static void check_reset_cause(void)
/* Clear saved reset flags in bbram */
#ifdef CONFIG_POWER_BUTTON_INIT_IDLE
- /* We'll clear AP_OFF on S5->S3 transition */
- chip_save_reset_flags(flags & EC_RESET_FLAG_AP_OFF);
+ /*
+ * We're not sure whether we're booting or not. AP_IDLE will be cleared
+ * on S5->S3 transition.
+ */
+ chip_save_reset_flags(flags & EC_RESET_FLAG_AP_IDLE);
#else
chip_save_reset_flags(0);
#endif