25 #include <linux/module.h>
28 #include <linux/device.h>
32 #include <mach/hardware.h>
37 #include <mach/regs-irq.h>
38 #include <mach/regs-gpio.h>
44 #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1)
46 static inline void s3c2416_irq_demux(
unsigned int irq,
unsigned int len)
48 unsigned int subsrc, submsk;
59 subsrc &= (1 << len)-1;
63 for (; irq < end && subsrc; irq++) {
73 static void s3c2416_irq_demux_wdtac97(
unsigned int irq,
struct irq_desc *
desc)
78 #define INTMSK_WDTAC97 (1UL << (IRQ_WDT - IRQ_EINT0))
79 #define SUBMSK_WDTAC97 INTMSK(IRQ_S3C2443_WDT, IRQ_S3C2443_AC97)
81 static void s3c2416_irq_wdtac97_mask(
struct irq_data *
data)
86 static void s3c2416_irq_wdtac97_unmask(
struct irq_data *
data)
91 static void s3c2416_irq_wdtac97_ack(
struct irq_data *
data)
96 static struct irq_chip s3c2416_irq_wdtac97 = {
97 .irq_mask = s3c2416_irq_wdtac97_mask,
98 .irq_unmask = s3c2416_irq_wdtac97_unmask,
99 .irq_ack = s3c2416_irq_wdtac97_ack,
104 static void s3c2416_irq_demux_lcd(
unsigned int irq,
struct irq_desc *
desc)
109 #define INTMSK_LCD (1UL << (IRQ_LCD - IRQ_EINT0))
110 #define SUBMSK_LCD INTMSK(IRQ_S3C2443_LCD1, IRQ_S3C2443_LCD4)
117 static void s3c2416_irq_lcd_unmask(
struct irq_data *
data)
127 static struct irq_chip s3c2416_irq_lcd = {
128 .irq_mask = s3c2416_irq_lcd_mask,
129 .irq_unmask = s3c2416_irq_lcd_unmask,
130 .irq_ack = s3c2416_irq_lcd_ack,
135 static void s3c2416_irq_demux_dma(
unsigned int irq,
struct irq_desc *
desc)
140 #define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0))
141 #define SUBMSK_DMA INTMSK(IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5)
149 static void s3c2416_irq_dma_unmask(
struct irq_data *
data)
159 static struct irq_chip s3c2416_irq_dma = {
160 .irq_mask = s3c2416_irq_dma_mask,
161 .irq_unmask = s3c2416_irq_dma_unmask,
162 .irq_ack = s3c2416_irq_dma_ack,
167 static void s3c2416_irq_demux_uart3(
unsigned int irq,
struct irq_desc *
desc)
172 #define INTMSK_UART3 (1UL << (IRQ_S3C2443_UART3 - IRQ_EINT0))
173 #define SUBMSK_UART3 (0x7 << (IRQ_S3C2443_RX3 - S3C2410_IRQSUB(0)))
175 static void s3c2416_irq_uart3_mask(
struct irq_data *
data)
180 static void s3c2416_irq_uart3_unmask(
struct irq_data *
data)
185 static void s3c2416_irq_uart3_ack(
struct irq_data *
data)
190 static struct irq_chip s3c2416_irq_uart3 = {
191 .irq_mask = s3c2416_irq_uart3_mask,
192 .irq_unmask = s3c2416_irq_uart3_unmask,
193 .irq_ack = s3c2416_irq_uart3_ack,
198 static inline void s3c2416_irq_ack_second(
struct irq_data *
data)
206 static void s3c2416_irq_mask_second(
struct irq_data *
data)
216 static void s3c2416_irq_unmask_second(
struct irq_data *
data)
227 .irq_ack = s3c2416_irq_ack_second,
228 .irq_mask = s3c2416_irq_mask_second,
229 .irq_unmask = s3c2416_irq_unmask_second,
235 static int s3c2416_add_sub(
unsigned int base,
236 void (*demux)(
unsigned int,
239 unsigned int start,
unsigned int end)
244 irq_set_chained_handler(base, demux);
246 for (irqno = start; irqno <=
end; irqno++) {
254 static void s3c2416_irq_add_second(
void)
263 for (i = 0; i < 4; i++) {
266 if (pend == 0 || pend == last)
283 irq_set_chip_and_handler(irqno, &s3c2416_irq_second,
290 static int s3c2416_irq_add(
struct device *
dev,
295 s3c2416_add_sub(
IRQ_LCD, s3c2416_irq_demux_lcd, &s3c2416_irq_lcd,
305 s3c2416_add_sub(
IRQ_WDT, s3c2416_irq_demux_wdtac97,
306 &s3c2416_irq_wdtac97,
309 s3c2416_irq_add_second();
315 .name =
"s3c2416_irq",
317 .add_dev = s3c2416_irq_add,
320 static int __init s3c2416_irq_init(
void)
332 int s3c2416_irq_suspend(
void)
339 void s3c2416_irq_resume(
void)
345 .
suspend = s3c2416_irq_suspend,
346 .resume = s3c2416_irq_resume,