1b1479ebbSBoris BREZILLON /* 2b1479ebbSBoris BREZILLON * Atmel AT91 AIC5 (Advanced Interrupt Controller) driver 3b1479ebbSBoris BREZILLON * 4b1479ebbSBoris BREZILLON * Copyright (C) 2004 SAN People 5b1479ebbSBoris BREZILLON * Copyright (C) 2004 ATMEL 6b1479ebbSBoris BREZILLON * Copyright (C) Rick Bronson 7b1479ebbSBoris BREZILLON * Copyright (C) 2014 Free Electrons 8b1479ebbSBoris BREZILLON * 9b1479ebbSBoris BREZILLON * Author: Boris BREZILLON <boris.brezillon@free-electrons.com> 10b1479ebbSBoris BREZILLON * 11b1479ebbSBoris BREZILLON * This file is licensed under the terms of the GNU General Public 12b1479ebbSBoris BREZILLON * License version 2. This program is licensed "as is" without any 13b1479ebbSBoris BREZILLON * warranty of any kind, whether express or implied. 14b1479ebbSBoris BREZILLON */ 15b1479ebbSBoris BREZILLON 16b1479ebbSBoris BREZILLON #include <linux/init.h> 17b1479ebbSBoris BREZILLON #include <linux/module.h> 18b1479ebbSBoris BREZILLON #include <linux/mm.h> 19b1479ebbSBoris BREZILLON #include <linux/bitmap.h> 20b1479ebbSBoris BREZILLON #include <linux/types.h> 21b1479ebbSBoris BREZILLON #include <linux/irq.h> 22b1479ebbSBoris BREZILLON #include <linux/of.h> 23b1479ebbSBoris BREZILLON #include <linux/of_address.h> 24b1479ebbSBoris BREZILLON #include <linux/of_irq.h> 25b1479ebbSBoris BREZILLON #include <linux/irqdomain.h> 26b1479ebbSBoris BREZILLON #include <linux/err.h> 27b1479ebbSBoris BREZILLON #include <linux/slab.h> 28b1479ebbSBoris BREZILLON #include <linux/io.h> 29b1479ebbSBoris BREZILLON 30b1479ebbSBoris BREZILLON #include <asm/exception.h> 31b1479ebbSBoris BREZILLON #include <asm/mach/irq.h> 32b1479ebbSBoris BREZILLON 33b1479ebbSBoris BREZILLON #include "irq-atmel-aic-common.h" 34b1479ebbSBoris BREZILLON #include "irqchip.h" 35b1479ebbSBoris BREZILLON 36b1479ebbSBoris BREZILLON /* Number of irq lines managed by AIC */ 37b1479ebbSBoris BREZILLON #define NR_AIC5_IRQS 128 38b1479ebbSBoris BREZILLON 39b1479ebbSBoris BREZILLON #define AT91_AIC5_SSR 0x0 40b1479ebbSBoris BREZILLON #define AT91_AIC5_INTSEL_MSK (0x7f << 0) 41b1479ebbSBoris BREZILLON 42b1479ebbSBoris BREZILLON #define AT91_AIC5_SMR 0x4 43b1479ebbSBoris BREZILLON 44b1479ebbSBoris BREZILLON #define AT91_AIC5_SVR 0x8 45b1479ebbSBoris BREZILLON #define AT91_AIC5_IVR 0x10 46b1479ebbSBoris BREZILLON #define AT91_AIC5_FVR 0x14 47b1479ebbSBoris BREZILLON #define AT91_AIC5_ISR 0x18 48b1479ebbSBoris BREZILLON 49b1479ebbSBoris BREZILLON #define AT91_AIC5_IPR0 0x20 50b1479ebbSBoris BREZILLON #define AT91_AIC5_IPR1 0x24 51b1479ebbSBoris BREZILLON #define AT91_AIC5_IPR2 0x28 52b1479ebbSBoris BREZILLON #define AT91_AIC5_IPR3 0x2c 53b1479ebbSBoris BREZILLON #define AT91_AIC5_IMR 0x30 54b1479ebbSBoris BREZILLON #define AT91_AIC5_CISR 0x34 55b1479ebbSBoris BREZILLON 56b1479ebbSBoris BREZILLON #define AT91_AIC5_IECR 0x40 57b1479ebbSBoris BREZILLON #define AT91_AIC5_IDCR 0x44 58b1479ebbSBoris BREZILLON #define AT91_AIC5_ICCR 0x48 59b1479ebbSBoris BREZILLON #define AT91_AIC5_ISCR 0x4c 60b1479ebbSBoris BREZILLON #define AT91_AIC5_EOICR 0x38 61b1479ebbSBoris BREZILLON #define AT91_AIC5_SPU 0x3c 62b1479ebbSBoris BREZILLON #define AT91_AIC5_DCR 0x6c 63b1479ebbSBoris BREZILLON 64b1479ebbSBoris BREZILLON #define AT91_AIC5_FFER 0x50 65b1479ebbSBoris BREZILLON #define AT91_AIC5_FFDR 0x54 66b1479ebbSBoris BREZILLON #define AT91_AIC5_FFSR 0x58 67b1479ebbSBoris BREZILLON 68b1479ebbSBoris BREZILLON static struct irq_domain *aic5_domain; 69b1479ebbSBoris BREZILLON 70b1479ebbSBoris BREZILLON static asmlinkage void __exception_irq_entry 71b1479ebbSBoris BREZILLON aic5_handle(struct pt_regs *regs) 72b1479ebbSBoris BREZILLON { 73b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = aic5_domain->gc; 74b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = dgc->gc[0]; 75b1479ebbSBoris BREZILLON u32 irqnr; 76b1479ebbSBoris BREZILLON u32 irqstat; 77b1479ebbSBoris BREZILLON 78b1479ebbSBoris BREZILLON irqnr = irq_reg_readl(gc->reg_base + AT91_AIC5_IVR); 79b1479ebbSBoris BREZILLON irqstat = irq_reg_readl(gc->reg_base + AT91_AIC5_ISR); 80b1479ebbSBoris BREZILLON 81b1479ebbSBoris BREZILLON irqnr = irq_find_mapping(aic5_domain, irqnr); 82b1479ebbSBoris BREZILLON 83b1479ebbSBoris BREZILLON if (!irqstat) 84b1479ebbSBoris BREZILLON irq_reg_writel(0, gc->reg_base + AT91_AIC5_EOICR); 85b1479ebbSBoris BREZILLON else 86b1479ebbSBoris BREZILLON handle_IRQ(irqnr, regs); 87b1479ebbSBoris BREZILLON } 88b1479ebbSBoris BREZILLON 89b1479ebbSBoris BREZILLON static void aic5_mask(struct irq_data *d) 90b1479ebbSBoris BREZILLON { 91b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 92b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = domain->gc; 93b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = dgc->gc[0]; 94b1479ebbSBoris BREZILLON 95b1479ebbSBoris BREZILLON /* Disable interrupt on AIC5 */ 96b1479ebbSBoris BREZILLON irq_gc_lock(gc); 97b1479ebbSBoris BREZILLON irq_reg_writel(d->hwirq, gc->reg_base + AT91_AIC5_SSR); 98b1479ebbSBoris BREZILLON irq_reg_writel(1, gc->reg_base + AT91_AIC5_IDCR); 99b1479ebbSBoris BREZILLON gc->mask_cache &= ~d->mask; 100b1479ebbSBoris BREZILLON irq_gc_unlock(gc); 101b1479ebbSBoris BREZILLON } 102b1479ebbSBoris BREZILLON 103b1479ebbSBoris BREZILLON static void aic5_unmask(struct irq_data *d) 104b1479ebbSBoris BREZILLON { 105b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 106b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = domain->gc; 107b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = dgc->gc[0]; 108b1479ebbSBoris BREZILLON 109b1479ebbSBoris BREZILLON /* Enable interrupt on AIC5 */ 110b1479ebbSBoris BREZILLON irq_gc_lock(gc); 111b1479ebbSBoris BREZILLON irq_reg_writel(d->hwirq, gc->reg_base + AT91_AIC5_SSR); 112b1479ebbSBoris BREZILLON irq_reg_writel(1, gc->reg_base + AT91_AIC5_IECR); 113b1479ebbSBoris BREZILLON gc->mask_cache |= d->mask; 114b1479ebbSBoris BREZILLON irq_gc_unlock(gc); 115b1479ebbSBoris BREZILLON } 116b1479ebbSBoris BREZILLON 117b1479ebbSBoris BREZILLON static int aic5_retrigger(struct irq_data *d) 118b1479ebbSBoris BREZILLON { 119b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 120b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = domain->gc; 121b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = dgc->gc[0]; 122b1479ebbSBoris BREZILLON 123b1479ebbSBoris BREZILLON /* Enable interrupt on AIC5 */ 124b1479ebbSBoris BREZILLON irq_gc_lock(gc); 125b1479ebbSBoris BREZILLON irq_reg_writel(d->hwirq, gc->reg_base + AT91_AIC5_SSR); 126b1479ebbSBoris BREZILLON irq_reg_writel(1, gc->reg_base + AT91_AIC5_ISCR); 127b1479ebbSBoris BREZILLON irq_gc_unlock(gc); 128b1479ebbSBoris BREZILLON 129b1479ebbSBoris BREZILLON return 0; 130b1479ebbSBoris BREZILLON } 131b1479ebbSBoris BREZILLON 132b1479ebbSBoris BREZILLON static int aic5_set_type(struct irq_data *d, unsigned type) 133b1479ebbSBoris BREZILLON { 134b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 135b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = domain->gc; 136b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = dgc->gc[0]; 137b1479ebbSBoris BREZILLON unsigned int smr; 138b1479ebbSBoris BREZILLON int ret; 139b1479ebbSBoris BREZILLON 140b1479ebbSBoris BREZILLON irq_gc_lock(gc); 141b1479ebbSBoris BREZILLON irq_reg_writel(d->hwirq, gc->reg_base + AT91_AIC5_SSR); 142b1479ebbSBoris BREZILLON smr = irq_reg_readl(gc->reg_base + AT91_AIC5_SMR); 143b1479ebbSBoris BREZILLON ret = aic_common_set_type(d, type, &smr); 144b1479ebbSBoris BREZILLON if (!ret) 145b1479ebbSBoris BREZILLON irq_reg_writel(smr, gc->reg_base + AT91_AIC5_SMR); 146b1479ebbSBoris BREZILLON irq_gc_unlock(gc); 147b1479ebbSBoris BREZILLON 148b1479ebbSBoris BREZILLON return ret; 149b1479ebbSBoris BREZILLON } 150b1479ebbSBoris BREZILLON 151b1479ebbSBoris BREZILLON #ifdef CONFIG_PM 152b1479ebbSBoris BREZILLON static void aic5_suspend(struct irq_data *d) 153b1479ebbSBoris BREZILLON { 154b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 155b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = domain->gc; 156b1479ebbSBoris BREZILLON struct irq_chip_generic *bgc = dgc->gc[0]; 157b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 158b1479ebbSBoris BREZILLON int i; 159b1479ebbSBoris BREZILLON u32 mask; 160b1479ebbSBoris BREZILLON 161b1479ebbSBoris BREZILLON irq_gc_lock(bgc); 162b1479ebbSBoris BREZILLON for (i = 0; i < dgc->irqs_per_chip; i++) { 163b1479ebbSBoris BREZILLON mask = 1 << i; 164b1479ebbSBoris BREZILLON if ((mask & gc->mask_cache) == (mask & gc->wake_active)) 165b1479ebbSBoris BREZILLON continue; 166b1479ebbSBoris BREZILLON 167b1479ebbSBoris BREZILLON irq_reg_writel(i + gc->irq_base, 168b1479ebbSBoris BREZILLON bgc->reg_base + AT91_AIC5_SSR); 169b1479ebbSBoris BREZILLON if (mask & gc->wake_active) 170b1479ebbSBoris BREZILLON irq_reg_writel(1, bgc->reg_base + AT91_AIC5_IECR); 171b1479ebbSBoris BREZILLON else 172b1479ebbSBoris BREZILLON irq_reg_writel(1, bgc->reg_base + AT91_AIC5_IDCR); 173b1479ebbSBoris BREZILLON } 174b1479ebbSBoris BREZILLON irq_gc_unlock(bgc); 175b1479ebbSBoris BREZILLON } 176b1479ebbSBoris BREZILLON 177b1479ebbSBoris BREZILLON static void aic5_resume(struct irq_data *d) 178b1479ebbSBoris BREZILLON { 179b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 180b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = domain->gc; 181b1479ebbSBoris BREZILLON struct irq_chip_generic *bgc = dgc->gc[0]; 182b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 183b1479ebbSBoris BREZILLON int i; 184b1479ebbSBoris BREZILLON u32 mask; 185b1479ebbSBoris BREZILLON 186b1479ebbSBoris BREZILLON irq_gc_lock(bgc); 187b1479ebbSBoris BREZILLON for (i = 0; i < dgc->irqs_per_chip; i++) { 188b1479ebbSBoris BREZILLON mask = 1 << i; 189b1479ebbSBoris BREZILLON if ((mask & gc->mask_cache) == (mask & gc->wake_active)) 190b1479ebbSBoris BREZILLON continue; 191b1479ebbSBoris BREZILLON 192b1479ebbSBoris BREZILLON irq_reg_writel(i + gc->irq_base, 193b1479ebbSBoris BREZILLON bgc->reg_base + AT91_AIC5_SSR); 194b1479ebbSBoris BREZILLON if (mask & gc->mask_cache) 195b1479ebbSBoris BREZILLON irq_reg_writel(1, bgc->reg_base + AT91_AIC5_IECR); 196b1479ebbSBoris BREZILLON else 197b1479ebbSBoris BREZILLON irq_reg_writel(1, bgc->reg_base + AT91_AIC5_IDCR); 198b1479ebbSBoris BREZILLON } 199b1479ebbSBoris BREZILLON irq_gc_unlock(bgc); 200b1479ebbSBoris BREZILLON } 201b1479ebbSBoris BREZILLON 202b1479ebbSBoris BREZILLON static void aic5_pm_shutdown(struct irq_data *d) 203b1479ebbSBoris BREZILLON { 204b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 205b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = domain->gc; 206b1479ebbSBoris BREZILLON struct irq_chip_generic *bgc = dgc->gc[0]; 207b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 208b1479ebbSBoris BREZILLON int i; 209b1479ebbSBoris BREZILLON 210b1479ebbSBoris BREZILLON irq_gc_lock(bgc); 211b1479ebbSBoris BREZILLON for (i = 0; i < dgc->irqs_per_chip; i++) { 212b1479ebbSBoris BREZILLON irq_reg_writel(i + gc->irq_base, 213b1479ebbSBoris BREZILLON bgc->reg_base + AT91_AIC5_SSR); 214b1479ebbSBoris BREZILLON irq_reg_writel(1, bgc->reg_base + AT91_AIC5_IDCR); 215b1479ebbSBoris BREZILLON irq_reg_writel(1, bgc->reg_base + AT91_AIC5_ICCR); 216b1479ebbSBoris BREZILLON } 217b1479ebbSBoris BREZILLON irq_gc_unlock(bgc); 218b1479ebbSBoris BREZILLON } 219b1479ebbSBoris BREZILLON #else 220b1479ebbSBoris BREZILLON #define aic5_suspend NULL 221b1479ebbSBoris BREZILLON #define aic5_resume NULL 222b1479ebbSBoris BREZILLON #define aic5_pm_shutdown NULL 223b1479ebbSBoris BREZILLON #endif /* CONFIG_PM */ 224b1479ebbSBoris BREZILLON 225b1479ebbSBoris BREZILLON static void __init aic5_hw_init(struct irq_domain *domain) 226b1479ebbSBoris BREZILLON { 227b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = irq_get_domain_generic_chip(domain, 0); 228b1479ebbSBoris BREZILLON int i; 229b1479ebbSBoris BREZILLON 230b1479ebbSBoris BREZILLON /* 231b1479ebbSBoris BREZILLON * Perform 8 End Of Interrupt Command to make sure AIC 232b1479ebbSBoris BREZILLON * will not Lock out nIRQ 233b1479ebbSBoris BREZILLON */ 234b1479ebbSBoris BREZILLON for (i = 0; i < 8; i++) 235b1479ebbSBoris BREZILLON irq_reg_writel(0, gc->reg_base + AT91_AIC5_EOICR); 236b1479ebbSBoris BREZILLON 237b1479ebbSBoris BREZILLON /* 238b1479ebbSBoris BREZILLON * Spurious Interrupt ID in Spurious Vector Register. 239b1479ebbSBoris BREZILLON * When there is no current interrupt, the IRQ Vector Register 240b1479ebbSBoris BREZILLON * reads the value stored in AIC_SPU 241b1479ebbSBoris BREZILLON */ 242b1479ebbSBoris BREZILLON irq_reg_writel(0xffffffff, gc->reg_base + AT91_AIC5_SPU); 243b1479ebbSBoris BREZILLON 244b1479ebbSBoris BREZILLON /* No debugging in AIC: Debug (Protect) Control Register */ 245b1479ebbSBoris BREZILLON irq_reg_writel(0, gc->reg_base + AT91_AIC5_DCR); 246b1479ebbSBoris BREZILLON 247b1479ebbSBoris BREZILLON /* Disable and clear all interrupts initially */ 248b1479ebbSBoris BREZILLON for (i = 0; i < domain->revmap_size; i++) { 249b1479ebbSBoris BREZILLON irq_reg_writel(i, gc->reg_base + AT91_AIC5_SSR); 250b1479ebbSBoris BREZILLON irq_reg_writel(i, gc->reg_base + AT91_AIC5_SVR); 251b1479ebbSBoris BREZILLON irq_reg_writel(1, gc->reg_base + AT91_AIC5_IDCR); 252b1479ebbSBoris BREZILLON irq_reg_writel(1, gc->reg_base + AT91_AIC5_ICCR); 253b1479ebbSBoris BREZILLON } 254b1479ebbSBoris BREZILLON } 255b1479ebbSBoris BREZILLON 256b1479ebbSBoris BREZILLON static int aic5_irq_domain_xlate(struct irq_domain *d, 257b1479ebbSBoris BREZILLON struct device_node *ctrlr, 258b1479ebbSBoris BREZILLON const u32 *intspec, unsigned int intsize, 259b1479ebbSBoris BREZILLON irq_hw_number_t *out_hwirq, 260b1479ebbSBoris BREZILLON unsigned int *out_type) 261b1479ebbSBoris BREZILLON { 262b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = d->gc; 263b1479ebbSBoris BREZILLON struct irq_chip_generic *gc; 264b1479ebbSBoris BREZILLON unsigned smr; 265b1479ebbSBoris BREZILLON int ret; 266b1479ebbSBoris BREZILLON 267b1479ebbSBoris BREZILLON if (!dgc) 268b1479ebbSBoris BREZILLON return -EINVAL; 269b1479ebbSBoris BREZILLON 270b1479ebbSBoris BREZILLON ret = aic_common_irq_domain_xlate(d, ctrlr, intspec, intsize, 271b1479ebbSBoris BREZILLON out_hwirq, out_type); 272b1479ebbSBoris BREZILLON if (ret) 273b1479ebbSBoris BREZILLON return ret; 274b1479ebbSBoris BREZILLON 275b1479ebbSBoris BREZILLON gc = dgc->gc[0]; 276b1479ebbSBoris BREZILLON 277b1479ebbSBoris BREZILLON irq_gc_lock(gc); 278b1479ebbSBoris BREZILLON irq_reg_writel(*out_hwirq, gc->reg_base + AT91_AIC5_SSR); 279b1479ebbSBoris BREZILLON smr = irq_reg_readl(gc->reg_base + AT91_AIC5_SMR); 280b1479ebbSBoris BREZILLON ret = aic_common_set_priority(intspec[2], &smr); 281b1479ebbSBoris BREZILLON if (!ret) 282b1479ebbSBoris BREZILLON irq_reg_writel(intspec[2] | smr, gc->reg_base + AT91_AIC5_SMR); 283b1479ebbSBoris BREZILLON irq_gc_unlock(gc); 284b1479ebbSBoris BREZILLON 285b1479ebbSBoris BREZILLON return ret; 286b1479ebbSBoris BREZILLON } 287b1479ebbSBoris BREZILLON 288b1479ebbSBoris BREZILLON static const struct irq_domain_ops aic5_irq_ops = { 289b1479ebbSBoris BREZILLON .map = irq_map_generic_chip, 290b1479ebbSBoris BREZILLON .xlate = aic5_irq_domain_xlate, 291b1479ebbSBoris BREZILLON }; 292b1479ebbSBoris BREZILLON 2936704d12dSBoris BREZILLON static void __init sama5d3_aic_irq_fixup(struct device_node *root) 2946704d12dSBoris BREZILLON { 2956704d12dSBoris BREZILLON aic_common_rtc_irq_fixup(root); 2966704d12dSBoris BREZILLON } 2976704d12dSBoris BREZILLON 2986704d12dSBoris BREZILLON static const struct of_device_id __initdata aic5_irq_fixups[] = { 2996704d12dSBoris BREZILLON { .compatible = "atmel,sama5d3", .data = sama5d3_aic_irq_fixup }, 300*20afdeb8SAlexandre Belloni { .compatible = "atmel,sama5d4", .data = sama5d3_aic_irq_fixup }, 3016704d12dSBoris BREZILLON { /* sentinel */ }, 3026704d12dSBoris BREZILLON }; 3036704d12dSBoris BREZILLON 304b1479ebbSBoris BREZILLON static int __init aic5_of_init(struct device_node *node, 305b1479ebbSBoris BREZILLON struct device_node *parent, 306b1479ebbSBoris BREZILLON int nirqs) 307b1479ebbSBoris BREZILLON { 308b1479ebbSBoris BREZILLON struct irq_chip_generic *gc; 309b1479ebbSBoris BREZILLON struct irq_domain *domain; 310b1479ebbSBoris BREZILLON int nchips; 311b1479ebbSBoris BREZILLON int i; 312b1479ebbSBoris BREZILLON 313b1479ebbSBoris BREZILLON if (nirqs > NR_AIC5_IRQS) 314b1479ebbSBoris BREZILLON return -EINVAL; 315b1479ebbSBoris BREZILLON 316b1479ebbSBoris BREZILLON if (aic5_domain) 317b1479ebbSBoris BREZILLON return -EEXIST; 318b1479ebbSBoris BREZILLON 319b1479ebbSBoris BREZILLON domain = aic_common_of_init(node, &aic5_irq_ops, "atmel-aic5", 320b1479ebbSBoris BREZILLON nirqs); 321b1479ebbSBoris BREZILLON if (IS_ERR(domain)) 322b1479ebbSBoris BREZILLON return PTR_ERR(domain); 323b1479ebbSBoris BREZILLON 3246704d12dSBoris BREZILLON aic_common_irq_fixup(aic5_irq_fixups); 3256704d12dSBoris BREZILLON 326b1479ebbSBoris BREZILLON aic5_domain = domain; 327b1479ebbSBoris BREZILLON nchips = aic5_domain->revmap_size / 32; 328b1479ebbSBoris BREZILLON for (i = 0; i < nchips; i++) { 329b1479ebbSBoris BREZILLON gc = irq_get_domain_generic_chip(domain, i * 32); 330b1479ebbSBoris BREZILLON 331b1479ebbSBoris BREZILLON gc->chip_types[0].regs.eoi = AT91_AIC5_EOICR; 332b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_mask = aic5_mask; 333b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_unmask = aic5_unmask; 334b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_retrigger = aic5_retrigger; 335b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_set_type = aic5_set_type; 336b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_suspend = aic5_suspend; 337b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_resume = aic5_resume; 338b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_pm_shutdown = aic5_pm_shutdown; 339b1479ebbSBoris BREZILLON } 340b1479ebbSBoris BREZILLON 341b1479ebbSBoris BREZILLON aic5_hw_init(domain); 342b1479ebbSBoris BREZILLON set_handle_irq(aic5_handle); 343b1479ebbSBoris BREZILLON 344b1479ebbSBoris BREZILLON return 0; 345b1479ebbSBoris BREZILLON } 346b1479ebbSBoris BREZILLON 3470cae165fSAlexandre Belloni #define NR_SAMA5D3_IRQS 48 348b1479ebbSBoris BREZILLON 349b1479ebbSBoris BREZILLON static int __init sama5d3_aic5_of_init(struct device_node *node, 350b1479ebbSBoris BREZILLON struct device_node *parent) 351b1479ebbSBoris BREZILLON { 352b1479ebbSBoris BREZILLON return aic5_of_init(node, parent, NR_SAMA5D3_IRQS); 353b1479ebbSBoris BREZILLON } 354b1479ebbSBoris BREZILLON IRQCHIP_DECLARE(sama5d3_aic5, "atmel,sama5d3-aic", sama5d3_aic5_of_init); 355*20afdeb8SAlexandre Belloni 356*20afdeb8SAlexandre Belloni #define NR_SAMA5D4_IRQS 68 357*20afdeb8SAlexandre Belloni 358*20afdeb8SAlexandre Belloni static int __init sama5d4_aic5_of_init(struct device_node *node, 359*20afdeb8SAlexandre Belloni struct device_node *parent) 360*20afdeb8SAlexandre Belloni { 361*20afdeb8SAlexandre Belloni return aic5_of_init(node, parent, NR_SAMA5D4_IRQS); 362*20afdeb8SAlexandre Belloni } 363*20afdeb8SAlexandre Belloni IRQCHIP_DECLARE(sama5d4_aic5, "atmel,sama5d4-aic", sama5d4_aic5_of_init); 364