[U-Boot] [PATCH v2 2/2] support blackfin board initialization in generic board_f
Sonic Zhang
sonic.adi at gmail.com
Wed Jul 30 08:16:16 CEST 2014
From: Sonic Zhang <sonic.zhang at analog.com>
- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin
Signed-off-by: Sonic Zhang <sonic.zhang at analog.com>
---
v2-changes:
- make hardware watchdog init depend on BLACKFIN || M68K || MICROBLAZE || SH
- define watchdog init and reset macros for both software and hardware watchdog
---
common/board_f.c | 23 +++++++++++++++++++++--
include/watchdog.h | 2 +-
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c
index bdab38e..7943d08 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -104,9 +104,14 @@ __weak void blue_led_off(void) {}
* Could the CONFIG_SPL_BUILD infection become a flag in gd?
*/
-#if defined(CONFIG_WATCHDOG)
+#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
static int init_func_watchdog_init(void)
{
+# if defined(CONFIG_HW_WATCHDOG) && (defined(CONFIG_BLACKFIN) || \
+ defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
+ defined(CONFIG_SH))
+ hw_watchdog_init();
+# endif
puts(" Watchdog enabled\n");
WATCHDOG_RESET();
@@ -144,7 +149,11 @@ static int display_text_info(void)
bss_end = (ulong)&__bss_end;
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",
+#ifdef CONFIG_SYS_TEXT_BASE
CONFIG_SYS_TEXT_BASE, bss_start, bss_end);
+#else
+ CONFIG_SYS_MONITOR_BASE, bss_start, bss_end);
+#endif
#endif
#ifdef CONFIG_MODEM_SUPPORT
@@ -259,6 +268,8 @@ static int setup_mon_len(void)
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
#elif defined(CONFIG_SANDBOX)
gd->mon_len = (ulong)&_end - (ulong)_init;
+#elif defined(CONFIG_BLACKFIN)
+ gd->mon_len = CONFIG_SYS_MONITOR_LEN;
#else
/* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */
gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
@@ -719,7 +730,9 @@ static int reloc_fdt(void)
static int setup_reloc(void)
{
+#ifdef CONFIG_SYS_TEXT_BASE
gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
+#endif
memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
debug("Relocation Offset is: %08lx\n", gd->reloc_off);
@@ -802,7 +815,7 @@ static init_fnc_t init_sequence_f[] = {
/* TODO: can we rename this to timer_init()? */
init_timebase,
#endif
-#if defined(CONFIG_ARM) || defined(CONFIG_MIPS)
+#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_BLACKFIN)
timer_init, /* initialize timer */
#endif
#ifdef CONFIG_SYS_ALLOC_DPRAM
@@ -901,6 +914,10 @@ static init_fnc_t init_sequence_f[] = {
* - board info struct
*/
setup_dest_addr,
+#if defined(CONFIG_BLACKFIN)
+ /* Blackfin u-boot monitor should be on top of the ram */
+ reserve_uboot,
+#endif
#if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
reserve_logbuffer,
#endif
@@ -921,7 +938,9 @@ static init_fnc_t init_sequence_f[] = {
&& !defined(CONFIG_ARM) && !defined(CONFIG_X86)
reserve_video,
#endif
+#if !defined(CONFIG_BLACKFIN)
reserve_uboot,
+#endif
#ifndef CONFIG_SPL_BUILD
reserve_malloc,
reserve_board,
diff --git a/include/watchdog.h b/include/watchdog.h
index aacacb9..437df4b 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -21,7 +21,7 @@
int init_func_watchdog_reset(void);
#endif
-#ifdef CONFIG_WATCHDOG
+#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
#define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
#define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
#else
--
1.8.2.3
More information about the U-Boot
mailing list