summaryrefslogtreecommitdiff
path: root/net/eth.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/eth.c')
-rw-r--r--net/eth.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/net/eth.c b/net/eth.c
index b650a20..45e4a26 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 2001-2004
+ * (C) Copyright 2001-2010
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
@@ -60,6 +60,14 @@ int eth_getenv_enetaddr_by_index(int index, uchar *enetaddr)
return eth_getenv_enetaddr(enetvar, enetaddr);
}
+static int eth_mac_skip(int index)
+{
+ char enetvar[15];
+ char *skip_state;
+ sprintf(enetvar, index ? "eth%dmacskip" : "ethmacskip", index);
+ return ((skip_state = getenv(enetvar)) != NULL);
+}
+
#ifdef CONFIG_NET_MULTI
/*
@@ -173,7 +181,8 @@ int eth_register(struct eth_device* dev)
}
#endif
} else {
- for (d=eth_devices; d->next!=eth_devices; d=d->next);
+ for (d=eth_devices; d->next!=eth_devices; d=d->next)
+ ;
d->next = dev;
}
@@ -241,6 +250,11 @@ int eth_initialize(bd_t *bis)
memcpy(dev->enetaddr, env_enetaddr, 6);
}
+ if (dev->write_hwaddr &&
+ !eth_mac_skip(eth_number) &&
+ is_valid_ether_addr(dev->enetaddr)) {
+ dev->write_hwaddr(dev);
+ }
eth_number++;
dev = dev->next;