aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mips-boards
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@mips.com>2006-09-12 14:12:18 -0400
committerRalf Baechle <ralf@linux-mips.org>2006-09-27 08:37:42 -0400
commitfc095a902181b72ce77a10feb7b36ba1cbacd736 (patch)
treefdd84f9ea29f26dea3ae340ca168e2a2df27b3be /arch/mips/mips-boards
parent3ee24e1b1e0b5ae413a85ba63677a7110915e3af (diff)
[MIPS] Atlas: update interrupt handling
The following change updates the Atlas interrupt handling to match that of Malta. Tested with a 5Kc and a 34Kf successfully. Signed-off-by: Maciej W. Rozycki <macro@mips.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/mips-boards')
-rw-r--r--arch/mips/mips-boards/atlas/atlas_int.c105
-rw-r--r--arch/mips/mips-boards/atlas/atlas_setup.c2
-rw-r--r--arch/mips/mips-boards/generic/time.c7
3 files changed, 92 insertions, 22 deletions
diff --git a/arch/mips/mips-boards/atlas/atlas_int.c b/arch/mips/mips-boards/atlas/atlas_int.c
index fb25e0377f11..a020a3cb4f4b 100644
--- a/arch/mips/mips-boards/atlas/atlas_int.c
+++ b/arch/mips/mips-boards/atlas/atlas_int.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * Carsten Langgaard, carstenl@mips.com 2 * Copyright (C) 1999, 2000, 2006 MIPS Technologies, Inc.
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. 3 * All rights reserved.
4 * Authors: Carsten Langgaard <carstenl@mips.com>
5 * Maciej W. Rozycki <macro@mips.com>
4 * 6 *
5 * ######################################################################## 7 * ########################################################################
6 * 8 *
@@ -25,17 +27,20 @@
25 */ 27 */
26#include <linux/compiler.h> 28#include <linux/compiler.h>
27#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/irq.h>
28#include <linux/sched.h> 31#include <linux/sched.h>
29#include <linux/slab.h> 32#include <linux/slab.h>
30#include <linux/interrupt.h> 33#include <linux/interrupt.h>
31#include <linux/kernel_stat.h> 34#include <linux/kernel_stat.h>
32 35
33#include <asm/irq.h> 36#include <asm/gdb-stub.h>
34#include <asm/io.h> 37#include <asm/io.h>
38#include <asm/irq_cpu.h>
39#include <asm/msc01_ic.h>
40
35#include <asm/mips-boards/atlas.h> 41#include <asm/mips-boards/atlas.h>
36#include <asm/mips-boards/atlasint.h> 42#include <asm/mips-boards/atlasint.h>
37#include <asm/gdb-stub.h> 43#include <asm/mips-boards/generic.h>
38
39 44
40static struct atlas_ictrl_regs *atlas_hw0_icregs; 45static struct atlas_ictrl_regs *atlas_hw0_icregs;
41 46
@@ -47,13 +52,13 @@ static struct atlas_ictrl_regs *atlas_hw0_icregs;
47 52
48void disable_atlas_irq(unsigned int irq_nr) 53void disable_atlas_irq(unsigned int irq_nr)
49{ 54{
50 atlas_hw0_icregs->intrsten = (1 << (irq_nr-ATLASINT_BASE)); 55 atlas_hw0_icregs->intrsten = 1 << (irq_nr - ATLAS_INT_BASE);
51 iob(); 56 iob();
52} 57}
53 58
54void enable_atlas_irq(unsigned int irq_nr) 59void enable_atlas_irq(unsigned int irq_nr)
55{ 60{
56 atlas_hw0_icregs->intseten = (1 << (irq_nr-ATLASINT_BASE)); 61 atlas_hw0_icregs->intseten = 1 << (irq_nr - ATLAS_INT_BASE);
57 iob(); 62 iob();
58} 63}
59 64
@@ -107,7 +112,7 @@ static inline void atlas_hw0_irqdispatch(struct pt_regs *regs)
107 if (unlikely(int_status == 0)) 112 if (unlikely(int_status == 0))
108 return; 113 return;
109 114
110 irq = ATLASINT_BASE + ls1bit32(int_status); 115 irq = ATLAS_INT_BASE + ls1bit32(int_status);
111 116
112 DEBUG_INT("atlas_hw0_irqdispatch: irq=%d\n", irq); 117 DEBUG_INT("atlas_hw0_irqdispatch: irq=%d\n", irq);
113 118
@@ -161,15 +166,14 @@ static inline unsigned int irq_ffs(unsigned int pending)
161} 166}
162 167
163/* 168/*
164 * IRQs on the Atlas board look basically (barring software IRQs which we 169 * IRQs on the Atlas board look basically like (all external interrupt
165 * don't use at all and all external interrupt sources are combined together 170 * sources are combined together on hardware interrupt 0 (MIPS IRQ 2)):
166 * on hardware interrupt 0 (MIPS IRQ 2)) like:
167 * 171 *
168 * MIPS IRQ Source 172 * MIPS IRQ Source
169 * -------- ------ 173 * -------- ------
170 * 0 Software (ignored) 174 * 0 Software 0 (reschedule IPI on MT)
171 * 1 Software (ignored) 175 * 1 Software 1 (remote call IPI on MT)
172 * 2 Combined hardware interrupt (hw0) 176 * 2 Combined Atlas hardware interrupt (hw0)
173 * 3 Hardware (ignored) 177 * 3 Hardware (ignored)
174 * 4 Hardware (ignored) 178 * 4 Hardware (ignored)
175 * 5 Hardware (ignored) 179 * 5 Hardware (ignored)
@@ -179,7 +183,7 @@ static inline unsigned int irq_ffs(unsigned int pending)
179 * We handle the IRQ according to _our_ priority which is: 183 * We handle the IRQ according to _our_ priority which is:
180 * 184 *
181 * Highest ---- R4k Timer 185 * Highest ---- R4k Timer
182 * Lowest ---- Combined hardware interrupt 186 * Lowest ---- Software 0
183 * 187 *
184 * then we just return, if multiple IRQs are pending then we will just take 188 * then we just return, if multiple IRQs are pending then we will just take
185 * another exception, big deal. 189 * another exception, big deal.
@@ -193,17 +197,19 @@ asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
193 197
194 if (irq == MIPSCPU_INT_ATLAS) 198 if (irq == MIPSCPU_INT_ATLAS)
195 atlas_hw0_irqdispatch(regs); 199 atlas_hw0_irqdispatch(regs);
196 else if (irq > 0) 200 else if (irq >= 0)
197 do_IRQ(MIPSCPU_INT_BASE + irq, regs); 201 do_IRQ(MIPSCPU_INT_BASE + irq, regs);
198 else 202 else
199 spurious_interrupt(regs); 203 spurious_interrupt(regs);
200} 204}
201 205
202void __init arch_init_irq(void) 206static inline void init_atlas_irqs (int base)
203{ 207{
204 int i; 208 int i;
205 209
206 atlas_hw0_icregs = (struct atlas_ictrl_regs *)ioremap (ATLAS_ICTRL_REGS_BASE, sizeof(struct atlas_ictrl_regs *)); 210 atlas_hw0_icregs = (struct atlas_ictrl_regs *)
211 ioremap(ATLAS_ICTRL_REGS_BASE,
212 sizeof(struct atlas_ictrl_regs *));
207 213
208 /* 214 /*
209 * Mask out all interrupt by writing "1" to all bit position in 215 * Mask out all interrupt by writing "1" to all bit position in
@@ -211,7 +217,7 @@ void __init arch_init_irq(void)
211 */ 217 */
212 atlas_hw0_icregs->intrsten = 0xffffffff; 218 atlas_hw0_icregs->intrsten = 0xffffffff;
213 219
214 for (i = ATLASINT_BASE; i <= ATLASINT_END; i++) { 220 for (i = ATLAS_INT_BASE; i <= ATLAS_INT_END; i++) {
215 irq_desc[i].status = IRQ_DISABLED; 221 irq_desc[i].status = IRQ_DISABLED;
216 irq_desc[i].action = 0; 222 irq_desc[i].action = 0;
217 irq_desc[i].depth = 1; 223 irq_desc[i].depth = 1;
@@ -219,3 +225,62 @@ void __init arch_init_irq(void)
219 spin_lock_init(&irq_desc[i].lock); 225 spin_lock_init(&irq_desc[i].lock);
220 } 226 }
221} 227}
228
229static struct irqaction atlasirq = {
230 .handler = no_action,
231 .name = "Atlas cascade"
232};
233
234msc_irqmap_t __initdata msc_irqmap[] = {
235 {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0},
236 {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0},
237};
238int __initdata msc_nr_irqs = sizeof(msc_irqmap) / sizeof(*msc_irqmap);
239
240msc_irqmap_t __initdata msc_eicirqmap[] = {
241 {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0},
242 {MSC01E_INT_SW1, MSC01_IRQ_LEVEL, 0},
243 {MSC01E_INT_ATLAS, MSC01_IRQ_LEVEL, 0},
244 {MSC01E_INT_TMR, MSC01_IRQ_EDGE, 0},
245 {MSC01E_INT_PCI, MSC01_IRQ_LEVEL, 0},
246 {MSC01E_INT_PERFCTR, MSC01_IRQ_LEVEL, 0},
247 {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0}
248};
249int __initdata msc_nr_eicirqs = sizeof(msc_eicirqmap) / sizeof(*msc_eicirqmap);
250
251void __init arch_init_irq(void)
252{
253 init_atlas_irqs(ATLAS_INT_BASE);
254
255 if (!cpu_has_veic)
256 mips_cpu_irq_init(MIPSCPU_INT_BASE);
257
258 switch(mips_revision_corid) {
259 case MIPS_REVISION_CORID_CORE_MSC:
260 case MIPS_REVISION_CORID_CORE_FPGA2:
261 case MIPS_REVISION_CORID_CORE_FPGA3:
262 case MIPS_REVISION_CORID_CORE_24K:
263 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
264 if (cpu_has_veic)
265 init_msc_irqs (MSC01E_INT_BASE,
266 msc_eicirqmap, msc_nr_eicirqs);
267 else
268 init_msc_irqs (MSC01C_INT_BASE,
269 msc_irqmap, msc_nr_irqs);
270 }
271
272
273 if (cpu_has_veic) {
274 set_vi_handler (MSC01E_INT_ATLAS, atlas_hw0_irqdispatch);
275 setup_irq (MSC01E_INT_BASE + MSC01E_INT_ATLAS, &atlasirq);
276 } else if (cpu_has_vint) {
277 set_vi_handler (MIPSCPU_INT_ATLAS, atlas_hw0_irqdispatch);
278#ifdef CONFIG_MIPS_MT_SMTC
279 setup_irq_smtc (MIPSCPU_INT_BASE + MIPSCPU_INT_ATLAS,
280 &atlasirq, (0x100 << MIPSCPU_INT_ATLAS));
281#else /* Not SMTC */
282 setup_irq(MIPSCPU_INT_BASE + MIPSCPU_INT_ATLAS, &atlasirq);
283#endif /* CONFIG_MIPS_MT_SMTC */
284 } else
285 setup_irq(MIPSCPU_INT_BASE + MIPSCPU_INT_ATLAS, &atlasirq);
286}
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
index 9871a91fdb07..0c6b0ce15028 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -77,7 +77,7 @@ static void __init serial_init(void)
77#else 77#else
78 s.iobase = ATLAS_UART_REGS_BASE+3; 78 s.iobase = ATLAS_UART_REGS_BASE+3;
79#endif 79#endif
80 s.irq = ATLASINT_UART; 80 s.irq = ATLAS_INT_UART;
81 s.uartclk = ATLAS_BASE_BAUD * 16; 81 s.uartclk = ATLAS_BASE_BAUD * 16;
82 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ; 82 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
83 s.iotype = UPIO_PORT; 83 s.iotype = UPIO_PORT;
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index de5798e1e015..8d15861fce61 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -41,8 +41,13 @@
41 41
42#include <asm/mips-boards/generic.h> 42#include <asm/mips-boards/generic.h>
43#include <asm/mips-boards/prom.h> 43#include <asm/mips-boards/prom.h>
44
45#ifdef CONFIG_MIPS_ATLAS
46#include <asm/mips-boards/atlasint.h>
47#endif
48#ifdef CONFIG_MIPS_MALTA
44#include <asm/mips-boards/maltaint.h> 49#include <asm/mips-boards/maltaint.h>
45#include <asm/mc146818-time.h> 50#endif
46 51
47unsigned long cpu_khz; 52unsigned long cpu_khz;
48 53