2 * include/asm-arm/arch-clps711x/entry-macro.S
4 * Low-level IRQ helper macros for CLPS711X-based platforms
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
10 #include <asm/hardware.h>
11 #include <asm/hardware/clps7111.h>
16 #if (INTSR2 - INTSR1) != (INTMR2 - INTMR1)
17 #error INTSR stride != INTMR stride
20 .macro get_irqnr_and_base, irqnr, stat, base, mask
21 mov \base, #CLPS7111_BASE
22 ldr \stat, [\base, #INTSR1]
23 ldr \mask, [\base, #INTMR1]
25 mov \mask, \mask, lsl #16
26 and \stat, \stat, \mask, lsr #16
27 movs \stat, \stat, lsr #4
30 add \base, \base, #INTSR2 - INTSR1
31 ldr \stat, [\base, #INTSR1]
32 ldr \mask, [\base, #INTMR1]
34 mov \mask, \mask, lsl #16
35 and \stat, \stat, \mask, lsr #16
38 addeq \irqnr, \irqnr, #8
39 moveq \stat, \stat, lsr #8
41 addeq \irqnr, \irqnr, #4
42 moveq \stat, \stat, lsr #4
44 addeq \irqnr, \irqnr, #2
45 moveq \stat, \stat, lsr #2
47 addeq \irqnr, \irqnr, #1
48 moveq \stat, \stat, lsr #1
49 tst \stat, #1 @ bit 0 should be set