net: macb: write mac address when initialization
PATCH 1/1 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.
---
drivers/net/macb.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/macb.c +9 -0
@@ -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 ;
Signature · 1 line
2.1.0.24.g4109c28
PATCH 1/1 net: macb: write mac address when initialization
Hi Bo,
Quoted 5 lines · On Wed, 22 Oct 2014 14:45:56 +0800 Bo Shen <[email protected]> wrote:
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.
Quoted 7 lines
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 <[email protected]>
Thanks for fixing this.
Tested-by Boris Brezillon <[email protected]>
Quoted 32 lines
---
drivers/net/macb.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/net/macb.c +9
-0@@ -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 ;
Signature · 3 lines
Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Dear Bo Shen,
Quoted 11 lines · Bo Shen
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.
Quoted 6 lines
Signed-off-by Bo Shen <[email protected]>Tested-by Boris Brezillon <[email protected]>---
drivers/net/macb.c| 9 +++++++++1 file changed, 9 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards,
Andreas Bie?mann