Skip to content

Commit

Permalink
[ARM] 2871/1: Fixes an issue with gettimeofday not working correctly …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Adam Brooks authored and Russell King committed Sep 7, 2005
1 parent fd6480f commit 7691d93
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-iop3xx/iop321-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static unsigned long iop321_gettimeoffset(void)
/*
* Now convert them to usec.
*/
usec = (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH;
usec = (unsigned long)(elapsed / (CLOCK_TICK_RATE/1000000));

return usec;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-iop3xx/iop331-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static unsigned long iop331_gettimeoffset(void)
/*
* Now convert them to usec.
*/
usec = (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH;
usec = (unsigned long)(elapsed / (CLOCK_TICK_RATE/1000000));

return usec;
}
Expand Down

0 comments on commit 7691d93

Please sign in to comment.