]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/board_f.c
x86: Remove board_early_init_r()
[karo-tx-uboot.git] / common / board_f.c
index ea33eadc16e8844bc380251367a870c637658174..f8fd324d0d79741c0741f24d38645895c22a2fbb 100644 (file)
@@ -34,7 +34,7 @@
 #ifdef CONFIG_MPC5xxx
 #include <mpc5xxx.h>
 #endif
-#if (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
+#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
 #include <asm/mp.h>
 #endif
 
@@ -128,14 +128,11 @@ int init_func_watchdog_reset(void)
 }
 #endif /* CONFIG_WATCHDOG */
 
-void __board_add_ram_info(int use_default)
+__weak void board_add_ram_info(int use_default)
 {
        /* please define platform specific board_add_ram_info() */
 }
 
-void board_add_ram_info(int)
-       __attribute__ ((weak, alias("__board_add_ram_info")));
-
 static int init_baud_rate(void)
 {
        gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
@@ -145,17 +142,19 @@ static int init_baud_rate(void)
 static int display_text_info(void)
 {
 #ifndef CONFIG_SANDBOX
-       ulong bss_start, bss_end;
+       ulong bss_start, bss_end, text_base;
 
        bss_start = (ulong)&__bss_start;
        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);
+       text_base = CONFIG_SYS_TEXT_BASE;
 #else
-             CONFIG_SYS_MONITOR_BASE, bss_start, bss_end);
+       text_base = CONFIG_SYS_MONITOR_BASE;
 #endif
+
+       debug("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
+               text_base, bss_start, bss_end);
 #endif
 
 #ifdef CONFIG_MODEM_SUPPORT
@@ -221,7 +220,7 @@ static int show_dram_config(void)
        return 0;
 }
 
-void __dram_init_banksize(void)
+__weak void dram_init_banksize(void)
 {
 #if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE)
        gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
@@ -229,9 +228,6 @@ void __dram_init_banksize(void)
 #endif
 }
 
-void dram_init_banksize(void)
-       __attribute__((weak, alias("__dram_init_banksize")));
-
 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
 static int init_func_i2c(void)
 {
@@ -291,7 +287,7 @@ static int read_fdt_from_file(void)
        struct sandbox_state *state = state_get_current();
        const char *fname = state->fdt_fname;
        void *blob;
-       ssize_t size;
+       loff_t size;
        int err;
        int fd;
 
@@ -304,10 +300,10 @@ static int read_fdt_from_file(void)
                return -EINVAL;
        }
 
-       size = os_get_filesize(fname);
-       if (size < 0) {
+       err = os_get_filesize(fname, &size);
+       if (err < 0) {
                printf("Failed to file FDT file '%s'\n", fname);
-               return -ENOENT;
+               return err;
        }
        fd = os_open(fname, OS_O_RDONLY);
        if (fd < 0) {
@@ -341,21 +337,23 @@ static int setup_ram_buf(void)
 
 static int setup_fdt(void)
 {
-#ifdef CONFIG_OF_EMBED
+#ifdef CONFIG_OF_CONTROL
+# ifdef CONFIG_OF_EMBED
        /* Get a pointer to the FDT */
        gd->fdt_blob = __dtb_dt_begin;
-#elif defined CONFIG_OF_SEPARATE
+# elif defined CONFIG_OF_SEPARATE
        /* FDT is at end of image */
        gd->fdt_blob = (ulong *)&_end;
-#elif defined(CONFIG_OF_HOSTFILE)
+# elif defined(CONFIG_OF_HOSTFILE)
        if (read_fdt_from_file()) {
                puts("Failed to read control FDT\n");
                return -1;
        }
-#endif
+# endif
        /* Allow the early environment to override the fdt address */
        gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
                                                (uintptr_t)gd->fdt_blob);
+#endif
        return 0;
 }
 
@@ -392,7 +390,7 @@ static int setup_dest_addr(void)
        gd->ram_top = board_get_usable_ram_top(gd->mon_len);
        gd->relocaddr = gd->ram_top;
        debug("Ram top: %08lX\n", (ulong)gd->ram_top);
-#if (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
+#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
        /*
         * We need to make sure the location we intend to put secondary core
         * boot code is reserved and not used by any part of u-boot
@@ -583,7 +581,7 @@ static int reserve_stacks(void)
        gd->irq_sp = gd->start_addr_sp;
 # endif
 #else
-# ifdef CONFIG_PPC
+# if defined(CONFIG_PPC) || defined(CONFIG_MIPS)
        ulong *s;
 # endif
 
@@ -613,6 +611,12 @@ static int reserve_stacks(void)
        s = (ulong *) gd->start_addr_sp;
        *s = 0; /* Terminate back chain */
        *++s = 0; /* NULL return address */
+# elif defined(CONFIG_MIPS)
+       /* Clear initial stack frame */
+       s = (ulong *) gd->start_addr_sp;
+       *s-- = 0;
+       *s-- = 0;
+       gd->start_addr_sp = (ulong) s;
 # endif /* Architecture specific code */
 
        return 0;
@@ -816,22 +820,16 @@ static init_fnc_t init_sequence_f[] = {
        setup_mon_len,
        setup_fdt,
        trace_early_init,
+       initf_malloc,
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
        /* TODO: can this go into arch_cpu_init()? */
        probecpu,
 #endif
        arch_cpu_init,          /* basic arch cpu dependent setup */
-#ifdef CONFIG_X86
-       cpu_init_f,             /* TODO(sjg@chromium.org): remove */
-# ifdef CONFIG_OF_CONTROL
-       find_fdt,               /* TODO(sjg@chromium.org): remove */
-# endif
-#endif
        mark_bootstage,
 #ifdef CONFIG_OF_CONTROL
        fdtdec_check_fdt,
 #endif
-       initf_malloc,
        initf_dm,
 #if defined(CONFIG_BOARD_EARLY_INIT_F)
        board_early_init_f,
@@ -906,14 +904,10 @@ static init_fnc_t init_sequence_f[] = {
 #endif
 #if defined(CONFIG_HARD_SPI)
        init_func_spi,
-#endif
-#ifdef CONFIG_X86
-       dram_init_f,            /* configure available RAM banks */
-       calculate_relocation_address,
 #endif
        announce_dram_init,
        /* TODO: unify all these dram functions? */
-#ifdef CONFIG_ARM
+#if defined(CONFIG_ARM) || defined(CONFIG_X86)
        dram_init,              /* configure available RAM banks */
 #endif
 #if defined(CONFIG_MIPS) || defined(CONFIG_PPC)