summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorPhilippe De Muyter <phdm@macqel.be>2008-06-12 22:21:36 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2008-06-13 01:05:40 (GMT)
commit6c38d8578545482fe45d6e6ea37be02a2e1bb289 (patch)
tree05f291e2fc1e9cf89398aed63b843bfe6c766789 /arch
parent67dddaad5d8b8c5ee5b96a7e2f6cb0faad703865 (diff)
downloadlinux-6c38d8578545482fe45d6e6ea37be02a2e1bb289.tar.xz
m68knommu: init coldfire timer TRR with n - 1, not n
The coldfire timer must be initialised to n - 1 if we want it to count n cycles between each tick interrupt. This was already fixed, but has been lost with the conversion to GENERIC_TIMER. Signed-off-by: Philippe De Muyter <phdm@macqel.be> Acked-by: Greg Ungerer <gerg@snapgear.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/m68knommu/platform/coldfire/timers.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/m68knommu/platform/coldfire/timers.c b/arch/m68knommu/platform/coldfire/timers.c
index ba5a9f3..454f254 100644
--- a/arch/m68knommu/platform/coldfire/timers.c
+++ b/arch/m68knommu/platform/coldfire/timers.c
@@ -111,7 +111,13 @@ void hw_timer_init(void)
__raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
mcftmr_cycles_per_jiffy = FREQ / HZ;
- __raw_writetrr(mcftmr_cycles_per_jiffy, TA(MCFTIMER_TRR));
+ /*
+ * The coldfire timer runs from 0 to TRR included, then 0
+ * again and so on. It counts thus actually TRR + 1 steps
+ * for 1 tick, not TRR. So if you want n cycles,
+ * initialize TRR with n - 1.
+ */
+ __raw_writetrr(mcftmr_cycles_per_jiffy - 1, TA(MCFTIMER_TRR));
__raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));