From 96c44507601d64f29b8ccc867637292e326c7019 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Sun, 23 Oct 2005 17:14:56 +1000 Subject: 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 --- include/asm-powerpc/time.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include/asm-powerpc/time.h') diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h index 99bfe328176..410e795f7d4 100644 --- a/include/asm-powerpc/time.h +++ b/include/asm-powerpc/time.h @@ -30,7 +30,8 @@ extern unsigned long tb_ticks_per_usec; extern unsigned long tb_ticks_per_sec; extern u64 tb_to_xs; extern unsigned tb_to_us; -extern u64 tb_last_stamp; +extern unsigned long tb_last_stamp; +extern u64 tb_last_jiffy; DECLARE_PER_CPU(unsigned long, last_jiffy); @@ -113,6 +114,17 @@ static inline unsigned int get_rtcl(void) return rtcl; } +static inline u64 get_rtc(void) +{ + unsigned int hi, lo, hi2; + + do { + asm volatile("mfrtcu %0; mfrtcl %1; mfrtcu %2" + : "=r" (hi), "=r" (lo), "=r" (hi2)); + } while (hi2 != hi); + return (u64)hi * 1000000000 + lo; +} + #ifdef CONFIG_PPC64 static inline u64 get_tb(void) { -- cgit v1.2.3