summaryrefslogtreecommitdiff
path: root/board/xilinx/zynqmp/zynqmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/xilinx/zynqmp/zynqmp.c')
-rw-r--r--board/xilinx/zynqmp/zynqmp.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 3c92b1a582..a2a0d56331 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -26,7 +26,7 @@
#include <zynqmppl.h>
#include <zynqmp_firmware.h>
#include <g_dnl.h>
-#include <linux/sizes.h>
+#include "../common/board.h"
#include "pm_cfg_obj.h"
@@ -552,9 +552,26 @@ static int set_fdtfile(void)
return 0;
}
-int board_late_init(void)
+static u8 zynqmp_get_bootmode(void)
{
+ u8 bootmode;
u32 reg = 0;
+ int ret;
+
+ ret = zynqmp_mmio_read((ulong)&crlapb_base->boot_mode, &reg);
+ if (ret)
+ return -EINVAL;
+
+ if (reg >> BOOT_MODE_ALT_SHIFT)
+ reg >>= BOOT_MODE_ALT_SHIFT;
+
+ bootmode = reg & BOOT_MODES_MASK;
+
+ return bootmode;
+}
+
+int board_late_init(void)
+{
u8 bootmode;
struct udevice *dev;
int bootseq = -1;
@@ -564,7 +581,6 @@ 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();
@@ -579,14 +595,7 @@ int board_late_init(void)
if (ret)
return ret;
- ret = zynqmp_mmio_read((ulong)&crlapb_base->boot_mode, &reg);
- if (ret)
- return -EINVAL;
-
- if (reg >> BOOT_MODE_ALT_SHIFT)
- reg >>= BOOT_MODE_ALT_SHIFT;
-
- bootmode = reg & BOOT_MODES_MASK;
+ bootmode = zynqmp_get_bootmode();
puts("Bootmode: ");
switch (bootmode) {
@@ -691,15 +700,9 @@ 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);
-
- env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
-
reset_reason();
- return 0;
+ return board_late_init_xilinx();
}
#endif