From 81d93e5c4b83d8b6dcee69de6f4a14ccf6f7114a Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Mon, 18 Feb 2008 08:09:37 -0600 Subject: ppc: Allow boards to specify effective amount of memory For historical reasons we limited the stack to 256M because some boards could only map that much via BATS. However newer boards are capable of mapping more memory (for example 85xx is capable of doing up to 2G). Signed-off-by: Kumar Gala --- lib_ppc/board.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'lib_ppc') diff --git a/lib_ppc/board.c b/lib_ppc/board.c index 45d1328f21..fbf1c5d25a 100644 --- a/lib_ppc/board.c +++ b/lib_ppc/board.c @@ -361,6 +361,20 @@ init_fnc_t *init_sequence[] = { NULL, /* Terminate this list */ }; +#ifndef CONFIG_MAX_MEM_MAPPED +#define CONFIG_MAX_MEM_MAPPED (256 << 20) +#endif +ulong get_effective_memsize(void) +{ +#ifndef CONFIG_VERY_BIG_RAM + return gd->ram_size; +#else + /* limit stack to what we can reasonable map */ + return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ? + CONFIG_MAX_MEM_MAPPED : gd->ram_size); +#endif +} + /************************************************************************ * * This is the first part of the initialization sequence that is @@ -419,13 +433,7 @@ void board_init_f (ulong bootflag) */ len = (ulong)&_end - CFG_MONITOR_BASE; -#ifndef CONFIG_VERY_BIG_RAM - addr = CFG_SDRAM_BASE + gd->ram_size; -#else - /* only allow stack below 256M */ - addr = CFG_SDRAM_BASE + - (gd->ram_size > 256 << 20) ? 256 << 20 : gd->ram_size; -#endif + addr = CFG_SDRAM_BASE + get_effective_memsize(); #ifdef CONFIG_LOGBUFFER /* reserve kernel log buffer */ -- cgit v1.2.3 From 2e721094a70a52206af2e1bf1208d9a7131f6dad Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Thu, 21 Feb 2008 14:23:42 +0100 Subject: lwmon5: enable hardware watchdog Some boards (e.g. lwmon5) may use rather small watchdog intervals, so causing it to reboot the board if U-Boot does a long busy-wait with udelay(). Thus, for these boards we have to restart WD more frequently. This patch splits the busy-wait udelay() into smaller, predefined, intervals, so that the watchdog timer may be resetted with the configurable (CONFIG_WD_PERIOD) interval. Signed-off-by: Yuri Tikhonov --- lib_ppc/time.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib_ppc') diff --git a/lib_ppc/time.c b/lib_ppc/time.c index 51e8e8406d..2649d5ffdc 100644 --- a/lib_ppc/time.c +++ b/lib_ppc/time.c @@ -23,6 +23,9 @@ #include +#ifndef CONFIG_WD_PERIOD +# define CONFIG_WD_PERIOD (10 * 1000 * 1000) /* 10 seconds default*/ +#endif /* ------------------------------------------------------------------------- */ @@ -53,9 +56,14 @@ unsigned long usec2ticks(unsigned long usec) */ void udelay(unsigned long usec) { - ulong ticks = usec2ticks (usec); - - wait_ticks (ticks); + ulong ticks, kv; + + do { + kv = usec > CONFIG_WD_PERIOD ? CONFIG_WD_PERIOD : usec; + ticks = usec2ticks (kv); + wait_ticks (ticks); + usec -= kv; + } while(usec); } /* ------------------------------------------------------------------------- */ -- cgit v1.2.3