1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2014 - 2019 Xilinx, Inc.
4 * Michal Simek <michal.simek@xilinx.com>
10 #include <asm/sections.h>
11 #include <dm/uclass.h>
13 #include <linux/sizes.h>
16 int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
20 #if defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET)
24 eeprom = ofnode_get_chosen_node("xlnx,eeprom");
25 if (!ofnode_valid(eeprom))
28 debug("%s: Path to EEPROM %s\n", __func__,
29 ofnode_read_chosen_string("xlnx,eeprom"));
31 ret = uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, eeprom, &dev);
35 ret = dm_i2c_read(dev, CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET, ethaddr, 6);
37 debug("%s: I2C EEPROM MAC address read failed\n", __func__);
39 debug("%s: I2C EEPROM MAC %pM\n", __func__, ethaddr);
45 #if defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE)
46 void *board_fdt_blob_setup(void)
48 static void *fdt_blob;
50 #if !defined(CONFIG_VERSAL_NO_DDR) && !defined(CONFIG_ZYNQMP_NO_DDR)
51 fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR;
53 if (fdt_magic(fdt_blob) == FDT_MAGIC)
56 debug("DTB is not passed via %p\n", fdt_blob);
59 #ifdef CONFIG_SPL_BUILD
60 /* FDT is at end of BSS unless it is in a different memory region */
61 if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
62 fdt_blob = (ulong *)&_image_binary_end;
64 fdt_blob = (ulong *)&__bss_end;
66 /* FDT is at end of image */
67 fdt_blob = (ulong *)&_end;
70 if (fdt_magic(fdt_blob) == FDT_MAGIC)
73 debug("DTB is also not passed via %p\n", fdt_blob);
79 int board_late_init_xilinx(void)
83 env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
85 initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
86 initrd_hi = round_down(initrd_hi, SZ_16M);
87 env_set_addr("initrd_high", (void *)initrd_hi);