X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=common%2Fboard_r.c;h=3affb6362f4531ebd3f313248df1fbd7c588e7bf;hb=6126c8e88609286c04600da9dce7a7537f568845;hp=86ca1cbbd4e118ee6b8779476fa37964805fa1d3;hpb=8b485ba12b0defa0c4ed3559789250238f8331a8;p=karo-tx-uboot.git diff --git a/common/board_r.c b/common/board_r.c index 86ca1cbbd4..3affb6362f 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -18,6 +18,7 @@ #ifdef CONFIG_HAS_DATAFLASH #include #endif +#include #include #include #if defined(CONFIG_CMD_IDE) @@ -51,7 +52,9 @@ #ifdef CONFIG_X86 #include #endif +#include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -128,9 +131,9 @@ __weak int fixup_cpu(void) static int initr_reloc_global_data(void) { -#ifdef CONFIG_SYS_SYM_OFFSETS - monitor_flash_len = _end_ofs; -#elif !defined(CONFIG_SANDBOX) +#ifdef __ARM__ + monitor_flash_len = _end - __image_copy_start; +#elif !defined(CONFIG_SANDBOX) && !defined(CONFIG_NIOS2) monitor_flash_len = (ulong)&__init_end - gd->relocaddr; #endif #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) @@ -256,6 +259,10 @@ static int initr_malloc(void) { ulong malloc_start; +#ifdef CONFIG_SYS_MALLOC_F_LEN + debug("Pre-reloc malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr, + gd->malloc_ptr / 1024); +#endif /* The malloc area is immediately below the monitor copy in DRAM */ malloc_start = gd->relocaddr - TOTAL_MALLOC_LEN; mem_malloc_init((ulong)map_sysmem(malloc_start, TOTAL_MALLOC_LEN), @@ -263,6 +270,16 @@ static int initr_malloc(void) return 0; } +#ifdef CONFIG_DM +static int initr_dm(void) +{ + /* Save the pre-reloc driver model and start a new one */ + gd->dm_root_f = gd->dm_root; + gd->dm_root = NULL; + return dm_init_and_scan(false); +} +#endif + __weak int power_init_board(void) { return 0; @@ -337,7 +354,7 @@ static int initr_flash(void) } #endif -#ifdef CONFIG_PPC +#if defined(CONFIG_PPC) && !defined(CONFIG_DM_SPI) static int initr_spi(void) { /* PPC does this here */ @@ -498,6 +515,7 @@ static int show_model_r(void) # else checkboard(); # endif + return 0; } #endif @@ -557,21 +575,19 @@ static int initr_status_led(void) #if defined(CONFIG_CMD_SCSI) static int initr_scsi(void) { - /* Not supported properly on ARM yet */ -#ifndef CONFIG_ARM puts("SCSI: "); scsi_init(); -#endif return 0; } -#endif /* CONFIG_CMD_NET */ +#endif #if defined(CONFIG_CMD_DOC) static int initr_doc(void) { puts("DOC: "); doc_init(); + return 0; } #endif @@ -648,7 +664,7 @@ int initr_mem(void) /* Also take the logbuffer into account (pram is in kB) */ pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024; # endif - sprintf(memsz, "%ldk", (gd->ram_size / 1024) - pram); + sprintf(memsz, "%ldk", (long int) ((gd->ram_size / 1024) - pram)); setenv("mem", memsz); return 0; @@ -673,17 +689,6 @@ static int initr_kbd(void) } #endif -#ifdef CONFIG_MODEM_SUPPORT -static int initr_modem(void) -{ - /* TODO: with new initcalls, move this into the driver */ - extern int do_mdm_init; - - do_mdm_init = gd->do_mdm_init; - return 0; -} -#endif - static int run_main_loop(void) { #ifdef CONFIG_SANDBOX @@ -710,6 +715,18 @@ init_fnc_t init_sequence_r[] = { /* TODO: could x86/PPC have this also perhaps? */ #ifdef CONFIG_ARM initr_caches, +#endif + initr_reloc_global_data, +#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500) + initr_unlock_ram_in_cache, +#endif + initr_barrier, + initr_malloc, + bootstage_relocate, +#ifdef CONFIG_DM + initr_dm, +#endif +#ifdef CONFIG_ARM board_init, /* Setup chipselects */ #endif /* @@ -721,7 +738,7 @@ init_fnc_t init_sequence_r[] = { #ifdef CONFIG_CLOCKS set_cpu_clk_info, /* Setup clock information */ #endif - initr_reloc_global_data, + stdio_init_tables, initr_serial, initr_announce, INIT_FUNC_WATCHDOG_RESET @@ -745,9 +762,6 @@ init_fnc_t init_sequence_r[] = { #ifdef CONFIG_SYS_DELAYED_ICACHE initr_icache_enable, #endif -#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500) - initr_unlock_ram_in_cache, -#endif #if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT) /* * Do early PCI configuration _before_ the flash gets initialised, @@ -758,9 +772,6 @@ init_fnc_t init_sequence_r[] = { #ifdef CONFIG_WINBOND_83C553 initr_w83c553f, #endif - initr_barrier, - initr_malloc, - bootstage_relocate, #ifdef CONFIG_ARCH_EARLY_INIT_R arch_early_init_r, #endif @@ -810,7 +821,7 @@ init_fnc_t init_sequence_r[] = { */ initr_pci, #endif - stdio_init, + stdio_add_devices, initr_jumptable, #ifdef CONFIG_API initr_api, @@ -894,18 +905,25 @@ init_fnc_t init_sequence_r[] = { #endif #ifdef CONFIG_PS2KBD initr_kbd, -#endif -#ifdef CONFIG_MODEM_SUPPORT - initr_modem, #endif run_main_loop, }; void board_init_r(gd_t *new_gd, ulong dest_addr) { -#ifndef CONFIG_X86 +#ifdef CONFIG_NEEDS_MANUAL_RELOC + int i; +#endif + +#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64) gd = new_gd; #endif + +#ifdef CONFIG_NEEDS_MANUAL_RELOC + for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++) + init_sequence_r[i] += gd->reloc_off; +#endif + if (initcall_run_list(init_sequence_r)) hang();