summaryrefslogtreecommitdiff
path: root/chip/npcx/system.c
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2017-11-30 17:58:38 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-12-05 18:00:38 -0800
commit23149261dc4a9429a1c98aa829e02d4a3ec5103a (patch)
treee86a656759c50faba656be820118ef25fb7a3010 /chip/npcx/system.c
parent0a5e908467b5f5169a7197bbe7b327e06432d4cf (diff)
downloadchrome-ec-23149261dc4a9429a1c98aa829e02d4a3ec5103a.tar.gz
system: Allow hibernate to clear AP_OFF flag
After firmware update, cr50 toggles the EC's reset line, expecting the system will boot. This isn't the case for Chromebox because it sets AP_OFF flag on a clean shutdown (to restore the previous power state after power loss & restore). This patch adds EC_REBOOT_HIBERNATE_CLEAR_AP_OFF to EC reboot command. It makes EC first clear AP_OFF then hibernate. BUG=b:69721737 BRANCH=none TEST=Verify Fizz reboot after cr50 update. Change-Id: If3207d7284f244ca1adf0d516ef744dbc739a9c1 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/802632 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'chip/npcx/system.c')
-rw-r--r--chip/npcx/system.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c
index 96879b40e4..e7826f794c 100644
--- a/chip/npcx/system.c
+++ b/chip/npcx/system.c
@@ -312,6 +312,11 @@ void chip_save_reset_flags(int flags)
bbram_data_write(BBRM_DATA_INDEX_SAVED_RESET_FLAGS, flags);
}
+uint32_t chip_read_reset_flags(void)
+{
+ return bbram_data_read(BBRM_DATA_INDEX_SAVED_RESET_FLAGS);
+}
+
#ifdef CONFIG_POWER_BUTTON_INIT_IDLE
/*
* Set/clear AP_OFF flag. It's set when the system gracefully shuts down and
@@ -338,7 +343,10 @@ static void board_chipset_shutdown(void)
system_set_reset_flags(RESET_FLAG_AP_OFF);
CPRINTS("Set AP_OFF flag");
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown,
+ /* Slightly higher than handle_pending_reboot because
+ * it may clear AP_OFF flag. */
+ HOOK_PRIO_DEFAULT - 1);
#endif
/* Check reset cause */