[ifxmips]:
[openwrt/svn-archive/archive.git] / target / linux / ifxmips / patches / 000-mips-bad-intctl.patch
1 --- a/arch/mips/kernel/traps.c
2 +++ b/arch/mips/kernel/traps.c
3 @@ -1496,7 +1496,18 @@ void __cpuinit per_cpu_trap_init(void)
4 if (cpu_has_mips_r2) {
5 cp0_compare_irq_shift = CAUSEB_TI - CAUSEB_IP;
6 cp0_compare_irq = (read_c0_intctl() >> INTCTLB_IPTI) & 7;
7 +
8 + if (!cp0_compare_irq)
9 + cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
10 +
11 cp0_perfcount_irq = (read_c0_intctl() >> INTCTLB_IPPCI) & 7;
12 +
13 + if (!cp0_perfcount_irq)
14 + cp0_perfcount_irq = CP0_LEGACY_PERFCNT_IRQ;
15 +
16 + if (arch_fixup_c0_irqs)
17 + arch_fixup_c0_irqs();
18 +
19 if (cp0_perfcount_irq == cp0_compare_irq)
20 cp0_perfcount_irq = -1;
21 } else {
22 --- a/arch/mips/include/asm/irq.h
23 +++ b/arch/mips/include/asm/irq.h
24 @@ -133,9 +133,11 @@ extern void free_irqno(unsigned int irq)
25 * IE7. Since R2 their number has to be read from the c0_intctl register.
26 */
27 #define CP0_LEGACY_COMPARE_IRQ 7
28 +#define CP0_LEGACY_PERFCNT_IRQ 7
29
30 extern int cp0_compare_irq;
31 extern int cp0_compare_irq_shift;
32 extern int cp0_perfcount_irq;
33 +extern void __weak arch_fixup_c0_irqs(void);
34
35 #endif /* _ASM_IRQ_H */