kernel: refresh patches
[openwrt.git] / target / linux / ramips / patches-3.14 / 0017-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch
1 From f8da5caf65926d44581d4e7914b28ceab3d28a7c Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sun, 14 Jul 2013 23:08:11 +0200
4 Subject: [PATCH 17/57] MIPS: use set_mode() to enable/disable the cevt-r4k
5  irq
6
7 Signed-off-by: John Crispin <blogic@openwrt.org>
8 ---
9  arch/mips/kernel/cevt-r4k.c |   37 +++++++++++++++++++++++++++++++------
10  1 file changed, 31 insertions(+), 6 deletions(-)
11
12 --- a/arch/mips/kernel/cevt-r4k.c
13 +++ b/arch/mips/kernel/cevt-r4k.c
14 @@ -38,12 +38,6 @@ static int mips_next_event(unsigned long
15  
16  #endif /* CONFIG_MIPS_MT_SMTC */
17  
18 -void mips_set_clock_mode(enum clock_event_mode mode,
19 -                               struct clock_event_device *evt)
20 -{
21 -       /* Nothing to do ...  */
22 -}
23 -
24  DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
25  int cp0_timer_irq_installed;
26  
27 @@ -90,9 +84,38 @@ struct irqaction c0_compare_irqaction = 
28         .name = "timer",
29  };
30  
31 +void mips_set_clock_mode(enum clock_event_mode mode,
32 +                               struct clock_event_device *evt)
33 +{
34 +#ifdef CONFIG_CEVT_SYSTICK_QUIRK
35 +       switch (mode) {
36 +       case CLOCK_EVT_MODE_ONESHOT:
37 +               if (cp0_timer_irq_installed)
38 +                       break;
39 +
40 +               cp0_timer_irq_installed = 1;
41 +
42 +               setup_irq(evt->irq, &c0_compare_irqaction);
43 +               break;
44 +
45 +       case CLOCK_EVT_MODE_SHUTDOWN:
46 +               if (!cp0_timer_irq_installed)
47 +                       break;
48 +
49 +               cp0_timer_irq_installed = 0;
50 +               free_irq(evt->irq, &c0_compare_irqaction);
51 +               break;
52 +
53 +       default:
54 +               pr_err("Unhandeled mips clock_mode\n");
55 +               break;
56 +       }
57 +#endif
58 +}
59  
60  void mips_event_handler(struct clock_event_device *dev)
61  {
62 +
63  }
64  
65  /*
66 @@ -215,12 +238,14 @@ int r4k_clockevent_init(void)
67  #endif
68         clockevents_register_device(cd);
69  
70 +#ifndef CONFIG_CEVT_SYSTICK_QUIRK
71         if (cp0_timer_irq_installed)
72                 return 0;
73  
74         cp0_timer_irq_installed = 1;
75  
76         setup_irq(irq, &c0_compare_irqaction);
77 +#endif
78  
79         return 0;
80  }