2 * Copyright (c) 2016, NVIDIA CORPORATION.
4 * SPDX-License-Identifier: GPL-2.0+
8 #include <fdt_support.h>
10 #include <asm/arch/tegra.h>
12 extern unsigned long nvtboot_boot_x0;
14 static int set_fdt_addr(void)
18 ret = setenv_hex("fdt_addr", nvtboot_boot_x0);
20 printf("Failed to set fdt_addr to point at DTB: %d\n", ret);
28 * Attempt to use /chosen/nvidia,ether-mac in the nvtboot DTB to U-Boot's
29 * ethaddr environment variable if possible.
31 static int set_ethaddr_from_nvtboot(void)
33 const void *nvtboot_blob = (void *)nvtboot_boot_x0;
37 /* Already a valid address in the environment? If so, keep it */
38 if (getenv("ethaddr"))
41 node = fdt_path_offset(nvtboot_blob, "/chosen");
43 printf("Can't find /chosen node in nvtboot DTB\n");
46 prop = fdt_getprop(nvtboot_blob, node, "nvidia,ether-mac", &len);
48 printf("Can't find nvidia,ether-mac property in nvtboot DTB\n");
52 ret = setenv("ethaddr", (void *)prop);
54 printf("Failed to set ethaddr from nvtboot DTB: %d\n", ret);
61 int tegra_soc_board_init_late(void)
64 * Ignore errors here; the value may not be used depending on
65 * extlinux.conf or boot script content.
68 /* Ignore errors here; not all cases care about Ethernet addresses */
69 set_ethaddr_from_nvtboot();