summaryrefslogtreecommitdiff
path: root/recipes-bsp/at91bootstrap/at91bootstrap-3.8.12/0003-disable-rtc-interrupts.patch
blob: d262972d1e509e1f6f93eb3585205dcac0b7ed5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff -Naru orig/board/at91sam9x5ek/at91sam9x5ek.c new/board/at91sam9x5ek/at91sam9x5ek.c
--- orig/board/at91sam9x5ek/at91sam9x5ek.c	2018-01-04 18:06:52.533763774 -0600
+++ new/board/at91sam9x5ek/at91sam9x5ek.c	2018-01-04 18:32:57.905717432 -0600
@@ -44,6 +44,18 @@
 #include "at91sam9x5ek.h"
 #include "board_hw_info.h"
 
+#define RTC_SCCR   0x1C
+#define RTC_IDR    0x24
+
+static void at91_disable_rtc(void)
+{
+	/* disable all RTC interrupts and clear status register.
+	 * Prevents possible Linux lockup due to unexpected RTC interrupt
+	 */
+	writel(0xFF, RTC_IDR + AT91C_BASE_RTC);
+	writel(0xFF, RTC_SCCR + AT91C_BASE_RTC);
+}
+
 static void at91_dbgu_hw_init(void)
 {
 	/* Configure DBGU pins */
@@ -161,6 +173,9 @@
 #ifdef CONFIG_HW_INIT
 void hw_init(void)
 {
+        /* 1st chance to disable RTC */
+        at91_disable_rtc();
+        
 	/* Disable watchdog */
 	at91_disable_wdt();