]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
lib_arch/board.c: Move malloc initialization before flash_init()
authorStefan Roese <sr@denx.de>
Mon, 11 May 2009 13:50:12 +0000 (15:50 +0200)
committerWolfgang Denk <wd@denx.de>
Fri, 12 Jun 2009 18:39:47 +0000 (20:39 +0200)
This patch moves the malloc initialization before calling flash_init().
Upcoming changes to the NOR FLASH common CFI driver with optional
MTD infrastructure and MTD concatenation support will call malloc().
And nothing really speaks against enabling malloc just a little earlier
in the boot stage. Some architectures already enable malloc before
calling flash_init() so they don't need any changes here.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Scott McNutt <smcnutt@psyent.com>
Cc: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: John Rigby <jcrigby@gmail.com>
lib_arm/board.c
lib_blackfin/board.c
lib_m68k/board.c
lib_mips/board.c
lib_nios/board.c
lib_nios2/board.c
lib_ppc/board.c
lib_sh/board.c
lib_sparc/board.c

index 5d05d9b9279b96a2df848dd264c7ede4c9f62075..e3040acdc62760075eee407d2744fafddf820741 100644 (file)
@@ -316,6 +316,9 @@ void start_armboot (void)
                }
        }
 
+       /* armboot_start is defined in the board-specific linker script */
+       mem_malloc_init (_armboot_start - CONFIG_SYS_MALLOC_LEN);
+
 #ifndef CONFIG_SYS_NO_FLASH
        /* configure available FLASH banks */
        display_flash_config (flash_init ());
@@ -350,9 +353,6 @@ void start_armboot (void)
        }
 #endif /* CONFIG_LCD */
 
-       /* armboot_start is defined in the board-specific linker script */
-       mem_malloc_init (_armboot_start - CONFIG_SYS_MALLOC_LEN);
-
 #if defined(CONFIG_CMD_NAND)
        puts ("NAND:  ");
        nand_init();            /* go init the NAND */
index 49465d2a058a706c543b8f7d989c8a2724e9c143..047f16418f8aa4c1c067e71198e9afd3bc836a53 100644 (file)
@@ -324,6 +324,10 @@ void board_init_r(gd_t * id, ulong dest_addr)
        post_reloc();
 #endif
 
+       /* initialize malloc() area */
+       mem_malloc_init();
+       malloc_bin_reloc();
+
 #if    !defined(CONFIG_SYS_NO_FLASH)
        /* Initialize the flash and protect u-boot by default */
        extern flash_info_t flash_info[];
@@ -341,9 +345,6 @@ void board_init_r(gd_t * id, ulong dest_addr)
        bd->bi_flashsize = 0;
        bd->bi_flashoffset = 0;
 #endif
-       /* initialize malloc() area */
-       mem_malloc_init();
-       malloc_bin_reloc();
 
 #ifdef CONFIG_CMD_NAND
        puts("NAND:  ");
index db45b00b1e3eacef5884d8074b3bc7716027e455..584d1fff32f8e0efcdab66a8d1a0d70bcaae66b3 100644 (file)
@@ -519,6 +519,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
         */
        trap_init (CONFIG_SYS_SDRAM_BASE);
 
+       /* initialize malloc() area */
+       mem_malloc_init ();
+       malloc_bin_reloc ();
+
 #if !defined(CONFIG_SYS_NO_FLASH)
        puts ("FLASH: ");
 
@@ -563,10 +567,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        WATCHDOG_RESET ();
 
-       /* initialize malloc() area */
-       mem_malloc_init ();
-       malloc_bin_reloc ();
-
 #ifdef CONFIG_SPI
 # if !defined(CONFIG_ENV_IS_IN_EEPROM)
        spi_init_f ();
index 061901e9725a2d7f6d9f000a2522e59f84195658..f8ac234d10884bc4a8f75dd9445ce9498466e99e 100644 (file)
@@ -370,6 +370,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        bd = gd->bd;
 
