1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2012 Michal Simek <monstr@monstr.eu>
4 * (C) Copyright 2013 - 2018 Xilinx, Inc.
10 #include <dm/uclass.h>
19 #include <asm/arch/hardware.h>
20 #include <asm/arch/sys_proto.h>
21 #include "../common/board.h"
23 DECLARE_GLOBAL_DATA_PTR;
30 int board_late_init(void)
32 int env_targets_len = 0;
37 if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
38 debug("Saved variables - Skipping\n");
42 if (!CONFIG_IS_ENABLED(ENV_VARS_UBOOT_RUNTIME_CONFIG))
45 switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
48 env_set("modeboot", "qspiboot");
52 env_set("modeboot", "nandboot");
56 env_set("modeboot", "norboot");
60 env_set("modeboot", "sdboot");
63 mode = "jtag pxe dhcp";
64 env_set("modeboot", "jtagboot");
68 env_set("modeboot", "");
73 * One terminating char + one byte for space between mode
74 * and default boot_targets
76 env_targets = env_get("boot_targets");
78 env_targets_len = strlen(env_targets);
80 new_targets = calloc(1, strlen(mode) + env_targets_len + 2);
84 sprintf(new_targets, "%s %s", mode,
85 env_targets ? env_targets : "");
87 env_set("boot_targets", new_targets);
89 return board_late_init_xilinx();
92 #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE)
93 int dram_init_banksize(void)
95 return fdtdec_setup_memory_banksize();
100 if (fdtdec_setup_mem_size_base() != 0)
110 gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
111 CONFIG_SYS_SDRAM_SIZE);