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