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>
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
)
36 local_irq_save(flags
);
38 local_irq_restore(flags
);
41 static void rm7k_cpu_irq_disable(unsigned int irq
)
45 local_irq_save(flags
);
47 local_irq_restore(flags
);
50 static unsigned int rm7k_cpu_irq_startup(unsigned int irq
)
52 rm7k_cpu_irq_enable(irq
);
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
)
68 static void rm7k_cpu_irq_end(unsigned int irq
)
70 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
| IRQ_INPROGRESS
)))
74 static hw_irq_controller rm7k_irq_controller
= {
76 .startup
= rm7k_cpu_irq_startup
,
77 .shutdown
= rm7k_cpu_irq_shutdown
,
78 .enable
= rm7k_cpu_irq_enable
,
79 .disable
= rm7k_cpu_irq_disable
,
80 .ack
= rm7k_cpu_irq_ack
,
81 .end
= rm7k_cpu_irq_end
,
84 void __init
rm7k_cpu_irq_init(int base
)
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
;