aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/irqchip
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2013-04-10 09:17:47 -0400
committerArnd Bergmann <arnd@arndb.de>2013-04-19 17:00:40 -0400
commit6761dcfe8c42b55076753bc8bea7b5dcbfb445c0 (patch)
tree1fff09aea689b937c15ac5f6178d173ac3f062c5 /drivers/irqchip
parent30269ddff13f417677a27e37086c97a57f1cf2da (diff)
irqchip: exynos: pass max combiner number to combiner_init
We can find out the number of combined IRQs from the device tree, but in case of ATAGS boot, the driver currently uses hardcoded values based on the SoC type. We can't do that in general for a multiplatform kernel, so let's instead pass this information from platform code directly in case of ATAGS boot. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r--drivers/irqchip/exynos-combiner.c46
1 files changed, 16 insertions, 30 deletions
diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c
index e8501dbaa0b7..d8683836ee1e 100644
--- a/drivers/irqchip/exynos-combiner.c
+++ b/drivers/irqchip/exynos-combiner.c
@@ -25,6 +25,8 @@
25#define COMBINER_ENABLE_CLEAR 0x4 25#define COMBINER_ENABLE_CLEAR 0x4
26#define COMBINER_INT_STATUS 0xC 26#define COMBINER_INT_STATUS 0xC
27 27
28#define IRQ_IN_COMBINER 8
29
28static DEFINE_SPINLOCK(irq_controller_lock); 30static DEFINE_SPINLOCK(irq_controller_lock);
29 31
30struct combiner_chip_data { 32struct combiner_chip_data {
@@ -112,23 +114,9 @@ static struct irq_chip combiner_chip = {
112#endif 114#endif
113}; 115};
114 116
115static unsigned int max_combiner_nr(void)
116{
117 if (soc_is_exynos5250())
118 return EXYNOS5_MAX_COMBINER_NR;
119 else if (soc_is_exynos4412())
120 return EXYNOS4412_MAX_COMBINER_NR;
121 else if (soc_is_exynos4212())
122 return EXYNOS4212_MAX_COMBINER_NR;
123 else
124 return EXYNOS4210_MAX_COMBINER_NR;
125}
126
127static void __init combiner_cascade_irq(unsigned int combiner_nr, 117static void __init combiner_cascade_irq(unsigned int combiner_nr,
128 unsigned int irq) 118 unsigned int irq)
129{ 119{
130 if (combiner_nr >= max_combiner_nr())
131 BUG();
132 if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0) 120 if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0)
133 BUG(); 121 BUG();
134 irq_set_chained_handler(irq, combiner_handle_cascade_irq); 122 irq_set_chained_handler(irq, combiner_handle_cascade_irq);
@@ -139,7 +127,7 @@ static void __init combiner_init_one(unsigned int combiner_nr,
139{ 127{
140 combiner_data[combiner_nr].base = base; 128 combiner_data[combiner_nr].base = base;
141 combiner_data[combiner_nr].irq_offset = irq_find_mapping( 129 combiner_data[combiner_nr].irq_offset = irq_find_mapping(
142 combiner_irq_domain, combiner_nr * MAX_IRQ_IN_COMBINER); 130 combiner_irq_domain, combiner_nr * IRQ_IN_COMBINER);
143 combiner_data[combiner_nr].irq_mask = 0xff << ((combiner_nr % 4) << 3); 131 combiner_data[combiner_nr].irq_mask = 0xff << ((combiner_nr % 4) << 3);
144 combiner_data[combiner_nr].parent_irq = irq; 132 combiner_data[combiner_nr].parent_irq = irq;
145 133
@@ -161,7 +149,7 @@ static int combiner_irq_domain_xlate(struct irq_domain *d,
161 if (intsize < 2) 149 if (intsize < 2)
162 return -EINVAL; 150 return -EINVAL;
163 151
164 *out_hwirq = intspec[0] * MAX_IRQ_IN_COMBINER + intspec[1]; 152 *out_hwirq = intspec[0] * IRQ_IN_COMBINER + intspec[1];
165 *out_type = 0; 153 *out_type = 0;
166 154
167 return 0; 155 return 0;
@@ -209,22 +197,13 @@ static unsigned int exynos4x12_combiner_extra_irq(int group)
209} 197}
210 198
211void __init combiner_init(void __iomem *combiner_base, 199void __init combiner_init(void __iomem *combiner_base,
212 struct device_node *np) 200 struct device_node *np,
201 unsigned int max_nr)
213{ 202{
214 int i, irq, irq_base; 203 int i, irq, irq_base;
215 unsigned int max_nr, nr_irq; 204 unsigned int nr_irq;
216 205
217 max_nr = max_combiner_nr(); 206 nr_irq = max_nr * IRQ_IN_COMBINER;
218
219 if (np) {
220 if (of_property_read_u32(np, "samsung,combiner-nr", &max_nr)) {
221 pr_info("%s: number of combiners not specified, "
222 "setting default as %d.\n",
223 __func__, max_nr);
224 }
225 }
226
227 nr_irq = max_nr * MAX_IRQ_IN_COMBINER;
228 207
229 irq_base = irq_alloc_descs(COMBINER_IRQ(0, 0), 1, nr_irq, 0); 208 irq_base = irq_alloc_descs(COMBINER_IRQ(0, 0), 1, nr_irq, 0);
230 if (IS_ERR_VALUE(irq_base)) { 209 if (IS_ERR_VALUE(irq_base)) {
@@ -258,6 +237,7 @@ static int __init combiner_of_init(struct device_node *np,
258 struct device_node *parent) 237 struct device_node *parent)
259{ 238{
260 void __iomem *combiner_base; 239 void __iomem *combiner_base;
240 unsigned int max_nr = 20;
261 241
262 combiner_base = of_iomap(np, 0); 242 combiner_base = of_iomap(np, 0);
263 if (!combiner_base) { 243 if (!combiner_base) {
@@ -265,7 +245,13 @@ static int __init combiner_of_init(struct device_node *np,
265 return -ENXIO; 245 return -ENXIO;
266 } 246 }
267 247
268 combiner_init(combiner_base, np); 248 if (of_property_read_u32(np, "samsung,combiner-nr", &max_nr)) {
249 pr_info("%s: number of combiners not specified, "
250 "setting default as %d.\n",
251 __func__, max_nr);
252 }
253
254 combiner_init(combiner_base, np, max_nr);
269 255
270 return 0; 256 return 0;
271} 257}