summaryrefslogtreecommitdiff
path: root/net/eth.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/eth.c')
-rw-r--r--net/eth.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/net/eth.c b/net/eth.c
index 2200767..7adc9e6 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -1,9 +1,7 @@
/*
- * (C) Copyright 2001-2004
+ * (C) Copyright 2001-2010
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
- * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
- *
* See file CREDITS for list of people who contributed to this
* project.
*
@@ -28,7 +26,6 @@
#include <net.h>
#include <miiphy.h>
-#ifdef CONFIG_CMD_NET
void eth_parse_enetaddr(const char *addr, uchar *enetaddr)
{
char *end;
@@ -62,9 +59,16 @@ int eth_getenv_enetaddr_by_index(int index, uchar *enetaddr)
sprintf(enetvar, index ? "eth%daddr" : "ethaddr", index);
return eth_getenv_enetaddr(enetvar, enetaddr);
}
-#endif
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
+#ifdef CONFIG_NET_MULTI
+
+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);
+}
/*
* CPU and board-specific Ethernet initializations. Aliased function
@@ -177,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;
}
@@ -245,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;
@@ -494,7 +504,8 @@ char *eth_get_name (void)
{
return (eth_current ? eth_current->name : "unknown");
}
-#elif defined(CONFIG_CMD_NET) && !defined(CONFIG_NET_MULTI)
+
+#else /* !CONFIG_NET_MULTI */
#warning Ethernet driver is deprecated. Please update to use CONFIG_NET_MULTI
@@ -518,9 +529,6 @@ int eth_initialize(bd_t *bis)
#if defined(CONFIG_DRIVER_NS7520_ETHERNET)
ns7520_miiphy_initialize(bis);
#endif
-#if defined(CONFIG_SMC911X)
- smc911x_initialize(0, CONFIG_SMC911X_BASE);
-#endif
return 0;
}
#endif