All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: fec: add the initial to set the physical mac address
@ 2013-08-22 11:17 Fugang Duan
  2013-08-22 14:07 ` Li Frank-B20596
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Fugang Duan @ 2013-08-22 11:17 UTC (permalink / raw)
  To: b20596, b45643, davem; +Cc: netdev, shawn.guo, bhutchings, R49496, stephen

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.

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

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

* RE: [PATCH] net: fec: add the initial to set the physical mac address
  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
  2013-09-10 14:19 ` Denis Kirjanov
  2 siblings, 0 replies; 10+ messages in thread
From: Li Frank-B20596 @ 2013-08-22 14:07 UTC (permalink / raw)
  To: Duan Fugang-B38611, Zhou Luwei-B45643, davem
  Cc: netdev, shawn.guo, bhutchings, Estevam Fabio-R49496, stephen

I remember community have patch to set random mac if there are not validate mac address 

-----Original Message-----
From: Duan Fugang-B38611 
Sent: Thursday, August 22, 2013 6:18 AM
To: Li Frank-B20596; Zhou Luwei-B45643; davem@davemloft.net
Cc: netdev@vger.kernel.org; shawn.guo@linaro.org; bhutchings@solarflare.com; Estevam Fabio-R49496; stephen@networkplumber.org
Subject: [PATCH] net: fec: add the initial to set the physical mac address

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.

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

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

* Re: [PATCH] net: fec: add the initial to set the physical mac address
  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
  2013-08-28  2:11   ` Duan Fugang-B38611
  2013-09-10 14:19 ` Denis Kirjanov
  2 siblings, 1 reply; 10+ messages in thread
From: Lucas Stach @ 2013-08-27 14:18 UTC (permalink / raw)
  To: Fugang Duan
  Cc: b20596, b45643, davem, netdev, shawn.guo, bhutchings, R49496, stephen

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 |

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

* RE: [PATCH] net: fec: add the initial to set the physical mac address
  2013-08-27 14:18 ` Lucas Stach
@ 2013-08-28  2:11   ` Duan Fugang-B38611
  2013-08-30  1:59     ` Duan Fugang-B38611
  2013-09-10  1:45     ` Duan Fugang-B38611
  0 siblings, 2 replies; 10+ messages in thread
From: Duan Fugang-B38611 @ 2013-08-28  2:11 UTC (permalink / raw)
  To: Lucas Stach
  Cc: Li Frank-B20596, Zhou Luwei-B45643, davem, netdev, shawn.guo,
	bhutchings, Estevam Fabio-R49496, stephen

From: Lucas Stach [mailto:l.stach@pengutronix.de]
Data: Tuesday, August 27, 2013 10:19 PM

> To: Duan Fugang-B38611
> Cc: Li Frank-B20596; Zhou Luwei-B45643; davem@davemloft.net;
> netdev@vger.kernel.org; shawn.guo@linaro.org; bhutchings@solarflare.com;
> Estevam Fabio-R49496; stephen@networkplumber.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@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 |
> 


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

* RE: [PATCH] net: fec: add the initial to set the physical mac address
  2013-08-28  2:11   ` Duan Fugang-B38611
@ 2013-08-30  1:59     ` Duan Fugang-B38611
  2013-09-10  1:45     ` Duan Fugang-B38611
  1 sibling, 0 replies; 10+ messages in thread
From: Duan Fugang-B38611 @ 2013-08-30  1:59 UTC (permalink / raw)
  To: Lucas Stach, davem
  Cc: davem, netdev, bhutchings, Estevam Fabio-R49496, stephen

Ping...

> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.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@davemloft.net;
> netdev@vger.kernel.org; shawn.guo@linaro.org; bhutchings@solarflare.com;
> Estevam Fabio-R49496; stephen@networkplumber.org
> Subject: RE: [PATCH] net: fec: add the initial to set the physical mac
> address
> 
> From: Lucas Stach [mailto:l.stach@pengutronix.de]
> Data: Tuesday, August 27, 2013 10:19 PM
> 
> > To: Duan Fugang-B38611
> > Cc: Li Frank-B20596; Zhou Luwei-B45643; davem@davemloft.net;
> > netdev@vger.kernel.org; shawn.guo@linaro.org;
> > bhutchings@solarflare.com; Estevam Fabio-R49496;
> > stephen@networkplumber.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@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
> |
> >
> 



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

* RE: [PATCH] net: fec: add the initial to set the physical mac address
  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
  1 sibling, 1 reply; 10+ messages in thread
From: Duan Fugang-B38611 @ 2013-09-10  1:45 UTC (permalink / raw)
  To: Lucas Stach, davem
  Cc: davem, netdev, bhutchings, Estevam Fabio-R49496, stephen, Sascha Hauer

Hi, David,

Please don't ignore the patch. 

Thanks,
Andy

> -----Original Message-----
> From: Duan Fugang-B38611
> Sent: Friday, August 30, 2013 10:01 AM
> To: Lucas Stach; davem@davemloft.net
> Cc: davem@davemloft.net; netdev@vger.kernel.org; bhutchings@solarflare.com;
> Estevam Fabio-R49496; stephen@networkplumber.org
> Subject: RE: [PATCH] net: fec: add the initial to set the physical mac
> address
> 
> Ping...
> 
> > -----Original Message-----
> > From: netdev-owner@vger.kernel.org
> > [mailto:netdev-owner@vger.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@davemloft.net;
> > netdev@vger.kernel.org; shawn.guo@linaro.org;
> > bhutchings@solarflare.com; Estevam Fabio-R49496;
> > stephen@networkplumber.org
> > Subject: RE: [PATCH] net: fec: add the initial to set the physical mac
> > address
> >
> > From: Lucas Stach [mailto:l.stach@pengutronix.de]
> > Data: Tuesday, August 27, 2013 10:19 PM
> >
> > > To: Duan Fugang-B38611
> > > Cc: Li Frank-B20596; Zhou Luwei-B45643; davem@davemloft.net;
> > > netdev@vger.kernel.org; shawn.guo@linaro.org;
> > > bhutchings@solarflare.com; Estevam Fabio-R49496;
> > > stephen@networkplumber.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@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
> > |
> > >
> >
> 

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

* Re: [PATCH] net: fec: add the initial to set the physical mac address
  2013-09-10  1:45     ` Duan Fugang-B38611
