All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cp/cmp: Add WATCHDOG_RESET in copy and compare loop
@ 2010-08-31 11:57 Stefan Roese
  2010-08-31 13:18 ` Mike Frysinger
  2010-09-09 18:25 ` Wolfgang Denk
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Roese @ 2010-08-31 11:57 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>
---
 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..c426997 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 % 1000) == 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 % 1000) == 0)
+			WATCHDOG_RESET();
 	}
 	return 0;
 }
-- 
1.7.2.2

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

* [U-Boot] [PATCH] cp/cmp: Add WATCHDOG_RESET in copy and compare loop
  2010-08-31 11:57 [U-Boot] [PATCH] cp/cmp: Add WATCHDOG_RESET in copy and compare loop Stefan Roese
@ 2010-08-31 13:18 ` Mike Frysinger
  2010-08-31 13:26   ` Stefan Roese
  2010-09-09 18:25 ` Wolfgang Denk
  1 sibling, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2010-08-31 13:18 UTC (permalink / raw)
  To: u-boot

On Tuesday, August 31, 2010 07:57:33 Stefan Roese wrote:
> +		/* reset watchdog from time to time */
> +		if ((count % 1000) == 0)
> +			WATCHDOG_RESET();

please pick a number that doesnt involve needing to call libgcc math 
functions.  like 1024.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100831/a137c5aa/attachment.pgp 

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

* [U-Boot] [PATCH] cp/cmp: Add WATCHDOG_RESET in copy and compare loop
  2010-08-31 13:18 ` Mike Frysinger
@ 2010-08-31 13:26   ` Stefan Roese
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2010-08-31 13:26 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Tuesday 31 August 2010 15:18:03 Mike Frysinger wrote:
> On Tuesday, August 31, 2010 07:57:33 Stefan Roese wrote:
> > +		/* reset watchdog from time to time */
> > +		if ((count % 1000) == 0)
> > +			WATCHDOG_RESET();
> 
> please pick a number that doesnt involve needing to call libgcc math
> functions.  like 1024.

Good idea, thanks. Will send an updated version soon.

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH] cp/cmp: Add WATCHDOG_RESET in copy and compare loop
  2010-08-31 11:57 [U-Boot] [PATCH] cp/cmp: Add WATCHDOG_RESET in copy and compare loop Stefan Roese
  2010-08-31 13:18 ` Mike Frysinger
@ 2010-09-09 18:25 ` Wolfgang Denk
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2010-09-09 18:25 UTC (permalink / raw)
  To: u-boot

Dear Stefan Roese,

In message <1283255853-30198-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>
> ---
>  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..c426997 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 % 1000) == 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 % 1000) == 0)
> +			WATCHDOG_RESET();

1000 seems a bit arbitray to me, and very, very low. Are you sure such
a low value is needed?

I think lwmon5 has some 50 ms trigger period, so I'd expect to see a
_much_ higher value here.

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
It [being a Vulcan] means to adopt a philosophy, a way of life  which
is logical and beneficial. We cannot disregard that philosophy merely
for personal gain, no matter how important that gain might be.
	-- Spock, "Journey to Babel", stardate 3842.4

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

end of thread, other threads:[~2010-09-09 18:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-31 11:57 [U-Boot] [PATCH] cp/cmp: Add WATCHDOG_RESET in copy and compare loop Stefan Roese
2010-08-31 13:18 ` Mike Frysinger
2010-08-31 13:26   ` Stefan Roese
2010-09-09 18:25 ` 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.