[U-Boot,2/2] arm64: zynqmp: Set initrd_high to as high as possible
diff mbox series

Message ID 77ccfdb1289cd941b67b04b1e0aac4913ea5d167.1568186905.git.michal.simek@xilinx.com
State New
Delegated to: Michal Simek
Headers show
Series
  • arm64: Setting up initrd_hi at run time
Related show

Commit Message

Michal Simek Sept. 11, 2019, 7:28 a.m. UTC
From: T Karthik Reddy <t.karthik.reddy@xilinx.com>

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 arch/arm/Kconfig                | 4 ++--
 board/xilinx/zynqmp/zynqmp.c    | 6 ++++++
 include/configs/xilinx_zynqmp.h | 1 -
 3 files changed, 8 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 33cb3e065830..257a98d795e5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -464,7 +464,7 @@  config TPL_USE_ARCH_MEMSET
 
 config SET_STACK_SIZE
 	bool "Enable an option to set max stack size that can be used"
-	default y if ARCH_VERSAL
+	default y if ARCH_VERSAL || ARCH_ZYNQMP
 	help
 	  This will enable an option to set max stack size that can be
 	  used by u-boot.
@@ -472,7 +472,7 @@  config SET_STACK_SIZE
 config STACK_SIZE
 	hex "Define max stack size that can be used by u-boot"
 	depends on SET_STACK_SIZE
-	default 0x4000000 if ARCH_VERSAL
+	default 0x4000000 if ARCH_VERSAL || ARCH_ZYNQMP
 	help
 	  Defines Max stack size that can be used by u-boot so that the
 	  initrd_high will be calculated as base stack pointer minus this
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index d649daba96d4..0c331e332230 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -22,6 +22,7 @@ 
 #include <dwc3-uboot.h>
 #include <zynqmppl.h>
 #include <g_dnl.h>
+#include <linux/sizes.h>
 
 #include "pm_cfg_obj.h"
 
@@ -530,6 +531,7 @@  int board_late_init(void)
 	char *new_targets;
 	char *env_targets;
 	int ret;
+	ulong initrd_hi;
 
 #if defined(CONFIG_USB_ETHER) && !defined(CONFIG_USB_GADGET_DOWNLOAD)
 	usb_ether_init();
@@ -647,6 +649,10 @@  int board_late_init(void)
 
 	env_set("boot_targets", new_targets);
 
+	initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
+	initrd_hi = round_down(initrd_hi, SZ_16M);
+	env_set_addr("initrd_high", (void *)initrd_hi);
+
 	reset_reason();
 
 	return 0;
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
index ddeb24a0af6e..cdcf853fceb3 100644
--- a/include/configs/xilinx_zynqmp.h
+++ b/include/configs/xilinx_zynqmp.h
@@ -109,7 +109,6 @@ 
 
 #define ENV_MEM_LAYOUT_SETTINGS \
 	"fdt_high=10000000\0" \
-	"initrd_high=10000000\0" \
 	"fdt_addr_r=0x40000000\0" \
 	"pxefile_addr_r=0x10000000\0" \
 	"kernel_addr_r=0x18000000\0" \