summaryrefslogtreecommitdiff
path: root/chip/it83xx/system.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/it83xx/system.c')
-rw-r--r--chip/it83xx/system.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/chip/it83xx/system.c b/chip/it83xx/system.c
index 87a97e1021..02153424e1 100644
--- a/chip/it83xx/system.c
+++ b/chip/it83xx/system.c
@@ -44,6 +44,12 @@ static void check_reset_cause(void)
uint8_t raw_reset_cause = IT83XX_GCTRL_RSTS & 0x03;
uint8_t raw_reset_cause2 = IT83XX_GCTRL_SPCTRL4 & 0x07;
+ /* Restore saved reset flags. */
+ flags |= BRAM_RESET_FLAGS0 << 24;
+ flags |= BRAM_RESET_FLAGS1 << 16;
+ flags |= BRAM_RESET_FLAGS2 << 8;
+ flags |= BRAM_RESET_FLAGS3;
+
/* Clear reset cause. */
IT83XX_GCTRL_RSTS |= 0x03;
IT83XX_GCTRL_SPCTRL4 |= 0x07;
@@ -61,18 +67,11 @@ static void check_reset_cause(void)
if (raw_reset_cause2 & 0x04)
flags |= RESET_FLAG_RESET_PIN;
- /* Restore then clear saved reset flags. */
- if (!(flags & RESET_FLAG_POWER_ON)) {
- flags |= BRAM_RESET_FLAGS0 << 24;
- flags |= BRAM_RESET_FLAGS1 << 16;
- flags |= BRAM_RESET_FLAGS2 << 8;
- flags |= BRAM_RESET_FLAGS3;
-
- /* watchdog module triggers these reset */
- if (flags & (RESET_FLAG_HARD | RESET_FLAG_SOFT))
- flags &= ~RESET_FLAG_WATCHDOG;
- }
+ /* watchdog module triggers these reset */
+ if (flags & (RESET_FLAG_HARD | RESET_FLAG_SOFT))
+ flags &= ~RESET_FLAG_WATCHDOG;
+ /* Clear saved reset flags. */
BRAM_RESET_FLAGS0 = 0;
BRAM_RESET_FLAGS1 = 0;
BRAM_RESET_FLAGS2 = 0;