23 #include <linux/module.h>
26 #include <linux/device.h>
29 #include <mach/hardware.h>
34 #include <mach/regs-irq.h>
35 #include <mach/regs-gpio.h>
41 #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1)
43 static inline void s3c2443_irq_demux(
unsigned int irq,
unsigned int len)
45 unsigned int subsrc, submsk;
56 subsrc &= (1 << len)-1;
60 for (; irq < end && subsrc; irq++) {
70 static void s3c2443_irq_demux_wdtac97(
unsigned int irq,
struct irq_desc *
desc)
75 #define INTMSK_WDTAC97 (1UL << (IRQ_WDT - IRQ_EINT0))
76 #define SUBMSK_WDTAC97 INTMSK(IRQ_S3C2443_WDT, IRQ_S3C2443_AC97)
78 static void s3c2443_irq_wdtac97_mask(
struct irq_data *
data)
83 static void s3c2443_irq_wdtac97_unmask(
struct irq_data *
data)
88 static void s3c2443_irq_wdtac97_ack(
struct irq_data *
data)
93 static struct irq_chip s3c2443_irq_wdtac97 = {
94 .irq_mask = s3c2443_irq_wdtac97_mask,
95 .irq_unmask = s3c2443_irq_wdtac97_unmask,
96 .irq_ack = s3c2443_irq_wdtac97_ack,
101 static void s3c2443_irq_demux_lcd(
unsigned int irq,
struct irq_desc *
desc)
106 #define INTMSK_LCD (1UL << (IRQ_LCD - IRQ_EINT0))
107 #define SUBMSK_LCD INTMSK(IRQ_S3C2443_LCD1, IRQ_S3C2443_LCD4)
114 static void s3c2443_irq_lcd_unmask(
struct irq_data *
data)
124 static struct irq_chip s3c2443_irq_lcd = {
125 .irq_mask = s3c2443_irq_lcd_mask,
126 .irq_unmask = s3c2443_irq_lcd_unmask,
127 .irq_ack = s3c2443_irq_lcd_ack,
132 static void s3c2443_irq_demux_dma(
unsigned int irq,
struct irq_desc *
desc)
137 #define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0))
138 #define SUBMSK_DMA INTMSK(IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5)
145 static void s3c2443_irq_dma_unmask(
struct irq_data *
data)
155 static struct irq_chip s3c2443_irq_dma = {
156 .irq_mask = s3c2443_irq_dma_mask,
157 .irq_unmask = s3c2443_irq_dma_unmask,
158 .irq_ack = s3c2443_irq_dma_ack,
163 static void s3c2443_irq_demux_uart3(
unsigned int irq,
struct irq_desc *
desc)
168 #define INTMSK_UART3 (1UL << (IRQ_S3C2443_UART3 - IRQ_EINT0))
169 #define SUBMSK_UART3 (0x7 << (IRQ_S3C2443_RX3 - S3C2410_IRQSUB(0)))
171 static void s3c2443_irq_uart3_mask(
struct irq_data *
data)
176 static void s3c2443_irq_uart3_unmask(
struct irq_data *
data)
181 static void s3c2443_irq_uart3_ack(
struct irq_data *
data)
186 static struct irq_chip s3c2443_irq_uart3 = {
187 .irq_mask = s3c2443_irq_uart3_mask,
188 .irq_unmask = s3c2443_irq_uart3_unmask,
189 .irq_ack = s3c2443_irq_uart3_ack,
194 static void s3c2443_irq_demux_cam(
unsigned int irq,
struct irq_desc *
desc)
199 #define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
200 #define SUBMSK_CAM INTMSK(IRQ_S3C2440_CAM_C, IRQ_S3C2440_CAM_P)
207 static void s3c2443_irq_cam_unmask(
struct irq_data *
data)
217 static struct irq_chip s3c2443_irq_cam = {
218 .irq_mask = s3c2443_irq_cam_mask,
219 .irq_unmask = s3c2443_irq_cam_unmask,
220 .irq_ack = s3c2443_irq_cam_ack,
225 static int s3c2443_add_sub(
unsigned int base,
226 void (*demux)(
unsigned int,
229 unsigned int start,
unsigned int end)
234 irq_set_chained_handler(base, demux);
236 for (irqno = start; irqno <=
end; irqno++) {
244 static int s3c2443_irq_add(
struct device *
dev,
247 printk(
"S3C2443: IRQ Support\n");
249 s3c2443_add_sub(
IRQ_CAM, s3c2443_irq_demux_cam, &s3c2443_irq_cam,
252 s3c2443_add_sub(
IRQ_LCD, s3c2443_irq_demux_lcd, &s3c2443_irq_lcd,
262 s3c2443_add_sub(
IRQ_WDT, s3c2443_irq_demux_wdtac97,
263 &s3c2443_irq_wdtac97,
270 .name =
"s3c2443_irq",
272 .add_dev = s3c2443_irq_add,
275 static int __init s3c2443_irq_init(
void)