1 #include <linux/init.h>
2 #include <linux/list.h>
5 #include <asm/mach/irq.h>
6 #include <asm/hardware/iomd.h>
10 static void iomd_ack_irq_a(struct irq_data
*d
)
12 unsigned int val
, mask
;
15 val
= iomd_readb(IOMD_IRQMASKA
);
16 iomd_writeb(val
& ~mask
, IOMD_IRQMASKA
);
17 iomd_writeb(mask
, IOMD_IRQCLRA
);
20 static void iomd_mask_irq_a(struct irq_data
*d
)
22 unsigned int val
, mask
;
25 val
= iomd_readb(IOMD_IRQMASKA
);
26 iomd_writeb(val
& ~mask
, IOMD_IRQMASKA
);
29 static void iomd_unmask_irq_a(struct irq_data
*d
)
31 unsigned int val
, mask
;
34 val
= iomd_readb(IOMD_IRQMASKA
);
35 iomd_writeb(val
| mask
, IOMD_IRQMASKA
);
38 static struct irq_chip iomd_a_chip
= {
39 .irq_ack
= iomd_ack_irq_a
,
40 .irq_mask
= iomd_mask_irq_a
,
41 .irq_unmask
= iomd_unmask_irq_a
,
44 static void iomd_mask_irq_b(struct irq_data
*d
)
46 unsigned int val
, mask
;
48 mask
= 1 << (d
->irq
& 7);
49 val
= iomd_readb(IOMD_IRQMASKB
);
50 iomd_writeb(val
& ~mask
, IOMD_IRQMASKB
);
53 static void iomd_unmask_irq_b(struct irq_data
*d
)
55 unsigned int val
, mask
;
57 mask
= 1 << (d
->irq
& 7);
58 val
= iomd_readb(IOMD_IRQMASKB
);
59 iomd_writeb(val
| mask
, IOMD_IRQMASKB
);
62 static struct irq_chip iomd_b_chip
= {
63 .irq_ack
= iomd_mask_irq_b
,
64 .irq_mask
= iomd_mask_irq_b
,
65 .irq_unmask
= iomd_unmask_irq_b
,
68 static void iomd_mask_irq_dma(struct irq_data
*d
)
70 unsigned int val
, mask
;
72 mask
= 1 << (d
->irq
& 7);
73 val
= iomd_readb(IOMD_DMAMASK
);
74 iomd_writeb(val
& ~mask
, IOMD_DMAMASK
);
77 static void iomd_unmask_irq_dma(struct irq_data
*d
)
79 unsigned int val
, mask
;
81 mask
= 1 << (d
->irq
& 7);
82 val
= iomd_readb(IOMD_DMAMASK
);
83 iomd_writeb(val
| mask
, IOMD_DMAMASK
);
86 static struct irq_chip iomd_dma_chip
= {
87 .irq_ack
= iomd_mask_irq_dma
,
88 .irq_mask
= iomd_mask_irq_dma
,
89 .irq_unmask
= iomd_unmask_irq_dma
,
92 static void iomd_mask_irq_fiq(struct irq_data
*d
)
94 unsigned int val
, mask
;
96 mask
= 1 << (d
->irq
& 7);
97 val
= iomd_readb(IOMD_FIQMASK
);
98 iomd_writeb(val
& ~mask
, IOMD_FIQMASK
);
101 static void iomd_unmask_irq_fiq(struct irq_data
*d
)
103 unsigned int val
, mask
;
105 mask
= 1 << (d
->irq
& 7);
106 val
= iomd_readb(IOMD_FIQMASK
);
107 iomd_writeb(val
| mask
, IOMD_FIQMASK
);
110 static struct irq_chip iomd_fiq_chip
= {
111 .irq_ack
= iomd_mask_irq_fiq
,
112 .irq_mask
= iomd_mask_irq_fiq
,
113 .irq_unmask
= iomd_unmask_irq_fiq
,
116 extern unsigned char rpc_default_fiq_start
, rpc_default_fiq_end
;
118 void __init
rpc_init_irq(void)
120 unsigned int irq
, clr
, set
= 0;
122 iomd_writeb(0, IOMD_IRQMASKA
);
123 iomd_writeb(0, IOMD_IRQMASKB
);
124 iomd_writeb(0, IOMD_FIQMASK
);
125 iomd_writeb(0, IOMD_DMAMASK
);
127 set_fiq_handler(&rpc_default_fiq_start
,
128 &rpc_default_fiq_end
- &rpc_default_fiq_start
);
130 for (irq
= 0; irq
< NR_IRQS
; irq
++) {
133 if (irq
<= 6 || (irq
>= 9 && irq
<= 15))
136 if (irq
== 21 || (irq
>= 16 && irq
<= 19) ||
137 irq
== IRQ_KEYBOARDTX
)
142 irq_set_chip_and_handler(irq
, &iomd_a_chip
,
144 irq_modify_status(irq
, clr
, set
);
148 irq_set_chip_and_handler(irq
, &iomd_b_chip
,
150 irq_modify_status(irq
, clr
, set
);
154 irq_set_chip_and_handler(irq
, &iomd_dma_chip
,
156 irq_modify_status(irq
, clr
, set
);
160 irq_set_chip(irq
, &iomd_fiq_chip
);
161 irq_modify_status(irq
, clr
, set
);