summaryrefslogtreecommitdiff
path: root/target/linux/ramips/patches-4.3/0005-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch
blob: fe918e6fd30e97b068fe5f8f753a6cd6f570b7a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
From ce3d4a4111a5f7e6b4e74bceae5faa6ce388e8ec Mon Sep 17 00:00:00 2001
From: John Crispin <blogic@openwrt.org>
Date: Sun, 14 Jul 2013 23:08:11 +0200
Subject: [PATCH 05/53] MIPS: use set_mode() to enable/disable the cevt-r4k
 irq

Signed-off-by: John Crispin <blogic@openwrt.org>
---
 arch/mips/ralink/Kconfig |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig
index d078e61..c2778f2 100644
--- a/arch/mips/ralink/Kconfig
+++ b/arch/mips/ralink/Kconfig
@@ -1,11 +1,16 @@
 if RALINK
 
+config CEVT_SYSTICK_QUIRK
+	bool
+	default n
+
 config CLKEVT_RT3352
 	bool
 	depends on SOC_RT305X || SOC_MT7620
 	default y
 	select CLKSRC_OF
 	select CLKSRC_MMIO
+	select CEVT_SYSTICK_QUIRK
 
 config RALINK_ILL_ACC
 	bool
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -15,6 +15,26 @@
 #include <asm/time.h>
 #include <asm/cevt-r4k.h>
 
+static int mips_state_oneshot(struct clock_event_device *evt)
+{
+	if (!cp0_timer_irq_installed) {
+		cp0_timer_irq_installed = 1;
+		setup_irq(evt->irq, &c0_compare_irqaction);
+	}
+
+	return 0;
+}
+
+static int mips_state_shutdown(struct clock_event_device *evt)
+{
+	if (cp0_timer_irq_installed) {
+		cp0_timer_irq_installed = 0;
+		remove_irq(evt->irq, &c0_compare_irqaction);
+	}
+
+	return 0;
+}
+
 static int mips_next_event(unsigned long delta,
 			   struct clock_event_device *evt)
 {
@@ -208,18 +228,21 @@
 	cd->rating		= 300;
 	cd->irq			= irq;
 	cd->cpumask		= cpumask_of(cpu);
+	cd->set_state_shutdown	= mips_state_shutdown;
+	cd->set_state_oneshot	= mips_state_oneshot;
 	cd->set_next_event	= mips_next_event;
 	cd->event_handler	= mips_event_handler;
 
 	clockevents_register_device(cd);
 
+#ifndef CONFIG_CEVT_SYSTICK_QUIRK
 	if (cp0_timer_irq_installed)
 		return 0;
 
 	cp0_timer_irq_installed = 1;
 
 	setup_irq(irq, &c0_compare_irqaction);
-
+#endif
 	return 0;
 }
 
--
1.7.10.4