From edb881c3dded700075a7f0cda5465ccd4a96dcc4 Mon Sep 17 00:00:00 2001 From: Philip Chen Date: Thu, 27 Dec 2018 18:42:02 -0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/1390947 Commit-Ready: Philip Chen Tested-by: Philip Chen Reviewed-by: Nicolas Boichat --- chip/stm32/clock-f.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chip/stm32/clock-f.c b/chip/stm32/clock-f.c index ee1c28dbb2..1872b0ce3c 100644 --- a/chip/stm32/clock-f.c +++ b/chip/stm32/clock-f.c @@ -254,6 +254,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); -- cgit v1.2.1