diff options
Diffstat (limited to 'arch/sh/kernel/time.c')
-rw-r--r-- | arch/sh/kernel/time.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c index 8acd70bffe76..149d9713eddf 100644 --- a/arch/sh/kernel/time.c +++ b/arch/sh/kernel/time.c | |||
@@ -3,13 +3,12 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka | 4 | * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka |
5 | * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> | 5 | * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> |
6 | * Copyright (C) 2002, 2003, 2004, 2005 Paul Mundt | 6 | * Copyright (C) 2002 - 2006 Paul Mundt |
7 | * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org> | 7 | * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org> |
8 | * | 8 | * |
9 | * Some code taken from i386 version. | 9 | * Some code taken from i386 version. |
10 | * Copyright (C) 1991, 1992, 1995 Linus Torvalds | 10 | * Copyright (C) 1991, 1992, 1995 Linus Torvalds |
11 | */ | 11 | */ |
12 | |||
13 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
14 | #include <linux/module.h> | 13 | #include <linux/module.h> |
15 | #include <linux/init.h> | 14 | #include <linux/init.h> |
@@ -26,15 +25,20 @@ struct sys_timer *sys_timer; | |||
26 | DEFINE_SPINLOCK(rtc_lock); | 25 | DEFINE_SPINLOCK(rtc_lock); |
27 | EXPORT_SYMBOL(rtc_lock); | 26 | EXPORT_SYMBOL(rtc_lock); |
28 | 27 | ||
29 | /* XXX: Can we initialize this in a routine somewhere? Dreamcast doesn't want | 28 | /* Dummy RTC ops */ |
30 | * these routines anywhere... */ | 29 | static void null_rtc_get_time(struct timespec *tv) |
31 | #ifdef CONFIG_SH_RTC | 30 | { |
32 | void (*rtc_sh_get_time)(struct timespec *) = sh_rtc_gettimeofday; | 31 | tv->tv_sec = mktime(2000, 1, 1, 0, 0, 0); |
33 | int (*rtc_sh_set_time)(const time_t) = sh_rtc_settimeofday; | 32 | tv->tv_nsec = 0; |
34 | #else | 33 | } |
35 | void (*rtc_sh_get_time)(struct timespec *); | 34 | |
36 | int (*rtc_sh_set_time)(const time_t); | 35 | static int null_rtc_set_time(const time_t secs) |
37 | #endif | 36 | { |
37 | return 0; | ||
38 | } | ||
39 | |||
40 | void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time; | ||
41 | int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time; | ||
38 | 42 | ||
39 | /* | 43 | /* |
40 | * Scheduler clock - returns current time in nanosec units. | 44 | * Scheduler clock - returns current time in nanosec units. |
@@ -70,7 +74,6 @@ void do_gettimeofday(struct timeval *tv) | |||
70 | tv->tv_sec = sec; | 74 | tv->tv_sec = sec; |
71 | tv->tv_usec = usec; | 75 | tv->tv_usec = usec; |
72 | } | 76 | } |
73 | |||
74 | EXPORT_SYMBOL(do_gettimeofday); | 77 | EXPORT_SYMBOL(do_gettimeofday); |
75 | 78 | ||
76 | int do_settimeofday(struct timespec *tv) | 79 | int do_settimeofday(struct timespec *tv) |
@@ -103,7 +106,6 @@ int do_settimeofday(struct timespec *tv) | |||
103 | 106 | ||
104 | return 0; | 107 | return 0; |
105 | } | 108 | } |
106 | |||
107 | EXPORT_SYMBOL(do_settimeofday); | 109 | EXPORT_SYMBOL(do_settimeofday); |
108 | 110 | ||
109 | /* last time the RTC clock got updated */ | 111 | /* last time the RTC clock got updated */ |
@@ -181,7 +183,6 @@ static int __init timer_init_sysfs(void) | |||
181 | sys_timer->dev.cls = &timer_sysclass; | 183 | sys_timer->dev.cls = &timer_sysclass; |
182 | return sysdev_register(&sys_timer->dev); | 184 | return sysdev_register(&sys_timer->dev); |
183 | } | 185 | } |
184 | |||
185 | device_initcall(timer_init_sysfs); | 186 | device_initcall(timer_init_sysfs); |
186 | 187 | ||
187 | void (*board_time_init)(void); | 188 | void (*board_time_init)(void); |
@@ -193,15 +194,9 @@ void __init time_init(void) | |||
193 | 194 | ||
194 | clk_init(); | 195 | clk_init(); |
195 | 196 | ||
196 | if (rtc_sh_get_time) { | 197 | rtc_sh_get_time(&xtime); |
197 | rtc_sh_get_time(&xtime); | 198 | set_normalized_timespec(&wall_to_monotonic, |
198 | } else { | 199 | -xtime.tv_sec, -xtime.tv_nsec); |
199 | xtime.tv_sec = mktime(2000, 1, 1, 0, 0, 0); | ||
200 | xtime.tv_nsec = 0; | ||
201 | } | ||
202 | |||
203 | set_normalized_timespec(&wall_to_monotonic, | ||
204 | -xtime.tv_sec, -xtime.tv_nsec); | ||
205 | 200 | ||
206 | /* | 201 | /* |
207 | * Find the timer to use as the system timer, it will be | 202 | * Find the timer to use as the system timer, it will be |