# BRCM_VERSION=3
[bcm963xx.git] / kernel / linux / 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 static void xs80200_irq_mask (unsigned int irq)
21 {
22         unsigned long intctl;
23         asm ("mrc p13, 0, %0, c0, c0, 0" : "=r" (intctl));
24         switch (irq) {
25             case IRQ_XS80200_BCU:     intctl &= ~(1<<3); break;
26             case IRQ_XS80200_PMU:     intctl &= ~(1<<2); break;
27             case IRQ_XS80200_EXTIRQ:  intctl &= ~(1<<1); break;
28             case IRQ_XS80200_EXTFIQ:  intctl &= ~(1<<0); break;
29         }
30         asm ("mcr p13, 0, %0, c0, c0, 0" : : "r" (intctl));
31 }
32
33 static void xs80200_irq_unmask (unsigned int irq)
34 {
35         unsigned long intctl;
36         asm ("mrc p13, 0, %0, c0, c0, 0" : "=r" (intctl));
37         switch (irq) {
38             case IRQ_XS80200_BCU:       intctl |= (1<<3); break;
39             case IRQ_XS80200_PMU:       intctl |= (1<<2); break;
40             case IRQ_XS80200_EXTIRQ:    intctl |= (1<<1); break;
41             case IRQ_XS80200_EXTFIQ:    intctl |= (1<<0); break;
42         }
43         asm ("mcr p13, 0, %0, c0, c0, 0" : : "r" (intctl));
44 }
45
46 static struct irqchip xs80200_chip = {
47         .ack    = xs80200_irq_mask,
48         .mask   = xs80200_irq_mask,
49         .unmask = xs80200_irq_unmask,
50 };
51
52 void __init xs80200_init_irq(void)
53 {
54         unsigned int i;
55
56         asm("mcr p13, 0, %0, c0, c0, 0" : : "r" (0));
57
58         for (i = 0; i < NR_XS80200_IRQS; i++) {
59                 set_irq_chip(i, &xs80200_chip);
60                 set_irq_handler(i, do_level_IRQ);
61                 set_irq_flags(i, IRQF_VALID);
62         }
63 }