]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/board_r.c
Merge http://git.denx.de/u-boot-sunxi
[karo-tx-uboot.git] / common / board_r.c
index 2298ba5761dba9a39ed5bc8ee2d5528a0bdc0ead..7c339008ed2a46b91677d4c4c9e5e97fd58f4a1f 100644 (file)
@@ -60,7 +60,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 ulong monitor_flash_len;
 
-int __board_flash_wp_on(void)
+__weak int board_flash_wp_on(void)
 {
        /*
         * Most flashes can't be detected when write protection is enabled,
@@ -70,16 +70,10 @@ int __board_flash_wp_on(void)
        return 0;
 }
 
-int board_flash_wp_on(void)
-       __attribute__ ((weak, alias("__board_flash_wp_on")));
-
-void __cpu_secondary_init_r(void)
+__weak void cpu_secondary_init_r(void)
 {
 }
 
-void cpu_secondary_init_r(void)
-       __attribute__ ((weak, alias("__cpu_secondary_init_r")));
-
 static int initr_secondary_cpu(void)
 {
        /*
@@ -133,7 +127,7 @@ static int initr_reloc_global_data(void)
 {
 #ifdef __ARM__
        monitor_flash_len = _end - __image_copy_start;
-#elif !defined(CONFIG_SANDBOX)
+#elif !defined(CONFIG_SANDBOX) && !defined(CONFIG_NIOS2)
        monitor_flash_len = (ulong)&__init_end - gd->relocaddr;
 #endif
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
@@ -273,27 +267,10 @@ static int initr_malloc(void)
 #ifdef CONFIG_DM
 static int initr_dm(void)
 {
-       int ret;
-
-       ret = dm_init();
-       if (ret) {
-               debug("dm_init() failed: %d\n", ret);
-               return ret;
-       }
-       ret = dm_scan_platdata();
-       if (ret) {
-               debug("dm_scan_platdata() failed: %d\n", ret);
-               return ret;
-       }
-#ifdef CONFIG_OF_CONTROL
-       ret = dm_scan_fdt(gd->fdt_blob);
-       if (ret) {
-               debug("dm_scan_fdt() failed: %d\n", ret);
-               return ret;
-       }
-#endif
-
-       return 0;
+       /* 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
 
@@ -371,7 +348,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 */
@@ -387,7 +364,7 @@ static int initr_spi(void)
 
 #ifdef CONFIG_CMD_NAND
 /* go init the NAND */
-int initr_nand(void)
+static int initr_nand(void)
 {
        puts("NAND:  ");
        nand_init();
@@ -397,7 +374,7 @@ int initr_nand(void)
 
 #if defined(CONFIG_CMD_ONENAND)
 /* go init the NAND */
-int initr_onenand(void)
+static int initr_onenand(void)
 {
        puts("NAND:  ");
        onenand_init();
@@ -406,7 +383,7 @@ int initr_onenand(void)
 #endif
 
 #ifdef CONFIG_GENERIC_MMC
-int initr_mmc(void)
+static int initr_mmc(void)
 {
        puts("MMC:   ");
        mmc_initialize(gd->bd);
@@ -415,7 +392,7 @@ int initr_mmc(void)
 #endif
 
 #ifdef CONFIG_HAS_DATAFLASH
-int initr_dataflash(void)
+static int initr_dataflash(void)
 {
        AT91F_DataflashInit();
        dataflash_print_info();
@@ -604,6 +581,7 @@ static int initr_doc(void)
 {
        puts("DOC:   ");
        doc_init();
+       return 0;
 }
 #endif
 
@@ -680,7 +658,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;
@@ -731,6 +709,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
        /*
@@ -742,7 +732,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
@@ -766,9 +756,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,
@@ -778,12 +765,6 @@ init_fnc_t init_sequence_r[] = {
 #endif
 #ifdef CONFIG_WINBOND_83C553
        initr_w83c553f,
-#endif
-       initr_barrier,
-       initr_malloc,
-       bootstage_relocate,
-#ifdef CONFIG_DM
-       initr_dm,
 #endif
 #ifdef CONFIG_ARCH_EARLY_INIT_R
        arch_early_init_r,
@@ -834,7 +815,7 @@ init_fnc_t init_sequence_r[] = {
         */
        initr_pci,
 #endif
-       stdio_init,
+       stdio_add_devices,
        initr_jumptable,
 #ifdef CONFIG_API
        initr_api,
@@ -928,7 +909,7 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
        int i;
 #endif
 
-#ifndef CONFIG_X86
+#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
        gd = new_gd;
 #endif