Skip to contentSkip to conversation

ppc flush_cache: add watch-dog triggering into the loops.

PATCH New Wolfgang Denk 2 participants 4 messages Apr 29, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc flush_cache: add watch-dog triggering into the loops.

From: Yuri Tikhonov <[email protected]>

Some boards (e.g. lwmon5) need rather a frequent watch-dog kicking. Since the time it takes for the flush_cache() function to complete its job depends on the size of data being flushed, one may encounter watch-dog resets on such boards when, for example, download big files over ethernet.

---
 lib_ppc/cache.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
lib_ppc/cache.c +3 -0
index 27e1a82..5bfb220 100644
@@ -23,6 +23,7 @@
 
 #include <common.h>
 #include <asm/cache.h>
+#include <watchdog.h>
 
 void flush_cache (ulong start_addr, ulong size)
 {
@@ -35,6 +36,7 @@ void flush_cache (ulong start_addr, ulong size)
 		     addr < end_addr;
 		     addr += CFG_CACHELINE_SIZE) {
 			asm ("dcbst 0,%0": :"r" (addr));
+			WATCHDOG_RESET();
 		}
 		asm ("sync");	/* Wait for all dcbst to complete on bus */
 
@@ -42,6 +44,7 @@ void flush_cache (ulong start_addr, ulong size)
 		     addr < end_addr;
 		     addr += CFG_CACHELINE_SIZE) {
 			asm ("icbi 0,%0": :"r" (addr));
+			WATCHDOG_RESET();
 		}
 	}
 	asm ("sync");		/* Always flush prefetch queue in any case */
Signature · 1 line
1.5.4.2
#1 lore raw

PATCH 1/1 ppc flush_cache: add watch-dog triggering into the loops.

Quoted 7 lines · Wolfgang Denk

From: Yuri Tikhonov <[email protected]>

Some boards (e.g. lwmon5) need rather a frequent watch-dog kicking. Since the time it takes for the flush_cache() function to complete its job depends on the size of data being flushed, one may encounter watch-dog resets on such boards when, for example, download big files over ethernet.

is this because the size argument being passed to flush_cache is well beyond the size of the cache itself?

- k

#2 lore raw

PATCH 1/1 ppc flush_cache: add watch-dog triggering into the loops.

Dear Kumar,

Quoted 9 lines · in message <[email protected]> you wrote:
Quoted 6 lines

Some boards (e.g. lwmon5) need rather a frequent watch-dog kicking. Since the time it takes for the flush_cache() function to complete its job depends on the size of data being flushed, one may encounter watch-dog resets on such boards when, for example, download big files over ethernet.

is this because the size argument being passed to flush_cache is well beyond the size of the cache itself?

Yes - the thing is that after a TFTP download flush_cache() is called for the size of the downloaded filr; this may be 8 or 32 MiB or more ;-)

Best regards,

Wolfgang Denk

Signature · 7 lines
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
Severe culture shock results when experts from another protocol suite
[...] try to read OSI documents. The term "osified" is used to  refer
to  such  documents. [...] Any relationship to the word "ossified" is
purely intentional.                                - Marshall T. Rose
#3 lore raw

PATCH 1/1 ppc flush_cache: add watch-dog triggering into the loops.

Quoted 11 lines · Wolfgang Denk

Dear Kumar,

in message

Quoted 7 lines · <[email protected]> you wrote:
Quoted 6 lines

Some boards (e.g. lwmon5) need rather a frequent watch-dog kicking. Since the time it takes for the flush_cache() function to complete its job depends on the size of data being flushed, one may encounter watch-dog resets on such boards when, for example, download big files over ethernet.

Quoted 6 lines
Quoted 2 lines

is this because the size argument being passed to flush_cache is well beyond the size of the cache itself?

Yes - the thing is that after a TFTP download flush_cache() is called for the size of the downloaded filr; this may be 8 or 32 MiB or more ;-)

Seems like we should have a max flush size that is know to flush the whole cache.

Something like:

void flush_cache (ulong start_addr, ulong size)
{

#ifndef CONFIG_5xx
         ulong addr, end_addr;
	size = MIN(MAX_CACHE_SIZE_TO_FLUSH, size);
	end_addr = start_addr + size;

...

oh well.

- k