Linux 2.6.31.8
[linux/fpc-iii.git] / arch / arm / plat-s3c24xx / include / plat / irq.h
blob69e1be8bec352e73d730f3439aecf56be32a5292
1 /* linux/include/asm-arm/plat-s3c24xx/irq.h
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * Header file for S3C24XX CPU IRQ support
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/io.h>
15 #include <mach/hardware.h>
16 #include <mach/regs-irq.h>
17 #include <mach/regs-gpio.h>
19 #define irqdbf(x...)
20 #define irqdbf2(x...)
22 #define EXTINT_OFF (IRQ_EINT4 - 4)
24 /* these are exported for arch/arm/mach-* usage */
25 extern struct irq_chip s3c_irq_level_chip;
26 extern struct irq_chip s3c_irq_chip;
28 static inline void
29 s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit,
30 int subcheck)
32 unsigned long mask;
33 unsigned long submask;
35 submask = __raw_readl(S3C2410_INTSUBMSK);
36 mask = __raw_readl(S3C2410_INTMSK);
38 submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
40 /* check to see if we need to mask the parent IRQ */
42 if ((submask & subcheck) == subcheck) {
43 __raw_writel(mask | parentbit, S3C2410_INTMSK);
46 /* write back masks */
47 __raw_writel(submask, S3C2410_INTSUBMSK);
51 static inline void
52 s3c_irqsub_unmask(unsigned int irqno, unsigned int parentbit)
54 unsigned long mask;
55 unsigned long submask;
57 submask = __raw_readl(S3C2410_INTSUBMSK);
58 mask = __raw_readl(S3C2410_INTMSK);
60 submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
61 mask &= ~parentbit;
63 /* write back masks */
64 __raw_writel(submask, S3C2410_INTSUBMSK);
65 __raw_writel(mask, S3C2410_INTMSK);
69 static inline void
70 s3c_irqsub_maskack(unsigned int irqno, unsigned int parentmask, unsigned int group)
72 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
74 s3c_irqsub_mask(irqno, parentmask, group);
76 __raw_writel(bit, S3C2410_SUBSRCPND);
78 /* only ack parent if we've got all the irqs (seems we must
79 * ack, all and hope that the irq system retriggers ok when
80 * the interrupt goes off again)
83 if (1) {
84 __raw_writel(parentmask, S3C2410_SRCPND);
85 __raw_writel(parentmask, S3C2410_INTPND);
89 static inline void
90 s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
92 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
94 __raw_writel(bit, S3C2410_SUBSRCPND);
96 /* only ack parent if we've got all the irqs (seems we must
97 * ack, all and hope that the irq system retriggers ok when
98 * the interrupt goes off again)
101 if (1) {
102 __raw_writel(parentmask, S3C2410_SRCPND);
103 __raw_writel(parentmask, S3C2410_INTPND);
107 /* exported for use in arch/arm/mach-s3c2410 */
109 #ifdef CONFIG_PM
110 extern int s3c_irq_wake(unsigned int irqno, unsigned int state);
111 #else
112 #define s3c_irq_wake NULL
113 #endif
115 extern int s3c_irqext_type(unsigned int irq, unsigned int type);