Skip to contentSkip to conversation

Nomadik: fix reset_timer()

PATCH New Alessandro Rubini 1 participant 1 message Sep 29, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Nomadik: fix reset_timer()

From: Alessandro Rubini <[email protected]>

The timer decrements and READ_TIMER() negates the value read. Writing 0 in reset_timer() is this wrong, as a readback before 400us will read back 0 and will report 1780 seconds, so nand operations did timeout. This patch writes ~0 in reset_timer to prevent this.

Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
---
 cpu/arm926ejs/nomadik/timer.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
cpu/arm926ejs/nomadik/timer.c +2 -2
index 16067c9..2115b71 100644
@@ -46,10 +46,10 @@ int timer_init(void)
 	return 0;
 }
 
-/* Restart counting from 0 */
+/* Restart counting from ~0 (can't be 0, since READ_TIMER negates) */
 void reset_timer(void)
 {
-	writel(0, CONFIG_SYS_TIMERBASE + MTU_LR(0)); /* Immediate effect */
+	writel(~0, CONFIG_SYS_TIMERBASE + MTU_LR(0)); /* Immediate effect */
 }
 
 /* Return how many HZ passed since "base" */
Signature · 1 line
1.5.6.5