import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / arm / mach-integrator / irq.c
1 /*
2  *  linux/arch/arm/mach-integrator/irq.c
3  *
4  *  Copyright (C) 1999 ARM Limited
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20 #include <linux/init.h>
21 #include <linux/stddef.h>
22 #include <linux/list.h>
23 #include <linux/timer.h>
24
25 #include <asm/hardware.h>
26 #include <asm/irq.h>
27 #include <asm/io.h>
28
29 #include <asm/mach/irq.h>
30
31 /* 
32  * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
33  * is the (PA >> 12).
34  *
35  * Setup a VA for the Integrator interrupt controller (for header #0,
36  * just for now).
37  */
38 #define VA_IC_BASE              IO_ADDRESS(INTEGRATOR_IC_BASE) 
39 #define VA_CMIC_BASE            IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_IC_OFFSET
40
41 #define ALLPCI ( (1 << IRQ_PCIINT0) | (1 << IRQ_PCIINT1) | (1 << IRQ_PCIINT2) | (1 << IRQ_PCIINT3) ) 
42
43 static void sc_mask_irq(unsigned int irq)
44 {
45         __raw_writel(1 << irq, VA_IC_BASE + IRQ_ENABLE_CLEAR);
46 }
47
48 static void sc_unmask_irq(unsigned int irq)
49 {
50         __raw_writel(1 << irq, VA_IC_BASE + IRQ_ENABLE_SET);
51 }
52  
53 void __init integrator_init_irq(void)
54 {
55         unsigned int i;
56
57         for (i = 0; i < NR_IRQS; i++) {
58                 if (((1 << i) & INTEGRATOR_SC_VALID_INT) != 0) {
59                         irq_desc[i].valid       = 1;
60                         irq_desc[i].probe_ok    = 1;
61                         irq_desc[i].mask_ack    = sc_mask_irq;
62                         irq_desc[i].mask        = sc_mask_irq;
63                         irq_desc[i].unmask      = sc_unmask_irq;
64                 }
65         }
66
67         /* Disable all interrupts initially. */
68         /* Do the core module ones */
69         __raw_writel(-1, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
70
71         /* do the header card stuff next */
72         __raw_writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR);
73         __raw_writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR);
74 }