Merge branch 'u-boot-ti/master' into 'u-boot-arm/master'
[oweals/u-boot.git] / arch / mips / lib / board.c
index 84e55f2102849d06408e88fdd159b6671c903e6a..fac791520e10444b18d44ccac9e595e945800bba 100644 (file)
@@ -24,6 +24,7 @@
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
+#include <serial.h>
 #include <stdio_dev.h>
 #include <version.h>
 #include <net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-extern int timer_init(void);
-
-extern int incaip_set_cpuclk(void);
-
-extern ulong uboot_end_data;
-extern ulong uboot_end;
-
 ulong monitor_flash_len;
 
 static char *failed = "*** failed ***\n";
@@ -53,7 +47,7 @@ static char *failed = "*** failed ***\n";
  * mips_io_port_base is the begin of the address space to which x86 style
  * I/O ports are mapped.
  */
-unsigned long mips_io_port_base = -1;
+const unsigned long mips_io_port_base = -1;
 
 int __board_early_init_f(void)
 {
@@ -149,7 +143,7 @@ void board_init_f(ulong bootflag)
        gd_t gd_data, *id;
        bd_t *bd;
        init_fnc_t **init_fnc_ptr;
-       ulong addr, addr_sp, len = (ulong)&uboot_end - CONFIG_SYS_MONITOR_BASE;
+       ulong addr, addr_sp, len;
        ulong *s;
 
        /* Pointer is writable since we allocated a register for it.
@@ -182,6 +176,7 @@ void board_init_f(ulong bootflag)
        /* Reserve memory for U-Boot code, data & bss
         * round down to next 16 kB limit
         */
+       len = bss_end() - CONFIG_SYS_MONITOR_BASE;
        addr -= len;
        addr &= ~(16 * 1024 - 1);
 
@@ -254,10 +249,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
 {
 #ifndef CONFIG_SYS_NO_FLASH
        ulong size;
-#endif
-       extern void malloc_bin_reloc(void);
-#ifndef CONFIG_ENV_IS_NOWHERE
-       extern char *env_name_spec;
 #endif
        bd_t *bd;
 
@@ -268,27 +259,15 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
        gd->reloc_off = dest_addr - CONFIG_SYS_MONITOR_BASE;
 
-       monitor_flash_len = (ulong)&uboot_end_data - dest_addr;
+       monitor_flash_len = image_copy_end() - dest_addr;
 
-#if defined(CONFIG_NEEDS_MANUAL_RELOC)
-       /*
-        * We have to relocate the command table manually
-        */
-       fixup_cmdtable(&__u_boot_cmd_start,
-               (ulong)(&__u_boot_cmd_end - &__u_boot_cmd_start));
-#endif /* defined(CONFIG_NEEDS_MANUAL_RELOC) */
-
-       /* there are some other pointer constants we must deal with */
-#ifndef CONFIG_ENV_IS_NOWHERE
-       env_name_spec += gd->reloc_off;
-#endif
+       serial_initialize();
 
        bd = gd->bd;
 
        /* The Malloc area is immediately below the monitor copy in DRAM */
        mem_malloc_init(CONFIG_SYS_MONITOR_BASE + gd->reloc_off -
                        TOTAL_MALLOC_LEN, TOTAL_MALLOC_LEN);
-       malloc_bin_reloc();
 
 #ifndef CONFIG_SYS_NO_FLASH
        /* configure available FLASH banks */
@@ -339,14 +318,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
        /* Initialize from environment */
        load_addr = getenv_ulong("loadaddr", 16, load_addr);
-#if defined(CONFIG_CMD_NET)
-       {
-               char *s = getenv("bootfile");
-
-               if (s != NULL)
-                       copy_filename(BootFile, s, sizeof(BootFile));
-       }
-#endif
 
 #ifdef CONFIG_CMD_SPI
        puts("SPI:   ");
@@ -373,10 +344,3 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
        /* NOTREACHED - no way out of command loop except booting */
 }
-
-void hang(void)
-{
-       puts("### ERROR ### Please RESET the board ###\n");
-       for (;;)
-               ;
-}