2 * include/asm-arm/arch-pnx4008/entry-macro.S
4 * Low-level IRQ helper macros for PNX4008-based platforms
6 * 2005-2006 (c) MontaVista Software, Inc.
7 * Author: Vitaly Wool <vwool@ru.mvista.com>
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
15 #define IO_BASE 0xF0000000
16 #define IO_ADDRESS(x) (((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) | IO_BASE)
18 #define INTRC_MASK 0x00
19 #define INTRC_RAW_STAT 0x04
20 #define INTRC_STAT 0x08
21 #define INTRC_POLAR 0x0C
22 #define INTRC_ACT_TYPE 0x10
23 #define INTRC_TYPE 0x14
25 #define SIC1_BASE_INT 32
26 #define SIC2_BASE_INT 64
31 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
32 /* decode the MIC interrupt numbers */
33 ldr \base, =IO_ADDRESS(PNX4008_INTCTRLMIC_BASE)
34 ldr \irqstat, [\base, #INTRC_STAT]
39 movhs \irqstat,\irqstat,lsr#16
41 addhs \irqnr,\irqnr,#8
42 movhs \irqstat,\irqstat,lsr#8
44 addhs \irqnr,\irqnr,#4
45 movhs \irqstat,\irqstat,lsr#4
47 addhs \irqnr,\irqnr,#2
48 movhs \irqstat,\irqstat,lsr#2
50 addhs \irqnr,\irqnr,#1
52 /* was there an interrupt ? if not then drop out with EQ status */
56 /* and now check for extended IRQ reasons */
62 /* IRQ 31,30 : High priority cascade IRQ handle */
63 /* read the correct SIC */
64 /* decoding status after compare : eq is 30 (SIC1) , ne is 31 (SIC2) */
65 /* set the base IRQ number */
66 ldreq \base, =IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
67 moveq \irqnr,#SIC1_BASE_INT
68 ldrne \base, =IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
69 movne \irqnr,#SIC2_BASE_INT
70 ldr \irqstat, [\base, #INTRC_STAT]
71 ldr \tmp, [\base, #INTRC_TYPE]
72 /* and with inverted mask : low priority interrupts */
73 and \irqstat,\irqstat,\tmp
77 /* IRQ 1,0 : Low priority cascade IRQ handle */
78 /* read the correct SIC */
79 /* decoding status after compare : eq is 1 (SIC2) , ne is 0 (SIC1)*/
80 /* read the correct SIC */
81 /* set the base IRQ number */
82 ldrne \base, =IO_ADDRESS(PNX4008_INTCTRLSIC1_BASE)
83 movne \irqnr,#SIC1_BASE_INT
84 ldreq \base, =IO_ADDRESS(PNX4008_INTCTRLSIC2_BASE)
85 moveq \irqnr,#SIC2_BASE_INT
86 ldr \irqstat, [\base, #INTRC_STAT]
87 ldr \tmp, [\base, #INTRC_TYPE]
88 /* and with inverted mask : low priority interrupts */
89 bic \irqstat,\irqstat,\tmp
94 addhs \irqnr,\irqnr,#16
95 movhs \irqstat,\irqstat,lsr#16
97 addhs \irqnr,\irqnr,#8
98 movhs \irqstat,\irqstat,lsr#8
100 addhs \irqnr,\irqnr,#4
101 movhs \irqstat,\irqstat,lsr#4
103 addhs \irqnr,\irqnr,#2
104 movhs \irqstat,\irqstat,lsr#2
106 addhs \irqnr,\irqnr,#1
109 /* is irqstat not zero */
112 /* we assert that irqstat is not equal to zero and return ne status if true*/
118 .macro irq_prio_table