blob: 701ba84c7049305dd1e763efe671bfbf15ed9439 [file] [log] [blame]
Paul Mundtaa016662006-01-16 22:14:18 -08001#ifndef __ASM_SH_TIMER_H
2#define __ASM_SH_TIMER_H
3
4#include <linux/sysdev.h>
Paul Mundt57be2b42007-05-09 17:33:24 +09005#include <linux/clocksource.h>
Paul Mundtaa016662006-01-16 22:14:18 -08006#include <asm/cpu/timer.h>
7
8struct sys_timer_ops {
9 int (*init)(void);
Andriy Skulysh3aa770e2006-09-27 16:20:22 +090010 int (*start)(void);
11 int (*stop)(void);
Paul Mundt57be2b42007-05-09 17:33:24 +090012 cycle_t (*read)(void);
Paul Mundt45882142006-10-04 13:21:45 +090013#ifndef CONFIG_GENERIC_TIME
Paul Mundtaa016662006-01-16 22:14:18 -080014 unsigned long (*get_offset)(void);
Paul Mundt45882142006-10-04 13:21:45 +090015#endif
Paul Mundtaa016662006-01-16 22:14:18 -080016};
17
18struct sys_timer {
19 const char *name;
20
21 struct sys_device dev;
22 struct sys_timer_ops *ops;
23};
24
25#define TICK_SIZE (tick_nsec / 1000)
26
Paul Mundt710ee0c2006-11-05 16:48:42 +090027extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer;
Paul Mundtaa016662006-01-16 22:14:18 -080028extern struct sys_timer *sys_timer;
29
Paul Mundt45882142006-10-04 13:21:45 +090030#ifndef CONFIG_GENERIC_TIME
Paul Mundtaa016662006-01-16 22:14:18 -080031static inline unsigned long get_timer_offset(void)
32{
33 return sys_timer->ops->get_offset();
34}
Paul Mundt45882142006-10-04 13:21:45 +090035#endif
Paul Mundtaa016662006-01-16 22:14:18 -080036
Paul Mundtaa016662006-01-16 22:14:18 -080037/* arch/sh/kernel/timers/timer.c */
38struct sys_timer *get_sys_timer(void);
39
40/* arch/sh/kernel/time.c */
Paul Mundt35f3c512006-10-06 15:31:16 +090041void handle_timer_tick(void);
Paul Mundt57be2b42007-05-09 17:33:24 +090042extern unsigned long sh_hpt_frequency;
43extern struct clocksource clocksource_sh;
Paul Mundtaa016662006-01-16 22:14:18 -080044
45#endif /* __ASM_SH_TIMER_H */