Paul Mundt | aa01666 | 2006-01-16 22:14:18 -0800 | [diff] [blame] | 1 | #ifndef __ASM_SH_TIMER_H |
| 2 | #define __ASM_SH_TIMER_H |
| 3 | |
| 4 | #include <linux/sysdev.h> |
Paul Mundt | 57be2b4 | 2007-05-09 17:33:24 +0900 | [diff] [blame^] | 5 | #include <linux/clocksource.h> |
Paul Mundt | aa01666 | 2006-01-16 22:14:18 -0800 | [diff] [blame] | 6 | #include <asm/cpu/timer.h> |
| 7 | |
| 8 | struct sys_timer_ops { |
| 9 | int (*init)(void); |
Andriy Skulysh | 3aa770e | 2006-09-27 16:20:22 +0900 | [diff] [blame] | 10 | int (*start)(void); |
| 11 | int (*stop)(void); |
Paul Mundt | 57be2b4 | 2007-05-09 17:33:24 +0900 | [diff] [blame^] | 12 | cycle_t (*read)(void); |
Paul Mundt | 4588214 | 2006-10-04 13:21:45 +0900 | [diff] [blame] | 13 | #ifndef CONFIG_GENERIC_TIME |
Paul Mundt | aa01666 | 2006-01-16 22:14:18 -0800 | [diff] [blame] | 14 | unsigned long (*get_offset)(void); |
Paul Mundt | 4588214 | 2006-10-04 13:21:45 +0900 | [diff] [blame] | 15 | #endif |
Paul Mundt | aa01666 | 2006-01-16 22:14:18 -0800 | [diff] [blame] | 16 | }; |
| 17 | |
| 18 | struct 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 Mundt | 710ee0c | 2006-11-05 16:48:42 +0900 | [diff] [blame] | 27 | extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer; |
Paul Mundt | aa01666 | 2006-01-16 22:14:18 -0800 | [diff] [blame] | 28 | extern struct sys_timer *sys_timer; |
| 29 | |
Paul Mundt | 4588214 | 2006-10-04 13:21:45 +0900 | [diff] [blame] | 30 | #ifndef CONFIG_GENERIC_TIME |
Paul Mundt | aa01666 | 2006-01-16 22:14:18 -0800 | [diff] [blame] | 31 | static inline unsigned long get_timer_offset(void) |
| 32 | { |
| 33 | return sys_timer->ops->get_offset(); |
| 34 | } |
Paul Mundt | 4588214 | 2006-10-04 13:21:45 +0900 | [diff] [blame] | 35 | #endif |
Paul Mundt | aa01666 | 2006-01-16 22:14:18 -0800 | [diff] [blame] | 36 | |
Paul Mundt | aa01666 | 2006-01-16 22:14:18 -0800 | [diff] [blame] | 37 | /* arch/sh/kernel/timers/timer.c */ |
| 38 | struct sys_timer *get_sys_timer(void); |
| 39 | |
| 40 | /* arch/sh/kernel/time.c */ |
Paul Mundt | 35f3c51 | 2006-10-06 15:31:16 +0900 | [diff] [blame] | 41 | void handle_timer_tick(void); |
Paul Mundt | 57be2b4 | 2007-05-09 17:33:24 +0900 | [diff] [blame^] | 42 | extern unsigned long sh_hpt_frequency; |
| 43 | extern struct clocksource clocksource_sh; |
Paul Mundt | aa01666 | 2006-01-16 22:14:18 -0800 | [diff] [blame] | 44 | |
| 45 | #endif /* __ASM_SH_TIMER_H */ |