[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9848F2DB572E5649BA045B288BE08FBE01662A37@039-SN2MPN1-021.039d.mgd.msft.net>
Date: Fri, 30 Aug 2013 01:59:51 +0000
From: Duan Fugang-B38611 <B38611@...escale.com>
To: Lucas Stach <l.stach@...gutronix.de>,
"davem@...emloft.net" <davem@...emloft.net>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bhutchings@...arflare.com" <bhutchings@...arflare.com>,
Estevam Fabio-R49496 <r49496@...escale.com>,
"stephen@...workplumber.org" <stephen@...workplumber.org>
Subject: RE: [PATCH] net: fec: add the initial to set the physical mac
address
Ping...
> -----Original Message-----
> From: netdev-owner@...r.kernel.org [mailto:netdev-owner@...r.kernel.org]
> On Behalf Of Duan Fugang-B38611
> Sent: Wednesday, August 28, 2013 10:11 AM
> To: Lucas Stach
> Cc: Li Frank-B20596; Zhou Luwei-B45643; davem@...emloft.net;
> netdev@...r.kernel.org; shawn.guo@...aro.org; bhutchings@...arflare.com;
> Estevam Fabio-R49496; stephen@...workplumber.org
> Subject: RE: [PATCH] net: fec: add the initial to set the physical mac
> address
>
> From: Lucas Stach [mailto:l.stach@...gutronix.de]
> Data: Tuesday, August 27, 2013 10:19 PM
>
> > To: Duan Fugang-B38611
> > Cc: Li Frank-B20596; Zhou Luwei-B45643; davem@...emloft.net;
> > netdev@...r.kernel.org; shawn.guo@...aro.org;
> > bhutchings@...arflare.com; Estevam Fabio-R49496;
> > stephen@...workplumber.org
> > Subject: Re: [PATCH] net: fec: add the initial to set the physical mac
> > address
> >
> > 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.
> Netdev core don't call the function willingly, if only user config MAC
> address such as call ioctl(sockfd, SIOCSIFHWADDR, ifreq).
>
> > So anyway:
> > Reviewed-by: Lucas Stach <l.stach@...gutronix.de>
> >
> > > Signed-off-by: Fugang Duan <B38611@...escale.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
> |
> >
>
Powered by blists - more mailing lists