aboutsummaryrefslogtreecommitdiffstats
path: root/arch/v850/kernel
diff options
context:
space:
mode:
authorjohn stultz <johnstul@us.ibm.com>2007-05-06 17:51:53 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:13:04 -0400
commitee17b36fd0dc2af37ea92548595e30964674ded8 (patch)
treecfb2d5fe67802eac1c46d5542df86f237e1bcf1c /arch/v850/kernel
parentc2f239d93e8af991392871c57465cb2ac556b482 (diff)
v850: generic timekeeping conversion
Convert an arch that does not currently implement sub-jiffy timekeeping to use the generic timekeeping code. v850 looks like it has some intent to implement sub-jiffy timekeeping, so it may not yet be appropriate to try to convert, but I figured I'd get the maintainer's input and submit the patch for comment. Signed-off-by: John Stultz <johnstul@us.ibm.com> Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/v850/kernel')
-rw-r--r--arch/v850/kernel/time.c75
1 files changed, 0 insertions, 75 deletions
diff --git a/arch/v850/kernel/time.c b/arch/v850/kernel/time.c
index 486e3a441c86..f0905b03523b 100644
--- a/arch/v850/kernel/time.c
+++ b/arch/v850/kernel/time.c
@@ -90,81 +90,6 @@ static irqreturn_t timer_interrupt (int irq, void *dummy, struct pt_regs *regs)
90 return IRQ_HANDLED; 90 return IRQ_HANDLED;
91} 91}
92 92
93/*
94 * This version of gettimeofday has near microsecond resolution.
95 */
96void do_gettimeofday (struct timeval *tv)
97{
98#if 0 /* DAVIDM later if possible */
99 extern volatile unsigned long lost_ticks;
100 unsigned long lost;
101#endif
102 unsigned long flags;
103 unsigned long usec, sec;
104 unsigned long seq;
105
106 do {
107 seq = read_seqbegin_irqsave(&xtime_lock, flags);
108
109#if 0
110 usec = mach_gettimeoffset ? mach_gettimeoffset () : 0;
111#else
112 usec = 0;
113#endif
114#if 0 /* DAVIDM later if possible */
115 lost = lost_ticks;
116 if (lost)
117 usec += lost * (1000000/HZ);
118#endif
119 sec = xtime.tv_sec;
120 usec += xtime.tv_nsec / 1000;
121 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
122
123 while (usec >= 1000000) {
124 usec -= 1000000;
125 sec++;
126 }
127
128 tv->tv_sec = sec;
129 tv->tv_usec = usec;
130}
131
132EXPORT_SYMBOL(do_gettimeofday);
133
134int do_settimeofday(struct timespec *tv)
135{
136 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
137 return -EINVAL;
138
139 write_seqlock_irq (&xtime_lock);
140
141 /* This is revolting. We need to set the xtime.tv_nsec
142 * correctly. However, the value in this location is
143 * is value at the last tick.
144 * Discover what correction gettimeofday
145 * would have done, and then undo it!
146 */
147#if 0
148 tv->tv_nsec -= mach_gettimeoffset() * 1000;
149#endif
150
151 while (tv->tv_nsec < 0) {
152 tv->tv_nsec += NSEC_PER_SEC;
153 tv->tv_sec--;
154 }
155
156 xtime.tv_sec = tv->tv_sec;
157 xtime.tv_nsec = tv->tv_nsec;
158
159 ntp_clear();
160
161 write_sequnlock_irq (&xtime_lock);
162 clock_was_set();
163 return 0;
164}
165
166EXPORT_SYMBOL(do_settimeofday);
167
168static int timer_dev_id; 93static int timer_dev_id;
169static struct irqaction timer_irqaction = { 94static struct irqaction timer_irqaction = {
170 timer_interrupt, 95 timer_interrupt,