aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68knommu')
-rw-r--r--arch/m68knommu/platform/coldfire/intc-2.c58
1 files changed, 25 insertions, 33 deletions
diff --git a/arch/m68knommu/platform/coldfire/intc-2.c b/arch/m68knommu/platform/coldfire/intc-2.c
index ec869c8e8890..4d172a7a6fbc 100644
--- a/arch/m68knommu/platform/coldfire/intc-2.c
+++ b/arch/m68knommu/platform/coldfire/intc-2.c
@@ -45,54 +45,46 @@ static u8 intc_intpri = MCFSIM_ICR_LEVEL(6) | MCFSIM_ICR_PRI(6);
45 45
46static void intc_irq_mask(struct irq_data *d) 46static void intc_irq_mask(struct irq_data *d)
47{ 47{
48 unsigned int irq = d->irq; 48 unsigned int irq = d->irq - MCFINT_VECBASE;
49 unsigned long imraddr;
50 u32 val, imrbit;
49 51
50 if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + NR_VECS)) {
51 unsigned long imraddr;
52 u32 val, imrbit;
53
54 irq -= MCFINT_VECBASE;
55#ifdef MCFICM_INTC1 52#ifdef MCFICM_INTC1
56 imraddr = (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0; 53 imraddr = (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0;
57#else 54#else
58 imraddr = MCFICM_INTC0; 55 imraddr = MCFICM_INTC0;
59#endif 56#endif
60 imraddr += (irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL; 57 imraddr += (irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL;
61 imrbit = 0x1 << (irq & 0x1f); 58 imrbit = 0x1 << (irq & 0x1f);
62 59
63 val = __raw_readl(imraddr); 60 val = __raw_readl(imraddr);
64 __raw_writel(val | imrbit, imraddr); 61 __raw_writel(val | imrbit, imraddr);
65 }
66} 62}
67 63
68static void intc_irq_unmask(struct irq_data *d) 64static void intc_irq_unmask(struct irq_data *d)
69{ 65{
70 unsigned int irq = d->irq; 66 unsigned int irq = d->irq - MCFINT_VECBASE;
67 unsigned long intaddr, imraddr, icraddr;
68 u32 val, imrbit;
71 69
72 if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + NR_VECS)) {
73 unsigned long intaddr, imraddr, icraddr;
74 u32 val, imrbit;
75
76 irq -= MCFINT_VECBASE;
77#ifdef MCFICM_INTC1 70#ifdef MCFICM_INTC1
78 intaddr = (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0; 71 intaddr = (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0;
79#else 72#else
80 intaddr = MCFICM_INTC0; 73 intaddr = MCFICM_INTC0;
81#endif 74#endif
82 imraddr = intaddr + ((irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL); 75 imraddr = intaddr + ((irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL);
83 icraddr = intaddr + MCFINTC_ICR0 + (irq & 0x3f); 76 icraddr = intaddr + MCFINTC_ICR0 + (irq & 0x3f);
84 imrbit = 0x1 << (irq & 0x1f); 77 imrbit = 0x1 << (irq & 0x1f);
85 78
86 /* Don't set the "maskall" bit! */ 79 /* Don't set the "maskall" bit! */
87 if ((irq & 0x20) == 0) 80 if ((irq & 0x20) == 0)
88 imrbit |= 0x1; 81 imrbit |= 0x1;
89 82
90 if (__raw_readb(icraddr) == 0) 83 if (__raw_readb(icraddr) == 0)
91 __raw_writeb(intc_intpri--, icraddr); 84 __raw_writeb(intc_intpri--, icraddr);
92 85
93 val = __raw_readl(imraddr); 86 val = __raw_readl(imraddr);
94 __raw_writel(val & ~imrbit, imraddr); 87 __raw_writel(val & ~imrbit, imraddr);
95 }
96} 88}
97 89
98static int intc_irq_set_type(struct irq_data *d, unsigned int type) 90static int intc_irq_set_type(struct irq_data *d, unsigned int type)
@@ -119,7 +111,7 @@ void __init init_IRQ(void)
119 __raw_writel(0x1, MCFICM_INTC1 + MCFINTC_IMRL); 111 __raw_writel(0x1, MCFICM_INTC1 + MCFINTC_IMRL);
120#endif 112#endif
121 113
122 for (irq = 0; (irq < NR_IRQS); irq++) { 114 for (irq = MCFINT_VECBASE; (irq < MCFINT_VECBASE + NR_VECS); irq++) {
123 set_irq_chip(irq, &intc_irq_chip); 115 set_irq_chip(irq, &intc_irq_chip);
124 set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH); 116 set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
125 set_irq_handler(irq, handle_level_irq); 117 set_irq_handler(irq, handle_level_irq);