[CPUFREQ] Bug fix for acpi-cpufreq and cpufreq_stats oops on frequency change notific...
[linux-2.6/mini2440.git] / include / asm-sh / timer.h
blob17b5e76a4c3131471599b52bb3aea12ce78aad43
1 #ifndef __ASM_SH_TIMER_H
2 #define __ASM_SH_TIMER_H
4 #include <linux/sysdev.h>
5 #include <asm/cpu/timer.h>
7 struct sys_timer_ops {
8 int (*init)(void);
9 int (*start)(void);
10 int (*stop)(void);
11 #ifndef CONFIG_GENERIC_TIME
12 unsigned long (*get_offset)(void);
13 #endif
16 struct sys_timer {
17 const char *name;
19 struct sys_device dev;
20 struct sys_timer_ops *ops;
22 #ifdef CONFIG_NO_IDLE_HZ
23 struct dyn_tick_timer *dyn_tick;
24 #endif
27 #ifdef CONFIG_NO_IDLE_HZ
28 #define DYN_TICK_ENABLED (1 << 1)
30 struct 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 *);
39 void timer_dyn_reprogram(void);
40 #else
41 #define timer_dyn_reprogram() do { } while (0)
42 #endif
44 #define TICK_SIZE (tick_nsec / 1000)
46 extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer;
47 extern struct sys_timer *sys_timer;
49 #ifndef CONFIG_GENERIC_TIME
50 static inline unsigned long get_timer_offset(void)
52 return sys_timer->ops->get_offset();
54 #endif
56 /* arch/sh/kernel/timers/timer.c */
57 struct sys_timer *get_sys_timer(void);
59 /* arch/sh/kernel/time.c */
60 void handle_timer_tick(void);
62 #endif /* __ASM_SH_TIMER_H */