Commit 3c57bd0f authored by Deepak Saxena's avatar Deepak Saxena Committed by Russell King

[ARM PATCH] 2412/1: Fix IXP2000 gettimeofday() implementation (again)

Patch from Deepak Saxena

Previous fixed showed negative time flow every few hours during
extensive testing. This new version is much simpler and has been
tested w/o any failures.

Signed-off-by: Deepak Saxena
Signed-off-by: Russell King
parent 5da2776d
...@@ -171,22 +171,9 @@ static unsigned next_jiffy_time; ...@@ -171,22 +171,9 @@ static unsigned next_jiffy_time;
unsigned long ixp2000_gettimeoffset (void) unsigned long ixp2000_gettimeoffset (void)
{ {
unsigned long elapsed1, elapsed2, pending;
unsigned long offset; unsigned long offset;
elapsed1 = *IXP2000_T1_CSR; offset = next_jiffy_time - *IXP2000_T4_CSR;
pending = (*IXP2000_IRQ_STATUS & IRQ_MASK_TIMER1);
elapsed2 = *IXP2000_T1_CSR;
offset = ticks_per_jiffy - elapsed2;
/*
* We have two cases to cover, one where we were pending
* already, and another where it overflowed while we were
* checking the timers.
*/
if ((elapsed2 > elapsed1) || pending)
offset += ticks_per_jiffy;
return offset / ticks_per_usec; return offset / ticks_per_usec;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment