linux/atheros: add 2.6.38 preliminary support
[openwrt.git] / target / linux / atheros / patches-2.6.38 / 001-get_c0_compare_int_fix.patch
1 Fix the usage of get_c0_compare_int: override cp0_compare_irq if the returned
2 value is in the MIPS CPU IRQ range to ensure that c0_compare_int_usable()
3 still works.
4
5 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
6
7 --- a/arch/mips/kernel/cevt-r4k.c
8 +++ b/arch/mips/kernel/cevt-r4k.c
9 @@ -168,20 +168,23 @@ int __cpuinit r4k_clockevent_init(void)
10         struct clock_event_device *cd;
11         unsigned int irq;
12  
13 -       if (!cpu_has_counter || !mips_hpt_frequency)
14 -               return -ENXIO;
15 -
16 -       if (!c0_compare_int_usable())
17 -               return -ENXIO;
18 -
19         /*
20          * With vectored interrupts things are getting platform specific.
21          * get_c0_compare_int is a hook to allow a platform to return the
22          * interrupt number of it's liking.
23          */
24         irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
25 -       if (get_c0_compare_int)
26 +       if (get_c0_compare_int) {
27                 irq = get_c0_compare_int();
28 +               if ((irq >= MIPS_CPU_IRQ_BASE) && (irq < MIPS_CPU_IRQ_BASE + 8))
29 +                       cp0_compare_irq = irq - MIPS_CPU_IRQ_BASE;
30 +       }
31 +
32 +       if (!cpu_has_counter || !mips_hpt_frequency)
33 +               return -ENXIO;
34 +
35 +       if (!c0_compare_int_usable())
36 +               return -ENXIO;
37  
38         cd = &per_cpu(mips_clockevent_device, cpu);
39