aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300
diff options
context:
space:
mode:
Diffstat (limited to 'arch/h8300')
-rw-r--r--arch/h8300/Kconfig4
-rw-r--r--arch/h8300/kernel/time.c52
2 files changed, 4 insertions, 52 deletions
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 1734d96422c6..86f6ca36363f 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -53,6 +53,10 @@ config GENERIC_CALIBRATE_DELAY
53 bool 53 bool
54 default y 54 default y
55 55
56config GENERIC_TIME
57 bool
58 default y
59
56config TIME_LOW_RES 60config TIME_LOW_RES
57 bool 61 bool
58 default y 62 default y
diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c
index d1ef615ba895..91d3b56ddc68 100644
--- a/arch/h8300/kernel/time.c
+++ b/arch/h8300/kernel/time.c
@@ -66,55 +66,3 @@ void time_init(void)
66 66
67 platform_timer_setup(timer_interrupt); 67 platform_timer_setup(timer_interrupt);
68} 68}
69
70/*
71 * This version of gettimeofday has near microsecond resolution.
72 */
73void do_gettimeofday(struct timeval *tv)
74{
75 unsigned long flags;
76 unsigned long usec, sec;
77
78 read_lock_irqsave(&xtime_lock, flags);
79 usec = 0;
80 sec = xtime.tv_sec;
81 usec += (xtime.tv_nsec / 1000);
82 read_unlock_irqrestore(&xtime_lock, flags);
83
84 while (usec >= 1000000) {
85 usec -= 1000000;
86 sec++;
87 }
88
89 tv->tv_sec = sec;
90 tv->tv_usec = usec;
91}
92
93EXPORT_SYMBOL(do_gettimeofday);
94
95int do_settimeofday(struct timespec *tv)
96{
97 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
98 return -EINVAL;
99
100 write_lock_irq(&xtime_lock);
101 /* This is revolting. We need to set the xtime.tv_usec
102 * correctly. However, the value in this location is
103 * is value at the last tick.
104 * Discover what correction gettimeofday
105 * would have done, and then undo it!
106 */
107 while (tv->tv_nsec < 0) {
108 tv->tv_nsec += NSEC_PER_SEC;
109 tv->tv_sec--;
110 }
111
112 xtime.tv_sec = tv->tv_sec;
113 xtime.tv_nsec = tv->tv_nsec;
114 ntp_clear();
115 write_sequnlock_irq(&xtime_lock);
116 clock_was_set();
117 return 0;
118}
119
120EXPORT_SYMBOL(do_settimeofday);