aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/time.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-27 04:45:01 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 04:45:01 -0400
commit91550f715b7f7707b5ab5b9b0cd455bda8505954 (patch)
tree252b23d87eb62562f16e95d24761f03a9d82ede0 /arch/sh/kernel/time.c
parent51e22e7a05c1c6f2e38ac7459d3404e32e543b75 (diff)
sh: Kill off the rest of the legacy rtc mess.
With the new RTC class driver, we can get rid of most of the old left over cruft. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/time.c')
-rw-r--r--arch/sh/kernel/time.c41
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;
26DEFINE_SPINLOCK(rtc_lock); 25DEFINE_SPINLOCK(rtc_lock);
27EXPORT_SYMBOL(rtc_lock); 26EXPORT_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... */ 29static void null_rtc_get_time(struct timespec *tv)
31#ifdef CONFIG_SH_RTC 30{
32void (*rtc_sh_get_time)(struct timespec *) = sh_rtc_gettimeofday; 31 tv->tv_sec = mktime(2000, 1, 1, 0, 0, 0);
33int (*rtc_sh_set_time)(const time_t) = sh_rtc_settimeofday; 32 tv->tv_nsec = 0;
34#else 33}
35void (*rtc_sh_get_time)(struct timespec *); 34
36int (*rtc_sh_set_time)(const time_t); 35static int null_rtc_set_time(const time_t secs)
37#endif 36{
37 return 0;
38}
39
40void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time;
41int (*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
74EXPORT_SYMBOL(do_gettimeofday); 77EXPORT_SYMBOL(do_gettimeofday);
75 78
76int do_settimeofday(struct timespec *tv) 79int 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
107EXPORT_SYMBOL(do_settimeofday); 109EXPORT_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
185device_initcall(timer_init_sysfs); 186device_initcall(timer_init_sysfs);
186 187
187void (*board_time_init)(void); 188void (*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