public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Nomadik: fix reset_timer()
@ 2009-09-29  5:22 Alessandro Rubini
  0 siblings, 0 replies; only message in thread
From: Alessandro Rubini @ 2009-09-29  5:22 UTC (permalink / raw)
  To: u-boot

From: Alessandro Rubini <rubini@unipv.it>

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.

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Andrea Gallo <andrea.gallo@stericsson.com>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 cpu/arm926ejs/nomadik/timer.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpu/arm926ejs/nomadik/timer.c b/cpu/arm926ejs/nomadik/timer.c
index 16067c9..2115b71 100644
--- a/cpu/arm926ejs/nomadik/timer.c
+++ b/cpu/arm926ejs/nomadik/timer.c
@@ -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" */
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-29  5:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-29  5:22 [U-Boot] [PATCH] Nomadik: fix reset_timer() Alessandro Rubini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox