blob: 4c3b66e30af23fccb48b2392b54ae5cbb581827c [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 Mundtf15cbe62008-07-29 08:09:44 +09006#include <cpu/timer.h>
Paul Mundtaa016662006-01-16 22:14:18 -08007
8struct sys_timer_ops {
9 int (*init)(void);
Andriy Skulysh3aa770e2006-09-27 16:20:22 +090010 int (*start)(void);
11 int (*stop)(void);
Paul Mundt45882142006-10-04 13:21:45 +090012#ifndef CONFIG_GENERIC_TIME
Paul Mundtaa016662006-01-16 22:14:18 -080013 unsigned long (*get_offset)(void);
Paul Mundt45882142006-10-04 13:21:45 +090014#endif
Paul Mundtaa016662006-01-16 22:14:18 -080015};
16
17struct sys_timer {
18 const char *name;
19
20 struct sys_device dev;
21 struct sys_timer_ops *ops;
22};
23
24#define TICK_SIZE (tick_nsec / 1000)
25
Paul Mundt710ee0c2006-11-05 16:48:42 +090026extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer;
Paul Mundtaa016662006-01-16 22:14:18 -080027extern struct sys_timer *sys_timer;
28
Paul Mundt45882142006-10-04 13:21:45 +090029#ifndef CONFIG_GENERIC_TIME
Paul Mundtaa016662006-01-16 22:14:18 -080030static inline unsigned long get_timer_offset(void)
31{
32 return sys_timer->ops->get_offset();
33}
Paul Mundt45882142006-10-04 13:21:45 +090034#endif
Paul Mundtaa016662006-01-16 22:14:18 -080035
Paul Mundtaa016662006-01-16 22:14:18 -080036/* arch/sh/kernel/timers/timer.c */
37struct sys_timer *get_sys_timer(void);
38
39/* arch/sh/kernel/time.c */
Paul Mundt35f3c512006-10-06 15:31:16 +090040void handle_timer_tick(void);
Magnus Damm955c0772009-01-22 09:55:31 +000041
42extern struct clocksource clocksource_sh;
Paul Mundtaa016662006-01-16 22:14:18 -080043
44#endif /* __ASM_SH_TIMER_H */