blob: cc06b1bd37b245a5f030feb3ef5955f18c2863b0 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * include/asm-arm/arch-s3c2410/entry-macro.S
3 *
4 * Low-level IRQ helper macros for S3C2410-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 * Modifications:
11 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
12 */
Russell King78ff18a2006-01-03 17:39:34 +000013#include <asm/hardware.h>
14#include <asm/arch/irqs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16
17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
18
19 mov \tmp, #S3C24XX_VA_IRQ
20 ldr \irqnr, [ \tmp, #0x14 ] @ get irq no
2130000:
22 teq \irqnr, #4
23 teqne \irqnr, #5
24 beq 1002f @ external irq reg
25
26 @ debug check to see if interrupt reported is the same
27 @ as the offset....
28
29 teq \irqnr, #0
30 beq 20002f
31 ldr \irqstat, [ \tmp, #0x10 ] @ INTPND
32 mov \irqstat, \irqstat, lsr \irqnr
33 tst \irqstat, #1
34 bne 20002f
35
36 /* debug/warning if we get an invalud response from the
37 * INTOFFSET register */
38#if 1
39 stmfd r13!, { r0 - r4 , r8-r12, r14 }
40 ldr r1, [ \tmp, #0x14 ] @ INTOFFSET
41 ldr r2, [ \tmp, #0x10 ] @ INTPND
42 ldr r3, [ \tmp, #0x00 ] @ SRCPND
43 adr r0, 20003f
44 bl printk
45 b 20004f
46
4720003:
48 .ascii "<7>irq: err - bad offset %d, intpnd=%08x, srcpnd=%08x\n"
49 .byte 0
50 .align 4
5120004:
52 mov r1, #1
53 mov \tmp, #S3C24XX_VA_IRQ
54 ldmfd r13!, { r0 - r4 , r8-r12, r14 }
55#endif
56
57 @ try working out interrupt number for ourselves
58 mov \irqnr, #0
59 ldr \irqstat, [ \tmp, #0x10 ] @ INTPND
6010021:
61 movs \irqstat, \irqstat, lsr#1
62 bcs 30000b @ try and re-start the proccess
63 add \irqnr, \irqnr, #1
64 cmp \irqnr, #32
65 ble 10021b
66
67 @ found no interrupt, set Z flag and leave
68 movs \irqnr, #0
69 b 1001f
70
7120005:
7220002: @ exit
73 @ we base the s3c2410x interrupts at 16 and above to allow
74 @ isa peripherals to have their standard interrupts, also
75 @ ensure that Z flag is un-set on exit
76
77 @ note, we cannot be sure if we get IRQ_EINT0 (0) that
78 @ there is simply no interrupt pending, so in all other
79 @ cases we jump to say we have found something, otherwise
80 @ we check to see if the interrupt really is assrted
81 adds \irqnr, \irqnr, #IRQ_EINT0
82 teq \irqnr, #IRQ_EINT0
83 bne 1001f @ exit
84 ldr \irqstat, [ \tmp, #0x10 ] @ INTPND
85 teq \irqstat, #0
86 moveq \irqnr, #0
87 b 1001f
88
89 @ we get here from no main or external interrupts pending
901002:
91 add \tmp, \tmp, #S3C24XX_VA_GPIO - S3C24XX_VA_IRQ
92 ldr \irqstat, [ \tmp, # 0xa8 ] @ EXTINTPEND
93 ldr \irqnr, [ \tmp, # 0xa4 ] @ EXTINTMASK
94
95 bic \irqstat, \irqstat, \irqnr @ clear masked irqs
96
97 mov \irqnr, #IRQ_EINT4 @ start extint nos
98 mov \irqstat, \irqstat, lsr#4 @ ignore bottom 4 bits
9910021:
100 movs \irqstat, \irqstat, lsr#1
101 bcs 1004f
102 add \irqnr, \irqnr, #1
103 cmp \irqnr, #IRQ_EINT23
104 ble 10021b
105
106 @ found no interrupt, set Z flag and leave
107 movs \irqnr, #0
108
1091004: @ ensure Z flag clear in case our MOVS shifted out the last bit
110 teq \irqnr, #0
1111001:
112 @ exit irq routine
113 .endm
114
115
116 /* currently don't need an disable_fiq macro */
117
118 .macro disable_fiq
119 .endm
120
121