diff options
author | Paul Mackerras <paulus@samba.org> | 2005-10-23 03:14:56 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-10-23 03:14:56 -0400 |
commit | 96c44507601d64f29b8ccc867637292e326c7019 (patch) | |
tree | 1fbdb6f4a3c2d99afaa6a244161518ec78f31048 /include/asm-powerpc | |
parent | 985990137e81ca9fd6561cd0f7d1a9695ec57d5a (diff) |
powerpc: Fix time code for 601 processors
The 601 doesn't have the timebase register; instead it has an RTCL
register that counts nanoseconds and wraps at 1000000000, and an
RTCU register that counts seconds. This makes the necessary changes
for the merged time code to use the RTCL/U registers when the kernel
is running on a 601.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r-- | include/asm-powerpc/time.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h index 99bfe3281768..410e795f7d43 100644 --- a/include/asm-powerpc/time.h +++ b/include/asm-powerpc/time.h | |||
@@ -30,7 +30,8 @@ extern unsigned long tb_ticks_per_usec; | |||
30 | extern unsigned long tb_ticks_per_sec; | 30 | extern unsigned long tb_ticks_per_sec; |
31 | extern u64 tb_to_xs; | 31 | extern u64 tb_to_xs; |
32 | extern unsigned tb_to_us; | 32 | extern unsigned tb_to_us; |
33 | extern u64 tb_last_stamp; | 33 | extern unsigned long tb_last_stamp; |
34 | extern u64 tb_last_jiffy; | ||
34 | 35 | ||
35 | DECLARE_PER_CPU(unsigned long, last_jiffy); | 36 | DECLARE_PER_CPU(unsigned long, last_jiffy); |
36 | 37 | ||
@@ -113,6 +114,17 @@ static inline unsigned int get_rtcl(void) | |||
113 | return rtcl; | 114 | return rtcl; |
114 | } | 115 | } |
115 | 116 | ||
117 | static inline u64 get_rtc(void) | ||
118 | { | ||
119 | unsigned int hi, lo, hi2; | ||
120 | |||
121 | do { | ||
122 | asm volatile("mfrtcu %0; mfrtcl %1; mfrtcu %2" | ||
123 | : "=r" (hi), "=r" (lo), "=r" (hi2)); | ||
124 | } while (hi2 != hi); | ||
125 | return (u64)hi * 1000000000 + lo; | ||
126 | } | ||
127 | |||
116 | #ifdef CONFIG_PPC64 | 128 | #ifdef CONFIG_PPC64 |
117 | static inline u64 get_tb(void) | 129 | static inline u64 get_tb(void) |
118 | { | 130 | { |