Merge branch 'samsung/exynos5' into next/soc2
[linux-2.6.git] / arch / arm / mach-clps711x / include / mach / entry-macro.S
1 /*
2  * arch/arm/mach-clps711x/include/mach/entry-macro.S
3  *
4  * Low-level IRQ helper macros for CLPS711X-based platforms
5  *
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.
9  */
10 #include <mach/hardware.h>
11 #include <asm/hardware/clps7111.h>
12
13                 .macro  get_irqnr_preamble, base, tmp
14                 .endm
15
16 #if (INTSR2 - INTSR1) != (INTMR2 - INTMR1)
17 #error INTSR stride != INTMR stride
18 #endif
19
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]
24                 mov     \irqnr, #4
25                 mov     \mask, \mask, lsl #16
26                 and     \stat, \stat, \mask, lsr #16
27                 movs    \stat, \stat, lsr #4
28                 bne     1001f
29
30                 add     \base, \base, #INTSR2 - INTSR1
31                 ldr     \stat, [\base, #INTSR1]
32                 ldr     \mask, [\base, #INTMR1]
33                 mov     \irqnr, #16
34                 mov     \mask, \mask, lsl #16
35                 and     \stat, \stat, \mask, lsr #16
36
37 1001:           tst     \stat, #255
38                 addeq   \irqnr, \irqnr, #8
39                 moveq   \stat, \stat, lsr #8
40                 tst     \stat, #15
41                 addeq   \irqnr, \irqnr, #4
42                 moveq   \stat, \stat, lsr #4
43                 tst     \stat, #3
44                 addeq   \irqnr, \irqnr, #2
45                 moveq   \stat, \stat, lsr #2
46                 tst     \stat, #1
47                 addeq   \irqnr, \irqnr, #1
48                 moveq   \stat, \stat, lsr #1
49                 tst     \stat, #1                       @ bit 0 should be set
50                 .endm
51
52