[U-Boot] [PATCH 18/27] board_f: Account for CONFIG_SYS_SDRAM_BASE being physical

Paul Burton paul.burton at imgtec.com
Sat Oct 1 16:19:21 CEST 2016


README declares that CONFIG_SYS_SDRAM_BASE is meant to be the physical
address of SDRAM, but right now that is not the case on MIPS systems. In
preparation for making it so, use phys_to_virt to translate
CONFIG_SYS_SDRAM_BASE to the ram_top field of struct global_data which
is then used to calculate most memory addresses used by U-Boot.

Signed-off-by: Paul Burton <paul.burton at imgtec.com>
---

 common/board_f.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index 2c88595..1afc80d 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -315,7 +315,7 @@ __weak ulong board_get_usable_ram_top(ulong total_size)
 	 * Detect whether we have so much RAM that it goes past the end of our
 	 * 32-bit address space. If so, clip the usable RAM so it doesn't.
 	 */
-	if (gd->ram_top < CONFIG_SYS_SDRAM_BASE)
+	if (gd->ram_top < (ulong)phys_to_virt(CONFIG_SYS_SDRAM_BASE))
 		/*
 		 * Will wrap back to top of 32-bit space when reservations
 		 * are made.
@@ -362,7 +362,7 @@ static int setup_dest_addr(void)
 	gd->ram_size = board_reserve_ram_top(gd->ram_size);
 
 #ifdef CONFIG_SYS_SDRAM_BASE
-	gd->ram_top = CONFIG_SYS_SDRAM_BASE;
+	gd->ram_top = (ulong)phys_to_virt(CONFIG_SYS_SDRAM_BASE);
 #endif
 	gd->ram_top += get_effective_memsize();
 	gd->ram_top = board_get_usable_ram_top(gd->mon_len);
-- 
2.10.0



More information about the U-Boot mailing list