SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 1 | /* |
Andrew Victor | 9d04126 | 2007-02-05 11:42:07 +0100 | [diff] [blame] | 2 | * linux/arch/arm/mach-at91/irq.c |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2004 SAN People |
| 5 | * Copyright (C) 2004 ATMEL |
| 6 | * Copyright (C) Rick Bronson |
| 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 | |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 23 | #include <linux/init.h> |
| 24 | #include <linux/module.h> |
| 25 | #include <linux/mm.h> |
| 26 | #include <linux/types.h> |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 27 | #include <linux/irq.h> |
| 28 | #include <linux/of.h> |
| 29 | #include <linux/of_address.h> |
| 30 | #include <linux/of_irq.h> |
| 31 | #include <linux/irqdomain.h> |
| 32 | #include <linux/err.h> |
Ludovic Desroches | f8a073e | 2012-06-20 16:13:30 +0200 | [diff] [blame] | 33 | #include <linux/slab.h> |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 34 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 35 | #include <mach/hardware.h> |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 36 | #include <asm/irq.h> |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 37 | #include <asm/setup.h> |
| 38 | |
Ludovic Desroches | 3e13546 | 2012-06-11 15:38:03 +0200 | [diff] [blame] | 39 | #include <asm/exception.h> |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 40 | #include <asm/mach/arch.h> |
| 41 | #include <asm/mach/irq.h> |
| 42 | #include <asm/mach/map.h> |
| 43 | |
Ludovic Desroches | 8fe82a5 | 2012-06-21 14:47:27 +0200 | [diff] [blame^] | 44 | #include <mach/at91_aic.h> |
| 45 | |
Jean-Christophe PLAGNIOL-VILLARD | be6d432 | 2011-11-03 01:12:50 +0800 | [diff] [blame] | 46 | void __iomem *at91_aic_base; |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 47 | static struct irq_domain *at91_aic_domain; |
| 48 | static struct device_node *at91_aic_np; |
Ludovic Desroches | f8a073e | 2012-06-20 16:13:30 +0200 | [diff] [blame] | 49 | static unsigned int *at91_aic_irq_priorities; |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 50 | |
Ludovic Desroches | 3e13546 | 2012-06-11 15:38:03 +0200 | [diff] [blame] | 51 | asmlinkage void __exception_irq_entry at91_aic_handle_irq(struct pt_regs *regs) |
| 52 | { |
| 53 | u32 irqnr; |
| 54 | u32 irqstat; |
| 55 | |
| 56 | irqnr = at91_aic_read(AT91_AIC_IVR); |
| 57 | irqstat = at91_aic_read(AT91_AIC_ISR); |
| 58 | |
| 59 | /* |
| 60 | * ISR value is 0 when there is no current interrupt or when there is |
| 61 | * a spurious interrupt |
| 62 | */ |
| 63 | if (!irqstat) |
| 64 | at91_aic_write(AT91_AIC_EOICR, 0); |
| 65 | else |
| 66 | handle_IRQ(irqnr, regs); |
| 67 | } |
| 68 | |
Lennert Buytenhek | da0f940 | 2010-11-29 10:26:19 +0100 | [diff] [blame] | 69 | static void at91_aic_mask_irq(struct irq_data *d) |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 70 | { |
| 71 | /* Disable interrupt on AIC */ |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 72 | at91_aic_write(AT91_AIC_IDCR, 1 << d->hwirq); |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 73 | } |
| 74 | |
Lennert Buytenhek | da0f940 | 2010-11-29 10:26:19 +0100 | [diff] [blame] | 75 | static void at91_aic_unmask_irq(struct irq_data *d) |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 76 | { |
| 77 | /* Enable interrupt on AIC */ |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 78 | at91_aic_write(AT91_AIC_IECR, 1 << d->hwirq); |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 79 | } |
| 80 | |
Ludovic Desroches | 42a859d | 2012-05-25 14:11:51 +0200 | [diff] [blame] | 81 | static void at91_aic_eoi(struct irq_data *d) |
| 82 | { |
| 83 | /* |
| 84 | * Mark end-of-interrupt on AIC, the controller doesn't care about |
| 85 | * the value written. Moreover it's a write-only register. |
| 86 | */ |
| 87 | at91_aic_write(AT91_AIC_EOICR, 0); |
| 88 | } |
| 89 | |
Andrew Victor | 1f4fd0a | 2006-11-30 10:01:47 +0100 | [diff] [blame] | 90 | unsigned int at91_extern_irq; |
| 91 | |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 92 | #define is_extern_irq(hwirq) ((1 << (hwirq)) & at91_extern_irq) |
Andrew Victor | 1f4fd0a | 2006-11-30 10:01:47 +0100 | [diff] [blame] | 93 | |
Lennert Buytenhek | da0f940 | 2010-11-29 10:26:19 +0100 | [diff] [blame] | 94 | static int at91_aic_set_type(struct irq_data *d, unsigned type) |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 95 | { |
| 96 | unsigned int smr, srctype; |
| 97 | |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 98 | switch (type) { |
Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 99 | case IRQ_TYPE_LEVEL_HIGH: |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 100 | srctype = AT91_AIC_SRCTYPE_HIGH; |
| 101 | break; |
Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 102 | case IRQ_TYPE_EDGE_RISING: |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 103 | srctype = AT91_AIC_SRCTYPE_RISING; |
| 104 | break; |
Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 105 | case IRQ_TYPE_LEVEL_LOW: |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 106 | if ((d->hwirq == AT91_ID_FIQ) || is_extern_irq(d->hwirq)) /* only supported on external interrupts */ |
Andrew Victor | 1f4fd0a | 2006-11-30 10:01:47 +0100 | [diff] [blame] | 107 | srctype = AT91_AIC_SRCTYPE_LOW; |
| 108 | else |
Andrew Victor | 37f2e4bc | 2006-06-19 15:26:52 +0100 | [diff] [blame] | 109 | return -EINVAL; |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 110 | break; |
Dmitry Baryshkov | 6cab486 | 2008-07-27 04:23:31 +0100 | [diff] [blame] | 111 | case IRQ_TYPE_EDGE_FALLING: |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 112 | if ((d->hwirq == AT91_ID_FIQ) || is_extern_irq(d->hwirq)) /* only supported on external interrupts */ |
Andrew Victor | 1f4fd0a | 2006-11-30 10:01:47 +0100 | [diff] [blame] | 113 | srctype = AT91_AIC_SRCTYPE_FALLING; |
| 114 | else |
Andrew Victor | 37f2e4bc | 2006-06-19 15:26:52 +0100 | [diff] [blame] | 115 | return -EINVAL; |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 116 | break; |
| 117 | default: |
| 118 | return -EINVAL; |
| 119 | } |
| 120 | |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 121 | smr = at91_aic_read(AT91_AIC_SMR(d->hwirq)) & ~AT91_AIC_SRCTYPE; |
| 122 | at91_aic_write(AT91_AIC_SMR(d->hwirq), smr | srctype); |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 123 | return 0; |
| 124 | } |
| 125 | |
Andrew Victor | 683c66b | 2006-06-19 15:26:53 +0100 | [diff] [blame] | 126 | #ifdef CONFIG_PM |
| 127 | |
| 128 | static u32 wakeups; |
| 129 | static u32 backups; |
| 130 | |
Lennert Buytenhek | da0f940 | 2010-11-29 10:26:19 +0100 | [diff] [blame] | 131 | static int at91_aic_set_wake(struct irq_data *d, unsigned value) |
Andrew Victor | 683c66b | 2006-06-19 15:26:53 +0100 | [diff] [blame] | 132 | { |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 133 | if (unlikely(d->hwirq >= NR_AIC_IRQS)) |
Andrew Victor | 683c66b | 2006-06-19 15:26:53 +0100 | [diff] [blame] | 134 | return -EINVAL; |
| 135 | |
| 136 | if (value) |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 137 | wakeups |= (1 << d->hwirq); |
Andrew Victor | 683c66b | 2006-06-19 15:26:53 +0100 | [diff] [blame] | 138 | else |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 139 | wakeups &= ~(1 << d->hwirq); |
Andrew Victor | 683c66b | 2006-06-19 15:26:53 +0100 | [diff] [blame] | 140 | |
| 141 | return 0; |
| 142 | } |
| 143 | |
| 144 | void at91_irq_suspend(void) |
| 145 | { |
Jean-Christophe PLAGNIOL-VILLARD | be6d432 | 2011-11-03 01:12:50 +0800 | [diff] [blame] | 146 | backups = at91_aic_read(AT91_AIC_IMR); |
| 147 | at91_aic_write(AT91_AIC_IDCR, backups); |
| 148 | at91_aic_write(AT91_AIC_IECR, wakeups); |
Andrew Victor | 683c66b | 2006-06-19 15:26:53 +0100 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | void at91_irq_resume(void) |
| 152 | { |
Jean-Christophe PLAGNIOL-VILLARD | be6d432 | 2011-11-03 01:12:50 +0800 | [diff] [blame] | 153 | at91_aic_write(AT91_AIC_IDCR, wakeups); |
| 154 | at91_aic_write(AT91_AIC_IECR, backups); |
Andrew Victor | 683c66b | 2006-06-19 15:26:53 +0100 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | #else |
Andrew Victor | ba854e1 | 2006-07-05 17:22:52 +0100 | [diff] [blame] | 158 | #define at91_aic_set_wake NULL |
Andrew Victor | 683c66b | 2006-06-19 15:26:53 +0100 | [diff] [blame] | 159 | #endif |
| 160 | |
David Brownell | 38c677c | 2006-08-01 22:26:25 +0100 | [diff] [blame] | 161 | static struct irq_chip at91_aic_chip = { |
| 162 | .name = "AIC", |
Lennert Buytenhek | da0f940 | 2010-11-29 10:26:19 +0100 | [diff] [blame] | 163 | .irq_mask = at91_aic_mask_irq, |
| 164 | .irq_unmask = at91_aic_unmask_irq, |
| 165 | .irq_set_type = at91_aic_set_type, |
| 166 | .irq_set_wake = at91_aic_set_wake, |
Ludovic Desroches | 42a859d | 2012-05-25 14:11:51 +0200 | [diff] [blame] | 167 | .irq_eoi = at91_aic_eoi, |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 168 | }; |
| 169 | |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 170 | static void __init at91_aic_hw_init(unsigned int spu_vector) |
| 171 | { |
| 172 | int i; |
| 173 | |
| 174 | /* |
| 175 | * Perform 8 End Of Interrupt Command to make sure AIC |
| 176 | * will not Lock out nIRQ |
| 177 | */ |
| 178 | for (i = 0; i < 8; i++) |
| 179 | at91_aic_write(AT91_AIC_EOICR, 0); |
| 180 | |
| 181 | /* |
| 182 | * Spurious Interrupt ID in Spurious Vector Register. |
| 183 | * When there is no current interrupt, the IRQ Vector Register |
| 184 | * reads the value stored in AIC_SPU |
| 185 | */ |
| 186 | at91_aic_write(AT91_AIC_SPU, spu_vector); |
| 187 | |
| 188 | /* No debugging in AIC: Debug (Protect) Control Register */ |
| 189 | at91_aic_write(AT91_AIC_DCR, 0); |
| 190 | |
| 191 | /* Disable and clear all interrupts initially */ |
| 192 | at91_aic_write(AT91_AIC_IDCR, 0xFFFFFFFF); |
| 193 | at91_aic_write(AT91_AIC_ICCR, 0xFFFFFFFF); |
| 194 | } |
| 195 | |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 196 | #if defined(CONFIG_OF) |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 197 | static int at91_aic_irq_map(struct irq_domain *h, unsigned int virq, |
| 198 | irq_hw_number_t hw) |
| 199 | { |
| 200 | /* Put virq number in Source Vector Register */ |
| 201 | at91_aic_write(AT91_AIC_SVR(hw), virq); |
| 202 | |
Ludovic Desroches | f8a073e | 2012-06-20 16:13:30 +0200 | [diff] [blame] | 203 | /* Active Low interrupt, with priority */ |
| 204 | at91_aic_write(AT91_AIC_SMR(hw), |
| 205 | AT91_AIC_SRCTYPE_LOW | at91_aic_irq_priorities[hw]); |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 206 | |
Ludovic Desroches | 42a859d | 2012-05-25 14:11:51 +0200 | [diff] [blame] | 207 | irq_set_chip_and_handler(virq, &at91_aic_chip, handle_fasteoi_irq); |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 208 | set_irq_flags(virq, IRQF_VALID | IRQF_PROBE); |
| 209 | |
| 210 | return 0; |
| 211 | } |
| 212 | |
Ludovic Desroches | f8a073e | 2012-06-20 16:13:30 +0200 | [diff] [blame] | 213 | static int at91_aic_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr, |
| 214 | const u32 *intspec, unsigned int intsize, |
| 215 | irq_hw_number_t *out_hwirq, unsigned int *out_type) |
| 216 | { |
| 217 | if (WARN_ON(intsize < 3)) |
| 218 | return -EINVAL; |
| 219 | if (WARN_ON(intspec[0] >= NR_AIC_IRQS)) |
| 220 | return -EINVAL; |
| 221 | if (WARN_ON((intspec[2] < AT91_AIC_IRQ_MIN_PRIORITY) |
| 222 | || (intspec[2] > AT91_AIC_IRQ_MAX_PRIORITY))) |
| 223 | return -EINVAL; |
| 224 | |
| 225 | *out_hwirq = intspec[0]; |
| 226 | *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; |
| 227 | at91_aic_irq_priorities[*out_hwirq] = intspec[2]; |
| 228 | |
| 229 | return 0; |
| 230 | } |
| 231 | |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 232 | static struct irq_domain_ops at91_aic_irq_ops = { |
| 233 | .map = at91_aic_irq_map, |
Ludovic Desroches | f8a073e | 2012-06-20 16:13:30 +0200 | [diff] [blame] | 234 | .xlate = at91_aic_irq_domain_xlate, |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 235 | }; |
| 236 | |
| 237 | int __init at91_aic_of_init(struct device_node *node, |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 238 | struct device_node *parent) |
| 239 | { |
Jean-Christophe PLAGNIOL-VILLARD | c657394 | 2012-04-09 19:36:36 +0800 | [diff] [blame] | 240 | struct property *prop; |
| 241 | const __be32 *p; |
| 242 | u32 val; |
| 243 | |
Ludovic Desroches | f8a073e | 2012-06-20 16:13:30 +0200 | [diff] [blame] | 244 | at91_aic_irq_priorities = kzalloc(NR_AIC_IRQS |
| 245 | * sizeof(*at91_aic_irq_priorities), |
| 246 | GFP_KERNEL); |
| 247 | if (!at91_aic_irq_priorities) |
| 248 | return -ENOMEM; |
| 249 | |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 250 | at91_aic_base = of_iomap(node, 0); |
| 251 | at91_aic_np = node; |
| 252 | |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 253 | at91_aic_domain = irq_domain_add_linear(at91_aic_np, NR_AIC_IRQS, |
| 254 | &at91_aic_irq_ops, NULL); |
| 255 | if (!at91_aic_domain) |
| 256 | panic("Unable to add AIC irq domain (DT)\n"); |
| 257 | |
Jean-Christophe PLAGNIOL-VILLARD | c657394 | 2012-04-09 19:36:36 +0800 | [diff] [blame] | 258 | at91_extern_irq = 0; |
| 259 | of_property_for_each_u32(node, "atmel,external-irqs", prop, p, val) { |
| 260 | if (val > 31) |
| 261 | pr_warn("AIC: external irq %d > 31 skip it\n", val); |
| 262 | else |
| 263 | at91_extern_irq |= (1 << val); |
| 264 | } |
| 265 | |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 266 | irq_set_default_host(at91_aic_domain); |
| 267 | |
| 268 | at91_aic_hw_init(NR_AIC_IRQS); |
| 269 | |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 270 | return 0; |
| 271 | } |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 272 | #endif |
| 273 | |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 274 | /* |
| 275 | * Initialize the AIC interrupt controller. |
| 276 | */ |
Andrew Victor | ba854e1 | 2006-07-05 17:22:52 +0100 | [diff] [blame] | 277 | void __init at91_aic_init(unsigned int priority[NR_AIC_IRQS]) |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 278 | { |
| 279 | unsigned int i; |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 280 | int irq_base; |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 281 | |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 282 | at91_aic_base = ioremap(AT91_AIC, 512); |
Jean-Christophe PLAGNIOL-VILLARD | be6d432 | 2011-11-03 01:12:50 +0800 | [diff] [blame] | 283 | if (!at91_aic_base) |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 284 | panic("Unable to ioremap AIC registers\n"); |
| 285 | |
| 286 | /* Add irq domain for AIC */ |
| 287 | irq_base = irq_alloc_descs(-1, 0, NR_AIC_IRQS, 0); |
| 288 | if (irq_base < 0) { |
| 289 | WARN(1, "Cannot allocate irq_descs, assuming pre-allocated\n"); |
| 290 | irq_base = 0; |
| 291 | } |
| 292 | at91_aic_domain = irq_domain_add_legacy(at91_aic_np, NR_AIC_IRQS, |
| 293 | irq_base, 0, |
| 294 | &irq_domain_simple_ops, NULL); |
| 295 | |
| 296 | if (!at91_aic_domain) |
| 297 | panic("Unable to add AIC irq domain\n"); |
Jean-Christophe PLAGNIOL-VILLARD | be6d432 | 2011-11-03 01:12:50 +0800 | [diff] [blame] | 298 | |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 299 | irq_set_default_host(at91_aic_domain); |
| 300 | |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 301 | /* |
| 302 | * The IVR is used by macro get_irqnr_and_base to read and verify. |
| 303 | * The irq number is NR_AIC_IRQS when a spurious interrupt has occurred. |
| 304 | */ |
| 305 | for (i = 0; i < NR_AIC_IRQS; i++) { |
Nicolas Ferre | e261501 | 2011-11-22 22:26:09 +0100 | [diff] [blame] | 306 | /* Put hardware irq number in Source Vector Register: */ |
Ludovic Desroches | 8fe82a5 | 2012-06-21 14:47:27 +0200 | [diff] [blame^] | 307 | at91_aic_write(AT91_AIC_SVR(i), NR_IRQS_LEGACY + i); |
Andrew Victor | ba854e1 | 2006-07-05 17:22:52 +0100 | [diff] [blame] | 308 | /* Active Low interrupt, with the specified priority */ |
Jean-Christophe PLAGNIOL-VILLARD | be6d432 | 2011-11-03 01:12:50 +0800 | [diff] [blame] | 309 | at91_aic_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]); |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 310 | |
Ludovic Desroches | 8fe82a5 | 2012-06-21 14:47:27 +0200 | [diff] [blame^] | 311 | irq_set_chip_and_handler(NR_IRQS_LEGACY + i, &at91_aic_chip, handle_fasteoi_irq); |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 312 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 313 | } |
| 314 | |
Nicolas Ferre | 8014d6f | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 315 | at91_aic_hw_init(NR_AIC_IRQS); |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 316 | } |