All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] lib_arch/board.c: Move malloc initialization before flash_init()
Date: Mon, 11 May 2009 15:50:12 +0200	[thread overview]
Message-ID: <1242049812-6038-1-git-send-email-sr@denx.de> (raw)

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>
---
If nobody from the platforms custodians objects against this patch
then I suggest that Wolfgang pulls it directly into next.

Thanks,
Stefan

 lib_arm/board.c      |    6 +++---
 lib_blackfin/board.c |    7 ++++---
 lib_m68k/board.c     |    8 ++++----
 lib_mips/board.c     |    8 ++++----
 lib_nios/board.c     |    6 ++++--
 lib_nios2/board.c    |    6 ++++--
 lib_ppc/board.c      |    8 ++++----
 lib_sh/board.c       |    2 +-
 lib_sparc/board.c    |    9 ++++-----
 9 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/lib_arm/board.c b/lib_arm/board.c
index 09eaaf2..bbed820 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -313,6 +313,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 ());
@@ -347,9 +350,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 */
diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c
index c223711..1df8370 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -309,6 +309,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[];
@@ -326,9 +330,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:  ");
diff --git a/lib_m68k/board.c b/lib_m68k/board.c
index 583ce10..76b1f54 100644
--- a/lib_m68k/board.c
+++ b/lib_m68k/board.c
@@ -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 ();
diff --git a/lib_mips/board.c b/lib_mips/board.c
index dfe6831..f483211 100644
--- a/lib_mips/board.c
+++ b/lib_mips/board.c
@@ -371,6 +371,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();
@@ -385,10 +389,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 */
diff --git a/lib_nios/board.c b/lib_nios/board.c
index 024beb5..fc63793 100644
--- a/lib_nios/board.c
+++ b/lib_nios/board.c
@@ -143,11 +143,13 @@ 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");
diff --git a/lib_nios2/board.c b/lib_nios2/board.c
index d759f0f..7986bdc 100644
--- a/lib_nios2/board.c
+++ b/lib_nios2/board.c
@@ -149,11 +149,13 @@ 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");
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index f69c5f4..7b76886 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -761,6 +761,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: ");
 
@@ -818,10 +822,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 ();
diff --git a/lib_sh/board.c b/lib_sh/board.c
index d4cc85c..d0dcf31 100644
--- a/lib_sh/board.c
+++ b/lib_sh/board.c
@@ -156,8 +156,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,
diff --git a/lib_sparc/board.c b/lib_sparc/board.c
index e972d3e..862bce8 100644
--- a/lib_sparc/board.c
+++ b/lib_sparc/board.c
@@ -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();
-- 
1.6.2.5

             reply	other threads:[~2009-05-11 13:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11 13:50 Stefan Roese [this message]
2009-05-12 20:09 ` [U-Boot] [PATCH] lib_arch/board.c: Move malloc initialization before flash_init() Kim Phillips
2009-05-13  4:20   ` Stefan Roese
2009-05-13  4:58     ` Mike Frysinger
2009-05-13 15:55       ` Kim Phillips
2009-05-13  8:58     ` Detlev Zundel
2009-05-15 19:50 ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1242049812-6038-1-git-send-email-sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.