diff mbox

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

Message ID 20161001141931.32354-19-paul.burton@imgtec.com
State Deferred
Delegated to: Tom Rini
Headers show

Commit Message

Paul Burton Oct. 1, 2016, 2:19 p.m. UTC
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@imgtec.com>
---

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

Comments

Simon Glass Oct. 3, 2016, 9:49 p.m. UTC | #1
On 1 October 2016 at 08:19, Paul Burton <paul.burton@imgtec.com> wrote:
> 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@imgtec.com>
> ---
>
>  common/board_f.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox

Patch

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);