diff options
-rw-r--r-- | chip/npcx/system.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c index eda899d833..bce7b17e09 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -418,12 +418,15 @@ void system_set_rtc_alarm(uint32_t seconds, uint32_t microseconds) alarm_secs = cur_secs + seconds; alarm_secs = alarm_secs & MTC_ALARM_MASK; + /* + * We should set new alarm (first 25 bits of clock value) first before + * clearing PTO in case issue rtc interrupt immediately. + */ + NPCX_WTC = alarm_secs; + /* Reset alarm first */ system_reset_rtc_alarm(); - /* Set alarm, use first 25 bits of clock value */ - NPCX_WTC = alarm_secs; - /* Enable interrupt mode alarm */ SET_BIT(NPCX_WTC, NPCX_WTC_WIE); |