Patchwork [U-Boot,1/2] nand_spl: p1010rdb: don't write to global variable before reloc

login
register
mail settings
Submitter Scott Wood
Date Aug. 24, 2012, 1:48 a.m.
Message ID <1345772931-26567-1-git-send-email-scottwood@freescale.com>
Download mbox | patch
Permalink /patch/179759/
State Accepted
Delegated to: Andy Fleming
Headers show

Comments

Scott Wood - Aug. 24, 2012, 1:48 a.m.
Pass it on the stack instead.  Besides being the right thing to do, it
also should save a few bytes.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 nand_spl/board/freescale/p1010rdb/nand_boot.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Patch

diff --git a/nand_spl/board/freescale/p1010rdb/nand_boot.c b/nand_spl/board/freescale/p1010rdb/nand_boot.c
index 9c35690..444d2f2 100644
--- a/nand_spl/board/freescale/p1010rdb/nand_boot.c
+++ b/nand_spl/board/freescale/p1010rdb/nand_boot.c
@@ -31,9 +31,7 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-unsigned long ddr_freq_mhz;
-
-void sdram_init(void)
+void sdram_init(u32 ddr_freq_mhz)
 {
 	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC85xx_DDR_ADDR;
 	/* mask off E bit */
@@ -91,7 +89,7 @@  void sdram_init(void)
 
 void board_init_f(ulong bootflag)
 {
-	u32 plat_ratio, ddr_ratio;
+	u32 plat_ratio, ddr_ratio,  ddr_freq_mhz;
 	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 
 	/* initialize selected port with appropriate baud rate */
@@ -109,7 +107,7 @@  void board_init_f(ulong bootflag)
 	puts("\nNAND boot... ");
 
 	/* Initialize the DDR3 */
-	sdram_init();
+	sdram_init(ddr_freq_mhz);
 
 	/* copy code to RAM and jump to it - this should not return */
 	/* NOTE - code has to be copied out of NAND buffer before