viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 1 | /* |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 2 | * SPEAr platform shared irq layer source file |
| 3 | * |
Viresh Kumar | df1590d | 2012-11-12 22:56:03 +0530 | [diff] [blame] | 4 | * Copyright (C) 2009-2012 ST Microelectronics |
Viresh Kumar | da89947 | 2015-07-17 16:23:50 -0700 | [diff] [blame] | 5 | * Viresh Kumar <vireshk@kernel.org> |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 6 | * |
Viresh Kumar | df1590d | 2012-11-12 22:56:03 +0530 | [diff] [blame] | 7 | * Copyright (C) 2012 ST Microelectronics |
Viresh Kumar | 9cc2368 | 2014-04-18 15:07:16 -0700 | [diff] [blame] | 8 | * Shiraz Hashim <shiraz.linux.kernel@gmail.com> |
Viresh Kumar | df1590d | 2012-11-12 22:56:03 +0530 | [diff] [blame] | 9 | * |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 10 | * This file is licensed under the terms of the GNU General Public |
| 11 | * License version 2. This program is licensed "as is" without any |
| 12 | * warranty of any kind, whether express or implied. |
| 13 | */ |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 15 | |
| 16 | #include <linux/err.h> |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 17 | #include <linux/export.h> |
| 18 | #include <linux/interrupt.h> |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 19 | #include <linux/io.h> |
| 20 | #include <linux/irq.h> |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 21 | #include <linux/irqdomain.h> |
| 22 | #include <linux/of.h> |
| 23 | #include <linux/of_address.h> |
| 24 | #include <linux/of_irq.h> |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 25 | #include <linux/spinlock.h> |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 26 | |
Rob Herring | e9c5155 | 2013-01-02 09:37:56 -0600 | [diff] [blame] | 27 | #include "irqchip.h" |
| 28 | |
Thomas Gleixner | 078bc00 | 2014-06-19 21:34:38 +0000 | [diff] [blame] | 29 | /* |
Thomas Gleixner | 078bc00 | 2014-06-19 21:34:38 +0000 | [diff] [blame] | 30 | * struct spear_shirq: shared irq structure |
| 31 | * |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 32 | * base: Base register address |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 33 | * status_reg: Status register offset for chained interrupt handler |
| 34 | * mask_reg: Mask register offset for irq chip |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 35 | * mask: Mask to apply to the status register |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 36 | * virq_base: Base virtual interrupt number |
| 37 | * nr_irqs: Number of interrupts handled by this block |
| 38 | * offset: Bit offset of the first interrupt |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 39 | * irq_chip: Interrupt controller chip used for this instance, |
| 40 | * if NULL group is disabled, but accounted |
Thomas Gleixner | 078bc00 | 2014-06-19 21:34:38 +0000 | [diff] [blame] | 41 | */ |
| 42 | struct spear_shirq { |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 43 | void __iomem *base; |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 44 | u32 status_reg; |
| 45 | u32 mask_reg; |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 46 | u32 mask; |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 47 | u32 virq_base; |
| 48 | u32 nr_irqs; |
| 49 | u32 offset; |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 50 | struct irq_chip *irq_chip; |
Thomas Gleixner | 078bc00 | 2014-06-19 21:34:38 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 53 | /* spear300 shared irq registers offsets and masks */ |
| 54 | #define SPEAR300_INT_ENB_MASK_REG 0x54 |
| 55 | #define SPEAR300_INT_STS_MASK_REG 0x58 |
| 56 | |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 57 | static DEFINE_RAW_SPINLOCK(shirq_lock); |
| 58 | |
| 59 | static void shirq_irq_mask(struct irq_data *d) |
| 60 | { |
| 61 | struct spear_shirq *shirq = irq_data_get_irq_chip_data(d); |
| 62 | u32 val, shift = d->irq - shirq->virq_base + shirq->offset; |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 63 | u32 __iomem *reg = shirq->base + shirq->mask_reg; |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 64 | |
| 65 | raw_spin_lock(&shirq_lock); |
| 66 | val = readl(reg) & ~(0x1 << shift); |
| 67 | writel(val, reg); |
| 68 | raw_spin_unlock(&shirq_lock); |
| 69 | } |
| 70 | |
| 71 | static void shirq_irq_unmask(struct irq_data *d) |
| 72 | { |
| 73 | struct spear_shirq *shirq = irq_data_get_irq_chip_data(d); |
| 74 | u32 val, shift = d->irq - shirq->virq_base + shirq->offset; |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 75 | u32 __iomem *reg = shirq->base + shirq->mask_reg; |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 76 | |
| 77 | raw_spin_lock(&shirq_lock); |
| 78 | val = readl(reg) | (0x1 << shift); |
| 79 | writel(val, reg); |
| 80 | raw_spin_unlock(&shirq_lock); |
| 81 | } |
| 82 | |
| 83 | static struct irq_chip shirq_chip = { |
| 84 | .name = "spear-shirq", |
| 85 | .irq_mask = shirq_irq_mask, |
| 86 | .irq_unmask = shirq_irq_unmask, |
| 87 | }; |
| 88 | |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 89 | static struct spear_shirq spear300_shirq_ras1 = { |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 90 | .offset = 0, |
| 91 | .nr_irqs = 9, |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 92 | .mask = ((0x1 << 9) - 1) << 0, |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 93 | .irq_chip = &shirq_chip, |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 94 | .status_reg = SPEAR300_INT_STS_MASK_REG, |
| 95 | .mask_reg = SPEAR300_INT_ENB_MASK_REG, |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | static struct spear_shirq *spear300_shirq_blocks[] = { |
| 99 | &spear300_shirq_ras1, |
| 100 | }; |
| 101 | |
| 102 | /* spear310 shared irq registers offsets and masks */ |
| 103 | #define SPEAR310_INT_STS_MASK_REG 0x04 |
| 104 | |
| 105 | static struct spear_shirq spear310_shirq_ras1 = { |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 106 | .offset = 0, |
| 107 | .nr_irqs = 8, |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 108 | .mask = ((0x1 << 8) - 1) << 0, |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 109 | .irq_chip = &dummy_irq_chip, |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 110 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 111 | }; |
| 112 | |
| 113 | static struct spear_shirq spear310_shirq_ras2 = { |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 114 | .offset = 8, |
| 115 | .nr_irqs = 5, |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 116 | .mask = ((0x1 << 5) - 1) << 8, |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 117 | .irq_chip = &dummy_irq_chip, |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 118 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 119 | }; |
| 120 | |
| 121 | static struct spear_shirq spear310_shirq_ras3 = { |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 122 | .offset = 13, |
| 123 | .nr_irqs = 1, |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 124 | .mask = ((0x1 << 1) - 1) << 13, |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 125 | .irq_chip = &dummy_irq_chip, |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 126 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | static struct spear_shirq spear310_shirq_intrcomm_ras = { |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 130 | .offset = 14, |
| 131 | .nr_irqs = 3, |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 132 | .mask = ((0x1 << 3) - 1) << 14, |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 133 | .irq_chip = &dummy_irq_chip, |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 134 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 135 | }; |
| 136 | |
| 137 | static struct spear_shirq *spear310_shirq_blocks[] = { |
| 138 | &spear310_shirq_ras1, |
| 139 | &spear310_shirq_ras2, |
| 140 | &spear310_shirq_ras3, |
| 141 | &spear310_shirq_intrcomm_ras, |
| 142 | }; |
| 143 | |
| 144 | /* spear320 shared irq registers offsets and masks */ |
| 145 | #define SPEAR320_INT_STS_MASK_REG 0x04 |
| 146 | #define SPEAR320_INT_CLR_MASK_REG 0x04 |
| 147 | #define SPEAR320_INT_ENB_MASK_REG 0x08 |
| 148 | |
Thomas Gleixner | 03319a1 | 2014-06-19 21:34:40 +0000 | [diff] [blame] | 149 | static struct spear_shirq spear320_shirq_ras3 = { |
| 150 | .offset = 0, |
| 151 | .nr_irqs = 7, |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 152 | .mask = ((0x1 << 7) - 1) << 0, |
Thomas Gleixner | 03319a1 | 2014-06-19 21:34:40 +0000 | [diff] [blame] | 153 | }; |
| 154 | |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 155 | static struct spear_shirq spear320_shirq_ras1 = { |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 156 | .offset = 7, |
| 157 | .nr_irqs = 3, |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 158 | .mask = ((0x1 << 3) - 1) << 7, |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 159 | .irq_chip = &dummy_irq_chip, |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 160 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 161 | }; |
| 162 | |
| 163 | static struct spear_shirq spear320_shirq_ras2 = { |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 164 | .offset = 10, |
| 165 | .nr_irqs = 1, |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 166 | .mask = ((0x1 << 1) - 1) << 10, |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 167 | .irq_chip = &dummy_irq_chip, |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 168 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 169 | }; |
| 170 | |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 171 | static struct spear_shirq spear320_shirq_intrcomm_ras = { |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 172 | .offset = 11, |
| 173 | .nr_irqs = 11, |
Thomas Gleixner | 4ecc832 | 2014-06-19 21:34:41 +0000 | [diff] [blame] | 174 | .mask = ((0x1 << 11) - 1) << 11, |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 175 | .irq_chip = &dummy_irq_chip, |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 176 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 177 | }; |
| 178 | |
| 179 | static struct spear_shirq *spear320_shirq_blocks[] = { |
| 180 | &spear320_shirq_ras3, |
| 181 | &spear320_shirq_ras1, |
| 182 | &spear320_shirq_ras2, |
| 183 | &spear320_shirq_intrcomm_ras, |
| 184 | }; |
| 185 | |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 186 | static void shirq_handler(unsigned irq, struct irq_desc *desc) |
| 187 | { |
Thomas Gleixner | 6845664a | 2011-03-24 13:25:22 +0100 | [diff] [blame] | 188 | struct spear_shirq *shirq = irq_get_handler_data(irq); |
Thomas Gleixner | 25dc49e | 2014-06-19 21:34:42 +0000 | [diff] [blame] | 189 | u32 pend; |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 190 | |
Thomas Gleixner | 1b0a76c | 2014-06-19 21:34:44 +0000 | [diff] [blame] | 191 | pend = readl(shirq->base + shirq->status_reg) & shirq->mask; |
Thomas Gleixner | 25dc49e | 2014-06-19 21:34:42 +0000 | [diff] [blame] | 192 | pend >>= shirq->offset; |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 193 | |
Thomas Gleixner | 25dc49e | 2014-06-19 21:34:42 +0000 | [diff] [blame] | 194 | while (pend) { |
| 195 | int irq = __ffs(pend); |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 196 | |
Thomas Gleixner | 25dc49e | 2014-06-19 21:34:42 +0000 | [diff] [blame] | 197 | pend &= ~(0x1 << irq); |
| 198 | generic_handle_irq(shirq->virq_base + irq); |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 199 | } |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 200 | } |
| 201 | |
Thomas Gleixner | f37ecbc | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 202 | static void __init spear_shirq_register(struct spear_shirq *shirq, |
| 203 | int parent_irq) |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 204 | { |
| 205 | int i; |
| 206 | |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 207 | if (!shirq->irq_chip) |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 208 | return; |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 209 | |
Russell King | 2aedd0f | 2015-06-16 23:07:01 +0100 | [diff] [blame] | 210 | irq_set_chained_handler_and_data(parent_irq, shirq_handler, shirq); |
Thomas Gleixner | f37ecbc | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 211 | |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 212 | for (i = 0; i < shirq->nr_irqs; i++) { |
| 213 | irq_set_chip_and_handler(shirq->virq_base + i, |
Thomas Gleixner | f07e42f | 2014-06-19 21:34:43 +0000 | [diff] [blame] | 214 | shirq->irq_chip, handle_simple_irq); |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 215 | set_irq_flags(shirq->virq_base + i, IRQF_VALID); |
| 216 | irq_set_chip_data(shirq->virq_base + i, shirq); |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 217 | } |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | static int __init shirq_init(struct spear_shirq **shirq_blocks, int block_nr, |
| 221 | struct device_node *np) |
| 222 | { |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 223 | int i, parent_irq, virq_base, hwirq = 0, nr_irqs = 0; |
Thomas Gleixner | a26c06f | 2014-06-19 21:34:37 +0000 | [diff] [blame] | 224 | struct irq_domain *shirq_domain; |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 225 | void __iomem *base; |
| 226 | |
| 227 | base = of_iomap(np, 0); |
| 228 | if (!base) { |
| 229 | pr_err("%s: failed to map shirq registers\n", __func__); |
| 230 | return -ENXIO; |
| 231 | } |
| 232 | |
| 233 | for (i = 0; i < block_nr; i++) |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 234 | nr_irqs += shirq_blocks[i]->nr_irqs; |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 235 | |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 236 | virq_base = irq_alloc_descs(-1, 0, nr_irqs, 0); |
| 237 | if (IS_ERR_VALUE(virq_base)) { |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 238 | pr_err("%s: irq desc alloc failed\n", __func__); |
| 239 | goto err_unmap; |
| 240 | } |
| 241 | |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 242 | shirq_domain = irq_domain_add_legacy(np, nr_irqs, virq_base, 0, |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 243 | &irq_domain_simple_ops, NULL); |
| 244 | if (WARN_ON(!shirq_domain)) { |
| 245 | pr_warn("%s: irq domain init failed\n", __func__); |
| 246 | goto err_free_desc; |
| 247 | } |
| 248 | |
| 249 | for (i = 0; i < block_nr; i++) { |
| 250 | shirq_blocks[i]->base = base; |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 251 | shirq_blocks[i]->virq_base = irq_find_mapping(shirq_domain, |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 252 | hwirq); |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 253 | |
Thomas Gleixner | f37ecbc | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 254 | parent_irq = irq_of_parse_and_map(np, i); |
| 255 | spear_shirq_register(shirq_blocks[i], parent_irq); |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 256 | hwirq += shirq_blocks[i]->nr_irqs; |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 257 | } |
| 258 | |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 259 | return 0; |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 260 | |
| 261 | err_free_desc: |
Thomas Gleixner | c5d1d85 | 2014-06-19 21:34:39 +0000 | [diff] [blame] | 262 | irq_free_descs(virq_base, nr_irqs); |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 263 | err_unmap: |
| 264 | iounmap(base); |
| 265 | return -ENXIO; |
| 266 | } |
| 267 | |
Thomas Gleixner | 078bc00 | 2014-06-19 21:34:38 +0000 | [diff] [blame] | 268 | static int __init spear300_shirq_of_init(struct device_node *np, |
| 269 | struct device_node *parent) |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 270 | { |
| 271 | return shirq_init(spear300_shirq_blocks, |
| 272 | ARRAY_SIZE(spear300_shirq_blocks), np); |
| 273 | } |
Rob Herring | e9c5155 | 2013-01-02 09:37:56 -0600 | [diff] [blame] | 274 | IRQCHIP_DECLARE(spear300_shirq, "st,spear300-shirq", spear300_shirq_of_init); |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 275 | |
Thomas Gleixner | 078bc00 | 2014-06-19 21:34:38 +0000 | [diff] [blame] | 276 | static int __init spear310_shirq_of_init(struct device_node *np, |
| 277 | struct device_node *parent) |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 278 | { |
| 279 | return shirq_init(spear310_shirq_blocks, |
| 280 | ARRAY_SIZE(spear310_shirq_blocks), np); |
| 281 | } |
Rob Herring | e9c5155 | 2013-01-02 09:37:56 -0600 | [diff] [blame] | 282 | IRQCHIP_DECLARE(spear310_shirq, "st,spear310-shirq", spear310_shirq_of_init); |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 283 | |
Thomas Gleixner | 078bc00 | 2014-06-19 21:34:38 +0000 | [diff] [blame] | 284 | static int __init spear320_shirq_of_init(struct device_node *np, |
| 285 | struct device_node *parent) |
Shiraz Hashim | 80515a5a | 2012-08-03 15:33:10 +0530 | [diff] [blame] | 286 | { |
| 287 | return shirq_init(spear320_shirq_blocks, |
| 288 | ARRAY_SIZE(spear320_shirq_blocks), np); |
viresh kumar | 4c18e77 | 2010-05-03 09:24:30 +0100 | [diff] [blame] | 289 | } |
Rob Herring | e9c5155 | 2013-01-02 09:37:56 -0600 | [diff] [blame] | 290 | IRQCHIP_DECLARE(spear320_shirq, "st,spear320-shirq", spear320_shirq_of_init); |