]> git.sur5r.net Git - u-boot/blobdiff - lib_ppc/board.c
82xx, ids8247: added ids8247 board to MAKEALL script
[u-boot] / lib_ppc / board.c
index 61c29b563d077a6cdba43604df6c7feb196bd4a7..9e944fa38a161036c066c61fad2ca135cfc6fe0c 100644 (file)
@@ -38,9 +38,6 @@
 #if defined(CONFIG_CMD_IDE)
 #include <ide.h>
 #endif
-#if defined(CONFIG_CMD_SATA)
-#include <sata.h>
-#endif
 #if defined(CONFIG_CMD_SCSI)
 #include <scsi.h>
 #endif
@@ -51,6 +48,9 @@
 #include <status_led.h>
 #endif
 #include <net.h>
+#ifdef CONFIG_GENERIC_MMC
+#include <mmc.h>
+#endif
 #include <serial.h>
 #ifdef CONFIG_SYS_ALLOC_DPRAM
 #if !defined(CONFIG_CPM2)
 #include <asm/mmu.h>
 #endif
 
+#ifdef CONFIG_MP
+#include <asm/mp.h>
+#endif
+
 #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
 extern int update_flash_size (int flash_size);
 #endif
@@ -339,9 +343,6 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_HARD_SPI)
        init_func_spi,
 #endif
-#if defined(CONFIG_DTT)                /* Digital Thermometers and Thermostats */
-       dtt_init,
-#endif
 #ifdef CONFIG_POST
        post_init_f,
 #endif
@@ -355,9 +356,6 @@ init_fnc_t *init_sequence[] = {
        NULL,                   /* Terminate this list */
 };
 
-#ifndef CONFIG_MAX_MEM_MAPPED
-#define CONFIG_MAX_MEM_MAPPED (256 << 20)
-#endif
 ulong get_effective_memsize(void)
 {
 #ifndef        CONFIG_VERY_BIG_RAM
@@ -450,6 +448,17 @@ void board_init_f (ulong bootflag)
 
        addr = CONFIG_SYS_SDRAM_BASE + get_effective_memsize();
 
+#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
+       /*
+        * We need to make sure the location we intend to put secondary core
+        * boot code is reserved and not used by any part of u-boot
+        */
+       if (addr > determine_mp_bootpg()) {
+               addr = determine_mp_bootpg();
+               debug ("Reserving MP boot page to %08lx\n", addr);
+       }
+#endif
+
 #ifdef CONFIG_LOGBUFFER
 #ifndef CONFIG_ALT_LB_ADDR
        /* reserve kernel log buffer */
@@ -639,16 +648,6 @@ void board_init_f (ulong bootflag)
        /* NOTREACHED - relocate_code() does not return */
 }
 
-int __is_sata_supported(void)
-{
-       /* For some boards, when sata disabled by the switch, and the
-        * driver still access the sata registers, the cpu will hangup.
-        * please define platform specific is_sata_supported() if your
-        * board have such issue.*/
-       return 1;
-}
-int is_sata_supported(void) __attribute__((weak, alias("__is_sata_supported")));
-
 /************************************************************************
  *
  * This is the next part if the initialization sequence: we are now
@@ -661,9 +660,8 @@ int is_sata_supported(void) __attribute__((weak, alias("__is_sata_supported")));
 void board_init_r (gd_t *id, ulong dest_addr)
 {
        cmd_tbl_t *cmdtp;
-       char *s, *e;
+       char *s;
        bd_t *bd;
-       int i;
        extern void malloc_bin_reloc (void);
 #ifndef CONFIG_ENV_IS_NOWHERE
        extern char * env_name_spec;
@@ -698,7 +696,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
         */
        trap_init (dest_addr);
 
-#if defined(CONFIG_ADDR_MAP) && defined(CONFIG_E500)
+#ifdef CONFIG_ADDR_MAP
        init_addr_map();
 #endif
 
@@ -752,8 +750,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        WATCHDOG_RESET();
 
-#if defined(CONFIG_IP860) || defined(CONFIG_PCU_E) || \
-       defined (CONFIG_FLAGADM) || defined(CONFIG_MPC83XX)
+#if defined(CONFIG_SYS_DELAYED_ICACHE) || defined(CONFIG_MPC83XX)
        icache_enable ();       /* it's time to enable the instruction cache */
 #endif
 
@@ -895,20 +892,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
        mac_read_from_eeprom();
 #endif
 
