blob: 5f3a49e15212edf55cc34ba955c31d78ed455f2b [file] [log] [blame]
Wolfgang Denk83c15852006-10-24 14:21:16 +02001/*
2 * Copyright (C) 2006 Atmel Corporation
3 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Wolfgang Denk83c15852006-10-24 14:21:16 +02005 */
6#include <common.h>
7
8#include <asm/sysreg.h>
9
Andreas Bießmannc1d09172015-02-06 23:06:48 +010010int interrupt_init(void)
11{
12 return 0;
13}
14
Wolfgang Denk83c15852006-10-24 14:21:16 +020015void enable_interrupts(void)
16{
17 asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET));
18}
19
20int disable_interrupts(void)
21{
22 unsigned long sr;
23
24 sr = sysreg_read(SR);
25 asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET));
26
Olav Morken4cbcd5c2009-01-23 12:56:32 +010027#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
Haavard Skinnemoend3567ab2007-12-17 11:02:44 +010034 return !SYSREG_BFEXT(GM, sr);
Wolfgang Denk83c15852006-10-24 14:21:16 +020035}