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