+       /* initialize malloc() area */
+       mem_malloc_init();
+       malloc_bin_reloc();
+
 #ifndef CONFIG_SYS_NO_FLASH
        /* configure available FLASH banks */
        size = flash_init();
@@ -384,10 +388,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
        bd->bi_flashoffset = 0;
 #endif
 
-       /* initialize malloc() area */
-       mem_malloc_init();
-       malloc_bin_reloc();
-
 #ifdef CONFIG_CMD_NAND
        puts ("NAND:  ");
        nand_init ();           /* go init the NAND */
index 63e79aec28ea98d44f5b5d1044582eba87934c34..9d8eea796245b8a9714d468d12f9b98d02ef2735 100644 (file)
@@ -142,12 +142,14 @@ void board_init (void)
                }
        }
 
+       WATCHDOG_RESET ();
+       mem_malloc_init();
+       malloc_bin_reloc();
+
        WATCHDOG_RESET ();
        bd->bi_flashsize = flash_init();
 
        WATCHDOG_RESET ();
-       mem_malloc_init();
-       malloc_bin_reloc();
        env_relocate();
 
        bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
index 70fad1b87029f2c54c05f248b9b2b48bf3003746..0677e999952ac82994c91215e8e4a7099cd6dc55 100644 (file)
@@ -148,12 +148,14 @@ void board_init (void)
                }
        }
 
+       WATCHDOG_RESET ();
+       mem_malloc_init();
+       malloc_bin_reloc();
+
        WATCHDOG_RESET ();
        bd->bi_flashsize = flash_init();
 
        WATCHDOG_RESET ();
-       mem_malloc_init();
-       malloc_bin_reloc();
        env_relocate();
 
        bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
index 9e944fa38a161036c066c61fad2ca135cfc6fe0c..a0e6b208a730d0a6cf4a915203d1be7593325147 100644 (file)
@@ -775,6 +775,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        asm ("sync ; isync");
 
+       /* initialize malloc() area */
+       mem_malloc_init ();
+       malloc_bin_reloc ();
+
 #if !defined(CONFIG_SYS_NO_FLASH)
        puts ("FLASH: ");
 
@@ -832,10 +836,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        WATCHDOG_RESET ();
 
-       /* initialize malloc() area */
-       mem_malloc_init ();
-       malloc_bin_reloc ();
-
 #ifdef CONFIG_SPI
 # if !defined(CONFIG_ENV_IS_IN_EEPROM)
        spi_init_f ();
index 2fd213ba3dd1fd7c4aae3c766ab239535ee2bc37..183110fe30b42b15d89c71a41bc5376b121d4206 100644 (file)
@@ -146,8 +146,8 @@ init_fnc_t *init_sequence[] =
        checkboard,             /* Check support board */
        dram_init,              /* SDRAM init */
        timer_init,             /* SuperH Timer (TCNT0 only) init */
-       sh_flash_init,  /* Flash memory(NOR) init*/
        sh_mem_env_init,
+       sh_flash_init,  /* Flash memory(NOR) init*/
        INIT_FUNC_NAND_INIT/* Flash memory (NAND) init */
        INIT_FUNC_PCI_INIT      /* PCI init */
        devices_init,
index 2f3e6733b60af00a06baedb6477a9c305924d940..628d46d3085e3600535923274c83ae97190d9039 100644 (file)
@@ -331,6 +331,10 @@ void board_init_f(ulong bootflag)
         */
        interrupt_init();
 
+       /* initialize malloc() area */
+       mem_malloc_init();
+       malloc_bin_reloc();
+
 #if !defined(CONFIG_SYS_NO_FLASH)
        puts("FLASH: ");
 
@@ -371,11 +375,6 @@ void board_init_f(ulong bootflag)
        bd->bi_flashoffset = 0;
 #endif                         /* !CONFIG_SYS_NO_FLASH */
 
-       /* initialize malloc() area */
-       mem_malloc_init();
-
-       malloc_bin_reloc();
-
 #ifdef CONFIG_SPI
 # if !defined(CONFIG_ENV_IS_IN_EEPROM)
        spi_init_f();