diff options
author | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2022-05-21 12:42:46 +0200 |
---|---|---|
committer | Tom Warren <twarren@nvidia.com> | 2022-06-13 15:31:15 -0700 |
commit | 8f27bf114ef48e681f00fcb38ad48d4ab581d0ca (patch) | |
tree | 696a16e626df00607b67d188a129a8eb9412344e /board/toradex/apalis_t30 | |
parent | 0d2105ae5e32ef5c87246054b2638fe50e62448c (diff) | |
download | u-boot-8f27bf114ef48e681f00fcb38ad48d4ab581d0ca.zip u-boot-8f27bf114ef48e681f00fcb38ad48d4ab581d0ca.tar.gz u-boot-8f27bf114ef48e681f00fcb38ad48d4ab581d0ca.tar.bz2 |
board: apalis_t30/tk1/colibri_t20/t30: integrate mac address via dt
Use device tree to set MAC address of the Ethernet chip.
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'board/toradex/apalis_t30')
-rw-r--r-- | board/toradex/apalis_t30/apalis_t30.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/board/toradex/apalis_t30/apalis_t30.c b/board/toradex/apalis_t30/apalis_t30.c index 0396eea..ef71270 100644 --- a/board/toradex/apalis_t30/apalis_t30.c +++ b/board/toradex/apalis_t30/apalis_t30.c @@ -5,6 +5,7 @@ */ #include <common.h> +#include <env.h> #include <init.h> #include <log.h> #include <asm/arch/gp_padctrl.h> @@ -16,6 +17,7 @@ #include <asm/io.h> #include <dm.h> #include <i2c.h> +#include <fdt_support.h> #include <pci_tegra.h> #include <linux/delay.h> #include "../common/tdx-common.h" @@ -54,6 +56,24 @@ int checkboard(void) #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, struct bd_info *bd) { + u8 enetaddr[6]; + + /* MAC addr */ + if (eth_env_get_enetaddr("ethaddr", enetaddr)) { + int err = fdt_find_and_setprop(blob, + "/pcie@3000/pci@3,0/ethernet@0,0", + "local-mac-address", enetaddr, 6, 0); + + /* Older device trees might have used a different node name */ + if (err < 0) + err = fdt_find_and_setprop(blob, + "/pcie@3000/pci@3,0/pcie@0", + "local-mac-address", enetaddr, 6, 0); + + if (err >= 0) + puts(" MAC address updated...\n"); + } + return ft_common_board_setup(blob, bd); } #endif |