1 /* linux/arch/arm/mach-s3c2410/irq.c
3 * Copyright (c) 2003,2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * 22-Jul-2004 Ben Dooks <ben@simtec.co.uk>
23 * Fixed compile warnings
25 * 22-Jul-2004 Roc Wu <cooloney@yahoo.com.cn>
26 * Fixed s3c_extirq_type
28 * 21-Jul-2004 Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
29 * Addition of ADC/TC demux
31 * 04-Oct-2004 Klaus Fetscher <k.fetscher@fetron.de>
32 * Fix for set_irq_type() on low EINT numbers
34 * 05-Oct-2004 Ben Dooks <ben@simtec.co.uk>
35 * Tidy up KF's patch and sort out new release
37 * 05-Oct-2004 Ben Dooks <ben@simtec.co.uk>
38 * Add support for power management controls
40 * 04-Nov-2004 Ben Dooks
41 * Fix standard IRQ wake for EINT0..4 and RTC
43 * 22-Feb-2005 Ben Dooks
44 * Fixed edge-triggering on ADC IRQ
46 * 28-Jun-2005 Ben Dooks
50 #include <linux/init.h>
51 #include <linux/module.h>
52 #include <linux/interrupt.h>
53 #include <linux/ioport.h>
54 #include <linux/ptrace.h>
55 #include <linux/sysdev.h>
57 #include <asm/hardware.h>
61 #include <asm/mach/irq.h>
63 #include <asm/arch/regs-irq.h>
64 #include <asm/arch/regs-gpio.h>
72 #define EXTINT_OFF (IRQ_EINT4 - 4)
74 /* wakeup irq control */
78 /* state for IRQs over sleep */
80 /* default is to allow for EINT0..EINT15, and IRQ_RTC as wakeup sources
82 * set bit to 1 in allow bitfield to enable the wakeup settings on it
85 unsigned long s3c_irqwake_intallow = 1L << (IRQ_RTC - IRQ_EINT0) | 0xfL;
86 unsigned long s3c_irqwake_intmask = 0xffffffffL;
87 unsigned long s3c_irqwake_eintallow = 0x0000fff0L;
88 unsigned long s3c_irqwake_eintmask = 0xffffffffL;
91 s3c_irq_wake(unsigned int irqno, unsigned int state)
93 unsigned long irqbit = 1 << (irqno - IRQ_EINT0);
95 if (!(s3c_irqwake_intallow & irqbit))
98 printk(KERN_INFO "wake %s for irq %d\n",
99 state ? "enabled" : "disabled", irqno);
102 s3c_irqwake_intmask |= irqbit;
104 s3c_irqwake_intmask &= ~irqbit;
110 s3c_irqext_wake(unsigned int irqno, unsigned int state)
112 unsigned long bit = 1L << (irqno - EXTINT_OFF);
114 if (!(s3c_irqwake_eintallow & bit))
117 printk(KERN_INFO "wake %s for irq %d\n",
118 state ? "enabled" : "disabled", irqno);
121 s3c_irqwake_eintmask |= bit;
123 s3c_irqwake_eintmask &= ~bit;
129 #define s3c_irqext_wake NULL
130 #define s3c_irq_wake NULL
135 s3c_irq_mask(unsigned int irqno)
141 mask = __raw_readl(S3C2410_INTMSK);
142 mask |= 1UL << irqno;
143 __raw_writel(mask, S3C2410_INTMSK);
147 s3c_irq_ack(unsigned int irqno)
149 unsigned long bitval = 1UL << (irqno - IRQ_EINT0);
151 __raw_writel(bitval, S3C2410_SRCPND);
152 __raw_writel(bitval, S3C2410_INTPND);
156 s3c_irq_maskack(unsigned int irqno)
158 unsigned long bitval = 1UL << (irqno - IRQ_EINT0);
161 mask = __raw_readl(S3C2410_INTMSK);
162 __raw_writel(mask|bitval, S3C2410_INTMSK);
164 __raw_writel(bitval, S3C2410_SRCPND);
165 __raw_writel(bitval, S3C2410_INTPND);
170 s3c_irq_unmask(unsigned int irqno)
174 if (irqno != IRQ_TIMER4 && irqno != IRQ_EINT8t23)
175 irqdbf2("s3c_irq_unmask %d\n", irqno);
179 mask = __raw_readl(S3C2410_INTMSK);
180 mask &= ~(1UL << irqno);
181 __raw_writel(mask, S3C2410_INTMSK);
184 static struct irqchip s3c_irq_level_chip = {
185 .ack = s3c_irq_maskack,
186 .mask = s3c_irq_mask,
187 .unmask = s3c_irq_unmask,
191 static struct irqchip s3c_irq_chip = {
193 .mask = s3c_irq_mask,
194 .unmask = s3c_irq_unmask,
203 s3c_irqext_mask(unsigned int irqno)
209 mask = __raw_readl(S3C2410_EINTMASK);
210 mask |= ( 1UL << irqno);
211 __raw_writel(mask, S3C2410_EINTMASK);
213 if (irqno <= (IRQ_EINT7 - EXTINT_OFF)) {
214 /* check to see if all need masking */
216 if ((mask & (0xf << 4)) == (0xf << 4)) {
217 /* all masked, mask the parent */
218 s3c_irq_mask(IRQ_EINT4t7);
221 /* todo: the same check as above for the rest of the irq regs...*/
227 s3c_irqext_ack(unsigned int irqno)
233 bit = 1UL << (irqno - EXTINT_OFF);
236 mask = __raw_readl(S3C2410_EINTMASK);
238 __raw_writel(bit, S3C2410_EINTPEND);
240 req = __raw_readl(S3C2410_EINTPEND);
243 /* not sure if we should be acking the parent irq... */
245 if (irqno <= IRQ_EINT7 ) {
246 if ((req & 0xf0) == 0)
247 s3c_irq_ack(IRQ_EINT4t7);
250 s3c_irq_ack(IRQ_EINT8t23);
255 s3c_irqext_unmask(unsigned int irqno)
261 mask = __raw_readl(S3C2410_EINTMASK);
262 mask &= ~( 1UL << irqno);
263 __raw_writel(mask, S3C2410_EINTMASK);
265 s3c_irq_unmask((irqno <= (IRQ_EINT7 - EXTINT_OFF)) ? IRQ_EINT4t7 : IRQ_EINT8t23);
269 s3c_irqext_type(unsigned int irq, unsigned int type)
271 void __iomem *extint_reg;
272 void __iomem *gpcon_reg;
273 unsigned long gpcon_offset, extint_offset;
274 unsigned long newvalue = 0, value;
276 if ((irq >= IRQ_EINT0) && (irq <= IRQ_EINT3))
278 gpcon_reg = S3C2410_GPFCON;
279 extint_reg = S3C2410_EXTINT0;
280 gpcon_offset = (irq - IRQ_EINT0) * 2;
281 extint_offset = (irq - IRQ_EINT0) * 4;
283 else if ((irq >= IRQ_EINT4) && (irq <= IRQ_EINT7))
285 gpcon_reg = S3C2410_GPFCON;
286 extint_reg = S3C2410_EXTINT0;
287 gpcon_offset = (irq - (EXTINT_OFF)) * 2;
288 extint_offset = (irq - (EXTINT_OFF)) * 4;
290 else if ((irq >= IRQ_EINT8) && (irq <= IRQ_EINT15))
292 gpcon_reg = S3C2410_GPGCON;
293 extint_reg = S3C2410_EXTINT1;
294 gpcon_offset = (irq - IRQ_EINT8) * 2;
295 extint_offset = (irq - IRQ_EINT8) * 4;
297 else if ((irq >= IRQ_EINT16) && (irq <= IRQ_EINT23))
299 gpcon_reg = S3C2410_GPGCON;
300 extint_reg = S3C2410_EXTINT2;
301 gpcon_offset = (irq - IRQ_EINT8) * 2;
302 extint_offset = (irq - IRQ_EINT16) * 4;
306 /* Set the GPIO to external interrupt mode */
307 value = __raw_readl(gpcon_reg);
308 value = (value & ~(3 << gpcon_offset)) | (0x02 << gpcon_offset);
309 __raw_writel(value, gpcon_reg);
311 /* Set the external interrupt to pointed trigger type */
315 printk(KERN_WARNING "No edge setting!\n");
319 newvalue = S3C2410_EXTINT_RISEEDGE;
323 newvalue = S3C2410_EXTINT_FALLEDGE;
327 newvalue = S3C2410_EXTINT_BOTHEDGE;
331 newvalue = S3C2410_EXTINT_LOWLEV;
335 newvalue = S3C2410_EXTINT_HILEV;
339 printk(KERN_ERR "No such irq type %d", type);
343 value = __raw_readl(extint_reg);
344 value = (value & ~(7 << extint_offset)) | (newvalue << extint_offset);
345 __raw_writel(value, extint_reg);
350 static struct irqchip s3c_irqext_chip = {
351 .mask = s3c_irqext_mask,
352 .unmask = s3c_irqext_unmask,
353 .ack = s3c_irqext_ack,
354 .type = s3c_irqext_type,
355 .wake = s3c_irqext_wake
358 static struct irqchip s3c_irq_eint0t4 = {
360 .mask = s3c_irq_mask,
361 .unmask = s3c_irq_unmask,
362 .wake = s3c_irq_wake,
363 .type = s3c_irqext_type,
366 /* mask values for the parent registers for each of the interrupt types */
368 #define INTMSK_UART0 (1UL << (IRQ_UART0 - IRQ_EINT0))
369 #define INTMSK_UART1 (1UL << (IRQ_UART1 - IRQ_EINT0))
370 #define INTMSK_UART2 (1UL << (IRQ_UART2 - IRQ_EINT0))
371 #define INTMSK_ADCPARENT (1UL << (IRQ_ADCPARENT - IRQ_EINT0))
374 s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit,
378 unsigned long submask;
380 submask = __raw_readl(S3C2410_INTSUBMSK);
381 mask = __raw_readl(S3C2410_INTMSK);
383 submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
385 /* check to see if we need to mask the parent IRQ */
387 if ((submask & subcheck) == subcheck) {
388 __raw_writel(mask | parentbit, S3C2410_INTMSK);
391 /* write back masks */
392 __raw_writel(submask, S3C2410_INTSUBMSK);
397 s3c_irqsub_unmask(unsigned int irqno, unsigned int parentbit)
400 unsigned long submask;
402 submask = __raw_readl(S3C2410_INTSUBMSK);
403 mask = __raw_readl(S3C2410_INTMSK);
405 submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
408 /* write back masks */
409 __raw_writel(submask, S3C2410_INTSUBMSK);
410 __raw_writel(mask, S3C2410_INTMSK);
415 s3c_irqsub_maskack(unsigned int irqno, unsigned int parentmask, unsigned int group)
417 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
419 s3c_irqsub_mask(irqno, parentmask, group);
421 __raw_writel(bit, S3C2410_SUBSRCPND);
423 /* only ack parent if we've got all the irqs (seems we must
424 * ack, all and hope that the irq system retriggers ok when
425 * the interrupt goes off again)
429 __raw_writel(parentmask, S3C2410_SRCPND);
430 __raw_writel(parentmask, S3C2410_INTPND);
435 s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
437 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
439 __raw_writel(bit, S3C2410_SUBSRCPND);
441 /* only ack parent if we've got all the irqs (seems we must
442 * ack, all and hope that the irq system retriggers ok when
443 * the interrupt goes off again)
447 __raw_writel(parentmask, S3C2410_SRCPND);
448 __raw_writel(parentmask, S3C2410_INTPND);
455 s3c_irq_uart0_mask(unsigned int irqno)
457 s3c_irqsub_mask(irqno, INTMSK_UART0, 7);
461 s3c_irq_uart0_unmask(unsigned int irqno)
463 s3c_irqsub_unmask(irqno, INTMSK_UART0);
467 s3c_irq_uart0_ack(unsigned int irqno)
469 s3c_irqsub_maskack(irqno, INTMSK_UART0, 7);
472 static struct irqchip s3c_irq_uart0 = {
473 .mask = s3c_irq_uart0_mask,
474 .unmask = s3c_irq_uart0_unmask,
475 .ack = s3c_irq_uart0_ack,
481 s3c_irq_uart1_mask(unsigned int irqno)
483 s3c_irqsub_mask(irqno, INTMSK_UART1, 7 << 3);
487 s3c_irq_uart1_unmask(unsigned int irqno)
489 s3c_irqsub_unmask(irqno, INTMSK_UART1);
493 s3c_irq_uart1_ack(unsigned int irqno)
495 s3c_irqsub_maskack(irqno, INTMSK_UART1, 7 << 3);
498 static struct irqchip s3c_irq_uart1 = {
499 .mask = s3c_irq_uart1_mask,
500 .unmask = s3c_irq_uart1_unmask,
501 .ack = s3c_irq_uart1_ack,
507 s3c_irq_uart2_mask(unsigned int irqno)
509 s3c_irqsub_mask(irqno, INTMSK_UART2, 7 << 6);
513 s3c_irq_uart2_unmask(unsigned int irqno)
515 s3c_irqsub_unmask(irqno, INTMSK_UART2);
519 s3c_irq_uart2_ack(unsigned int irqno)
521 s3c_irqsub_maskack(irqno, INTMSK_UART2, 7 << 6);
524 static struct irqchip s3c_irq_uart2 = {
525 .mask = s3c_irq_uart2_mask,
526 .unmask = s3c_irq_uart2_unmask,
527 .ack = s3c_irq_uart2_ack,
530 /* ADC and Touchscreen */
533 s3c_irq_adc_mask(unsigned int irqno)
535 s3c_irqsub_mask(irqno, INTMSK_ADCPARENT, 3 << 9);
539 s3c_irq_adc_unmask(unsigned int irqno)
541 s3c_irqsub_unmask(irqno, INTMSK_ADCPARENT);
545 s3c_irq_adc_ack(unsigned int irqno)
547 s3c_irqsub_ack(irqno, INTMSK_ADCPARENT, 3 << 9);
550 static struct irqchip s3c_irq_adc = {
551 .mask = s3c_irq_adc_mask,
552 .unmask = s3c_irq_adc_unmask,
553 .ack = s3c_irq_adc_ack,
556 /* irq demux for adc */
557 static void s3c_irq_demux_adc(unsigned int irq,
558 struct irqdesc *desc,
559 struct pt_regs *regs)
561 unsigned int subsrc, submsk;
562 unsigned int offset = 9;
563 struct irqdesc *mydesc;
565 /* read the current pending interrupts, and the mask
566 * for what it is available */
568 subsrc = __raw_readl(S3C2410_SUBSRCPND);
569 submsk = __raw_readl(S3C2410_INTSUBMSK);
577 mydesc = irq_desc + IRQ_TC;
578 mydesc->handle( IRQ_TC, mydesc, regs);
581 mydesc = irq_desc + IRQ_ADC;
582 mydesc->handle(IRQ_ADC, mydesc, regs);
587 static void s3c_irq_demux_uart(unsigned int start,
588 struct pt_regs *regs)
590 unsigned int subsrc, submsk;
591 unsigned int offset = start - IRQ_S3CUART_RX0;
592 struct irqdesc *desc;
594 /* read the current pending interrupts, and the mask
595 * for what it is available */
597 subsrc = __raw_readl(S3C2410_SUBSRCPND);
598 submsk = __raw_readl(S3C2410_INTSUBMSK);
600 irqdbf2("s3c_irq_demux_uart: start=%d (%d), subsrc=0x%08x,0x%08x\n",
601 start, offset, subsrc, submsk);
608 desc = irq_desc + start;
611 desc->handle(start, desc, regs);
616 desc->handle(start+1, desc, regs);
621 desc->handle(start+2, desc, regs);
625 /* uart demux entry points */
628 s3c_irq_demux_uart0(unsigned int irq,
629 struct irqdesc *desc,
630 struct pt_regs *regs)
633 s3c_irq_demux_uart(IRQ_S3CUART_RX0, regs);
637 s3c_irq_demux_uart1(unsigned int irq,
638 struct irqdesc *desc,
639 struct pt_regs *regs)
642 s3c_irq_demux_uart(IRQ_S3CUART_RX1, regs);
646 s3c_irq_demux_uart2(unsigned int irq,
647 struct irqdesc *desc,
648 struct pt_regs *regs)
651 s3c_irq_demux_uart(IRQ_S3CUART_RX2, regs);
657 * Initialise S3C2410 IRQ system
660 void __init s3c24xx_init_irq(void)
667 irqdbf("s3c2410_init_irq: clearing interrupt status flags\n");
669 /* first, clear all interrupts pending... */
672 for (i = 0; i < 4; i++) {
673 pend = __raw_readl(S3C2410_EINTPEND);
675 if (pend == 0 || pend == last)
678 __raw_writel(pend, S3C2410_EINTPEND);
679 printk("irq: clearing pending ext status %08x\n", (int)pend);
684 for (i = 0; i < 4; i++) {
685 pend = __raw_readl(S3C2410_INTPND);
687 if (pend == 0 || pend == last)
690 __raw_writel(pend, S3C2410_SRCPND);
691 __raw_writel(pend, S3C2410_INTPND);
692 printk("irq: clearing pending status %08x\n", (int)pend);
697 for (i = 0; i < 4; i++) {
698 pend = __raw_readl(S3C2410_SUBSRCPND);
700 if (pend == 0 || pend == last)
703 printk("irq: clearing subpending status %08x\n", (int)pend);
704 __raw_writel(pend, S3C2410_SUBSRCPND);
708 /* register the main interrupts */
710 irqdbf("s3c2410_init_irq: registering s3c2410 interrupt handlers\n");
712 for (irqno = IRQ_BATT_FLT; irqno <= IRQ_ADCPARENT; irqno++) {
713 /* set all the s3c2410 internal irqs */
716 /* deal with the special IRQs (cascaded) */
722 set_irq_chip(irqno, &s3c_irq_level_chip);
723 set_irq_handler(irqno, do_level_IRQ);
732 //irqdbf("registering irq %d (s3c irq)\n", irqno);
733 set_irq_chip(irqno, &s3c_irq_chip);
734 set_irq_handler(irqno, do_edge_IRQ);
735 set_irq_flags(irqno, IRQF_VALID);
739 /* setup the cascade irq handlers */
741 set_irq_chained_handler(IRQ_UART0, s3c_irq_demux_uart0);
742 set_irq_chained_handler(IRQ_UART1, s3c_irq_demux_uart1);
743 set_irq_chained_handler(IRQ_UART2, s3c_irq_demux_uart2);
744 set_irq_chained_handler(IRQ_ADCPARENT, s3c_irq_demux_adc);
747 /* external interrupts */
749 for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) {
750 irqdbf("registering irq %d (ext int)\n", irqno);
751 set_irq_chip(irqno, &s3c_irq_eint0t4);
752 set_irq_handler(irqno, do_edge_IRQ);
753 set_irq_flags(irqno, IRQF_VALID);
756 for (irqno = IRQ_EINT4; irqno <= IRQ_EINT23; irqno++) {
757 irqdbf("registering irq %d (extended s3c irq)\n", irqno);
758 set_irq_chip(irqno, &s3c_irqext_chip);
759 set_irq_handler(irqno, do_edge_IRQ);
760 set_irq_flags(irqno, IRQF_VALID);
763 /* register the uart interrupts */
765 irqdbf("s3c2410: registering external interrupts\n");
767 for (irqno = IRQ_S3CUART_RX0; irqno <= IRQ_S3CUART_ERR0; irqno++) {
768 irqdbf("registering irq %d (s3c uart0 irq)\n", irqno);
769 set_irq_chip(irqno, &s3c_irq_uart0);
770 set_irq_handler(irqno, do_level_IRQ);
771 set_irq_flags(irqno, IRQF_VALID);
774 for (irqno = IRQ_S3CUART_RX1; irqno <= IRQ_S3CUART_ERR1; irqno++) {
775 irqdbf("registering irq %d (s3c uart1 irq)\n", irqno);
776 set_irq_chip(irqno, &s3c_irq_uart1);
777 set_irq_handler(irqno, do_level_IRQ);
778 set_irq_flags(irqno, IRQF_VALID);
781 for (irqno = IRQ_S3CUART_RX2; irqno <= IRQ_S3CUART_ERR2; irqno++) {
782 irqdbf("registering irq %d (s3c uart2 irq)\n", irqno);
783 set_irq_chip(irqno, &s3c_irq_uart2);
784 set_irq_handler(irqno, do_level_IRQ);
785 set_irq_flags(irqno, IRQF_VALID);
788 for (irqno = IRQ_TC; irqno <= IRQ_ADC; irqno++) {
789 irqdbf("registering irq %d (s3c adc irq)\n", irqno);
790 set_irq_chip(irqno, &s3c_irq_adc);
791 set_irq_handler(irqno, do_edge_IRQ);
792 set_irq_flags(irqno, IRQF_VALID);
795 irqdbf("s3c2410: registered interrupt handlers\n");
801 #ifdef CONFIG_CPU_S3C2440
805 static void s3c_irq_demux_wdtac97(unsigned int irq,
806 struct irqdesc *desc,
807 struct pt_regs *regs)
809 unsigned int subsrc, submsk;
810 struct irqdesc *mydesc;
812 /* read the current pending interrupts, and the mask
813 * for what it is available */
815 subsrc = __raw_readl(S3C2410_SUBSRCPND);
816 submsk = __raw_readl(S3C2410_INTSUBMSK);
824 mydesc = irq_desc + IRQ_S3C2440_WDT;
825 mydesc->handle( IRQ_S3C2440_WDT, mydesc, regs);
828 mydesc = irq_desc + IRQ_S3C2440_AC97;
829 mydesc->handle(IRQ_S3C2440_AC97, mydesc, regs);
835 #define INTMSK_WDT (1UL << (IRQ_WDT - IRQ_EINT0))
838 s3c_irq_wdtac97_mask(unsigned int irqno)
840 s3c_irqsub_mask(irqno, INTMSK_WDT, 3<<13);
844 s3c_irq_wdtac97_unmask(unsigned int irqno)
846 s3c_irqsub_unmask(irqno, INTMSK_WDT);
850 s3c_irq_wdtac97_ack(unsigned int irqno)
852 s3c_irqsub_maskack(irqno, INTMSK_WDT, 3<<13);
855 static struct irqchip s3c_irq_wdtac97 = {
856 .mask = s3c_irq_wdtac97_mask,
857 .unmask = s3c_irq_wdtac97_unmask,
858 .ack = s3c_irq_wdtac97_ack,
863 static void s3c_irq_demux_cam(unsigned int irq,
864 struct irqdesc *desc,
865 struct pt_regs *regs)
867 unsigned int subsrc, submsk;
868 struct irqdesc *mydesc;
870 /* read the current pending interrupts, and the mask
871 * for what it is available */
873 subsrc = __raw_readl(S3C2410_SUBSRCPND);
874 submsk = __raw_readl(S3C2410_INTSUBMSK);
882 mydesc = irq_desc + IRQ_S3C2440_CAM_C;
883 mydesc->handle( IRQ_S3C2440_WDT, mydesc, regs);
886 mydesc = irq_desc + IRQ_S3C2440_CAM_P;
887 mydesc->handle(IRQ_S3C2440_AC97, mydesc, regs);
892 #define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
895 s3c_irq_cam_mask(unsigned int irqno)
897 s3c_irqsub_mask(irqno, INTMSK_CAM, 3<<11);
901 s3c_irq_cam_unmask(unsigned int irqno)
903 s3c_irqsub_unmask(irqno, INTMSK_CAM);
907 s3c_irq_cam_ack(unsigned int irqno)
909 s3c_irqsub_maskack(irqno, INTMSK_CAM, 3<<11);
912 static struct irqchip s3c_irq_cam = {
913 .mask = s3c_irq_cam_mask,
914 .unmask = s3c_irq_cam_unmask,
915 .ack = s3c_irq_cam_ack,
918 static int s3c2440_irq_add(struct sys_device *sysdev)
922 printk("S3C2440: IRQ Support\n");
924 set_irq_chip(IRQ_NFCON, &s3c_irq_level_chip);
925 set_irq_handler(IRQ_NFCON, do_level_IRQ);
926 set_irq_flags(IRQ_NFCON, IRQF_VALID);
928 /* add new chained handler for wdt, ac7 */
930 set_irq_chip(IRQ_WDT, &s3c_irq_level_chip);
931 set_irq_handler(IRQ_WDT, do_level_IRQ);
932 set_irq_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97);
934 for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) {
935 set_irq_chip(irqno, &s3c_irq_wdtac97);
936 set_irq_handler(irqno, do_level_IRQ);
937 set_irq_flags(irqno, IRQF_VALID);
940 /* add chained handler for camera */
942 set_irq_chip(IRQ_CAM, &s3c_irq_level_chip);
943 set_irq_handler(IRQ_CAM, do_level_IRQ);
944 set_irq_chained_handler(IRQ_CAM, s3c_irq_demux_cam);
946 for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) {
947 set_irq_chip(irqno, &s3c_irq_cam);
948 set_irq_handler(irqno, do_level_IRQ);
949 set_irq_flags(irqno, IRQF_VALID);
955 static struct sysdev_driver s3c2440_irq_driver = {
956 .add = s3c2440_irq_add,
959 static int s3c24xx_irq_driver(void)
961 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_irq_driver);
964 arch_initcall(s3c24xx_irq_driver);
966 #endif /* CONFIG_CPU_S3C2440 */