diff options
| author | john stultz <johnstul@us.ibm.com> | 2007-05-06 17:51:53 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:13:04 -0400 |
| commit | ee17b36fd0dc2af37ea92548595e30964674ded8 (patch) | |
| tree | cfb2d5fe67802eac1c46d5542df86f237e1bcf1c /arch/v850 | |
| parent | c2f239d93e8af991392871c57465cb2ac556b482 (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')
| -rw-r--r-- | arch/v850/Kconfig | 4 | ||||
| -rw-r--r-- | arch/v850/kernel/time.c | 75 |
2 files changed, 4 insertions, 75 deletions
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig index 50ccc7f57cd0..5f54c1236c18 100644 --- a/arch/v850/Kconfig +++ b/arch/v850/Kconfig | |||
| @@ -37,6 +37,10 @@ config GENERIC_IRQ_PROBE | |||
| 37 | bool | 37 | bool |
| 38 | default y | 38 | default y |
| 39 | 39 | ||
| 40 | config GENERIC_TIME | ||
| 41 | bool | ||
| 42 | default y | ||
| 43 | |||
| 40 | config TIME_LOW_RES | 44 | config TIME_LOW_RES |
| 41 | bool | 45 | bool |
| 42 | default y | 46 | default y |
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 | */ | ||
| 96 | void 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 | |||
| 132 | EXPORT_SYMBOL(do_gettimeofday); | ||
| 133 | |||
| 134 | int 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 | |||
| 166 | EXPORT_SYMBOL(do_settimeofday); | ||
| 167 | |||
| 168 | static int timer_dev_id; | 93 | static int timer_dev_id; |
| 169 | static struct irqaction timer_irqaction = { | 94 | static struct irqaction timer_irqaction = { |
| 170 | timer_interrupt, | 95 | timer_interrupt, |
