From patchwork Sat Jan 25 08:01:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 240080 List-Id: U-Boot discussion From: lukma at denx.de (Lukasz Majewski) Date: Sat, 25 Jan 2020 09:01:37 +0100 Subject: [PATCH v1 2/5] arm: xea: Provide function to set L2 switch 'local-mac-address' property In-Reply-To: <20200125080140.1267-1-lukma@denx.de> References: <20200125080140.1267-1-lukma@denx.de> Message-ID: <20200125080140.1267-3-lukma@denx.de> The 'local-mac-address' property needs to be adjusted to the MAC address value stored in U-Boot's 'ethaddr' env variable. Signed-off-by: Lukasz Majewski --- board/liebherr/xea/xea.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/board/liebherr/xea/xea.c b/board/liebherr/xea/xea.c index 1d47f67a7f..bdc073664c 100644 --- a/board/liebherr/xea/xea.c +++ b/board/liebherr/xea/xea.c @@ -150,4 +150,36 @@ int dram_init(void) return mxs_dram_init(); } +#ifdef CONFIG_OF_BOARD_SETUP +static int fdt_fixup_l2switch(void *blob) +{ + u8 ethaddr[6]; + int ret; + + if (eth_env_get_enetaddr("ethaddr", ethaddr)) { + ret = fdt_find_and_setprop(blob, + "/ahb at 80080000/switch at 800f0000", + "local-mac-address", ethaddr, 6, 1); + if (ret < 0) + printf("%s: can't find usbether at 1 node: %d\n", + __func__, ret); + } + + return 0; +} + +int ft_board_setup(void *blob, bd_t *bd) +{ + /* + * i.MX28 L2 switch needs manual update (fixup) of eth MAC address + * (in 'local-mac-address' property) as it uses "switch at 800f0000" + * node, not set by default FIT image handling code in + * "ethernet at 800f0000" + */ + fdt_fixup_l2switch(blob); + + return 0; +} +#endif + #endif /* CONFIG_SPL_BUILD */