aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/irq.c')
-rw-r--r--arch/arm/mach-pxa/irq.c106
1 files changed, 50 insertions, 56 deletions
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index 4619d5fe606c..4b867b0789d5 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -30,12 +30,12 @@
30 30
31static void pxa_mask_low_irq(unsigned int irq) 31static void pxa_mask_low_irq(unsigned int irq)
32{ 32{
33 ICMR &= ~(1 << (irq + PXA_IRQ_SKIP)); 33 ICMR &= ~(1 << irq);
34} 34}
35 35
36static void pxa_unmask_low_irq(unsigned int irq) 36static void pxa_unmask_low_irq(unsigned int irq)
37{ 37{
38 ICMR |= (1 << (irq + PXA_IRQ_SKIP)); 38 ICMR |= (1 << irq);
39} 39}
40 40
41static int pxa_set_wake(unsigned int irq, unsigned int on) 41static int pxa_set_wake(unsigned int irq, unsigned int on)
@@ -67,7 +67,27 @@ static struct irq_chip pxa_internal_chip_low = {
67 .set_wake = pxa_set_wake, 67 .set_wake = pxa_set_wake,
68}; 68};
69 69
70#if PXA_INTERNAL_IRQS > 32 70void __init pxa_init_irq_low(void)
71{
72 int irq;
73
74 /* disable all IRQs */
75 ICMR = 0;
76
77 /* all IRQs are IRQ, not FIQ */
78 ICLR = 0;
79
80 /* only unmasked interrupts kick us out of idle */
81 ICCR = 1;
82
83 for (irq = PXA_IRQ(0); irq <= PXA_IRQ(31); irq++) {
84 set_irq_chip(irq, &pxa_internal_chip_low);
85 set_irq_handler(irq, handle_level_irq);
86 set_irq_flags(irq, IRQF_VALID);
87 }
88}
89
90#ifdef CONFIG_PXA27x
71 91
72/* 92/*
73 * This is for the second set of internal IRQs as found on the PXA27x. 93 * This is for the second set of internal IRQs as found on the PXA27x.
@@ -75,12 +95,12 @@ static struct irq_chip pxa_internal_chip_low = {
75 95
76static void pxa_mask_high_irq(unsigned int irq) 96static void pxa_mask_high_irq(unsigned int irq)
77{ 97{
78 ICMR2 &= ~(1 << (irq - 32 + PXA_IRQ_SKIP)); 98 ICMR2 &= ~(1 << (irq - 32));
79} 99}
80 100
81static void pxa_unmask_high_irq(unsigned int irq) 101static void pxa_unmask_high_irq(unsigned int irq)
82{ 102{
83 ICMR2 |= (1 << (irq - 32 + PXA_IRQ_SKIP)); 103 ICMR2 |= (1 << (irq - 32));
84} 104}
85 105
86static struct irq_chip pxa_internal_chip_high = { 106static struct irq_chip pxa_internal_chip_high = {
@@ -90,6 +110,19 @@ static struct irq_chip pxa_internal_chip_high = {
90 .unmask = pxa_unmask_high_irq, 110 .unmask = pxa_unmask_high_irq,
91}; 111};
92 112
113void __init pxa_init_irq_high(void)
114{
115 int irq;
116
117 ICMR2 = 0;
118 ICLR2 = 0;
119
120 for (irq = PXA_IRQ(32); irq < PXA_IRQ(64); irq++) {
121 set_irq_chip(irq, &pxa_internal_chip_high);
122 set_irq_handler(irq, handle_level_irq);
123 set_irq_flags(irq, IRQF_VALID);
124 }
125}
93#endif 126#endif
94 127
95/* Note that if an input/irq line ever gets changed to an output during 128/* Note that if an input/irq line ever gets changed to an output during
@@ -217,7 +250,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
217 do { 250 do {
218 loop = 0; 251 loop = 0;
219 252
220 mask = GEDR0 & ~3; 253 mask = GEDR0 & GPIO_IRQ_mask[0] & ~3;
221 if (mask) { 254 if (mask) {
222 GEDR0 = mask; 255 GEDR0 = mask;
223 irq = IRQ_GPIO(2); 256 irq = IRQ_GPIO(2);
@@ -233,7 +266,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
233 loop = 1; 266 loop = 1;
234 } 267 }
235 268
236 mask = GEDR1; 269 mask = GEDR1 & GPIO_IRQ_mask[1];
237 if (mask) { 270 if (mask) {
238 GEDR1 = mask; 271 GEDR1 = mask;
239 irq = IRQ_GPIO(32); 272 irq = IRQ_GPIO(32);
@@ -248,7 +281,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
248 loop = 1; 281 loop = 1;
249 } 282 }
250 283
251 mask = GEDR2; 284 mask = GEDR2 & GPIO_IRQ_mask[2];
252 if (mask) { 285 if (mask) {
253 GEDR2 = mask; 286 GEDR2 = mask;
254 irq = IRQ_GPIO(64); 287 irq = IRQ_GPIO(64);
@@ -263,8 +296,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
263 loop = 1; 296 loop = 1;
264 } 297 }
265 298
266#if PXA_LAST_GPIO >= 96 299 mask = GEDR3 & GPIO_IRQ_mask[3];
267 mask = GEDR3;
268 if (mask) { 300 if (mask) {
269 GEDR3 = mask; 301 GEDR3 = mask;
270 irq = IRQ_GPIO(96); 302 irq = IRQ_GPIO(96);
@@ -278,7 +310,6 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
278 } while (mask); 310 } while (mask);
279 loop = 1; 311 loop = 1;
280 } 312 }
281#endif
282 } while (loop); 313 } while (loop);
283} 314}
284 315
@@ -314,64 +345,27 @@ static struct irq_chip pxa_muxed_gpio_chip = {
314 .set_wake = pxa_set_gpio_wake, 345 .set_wake = pxa_set_gpio_wake,
315}; 346};
316 347
317 348void __init pxa_init_irq_gpio(int gpio_nr)
318void __init pxa_init_irq(void)
319{ 349{
320 int irq; 350 int irq, i;
321
322 /* disable all IRQs */
323 ICMR = 0;
324
325 /* all IRQs are IRQ, not FIQ */
326 ICLR = 0;
327 351
328 /* clear all GPIO edge detects */ 352 /* clear all GPIO edge detects */
329 GFER0 = 0; 353 for (i = 0; i < gpio_nr; i += 32) {
330 GFER1 = 0; 354 GFER(i) = 0;
331 GFER2 = 0; 355 GRER(i) = 0;
332 GRER0 = 0; 356 GEDR(i) = GEDR(i);
333 GRER1 = 0; 357 }
334 GRER2 = 0;
335 GEDR0 = GEDR0;
336 GEDR1 = GEDR1;
337 GEDR2 = GEDR2;
338
339#ifdef CONFIG_PXA27x
340 /* And similarly for the extra regs on the PXA27x */
341 ICMR2 = 0;
342 ICLR2 = 0;
343 GFER3 = 0;
344 GRER3 = 0;
345 GEDR3 = GEDR3;
346#endif
347
348 /* only unmasked interrupts kick us out of idle */
349 ICCR = 1;
350 358
351 /* GPIO 0 and 1 must have their mask bit always set */ 359 /* GPIO 0 and 1 must have their mask bit always set */
352 GPIO_IRQ_mask[0] = 3; 360 GPIO_IRQ_mask[0] = 3;
353 361
354 for (irq = PXA_IRQ(PXA_IRQ_SKIP); irq <= PXA_IRQ(31); irq++) {
355 set_irq_chip(irq, &pxa_internal_chip_low);
356 set_irq_handler(irq, handle_level_irq);
357 set_irq_flags(irq, IRQF_VALID);
358 }
359
360#if PXA_INTERNAL_IRQS > 32
361 for (irq = PXA_IRQ(32); irq < PXA_IRQ(PXA_INTERNAL_IRQS); irq++) {
362 set_irq_chip(irq, &pxa_internal_chip_high);
363 set_irq_handler(irq, handle_level_irq);
364 set_irq_flags(irq, IRQF_VALID);
365 }
366#endif
367
368 for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) { 362 for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) {
369 set_irq_chip(irq, &pxa_low_gpio_chip); 363 set_irq_chip(irq, &pxa_low_gpio_chip);
370 set_irq_handler(irq, handle_edge_irq); 364 set_irq_handler(irq, handle_edge_irq);
371 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 365 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
372 } 366 }
373 367
374 for (irq = IRQ_GPIO(2); irq <= IRQ_GPIO(PXA_LAST_GPIO); irq++) { 368 for (irq = IRQ_GPIO(2); irq <= IRQ_GPIO(gpio_nr); irq++) {
375 set_irq_chip(irq, &pxa_muxed_gpio_chip); 369 set_irq_chip(irq, &pxa_muxed_gpio_chip);
376 set_irq_handler(irq, handle_edge_irq); 370 set_irq_handler(irq, handle_edge_irq);
377 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 371 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);