diff mbox

[U-Boot,2/2] support blackfin board initialization in generic board_f

Message ID 1406170022-25020-2-git-send-email-sonic.adi@gmail.com
State Superseded
Headers show

Commit Message

Sonic Zhang July 24, 2014, 2:47 a.m. UTC
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>
---

 common/board_f.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

Comments

Sonic Zhang July 29, 2014, 2:50 a.m. UTC | #1
Hi,

Any comment?

Regards,

Sonic

On Thu, Jul 24, 2014 at 10:47 AM, Sonic Zhang <sonic.adi@gmail.com> wrote:
> 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>
> ---
>
>  common/board_f.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/common/board_f.c b/common/board_f.c
> index bdab38e..079e1fa 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -107,6 +107,9 @@ __weak void blue_led_off(void) {}
>  #if defined(CONFIG_WATCHDOG)
>  static int init_func_watchdog_init(void)
>  {
> +#ifdef CONFIG_HW_WATCHDOG
> +       hw_watchdog_init();
> +#endif
>         puts("       Watchdog enabled\n");
>         WATCHDOG_RESET();
>
> @@ -144,7 +147,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 +266,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 +728,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 +813,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 +912,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 +936,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,
> --
> 1.8.2.3
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Tom Rini July 29, 2014, 12:33 p.m. UTC | #2
On Thu, Jul 24, 2014 at 10:47:02AM +0800, Sonic Zhang wrote:
> 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>
> ---
> 
>  common/board_f.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/common/board_f.c b/common/board_f.c
> index bdab38e..079e1fa 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -107,6 +107,9 @@ __weak void blue_led_off(void) {}
>  #if defined(CONFIG_WATCHDOG)
>  static int init_func_watchdog_init(void)
>  {
> +#ifdef CONFIG_HW_WATCHDOG
> +	hw_watchdog_init();
> +#endif
>  	puts("       Watchdog enabled\n");
>  	WATCHDOG_RESET();
>  

So today we're inconsistent about hw_watchdog_init.  For ARM this is
done at the board level, for blackfin/m68k as you've noted it's done in
board_init_f, which makes sense I believe.  But we need to get folks to
test the conversion over, so for now make this CONFIG_HW_WATCHDOG &&
(BLACKFIN || M68K || MICROBLAZE || SH) and we'll get everyone converted
when we can.

> @@ -144,7 +147,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

These aren't the same for you?
Sonic Zhang July 30, 2014, 5:40 a.m. UTC | #3
Hi Tom,

On Tue, Jul 29, 2014 at 8:33 PM, Tom Rini <trini@ti.com> wrote:
> On Thu, Jul 24, 2014 at 10:47:02AM +0800, Sonic Zhang wrote:
>> 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>
>> ---
>>
>>  common/board_f.c | 19 ++++++++++++++++++-
>>  1 file changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/board_f.c b/common/board_f.c
>> index bdab38e..079e1fa 100644
>> --- a/common/board_f.c
>> +++ b/common/board_f.c
>> @@ -107,6 +107,9 @@ __weak void blue_led_off(void) {}
>>  #if defined(CONFIG_WATCHDOG)
>>  static int init_func_watchdog_init(void)
>>  {
>> +#ifdef CONFIG_HW_WATCHDOG
>> +     hw_watchdog_init();
>> +#endif
>>       puts("       Watchdog enabled\n");
>>       WATCHDOG_RESET();
>>
>
> So today we're inconsistent about hw_watchdog_init.  For ARM this is
> done at the board level, for blackfin/m68k as you've noted it's done in
> board_init_f, which makes sense I believe.  But we need to get folks to
> test the conversion over, so for now make this CONFIG_HW_WATCHDOG &&
> (BLACKFIN || M68K || MICROBLAZE || SH) and we'll get everyone converted
> when we can.

OK. I will add these dependency to the patch.

>
>> @@ -144,7 +147,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
>
> These aren't the same for you?
>

According to Mike's patch in 2010, CONFIG_SYS_TEXT_BASE is not used in
Blackfin boards.

commit fbb21ff0478f1bac0b009133bf82b7412ea0230b
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Thu Dec 23 14:13:41 2010 -0500

    Blackfin: drop CONFIG_SYS_TEXT_BASE from boards

    We don't want/use this value for Blackfin boards, so punt it and have the
    common code error out when people try to use it.

    Signed-off-by: Mike Frysinger <vapier@gentoo.org>



Thanks,

Sonic
diff mbox

Patch

diff --git a/common/board_f.c b/common/board_f.c
index bdab38e..079e1fa 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -107,6 +107,9 @@  __weak void blue_led_off(void) {}
 #if defined(CONFIG_WATCHDOG)
 static int init_func_watchdog_init(void)
 {
+#ifdef CONFIG_HW_WATCHDOG
+	hw_watchdog_init();
+#endif
 	puts("       Watchdog enabled\n");
 	WATCHDOG_RESET();
 
@@ -144,7 +147,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 +266,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 +728,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 +813,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 +912,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 +936,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,