public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC] Program net device MAC addresses after initializing
@ 2010-04-05  7:02 Ben Warren
  2010-04-06  7:18 ` Heiko Schocher
  2010-04-06 12:57 ` Wolfgang Denk
  0 siblings, 2 replies; 9+ messages in thread
From: Ben Warren @ 2010-04-05  7:02 UTC (permalink / raw)
  To: u-boot

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@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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-04-10  6:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-05  7:02 [U-Boot] [RFC] Program net device MAC addresses after initializing Ben Warren
2010-04-06  7:18 ` Heiko Schocher
2010-04-06  8:02   ` Prafulla Wadaskar
2010-04-06 12:57 ` Wolfgang Denk
2010-04-06 16:42   ` Ben Warren
2010-04-08 15:30     ` Detlev Zundel
2010-04-09 19:58     ` Wolfgang Denk
2010-04-10  0:34       ` Ben Warren
2010-04-10  6:59         ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox