diff options
-rw-r--r-- | chip/g/system.c | 18 | ||||
-rw-r--r-- | common/system.c | 2 | ||||
-rw-r--r-- | include/system.h | 1 |
3 files changed, 18 insertions, 3 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) diff --git a/common/system.c b/common/system.c index afa278884d..7c3117a292 100644 --- a/common/system.c +++ b/common/system.c @@ -84,7 +84,7 @@ static struct jump_data *jdata; static const char * const reset_flag_descs[] = { "other", "reset-pin", "brownout", "power-on", "watchdog", "soft", "hibernate", "rtc-alarm", "wake-pin", "low-battery", "sysjump", - "hard", "ap-off", "preserved"}; + "hard", "ap-off", "preserved", "usb-resume"}; static uint32_t reset_flags; static int jumped_to_image; diff --git a/include/system.h b/include/system.h index b47cbac240..6c8bbea06d 100644 --- a/include/system.h +++ b/include/system.h @@ -28,6 +28,7 @@ #define RESET_FLAG_AP_OFF (1 << 12) /* Do not power on AP */ #define RESET_FLAG_PRESERVED (1 << 13) /* Some reset flags preserved from * previous boot */ +#define RESET_FLAG_USB_RESUME (1 << 14) /* USB resume triggered wake */ /* Per chip implementation to save raw RESET_FLAG_ flags. */ void chip_save_reset_flags(int flags); |