aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorAdam Brooks <adam.j.brooks@gmail.com>2005-09-07 12:24:36 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-09-07 12:24:36 -0400
commit7691d931aa55409ae3339d541ec0b87ab0a2adae (patch)
treefded2593c6d7e7a8e72728601573c6db7ceaa115 /arch/arm
parentfd6480f27e38f86ddea78eb5b46db249dfd09f17 (diff)
[ARM] 2871/1: Fixes an issue with gettimeofday not working correctly on Intel IOP3xx processors
Patch from Adam Brooks The current gettimeofday implementation for the IOP3xx processors reads the contents of the timer interrupt register and does math on the value to figure out exactly what time it is. To do this it multiplies the contents of the timer register with a large constant. The result is then divided by a large constant. Unfortunately the result of the first multiplication is often too large for the register to hold. The solution is to combine the two large constants to a single smaller constant at compile time. Then the timer value can be divided by single smaller constant without any overflow issues. Signed-off-by: Adam Brooks <adam.j.brooks@intel.com> Signed-off-by: Deepak Saxena <dsaxena@plexity.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-iop3xx/iop321-time.c2
-rw-r--r--arch/arm/mach-iop3xx/iop331-time.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/mach-iop3xx/iop321-time.c b/arch/arm/mach-iop3xx/iop321-time.c
index d53af1669502..0039793b694a 100644
--- a/arch/arm/mach-iop3xx/iop321-time.c
+++ b/arch/arm/mach-iop3xx/iop321-time.c
@@ -60,7 +60,7 @@ static unsigned long iop321_gettimeoffset(void)
60 /* 60 /*
61 * Now convert them to usec. 61 * Now convert them to usec.
62 */ 62 */
63 usec = (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH; 63 usec = (unsigned long)(elapsed / (CLOCK_TICK_RATE/1000000));
64 64
65 return usec; 65 return usec;
66} 66}
diff --git a/arch/arm/mach-iop3xx/iop331-time.c b/arch/arm/mach-iop3xx/iop331-time.c
index 1a6d9d661e4b..8eddfac7e2b0 100644
--- a/arch/arm/mach-iop3xx/iop331-time.c
+++ b/arch/arm/mach-iop3xx/iop331-time.c
@@ -58,7 +58,7 @@ static unsigned long iop331_gettimeoffset(void)
58 /* 58 /*
59 * Now convert them to usec. 59 * Now convert them to usec.
60 */ 60 */
61 usec = (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH; 61 usec = (unsigned long)(elapsed / (CLOCK_TICK_RATE/1000000));
62 62
63 return usec; 63 return usec;
64} 64}