[U-Boot] [PATCH v5 1/5] lib: fdtdec: Update ram_base to store ram start adddress

Michal Simek michal.simek at xilinx.com
Mon Jul 16 13:37:41 UTC 2018


From: Siva Durga Prasad Paladugu <siva.durga.paladugu at xilinx.com>

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu at xilinx.com>
Signed-off-by: Michal Simek <michal.simek at xilinx.com>
Reviewed-by: Tom Rini <trini at konsulko.com>

---

Changes in v5:
- Add Tom's tag -
  https://lists.denx.de/pipermail/u-boot/2018-June/332810.html

Changes in v4:
- Rebased on latest master and used
  available ram_base

Changes in v3:
- Used new varibale ram_start
- Rename fdtdec_setup_memory_size

Changes in v2: None

 common/board_f.c | 4 ++--
 lib/fdtdec.c     | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index e943347ce3df..88d770071c38 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -281,9 +281,9 @@ static int setup_dest_addr(void)
 	gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE;
 #endif
 #ifdef CONFIG_SYS_SDRAM_BASE
-	gd->ram_top = CONFIG_SYS_SDRAM_BASE;
+	gd->ram_base = CONFIG_SYS_SDRAM_BASE;
 #endif
-	gd->ram_top += get_effective_memsize();
+	gd->ram_top = gd->ram_base + get_effective_memsize();
 	gd->ram_top = board_get_usable_ram_top(gd->mon_len);
 	gd->relocaddr = gd->ram_top;
 	debug("Ram top: %08lX\n", (ulong)gd->ram_top);
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 1b0c430945a9..66dff0f906b7 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1173,6 +1173,7 @@ int fdtdec_setup_memory_size(void)
 	}
 
 	gd->ram_size = (phys_size_t)(res.end - res.start + 1);
+	gd->ram_base = (unsigned long)res.start;
 	debug("%s: Initial DRAM size %llx\n", __func__,
 	      (unsigned long long)gd->ram_size);
 
-- 
1.9.1



More information about the U-Boot mailing list