diff options
author | David VomLehn <dvomlehn@cisco.com> | 2009-12-21 20:49:22 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-01-27 18:03:31 -0500 |
commit | 010c108d7af708d9e09b83724a058a76803fbc66 (patch) | |
tree | 6b7108e6852b0306ecd686a8ce9b9ae5733985fa /arch/mips | |
parent | 59dfa2fcaecc39fb88bfa196cb15adca7146867a (diff) |
MIPS: PowerTV: Fix support for timer interrupts with > 64 external IRQs
The MIPS processor is limited to 64 external interrupt sources. Using a
greater number without IRQ sharing requires reading platform-specific
registers. On such platforms, reading the IntCtl register to determine
which interrupt corresponds to a timer interrupt will not work.
On MIPSR2 systems there is a solution - the TI bit in the Cause register,
specifically indicates that a timer interrupt has occured. This patch uses
that bit to detect interrupts for MIPSR2 processors, which may be expected
to work regardless of how the timer interrupt may be routed in the hardware.
Signed-off-by: David VomLehn (dvomlehn@cisco.com)
To: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/804/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/include/asm/irq.h | 1 | ||||
-rw-r--r-- | arch/mips/include/asm/mipsregs.h | 12 | ||||
-rw-r--r-- | arch/mips/kernel/cevt-r4k.c | 2 | ||||
-rw-r--r-- | arch/mips/kernel/traps.c | 6 |
4 files changed, 18 insertions, 3 deletions
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h index 06960364c96b..dea4aed6478f 100644 --- a/arch/mips/include/asm/irq.h +++ b/arch/mips/include/asm/irq.h | |||
@@ -135,6 +135,7 @@ extern void free_irqno(unsigned int irq); | |||
135 | #define CP0_LEGACY_COMPARE_IRQ 7 | 135 | #define CP0_LEGACY_COMPARE_IRQ 7 |
136 | 136 | ||
137 | extern int cp0_compare_irq; | 137 | extern int cp0_compare_irq; |
138 | extern int cp0_compare_irq_shift; | ||
138 | extern int cp0_perfcount_irq; | 139 | extern int cp0_perfcount_irq; |
139 | 140 | ||
140 | #endif /* _ASM_IRQ_H */ | 141 | #endif /* _ASM_IRQ_H */ |
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index a581d60cbcc2..f4ab3139d737 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -406,6 +406,16 @@ | |||
406 | #define ST0_XX 0x80000000 /* MIPS IV naming */ | 406 | #define ST0_XX 0x80000000 /* MIPS IV naming */ |
407 | 407 | ||
408 | /* | 408 | /* |
409 | * Bitfields and bit numbers in the coprocessor 0 IntCtl register. (MIPSR2) | ||
410 | * | ||
411 | * Refer to your MIPS R4xx0 manual, chapter 5 for explanation. | ||
412 | */ | ||
413 | #define INTCTLB_IPPCI 26 | ||
414 | #define INTCTLF_IPPCI (_ULCAST_(7) << INTCTLB_IPPCI) | ||
415 | #define INTCTLB_IPTI 29 | ||
416 | #define INTCTLF_IPTI (_ULCAST_(7) << INTCTLB_IPTI) | ||
417 | |||
418 | /* | ||
409 | * Bitfields and bit numbers in the coprocessor 0 cause register. | 419 | * Bitfields and bit numbers in the coprocessor 0 cause register. |
410 | * | 420 | * |
411 | * Refer to your MIPS R4xx0 manual, chapter 5 for explanation. | 421 | * Refer to your MIPS R4xx0 manual, chapter 5 for explanation. |
@@ -434,6 +444,8 @@ | |||
434 | #define CAUSEF_IV (_ULCAST_(1) << 23) | 444 | #define CAUSEF_IV (_ULCAST_(1) << 23) |
435 | #define CAUSEB_CE 28 | 445 | #define CAUSEB_CE 28 |
436 | #define CAUSEF_CE (_ULCAST_(3) << 28) | 446 | #define CAUSEF_CE (_ULCAST_(3) << 28) |
447 | #define CAUSEB_TI 30 | ||
448 | #define CAUSEF_TI (_ULCAST_(1) << 30) | ||
437 | #define CAUSEB_BD 31 | 449 | #define CAUSEB_BD 31 |
438 | #define CAUSEF_BD (_ULCAST_(1) << 31) | 450 | #define CAUSEF_BD (_ULCAST_(1) << 31) |
439 | 451 | ||
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c index b469ad05d520..0b2450ceb13f 100644 --- a/arch/mips/kernel/cevt-r4k.c +++ b/arch/mips/kernel/cevt-r4k.c | |||
@@ -97,7 +97,7 @@ void mips_event_handler(struct clock_event_device *dev) | |||
97 | */ | 97 | */ |
98 | static int c0_compare_int_pending(void) | 98 | static int c0_compare_int_pending(void) |
99 | { | 99 | { |
100 | return (read_c0_cause() >> cp0_compare_irq) & 0x100; | 100 | return (read_c0_cause() >> cp0_compare_irq_shift) & (1ul << CAUSEB_IP); |
101 | } | 101 | } |
102 | 102 | ||
103 | /* | 103 | /* |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 308e43460864..338dfe8ed002 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -1403,6 +1403,7 @@ extern void flush_tlb_handlers(void); | |||
1403 | * Timer interrupt | 1403 | * Timer interrupt |
1404 | */ | 1404 | */ |
1405 | int cp0_compare_irq; | 1405 | int cp0_compare_irq; |
1406 | int cp0_compare_irq_shift; | ||
1406 | 1407 | ||
1407 | /* | 1408 | /* |
1408 | * Performance counter IRQ or -1 if shared with timer | 1409 | * Performance counter IRQ or -1 if shared with timer |
@@ -1493,8 +1494,9 @@ void __cpuinit per_cpu_trap_init(void) | |||
1493 | * o read IntCtl.IPPCI to determine the performance counter interrupt | 1494 | * o read IntCtl.IPPCI to determine the performance counter interrupt |
1494 | */ | 1495 | */ |
1495 | if (cpu_has_mips_r2) { | 1496 | if (cpu_has_mips_r2) { |
1496 | cp0_compare_irq = (read_c0_intctl() >> 29) & 7; | 1497 | cp0_compare_irq_shift = CAUSEB_TI - CAUSEB_IP; |
1497 | cp0_perfcount_irq = (read_c0_intctl() >> 26) & 7; | 1498 | cp0_compare_irq = (read_c0_intctl() >> INTCTLB_IPTI) & 7; |
1499 | cp0_perfcount_irq = (read_c0_intctl() >> INTCTLB_IPPCI) & 7; | ||
1498 | if (cp0_perfcount_irq == cp0_compare_irq) | 1500 | if (cp0_perfcount_irq == cp0_compare_irq) |
1499 | cp0_perfcount_irq = -1; | 1501 | cp0_perfcount_irq = -1; |
1500 | } else { | 1502 | } else { |