In case of no relocation we'll just waste some paceat the very end
of usable memory area. If U-Boot is huge and we cannot use a lot of memory this
loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrod...@synopsys.com>
Cc: Simon Glass <s...@chromium.org>
Cc: Bin Meng <bmeng...@gmail.com>
Cc: Heiko Schocher <h...@denx.de>
Cc: York Sun <york....@nxp.com>
Cc: Stefan Roese <s...@denx.de>
---
 common/board_f.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index 92743089087e..d1662199a570 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -396,19 +396,21 @@ static int reserve_trace(void)
 
 static int reserve_uboot(void)
 {
-       /*
-        * reserve memory for U-Boot code, data & bss
-        * round down to next 4 kB limit
-        */
-       gd->relocaddr -= gd->mon_len;
-       gd->relocaddr &= ~(4096 - 1);
-#if defined(CONFIG_E500) || defined(CONFIG_MIPS)
-       /* round down to next 64 kB limit so that IVPR stays aligned */
-       gd->relocaddr &= ~(65536 - 1);
-#endif
-
-       debug("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10,
-             gd->relocaddr);
+       if (!(gd->flags & GD_FLG_SKIP_RELOC)) {
+               /*
+                * reserve memory for U-Boot code, data & bss
+                * round down to next 4 kB limit
+                */
+               gd->relocaddr -= gd->mon_len;
+               gd->relocaddr &= ~(4096 - 1);
+       #if defined(CONFIG_E500) || defined(CONFIG_MIPS)
+               /* round down to next 64 kB limit so that IVPR stays aligned */
+               gd->relocaddr &= ~(65536 - 1);
+       #endif
+
+               debug("Reserving %ldk for U-Boot at: %08lx\n",
+                     gd->mon_len >> 10, gd->relocaddr);
+       }
 
        gd->start_addr_sp = gd->relocaddr;
 
-- 
2.14.3

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to