[U-Boot-Users] [RFC/PATCH] fix initdram / use of phys_addr_t

Kumar Gala galak at kernel.crashing.org
Wed Mar 12 16:38:46 CET 2008


Wolfgang,

Before I went and looked at every board that uses initdram I wanted to get
some feedback of such a patch (for a wide majority of boards) would be
acceptable.

The idea is that initdram() should really have returned a 'unsigned long'.
However if we are going to change everyone that has initdram I figure we
should make it return a phys_addr_t.

I believe you've had some discussions with Jon on the subject and I wanted
to know if using 'phys_addr_t' here would be acceptable (before I looked
at trying to fix up ~200 boards).

The patch gives an example of what I'm looking at changing.

- k

diff --git a/board/freescale/mpc8544ds/mpc8544ds.c b/board/freescale/mpc8544ds/mpc8544ds.c
index 8107016..1577f13 100644
--- a/board/freescale/mpc8544ds/mpc8544ds.c
+++ b/board/freescale/mpc8544ds/mpc8544ds.c
@@ -64,10 +64,9 @@ int checkboard (void)
 	return 0;
 }

-long int
-initdram(int board_type)
+phys_addr_t initdram(int board_type)
 {
-	long dram_size = 0;
+	phys_addr_t dram_size = 0;

 	puts("Initializing\n");

diff --git a/cpu/mpc85xx/spd_sdram.c b/cpu/mpc85xx/spd_sdram.c
index abc63c4..55c45b5 100644
--- a/cpu/mpc85xx/spd_sdram.c
+++ b/cpu/mpc85xx/spd_sdram.c
@@ -169,8 +169,7 @@ unsigned int determine_refresh_rate(unsigned int spd_refresh)
 }


-long int
-spd_sdram(void)
+phys_addr_t spd_sdram(void)
 {
 	volatile ccsr_ddr_t *ddr = (void *)(CFG_MPC85xx_DDR_ADDR);
 	spd_eeprom_t spd;
diff --git a/include/common.h b/include/common.h
index cd8aad0..229d15a 100644
--- a/include/common.h
+++ b/include/common.h
@@ -107,6 +107,8 @@ typedef volatile unsigned char	vu_char;
 #include <asm/blackfin.h>
 #endif

+#include <asm/io.h>
+
 #include <part.h>
 #include <flash.h>
 #include <image.h>
@@ -191,7 +193,7 @@ int	serial_buffered_tstc (void);
 void	hang		(void) __attribute__ ((noreturn));

 /* */
-long int initdram (int);
+phys_addr_t initdram (int);
 int	display_options (void);
 void	print_size (ulong, const char *);
 int	print_buffer (ulong addr, void* data, uint width, uint count, uint linelen);
diff --git a/include/spd_sdram.h b/include/spd_sdram.h
index a2be96c..8f994b2 100644
--- a/include/spd_sdram.h
+++ b/include/spd_sdram.h
@@ -1,6 +1,6 @@
 #ifndef _SPD_SDRAM_H_
 #define _SPD_SDRAM_H_

-long int spd_sdram(void);
+phys_addr_t spd_sdram(void);

 #endif




More information about the U-Boot mailing list