import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / arm / mach-anakin / irq.c
1 /*
2  *  linux/arch/arm/mach-anakin/irq.c
3  *
4  *  Copyright (C) 2001 Aleph One Ltd. for Acunia N.V.
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 version 2 as
8  * published by the Free Software Foundation.
9  *
10  *  Changelog:
11  *   10-Apr-2001 TTC    Created
12  */
13
14 #include <linux/ptrace.h>
15 #include <linux/sched.h>
16 #include <linux/interrupt.h>
17 #include <linux/init.h>
18 #include <linux/list.h>
19 #include <linux/timer.h>
20
21 #include <asm/irq.h>
22 #include <asm/mach/irq.h>
23
24 extern unsigned int anakin_irq_mask, anakin_active_irqs;
25 extern void do_IRQ(int, struct pt_regs *);
26
27 static void
28 anakin_mask_irq(unsigned int irq)
29 {
30         anakin_irq_mask &= ~(1 << irq);
31 }
32
33 static void
34 anakin_unmask_irq(unsigned int irq)
35 {
36         anakin_irq_mask |= (1 << irq);
37 }
38
39 /*
40  * This is a faked interrupt to deal with parallel interrupt requests
41  * on the Anakin.  Make sure that its interrupt number is not in any
42  * way conflicting with the hardware interrupt numbers!  Check
43  * IRQ_ANAKIN in linux/include/asm-arm/arch-anakin/irqs.h.
44  */
45 static void
46 anakin_interrupt(int irq, void *dev_id, struct pt_regs *regs)
47 {
48         for (irq = 0; irq < NR_IRQS; irq++)
49                 if (anakin_active_irqs & (1 << irq))
50                         do_IRQ(irq, regs);
51 }
52
53 static struct irqaction anakin_irq = {
54         .name           = "Anakin IRQ",
55         .handler        = anakin_interrupt,
56         .flags          = SA_INTERRUPT,
57 };
58  
59 void __init
60 irq_init_irq(void)
61 {
62         unsigned int irq;
63
64         for (irq = 0; irq < NR_IRQS; irq++) {
65                 switch (irq) {
66                 case IRQ_UART0:
67                 case IRQ_UART1:
68                 case IRQ_UART2:
69                 case IRQ_TICK:
70                 case IRQ_CODEC:
71                 case IRQ_UART4:
72                 case IRQ_TOUCHSCREEN:
73                 case IRQ_UART3:
74                 case IRQ_FIFO:
75                 case IRQ_CAN:
76                 case IRQ_COMPACTFLASH:
77                 case IRQ_BOSH:
78                 case IRQ_ANAKIN:
79                         irq_desc[irq].valid = 1;
80                         irq_desc[irq].mask_ack = anakin_mask_irq;
81                         irq_desc[irq].mask = anakin_mask_irq;
82                         irq_desc[irq].unmask = anakin_unmask_irq;
83                 }
84         }
85         setup_arm_irq(IRQ_ANAKIN, &anakin_irq);
86 }