blob: 1fea3ddd123db53cd1bbe71602fd258d23d6be1f [file] [log] [blame]
Heiko Stuebner1f629b72013-01-29 10:25:22 -08001/*
2 * S3C24XX IRQ handling
Ben Dooksa21765a2007-02-11 18:31:01 +01003 *
Ben Dookse02f8662009-11-13 22:54:13 +00004 * Copyright (c) 2003-2004 Simtec Electronics
Ben Dooksa21765a2007-02-11 18:31:01 +01005 * Ben Dooks <ben@simtec.co.uk>
Heiko Stuebner1f629b72013-01-29 10:25:22 -08006 * Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de>
Ben Dooksa21765a2007-02-11 18:31:01 +01007 *
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.
Ben Dooksa21765a2007-02-11 18:31:01 +010017*/
18
19#include <linux/init.h>
Heiko Stuebner1f629b72013-01-29 10:25:22 -080020#include <linux/slab.h>
Ben Dooksa21765a2007-02-11 18:31:01 +010021#include <linux/module.h>
Heiko Stuebner1f629b72013-01-29 10:25:22 -080022#include <linux/io.h>
23#include <linux/err.h>
Ben Dooksa21765a2007-02-11 18:31:01 +010024#include <linux/interrupt.h>
25#include <linux/ioport.h>
Kay Sieversedbaa602011-12-21 16:26:03 -080026#include <linux/device.h>
Heiko Stuebner1f629b72013-01-29 10:25:22 -080027#include <linux/irqdomain.h>
Ben Dooksa21765a2007-02-11 18:31:01 +010028
Ben Dooksa21765a2007-02-11 18:31:01 +010029#include <asm/mach/irq.h>
30
Heiko Stuebner1f629b72013-01-29 10:25:22 -080031#include <mach/regs-irq.h>
32#include <mach/regs-gpio.h>
Ben Dooksa21765a2007-02-11 18:31:01 +010033
Ben Dooksa2b7ba92008-10-07 22:26:09 +010034#include <plat/cpu.h>
Heiko Stuebner1f629b72013-01-29 10:25:22 -080035#include <plat/regs-irqtype.h>
Ben Dooksa2b7ba92008-10-07 22:26:09 +010036#include <plat/pm.h>
Ben Dooksa21765a2007-02-11 18:31:01 +010037
Heiko Stuebner1f629b72013-01-29 10:25:22 -080038#define S3C_IRQTYPE_NONE 0
39#define S3C_IRQTYPE_EINT 1
40#define S3C_IRQTYPE_EDGE 2
41#define S3C_IRQTYPE_LEVEL 3
Ben Dooksa21765a2007-02-11 18:31:01 +010042
Heiko Stuebner1f629b72013-01-29 10:25:22 -080043struct s3c_irq_data {
44 unsigned int type;
45 unsigned long parent_irq;
Ben Dooksa21765a2007-02-11 18:31:01 +010046
Heiko Stuebner1f629b72013-01-29 10:25:22 -080047 /* data gets filled during init */
48 struct s3c_irq_intc *intc;
49 unsigned long sub_bits;
50 struct s3c_irq_intc *sub_intc;
Ben Dooksa21765a2007-02-11 18:31:01 +010051};
52
Heiko Stuebner1f629b72013-01-29 10:25:22 -080053/*
54 * Sructure holding the controller data
55 * @reg_pending register holding pending irqs
56 * @reg_intpnd special register intpnd in main intc
57 * @reg_mask mask register
58 * @domain irq_domain of the controller
59 * @parent parent controller for ext and sub irqs
60 * @irqs irq-data, always s3c_irq_data[32]
61 */
62struct s3c_irq_intc {
63 void __iomem *reg_pending;
64 void __iomem *reg_intpnd;
65 void __iomem *reg_mask;
66 struct irq_domain *domain;
67 struct s3c_irq_intc *parent;
68 struct s3c_irq_data *irqs;
Ben Dooksa21765a2007-02-11 18:31:01 +010069};
70
Heiko Stuebner1f629b72013-01-29 10:25:22 -080071static void s3c_irq_mask(struct irq_data *data)
Ben Dooksa21765a2007-02-11 18:31:01 +010072{
Heiko Stuebner1f629b72013-01-29 10:25:22 -080073 struct s3c_irq_intc *intc = data->domain->host_data;
74 struct s3c_irq_intc *parent_intc = intc->parent;
75 struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq];
76 struct s3c_irq_data *parent_data;
Ben Dooksa21765a2007-02-11 18:31:01 +010077 unsigned long mask;
Heiko Stuebner1f629b72013-01-29 10:25:22 -080078 unsigned int irqno;
Ben Dooksa21765a2007-02-11 18:31:01 +010079
Heiko Stuebner1f629b72013-01-29 10:25:22 -080080 mask = __raw_readl(intc->reg_mask);
81 mask |= (1UL << data->hwirq);
82 __raw_writel(mask, intc->reg_mask);
Ben Dooksa21765a2007-02-11 18:31:01 +010083
Heiko Stuebner1f629b72013-01-29 10:25:22 -080084 if (parent_intc && irq_data->parent_irq) {
85 parent_data = &parent_intc->irqs[irq_data->parent_irq];
Ben Dooksa21765a2007-02-11 18:31:01 +010086
Heiko Stuebner1f629b72013-01-29 10:25:22 -080087 /* check to see if we need to mask the parent IRQ */
88 if ((mask & parent_data->sub_bits) == parent_data->sub_bits) {
89 irqno = irq_find_mapping(parent_intc->domain,
90 irq_data->parent_irq);
91 s3c_irq_mask(irq_get_irq_data(irqno));
92 }
Ben Dooksa21765a2007-02-11 18:31:01 +010093 }
94}
95
Heiko Stuebner1f629b72013-01-29 10:25:22 -080096static void s3c_irq_unmask(struct irq_data *data)
Ben Dooksa21765a2007-02-11 18:31:01 +010097{
Heiko Stuebner1f629b72013-01-29 10:25:22 -080098 struct s3c_irq_intc *intc = data->domain->host_data;
99 struct s3c_irq_intc *parent_intc = intc->parent;
100 struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq];
Ben Dooksa21765a2007-02-11 18:31:01 +0100101 unsigned long mask;
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800102 unsigned int irqno;
Ben Dooksa21765a2007-02-11 18:31:01 +0100103
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800104 mask = __raw_readl(intc->reg_mask);
105 mask &= ~(1UL << data->hwirq);
106 __raw_writel(mask, intc->reg_mask);
107
108 if (parent_intc && irq_data->parent_irq) {
109 irqno = irq_find_mapping(parent_intc->domain,
110 irq_data->parent_irq);
111 s3c_irq_unmask(irq_get_irq_data(irqno));
112 }
Ben Dooksa21765a2007-02-11 18:31:01 +0100113}
114
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800115static inline void s3c_irq_ack(struct irq_data *data)
Ben Dooksa21765a2007-02-11 18:31:01 +0100116{
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800117 struct s3c_irq_intc *intc = data->domain->host_data;
118 unsigned long bitval = 1UL << data->hwirq;
119
120 __raw_writel(bitval, intc->reg_pending);
121 if (intc->reg_intpnd)
122 __raw_writel(bitval, intc->reg_intpnd);
123}
124
125static int s3c_irqext_type_set(void __iomem *gpcon_reg,
126 void __iomem *extint_reg,
127 unsigned long gpcon_offset,
128 unsigned long extint_offset,
129 unsigned int type)
130{
Ben Dooksa21765a2007-02-11 18:31:01 +0100131 unsigned long newvalue = 0, value;
132
Ben Dooksa21765a2007-02-11 18:31:01 +0100133 /* Set the GPIO to external interrupt mode */
134 value = __raw_readl(gpcon_reg);
135 value = (value & ~(3 << gpcon_offset)) | (0x02 << gpcon_offset);
136 __raw_writel(value, gpcon_reg);
137
138 /* Set the external interrupt to pointed trigger type */
139 switch (type)
140 {
Dmitry Baryshkov6cab4862008-07-27 04:23:31 +0100141 case IRQ_TYPE_NONE:
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800142 pr_warn("No edge setting!\n");
Ben Dooksa21765a2007-02-11 18:31:01 +0100143 break;
144
Dmitry Baryshkov6cab4862008-07-27 04:23:31 +0100145 case IRQ_TYPE_EDGE_RISING:
Ben Dooksa21765a2007-02-11 18:31:01 +0100146 newvalue = S3C2410_EXTINT_RISEEDGE;
147 break;
148
Dmitry Baryshkov6cab4862008-07-27 04:23:31 +0100149 case IRQ_TYPE_EDGE_FALLING:
Ben Dooksa21765a2007-02-11 18:31:01 +0100150 newvalue = S3C2410_EXTINT_FALLEDGE;
151 break;
152
Dmitry Baryshkov6cab4862008-07-27 04:23:31 +0100153 case IRQ_TYPE_EDGE_BOTH:
Ben Dooksa21765a2007-02-11 18:31:01 +0100154 newvalue = S3C2410_EXTINT_BOTHEDGE;
155 break;
156
Dmitry Baryshkov6cab4862008-07-27 04:23:31 +0100157 case IRQ_TYPE_LEVEL_LOW:
Ben Dooksa21765a2007-02-11 18:31:01 +0100158 newvalue = S3C2410_EXTINT_LOWLEV;
159 break;
160
Dmitry Baryshkov6cab4862008-07-27 04:23:31 +0100161 case IRQ_TYPE_LEVEL_HIGH:
Ben Dooksa21765a2007-02-11 18:31:01 +0100162 newvalue = S3C2410_EXTINT_HILEV;
163 break;
164
165 default:
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800166 pr_err("No such irq type %d", type);
167 return -EINVAL;
Ben Dooksa21765a2007-02-11 18:31:01 +0100168 }
169
170 value = __raw_readl(extint_reg);
171 value = (value & ~(7 << extint_offset)) | (newvalue << extint_offset);
172 __raw_writel(value, extint_reg);
173
174 return 0;
175}
176
Heiko Stuebnerdc1a3532013-02-12 14:23:01 -0800177static int s3c_irqext_type(struct irq_data *data, unsigned int type)
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800178{
179 void __iomem *extint_reg;
180 void __iomem *gpcon_reg;
181 unsigned long gpcon_offset, extint_offset;
182
183 if ((data->hwirq >= 4) && (data->hwirq <= 7)) {
184 gpcon_reg = S3C2410_GPFCON;
185 extint_reg = S3C24XX_EXTINT0;
186 gpcon_offset = (data->hwirq) * 2;
187 extint_offset = (data->hwirq) * 4;
188 } else if ((data->hwirq >= 8) && (data->hwirq <= 15)) {
189 gpcon_reg = S3C2410_GPGCON;
190 extint_reg = S3C24XX_EXTINT1;
191 gpcon_offset = (data->hwirq - 8) * 2;
192 extint_offset = (data->hwirq - 8) * 4;
193 } else if ((data->hwirq >= 16) && (data->hwirq <= 23)) {
194 gpcon_reg = S3C2410_GPGCON;
195 extint_reg = S3C24XX_EXTINT2;
196 gpcon_offset = (data->hwirq - 8) * 2;
197 extint_offset = (data->hwirq - 16) * 4;
198 } else {
199 return -EINVAL;
200 }
201
202 return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset,
203 extint_offset, type);
204}
205
206static int s3c_irqext0_type(struct irq_data *data, unsigned int type)
207{
208 void __iomem *extint_reg;
209 void __iomem *gpcon_reg;
210 unsigned long gpcon_offset, extint_offset;
211
212 if ((data->hwirq >= 0) && (data->hwirq <= 3)) {
213 gpcon_reg = S3C2410_GPFCON;
214 extint_reg = S3C24XX_EXTINT0;
215 gpcon_offset = (data->hwirq) * 2;
216 extint_offset = (data->hwirq) * 4;
217 } else {
218 return -EINVAL;
219 }
220
221 return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset,
222 extint_offset, type);
223}
224
Heiko Stuebnerdc1a3532013-02-12 14:23:01 -0800225static struct irq_chip s3c_irq_chip = {
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800226 .name = "s3c",
227 .irq_ack = s3c_irq_ack,
228 .irq_mask = s3c_irq_mask,
229 .irq_unmask = s3c_irq_unmask,
230 .irq_set_wake = s3c_irq_wake
231};
232
Heiko Stuebnerdc1a3532013-02-12 14:23:01 -0800233static struct irq_chip s3c_irq_level_chip = {
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800234 .name = "s3c-level",
235 .irq_mask = s3c_irq_mask,
236 .irq_unmask = s3c_irq_unmask,
237 .irq_ack = s3c_irq_ack,
238};
239
Ben Dooksa21765a2007-02-11 18:31:01 +0100240static struct irq_chip s3c_irqext_chip = {
241 .name = "s3c-ext",
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800242 .irq_mask = s3c_irq_mask,
243 .irq_unmask = s3c_irq_unmask,
244 .irq_ack = s3c_irq_ack,
Lennert Buytenhek57436c2d2011-01-03 19:15:54 +0900245 .irq_set_type = s3c_irqext_type,
Mark Brownf5aeffb2010-12-02 14:35:38 +0900246 .irq_set_wake = s3c_irqext_wake
Ben Dooksa21765a2007-02-11 18:31:01 +0100247};
248
249static struct irq_chip s3c_irq_eint0t4 = {
250 .name = "s3c-ext0",
Lennert Buytenhek57436c2d2011-01-03 19:15:54 +0900251 .irq_ack = s3c_irq_ack,
252 .irq_mask = s3c_irq_mask,
253 .irq_unmask = s3c_irq_unmask,
254 .irq_set_wake = s3c_irq_wake,
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800255 .irq_set_type = s3c_irqext0_type,
Ben Dooksa21765a2007-02-11 18:31:01 +0100256};
257
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800258static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc)
Ben Dooksa21765a2007-02-11 18:31:01 +0100259{
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800260 struct irq_chip *chip = irq_desc_get_chip(desc);
261 struct s3c_irq_intc *intc = desc->irq_data.domain->host_data;
262 struct s3c_irq_data *irq_data = &intc->irqs[desc->irq_data.hwirq];
263 struct s3c_irq_intc *sub_intc = irq_data->sub_intc;
264 unsigned long src;
265 unsigned long msk;
266 unsigned int n;
Ben Dooksa21765a2007-02-11 18:31:01 +0100267
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800268 chained_irq_enter(chip, desc);
Ben Dooksa21765a2007-02-11 18:31:01 +0100269
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800270 src = __raw_readl(sub_intc->reg_pending);
271 msk = __raw_readl(sub_intc->reg_mask);
Ben Dooksa21765a2007-02-11 18:31:01 +0100272
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800273 src &= ~msk;
274 src &= irq_data->sub_bits;
Ben Dooksa21765a2007-02-11 18:31:01 +0100275
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800276 while (src) {
277 n = __ffs(src);
278 src &= ~(1 << n);
279 generic_handle_irq(irq_find_mapping(sub_intc->domain, n));
Ben Dooksa21765a2007-02-11 18:31:01 +0100280 }
281
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800282 chained_irq_exit(chip, desc);
Ben Dooksa21765a2007-02-11 18:31:01 +0100283}
284
Ben Dooks229fd8f2009-08-03 17:26:57 +0100285#ifdef CONFIG_FIQ
286/**
287 * s3c24xx_set_fiq - set the FIQ routing
288 * @irq: IRQ number to route to FIQ on processor.
289 * @on: Whether to route @irq to the FIQ, or to remove the FIQ routing.
290 *
291 * Change the state of the IRQ to FIQ routing depending on @irq and @on. If
292 * @on is true, the @irq is checked to see if it can be routed and the
293 * interrupt controller updated to route the IRQ. If @on is false, the FIQ
294 * routing is cleared, regardless of which @irq is specified.
295 */
296int s3c24xx_set_fiq(unsigned int irq, bool on)
297{
298 u32 intmod;
299 unsigned offs;
300
301 if (on) {
302 offs = irq - FIQ_START;
303 if (offs > 31)
304 return -EINVAL;
305
306 intmod = 1 << offs;
307 } else {
308 intmod = 0;
309 }
310
311 __raw_writel(intmod, S3C2410_INTMOD);
312 return 0;
313}
Ben Dooks0f13c822009-12-07 14:51:38 +0000314
315EXPORT_SYMBOL_GPL(s3c24xx_set_fiq);
Ben Dooks229fd8f2009-08-03 17:26:57 +0100316#endif
317
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800318static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,
319 irq_hw_number_t hw)
320{
321 struct s3c_irq_intc *intc = h->host_data;
322 struct s3c_irq_data *irq_data = &intc->irqs[hw];
323 struct s3c_irq_intc *parent_intc;
324 struct s3c_irq_data *parent_irq_data;
325 unsigned int irqno;
326
327 if (!intc) {
328 pr_err("irq-s3c24xx: no controller found for hwirq %lu\n", hw);
329 return -EINVAL;
330 }
331
332 if (!irq_data) {
333 pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw);
334 return -EINVAL;
335 }
336
337 /* attach controller pointer to irq_data */
338 irq_data->intc = intc;
339
340 /* set handler and flags */
341 switch (irq_data->type) {
342 case S3C_IRQTYPE_NONE:
343 return 0;
344 case S3C_IRQTYPE_EINT:
345 if (irq_data->parent_irq)
346 irq_set_chip_and_handler(virq, &s3c_irqext_chip,
347 handle_edge_irq);
348 else
349 irq_set_chip_and_handler(virq, &s3c_irq_eint0t4,
350 handle_edge_irq);
351 break;
352 case S3C_IRQTYPE_EDGE:
Heiko Stuebner20f6c782013-01-29 10:25:22 -0800353 if (irq_data->parent_irq ||
354 intc->reg_pending == S3C2416_SRCPND2)
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800355 irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
356 handle_edge_irq);
357 else
358 irq_set_chip_and_handler(virq, &s3c_irq_chip,
359 handle_edge_irq);
360 break;
361 case S3C_IRQTYPE_LEVEL:
362 if (irq_data->parent_irq)
363 irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
364 handle_level_irq);
365 else
366 irq_set_chip_and_handler(virq, &s3c_irq_chip,
367 handle_level_irq);
368 break;
369 default:
370 pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type);
371 return -EINVAL;
372 }
373 set_irq_flags(virq, IRQF_VALID);
374
375 if (irq_data->parent_irq) {
376 parent_intc = intc->parent;
377 if (!parent_intc) {
378 pr_err("irq-s3c24xx: no parent controller found for hwirq %lu\n",
379 hw);
380 goto err;
381 }
382
383 parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
384 if (!irq_data) {
385 pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n",
386 hw);
387 goto err;
388 }
389
390 parent_irq_data->sub_intc = intc;
391 parent_irq_data->sub_bits |= (1UL << hw);
392
393 /* attach the demuxer to the parent irq */
394 irqno = irq_find_mapping(parent_intc->domain,
395 irq_data->parent_irq);
396 if (!irqno) {
397 pr_err("irq-s3c24xx: could not find mapping for parent irq %lu\n",
398 irq_data->parent_irq);
399 goto err;
400 }
401 irq_set_chained_handler(irqno, s3c_irq_demux);
402 }
403
404 return 0;
405
406err:
407 set_irq_flags(virq, 0);
408
409 /* the only error can result from bad mapping data*/
410 return -EINVAL;
411}
412
413static struct irq_domain_ops s3c24xx_irq_ops = {
414 .map = s3c24xx_irq_map,
415 .xlate = irq_domain_xlate_twocell,
416};
417
418static void s3c24xx_clear_intc(struct s3c_irq_intc *intc)
419{
420 void __iomem *reg_source;
421 unsigned long pend;
422 unsigned long last;
423 int i;
424
425 /* if intpnd is set, read the next pending irq from there */
426 reg_source = intc->reg_intpnd ? intc->reg_intpnd : intc->reg_pending;
427
428 last = 0;
429 for (i = 0; i < 4; i++) {
430 pend = __raw_readl(reg_source);
431
432 if (pend == 0 || pend == last)
433 break;
434
435 __raw_writel(pend, intc->reg_pending);
436 if (intc->reg_intpnd)
437 __raw_writel(pend, intc->reg_intpnd);
438
439 pr_info("irq: clearing pending status %08x\n", (int)pend);
440 last = pend;
441 }
442}
443
444struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np,
445 struct s3c_irq_data *irq_data,
446 struct s3c_irq_intc *parent,
447 unsigned long address)
448{
449 struct s3c_irq_intc *intc;
450 void __iomem *base = (void *)0xf6000000; /* static mapping */
451 int irq_num;
452 int irq_start;
453 int irq_offset;
454 int ret;
455
456 intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL);
457 if (!intc)
458 return ERR_PTR(-ENOMEM);
459
460 intc->irqs = irq_data;
461
462 if (parent)
463 intc->parent = parent;
464
465 /* select the correct data for the controller.
466 * Need to hard code the irq num start and offset
467 * to preserve the static mapping for now
468 */
469 switch (address) {
470 case 0x4a000000:
471 pr_debug("irq: found main intc\n");
472 intc->reg_pending = base;
473 intc->reg_mask = base + 0x08;
474 intc->reg_intpnd = base + 0x10;
475 irq_num = 32;
476 irq_start = S3C2410_IRQ(0);
477 irq_offset = 0;
478 break;
479 case 0x4a000018:
480 pr_debug("irq: found subintc\n");
481 intc->reg_pending = base + 0x18;
482 intc->reg_mask = base + 0x1c;
483 irq_num = 29;
484 irq_start = S3C2410_IRQSUB(0);
485 irq_offset = 0;
486 break;
487 case 0x4a000040:
488 pr_debug("irq: found intc2\n");
489 intc->reg_pending = base + 0x40;
490 intc->reg_mask = base + 0x48;
491 intc->reg_intpnd = base + 0x50;
492 irq_num = 8;
493 irq_start = S3C2416_IRQ(0);
494 irq_offset = 0;
495 break;
496 case 0x560000a4:
497 pr_debug("irq: found eintc\n");
498 base = (void *)0xfd000000;
499
500 intc->reg_mask = base + 0xa4;
501 intc->reg_pending = base + 0x08;
502 irq_num = 20;
503 irq_start = S3C2410_IRQ(32);
504 irq_offset = 4;
505 break;
506 default:
507 pr_err("irq: unsupported controller address\n");
508 ret = -EINVAL;
509 goto err;
510 }
511
512 /* now that all the data is complete, init the irq-domain */
513 s3c24xx_clear_intc(intc);
514 intc->domain = irq_domain_add_legacy(np, irq_num, irq_start,
515 irq_offset, &s3c24xx_irq_ops,
516 intc);
517 if (!intc->domain) {
518 pr_err("irq: could not create irq-domain\n");
519 ret = -EINVAL;
520 goto err;
521 }
522
523 return intc;
524
525err:
526 kfree(intc);
527 return ERR_PTR(ret);
528}
Ben Dooks229fd8f2009-08-03 17:26:57 +0100529
Ben Dooksa21765a2007-02-11 18:31:01 +0100530/* s3c24xx_init_irq
531 *
532 * Initialise S3C2410 IRQ system
533*/
534
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800535static struct s3c_irq_data init_base[32] = {
536 { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
537 { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
538 { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
539 { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
540 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
541 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
542 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
543 { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
544 { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
545 { .type = S3C_IRQTYPE_EDGE, }, /* WDT */
546 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
547 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
548 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
549 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
550 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
551 { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
552 { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
553 { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
554 { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
555 { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
556 { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
557 { .type = S3C_IRQTYPE_EDGE, }, /* SDI */
558 { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
559 { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
560 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
561 { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
562 { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
563 { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
564 { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
565 { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
566 { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
567 { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
568};
569
570static struct s3c_irq_data init_eint[32] = {
571 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
572 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
573 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
574 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
575 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */
576 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */
577 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */
578 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */
579 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */
580 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */
581 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */
582 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */
583 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */
584 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */
585 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */
586 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */
587 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */
588 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */
589 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */
590 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */
591 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */
592 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */
593 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */
594 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */
595};
596
597static struct s3c_irq_data init_subint[32] = {
598 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
599 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
600 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
601 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
602 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
603 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
604 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
605 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
606 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
607 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
608 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
609};
610
Ben Dooksa21765a2007-02-11 18:31:01 +0100611void __init s3c24xx_init_irq(void)
612{
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800613 struct s3c_irq_intc *main_intc;
Ben Dooksa21765a2007-02-11 18:31:01 +0100614
Ben Dooks229fd8f2009-08-03 17:26:57 +0100615#ifdef CONFIG_FIQ
Shawn Guobc896632012-06-28 14:42:08 +0800616 init_FIQ(FIQ_START);
Ben Dooks229fd8f2009-08-03 17:26:57 +0100617#endif
618
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800619 main_intc = s3c24xx_init_intc(NULL, &init_base[0], NULL, 0x4a000000);
620 if (IS_ERR(main_intc)) {
621 pr_err("irq: could not create main interrupt controller\n");
622 return;
Ben Dooksa21765a2007-02-11 18:31:01 +0100623 }
624
Heiko Stuebner1f629b72013-01-29 10:25:22 -0800625 s3c24xx_init_intc(NULL, &init_subint[0], main_intc, 0x4a000018);
626 s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4);
Ben Dooksa21765a2007-02-11 18:31:01 +0100627}
Heiko Stuebneref602eb2013-01-29 10:25:22 -0800628
629#ifdef CONFIG_CPU_S3C2416
Heiko Stuebner20f6c782013-01-29 10:25:22 -0800630static struct s3c_irq_data init_s3c2416base[32] = {
631 { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
632 { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
633 { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
634 { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
635 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
636 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
637 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
638 { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
639 { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
640 { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
641 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
642 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
643 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
644 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
645 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
646 { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
647 { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */
648 { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */
649 { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */
650 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
651 { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */
652 { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */
653 { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
654 { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
655 { .type = S3C_IRQTYPE_EDGE, }, /* NAND */
656 { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
657 { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
658 { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
659 { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
660 { .type = S3C_IRQTYPE_NONE, },
661 { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
662 { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
Heiko Stuebneref602eb2013-01-29 10:25:22 -0800663};
664
Heiko Stuebner20f6c782013-01-29 10:25:22 -0800665static struct s3c_irq_data init_s3c2416subint[32] = {
666 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
667 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
668 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
669 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
670 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
671 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
672 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
673 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
674 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
675 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
676 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
677 { .type = S3C_IRQTYPE_NONE }, /* reserved */
678 { .type = S3C_IRQTYPE_NONE }, /* reserved */
679 { .type = S3C_IRQTYPE_NONE }, /* reserved */
680 { .type = S3C_IRQTYPE_NONE }, /* reserved */
681 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */
682 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */
683 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */
684 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */
685 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */
686 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */
687 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */
688 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */
689 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */
690 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */
691 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */
692 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */
693 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
694 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
Heiko Stuebneref602eb2013-01-29 10:25:22 -0800695};
696
Heiko Stuebner20f6c782013-01-29 10:25:22 -0800697static struct s3c_irq_data init_s3c2416_second[32] = {
698 { .type = S3C_IRQTYPE_EDGE }, /* 2D */
699 { .type = S3C_IRQTYPE_EDGE }, /* IIC1 */
700 { .type = S3C_IRQTYPE_NONE }, /* reserved */
701 { .type = S3C_IRQTYPE_NONE }, /* reserved */
702 { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */
703 { .type = S3C_IRQTYPE_EDGE }, /* PCM1 */
704 { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */
705 { .type = S3C_IRQTYPE_EDGE }, /* I2S1 */
Heiko Stuebneref602eb2013-01-29 10:25:22 -0800706};
707
Heiko Stuebner4a282dd2013-01-29 10:25:22 -0800708void __init s3c2416_init_irq(void)
Heiko Stuebneref602eb2013-01-29 10:25:22 -0800709{
Heiko Stuebner20f6c782013-01-29 10:25:22 -0800710 struct s3c_irq_intc *main_intc;
711
Heiko Stuebner4a282dd2013-01-29 10:25:22 -0800712 pr_info("S3C2416: IRQ Support\n");
713
Heiko Stuebner20f6c782013-01-29 10:25:22 -0800714#ifdef CONFIG_FIQ
715 init_FIQ(FIQ_START);
716#endif
Heiko Stuebneref602eb2013-01-29 10:25:22 -0800717
Heiko Stuebner20f6c782013-01-29 10:25:22 -0800718 main_intc = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, 0x4a000000);
719 if (IS_ERR(main_intc)) {
720 pr_err("irq: could not create main interrupt controller\n");
721 return;
722 }
Heiko Stuebneref602eb2013-01-29 10:25:22 -0800723
Heiko Stuebner20f6c782013-01-29 10:25:22 -0800724 s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4);
725 s3c24xx_init_intc(NULL, &init_s3c2416subint[0], main_intc, 0x4a000018);
Heiko Stuebneref602eb2013-01-29 10:25:22 -0800726
Heiko Stuebner20f6c782013-01-29 10:25:22 -0800727 s3c24xx_init_intc(NULL, &init_s3c2416_second[0], NULL, 0x4a000040);
Heiko Stuebneref602eb2013-01-29 10:25:22 -0800728}
729
Heiko Stuebneref602eb2013-01-29 10:25:22 -0800730#endif
Heiko Stuebner6b628912013-01-29 10:25:22 -0800731
Heiko Stuebner6f8d7ea2013-02-12 09:59:17 -0800732#ifdef CONFIG_CPU_S3C244X
733/* camera irq */
734
735static void s3c_irq_demux_cam(unsigned int irq,
736 struct irq_desc *desc)
737{
738 unsigned int subsrc, submsk;
739
740 /* read the current pending interrupts, and the mask
741 * for what it is available */
742
743 subsrc = __raw_readl(S3C2410_SUBSRCPND);
744 submsk = __raw_readl(S3C2410_INTSUBMSK);
745
746 subsrc &= ~submsk;
747 subsrc >>= 11;
748 subsrc &= 3;
749
750 if (subsrc != 0) {
751 if (subsrc & 1) {
752 generic_handle_irq(IRQ_S3C2440_CAM_C);
753 }
754 if (subsrc & 2) {
755 generic_handle_irq(IRQ_S3C2440_CAM_P);
756 }
757 }
758}
759
760#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
761
762static void
763s3c_irq_cam_mask(struct irq_data *data)
764{
765 s3c_irqsub_mask(data->irq, INTMSK_CAM, 3 << 11);
766}
767
768static void
769s3c_irq_cam_unmask(struct irq_data *data)
770{
771 s3c_irqsub_unmask(data->irq, INTMSK_CAM);
772}
773
774static void
775s3c_irq_cam_ack(struct irq_data *data)
776{
777 s3c_irqsub_maskack(data->irq, INTMSK_CAM, 3 << 11);
778}
779
780static struct irq_chip s3c_irq_cam = {
781 .irq_mask = s3c_irq_cam_mask,
782 .irq_unmask = s3c_irq_cam_unmask,
783 .irq_ack = s3c_irq_cam_ack,
784};
785
786static int s3c244x_irq_add(struct device *dev, struct subsys_interface *sif)
787{
788 unsigned int irqno;
789
790 irq_set_chip_and_handler(IRQ_NFCON, &s3c_irq_level_chip,
791 handle_level_irq);
792 set_irq_flags(IRQ_NFCON, IRQF_VALID);
793
794 /* add chained handler for camera */
795
796 irq_set_chip_and_handler(IRQ_CAM, &s3c_irq_level_chip,
797 handle_level_irq);
798 irq_set_chained_handler(IRQ_CAM, s3c_irq_demux_cam);
799
800 for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) {
801 irq_set_chip_and_handler(irqno, &s3c_irq_cam,
802 handle_level_irq);
803 set_irq_flags(irqno, IRQF_VALID);
804 }
805
806 return 0;
807}
808
809static struct subsys_interface s3c2440_irq_interface = {
810 .name = "s3c2440_irq",
811 .subsys = &s3c2440_subsys,
812 .add_dev = s3c244x_irq_add,
813};
814
815static int s3c2440_irq_init(void)
816{
817 return subsys_interface_register(&s3c2440_irq_interface);
818}
819
820arch_initcall(s3c2440_irq_init);
821
822static struct subsys_interface s3c2442_irq_interface = {
823 .name = "s3c2442_irq",
824 .subsys = &s3c2442_subsys,
825 .add_dev = s3c244x_irq_add,
826};
827
828
829static int s3c2442_irq_init(void)
830{
831 return subsys_interface_register(&s3c2442_irq_interface);
832}
833
834arch_initcall(s3c2442_irq_init);
835#endif
836
Heiko Stuebner6b628912013-01-29 10:25:22 -0800837#ifdef CONFIG_CPU_S3C2443
Heiko Stuebnerf44ddba2013-01-29 10:25:23 -0800838static struct s3c_irq_data init_s3c2443base[32] = {
839 { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
840 { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
841 { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
842 { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
843 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
844 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
845 { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
846 { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
847 { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
848 { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
849 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
850 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
851 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
852 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
853 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
854 { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
855 { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */
856 { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */
857 { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */
858 { .type = S3C_IRQTYPE_EDGE, }, /* CFON */
859 { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */
860 { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */
861 { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
862 { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
863 { .type = S3C_IRQTYPE_EDGE, }, /* NAND */
864 { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
865 { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
866 { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
867 { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
868 { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
869 { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
870 { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
Heiko Stuebner6b628912013-01-29 10:25:22 -0800871};
872
Heiko Stuebner6b628912013-01-29 10:25:22 -0800873
Heiko Stuebnerf44ddba2013-01-29 10:25:23 -0800874static struct s3c_irq_data init_s3c2443subint[32] = {
875 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
876 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
877 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
878 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
879 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
880 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
881 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
882 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
883 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
884 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
885 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
886 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */
887 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */
888 { .type = S3C_IRQTYPE_NONE }, /* reserved */
889 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD1 */
890 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */
891 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */
892 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */
893 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */
894 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */
895 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */
896 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */
897 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */
898 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */
899 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */
900 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */
901 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */
902 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
903 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
Heiko Stuebner6b628912013-01-29 10:25:22 -0800904};
905
Heiko Stuebnerb499b7a2013-01-29 10:25:23 -0800906void __init s3c2443_init_irq(void)
Heiko Stuebner6b628912013-01-29 10:25:22 -0800907{
Heiko Stuebnerf44ddba2013-01-29 10:25:23 -0800908 struct s3c_irq_intc *main_intc;
909
Heiko Stuebnerb499b7a2013-01-29 10:25:23 -0800910 pr_info("S3C2443: IRQ Support\n");
911
Heiko Stuebnerf44ddba2013-01-29 10:25:23 -0800912#ifdef CONFIG_FIQ
913 init_FIQ(FIQ_START);
914#endif
Heiko Stuebner6b628912013-01-29 10:25:22 -0800915
Heiko Stuebnerf44ddba2013-01-29 10:25:23 -0800916 main_intc = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, 0x4a000000);
917 if (IS_ERR(main_intc)) {
918 pr_err("irq: could not create main interrupt controller\n");
919 return;
920 }
Heiko Stuebner6b628912013-01-29 10:25:22 -0800921
Heiko Stuebnerf44ddba2013-01-29 10:25:23 -0800922 s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4);
923 s3c24xx_init_intc(NULL, &init_s3c2443subint[0], main_intc, 0x4a000018);
Heiko Stuebner6b628912013-01-29 10:25:22 -0800924}
Heiko Stuebner6b628912013-01-29 10:25:22 -0800925#endif