]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - common/board_f.c
common: Simplify get_clocks() #ifdef
[people/ms/u-boot.git] / common / board_f.c
index 21be26f8e4051289b78de72933688ecd8d39135e..ed513058ee72bf7d9bb8ce88cd2d3070e793f03a 100644 (file)
@@ -144,7 +144,7 @@ static int init_baud_rate(void)
 
 static int display_text_info(void)
 {
-#ifndef CONFIG_SANDBOX
+#if !defined(CONFIG_SANDBOX) && !defined(CONFIG_EFI_APP)
        ulong bss_start, bss_end, text_base;
 
        bss_start = (ulong)&__bss_start;
@@ -206,7 +206,8 @@ static int show_dram_config(void)
        debug("\nRAM Configuration:\n");
        for (i = size = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
                size += gd->bd->bi_dram[i].size;
-               debug("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
+               debug("Bank #%d: %llx ", i,
+                     (unsigned long long)(gd->bd->bi_dram[i].start));
 #ifdef DEBUG
                print_size(gd->bd->bi_dram[i].size, "\n");
 #endif
@@ -267,10 +268,12 @@ static int setup_mon_len(void)
 {
 #if defined(__ARM__) || defined(__MICROBLAZE__)
        gd->mon_len = (ulong)&__bss_end - (ulong)_start;
-#elif defined(CONFIG_SANDBOX)
+#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
        gd->mon_len = (ulong)&_end - (ulong)_init;
 #elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2)
        gd->mon_len = CONFIG_SYS_MONITOR_LEN;
+#elif defined(CONFIG_NDS32)
+       gd->mon_len = (ulong)(&__bss_end) - (ulong)(&_start);
 #else
        /* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */
        gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
@@ -548,7 +551,7 @@ static int display_new_sp(void)
        return 0;
 }
 
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS)
 static int setup_board_part1(void)
 {
        bd_t *bd = gd->bd;
@@ -577,7 +580,9 @@ static int setup_board_part1(void)
 
        return 0;
 }
+#endif
 
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
 static int setup_board_part2(void)
 {
        bd_t *bd = gd->bd;
@@ -654,6 +659,8 @@ static int setup_dram_config(void)
 
 static int reloc_fdt(void)
 {
+       if (gd->flags & GD_FLG_SKIP_RELOC)
+               return 0;
        if (gd->new_fdt) {
                memcpy(gd->new_fdt, gd->fdt_blob, gd->fdt_size);
                gd->fdt_blob = gd->new_fdt;
@@ -664,6 +671,11 @@ static int reloc_fdt(void)
 
 static int setup_reloc(void)
 {
+       if (gd->flags & GD_FLG_SKIP_RELOC) {
+               debug("Skipping relocation due to flag\n");
+               return 0;
+       }
+
 #ifdef CONFIG_SYS_TEXT_BASE
        gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
 #ifdef CONFIG_M68K
@@ -689,6 +701,8 @@ static int setup_reloc(void)
 
 static int jump_to_copy(void)
 {
+       if (gd->flags & GD_FLG_SKIP_RELOC)
+               return 0;
        /*
         * x86 is special, but in a nice way. It uses a trampoline which
         * enables the dcache if possible.
@@ -704,6 +718,7 @@ static int jump_to_copy(void)
         * with the stack in SDRAM and Global Data in temporary memory
         * (CPU cache)
         */
+       arch_setup_gd(gd->new_gd);
        board_init_f_r_trampoline(gd->start_addr_sp);
 #else
        relocate_code(gd->start_addr_sp, gd->new_gd, gd->relocaddr);
@@ -753,9 +768,6 @@ static init_fnc_t init_sequence_f[] = {
 #ifdef CONFIG_OF_CONTROL
        fdtdec_setup,
 #endif
-#if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
-       x86_fsp_init,
-#endif
 #ifdef CONFIG_TRACE
        trace_early_init,
 #endif
@@ -763,6 +775,9 @@ static init_fnc_t init_sequence_f[] = {
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
        /* TODO: can this go into arch_cpu_init()? */
        probecpu,
+#endif
+#if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
+       x86_fsp_init,
 #endif
        arch_cpu_init,          /* basic arch cpu dependent setup */
        mark_bootstage,
@@ -781,7 +796,8 @@ 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) || defined(CONFIG_BLACKFIN)
+#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
+               defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32)
        timer_init,             /* initialize timer */
 #endif
 #ifdef CONFIG_SYS_ALLOC_DPRAM
@@ -792,10 +808,7 @@ static init_fnc_t init_sequence_f[] = {
 #if defined(CONFIG_BOARD_POSTCLK_INIT)
        board_postclk_init,
 #endif
-#ifdef CONFIG_FSL_ESDHC
-       get_clocks,
-#endif
-#ifdef CONFIG_M68K
+#if defined(CONFIG_SYS_FSL_CLK) || defined(CONFIG_M68K)
        get_clocks,
 #endif
        env_init,               /* initialize environment */
@@ -847,7 +860,8 @@ static init_fnc_t init_sequence_f[] = {
 #endif
        announce_dram_init,
        /* TODO: unify all these dram functions? */
-#if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32)
+#if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_NDS32) || \
+               defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32)
        dram_init,              /* configure available RAM banks */
 #endif
 #if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K)
@@ -879,7 +893,7 @@ static init_fnc_t init_sequence_f[] = {
         *  - board info struct
         */
        setup_dest_addr,
-#if defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2)
+#if defined(CONFIG_BLACKFIN)
        /* Blackfin u-boot monitor should be on top of the ram */
        reserve_uboot,
 #endif
@@ -904,7 +918,7 @@ static init_fnc_t init_sequence_f[] = {
                !defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)
        reserve_video,
 #endif
-#if !defined(CONFIG_BLACKFIN) && !defined(CONFIG_NIOS2)
+#if !defined(CONFIG_BLACKFIN)
        reserve_uboot,
 #endif
 #ifndef CONFIG_SPL_BUILD
@@ -918,8 +932,10 @@ static init_fnc_t init_sequence_f[] = {
        reserve_stacks,
        setup_dram_config,
        show_dram_config,
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS)
        setup_board_part1,
+#endif
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
        INIT_FUNC_WATCHDOG_RESET
        setup_board_part2,
 #endif
@@ -968,7 +984,8 @@ void board_init_f(ulong boot_flags)
        if (initcall_run_list(init_sequence_f))
                hang();
 
-#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
+#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
+               !defined(CONFIG_EFI_APP)
        /* NOTREACHED - jump_to_copy() does not return */
        hang();
 #endif
@@ -1014,23 +1031,3 @@ void board_init_f_r(void)
        hang();
 }
 #endif /* CONFIG_X86 */
-
-#ifndef CONFIG_X86
-ulong board_init_f_mem(ulong top)
-{
-       /* Leave space for the stack we are running with now */
-       top -= 0x40;
-
-       top -= sizeof(struct global_data);
-       top = ALIGN(top, 16);
-       gd = (struct global_data *)top;
-       memset((void *)gd, '\0', sizeof(*gd));
-
-#ifdef CONFIG_SYS_MALLOC_F_LEN
-       top -= CONFIG_SYS_MALLOC_F_LEN;
-       gd->malloc_base = top;
-#endif
-
-       return top;
-}
-#endif /* !CONFIG_X86 */