27 #include <linux/bitops.h>
28 #include <linux/errno.h>
32 #include <linux/module.h>
33 #include <linux/signal.h>
34 #include <linux/sched.h>
35 #include <linux/types.h>
38 #include <linux/timex.h>
39 #include <linux/random.h>
42 #include <asm/bootinfo.h>
54 #define RC32434_NR_IRQS (GROUP4_IRQ_BASE + 32)
56 #if (NR_IRQS < RC32434_NR_IRQS)
57 #error Too little irqs defined. Did you override <asm/irq.h> ?
78 #define READ_PEND(base) (*(base))
79 #define READ_MASK(base) (*(base + 2))
80 #define WRITE_MASK(base, val) (*(base + 2) = (val))
82 static inline int irq_to_group(
unsigned int irq_nr)
87 static inline int group_to_ip(
unsigned int group)
92 static inline void enable_local_irq(
unsigned int ip)
94 int ipnum = 0x100 <<
ip;
99 static inline void disable_local_irq(
unsigned int ip)
101 int ipnum = 0x100 <<
ip;
103 clear_c0_status(ipnum);
106 static inline void ack_local_irq(
unsigned int ip)
108 int ipnum = 0x100 <<
ip;
110 clear_c0_cause(ipnum);
113 static void rb532_enable_irq(
struct irq_data *
d)
117 volatile unsigned int *
addr;
120 enable_local_irq(irq_nr);
127 enable_local_irq(group_to_ip(group));
134 static void rb532_disable_irq(
struct irq_data *d)
138 volatile unsigned int *
addr;
141 disable_local_irq(irq_nr);
160 if (mask == intr_group[group].mask)
161 disable_local_irq(group_to_ip(group));
165 static void rb532_mask_and_ack_irq(
struct irq_data *d)
167 rb532_disable_irq(d);
168 ack_local_irq(group_to_ip(irq_to_group(d->
irq)));
171 static int rb532_set_type(
struct irq_data *d,
unsigned type)
174 int group = irq_to_group(d->
irq);
193 static struct irq_chip rc32434_irq_type = {
195 .irq_ack = rb532_disable_irq,
196 .irq_mask = rb532_disable_irq,
197 .irq_mask_ack = rb532_mask_and_ack_irq,
198 .irq_unmask = rb532_enable_irq,
199 .irq_set_type = rb532_set_type,
209 irq_set_chip_and_handler(i, &rc32434_irq_type,
217 volatile unsigned int *
addr;
223 ip = (cp0_cause & 0x7c00);
225 group = 21 + (fls(ip) - 32);
231 pend = 39 + (fls(pend) - 32);
232 do_IRQ((group << 5) + pend);