* Patches by Udi Finkelstein, 2 June 2003:
[platform/kernel/u-boot.git] / lib_ppc / board.c
index a11288d..56cbdfe 100644 (file)
@@ -73,6 +73,9 @@ void doc_init (void);
     defined(CONFIG_SOFT_I2C)
 #include <i2c.h>
 #endif
+#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+void nand_init (void);
+#endif
 
 static char *failed = "*** failed ***\n";
 
@@ -90,6 +93,11 @@ extern flash_info_t flash_info[];
 #define        TOTAL_MALLOC_LEN        CFG_MALLOC_LEN
 #endif
 
+extern ulong __init_end;
+extern ulong _end;
+
+ulong monitor_flash_len;
+
 /*
  * Begin and End of memory area for malloc(), and current "brk"
  */
@@ -171,7 +179,7 @@ static void syscalls_init (void)
        /* Initialize syscalls stack pointer                                 */
        addr = (ulong *) 0xCFC;
        *addr = (ulong)addr;
-#ifndef CONFIG_5xx     
+#ifndef CONFIG_5xx
        flush_cache ((ulong)addr, 0x10);
 #endif
 }
@@ -380,16 +388,7 @@ void board_init_f (ulong bootflag)
         *  - monitor code
         *  - board info struct
         */
-       len = get_endaddr () - CFG_MONITOR_BASE;
-
-       if (len > CFG_MONITOR_LEN) {
-               printf ("*** U-Boot size %ld > reserved memory (%d)\n",
-                               len, CFG_MONITOR_LEN);
-               hang ();
-       }
-
-       if (CFG_MONITOR_LEN > len)
-               len = CFG_MONITOR_LEN;
+       len = (ulong)&_end - CFG_MONITOR_BASE;
 
 #ifndef        CONFIG_VERY_BIG_RAM
        addr = CFG_SDRAM_BASE + gd->ram_size;
@@ -532,7 +531,7 @@ void board_init_f (ulong bootflag)
 
        bd->bi_procfreq = gd->cpu_clk;  /* Processor Speed, In Hz */
        bd->bi_plb_busfreq = gd->bus_clk;
-#ifdef CONFIG_405GP
+#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
        bd->bi_pci_busfreq = get_PCI_freq ();
 #endif
 #endif
@@ -597,6 +596,8 @@ void board_init_r (gd_t *id, ulong dest_addr)
        WATCHDOG_RESET ();
 
        gd->reloc_off = dest_addr - CFG_MONITOR_BASE;
+       
+       monitor_flash_len = (ulong)&__init_end - dest_addr;
 
        /*
         * We have to relocate the command table manually
@@ -702,7 +703,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #if defined(CONFIG_PCU_E) || defined(CONFIG_OXC)
        bd->bi_flashoffset = 0;
 #elif CFG_MONITOR_BASE == CFG_FLASH_BASE
-       bd->bi_flashoffset = CFG_MONITOR_LEN;   /* reserved area for startup monitor  */
+       bd->bi_flashoffset = monitor_flash_len; /* reserved area for startup monitor  */
 #else
        bd->bi_flashoffset = 0;
 #endif
@@ -911,6 +912,11 @@ void board_init_r (gd_t *id, ulong dest_addr)
        doc_init ();
 #endif
 
+#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+       WATCHDOG_RESET ();
+       nand_init();            /* go init the NAND */
+#endif
+
 #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI)
        WATCHDOG_RESET ();
        puts ("Net:   ");