public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] net: macb: write mac address when initialization
@ 2014-10-22  6:45 Bo Shen
  2014-10-22  7:19 ` Boris Brezillon
  2014-11-17 12:14 ` [U-Boot] " Andreas Bießmann
  0 siblings, 2 replies; 3+ messages in thread
From: Bo Shen @ 2014-10-22  6:45 UTC (permalink / raw)
  To: u-boot

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

 drivers/net/macb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

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;
 
-- 
2.1.0.24.g4109c28

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

* [U-Boot] [PATCH] net: macb: write mac address when initialization
  2014-10-22  6:45 [U-Boot] [PATCH] net: macb: write mac address when initialization Bo Shen
@ 2014-10-22  7:19 ` Boris Brezillon
  2014-11-17 12:14 ` [U-Boot] " Andreas Bießmann
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2014-10-22  7:19 UTC (permalink / raw)
  To: u-boot

Hi Bo,

On Wed, 22 Oct 2014 14:45:56 +0800
Bo Shen <voice.shen@atmel.com> 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.
> 
> 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>

Thanks for fixing this.

Tested-by Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
> 
>  drivers/net/macb.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> 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;
>  



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [U-Boot] net: macb: write mac address when initialization
  2014-10-22  6:45 [U-Boot] [PATCH] net: macb: write mac address when initialization Bo Shen
  2014-10-22  7:19 ` Boris Brezillon
@ 2014-11-17 12:14 ` Andreas Bießmann
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Bießmann @ 2014-11-17 12:14 UTC (permalink / raw)
  To: u-boot

Dear Bo Shen,

Bo Shen <voice.shen@atmel.com> writes:
>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>
>---
>
> drivers/net/macb.c | 9 +++++++++
> 1 file changed, 9 insertions(+)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

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

end of thread, other threads:[~2014-11-17 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-22  6:45 [U-Boot] [PATCH] net: macb: write mac address when initialization Bo Shen
2014-10-22  7:19 ` Boris Brezillon
2014-11-17 12:14 ` [U-Boot] " Andreas Bießmann

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