[U-Boot] [PATCH] net/eth.c call dev->write_hwaddr in eth_init

John Rigby john.rigby at linaro.org
Wed Sep 8 00:50:26 CEST 2010


When eth_init updates dev->enetaddr it does not
call dev->write_hwaddr.  Fix that so when ethaddr
is set after eth_initialize the change will propagate
to the hw.

Signed-off-by: John Rigby <john.rigby at linaro.org>
---
 net/eth.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/net/eth.c b/net/eth.c
index 993306f..5216c2b 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -341,8 +341,14 @@ int eth_init(bd_t *bis)
 	do {
 		uchar env_enetaddr[6];
 
-		if (eth_getenv_enetaddr_by_index(eth_number, env_enetaddr))
+		if (eth_getenv_enetaddr_by_index(eth_number, env_enetaddr)) {
 			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;
-- 
1.7.0.4



More information about the U-Boot mailing list