summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-10-22 15:41:54 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-23 03:32:51 +0000
commiteab146be79186bdfb95d6997f95dbd7565fc03f8 (patch)
tree9ac473240d3d5e085f0587b73bcd6a4e79d01df5
parent965e6bd9f948392d567d3339850e681096390d0e (diff)
downloadchrome-ec-eab146be79186bdfb95d6997f95dbd7565fc03f8.tar.gz
stm32f3: Use the correct RTC ALARM IRQ
On STM32F0, a single IRQ is used for all RTC events, including RTC_ALARM and RTC_WAKEUP, and this IRQ is named RTC_WAKEUP. We use RTC_WAKEUP IRQ in our code while we actually meant to capture RTC alarm event. On STM32F3, RTC_WAKEUP and RTC_ALARM are separate IRQs and thus we're having problem. Let's make it explicit which RTC IRQ we want to use and fix our code to use RTC_ALARM. BRANCH=None BUG=chrome-os-partner:33219 TEST=Run 'rtc_alarm' on Ryu and verify the EC gets interrupted after a second. Change-Id: Ib1a14a5da49d709a4d071d44fbfa46544cc5929b Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224998 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/stm32/clock-stm32f0.c4
-rw-r--r--chip/stm32/registers.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/chip/stm32/clock-stm32f0.c b/chip/stm32/clock-stm32f0.c
index 39a18b8e09..ac5e153209 100644
--- a/chip/stm32/clock-stm32f0.c
+++ b/chip/stm32/clock-stm32f0.c
@@ -194,7 +194,7 @@ void __rtc_alarm_irq(void)
reset_rtc_alarm(&rtc, &rtcss);
}
-DECLARE_IRQ(STM32_IRQ_RTC_WAKEUP, __rtc_alarm_irq, 1);
+DECLARE_IRQ(STM32_IRQ_RTC_ALARM, __rtc_alarm_irq, 1);
static void config_hispeed_clock(void)
{
@@ -437,7 +437,7 @@ void rtc_init(void)
/* Enable RTC alarm interrupt */
STM32_RTC_CR |= STM32_RTC_CR_ALRAIE | STM32_RTC_CR_BYPSHAD;
STM32_EXTI_RTSR |= EXTI_RTC_ALR_EVENT;
- task_enable_irq(STM32_IRQ_RTC_WAKEUP);
+ task_enable_irq(STM32_IRQ_RTC_ALARM);
rtc_lock_regs();
}
diff --git a/chip/stm32/registers.h b/chip/stm32/registers.h
index 24109454f1..37f907f9b8 100644
--- a/chip/stm32/registers.h
+++ b/chip/stm32/registers.h
@@ -15,6 +15,7 @@
#define STM32_IRQ_WWDG 0
#define STM32_IRQ_PVD 1
#define STM32_IRQ_RTC_WAKEUP 2
+#define STM32_IRQ_RTC_ALARM 2
#define STM32_IRQ_FLASH 3
#define STM32_IRQ_RCC 4
#define STM32_IRQ_EXTI0_1 5