[PATCH] w1_therm: support for ds18b20, ds1822 thermal sensors.
[linux-2.6/verdex.git] / arch / mips / kernel / irq-rm7000.c
blobf5d779fd0355343f406a0ad33f0f68f1b93bbc08
1 /*
2 * Copyright (C) 2003 Ralf Baechle
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
9 * Handler for RM7000 extended interrupts. These are a non-standard
10 * feature so we handle them separately from standard interrupts.
12 #include <linux/init.h>
13 #include <linux/interrupt.h>
14 #include <linux/kernel.h>
16 #include <asm/irq_cpu.h>
17 #include <asm/mipsregs.h>
18 #include <asm/system.h>
20 static int irq_base;
22 static inline void unmask_rm7k_irq(unsigned int irq)
24 set_c0_intcontrol(0x100 << (irq - irq_base));
27 static inline void mask_rm7k_irq(unsigned int irq)
29 clear_c0_intcontrol(0x100 << (irq - irq_base));
32 static inline void rm7k_cpu_irq_enable(unsigned int irq)
34 unsigned long flags;
36 local_irq_save(flags);
37 unmask_rm7k_irq(irq);
38 local_irq_restore(flags);
41 static void rm7k_cpu_irq_disable(unsigned int irq)
43 unsigned long flags;
45 local_irq_save(flags);
46 mask_rm7k_irq(irq);
47 local_irq_restore(flags);
50 static unsigned int rm7k_cpu_irq_startup(unsigned int irq)
52 rm7k_cpu_irq_enable(irq);
54 return 0;
57 #define rm7k_cpu_irq_shutdown rm7k_cpu_irq_disable
60 * While we ack the interrupt interrupts are disabled and thus we don't need
61 * to deal with concurrency issues. Same for rm7k_cpu_irq_end.
63 static void rm7k_cpu_irq_ack(unsigned int irq)
65 mask_rm7k_irq(irq);
68 static void rm7k_cpu_irq_end(unsigned int irq)
70 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
71 unmask_rm7k_irq(irq);
74 static hw_irq_controller rm7k_irq_controller = {
75 "RM7000",
76 rm7k_cpu_irq_startup,
77 rm7k_cpu_irq_shutdown,
78 rm7k_cpu_irq_enable,
79 rm7k_cpu_irq_disable,
80 rm7k_cpu_irq_ack,
81 rm7k_cpu_irq_end,
84 void __init rm7k_cpu_irq_init(int base)
86 int i;
88 clear_c0_intcontrol(0x00000f00); /* Mask all */
90 for (i = base; i < base + 4; i++) {
91 irq_desc[i].status = IRQ_DISABLED;
92 irq_desc[i].action = NULL;
93 irq_desc[i].depth = 1;
94 irq_desc[i].handler = &rm7k_irq_controller;
97 irq_base = base;