]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/board_r.c
board_f: call timer_init on MIPS
[karo-tx-uboot.git] / common / board_r.c
index f7a036e32f42e0adcbda61cebb566ee695dd2340..d1f0aa9b1ad12272bb657d6fabbad382d72ad746 100644 (file)
@@ -7,23 +7,7 @@
  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  * Marius Groeger <mgroeger@sysgo.de>
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -34,6 +18,7 @@
 #ifdef CONFIG_HAS_DATAFLASH
 #include <dataflash.h>
 #endif
+#include <dm.h>
 #include <environment.h>
 #include <fdtdec.h>
 #if defined(CONFIG_CMD_IDE)
@@ -67,7 +52,9 @@
 #ifdef CONFIG_X86
 #include <asm/init_helpers.h>
 #endif
+#include <dm/root.h>
 #include <linux/compiler.h>
+#include <linux/err.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -144,8 +131,8 @@ __weak int fixup_cpu(void)
 
 static int initr_reloc_global_data(void)
 {
-#ifdef CONFIG_SYS_SYM_OFFSETS
-       monitor_flash_len = _end_ofs;
+#ifdef __ARM__
+       monitor_flash_len = _end - __image_copy_start;
 #elif !defined(CONFIG_SANDBOX)
        monitor_flash_len = (ulong)&__init_end - gd->relocaddr;
 #endif
@@ -279,6 +266,33 @@ static int initr_malloc(void)
        return 0;
 }
 
+#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;
+}
+#endif
+
 __weak int power_init_board(void)
 {
        return 0;
@@ -514,6 +528,7 @@ static int show_model_r(void)
 # else
        checkboard();
 # endif
+       return 0;
 }
 #endif
 
@@ -777,6 +792,9 @@ init_fnc_t init_sequence_r[] = {
        initr_barrier,
        initr_malloc,
        bootstage_relocate,
+#ifdef CONFIG_DM
+       initr_dm,
+#endif
 #ifdef CONFIG_ARCH_EARLY_INIT_R
        arch_early_init_r,
 #endif
@@ -919,9 +937,19 @@ init_fnc_t init_sequence_r[] = {
 
 void board_init_r(gd_t *new_gd, ulong dest_addr)
 {
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+       int i;
+#endif
+
 #ifndef CONFIG_X86
        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();