summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2018-03-21 13:13:51 +0100
committerStefan Agner <stefan.agner@toradex.com>2018-03-21 14:43:33 +0100
commit9f519a4f5d0659fb21f8b8a88e5d2ac8dea9a5d1 (patch)
tree46b937ec64b266b5ba8089c638ecf276906e268c
parenta1c20450342a758dda7d6ac91ebb4f57290d0520 (diff)
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> Acked-by: Stefan Agner <stefan.agner@toradex.com>
-rw-r--r--board/toradex/apalis-tk1/apalis-tk1.c13
-rw-r--r--board/toradex/apalis_t30/apalis_t30.c13
-rw-r--r--board/toradex/colibri_t20/colibri_t20.c12
-rw-r--r--board/toradex/colibri_t30/colibri_t30.c13
4 files changed, 51 insertions, 0 deletions
diff --git a/board/toradex/apalis-tk1/apalis-tk1.c b/board/toradex/apalis-tk1/apalis-tk1.c
index b70f5649e90..7058cb3efcb 100644
--- a/board/toradex/apalis-tk1/apalis-tk1.c
+++ b/board/toradex/apalis-tk1/apalis-tk1.c
@@ -10,6 +10,7 @@
#include <asm/io.h>
#include <asm/arch/gpio.h>
#include <asm/arch/pinmux.h>
+#include <fdt_support.h>
#include <pci_tegra.h>
#include <power/as3722.h>
@@ -81,6 +82,18 @@ int checkboard(void)
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, bd_t *bd)
{
+ uint8_t enetaddr[6];
+
+ /* MAC addr */
+ if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ int 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
diff --git a/board/toradex/apalis_t30/apalis_t30.c b/board/toradex/apalis_t30/apalis_t30.c
index e91267b0b4e..3151078119b 100644
--- a/board/toradex/apalis_t30/apalis_t30.c
+++ b/board/toradex/apalis_t30/apalis_t30.c
@@ -13,6 +13,7 @@
#include <asm/io.h>
#include <dm.h>
#include <i2c.h>
+#include <fdt_support.h>
#include <pci_tegra.h>
#include "../common/tdx-common.h"
@@ -71,6 +72,18 @@ int checkboard(void)
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, bd_t *bd)
{
+ uint8_t enetaddr[6];
+
+ /* MAC addr */
+ if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ int 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
diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c
index 555111534c5..93504008d04 100644
--- a/board/toradex/colibri_t20/colibri_t20.c
+++ b/board/toradex/colibri_t20/colibri_t20.c
@@ -137,6 +137,18 @@ int checkboard(void)
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, bd_t *bd)
{
+ uint8_t enetaddr[6];
+
+ /* MAC addr */
+ if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ int err = fdt_find_and_setprop(blob,
+ "/usb@7d004000/asix@1",
+ "local-mac-address", enetaddr, 6, 0);
+
+ if (err >= 0)
+ puts(" MAC address updated...\n");
+ }
+
#if defined(CONFIG_FDT_FIXUP_PARTITIONS)
static struct node_info nodes[] = {
{ "nvidia,tegra20-nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */
diff --git a/board/toradex/colibri_t30/colibri_t30.c b/board/toradex/colibri_t30/colibri_t30.c
index 8ae3437a490..7d07247d5ed 100644
--- a/board/toradex/colibri_t30/colibri_t30.c
+++ b/board/toradex/colibri_t30/colibri_t30.c
@@ -12,6 +12,7 @@
#include <asm/gpio.h>
#include <asm/io.h>
#include <i2c.h>
+#include <fdt_support.h>
#include "pinmux-config-colibri_t30.h"
#include "../common/tdx-common.h"
@@ -36,6 +37,18 @@ int checkboard(void)
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, bd_t *bd)
{
+ uint8_t enetaddr[6];
+
+ /* MAC addr */
+ if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ int 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