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/global_data.h>
20 #include <asm/arch/hardware.h>
21 #include <asm/arch/sys_proto.h>
22 #include "../common/board.h"
24 DECLARE_GLOBAL_DATA_PTR;
28 if (IS_ENABLED(CONFIG_SPL_BUILD))
29 printf("Silicon version:\t%d\n", zynq_get_silicon_version());
34 int board_late_init(void)
36 int env_targets_len = 0;
41 if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
42 debug("Saved variables - Skipping\n");
46 if (!CONFIG_IS_ENABLED(ENV_VARS_UBOOT_RUNTIME_CONFIG))
49 switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
52 env_set("modeboot", "qspiboot");
56 env_set("modeboot", "nandboot");
60 env_set("modeboot", "norboot");
64 env_set("modeboot", "sdboot");
67 mode = "jtag pxe dhcp";
68 env_set("modeboot", "jtagboot");
72 env_set("modeboot", "");
77 * One terminating char + one byte for space between mode
78 * and default boot_targets
80 env_targets = env_get("boot_targets");
82 env_targets_len = strlen(env_targets);
84 new_targets = calloc(1, strlen(mode) + env_targets_len + 2);
88 sprintf(new_targets, "%s %s", mode,
89 env_targets ? env_targets : "");
91 env_set("boot_targets", new_targets);
93 return board_late_init_xilinx();
96 #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE)
97 int dram_init_banksize(void)
99 return fdtdec_setup_memory_banksize();
104 if (fdtdec_setup_mem_size_base() != 0)
114 gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
115 CONFIG_SYS_SDRAM_SIZE);