apollon: use the last memory area for u-boot
[platform/kernel/u-boot.git] / lib_mips / board.c
index 654c5af..09b8b3b 100644 (file)
@@ -28,6 +28,8 @@
 #include <version.h>
 #include <net.h>
 #include <environment.h>
+#include <nand.h>
+#include <spi.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -62,6 +64,11 @@ static ulong mem_malloc_start;
 static ulong mem_malloc_end;
 static ulong mem_malloc_brk;
 
+/*
+ * 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;
 
 /*
  * The Malloc area is immediately below the monitor copy in DRAM
@@ -116,12 +123,13 @@ static int display_banner(void)
        return (0);
 }
 
+#ifndef CFG_NO_FLASH
 static void display_flash_config(ulong size)
 {
        puts ("Flash: ");
        print_size (size, "\n");
 }
-
+#endif
 
 static int init_baudrate (void)
 {
@@ -234,15 +242,15 @@ void board_init_f(ulong bootflag)
        addr_sp -= sizeof(bd_t);
        bd = (bd_t *)addr_sp;
        gd->bd = bd;
-       debug ("Reserving %d Bytes for Board Info at: %08lx\n",
+       debug ("Reserving %zu Bytes for Board Info at: %08lx\n",
                        sizeof(bd_t), addr_sp);
 
        addr_sp -= sizeof(gd_t);
        id = (gd_t *)addr_sp;
-       debug ("Reserving %d Bytes for Global Data at: %08lx\n",
+       debug ("Reserving %zu Bytes for Global Data at: %08lx\n",
                        sizeof (gd_t), addr_sp);
 
-       /* Reserve memory for boot params.
+       /* Reserve memory for boot params.
         */
        addr_sp -= CFG_BOOTPARAMS_LEN;
        bd->bi_boot_params = addr_sp;
@@ -296,7 +304,9 @@ void board_init_f(ulong bootflag)
 void board_init_r (gd_t *id, ulong dest_addr)
 {
        cmd_tbl_t *cmdtp;
+#ifndef CFG_NO_FLASH
        ulong size;
+#endif
        extern void malloc_bin_reloc (void);
 #ifndef CFG_ENV_IS_NOWHERE
        extern char * env_name_spec;
@@ -317,7 +327,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
        /*
         * We have to relocate the command table manually
         */
-       for (cmdtp = &__u_boot_cmd_start; cmdtp !=  &__u_boot_cmd_end; cmdtp++) {
+       for (cmdtp = &__u_boot_cmd_start; cmdtp !=  &__u_boot_cmd_end; cmdtp++) {
                ulong addr;
 
                addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
@@ -347,13 +357,16 @@ void board_init_r (gd_t *id, ulong dest_addr)
        env_name_spec += gd->reloc_off;
 #endif
 
+       bd = gd->bd;
+
+#ifndef CFG_NO_FLASH
        /* configure available FLASH banks */
        size = flash_init();
        display_flash_config (size);
+       bd->bi_flashsize = size;
+#endif
 
-       bd = gd->bd;
        bd->bi_flashstart = CFG_FLASH_BASE;
-       bd->bi_flashsize = size;
 #if CFG_MONITOR_BASE == CFG_FLASH_BASE
        bd->bi_flashoffset = monitor_flash_len; /* reserved area for U-Boot */
 #else
@@ -399,18 +412,29 @@ void board_init_r (gd_t *id, ulong dest_addr)
        if ((s = getenv ("loadaddr")) != NULL) {
                load_addr = simple_strtoul (s, NULL, 16);
        }
-#if (CONFIG_COMMANDS & CFG_CMD_NET) || defined(CONFIG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
        if ((s = getenv ("bootfile")) != NULL) {
                copy_filename (BootFile, s, sizeof (BootFile));
        }
-#endif /* CFG_CMD_NET */
+#endif
+
+#ifdef CONFIG_CMD_NAND
+       puts ("NAND:  ");
+       nand_init ();           /* go init the NAND */
+#endif
+
+#ifdef CONFIG_CMD_SPI
+       puts ("SPI:   ");
+       spi_init ();            /* go init the SPI */
+       puts ("ready\n");
+#endif
 
 #if defined(CONFIG_MISC_INIT_R)
        /* miscellaneous platform dependent initialisations */
        misc_init_r ();
 #endif
 
-#if (CONFIG_COMMANDS & CFG_CMD_NET) || defined(CONFIG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
        puts ("Net:   ");
 #endif