From: Lucas Stach <l.stach@pengutronix.de>
To: Fugang Duan <B38611@freescale.com>
Cc: b20596@freescale.com, b45643@freescale.com, davem@davemloft.net,
netdev@vger.kernel.org, shawn.guo@linaro.org,
bhutchings@solarflare.com, R49496@freescale.com,
stephen@networkplumber.org
Subject: Re: [PATCH] net: fec: add the initial to set the physical mac address
Date: Tue, 27 Aug 2013 16:18:54 +0200 [thread overview]
Message-ID: <1377613134.4246.12.camel@weser.hi.pengutronix.de> (raw)
In-Reply-To: <1377170269-8988-1-git-send-email-B38611@freescale.com>
Am Donnerstag, den 22.08.2013, 19:17 +0800 schrieb Fugang Duan:
> For imx6slx evk platform, the fec driver cannot work since there
> have no valid mac address set in physical mac registers.
>
> For imx serial platform, fec/enet IPs both need the physical MAC
> address initial, otherwise it cannot work.
>
> After acquiring the valid MAC address from devices tree/pfuse/
> kernel command line/random mac address, and then set it to the
> physical MAC address registers.
>
Yeah, we have also seen that we need to set this explicitly. The strange
thing is that I recall this used to work without calling
fec_set_mac_address() explicitly, so either the netdev core was calling
it at some point, or our userspace was. I didn't got around to
investigate this further.
So anyway:
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Fugang Duan <B38611@freescale.com>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 4349a9e..9b5e08c 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1867,10 +1867,12 @@ fec_set_mac_address(struct net_device *ndev, void *p)
> struct fec_enet_private *fep = netdev_priv(ndev);
> struct sockaddr *addr = p;
>
> - if (!is_valid_ether_addr(addr->sa_data))
> - return -EADDRNOTAVAIL;
> + if (p) {
> + if (!is_valid_ether_addr(addr->sa_data))
> + return -EADDRNOTAVAIL;
>
> - memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
> + memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
> + }
>
> writel(ndev->dev_addr[3] | (ndev->dev_addr[2] << 8) |
> (ndev->dev_addr[1] << 16) | (ndev->dev_addr[0] << 24),
> @@ -1969,6 +1971,7 @@ static int fec_enet_init(struct net_device *ndev)
>
> /* Get the Ethernet address */
> fec_get_mac(ndev);
> + fec_set_mac_address(ndev, NULL);
>
> /* Set receive and transmit descriptor base. */
> fep->rx_bd_base = cbd_base;
--
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2013-08-27 14:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-22 11:17 [PATCH] net: fec: add the initial to set the physical mac address Fugang Duan
2013-08-22 14:07 ` Li Frank-B20596
2013-08-27 14:18 ` Lucas Stach [this message]
2013-08-28 2:11 ` Duan Fugang-B38611
2013-08-30 1:59 ` Duan Fugang-B38611
2013-09-10 1:45 ` Duan Fugang-B38611
2013-09-10 5:07 ` David Miller
2013-09-10 5:23 ` Duan Fugang-B38611
2013-09-10 14:19 ` Denis Kirjanov
2013-09-11 1:15 ` Duan Fugang-B38611
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1377613134.4246.12.camel@weser.hi.pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=B38611@freescale.com \
--cc=R49496@freescale.com \
--cc=b20596@freescale.com \
--cc=b45643@freescale.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shawn.guo@linaro.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).