-       s = getenv ("ethaddr");
-#if defined (CONFIG_MBX) || \
-    defined (CONFIG_RPXCLASSIC) || \
-    defined(CONFIG_IAD210) || \
-    defined(CONFIG_V38B)
-       if (s == NULL)
-               board_get_enetaddr (bd->bi_enetaddr);
-       else
-#endif
-               for (i = 0; i < 6; ++i) {
-                       bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-                       if (s)
-                               s = (*e) ? e + 1 : e;
-               }
 #ifdef CONFIG_HERMES
        if ((gd->board_type >> 16) == 2)
                bd->bi_ethspeed = gd->board_type & 0xFFFF;
@@ -916,88 +899,26 @@ void board_init_r (gd_t *id, ulong dest_addr)
                bd->bi_ethspeed = 0xFFFF;
 #endif
 
-#ifdef CONFIG_NX823
-       load_sernum_ethaddr ();
-#endif
-
+#ifdef CONFIG_CMD_NET
+       /* kept around for legacy kernels only ... ignore the next section */
+       eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
 #ifdef CONFIG_HAS_ETH1
-       /* handle the 2nd ethernet address */
-
-       s = getenv ("eth1addr");
-
-       for (i = 0; i < 6; ++i) {
-               bd->bi_enet1addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-               if (s)
-                       s = (*e) ? e + 1 : e;
-       }
+       eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
 #endif
 #ifdef CONFIG_HAS_ETH2
-       /* handle the 3rd ethernet address */
-
-       s = getenv ("eth2addr");
-#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
-       if (s == NULL)
-               board_get_enetaddr(bd->bi_enet2addr);
-       else
-#endif
-       for (i = 0; i < 6; ++i) {
-               bd->bi_enet2addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-               if (s)
-                       s = (*e) ? e + 1 : e;
-       }
+       eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
 #endif
-
 #ifdef CONFIG_HAS_ETH3
-       /* handle 4th ethernet address */
-       s = getenv("eth3addr");
-#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
-       if (s == NULL)
-               board_get_enetaddr(bd->bi_enet3addr);
-       else
+       eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
 #endif
-       for (i = 0; i < 6; ++i) {
-               bd->bi_enet3addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-               if (s)
-                       s = (*e) ? e + 1 : e;
-       }
-#endif
-
 #ifdef CONFIG_HAS_ETH4
-       /* handle 5th ethernet address */
-       s = getenv("eth4addr");
-#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
-       if (s == NULL)
-               board_get_enetaddr(bd->bi_enet4addr);
-       else
+       eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
 #endif
-       for (i = 0; i < 6; ++i) {
-               bd->bi_enet4addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-               if (s)
-                       s = (*e) ? e + 1 : e;
-       }
-#endif
-
 #ifdef CONFIG_HAS_ETH5
-       /* handle 6th ethernet address */
-       s = getenv("eth5addr");
-#if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
-       if (s == NULL)
-               board_get_enetaddr(bd->bi_enet5addr);
-       else
-#endif
-       for (i = 0; i < 6; ++i) {
-               bd->bi_enet5addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
-               if (s)
-                       s = (*e) ? e + 1 : e;
-       }
+       eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
 #endif
+#endif /* CONFIG_CMD_NET */
 
-#if defined(CONFIG_TQM8xxL) || defined(CONFIG_TQM8260) || \
-    defined(CONFIG_TQM8272) || \
-    defined(CONFIG_CCM) || defined(CONFIG_KUP4K) || \
-    defined(CONFIG_KUP4X) || defined(CONFIG_PCS440EP)
-       load_sernum_ethaddr ();
-#endif
        /* IP Address */
        bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
 
@@ -1085,12 +1006,21 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        WATCHDOG_RESET ();
 
+#if defined(CONFIG_DTT)                /* Digital Thermometers and Thermostats */
+       dtt_init ();
+#endif
 #if defined(CONFIG_CMD_SCSI)
        WATCHDOG_RESET ();
        puts ("SCSI:  ");
        scsi_init ();
 #endif
 
+#ifdef CONFIG_GENERIC_MMC
+       WATCHDOG_RESET ();
+       puts ("MMC:  ");
+       mmc_initialize (bd);
+#endif
+
 #if defined(CONFIG_CMD_DOC)
        WATCHDOG_RESET ();
        puts ("DOC:   ");
@@ -1152,13 +1082,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 #endif
 
-#if defined(CONFIG_CMD_SATA)
-       if (is_sata_supported()) {
-               puts("SATA:  ");
-               sata_initialize();
-       }
-#endif
-
 #ifdef CONFIG_LAST_STAGE_INIT
        WATCHDOG_RESET ();
        /*