summaryrefslogtreecommitdiff
path: root/chip/it83xx/clock.c
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2020-08-24 18:25:11 +0800
committerCommit Bot <commit-bot@chromium.org>2020-08-25 07:15:49 +0000
commit585918da5621a50a256c8140c55cf7899141e207 (patch)
tree201dca47ac7a51b8dace79c1cb08007f536ddd18 /chip/it83xx/clock.c
parent9dafd43be882202d413a444a4e193bf5ffcae670 (diff)
downloadchrome-ec-585918da5621a50a256c8140c55cf7899141e207.tar.gz
it83xx: fix incorrect reset cause when boot from z-state
Add the following features to support z-state for Asurada. 1) Call chip_save_reset_flags() before entering board_hibernate_late() to make sure the hibernate flag saved before ec powered off. 2) Handle the second ec reset correctly if CONFIG_BOARD_RESET_AFTER_POWER_ON enabled. BUG=b:163963220 TEST=Check the reset cause under following cases: 1) boot from z-state -> reset-pin power-on hibernate initial-pwr 2) boot from cutoff -> reset-pin power-on initial-pwr 3) `ecrst pulse` in cr50 console -> reset-pin power-on initial-pwr BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I176075ea2b3f6b2abbfe22e47f3019ee23af57a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2371751 Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'chip/it83xx/clock.c')
-rw-r--r--chip/it83xx/clock.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/chip/it83xx/clock.c b/chip/it83xx/clock.c
index c3fc6ffbf4..7c3bf25844 100644
--- a/chip/it83xx/clock.c
+++ b/chip/it83xx/clock.c
@@ -488,8 +488,14 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds)
* may not return at all. On those boards, power to the EC is likely
* being turn off entirely.
*/
- if (board_hibernate_late)
+ if (board_hibernate_late) {
+ /*
+ * Set reset flag in case board_hibernate_late() doesn't
+ * return.
+ */
+ chip_save_reset_flags(EC_RESET_FLAG_HIBERNATE);
board_hibernate_late();
+ }
if (seconds || microseconds) {
/* At least 1 ms for hibernate. */