1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2022 Marek Vasut <marex@denx.de>
7 #include <asm/arch/clock.h>
10 #include <dm/device-internal.h>
12 #include <env_internal.h>
17 #include "../common/common.h"
19 DECLARE_GLOBAL_DATA_PTR;
21 static void dmo_setup_second_mac_address(void)
26 /* In case 'eth1addr' is already set in environment, do nothing. */
27 ret = eth_env_get_enetaddr_by_index("eth", 1, enetaddr);
28 if (ret) /* valid 'eth1addr' is already set */
31 /* Read 'ethaddr' from environment and validate. */
32 ret = eth_env_get_enetaddr_by_index("eth", 0, enetaddr);
33 if (!ret) /* 'ethaddr' in environment is not valid, stop */
36 /* Set 'eth1addr' as 'ethaddr' + 1 */
39 eth_env_set_enetaddr_by_index("eth", 1, enetaddr);
42 enum env_location env_get_location(enum env_operation op, int prio)
44 /* Environment is always in eMMC boot partitions */
45 return prio ? ENVL_UNKNOWN : ENVL_MMC;
53 int board_late_init(void)
58 dmo_setup_boot_device();
59 dmo_setup_mac_address();
60 dmo_setup_second_mac_address();
62 ret = uclass_get_device_by_name(UCLASS_MISC, "usb-hub@2c", &dev);
64 printf("Error bringing up USB hub (%d)\n", ret);