aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2011-03-07 08:00:04 -0500
committerGreg Ungerer <gerg@uclinux.org>2011-03-15 07:01:55 -0400
commit745c061f98720e7be201dd2d2277e524ecf45d1c (patch)
tree0492d30e586b8c6e6a63ff22c39dd83f662699ac
parent6d0f33fa80ed530168161fd2f226a3e5cf27cf81 (diff)
m68knommu: limit interrupts supported by ColdFire intc-simr driver
The intc-simr interrupt controller on some ColdFire CPUs has a set range of interrupts its supports (64 through 128 or 192 depending on model). We shouldn't be setting this handler for every possible interrupt from 0 to 255. Set more appropriate limits, and this means we can drop the interrupt number check in the mask and unmask routines. Signed-off-by: Greg Ungerer <gerg@uclinux.org>
-rw-r--r--arch/m68knommu/platform/coldfire/intc-simr.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/arch/m68knommu/platform/coldfire/intc-simr.c b/arch/m68knommu/platform/coldfire/intc-simr.c
index 69a3b679730b..8876f434c125 100644
--- a/arch/m68knommu/platform/coldfire/intc-simr.c
+++ b/arch/m68knommu/platform/coldfire/intc-simr.c
@@ -20,40 +20,40 @@
20#include <asm/mcfsim.h> 20#include <asm/mcfsim.h>
21#include <asm/traps.h> 21#include <asm/traps.h>
22 22
23/*
24 * There maybe one or two interrupt control units, each has 64
25 * interrupts. If there is no second unit then MCFINTC1_* defines
26 * will be 0 (and code for them optimized away).
27 */
28
23static void intc_irq_mask(struct irq_data *d) 29static void intc_irq_mask(struct irq_data *d)
24{ 30{
25 unsigned int irq = d->irq; 31 unsigned int irq = d->irq - MCFINT_VECBASE;
26 32
27 if (irq >= MCFINT_VECBASE) { 33 if (MCFINTC1_SIMR && (irq > 64))
28 if (irq < MCFINT_VECBASE + 64) 34 __raw_writeb(irq - 64, MCFINTC1_SIMR);
29 __raw_writeb(irq - MCFINT_VECBASE, MCFINTC0_SIMR); 35 else
30 else if ((irq < MCFINT_VECBASE + 128) && MCFINTC1_SIMR) 36 __raw_writeb(irq, MCFINTC0_SIMR);
31 __raw_writeb(irq - MCFINT_VECBASE - 64, MCFINTC1_SIMR);
32 }
33} 37}
34 38
35static void intc_irq_unmask(struct irq_data *d) 39static void intc_irq_unmask(struct irq_data *d)
36{ 40{
37 unsigned int irq = d->irq; 41 unsigned int irq = d->irq - MCFINT_VECBASE;
38 42
39 if (irq >= MCFINT_VECBASE) { 43 if (MCFINTC1_CIMR && (irq > 64))
40 if (irq < MCFINT_VECBASE + 64) 44 __raw_writeb(irq - 64, MCFINTC1_CIMR);
41 __raw_writeb(irq - MCFINT_VECBASE, MCFINTC0_CIMR); 45 else
42 else if ((irq < MCFINT_VECBASE + 128) && MCFINTC1_CIMR) 46 __raw_writeb(irq, MCFINTC0_CIMR);
43 __raw_writeb(irq - MCFINT_VECBASE - 64, MCFINTC1_CIMR);
44 }
45} 47}
46 48
47static int intc_irq_set_type(struct irq_data *d, unsigned int type) 49static int intc_irq_set_type(struct irq_data *d, unsigned int type)
48{ 50{
49 unsigned int irq = d->irq; 51 unsigned int irq = d->irq - MCFINT_VECBASE;
50 52
51 if (irq >= MCFINT_VECBASE) { 53 if (MCFINTC1_ICR0 && (irq > 64))
52 if (irq < MCFINT_VECBASE + 64) 54 __raw_writeb(5, MCFINTC1_ICR0 + irq - 64);
53 __raw_writeb(5, MCFINTC0_ICR0 + irq - MCFINT_VECBASE); 55 else
54 else if ((irq < MCFINT_VECBASE) && MCFINTC1_ICR0) 56 __raw_writeb(5, MCFINTC0_ICR0 + irq);
55 __raw_writeb(5, MCFINTC1_ICR0 + irq - MCFINT_VECBASE - 64);
56 }
57 return 0; 57 return 0;
58} 58}
59 59
@@ -66,7 +66,7 @@ static struct irq_chip intc_irq_chip = {
66 66
67void __init init_IRQ(void) 67void __init init_IRQ(void)
68{ 68{
69 int irq; 69 int irq, eirq;
70 70
71 init_vectors(); 71 init_vectors();
72 72
@@ -75,7 +75,8 @@ void __init init_IRQ(void)
75 if (MCFINTC1_SIMR) 75 if (MCFINTC1_SIMR)
76 __raw_writeb(0xff, MCFINTC1_SIMR); 76 __raw_writeb(0xff, MCFINTC1_SIMR);
77 77
78 for (irq = 0; (irq < NR_IRQS); irq++) { 78 eirq = MCFINT_VECBASE + 64 + (MCFINTC1_ICR0 ? 64 : 0);
79 for (irq = MCFINT_VECBASE; (irq < eirq); irq++) {
79 set_irq_chip(irq, &intc_irq_chip); 80 set_irq_chip(irq, &intc_irq_chip);
80 set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH); 81 set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
81 set_irq_handler(irq, handle_level_irq); 82 set_irq_handler(irq, handle_level_irq);