blackfin: convert blackfin board_f and board_r to use generic board init functions
PATCH 1/2 blackfin: convert blackfin board_f and board_r to use generic board init functions
From: Sonic Zhang <[email protected]>
- move blackfin specific cpu init code from blackfin board.c to cpu.c
- remove blackfin specific board init code and invoke generic board_f fron cpu init entry
- rename section name bss_vma to bss_start in order to match the generic board init code
- add a fake relocate_code function to set up the new stack only
---
arch/blackfin/config.mk | 3 + arch/blackfin/cpu/cpu.c | 333 +++++++++++++++++++++++++--- arch/blackfin/cpu/start.S | 14 +- arch/blackfin/cpu/u-boot.lds | 4 +- arch/blackfin/include/asm/u-boot.h | 3 + arch/blackfin/lib/Makefile | 7 +- arch/blackfin/lib/board.c | 443 ------------------------------------- arch/blackfin/lib/sections.c | 11 + include/configs/bfin_adi_common.h | 4 + 9 files changed, 334 insertions(+), 488 deletions(-) delete mode 100644 arch/blackfin/lib/board.c create mode 100644 arch/blackfin/lib/sections.c
arch/blackfin/config.mk +3 -0
@@ -20,6 +20,9 @@ CONFIG_BFIN_CPU := $(strip $(CONFIG_BFIN_CPU:"%"=%)) endif CONFIG_BFIN_BOOT_MODE := $(strip $(CONFIG_BFIN_BOOT_MODE:"%"=%)) +# Support generic board on Blackfin +__HAVE_ARCH_GENERIC_BOARD := y + PLATFORM_RELFLAGS += -ffixed-P3 -fomit-frame-pointer -mno-fdpic PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN
arch/blackfin/cpu/cpu.c +297 -36
371 lines not on this page · raw message
arch/blackfin/cpu/start.S +12 -2
@@ -196,8 +196,8 @@ ENTRY(_start) * takes care of clearing things for us. */ serial_early_puts("Zero BSS"); - r0.l = __bss_vma; - r0.h = __bss_vma; + r0.l = __bss_start; + r0.h = __bss_start; r1 = 0 (x); r2.l = __bss_len; r2.h = __bss_len;
@@ -251,3 +251,13 @@ LENTRY(_get_pc) #endif rts; ENDPROC(_get_pc) + +ENTRY(_relocate_code) + /* Fake relocate code. Setup the new stack only */ + sp = r0; + fp = sp; + r0 = p3; + r1.h = 0x2000; + r1.l = 0x10; + jump.l _board_init_r +ENDPROC(_relocate_code)
arch/blackfin/cpu/u-boot.lds +3 -1
@@ -135,6 +135,8 @@ SECTIONS *(COMMON) . = ALIGN(4); } >ram_data - __bss_vma = ADDR(.bss); + __bss_end = .; + __bss_start = ADDR(.bss); __bss_len = SIZEOF(.bss); + __init_end = .; }
arch/blackfin/include/asm/u-boot.h +3 -0
@@ -25,9 +25,12 @@ typedef struct bd_info {unsigned long bi_vco;unsigned long bi_cclk;unsigned long bi_sclk; + unsigned char bi_enetaddr[6]; } bd_t;/* For image.h:image_check_target_arch() */ #define IH_ARCH_DEFAULT IH_ARCH_BLACKFIN +int arch_misc_init (void ); +#endif /* _U_BOOT_H_ */
arch/blackfin/lib/Makefile +1 -6
@@ -9,11 +9,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -# Unnecessary. -# Use CONFIG_SYS_BOARD instead of BFIN_BOARD_NAME -# and delete this. -ccflags-y += -DBFIN_BOARD_NAME='"$(BOARD)"' - obj-y += ins.o obj-y += memcmp.o obj-y += memcpy.o
@@ -21,7 +16,6 @@ obj-y += memmove.o obj-y += memset.o obj-y += outs.o obj-$(CONFIG_CMD_KGDB) += __kgdb.o -obj-y += board.o obj-y += boot.o obj-y += cache.o obj-y += clocks.o
@@ -30,3 +24,4 @@ obj-$(CONFIG_CMD_KGDB) += kgdb.o obj-y += muldi3.o obj-$(CONFIG_HAS_POST) += post.o obj-y += string.o +obj-y += sections.o
arch/blackfin/lib/board.c deleted +0 -443
443 lines not on this page · raw message
arch/blackfin/lib/sections.c new file +11 -0
@@ -0,0 +1,11 @@ +/* +* U-boot - section.c +* +* Copyright (c) 2014 Analog Devices Inc. +* +* Licensed under the GPL-2 or later. +*/ + +char __bss_start[0] __attribute__((section(".__bss_start"))); +char __bss_end[0] __attribute__((section(".__bss_end"))); +char __init_end[0] __attribute__((section(".__init_end")));
include/configs/bfin_adi_common.h +4 -0
@@ -327,4 +327,8 @@#ifndef CONFIG_ADI_GPIO2 # define CONFIG_ADI_GPIO1 #endif +#define CONFIG_SYS_GENERIC_BOARD +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_ARCH_MISC_INIT +#endif
Signature · 1 line
1.8.2.3
PATCH 2/2 support blackfin board initialization in generic board_f
From: Sonic Zhang <[email protected]>
- 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
---
common/board_f.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
common/board_f.c +18 -1
@@ -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,
Signature · 1 line
1.8.2.3
PATCH 2/2 support blackfin board initialization in generic board_f
Hi,
Any comment?
Regards,
Sonic
Quoted 95 lines · Sonic Zhang
From: Sonic Zhang <[email protected]>
- init hardware watchdog if applicable
- useCONFIG_SYS_MONITOR_LENas the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer toCONFIG_SYS_MONITOR_LEN, which is not defined by BlackfinSigned-off-by Sonic Zhang <[email protected]>---
common/board_f.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)common/board_f.c +18
-2@@ -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 at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 2/2 support blackfin board initialization in generic board_f
In reply to Sonic ZhangQuoted 18 lines · Sonic Zhang
From: Sonic Zhang <[email protected]>
- init hardware watchdog if applicable
- useCONFIG_SYS_MONITOR_LENas the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer toCONFIG_SYS_MONITOR_LEN, which is not defined by BlackfinSigned-off-by Sonic Zhang <[email protected]>---
common/board_f.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)common/board_f.c +0
-0
common/board_f.c __weak void blue_led_off(void) {} · line 115
Quoted 9 lines
common/board_f.c +3
-0@@ -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.
common/board_f.c static int display_text_info(void) · line 155
Quoted 10 lines
common/board_f.c +4
-0@@ -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?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140729/36ec0a09/attachment.pgp>
PATCH 2/2 support blackfin board initialization in generic board_f
Hi Tom,
Quoted 27 lines · Tom Rini
Quoted 26 lines · Sonic Zhang
From: Sonic Zhang <[email protected]>
- init hardware watchdog if applicable
- useCONFIG_SYS_MONITOR_LENas the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer toCONFIG_SYS_MONITOR_LEN, which is not defined by BlackfinSigned-off-by Sonic Zhang <[email protected]>---
common/board_f.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)common/board_f.c +3
-0@@ -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 ();
Quoted 8 lines
Quoted 1 line
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 inboard_init_f, which makes sense I believe. But we need to get folks to test the conversion over, so for now make thisCONFIG_HW_WATCHDOG&& (BLACKFIN || M68K || MICROBLAZE || SH) and we'll get everyone converted when we can.
OK. I will add these dependency to the patch.
Quoted 4 lines
Quoted 4 lines
common/board_f.c +0
-0@@ -144,7 +147,11 @@ static int display_text_info(void) bss_end = (ulong)&__bss_end;
Quoted 10 lines
common/board_f.c static int display_text_info(void) · line 155
Quoted 7 lines
common/board_f.c +4
-0debug("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 <[email protected]> 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.
Thanks,
Sonic