All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sonic Zhang <sonic.adi@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 2/2] support blackfin board initialization in generic board_f
Date: Thu, 7 Aug 2014 15:08:52 +0800	[thread overview]
Message-ID: <1407395332-20363-2-git-send-email-sonic.adi@gmail.com> (raw)
In-Reply-To: <1407395332-20363-1-git-send-email-sonic.adi@gmail.com>

From: Sonic Zhang <sonic.zhang@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@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

v3-changes:
- allocate board info struct only when it is not already allocated in arch init

v4-changes:
- Init hw watchdog only when generic board macro is defined, because m68k havsn't
switched over to generic board yet.
- avoid reserving video for Blackfin boards

---
 common/board_f.c   | 45 ++++++++++++++++++++++++++++++++++-----------
 include/watchdog.h |  3 ++-
 2 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index 6203d85..d5e7622 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -106,9 +106,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();
 
@@ -146,7 +151,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
@@ -261,6 +270,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;
@@ -470,8 +481,9 @@ static int reserve_trace(void)
 	return 0;
 }
 
-#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \
-		&& !defined(CONFIG_ARM) && !defined(CONFIG_X86)
+#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+		!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
+		!defined(CONFIG_BLACKFIN)
 static int reserve_video(void)
 {
 	/* reserve memory for video display (always full pages) */
@@ -516,11 +528,13 @@ static int reserve_malloc(void)
 /* (permanently) allocate a Board Info struct */
 static int reserve_board(void)
 {
-	gd->start_addr_sp -= sizeof(bd_t);
-	gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t));
-	memset(gd->bd, '\0', sizeof(bd_t));
-	debug("Reserving %zu Bytes for Board Info at: %08lx\n",
-			sizeof(bd_t), gd->start_addr_sp);
+	if (!gd->bd) {
+		gd->start_addr_sp -= sizeof(bd_t);
+		gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t));
+		memset(gd->bd, '\0', sizeof(bd_t));
+		debug("Reserving %zu Bytes for Board Info at: %08lx\n",
+		      sizeof(bd_t), gd->start_addr_sp);
+	}
 	return 0;
 }
 #endif
@@ -721,7 +735,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);
@@ -828,7 +844,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
@@ -929,6 +945,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
@@ -945,11 +965,14 @@ static init_fnc_t init_sequence_f[] = {
 #endif
 	reserve_trace,
 	/* TODO: Why the dependency on CONFIG_8xx? */
-#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \
-		&& !defined(CONFIG_ARM) && !defined(CONFIG_X86)
+#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+		!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
+		!defined(CONFIG_BLACKFIN)
 	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 bd0a8d6..9273fa1 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -21,7 +21,8 @@
 int init_func_watchdog_reset(void);
 #endif
 
-#ifdef CONFIG_WATCHDOG
+#if defined(CONFIG_SYS_GENERIC_BOARD) && \
+	(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

  reply	other threads:[~2014-08-07  7:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07  7:08 [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions Sonic Zhang
2014-08-07  7:08 ` Sonic Zhang [this message]
2014-08-08 16:50   ` [U-Boot] [PATCH v4 2/2] support blackfin board initialization in generic board_f Tom Rini
2014-08-29 12:20 ` [U-Boot] [PATCH v4 1/2] blackfin: convert blackfin board_f and board_r to use generic board init functions Michal Simek
2014-09-01  2:52   ` Sonic Zhang
2014-09-01 11:01     ` Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407395332-20363-2-git-send-email-sonic.adi@gmail.com \
    --to=sonic.adi@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.