24 #include <linux/module.h>
26 #include <linux/bitmap.h>
27 #include <linux/types.h>
34 #include <linux/slab.h>
36 #include <mach/hardware.h>
38 #include <asm/setup.h>
40 #include <asm/exception.h>
51 static unsigned long at91_aic_caps = 0;
54 #define AT91_AIC_CAP_AIC5 (1 << 0)
55 #define has_aic5() (at91_aic_caps & AT91_AIC_CAP_AIC5)
59 static unsigned long *wakeups;
60 static unsigned long *backups;
62 #define set_backup(bit) set_bit(bit, backups)
63 #define clear_backup(bit) clear_bit(bit, backups)
65 static int at91_aic_pm_init(
void)
146 static inline int at91_aic_pm_init(
void)
151 #define set_backup(bit)
152 #define clear_backup(bit)
153 #define at91_aic_set_wake NULL
191 static void at91_aic_mask_irq(
struct irq_data *d)
208 static void at91_aic_unmask_irq(
struct irq_data *d)
225 static void at91_aic_eoi(
struct irq_data *d)
241 #define is_extern_irq(hwirq) test_bit(hwirq, at91_extern_irq)
243 static int at91_aic_compute_srctype(
struct irq_data *d,
unsigned type)
273 static int at91_aic_set_type(
struct irq_data *d,
unsigned type)
278 srctype = at91_aic_compute_srctype(d, type);
296 static struct irq_chip at91_aic_chip = {
298 .irq_mask = at91_aic_mask_irq,
299 .irq_unmask = at91_aic_unmask_irq,
300 .irq_set_type = at91_aic_set_type,
302 .irq_eoi = at91_aic_eoi,
305 static void __init at91_aic_hw_init(
unsigned int spu_vector)
313 for (i = 0; i < 8; i++)
339 for (i = 0; i < 8; i++)
353 for (i = 0; i < n_irqs; i++) {
360 #if defined(CONFIG_OF)
361 static unsigned int *at91_aic_irq_priorities;
363 static int at91_aic_irq_map(
struct irq_domain *
h,
unsigned int virq,
379 static int at91_aic5_irq_map(
struct irq_domain *h,
unsigned int virq,
398 const u32 *intspec,
unsigned int intsize,
403 if (
WARN_ON(intspec[0] >= n_irqs))
409 *out_hwirq = intspec[0];
411 at91_aic_irq_priorities[*out_hwirq] = intspec[2];
417 .
map = at91_aic_irq_map,
418 .xlate = at91_aic_irq_domain_xlate,
430 if (!at91_extern_irq)
433 if (at91_aic_pm_init()) {
434 kfree(at91_extern_irq);
438 at91_aic_irq_priorities = kzalloc(n_irqs
439 *
sizeof(*at91_aic_irq_priorities),
441 if (!at91_aic_irq_priorities)
448 &at91_aic_irq_ops,
NULL);
449 if (!at91_aic_domain)
450 panic(
"Unable to add AIC irq domain (DT)\n");
454 pr_warn(
"AIC: external irq %d >= %d skip it\n",
470 err = at91_aic_of_common_init(node, parent);
474 at91_aic_hw_init(n_irqs);
486 at91_aic_chip.
irq_ack = at91_aic5_mask_irq;
487 at91_aic_chip.
irq_mask = at91_aic5_mask_irq;
488 at91_aic_chip.
irq_unmask = at91_aic5_unmask_irq;
489 at91_aic_chip.
irq_eoi = at91_aic5_eoi;
490 at91_aic_irq_ops.
map = at91_aic5_irq_map;
492 err = at91_aic_of_common_init(node, parent);
496 at91_aic5_hw_init(n_irqs);
513 if (at91_aic_pm_init() || at91_extern_irq ==
NULL)
514 panic(
"Unable to allocate bit maps\n");
516 *at91_extern_irq = ext_irq_mask;
520 panic(
"Unable to ioremap AIC registers\n");
523 irq_base = irq_alloc_descs(-1, 0, n_irqs, 0);
525 WARN(1,
"Cannot allocate irq_descs, assuming pre-allocated\n");
532 if (!at91_aic_domain)
533 panic(
"Unable to add AIC irq domain\n");
541 for (i = 0; i < n_irqs; i++) {
550 at91_aic_hw_init(n_irqs);