gemini: switch to 4.14
[oweals/openwrt.git] / target / linux / ramips / patches-4.14 / 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 --- a/arch/mips/ralink/Kconfig
13 +++ b/arch/mips/ralink/Kconfig
14 @@ -1,12 +1,17 @@
15  # SPDX-License-Identifier: GPL-2.0
16  if RALINK
17  
18 +config CEVT_SYSTICK_QUIRK
19 +       bool
20 +       default n
21 +
22  config CLKEVT_RT3352
23         bool
24         depends on SOC_RT305X || SOC_MT7620
25         default y
26         select TIMER_OF
27         select CLKSRC_MMIO
28 +       select CEVT_SYSTICK_QUIRK
29  
30  config RALINK_ILL_ACC
31         bool
32 --- a/arch/mips/kernel/cevt-r4k.c
33 +++ b/arch/mips/kernel/cevt-r4k.c
34 @@ -15,6 +15,26 @@
35  #include <asm/time.h>
36  #include <asm/cevt-r4k.h>
37  
38 +static int mips_state_oneshot(struct clock_event_device *evt)
39 +{
40 +       if (!cp0_timer_irq_installed) {
41 +               cp0_timer_irq_installed = 1;
42 +               setup_irq(evt->irq, &c0_compare_irqaction);
43 +       }
44 +
45 +       return 0;
46 +}
47 +
48 +static int mips_state_shutdown(struct clock_event_device *evt)
49 +{
50 +       if (cp0_timer_irq_installed) {
51 +               cp0_timer_irq_installed = 0;
52 +               remove_irq(evt->irq, &c0_compare_irqaction);
53 +       }
54 +
55 +       return 0;
56 +}
57 +
58  static int mips_next_event(unsigned long delta,
59                            struct clock_event_device *evt)
60  {
61 @@ -281,17 +301,21 @@ int r4k_clockevent_init(void)
62         cd->rating              = 300;
63         cd->irq                 = irq;
64         cd->cpumask             = cpumask_of(cpu);
65 +       cd->set_state_shutdown  = mips_state_shutdown;
66 +       cd->set_state_oneshot   = mips_state_oneshot;
67         cd->set_next_event      = mips_next_event;
68         cd->event_handler       = mips_event_handler;
69  
70         clockevents_config_and_register(cd, mips_hpt_frequency, min_delta, 0x7fffffff);
71  
72 +#ifndef CONFIG_CEVT_SYSTICK_QUIRK
73         if (cp0_timer_irq_installed)
74                 return 0;
75  
76         cp0_timer_irq_installed = 1;
77  
78         setup_irq(irq, &c0_compare_irqaction);
79 +#endif
80  
81         return 0;
82  }