fe918e6fd30e97b068fe5f8f753a6cd6f570b7a5
[openwrt.git] / target / linux / ramips / patches-4.3 / 0005-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch
1 From ce3d4a4111a5f7e6b4e74bceae5faa6ce388e8ec 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 05/53] 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/ralink/Kconfig |    5 +++++
10  1 file changed, 5 insertions(+)
11
12 diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig
13 index d078e61..c2778f2 100644
14 --- a/arch/mips/ralink/Kconfig
15 +++ b/arch/mips/ralink/Kconfig
16 @@ -1,11 +1,16 @@
17  if RALINK
18  
19 +config CEVT_SYSTICK_QUIRK
20 +       bool
21 +       default n
22 +
23  config CLKEVT_RT3352
24         bool
25         depends on SOC_RT305X || SOC_MT7620
26         default y
27         select CLKSRC_OF
28         select CLKSRC_MMIO
29 +       select CEVT_SYSTICK_QUIRK
30  
31  config RALINK_ILL_ACC
32         bool
33 --- a/arch/mips/kernel/cevt-r4k.c
34 +++ b/arch/mips/kernel/cevt-r4k.c
35 @@ -15,6 +15,26 @@
36  #include <asm/time.h>
37  #include <asm/cevt-r4k.h>
38  
39 +static int mips_state_oneshot(struct clock_event_device *evt)
40 +{
41 +       if (!cp0_timer_irq_installed) {
42 +               cp0_timer_irq_installed = 1;
43 +               setup_irq(evt->irq, &c0_compare_irqaction);
44 +       }
45 +
46 +       return 0;
47 +}
48 +
49 +static int mips_state_shutdown(struct clock_event_device *evt)
50 +{
51 +       if (cp0_timer_irq_installed) {
52 +               cp0_timer_irq_installed = 0;
53 +               remove_irq(evt->irq, &c0_compare_irqaction);
54 +       }
55 +
56 +       return 0;
57 +}
58 +
59  static int mips_next_event(unsigned long delta,
60                            struct clock_event_device *evt)
61  {
62 @@ -208,18 +228,21 @@
63         cd->rating              = 300;
64         cd->irq                 = irq;
65         cd->cpumask             = cpumask_of(cpu);
66 +       cd->set_state_shutdown  = mips_state_shutdown;
67 +       cd->set_state_oneshot   = mips_state_oneshot;
68         cd->set_next_event      = mips_next_event;
69         cd->event_handler       = mips_event_handler;
70  
71         clockevents_register_device(cd);
72  
73 +#ifndef CONFIG_CEVT_SYSTICK_QUIRK
74         if (cp0_timer_irq_installed)
75                 return 0;
76  
77         cp0_timer_irq_installed = 1;
78  
79         setup_irq(irq, &c0_compare_irqaction);
80 -
81 +#endif
82         return 0;
83  }
84  
85 --
86 1.7.10.4
87
88