summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2018-12-27 18:42:02 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-01-05 14:52:12 -0800
commitedb881c3dded700075a7f0cda5465ccd4a96dcc4 (patch)
tree33030713db67f738c7185acf7312db5815005e78
parent88f7e7992fde6b0797c72474c8cba827ade82492 (diff)
downloadchrome-ec-edb881c3dded700075a7f0cda5465ccd4a96dcc4.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/1390947 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@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 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);