]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - common/board_r.c
usb: dwc3: add dwc3 folder from linux kernel to u-boot
[people/ms/u-boot.git] / common / board_r.c
index 19c64271ab9d151be1d7e289af50973c62427875..0335f6bde6ce78f002d34b3ef05b2c14b91b86d7 100644 (file)
@@ -55,6 +55,9 @@
 #include <dm/root.h>
 #include <linux/compiler.h>
 #include <linux/err.h>
+#ifdef CONFIG_AVR32
+#include <asm/arch/mmu.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -164,14 +167,17 @@ static int initr_serial(void)
        return 0;
 }
 
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
 static int initr_trap(void)
 {
        /*
         * Setup trap handlers
         */
+#if defined(CONFIG_PPC)
        trap_init(gd->relocaddr);
-
+#else
+       trap_init(CONFIG_SYS_SDRAM_BASE);
+#endif
        return 0;
 }
 #endif
@@ -265,6 +271,14 @@ static int initr_malloc(void)
        return 0;
 }
 
+#ifdef CONFIG_SYS_NONCACHED_MEMORY
+static int initr_noncached(void)
+{
+       noncached_init();
+       return 0;
+}
+#endif
+
 #ifdef CONFIG_DM
 static int initr_dm(void)
 {
@@ -286,31 +300,28 @@ static int initr_announce(void)
        return 0;
 }
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+static int initr_manual_reloc_cmdtable(void)
+{
+       fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd),
+                      ll_entry_count(cmd_tbl_t, cmd));
+       return 0;
+}
+#endif
+
 #if !defined(CONFIG_SYS_NO_FLASH)
 static int initr_flash(void)
 {
        ulong flash_size = 0;
        bd_t *bd = gd->bd;
-       int ok;
 
        puts("Flash: ");
 
-       if (board_flash_wp_on()) {
+       if (board_flash_wp_on())
                printf("Uninitialized - Write Protect On\n");
-               /* Since WP is on, we can't find real size.  Set to 0 */
-               ok = 1;
-       } else {
+       else
                flash_size = flash_init();
-               ok = flash_size > 0;
-       }
-       if (!ok) {
-               puts("*** failed ***\n");
-#ifdef CONFIG_PPC
-               /* Why does PPC do this? */
-               hang();
-#endif
-               return -1;
-       }
+
        print_size(flash_size, "");
 #ifdef CONFIG_SYS_FLASH_CHECKSUM
        /*
@@ -454,20 +465,14 @@ static int initr_env(void)
        return 0;
 }
 
-#ifdef CONFIG_HERMES
-static int initr_hermes(void)
+#ifdef CONFIG_SYS_BOOTPARAMS_LEN
+static int initr_malloc_bootparams(void)
 {
-       if ((gd->board_type >> 16) == 2)
-               gd->bd->bi_ethspeed = gd->board_type & 0xFFFF;
-       else
-               gd->bd->bi_ethspeed = 0xFFFF;
-       return 0;
-}
-
-static int initr_hermes_start(void)
-{
-       if (gd->bd->bi_ethspeed != 0xFFFF)
-               hermes_start_lxt980((int) gd->bd->bi_ethspeed);
+       gd->bd->bi_boot_params = (ulong)malloc(CONFIG_SYS_BOOTPARAMS_LEN);
+       if (!gd->bd->bi_boot_params) {
+               puts("WARNING: Cannot allocate space for boot parameters\n");
+               return -ENOMEM;
+       }
        return 0;
 }
 #endif
@@ -498,24 +503,8 @@ static int initr_api(void)
 }
 #endif
 
-#ifdef CONFIG_DISPLAY_BOARDINFO_LATE
-static int show_model_r(void)
-{
-       /* Put this here so it appears on the LCD, now it is ready */
-# ifdef CONFIG_OF_CONTROL
-       const char *model;
-
-       model = (char *)fdt_getprop(gd->fdt_blob, 0, "model", NULL);
-       printf("Model: %s\n", model ? model : "<unknown>");
-# else
-       checkboard();
-# endif
-       return 0;
-}
-#endif
-
 /* enable exceptions */
-#ifdef CONFIG_ARM
+#if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
 static int initr_enable_interrupts(void)
 {
        enable_interrupts();
@@ -717,6 +706,9 @@ init_fnc_t init_sequence_r[] = {
 #endif
        initr_barrier,
        initr_malloc,
+#ifdef CONFIG_SYS_NONCACHED_MEMORY
+       initr_noncached,
+#endif
        bootstage_relocate,
 #ifdef CONFIG_DM
        initr_dm,
@@ -737,7 +729,10 @@ init_fnc_t init_sequence_r[] = {
        initr_serial,
        initr_announce,
        INIT_FUNC_WATCHDOG_RESET
-#ifdef CONFIG_PPC
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+       initr_manual_reloc_cmdtable,
+#endif
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
        initr_trap,
 #endif
 #ifdef CONFIG_ADDR_MAP
@@ -775,7 +770,7 @@ init_fnc_t init_sequence_r[] = {
        initr_flash,
 #endif
        INIT_FUNC_WATCHDOG_RESET
-#if defined(CONFIG_PPC) || defined(CONFIG_X86)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
        /* initialize higher level parts of CPU like time base and timers */
        cpu_init_r,
 #endif
@@ -798,14 +793,14 @@ init_fnc_t init_sequence_r[] = {
        initr_dataflash,
 #endif
        initr_env,
+#ifdef CONFIG_SYS_BOOTPARAMS_LEN
+       initr_malloc_bootparams,
+#endif
        INIT_FUNC_WATCHDOG_RESET
        initr_secondary_cpu,
 #ifdef CONFIG_SC3
        initr_sc3_read_eeprom,
 #endif
-#ifdef CONFIG_HERMES
-       initr_hermes,
-#endif
 #if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET)
        mac_read_from_eeprom,
 #endif
@@ -823,29 +818,24 @@ init_fnc_t init_sequence_r[] = {
 #endif
        console_init_r,         /* fully init console as a device */
 #ifdef CONFIG_DISPLAY_BOARDINFO_LATE
-       show_model_r,
+       show_board_info,
 #endif
 #ifdef CONFIG_ARCH_MISC_INIT
        arch_misc_init,         /* miscellaneous arch-dependent init */
 #endif
 #ifdef CONFIG_MISC_INIT_R
        misc_init_r,            /* miscellaneous platform-dependent init */
-#endif
-#ifdef CONFIG_HERMES
-       initr_hermes_start,
 #endif
        INIT_FUNC_WATCHDOG_RESET
 #ifdef CONFIG_CMD_KGDB
        initr_kgdb,
-#endif
-#ifdef CONFIG_X86
-       board_early_init_r,
 #endif
        interrupt_init,
-#if defined(CONFIG_ARM) || defined(CONFIG_x86)
+#if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
        initr_enable_interrupts,
 #endif
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) \
+       || defined(CONFIG_M68K)
        timer_init,             /* initialize timer */
 #endif
 #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
@@ -910,6 +900,10 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
        int i;
 #endif
 
+#ifdef CONFIG_AVR32
+       mmu_init_r(dest_addr);
+#endif
+
 #if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
        gd = new_gd;
 #endif