support blackfin board initialization in generic board_f
- 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>
This commit is contained in:
		
							parent
							
								
									c49eabeffc
								
							
						
					
					
						commit
						d54d7eb965
					
				|  | @ -106,9 +106,14 @@ __weak void blue_led_off(void) {} | ||||||
|  * Could the CONFIG_SPL_BUILD infection become a flag in gd? |  * 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) | 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"); | 	puts("       Watchdog enabled\n"); | ||||||
| 	WATCHDOG_RESET(); | 	WATCHDOG_RESET(); | ||||||
| 
 | 
 | ||||||
|  | @ -146,7 +151,11 @@ static int display_text_info(void) | ||||||
| 	bss_end = (ulong)&__bss_end; | 	bss_end = (ulong)&__bss_end; | ||||||
| 
 | 
 | ||||||
| 	debug("U-Boot code: %08X -> %08lX  BSS: -> %08lX\n", | 	debug("U-Boot code: %08X -> %08lX  BSS: -> %08lX\n", | ||||||
|  | #ifdef CONFIG_SYS_TEXT_BASE | ||||||
| 	      CONFIG_SYS_TEXT_BASE, bss_start, bss_end); | 	      CONFIG_SYS_TEXT_BASE, bss_start, bss_end); | ||||||
|  | #else | ||||||
|  | 	      CONFIG_SYS_MONITOR_BASE, bss_start, bss_end); | ||||||
|  | #endif | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_MODEM_SUPPORT | #ifdef CONFIG_MODEM_SUPPORT | ||||||
|  | @ -261,6 +270,8 @@ static int setup_mon_len(void) | ||||||
| 	gd->mon_len = (ulong)&__bss_end - (ulong)_start; | 	gd->mon_len = (ulong)&__bss_end - (ulong)_start; | ||||||
| #elif defined(CONFIG_SANDBOX) | #elif defined(CONFIG_SANDBOX) | ||||||
| 	gd->mon_len = (ulong)&_end - (ulong)_init; | 	gd->mon_len = (ulong)&_end - (ulong)_init; | ||||||
|  | #elif defined(CONFIG_BLACKFIN) | ||||||
|  | 	gd->mon_len = CONFIG_SYS_MONITOR_LEN; | ||||||
| #else | #else | ||||||
| 	/* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */ | 	/* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */ | ||||||
| 	gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE; | 	gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE; | ||||||
|  | @ -470,8 +481,9 @@ static int reserve_trace(void) | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \ | #if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \ | ||||||
| 		&& !defined(CONFIG_ARM) && !defined(CONFIG_X86) | 		!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \ | ||||||
|  | 		!defined(CONFIG_BLACKFIN) | ||||||
| static int reserve_video(void) | static int reserve_video(void) | ||||||
| { | { | ||||||
| 	/* reserve memory for video display (always full pages) */ | 	/* reserve memory for video display (always full pages) */ | ||||||
|  | @ -516,11 +528,13 @@ static int reserve_malloc(void) | ||||||
| /* (permanently) allocate a Board Info struct */ | /* (permanently) allocate a Board Info struct */ | ||||||
| static int reserve_board(void) | static int reserve_board(void) | ||||||
| { | { | ||||||
|  | 	if (!gd->bd) { | ||||||
| 		gd->start_addr_sp -= sizeof(bd_t); | 		gd->start_addr_sp -= sizeof(bd_t); | ||||||
| 		gd->bd = (bd_t *)map_sysmem(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)); | 		memset(gd->bd, '\0', sizeof(bd_t)); | ||||||
| 		debug("Reserving %zu Bytes for Board Info at: %08lx\n", | 		debug("Reserving %zu Bytes for Board Info at: %08lx\n", | ||||||
| 		      sizeof(bd_t), gd->start_addr_sp); | 		      sizeof(bd_t), gd->start_addr_sp); | ||||||
|  | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  | @ -721,7 +735,9 @@ static int reloc_fdt(void) | ||||||
| 
 | 
 | ||||||
| static int setup_reloc(void) | static int setup_reloc(void) | ||||||
| { | { | ||||||
|  | #ifdef CONFIG_SYS_TEXT_BASE | ||||||
| 	gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE; | 	gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE; | ||||||
|  | #endif | ||||||
| 	memcpy(gd->new_gd, (char *)gd, sizeof(gd_t)); | 	memcpy(gd->new_gd, (char *)gd, sizeof(gd_t)); | ||||||
| 
 | 
 | ||||||
| 	debug("Relocation Offset is: %08lx\n", gd->reloc_off); | 	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()? */ | 	/* TODO: can we rename this to timer_init()? */ | ||||||
| 	init_timebase, | 	init_timebase, | ||||||
| #endif | #endif | ||||||
| #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) | #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_BLACKFIN) | ||||||
| 	timer_init,		/* initialize timer */ | 	timer_init,		/* initialize timer */ | ||||||
| #endif | #endif | ||||||
| #ifdef CONFIG_SYS_ALLOC_DPRAM | #ifdef CONFIG_SYS_ALLOC_DPRAM | ||||||
|  | @ -929,6 +945,10 @@ static init_fnc_t init_sequence_f[] = { | ||||||
| 	 *  - board info struct | 	 *  - board info struct | ||||||
| 	 */ | 	 */ | ||||||
| 	setup_dest_addr, | 	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) | #if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR) | ||||||
| 	reserve_logbuffer, | 	reserve_logbuffer, | ||||||
| #endif | #endif | ||||||
|  | @ -945,11 +965,14 @@ static init_fnc_t init_sequence_f[] = { | ||||||
| #endif | #endif | ||||||
| 	reserve_trace, | 	reserve_trace, | ||||||
| 	/* TODO: Why the dependency on CONFIG_8xx? */ | 	/* TODO: Why the dependency on CONFIG_8xx? */ | ||||||
| #if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \ | #if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \ | ||||||
| 		&& !defined(CONFIG_ARM) && !defined(CONFIG_X86) | 		!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \ | ||||||
|  | 		!defined(CONFIG_BLACKFIN) | ||||||
| 	reserve_video, | 	reserve_video, | ||||||
| #endif | #endif | ||||||
|  | #if !defined(CONFIG_BLACKFIN) | ||||||
| 	reserve_uboot, | 	reserve_uboot, | ||||||
|  | #endif | ||||||
| #ifndef CONFIG_SPL_BUILD | #ifndef CONFIG_SPL_BUILD | ||||||
| 	reserve_malloc, | 	reserve_malloc, | ||||||
| 	reserve_board, | 	reserve_board, | ||||||
|  |  | ||||||
|  | @ -21,7 +21,8 @@ | ||||||
| int init_func_watchdog_reset(void); | int init_func_watchdog_reset(void); | ||||||
| #endif | #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_INIT	init_func_watchdog_init, | ||||||
| #define INIT_FUNC_WATCHDOG_RESET	init_func_watchdog_reset, | #define INIT_FUNC_WATCHDOG_RESET	init_func_watchdog_reset, | ||||||
| #else | #else | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue