diff options
author | Bill Richardson <wfrichar@chromium.org> | 2016-03-30 12:26:01 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-03-30 20:38:13 -0700 |
commit | 70378b86b4e5682b70a8145c9679e250280d6f14 (patch) | |
tree | 3dc7dbf91224facdeb36b6555028a78b2a59bc20 /chip | |
parent | 55af6cc418c83c504f20145f075de645ff12aab6 (diff) | |
download | chrome-ec-70378b86b4e5682b70a8145c9679e250280d6f14.tar.gz |
Cr50: Include low-power exit triggers in reset causes
Some of the reset causes are found in another register when
resuming from a low-power state. We know we'll need to
distinguish among them eventually, so we might as well decode
them now.
BUG=chrome-os-partner:49955
BRANCH=none
TEST=make buildall; test on Cr50
I forced the system into deep sleep and observed that the reset
cause is accurately recorded on resume. Doing that requires a
fair amount of hacks and manual effort, and can't happen by
accident. Future CLs will make use of this.
The current, normal behavior is completely unaffected.
Change-Id: I5a7b19dee8bff1ff1703fbbcc84cff4e374cf872
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/336314
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/g/system.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/chip/g/system.c b/chip/g/system.c index 8054a11bc0..6b52f7d2cd 100644 --- a/chip/g/system.c +++ b/chip/g/system.c @@ -23,8 +23,22 @@ static void check_reset_cause(void) } /* Low-power exit (ie, wake from deep sleep) */ - if (g_rstsrc & GC_PMU_RSTSRC_EXIT_MASK) - flags |= RESET_FLAG_WAKE_PIN; + if (g_rstsrc & GC_PMU_RSTSRC_EXIT_MASK) { + /* This register is cleared by reading it */ + uint32_t g_exitpd = GR_PMU_EXITPD_SRC; + + if (g_exitpd & GC_PMU_EXITPD_SRC_PIN_PD_EXIT_MASK) + flags |= RESET_FLAG_WAKE_PIN; + if (g_exitpd & GC_PMU_EXITPD_SRC_UTMI_SUSPEND_N_MASK) + flags |= RESET_FLAG_USB_RESUME; + if (g_exitpd & (GC_PMU_EXITPD_SRC_TIMELS0_PD_EXIT_TIMER0_MASK | + GC_PMU_EXITPD_SRC_TIMELS0_PD_EXIT_TIMER1_MASK)) + flags |= RESET_FLAG_RTC_ALARM; + /* Not yet sure what to do with these */ + if (g_exitpd & (GC_PMU_EXITPD_SRC_RDD0_PD_EXIT_TIMER_MASK | + GC_PMU_EXITPD_SRC_RBOX_WAKEUP_MASK)) + flags |= RESET_FLAG_OTHER; + } /* TODO(crosbug.com/p/47289): This bit doesn't work */ if (g_rstsrc & GC_PMU_RSTSRC_WDOG_MASK) |