summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2017-12-27 08:17:05 -0500
committerTom Rini <[email protected]>2017-12-27 08:17:05 -0500
commit8e5f0497c8a8ab9bd7314737f2edb4711733b6fe (patch)
tree7ef6e942cb4fda392bb736f728b55b6882e265bd /common
parent7e3caa81e0e9cc5e2beed4a3a1c334e2119f4498 (diff)
parent4ace304062e143da8ab7851d0c8570d61777ec06 (diff)
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'common')
-rw-r--r--common/fdt_support.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 6896dcb285a..724452d7545 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -508,12 +508,16 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)
void fdt_fixup_ethernet(void *fdt)
{
- int i, j, prop;
+ int i = 0, j, prop;
char *tmp, *end;
char mac[16];
const char *path;
unsigned char mac_addr[ARP_HLEN];
int offset;
+#ifdef FDT_SEQ_MACADDR_FROM_ENV
+ int nodeoff;
+ const struct fdt_property *fdt_prop;
+#endif
if (fdt_path_offset(fdt, "/aliases") < 0)
return;
@@ -526,7 +530,7 @@ void fdt_fixup_ethernet(void *fdt)
offset = fdt_first_property_offset(fdt,
fdt_path_offset(fdt, "/aliases"));
/* Select property number 'prop' */
- for (i = 0; i < prop; i++)
+ for (j = 0; j < prop; j++)
offset = fdt_next_property_offset(fdt, offset);
if (offset < 0)
@@ -535,11 +539,16 @@ void fdt_fixup_ethernet(void *fdt)
path = fdt_getprop_by_offset(fdt, offset, &name, NULL);
if (!strncmp(name, "ethernet", 8)) {
/* Treat plain "ethernet" same as "ethernet0". */
- if (!strcmp(name, "ethernet"))
+ if (!strcmp(name, "ethernet")
+#ifdef FDT_SEQ_MACADDR_FROM_ENV
+ || !strcmp(name, "ethernet0")
+#endif
+ )
i = 0;
+#ifndef FDT_SEQ_MACADDR_FROM_ENV
else
i = trailing_strtol(name);
-
+#endif
if (i != -1) {
if (i == 0)
strcpy(mac, "ethaddr");
@@ -548,6 +557,14 @@ void fdt_fixup_ethernet(void *fdt)
} else {
continue;
}
+#ifdef FDT_SEQ_MACADDR_FROM_ENV
+ nodeoff = fdt_path_offset(fdt, path);
+ fdt_prop = fdt_get_property(fdt, nodeoff, "status",
+ NULL);
+ if (fdt_prop && !strcmp(fdt_prop->data, "disabled"))
+ continue;
+ i++;
+#endif
tmp = env_get(mac);
if (!tmp)
continue;