aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c24xx/bast-irq.c
diff options
context:
space:
mode:
authorKukjin Kim <kgene.kim@samsung.com>2012-02-05 19:38:19 -0500
committerKukjin Kim <kgene.kim@samsung.com>2012-03-02 17:47:38 -0500
commit85fd6d63bf2927b9da7ab1b0d46723bfdb13808c (patch)
tree7033ac06e365209b09ba4b97eba0cf2f7ceb3312 /arch/arm/mach-s3c24xx/bast-irq.c
parentb130d5c29544fe4cedafd35b112d27a06550d844 (diff)
ARM: S3C2410: move mach-s3c2410/* into mach-s3c24xx/
This patch moves S3C2410 stuff into mach-s3c24xx/ directory so that we can merge the s3c24 series' directories to the just one mach-s3c24xx/ directory. And this patch is including following. - re-ordered alphabetically by option text at Kconfig and Makefile - removed unused option, MACH_N35 - fixed duplcated option name, S3C2410_DMA to S3C24XX_DMA which is in plat-s3c24xx/ Cc: Ben Dooks <ben-linux@fluff.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-s3c24xx/bast-irq.c')
-rw-r--r--arch/arm/mach-s3c24xx/bast-irq.c166
1 files changed, 166 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c24xx/bast-irq.c b/arch/arm/mach-s3c24xx/bast-irq.c
new file mode 100644
index 00000000000..ac7b2ad5c40
--- /dev/null
+++ b/arch/arm/mach-s3c24xx/bast-irq.c
@@ -0,0 +1,166 @@
1/* linux/arch/arm/mach-s3c2410/bast-irq.c
2 *
3 * Copyright 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * http://www.simtec.co.uk/products/EB2410ITX/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23
24#include <linux/init.h>
25#include <linux/module.h>
26#include <linux/ioport.h>
27#include <linux/device.h>
28#include <linux/io.h>
29
30#include <asm/mach-types.h>
31
32#include <mach/hardware.h>
33#include <asm/irq.h>
34
35#include <asm/mach/irq.h>
36
37#include <mach/regs-irq.h>
38#include <mach/bast-map.h>
39#include <mach/bast-irq.h>
40
41#include <plat/irq.h>
42
43#if 0
44#include <asm/debug-ll.h>
45#endif
46
47#define irqdbf(x...)
48#define irqdbf2(x...)
49
50
51/* handle PC104 ISA interrupts from the system CPLD */
52
53/* table of ISA irq nos to the relevant mask... zero means
54 * the irq is not implemented
55*/
56static unsigned char bast_pc104_irqmasks[] = {
57 0, /* 0 */
58 0, /* 1 */
59 0, /* 2 */
60 1, /* 3 */
61 0, /* 4 */
62 2, /* 5 */
63 0, /* 6 */
64 4, /* 7 */
65 0, /* 8 */
66 0, /* 9 */
67 8, /* 10 */
68 0, /* 11 */
69 0, /* 12 */
70 0, /* 13 */
71 0, /* 14 */
72 0, /* 15 */
73};
74
75static unsigned char bast_pc104_irqs[] = { 3, 5, 7, 10 };
76
77static void
78bast_pc104_mask(struct irq_data *data)
79{
80 unsigned long temp;
81
82 temp = __raw_readb(BAST_VA_PC104_IRQMASK);
83 temp &= ~bast_pc104_irqmasks[data->irq];
84 __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
85}
86
87static void
88bast_pc104_maskack(struct irq_data *data)
89{
90 struct irq_desc *desc = irq_desc + IRQ_ISA;
91
92 bast_pc104_mask(data);
93 desc->irq_data.chip->irq_ack(&desc->irq_data);
94}
95
96static void
97bast_pc104_unmask(struct irq_data *data)
98{
99 unsigned long temp;
100
101 temp = __raw_readb(BAST_VA_PC104_IRQMASK);
102 temp |= bast_pc104_irqmasks[data->irq];
103 __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
104}
105
106static struct irq_chip bast_pc104_chip = {
107 .irq_mask = bast_pc104_mask,
108 .irq_unmask = bast_pc104_unmask,
109 .irq_ack = bast_pc104_maskack
110};
111
112static void
113bast_irq_pc104_demux(unsigned int irq,
114 struct irq_desc *desc)
115{
116 unsigned int stat;
117 unsigned int irqno;
118 int i;
119
120 stat = __raw_readb(BAST_VA_PC104_IRQREQ) & 0xf;
121
122 if (unlikely(stat == 0)) {
123 /* ack if we get an irq with nothing (ie, startup) */
124
125 desc = irq_desc + IRQ_ISA;
126 desc->irq_data.chip->irq_ack(&desc->irq_data);
127 } else {
128 /* handle the IRQ */
129
130 for (i = 0; stat != 0; i++, stat >>= 1) {
131 if (stat & 1) {
132 irqno = bast_pc104_irqs[i];
133 generic_handle_irq(irqno);
134 }
135 }
136 }
137}
138
139static __init int bast_irq_init(void)
140{
141 unsigned int i;
142
143 if (machine_is_bast()) {
144 printk(KERN_INFO "BAST PC104 IRQ routing, Copyright 2005 Simtec Electronics\n");
145
146 /* zap all the IRQs */
147
148 __raw_writeb(0x0, BAST_VA_PC104_IRQMASK);
149
150 irq_set_chained_handler(IRQ_ISA, bast_irq_pc104_demux);
151
152 /* register our IRQs */
153
154 for (i = 0; i < 4; i++) {
155 unsigned int irqno = bast_pc104_irqs[i];
156
157 irq_set_chip_and_handler(irqno, &bast_pc104_chip,
158 handle_level_irq);
159 set_irq_flags(irqno, IRQF_VALID);
160 }
161 }
162
163 return 0;
164}
165
166arch_initcall(bast_irq_init);