aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/kernel
diff options
context:
space:
mode:
authorJesper Nilsson <jesper.nilsson@axis.com>2010-07-30 11:33:07 -0400
committerJesper Nilsson <jesper.nilsson@axis.com>2010-08-04 06:58:55 -0400
commit60dbd6633178a8625ed71329da0167c6d50c559c (patch)
treebcbc1004dfe356ce7cf30f183725dbbc9dad3e4f /arch/cris/kernel
parent26bfeea38a4a5daf52c8f01c986ca8680bf1f6a1 (diff)
CRIS: GENERIC_TIME fixes
GENERIC_TIME was not functional for CRIS, giving random backward time jumps. For CRISv32 implement a new clocksource using the free running counter and ditch the arch_gettimeoffset. The random time jumps still existed, but turned out to be the write_seqlock which was missing around our do_timer() call. So switch over to GENERIC_TIME using the clocksource for CRISv32. CRISv10 doesn't have the free running counter needed for the clocksource trick, but we can still use GENERIC_TIME with arch_gettimeoffset. Unfortunately, there were problems in using the prescaler register to timer0 for the gettimeoffset calculation, so it is now ignored, making our resolution worse by the tune of 40usec (0.4%) worst case. At the same time, clean up some formatting and use NSEC_PER_SEC instead of 1000000000. Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Diffstat (limited to 'arch/cris/kernel')
-rw-r--r--arch/cris/kernel/time.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index c72730d20ef6..b5096430ce1c 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -39,13 +39,16 @@ int have_rtc; /* used to remember if we have an RTC or not */;
39extern unsigned long loops_per_jiffy; /* init/main.c */ 39extern unsigned long loops_per_jiffy; /* init/main.c */
40unsigned long loops_per_usec; 40unsigned long loops_per_usec;
41 41
42
43#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
42extern unsigned long do_slow_gettimeoffset(void); 44extern unsigned long do_slow_gettimeoffset(void);
43static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; 45static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
44 46
45u32 arch_gettimeoffset(void) 47u32 arch_gettimeoffset(void)
46{ 48{
47 return do_gettimeoffset() * 1000; 49 return do_gettimeoffset() * 1000;
48} 50}
51#endif
49 52
50/* 53/*
51 * BUG: This routine does not handle hour overflow properly; it just 54 * BUG: This routine does not handle hour overflow properly; it just
@@ -151,7 +154,7 @@ cris_do_profile(struct pt_regs* regs)
151 154
152unsigned long long sched_clock(void) 155unsigned long long sched_clock(void)
153{ 156{
154 return (unsigned long long)jiffies * (1000000000 / HZ) + 157 return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) +
155 get_ns_in_jiffie(); 158 get_ns_in_jiffie();
156} 159}
157 160