1/*
2 * include/asm-arm/hardware/entry-macro-iomd.S
3 *
4 * Low-level IRQ helper macros for IOC/IOMD 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
11/* IOC / IOMD based hardware */
12#include <asm/hardware/iomd.h>
13
14		.macro	disable_fiq
15		mov	r12, #ioc_base_high
16		.if	ioc_base_low
17		orr	r12, r12, #ioc_base_low
18		.endif
19		strb	r12, [r12, #0x38]	@ Disable FIQ register
20		.endm
21
22		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
23		ldrb	\irqstat, [\base, #IOMD_IRQREQB]	@ get high priority first
24		ldr	\tmp, =irq_prio_h
25		teq	\irqstat, #0
26#ifdef IOMD_BASE
27		ldreqb	\irqstat, [\base, #IOMD_DMAREQ]	@ get dma
28		addeq	\tmp, \tmp, #256		@ irq_prio_h table size
29		teqeq	\irqstat, #0
30		bne	2406f
31#endif
32		ldreqb	\irqstat, [\base, #IOMD_IRQREQA]	@ get low priority
33		addeq	\tmp, \tmp, #256		@ irq_prio_d table size
34		teqeq	\irqstat, #0
35#ifdef IOMD_IRQREQC
36		ldreqb	\irqstat, [\base, #IOMD_IRQREQC]
37		addeq	\tmp, \tmp, #256		@ irq_prio_l table size
38		teqeq	\irqstat, #0
39#endif
40#ifdef IOMD_IRQREQD
41		ldreqb	\irqstat, [\base, #IOMD_IRQREQD]
42		addeq	\tmp, \tmp, #256		@ irq_prio_lc table size
43		teqeq	\irqstat, #0
44#endif
452406:		ldrneb	\irqnr, [\tmp, \irqstat]	@ get IRQ number
46		.endm
47
48/*
49 * Interrupt table (incorporates priority).  Please note that we
50 * rely on the order of these tables (see above code).
51 */
52		.align	5
53irq_prio_h:	.byte	 0, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
54		.byte	12, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
55		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
56		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
57		.byte	14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
58		.byte	14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
59		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
60		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
61		.byte	15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
62		.byte	15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
63		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
64		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
65		.byte	15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
66		.byte	15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
67		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
68		.byte	13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
69#ifdef IOMD_BASE
70irq_prio_d:	.byte	 0,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
71		.byte	20,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
72		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
73		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
74		.byte	22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
75		.byte	22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
76		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
77		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
78		.byte	23,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
79		.byte	23,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
80		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
81		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
82		.byte	22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
83		.byte	22,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
84		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
85		.byte	21,16,17,16,18,16,17,16,19,16,17,16,18,16,17,16
86#endif
87irq_prio_l:	.byte	 0, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
88		.byte	 4, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
89		.byte	 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
90		.byte	 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
91		.byte	 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
92		.byte	 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
93		.byte	 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
94		.byte	 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
95		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
96		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
97		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
98		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
99		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
100		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
101		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
102		.byte	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
103#ifdef IOMD_IRQREQC
104irq_prio_lc:	.byte	24,24,25,24,26,26,26,26,27,27,27,27,27,27,27,27
105		.byte	28,24,25,24,26,26,26,26,27,27,27,27,27,27,27,27
106		.byte	29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
107		.byte	29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
108		.byte	30,30,30,30,30,30,30,30,27,27,27,27,27,27,27,27
109		.byte	30,30,30,30,30,30,30,30,27,27,27,27,27,27,27,27
110		.byte	29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
111		.byte	29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29
112		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
113		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
114		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
115		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
116		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
117		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
118		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
119		.byte	31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31
120#endif
121#ifdef IOMD_IRQREQD
122irq_prio_ld:	.byte	40,40,41,40,42,42,42,42,43,43,43,43,43,43,43,43
123		.byte	44,40,41,40,42,42,42,42,43,43,43,43,43,43,43,43
124		.byte	45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
125		.byte	45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
126		.byte	46,46,46,46,46,46,46,46,43,43,43,43,43,43,43,43
127		.byte	46,46,46,46,46,46,46,46,43,43,43,43,43,43,43,43
128		.byte	45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
129		.byte	45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45
130		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
131		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
132		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
133		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
134		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
135		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
136		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
137		.byte	47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47
138#endif
139