ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / arm / mach-iop3xx / xs80200-irq.c
1 /*
2  * linux/arch/arm/mach-iop3xx/xs80200-irq.c
3  *
4  * Generic IRQ handling for the XS80200 XScale core.
5  *
6  * Author:  Nicolas Pitre
7  * Copyright:   (C) 2001 MontaVista Software Inc.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13 #include <linux/init.h>
14 #include <linux/list.h>
15
16 #include <asm/mach/irq.h>
17 #include <asm/irq.h>
18 #include <asm/hardware.h>
19
20 #include <asm/mach-types.h>
21
22 static void xs80200_irq_mask (unsigned int irq)
23 {
24         unsigned long intctl;
25         asm ("mrc p13, 0, %0, c0, c0, 0" : "=r" (intctl));
26         switch (irq) {
27             case IRQ_XS80200_BCU:     intctl &= ~(1<<3); break;
28             case IRQ_XS80200_PMU:     intctl &= ~(1<<2); break;
29             case IRQ_XS80200_EXTIRQ:  intctl &= ~(1<<1); break;
30             case IRQ_XS80200_EXTFIQ:  intctl &= ~(1<<0); break;
31         }
32         asm ("mcr p13, 0, %0, c0, c0, 0" : : "r" (intctl));
33 }
34
35 static void xs80200_irq_unmask (unsigned int irq)
36 {
37         unsigned long intctl;
38         asm ("mrc p13, 0, %0, c0, c0, 0" : "=r" (intctl));
39         switch (irq) {
40             case IRQ_XS80200_BCU:       intctl |= (1<<3); break;
41             case IRQ_XS80200_PMU:       intctl |= (1<<2); break;
42             case IRQ_XS80200_EXTIRQ:    intctl |= (1<<1); break;
43             case IRQ_XS80200_EXTFIQ:    intctl |= (1<<0); break;
44         }
45         asm ("mcr p13, 0, %0, c0, c0, 0" : : "r" (intctl));
46 }
47
48 static struct irqchip xs80200_chip = {
49         .ack    = xs80200_irq_mask,
50         .mask   = xs80200_irq_mask,
51         .unmask = xs80200_irq_unmask,
52 };
53
54 void __init xs80200_init_irq(void)
55 {
56         unsigned int i;
57
58         asm("mcr p13, 0, %0, c0, c0, 0" : : "r" (0));
59
60         for (i = 0; i < NR_XS80200_IRQS; i++) {
61                 set_irq_chip(i, &xs80200_chip);
62                 set_irq_handler(i, do_level_IRQ);
63                 set_irq_flags(i, IRQF_VALID);
64         }
65 }