summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harvey <tharvey@gateworks.com>2016-06-17 06:10:42 -0700
committerStefano Babic <sbabic@denx.de>2016-07-28 13:27:16 +0200
commit5c34c2abb86a8e74234390300e4c852603b11621 (patch)
tree9fbce19e02b4aba6c33179f6a598ae04a3a05c97
parent5a08ad6fdc43cc756ef1ebe046bbfd4290204fbe (diff)
downloadu-boot-imx-5c34c2abb86a8e74234390300e4c852603b11621.zip
u-boot-imx-5c34c2abb86a8e74234390300e4c852603b11621.tar.gz
u-boot-imx-5c34c2abb86a8e74234390300e4c852603b11621.tar.bz2
imx: ventana: add dt fixup for eth1 mac-address
Ventana boards with a PCI Marvell Sky2 GigE MAC require the MAC address to be placed in a DT node in order for the mainline linux driver to obtain it. Signed-off-by: Tim Harvey <tharvey@gateworks.com>
-rw-r--r--board/gateworks/gw_ventana/gw_ventana.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 7d569ad..b3390a1 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -995,6 +995,32 @@ int fdt_fixup_gw16082(void *blob, int np, struct pci_dev *dev)
return 0;
}
+/* The sky2 GigE MAC obtains it's MAC addr from device-tree by default */
+int fdt_fixup_sky2(void *blob, int np, struct pci_dev *dev)
+{
+ char *tmp, *end;
+ char mac[16];
+ unsigned char mac_addr[6];
+ int j;
+
+ sprintf(mac, "eth1addr");
+ tmp = getenv(mac);
+ if (tmp) {
+ for (j = 0; j < 6; j++) {
+ mac_addr[j] = tmp ?
+ simple_strtoul(tmp, &end,16) : 0;
+ if (tmp)
+ tmp = (*end) ? end+1 : end;
+ }
+ fdt_setprop(blob, np, "local-mac-address", mac_addr,
+ sizeof(mac_addr));
+ printf(" Added mac addr for eth1\n");
+ return 0;
+ }
+
+ return -1;
+}
+
/*
* PCI DT nodes must be nested therefore if we need to apply a DT fixup
* we will walk the PCI bus and add bridge nodes up to the device receiving
@@ -1021,6 +1047,15 @@ void ft_board_pci_fixup(void *blob, bd_t *bd)
if (np > 0)
fdt_fixup_gw16082(blob, np, dev);
}
+
+ /* ethernet1 mac address */
+ else if ((dev->vendor == PCI_VENDOR_ID_MARVELL) &&
+ (dev->device == 0x4380))
+ {
+ np = fdt_add_pci_path(blob, dev);
+ if (np > 0)
+ fdt_fixup_sky2(blob, np, dev);
+ }
}
}
#endif /* if defined(CONFIG_CMD_PCI) */