diff options
| author | Mike Frysinger <vapier@gentoo.org> | 2012-02-29 22:48:10 -0500 | 
|---|---|---|
| committer | Mike Frysinger <vapier@gentoo.org> | 2012-04-22 13:00:19 -0400 | 
| commit | a4932d78774a96bef65c5ae3c76538d4949dc9eb (patch) | |
| tree | 3c30fa242d5e135a8fd3c7ca3427472b0b25e7c6 /arch/blackfin/lib/board.c | |
| parent | 33e7e60c77ec89cd969ff5718f798f881c2832b7 (diff) | |
| download | olio-uboot-2014.01-a4932d78774a96bef65c5ae3c76538d4949dc9eb.tar.xz olio-uboot-2014.01-a4932d78774a96bef65c5ae3c76538d4949dc9eb.zip | |
Blackfin: move gd/bd to bss by default
We don't need these setup manually, so let the bss do the rest.  On
Blackfin systems, we clear the bss before executing any C code that
would use these, so this should be fine.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/lib/board.c')
| -rw-r--r-- | arch/blackfin/lib/board.c | 58 | 
1 files changed, 42 insertions, 16 deletions
| diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c index e3ee4cd35..2d424a2da 100644 --- a/arch/blackfin/lib/board.c +++ b/arch/blackfin/lib/board.c @@ -181,6 +181,46 @@ void init_cplbtables(void)  	}  } +static int global_board_data_init(void) +{ +#ifndef CONFIG_SYS_GBL_DATA_ADDR +# define CONFIG_SYS_GBL_DATA_ADDR 0 +#endif +#ifndef CONFIG_SYS_BD_INFO_ADDR +# define CONFIG_SYS_BD_INFO_ADDR 0 +#endif + +	bd_t *bd; + +	if (CONFIG_SYS_GBL_DATA_ADDR) { +		gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR); +		memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE); +	} else { +		static gd_t _bfin_gd; +		gd = &_bfin_gd; +	} + +	if (CONFIG_SYS_BD_INFO_ADDR) { +		bd = (bd_t *) (CONFIG_SYS_BD_INFO_ADDR); +		memset(bd, 0, GENERATED_BD_INFO_SIZE); +	} else { +		static bd_t _bfin_bd; +		bd = &_bfin_bd; +	} +	gd->bd = bd; + +	bd->bi_r_version = version_string; +	bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU); +	bd->bi_board_name = BFIN_BOARD_NAME; +	bd->bi_vco = get_vco(); +	bd->bi_cclk = get_cclk(); +	bd->bi_sclk = get_sclk(); +	bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; +	bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE; + +	return 0; +} +  /*   * All attempts to come up with a "common" initialization sequence   * that works for all boards and architectures failed: some of the @@ -201,7 +241,6 @@ extern int timer_init(void);  void board_init_f(ulong bootflag)  { -	bd_t *bd;  	char buf[32];  #ifdef CONFIG_BOARD_EARLY_INIT_F @@ -234,21 +273,8 @@ void board_init_f(ulong bootflag)  		hang();  #endif  	serial_early_puts("Init global data\n"); -	gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR); -	memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE); - -	bd = (bd_t *) (CONFIG_SYS_BD_INFO_ADDR); -	gd->bd = bd; -	memset((void *)bd, 0, GENERATED_BD_INFO_SIZE); -	bd->bi_r_version = version_string; -	bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU); -	bd->bi_board_name = BFIN_BOARD_NAME; -	bd->bi_vco = get_vco(); -	bd->bi_cclk = get_cclk(); -	bd->bi_sclk = get_sclk(); -	bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; -	bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE; +	global_board_data_init();  	/* Initialize */  	serial_early_puts("IRQ init\n"); @@ -276,7 +302,7 @@ void board_init_f(ulong bootflag)  	if (CONFIG_MEM_SIZE) {  		printf("RAM:   "); -		print_size(bd->bi_memsize, "\n"); +		print_size(gd->bd->bi_memsize, "\n");  	}  #if defined(CONFIG_POST) |