1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2012 Michal Simek <monstr@monstr.eu>
4 * (C) Copyright 2013 - 2018 Xilinx, Inc.
16 #include <asm/arch/hardware.h>
17 #include <asm/arch/sys_proto.h>
19 DECLARE_GLOBAL_DATA_PTR;
21 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_BOARD_EARLY_INIT_F)
22 int board_early_init_f(void)
33 int board_late_init(void)
35 int env_targets_len = 0;
40 switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
43 env_set("modeboot", "qspiboot");
47 env_set("modeboot", "nandboot");
51 env_set("modeboot", "norboot");
55 env_set("modeboot", "sdboot");
59 env_set("modeboot", "jtagboot");
63 env_set("modeboot", "");
68 * One terminating char + one byte for space between mode
69 * and default boot_targets
71 env_targets = env_get("boot_targets");
73 env_targets_len = strlen(env_targets);
75 new_targets = calloc(1, strlen(mode) + env_targets_len + 2);
79 sprintf(new_targets, "%s %s", mode,
80 env_targets ? env_targets : "");
82 env_set("boot_targets", new_targets);
87 #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE)
88 int dram_init_banksize(void)
90 return fdtdec_setup_memory_banksize();
95 if (fdtdec_setup_mem_size_base() != 0)
105 gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
106 CONFIG_SYS_SDRAM_SIZE);