@ 2013-09-10  5:07       ` David Miller
  2013-09-10  5:23         ` Duan Fugang-B38611
  0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2013-09-10  5:07 UTC (permalink / raw)
  To: B38611; +Cc: l.stach, netdev, bhutchings, r49496, stephen, s.hauer

From: Duan Fugang-B38611 <B38611@freescale.com>
Date: Tue, 10 Sep 2013 01:45:52 +0000

> Please don't ignore the patch. 

Please don't just pray that it's in my queue and I will apply it.

If it's not in my patchwork queue, you need to simply resubmit it.

If it is in my patchwork queue, you need to be patient.

Thank you.

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

* RE: [PATCH] net: fec: add the initial to set the physical mac address
  2013-09-10  5:07       ` David Miller
@ 2013-09-10  5:23         ` Duan Fugang-B38611
  0 siblings, 0 replies; 10+ messages in thread
From: Duan Fugang-B38611 @ 2013-09-10  5:23 UTC (permalink / raw)
  To: David Miller
  Cc: l.stach, netdev, bhutchings, Estevam Fabio-R49496, stephen, s.hauer

From: David Miller [mailto:davem@davemloft.net]
Data: Tuesday, September 10, 2013 1:08 PM

> To: Duan Fugang-B38611
> Cc: l.stach@pengutronix.de; netdev@vger.kernel.org;
> bhutchings@solarflare.com; Estevam Fabio-R49496;
> stephen@networkplumber.org; s.hauer@pengutronix.de
> Subject: Re: [PATCH] net: fec: add the initial to set the physical mac
> address
> 
> From: Duan Fugang-B38611 <B38611@freescale.com>
> Date: Tue, 10 Sep 2013 01:45:52 +0000
> 
> > Please don't ignore the patch.
> 
> Please don't just pray that it's in my queue and I will apply it.
> 
> If it's not in my patchwork queue, you need to simply resubmit it.
> 
> If it is in my patchwork queue, you need to be patient.
> 
> Thank you.
> 
Ok, I know, just a notify to avoid forget it because I did ping to you.

Thanks.

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

* Re: [PATCH] net: fec: add the initial to set the physical mac address
  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
@ 2013-09-10 14:19 ` Denis Kirjanov
  2013-09-11  1:15   ` Duan Fugang-B38611
  2 siblings, 1 reply; 10+ messages in thread
From: Denis Kirjanov @ 2013-09-10 14:19 UTC (permalink / raw)
  To: Fugang Duan
  Cc: b20596, b45643, davem, netdev, shawn.guo, bhutchings, R49496, stephen

On 8/22/13, Fugang Duan <B38611@freescale.com> wrote:
> 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.
>
> 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) {

I don't see how the p pointer can be NULL...

> +		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;
> --
> 1.7.1
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* RE: [PATCH] net: fec: add the initial to set the physical mac address
  2013-09-10 14:19 ` Denis Kirjanov
@ 2013-09-11  1:15   ` Duan Fugang-B38611
  0 siblings, 0 replies; 10+ messages in thread
From: Duan Fugang-B38611 @ 2013-09-11  1:15 UTC (permalink / raw)
  To: Denis Kirjanov
  Cc: Li Frank-B20596, Zhou Luwei-B45643, davem, netdev, shawn.guo,
	bhutchings, Estevam Fabio-R49496, stephen

From: Denis Kirjanov [mailto:kda@linux-powerpc.org]
Data: Tuesday, September 10, 2013 10:19 PM

> To: Duan Fugang-B38611
> Cc: Li Frank-B20596; Zhou Luwei-B45643; davem@davemloft.net;
> netdev@vger.kernel.org; shawn.guo@linaro.org; bhutchings@solarflare.com;
> Estevam Fabio-R49496; stephen@networkplumber.org
> Subject: Re: [PATCH] net: fec: add the initial to set the physical mac
> address
> 
> On 8/22/13, Fugang Duan <B38611@freescale.com> wrote:
> > 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.
> >
> > 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) {
> 
> I don't see how the p pointer can be NULL...

As below, fec_enet_init() function calls fec_set_mac_address(ndev, NULL).

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

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

end of thread, other threads:[~2013-09-11  1:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.