Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/mpic_timer: fix the time is not accurate caused by GTCRR toggle bit

When the timer GTCCR toggle bit is inverted, we calculated the rest
of the time is not accurate. So we need to ignore this bit.

Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>

authored by

Wang Dongsheng and committed by
Scott Wood
0fd79588 7f83a50c

+3
+3
arch/powerpc/sysdev/mpic_timer.c
··· 41 41 #define MPIC_TIMER_TCR_ROVR_OFFSET 24 42 42 43 43 #define TIMER_STOP 0x80000000 44 + #define GTCCR_TOG 0x80000000 44 45 #define TIMERS_PER_GROUP 4 45 46 #define MAX_TICKS (~0U >> 1) 46 47 #define MAX_TICKS_CASCADE (~0U) ··· 328 327 casc_priv = priv->timer[handle->num].cascade_handle; 329 328 if (casc_priv) { 330 329 tmp_ticks = in_be32(&priv->regs[handle->num].gtccr); 330 + tmp_ticks &= ~GTCCR_TOG; 331 331 ticks = ((u64)tmp_ticks & UINT_MAX) * (u64)MAX_TICKS_CASCADE; 332 332 tmp_ticks = in_be32(&priv->regs[handle->num - 1].gtccr); 333 333 ticks += tmp_ticks; 334 334 } else { 335 335 ticks = in_be32(&priv->regs[handle->num].gtccr); 336 + ticks &= ~GTCCR_TOG; 336 337 } 337 338 338 339 convert_ticks_to_time(priv, ticks, time);