From: Greg Ungerer <gerg@xxxxxxxxxxx> The read function for the ColdFire slice timer doesn't deal with the hardware timer count register wrapping while we are reading it to get an accurate snapshot of the time. Re-read the timer a second time and see if it has wrapped, adjust the total count as required. Signed-off-by: Greg Ungerer <gerg@xxxxxxxxxxx> --- arch/m68k/platform/coldfire/sltimers.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/m68k/platform/coldfire/sltimers.c b/arch/m68k/platform/coldfire/sltimers.c index b7f822b..1249367 100644 --- a/arch/m68k/platform/coldfire/sltimers.c +++ b/arch/m68k/platform/coldfire/sltimers.c @@ -98,16 +98,17 @@ static struct irqaction mcfslt_timer_irq = { static cycle_t mcfslt_read_clk(struct clocksource *cs) { unsigned long flags; - u32 cycles; - u16 scnt; + u32 cycles, scnt; local_irq_save(flags); scnt = __raw_readl(TA(MCFSLT_SCNT)); cycles = mcfslt_cnt; + if (scnt < __raw_readl(TA(MCFSLT_SCNT))) + cycles += mcfslt_cycles_per_jiffy; local_irq_restore(flags); /* subtract because slice timers count down */ - return cycles - scnt; + return cycles + ((mcfslt_cycles_per_jiffy - 1) - scnt); } static struct clocksource mcfslt_clk = { -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html