]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/avr32/lib/interrupts.c
avr32: add generic board support
[karo-tx-uboot.git] / arch / avr32 / lib / interrupts.c
1 /*
2  * Copyright (C) 2006 Atmel Corporation
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6 #include <common.h>
7
8 #include <asm/sysreg.h>
9
10 int interrupt_init(void)
11 {
12         return 0;
13 }
14
15 void enable_interrupts(void)
16 {
17         asm volatile("csrf      %0" : : "n"(SYSREG_GM_OFFSET));
18 }
19
20 int disable_interrupts(void)
21 {
22         unsigned long sr;
23
24         sr = sysreg_read(SR);
25         asm volatile("ssrf      %0" : : "n"(SYSREG_GM_OFFSET));
26
27 #ifdef CONFIG_AT32UC3A0xxx
28         /* Two NOPs are required after masking interrupts on the
29          * AT32UC3A0512ES. See errata 41.4.5.5. */
30         asm("nop");
31         asm("nop");
32 #endif
33
34         return !SYSREG_BFEXT(GM, sr);
35 }