ppc: Clean up calling of phy_reset() during init
[platform/kernel/u-boot.git] / lib_ppc / board.c
index f0cc3ce..f9dbdb9 100644 (file)
@@ -142,22 +142,6 @@ ulong monitor_flash_len;
  */
 
 /*
- * The Malloc area is immediately below the monitor copy in DRAM
- */
-static void mem_malloc_init (void)
-{
-#if !defined(CONFIG_RELOC_FIXUP_WORKS)
-       mem_malloc_end = CONFIG_SYS_MONITOR_BASE + gd->reloc_off;
-#endif
-       mem_malloc_start = mem_malloc_end - TOTAL_MALLOC_LEN;
-       mem_malloc_brk = mem_malloc_start;
-
-       memset ((void *) mem_malloc_start,
-               0,
-               mem_malloc_end - mem_malloc_start);
-}
-
-/*
  * All attempts to come up with a "common" initialization sequence
  * that works for all boards and architectures failed: some of the
  * requirements are just _too_ different. To get rid of the resulting
@@ -650,6 +634,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #ifndef CONFIG_ENV_IS_NOWHERE
        extern char * env_name_spec;
 #endif
+       ulong malloc_start;
 
 #ifndef CONFIG_SYS_NO_FLASH
        ulong flash_size;
@@ -660,11 +645,18 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        gd->flags |= GD_FLG_RELOC;      /* tell others: relocation done */
 
+       /* The Malloc area is immediately below the monitor copy in DRAM */
 #if defined(CONFIG_RELOC_FIXUP_WORKS)
        gd->reloc_off = 0;
-       mem_malloc_end = dest_addr;
+       malloc_start = dest_addr - TOTAL_MALLOC_LEN;
 #else
        gd->reloc_off = dest_addr - CONFIG_SYS_MONITOR_BASE;
+       malloc_start = CONFIG_SYS_MONITOR_BASE + gd->reloc_off -
+                       TOTAL_MALLOC_LEN;
+#endif
+
+#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
+       gd->cpu += gd->reloc_off;
 #endif
 
 #ifdef CONFIG_SERIAL_MULTI
@@ -759,8 +751,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        asm ("sync ; isync");
 
-       /* initialize malloc() area */
-       mem_malloc_init ();
+       mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN);
        malloc_bin_reloc ();
 
 #if !defined(CONFIG_SYS_NO_FLASH)
@@ -930,17 +921,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
        /* Initialize the console (after the relocation and devices init) */
        console_init_r ();
 
-#if defined(CONFIG_CCM)                || \
-    defined(CONFIG_COGENT)     || \
-    defined(CONFIG_CPCI405)    || \
-    defined(CONFIG_EVB64260)   || \
-    defined(CONFIG_KUP4K)      || \
-    defined(CONFIG_KUP4X)      || \
-    defined(CONFIG_LWMON)      || \
-    defined(CONFIG_PCU_E)      || \
-    defined(CONFIG_SC3)                || \
-    defined(CONFIG_W7O)                || \
-    defined(CONFIG_MISC_INIT_R)
+#if defined(CONFIG_MISC_INIT_R)
        /* miscellaneous platform dependent initialisations */
        misc_init_r ();
 #endif
@@ -1019,22 +1000,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
        eth_initialize (bd);
 #endif
 
-#if defined(CONFIG_CMD_NET) && ( \
-    defined(CONFIG_CCM)                || \
-    defined(CONFIG_ELPT860)    || \
-    defined(CONFIG_EP8260)     || \
-    defined(CONFIG_IP860)      || \
-    defined(CONFIG_IVML24)     || \
-    defined(CONFIG_IVMS8)      || \
-    defined(CONFIG_MPC8260ADS) || \
-    defined(CONFIG_MPC8266ADS) || \
-    defined(CONFIG_MPC8560ADS) || \
-    defined(CONFIG_PCU_E)      || \
-    defined(CONFIG_RPXSUPER)   || \
-    defined(CONFIG_STXGP3)     || \
-    defined(CONFIG_SPD823TS)   || \
-    defined(CONFIG_RESET_PHY_R)        )
-
+#if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
        WATCHDOG_RESET ();
        debug ("Reset Ethernet PHY\n");
        reset_phy ();