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

Scott Wood scottwood at freescale.com
Fri Aug 24 03:48:50 CEST 2012


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 at freescale.com>
---
 nand_spl/board/freescale/p1010rdb/nand_boot.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

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
-- 
1.7.9.5




More information about the U-Boot mailing list