[U-Boot] [RFC] Program net device MAC addresses after initializing
Ben Warren
biggerbadderben at gmail.com
Mon Apr 5 09:02:09 CEST 2010
Add a new function to the eth_device struct for programming a network
controller's hardware address.
After all network devices have been initialized and the proper MAC address for
each has been determined, make a device driver call to program the address
into the device. Only device instances with valid unicast addresses will be
programmed.
This is a significant departure from existing U-boot behavior, but costs very
little in startup time and addresses a very common complaint among developers.
Signed-off-by: Ben Warren <biggerbadderben at gmail.com>
---
include/net.h | 1 +
net/eth.c | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/net.h b/include/net.h
index 3f6a5d1..a180881 100644
--- a/include/net.h
+++ b/include/net.h
@@ -105,6 +105,7 @@ struct eth_device {
#ifdef CONFIG_MCAST_TFTP
int (*mcast) (struct eth_device*, u32 ip, u8 set);
#endif
+ int (*write_hwaddr) (struct eth_device*);
struct eth_device *next;
void *priv;
};
diff --git a/net/eth.c b/net/eth.c
index b650a20..ee7678a 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -241,6 +241,10 @@ int eth_initialize(bd_t *bis)
memcpy(dev->enetaddr, env_enetaddr, 6);
}
+ if (dev->write_hwaddr &&
+ is_valid_ether_addr(dev->enetaddr)) {
+ dev->write_hwaddr(dev);
+ }
eth_number++;
dev = dev->next;
--
1.6.0.4
More information about the U-Boot
mailing list