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>
#include <asm/arch/gpio.h>
#include <asm/arch/pinmux.h>
#include <env_internal.h>
+#include <fdt_support.h>
#include <pci_tegra.h>
#include <linux/delay.h>
#include <power/as3722.h>
#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@1003000/pci@2,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@1003000/pci@2,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
*/
#include <common.h>
+#include <env.h>
#include <init.h>
#include <log.h>
#include <asm/arch/gp_padctrl.h>
#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"
#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
*/
#include <common.h>
+#include <env.h>
#include <init.h>
#include <log.h>
#include <asm/arch/clock.h>
#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,
+ "/usb@7d004000/ethernet@1",
+ "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,
+ "/usb@7d004000/asix@1",
+ "local-mac-address", enetaddr, 6, 0);
+
+ if (err >= 0)
+ puts(" MAC address updated...\n");
+ }
+
return ft_common_board_setup(blob, bd);
}
#endif
*/
#include <common.h>
+#include <env.h>
#include <init.h>
#include <asm/arch/gp_padctrl.h>
#include <asm/arch/pinmux.h>
#include <asm/arch-tegra/tegra.h>
#include <asm/gpio.h>
#include <asm/io.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <linux/delay.h>
#include "pinmux-config-colibri_t30.h"
#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,
+ "/usb@7d004000/ethernet@1",
+ "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,
+ "/usb@7d004000/asix@1",
+ "local-mac-address", enetaddr, 6, 0);
+
+ if (err >= 0)
+ puts(" MAC address updated...\n");
+ }
+
return ft_common_board_setup(blob, bd);
}
#endif