aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh/timer.h
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-05-09 04:33:24 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-05-09 04:33:24 -0400
commit57be2b484a417bffae66359b9b89e7239480b729 (patch)
treed517f5b449b4f6b629790476082a4a7c478112bb /include/asm-sh/timer.h
parent1ce7ddd5f4cc754b6afe9eec5cee89ede75348ea (diff)
sh: clockevent/clocksource/hrtimers/nohz TMU support.
This adds basic support for clockevents and clocksources, presently only implemented for TMU-based systems (which are the majority of SH-3 and SH-4 systems). The old NO_IDLE_HZ implementation is also dropped completely, the only users of this were on TMU-based systems anyways. More work needs to be done to generalize the TMU handling, in that the current implementation is rather tied to the notion of TMU0 and TMU1 utilization. Additionally, as more SH timers switch over to this scheme, we'll be able to gut most of the remaining system timer infrastructure that existed before. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/asm-sh/timer.h')
-rw-r--r--include/asm-sh/timer.h25
1 files changed, 4 insertions, 21 deletions
diff --git a/include/asm-sh/timer.h b/include/asm-sh/timer.h
index 17b5e76a4c31..701ba84c7049 100644
--- a/include/asm-sh/timer.h
+++ b/include/asm-sh/timer.h
@@ -2,12 +2,14 @@
2#define __ASM_SH_TIMER_H 2#define __ASM_SH_TIMER_H
3 3
4#include <linux/sysdev.h> 4#include <linux/sysdev.h>
5#include <linux/clocksource.h>
5#include <asm/cpu/timer.h> 6#include <asm/cpu/timer.h>
6 7
7struct sys_timer_ops { 8struct sys_timer_ops {
8 int (*init)(void); 9 int (*init)(void);
9 int (*start)(void); 10 int (*start)(void);
10 int (*stop)(void); 11 int (*stop)(void);
12 cycle_t (*read)(void);
11#ifndef CONFIG_GENERIC_TIME 13#ifndef CONFIG_GENERIC_TIME
12 unsigned long (*get_offset)(void); 14 unsigned long (*get_offset)(void);
13#endif 15#endif
@@ -18,29 +20,8 @@ struct sys_timer {
18 20
19 struct sys_device dev; 21 struct sys_device dev;
20 struct sys_timer_ops *ops; 22 struct sys_timer_ops *ops;
21
22#ifdef CONFIG_NO_IDLE_HZ
23 struct dyn_tick_timer *dyn_tick;
24#endif
25}; 23};
26 24
27#ifdef CONFIG_NO_IDLE_HZ
28#define DYN_TICK_ENABLED (1 << 1)
29
30struct dyn_tick_timer {
31 spinlock_t lock;
32 unsigned int state; /* Current state */
33 int (*enable)(void); /* Enables dynamic tick */
34 int (*disable)(void); /* Disables dynamic tick */
35 void (*reprogram)(unsigned long); /* Reprograms the timer */
36 int (*handler)(int, void *);
37};
38
39void timer_dyn_reprogram(void);
40#else
41#define timer_dyn_reprogram() do { } while (0)
42#endif
43
44#define TICK_SIZE (tick_nsec / 1000) 25#define TICK_SIZE (tick_nsec / 1000)
45 26
46extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer; 27extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer;
@@ -58,5 +39,7 @@ struct sys_timer *get_sys_timer(void);
58 39
59/* arch/sh/kernel/time.c */ 40/* arch/sh/kernel/time.c */
60void handle_timer_tick(void); 41void handle_timer_tick(void);
42extern unsigned long sh_hpt_frequency;
43extern struct clocksource clocksource_sh;
61 44
62#endif /* __ASM_SH_TIMER_H */ 45#endif /* __ASM_SH_TIMER_H */