summaryrefslogtreecommitdiff
path: root/board/compulab
diff options
context:
space:
mode:
authorNikita Kiryanov <nikita@compulab.co.il>2015-01-14 10:42:44 +0200
committerStefano Babic <sbabic@denx.de>2015-01-29 17:42:28 +0100
commiteab29802d6211aeb9cd521a51d22a43c8fb4f94d (patch)
tree62168b59a1c6d8a7cbbd8aadab08ba6f8fd9f3b6 /board/compulab
parente7a2447ba2d8483b7d029e77c59b0ee26eeabe88 (diff)
downloadu-boot-imx-eab29802d6211aeb9cd521a51d22a43c8fb4f94d.zip
u-boot-imx-eab29802d6211aeb9cd521a51d22a43c8fb4f94d.tar.gz
u-boot-imx-eab29802d6211aeb9cd521a51d22a43c8fb4f94d.tar.bz2
arm: mx6: cm-fx6: pass 2nd nic mac addr to Linux
Obtain 2nd NIC MAC address from baseboard EEPROM and pass it to Linux. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Stefano Babic <sbabic@denx.de> Cc: Igor Grinberg <grinberg@compulab.co.il> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Diffstat (limited to 'board/compulab')
-rw-r--r--board/compulab/cm_fx6/cm_fx6.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index 32f4434..eb18dfc 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -345,32 +345,36 @@ static iomux_v3_cfg_t const enet_pads[] = {
MUX_PAD_CTRL(ENET_PAD_CTRL)),
};
-static int handle_mac_address(void)
+static int handle_mac_address(char *env_var, uint eeprom_bus)
{
unsigned char enetaddr[6];
int rc;
- rc = eth_getenv_enetaddr("ethaddr", enetaddr);
+ rc = eth_getenv_enetaddr(env_var, enetaddr);
if (rc)
return 0;
- rc = cl_eeprom_read_mac_addr(enetaddr, CONFIG_SYS_I2C_EEPROM_BUS);
+ rc = cl_eeprom_read_mac_addr(enetaddr, eeprom_bus);
if (rc)
return rc;
if (!is_valid_ether_addr(enetaddr))
return -1;
- return eth_setenv_enetaddr("ethaddr", enetaddr);
+ return eth_setenv_enetaddr(env_var, enetaddr);
}
+#define SB_FX6_I2C_EEPROM_BUS 0
+#define NO_MAC_ADDR "No MAC address found for %s\n"
int board_eth_init(bd_t *bis)
{
int err;
- err = handle_mac_address();
- if (err)
- puts("No MAC address found\n");
+ if (handle_mac_address("ethaddr", CONFIG_SYS_I2C_EEPROM_BUS))
+ printf(NO_MAC_ADDR, "primary NIC");
+
+ if (handle_mac_address("eth1addr", SB_FX6_I2C_EEPROM_BUS))
+ printf(NO_MAC_ADDR, "secondary NIC");
SETUP_IOMUX_PADS(enet_pads);
/* phy reset */
@@ -469,6 +473,11 @@ int ft_board_setup(void *blob, bd_t *bd)
"local-mac-address", enetaddr, 6, 1);
}
+ if (eth_getenv_enetaddr("eth1addr", enetaddr)) {
+ fdt_find_and_setprop(blob, "/eth@pcie", "local-mac-address",
+ enetaddr, 6, 1);
+ }
+
return 0;
}
#endif