summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2018-12-27 18:42:02 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-01-11 18:40:34 +0000
commitf6805af8796784818697d4575fdf12000388e4af (patch)
tree7aa802118a57513f53bd835b317a08dc24e5e696
parent72650f3577a040ee89fe31f2b23c34cd4d2fb95d (diff)
downloadchrome-ec-f6805af8796784818697d4575fdf12000388e4af.tar.gz
chip/stm32/clock: Cleanly clear pending RTC alarm IRQ
We want to reset RTC alarm and clear pending IRQ when EC wakes up from deep sleep mode. Unfortunately, RTC alarm IRQ is still latched and pending in NVIC unless we explicitly clear the flag in ICPR register. BUG=chromium:769503 BRANCH=scarlet TEST=confirm RTC alarm irq is not fired after EC exits deep sleep mode Change-Id: If6b9815337fbd24a0337116ef9c5fa1521671a93 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/1392408 Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Trybot-Ready: Philip Chen <philipchen@chromium.org>
-rw-r--r--chip/stm32/clock-f.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/chip/stm32/clock-f.c b/chip/stm32/clock-f.c
index 84c40dc557..3333538326 100644
--- a/chip/stm32/clock-f.c
+++ b/chip/stm32/clock-f.c
@@ -295,6 +295,9 @@ void reset_rtc_alarm(struct rtc_time_reg *rtc)
STM32_EXTI_IMR &= ~EXTI_RTC_ALR_EVENT;
STM32_EXTI_PR = EXTI_RTC_ALR_EVENT;
+ /* Clear the pending RTC alarm IRQ in NVIC */
+ task_clear_pending_irq(STM32_IRQ_RTC_ALARM);
+
/* Read current time */
rtc_read(rtc);