All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3] cp/cmp: Add WATCHDOG_RESET in copy and compare loop
@ 2010-09-13  9:10 Stefan Roese
  2010-10-12 20:50 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Roese @ 2010-09-13  9:10 UTC (permalink / raw)
  To: u-boot

On some boards with a very short watchdog timeout, the "cp" and
"cmp" commands may reset the board. This patch adds some
watchdog resets inside the loops. Otherwise for example the lwmon5
board will reset while doing something like this:

=> cp.b fc000000 1000000 100000

Signed-off-by: Stefan Roese <sr@denx.de>
---
v3 
- Increased loop count as suggested by Wolfgang
  (256k still resets the lwmon5 board)

v2:
- Changed to power of 2 value to simplify the resulting code,
  4096 seems to be enough for lwmon5.

 common/cmd_mem.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 44834ea..f7a442a 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -337,6 +337,10 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		ngood++;
 		addr1 += size;
 		addr2 += size;
+
+		/* reset watchdog from time to time */
+		if ((count % (64 << 10)) == 0)
+			WATCHDOG_RESET();
 	}
 
 	printf("Total of %ld %s%s were the same\n",
@@ -447,6 +451,10 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			*((u_char *)dest) = *((u_char *)addr);
 		addr += size;
 		dest += size;
+
+		/* reset watchdog from time to time */
+		if ((count % (64 << 10)) == 0)
+			WATCHDOG_RESET();
 	}
 	return 0;
 }
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH v3] cp/cmp: Add WATCHDOG_RESET in copy and compare loop
  2010-09-13  9:10 [U-Boot] [PATCH v3] cp/cmp: Add WATCHDOG_RESET in copy and compare loop Stefan Roese
@ 2010-10-12 20:50 ` Wolfgang Denk
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2010-10-12 20:50 UTC (permalink / raw)
  To: u-boot

Dear Stefan Roese,

In message <1284369034-16382-1-git-send-email-sr@denx.de> you wrote:
> On some boards with a very short watchdog timeout, the "cp" and
> "cmp" commands may reset the board. This patch adds some
> watchdog resets inside the loops. Otherwise for example the lwmon5
> board will reset while doing something like this:
> 
> => cp.b fc000000 1000000 100000
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> ---
> v3 
> - Increased loop count as suggested by Wolfgang
>   (256k still resets the lwmon5 board)
> 
> v2:
> - Changed to power of 2 value to simplify the resulting code,
>   4096 seems to be enough for lwmon5.
> 
>  common/cmd_mem.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Fantasy is like alcohol - too much is bad for you, a little bit makes
the world a better place. Like  an  exercise  bicycle  it  takes  you
nowhere, but it just might tone up the muscles that will. Daydreaming
got  us  where we are today; early in our evolution we learned to let
our minds wander so well that they started coming  back  with  souve-
nirs.   - Terry Pratchett & Stephen Briggs, _The Discworld Companion_

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-12 20:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-13  9:10 [U-Boot] [PATCH v3] cp/cmp: Add WATCHDOG_RESET in copy and compare loop Stefan Roese
2010-10-12 20:50 ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.