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> 2241a83e06SJoel Porquet #include <linux/irqchip.h> 23b1479ebbSBoris BREZILLON #include <linux/of.h> 24b1479ebbSBoris BREZILLON #include <linux/of_address.h> 25b1479ebbSBoris BREZILLON #include <linux/of_irq.h> 26b1479ebbSBoris BREZILLON #include <linux/irqdomain.h> 27b1479ebbSBoris BREZILLON #include <linux/err.h> 28b1479ebbSBoris BREZILLON #include <linux/slab.h> 29b1479ebbSBoris BREZILLON #include <linux/io.h> 30b1479ebbSBoris BREZILLON 31b1479ebbSBoris BREZILLON #include <asm/exception.h> 32b1479ebbSBoris BREZILLON #include <asm/mach/irq.h> 33b1479ebbSBoris BREZILLON 34b1479ebbSBoris BREZILLON #include "irq-atmel-aic-common.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 { 73b55a3bb8SLudovic Desroches struct irq_chip_generic *bgc = irq_get_domain_generic_chip(aic5_domain, 0); 74b1479ebbSBoris BREZILLON u32 irqnr; 75b1479ebbSBoris BREZILLON u32 irqstat; 76b1479ebbSBoris BREZILLON 77414a431aSLudovic Desroches irqnr = irq_reg_readl(bgc, AT91_AIC5_IVR); 78414a431aSLudovic Desroches irqstat = irq_reg_readl(bgc, AT91_AIC5_ISR); 79b1479ebbSBoris BREZILLON 80b1479ebbSBoris BREZILLON if (!irqstat) 81414a431aSLudovic Desroches irq_reg_writel(bgc, 0, AT91_AIC5_EOICR); 82b1479ebbSBoris BREZILLON else 8331b7b6a8SMarc Zyngier handle_domain_irq(aic5_domain, irqnr, regs); 84b1479ebbSBoris BREZILLON } 85b1479ebbSBoris BREZILLON 86b1479ebbSBoris BREZILLON static void aic5_mask(struct irq_data *d) 87b1479ebbSBoris BREZILLON { 88b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 89b55a3bb8SLudovic Desroches struct irq_chip_generic *bgc = irq_get_domain_generic_chip(domain, 0); 90d32dc9aaSLudovic Desroches struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 91b1479ebbSBoris BREZILLON 92d32dc9aaSLudovic Desroches /* 93d32dc9aaSLudovic Desroches * Disable interrupt on AIC5. We always take the lock of the 94d32dc9aaSLudovic Desroches * first irq chip as all chips share the same registers. 95d32dc9aaSLudovic Desroches */ 96d32dc9aaSLudovic Desroches irq_gc_lock(bgc); 97332fd7c4SKevin Cernekee irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR); 98332fd7c4SKevin Cernekee irq_reg_writel(gc, 1, AT91_AIC5_IDCR); 99b1479ebbSBoris BREZILLON gc->mask_cache &= ~d->mask; 100d32dc9aaSLudovic Desroches irq_gc_unlock(bgc); 101b1479ebbSBoris BREZILLON } 102b1479ebbSBoris BREZILLON 103b1479ebbSBoris BREZILLON static void aic5_unmask(struct irq_data *d) 104b1479ebbSBoris BREZILLON { 105b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 106b55a3bb8SLudovic Desroches struct irq_chip_generic *bgc = irq_get_domain_generic_chip(domain, 0); 107d32dc9aaSLudovic Desroches struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 108b1479ebbSBoris BREZILLON 109d32dc9aaSLudovic Desroches /* 110d32dc9aaSLudovic Desroches * Enable interrupt on AIC5. We always take the lock of the 111d32dc9aaSLudovic Desroches * first irq chip as all chips share the same registers. 112d32dc9aaSLudovic Desroches */ 113d32dc9aaSLudovic Desroches irq_gc_lock(bgc); 114332fd7c4SKevin Cernekee irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR); 115332fd7c4SKevin Cernekee irq_reg_writel(gc, 1, AT91_AIC5_IECR); 116b1479ebbSBoris BREZILLON gc->mask_cache |= d->mask; 117d32dc9aaSLudovic Desroches irq_gc_unlock(bgc); 118b1479ebbSBoris BREZILLON } 119b1479ebbSBoris BREZILLON 120b1479ebbSBoris BREZILLON static int aic5_retrigger(struct irq_data *d) 121b1479ebbSBoris BREZILLON { 122b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 123b55a3bb8SLudovic Desroches struct irq_chip_generic *bgc = irq_get_domain_generic_chip(domain, 0); 124b1479ebbSBoris BREZILLON 125b1479ebbSBoris BREZILLON /* Enable interrupt on AIC5 */ 126414a431aSLudovic Desroches irq_gc_lock(bgc); 127414a431aSLudovic Desroches irq_reg_writel(bgc, d->hwirq, AT91_AIC5_SSR); 128414a431aSLudovic Desroches irq_reg_writel(bgc, 1, AT91_AIC5_ISCR); 129414a431aSLudovic Desroches irq_gc_unlock(bgc); 130b1479ebbSBoris BREZILLON 131b1479ebbSBoris BREZILLON return 0; 132b1479ebbSBoris BREZILLON } 133b1479ebbSBoris BREZILLON 134b1479ebbSBoris BREZILLON static int aic5_set_type(struct irq_data *d, unsigned type) 135b1479ebbSBoris BREZILLON { 136b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 137b55a3bb8SLudovic Desroches struct irq_chip_generic *bgc = irq_get_domain_generic_chip(domain, 0); 138b1479ebbSBoris BREZILLON unsigned int smr; 139b1479ebbSBoris BREZILLON int ret; 140b1479ebbSBoris BREZILLON 141414a431aSLudovic Desroches irq_gc_lock(bgc); 142414a431aSLudovic Desroches irq_reg_writel(bgc, d->hwirq, AT91_AIC5_SSR); 143414a431aSLudovic Desroches smr = irq_reg_readl(bgc, AT91_AIC5_SMR); 144b1479ebbSBoris BREZILLON ret = aic_common_set_type(d, type, &smr); 145b1479ebbSBoris BREZILLON if (!ret) 146414a431aSLudovic Desroches irq_reg_writel(bgc, smr, AT91_AIC5_SMR); 147414a431aSLudovic Desroches irq_gc_unlock(bgc); 148b1479ebbSBoris BREZILLON 149b1479ebbSBoris BREZILLON return ret; 150b1479ebbSBoris BREZILLON } 151b1479ebbSBoris BREZILLON 152b1479ebbSBoris BREZILLON #ifdef CONFIG_PM 153b1479ebbSBoris BREZILLON static void aic5_suspend(struct irq_data *d) 154b1479ebbSBoris BREZILLON { 155b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 156b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = domain->gc; 157b55a3bb8SLudovic Desroches struct irq_chip_generic *bgc = irq_get_domain_generic_chip(domain, 0); 158b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 159b1479ebbSBoris BREZILLON int i; 160b1479ebbSBoris BREZILLON u32 mask; 161b1479ebbSBoris BREZILLON 162b1479ebbSBoris BREZILLON irq_gc_lock(bgc); 163b1479ebbSBoris BREZILLON for (i = 0; i < dgc->irqs_per_chip; i++) { 164b1479ebbSBoris BREZILLON mask = 1 << i; 165b1479ebbSBoris BREZILLON if ((mask & gc->mask_cache) == (mask & gc->wake_active)) 166b1479ebbSBoris BREZILLON continue; 167b1479ebbSBoris BREZILLON 168332fd7c4SKevin Cernekee irq_reg_writel(bgc, i + gc->irq_base, AT91_AIC5_SSR); 169b1479ebbSBoris BREZILLON if (mask & gc->wake_active) 170332fd7c4SKevin Cernekee irq_reg_writel(bgc, 1, AT91_AIC5_IECR); 171b1479ebbSBoris BREZILLON else 172332fd7c4SKevin Cernekee irq_reg_writel(bgc, 1, 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; 181b55a3bb8SLudovic Desroches struct irq_chip_generic *bgc = irq_get_domain_generic_chip(domain, 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 192332fd7c4SKevin Cernekee irq_reg_writel(bgc, i + gc->irq_base, AT91_AIC5_SSR); 193b1479ebbSBoris BREZILLON if (mask & gc->mask_cache) 194332fd7c4SKevin Cernekee irq_reg_writel(bgc, 1, AT91_AIC5_IECR); 195b1479ebbSBoris BREZILLON else 196332fd7c4SKevin Cernekee irq_reg_writel(bgc, 1, AT91_AIC5_IDCR); 197b1479ebbSBoris BREZILLON } 198b1479ebbSBoris BREZILLON irq_gc_unlock(bgc); 199b1479ebbSBoris BREZILLON } 200b1479ebbSBoris BREZILLON 201b1479ebbSBoris BREZILLON static void aic5_pm_shutdown(struct irq_data *d) 202b1479ebbSBoris BREZILLON { 203b1479ebbSBoris BREZILLON struct irq_domain *domain = d->domain; 204b1479ebbSBoris BREZILLON struct irq_domain_chip_generic *dgc = domain->gc; 205b55a3bb8SLudovic Desroches struct irq_chip_generic *bgc = irq_get_domain_generic_chip(domain, 0); 206b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 207b1479ebbSBoris BREZILLON int i; 208b1479ebbSBoris BREZILLON 209b1479ebbSBoris BREZILLON irq_gc_lock(bgc); 210b1479ebbSBoris BREZILLON for (i = 0; i < dgc->irqs_per_chip; i++) { 211332fd7c4SKevin Cernekee irq_reg_writel(bgc, i + gc->irq_base, AT91_AIC5_SSR); 212332fd7c4SKevin Cernekee irq_reg_writel(bgc, 1, AT91_AIC5_IDCR); 213332fd7c4SKevin Cernekee irq_reg_writel(bgc, 1, AT91_AIC5_ICCR); 214b1479ebbSBoris BREZILLON } 215b1479ebbSBoris BREZILLON irq_gc_unlock(bgc); 216b1479ebbSBoris BREZILLON } 217b1479ebbSBoris BREZILLON #else 218b1479ebbSBoris BREZILLON #define aic5_suspend NULL 219b1479ebbSBoris BREZILLON #define aic5_resume NULL 220b1479ebbSBoris BREZILLON #define aic5_pm_shutdown NULL 221b1479ebbSBoris BREZILLON #endif /* CONFIG_PM */ 222b1479ebbSBoris BREZILLON 223b1479ebbSBoris BREZILLON static void __init aic5_hw_init(struct irq_domain *domain) 224b1479ebbSBoris BREZILLON { 225b1479ebbSBoris BREZILLON struct irq_chip_generic *gc = irq_get_domain_generic_chip(domain, 0); 226b1479ebbSBoris BREZILLON int i; 227b1479ebbSBoris BREZILLON 228b1479ebbSBoris BREZILLON /* 229b1479ebbSBoris BREZILLON * Perform 8 End Of Interrupt Command to make sure AIC 230b1479ebbSBoris BREZILLON * will not Lock out nIRQ 231b1479ebbSBoris BREZILLON */ 232b1479ebbSBoris BREZILLON for (i = 0; i < 8; i++) 233332fd7c4SKevin Cernekee irq_reg_writel(gc, 0, AT91_AIC5_EOICR); 234b1479ebbSBoris BREZILLON 235b1479ebbSBoris BREZILLON /* 236b1479ebbSBoris BREZILLON * Spurious Interrupt ID in Spurious Vector Register. 237b1479ebbSBoris BREZILLON * When there is no current interrupt, the IRQ Vector Register 238b1479ebbSBoris BREZILLON * reads the value stored in AIC_SPU 239b1479ebbSBoris BREZILLON */ 240332fd7c4SKevin Cernekee irq_reg_writel(gc, 0xffffffff, AT91_AIC5_SPU); 241b1479ebbSBoris BREZILLON 242b1479ebbSBoris BREZILLON /* No debugging in AIC: Debug (Protect) Control Register */ 243332fd7c4SKevin Cernekee irq_reg_writel(gc, 0, AT91_AIC5_DCR); 244b1479ebbSBoris BREZILLON 245b1479ebbSBoris BREZILLON /* Disable and clear all interrupts initially */ 246b1479ebbSBoris BREZILLON for (i = 0; i < domain->revmap_size; i++) { 247332fd7c4SKevin Cernekee irq_reg_writel(gc, i, AT91_AIC5_SSR); 248332fd7c4SKevin Cernekee irq_reg_writel(gc, i, AT91_AIC5_SVR); 249332fd7c4SKevin Cernekee irq_reg_writel(gc, 1, AT91_AIC5_IDCR); 250332fd7c4SKevin Cernekee irq_reg_writel(gc, 1, AT91_AIC5_ICCR); 251b1479ebbSBoris BREZILLON } 252b1479ebbSBoris BREZILLON } 253b1479ebbSBoris BREZILLON 254b1479ebbSBoris BREZILLON static int aic5_irq_domain_xlate(struct irq_domain *d, 255b1479ebbSBoris BREZILLON struct device_node *ctrlr, 256b1479ebbSBoris BREZILLON const u32 *intspec, unsigned int intsize, 257b1479ebbSBoris BREZILLON irq_hw_number_t *out_hwirq, 258b1479ebbSBoris BREZILLON unsigned int *out_type) 259b1479ebbSBoris BREZILLON { 260b55a3bb8SLudovic Desroches struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0); 261b1479ebbSBoris BREZILLON unsigned smr; 262b1479ebbSBoris BREZILLON int ret; 263b1479ebbSBoris BREZILLON 264b55a3bb8SLudovic Desroches if (!bgc) 265b1479ebbSBoris BREZILLON return -EINVAL; 266b1479ebbSBoris BREZILLON 267b1479ebbSBoris BREZILLON ret = aic_common_irq_domain_xlate(d, ctrlr, intspec, intsize, 268b1479ebbSBoris BREZILLON out_hwirq, out_type); 269b1479ebbSBoris BREZILLON if (ret) 270b1479ebbSBoris BREZILLON return ret; 271b1479ebbSBoris BREZILLON 272414a431aSLudovic Desroches irq_gc_lock(bgc); 273414a431aSLudovic Desroches irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR); 274414a431aSLudovic Desroches smr = irq_reg_readl(bgc, AT91_AIC5_SMR); 275*5fd26a0bSMilo Kim aic_common_set_priority(intspec[2], &smr); 276414a431aSLudovic Desroches irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR); 277414a431aSLudovic Desroches irq_gc_unlock(bgc); 278b1479ebbSBoris BREZILLON 279b1479ebbSBoris BREZILLON return ret; 280b1479ebbSBoris BREZILLON } 281b1479ebbSBoris BREZILLON 282b1479ebbSBoris BREZILLON static const struct irq_domain_ops aic5_irq_ops = { 283b1479ebbSBoris BREZILLON .map = irq_map_generic_chip, 284b1479ebbSBoris BREZILLON .xlate = aic5_irq_domain_xlate, 285b1479ebbSBoris BREZILLON }; 286b1479ebbSBoris BREZILLON 2876704d12dSBoris BREZILLON static void __init sama5d3_aic_irq_fixup(struct device_node *root) 2886704d12dSBoris BREZILLON { 2896704d12dSBoris BREZILLON aic_common_rtc_irq_fixup(root); 2906704d12dSBoris BREZILLON } 2916704d12dSBoris BREZILLON 292c376023bSNicolas Pitre static const struct of_device_id aic5_irq_fixups[] __initconst = { 2936704d12dSBoris BREZILLON { .compatible = "atmel,sama5d3", .data = sama5d3_aic_irq_fixup }, 29420afdeb8SAlexandre Belloni { .compatible = "atmel,sama5d4", .data = sama5d3_aic_irq_fixup }, 2956704d12dSBoris BREZILLON { /* sentinel */ }, 2966704d12dSBoris BREZILLON }; 2976704d12dSBoris BREZILLON 298b1479ebbSBoris BREZILLON static int __init aic5_of_init(struct device_node *node, 299b1479ebbSBoris BREZILLON struct device_node *parent, 300b1479ebbSBoris BREZILLON int nirqs) 301b1479ebbSBoris BREZILLON { 302b1479ebbSBoris BREZILLON struct irq_chip_generic *gc; 303b1479ebbSBoris BREZILLON struct irq_domain *domain; 304b1479ebbSBoris BREZILLON int nchips; 305b1479ebbSBoris BREZILLON int i; 306b1479ebbSBoris BREZILLON 307b1479ebbSBoris BREZILLON if (nirqs > NR_AIC5_IRQS) 308b1479ebbSBoris BREZILLON return -EINVAL; 309b1479ebbSBoris BREZILLON 310b1479ebbSBoris BREZILLON if (aic5_domain) 311b1479ebbSBoris BREZILLON return -EEXIST; 312b1479ebbSBoris BREZILLON 313b1479ebbSBoris BREZILLON domain = aic_common_of_init(node, &aic5_irq_ops, "atmel-aic5", 314dd85c791SMilo Kim nirqs, aic5_irq_fixups); 315b1479ebbSBoris BREZILLON if (IS_ERR(domain)) 316b1479ebbSBoris BREZILLON return PTR_ERR(domain); 317b1479ebbSBoris BREZILLON 318b1479ebbSBoris BREZILLON aic5_domain = domain; 319b1479ebbSBoris BREZILLON nchips = aic5_domain->revmap_size / 32; 320b1479ebbSBoris BREZILLON for (i = 0; i < nchips; i++) { 321b1479ebbSBoris BREZILLON gc = irq_get_domain_generic_chip(domain, i * 32); 322b1479ebbSBoris BREZILLON 323b1479ebbSBoris BREZILLON gc->chip_types[0].regs.eoi = AT91_AIC5_EOICR; 324b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_mask = aic5_mask; 325b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_unmask = aic5_unmask; 326b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_retrigger = aic5_retrigger; 327b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_set_type = aic5_set_type; 328b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_suspend = aic5_suspend; 329b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_resume = aic5_resume; 330b1479ebbSBoris BREZILLON gc->chip_types[0].chip.irq_pm_shutdown = aic5_pm_shutdown; 331b1479ebbSBoris BREZILLON } 332b1479ebbSBoris BREZILLON 333b1479ebbSBoris BREZILLON aic5_hw_init(domain); 334b1479ebbSBoris BREZILLON set_handle_irq(aic5_handle); 335b1479ebbSBoris BREZILLON 336b1479ebbSBoris BREZILLON return 0; 337b1479ebbSBoris BREZILLON } 338b1479ebbSBoris BREZILLON 33962a993dfSNicolas Ferre #define NR_SAMA5D2_IRQS 77 34062a993dfSNicolas Ferre 34162a993dfSNicolas Ferre static int __init sama5d2_aic5_of_init(struct device_node *node, 34262a993dfSNicolas Ferre struct device_node *parent) 34362a993dfSNicolas Ferre { 34462a993dfSNicolas Ferre return aic5_of_init(node, parent, NR_SAMA5D2_IRQS); 34562a993dfSNicolas Ferre } 34662a993dfSNicolas Ferre IRQCHIP_DECLARE(sama5d2_aic5, "atmel,sama5d2-aic", sama5d2_aic5_of_init); 34762a993dfSNicolas Ferre 3480cae165fSAlexandre Belloni #define NR_SAMA5D3_IRQS 48 349b1479ebbSBoris BREZILLON 350b1479ebbSBoris BREZILLON static int __init sama5d3_aic5_of_init(struct device_node *node, 351b1479ebbSBoris BREZILLON struct device_node *parent) 352b1479ebbSBoris BREZILLON { 353b1479ebbSBoris BREZILLON return aic5_of_init(node, parent, NR_SAMA5D3_IRQS); 354b1479ebbSBoris BREZILLON } 355b1479ebbSBoris BREZILLON IRQCHIP_DECLARE(sama5d3_aic5, "atmel,sama5d3-aic", sama5d3_aic5_of_init); 35620afdeb8SAlexandre Belloni 35720afdeb8SAlexandre Belloni #define NR_SAMA5D4_IRQS 68 35820afdeb8SAlexandre Belloni 35920afdeb8SAlexandre Belloni static int __init sama5d4_aic5_of_init(struct device_node *node, 36020afdeb8SAlexandre Belloni struct device_node *parent) 36120afdeb8SAlexandre Belloni { 36220afdeb8SAlexandre Belloni return aic5_of_init(node, parent, NR_SAMA5D4_IRQS); 36320afdeb8SAlexandre Belloni } 36420afdeb8SAlexandre Belloni IRQCHIP_DECLARE(sama5d4_aic5, "atmel,sama5d4-aic", sama5d4_aic5_of_init); 365