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
7 Signed-off-by: John Crispin <blogic@openwrt.org>
9 arch/mips/ralink/Kconfig | 5 +++++
10 1 file changed, 5 insertions(+)
12 --- a/arch/mips/ralink/Kconfig
13 +++ b/arch/mips/ralink/Kconfig
15 # SPDX-License-Identifier: GPL-2.0
18 +config CEVT_SYSTICK_QUIRK
24 depends on SOC_RT305X || SOC_MT7620
28 + select CEVT_SYSTICK_QUIRK
32 --- a/arch/mips/kernel/cevt-r4k.c
33 +++ b/arch/mips/kernel/cevt-r4k.c
36 #include <asm/cevt-r4k.h>
38 +#ifdef CONFIG_CEVT_SYSTICK_QUIRK
39 +static int mips_state_oneshot(struct clock_event_device *evt)
41 + unsigned long flags = IRQF_PERCPU | IRQF_TIMER | IRQF_SHARED;
42 + if (!cp0_timer_irq_installed) {
43 + cp0_timer_irq_installed = 1;
44 + if (request_irq(evt->irq, c0_compare_interrupt, flags, "timer",
45 + c0_compare_interrupt))
46 + pr_err("Failed to request irq %d (timer)\n", evt->irq);
52 +static int mips_state_shutdown(struct clock_event_device *evt)
54 + if (cp0_timer_irq_installed) {
55 + cp0_timer_irq_installed = 0;
56 + free_irq(evt->irq, NULL);
63 static int mips_next_event(unsigned long delta,
64 struct clock_event_device *evt)
66 @@ -292,7 +317,9 @@ core_initcall(r4k_register_cpufreq_notif
68 int r4k_clockevent_init(void)
70 +#ifndef CONFIG_CEVT_SYSTICK_QUIRK
71 unsigned long flags = IRQF_PERCPU | IRQF_TIMER | IRQF_SHARED;
73 unsigned int cpu = smp_processor_id();
74 struct clock_event_device *cd;
75 unsigned int irq, min_delta;
76 @@ -322,11 +349,16 @@ int r4k_clockevent_init(void)
79 cd->cpumask = cpumask_of(cpu);
80 +#ifdef CONFIG_CEVT_SYSTICK_QUIRK
81 + cd->set_state_shutdown = mips_state_shutdown;
82 + cd->set_state_oneshot = mips_state_oneshot;
84 cd->set_next_event = mips_next_event;
85 cd->event_handler = mips_event_handler;
87 clockevents_config_and_register(cd, mips_hpt_frequency, min_delta, 0x7fffffff);
89 +#ifndef CONFIG_CEVT_SYSTICK_QUIRK
90 if (cp0_timer_irq_installed)
93 @@ -335,6 +367,7 @@ int r4k_clockevent_init(void)
94 if (request_irq(irq, c0_compare_interrupt, flags, "timer",
95 c0_compare_interrupt))
96 pr_err("Failed to request irq %d (timer)\n", irq);