diff options
author | Bo Shen <voice.shen@atmel.com> | 2014-10-22 06:45:56 (GMT) |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-11-17 13:47:15 (GMT) |
commit | b2eff088699ac6b846b1ff34c2bb6549f358e6a0 (patch) | |
tree | 39af389a0a08fb5c21153972e76abd45e4305e93 /drivers/net | |
parent | bdf790fabc8185112b3f699c8a25aab09c50239e (diff) | |
download | u-boot-b2eff088699ac6b846b1ff34c2bb6549f358e6a0.tar.xz |
net: macb: write mac address when initialization
When boot up without mac address setting, it will give the warning
message like: "Warning: failed to set MAC address", however when
execute network related command, it still execute them without any
warning information.
With this patch, it will exit directly with following information:
"gmac0: mac address is not valid"
It also solve the problem after bootup then set mac address and the
mac address won't set to net device issue.
Signed-off-by: Bo Shen <voice.shen@atmel.com>
Tested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/macb.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 375c8a4..4616f36 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -525,6 +525,7 @@ static int macb_phy_init(struct macb_device *macb) return 1; } +static int macb_write_hwaddr(struct eth_device *dev); static int macb_init(struct eth_device *netdev, bd_t *bd) { struct macb_device *macb = to_macb(netdev); @@ -587,6 +588,14 @@ static int macb_init(struct eth_device *netdev, bd_t *bd) #endif /* CONFIG_RMII */ } + /* update the ethaddr */ + if (is_valid_ether_addr(netdev->enetaddr)) { + macb_write_hwaddr(netdev); + } else { + printf("%s: mac address is not valid\n", netdev->name); + return -1; + } + if (!macb_phy_init(macb)) return -1; |