ARM: fdt support: Add usbethaddr as an acceptable MAC
authorDan Murphy <dmurphy@ti.com>
Wed, 2 Oct 2013 19:00:15 +0000 (14:00 -0500)
committerTom Rini <trini@ti.com>
Thu, 19 Jun 2014 15:18:39 +0000 (11:18 -0400)
A board that has a USB ethernet device only may set the usbetheraddr
and not the ethaddr.
ethaddr will be the default MAC address that is chosen and if that
is not populated then the usbethaddr is looked at.  If neither are set
then then device tree blob is not modified.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
common/fdt_support.c

index fcd252336cdf15d8cebe503e4025ef2f07d41b09..c690768572007e8eed91fa351dea46e38ab148d5 100644 (file)
@@ -479,8 +479,18 @@ void fdt_fixup_ethernet(void *fdt)
        if (node < 0)
                return;
 
+       if (!getenv("ethaddr")) {
+               if (getenv("usbethaddr")) {
+                       strcpy(mac, "usbethaddr");
+               } else {
+                       debug("No ethernet MAC Address defined\n");
+                       return;
+               }
+       } else {
+               strcpy(mac, "ethaddr");
+       }
+
        i = 0;
-       strcpy(mac, "ethaddr");
        while ((tmp = getenv(mac)) != NULL) {
                sprintf(enet, "ethernet%d", i);
                path = fdt_getprop(fdt, node, enet, NULL);