[U-Boot] [PATCH v2] mvgbe: remove setting of ethaddr within the driver

Prafulla Wadaskar prafulla at marvell.com
Mon Nov 21 05:39:08 CET 2011



> -----Original Message-----
> From: Michael Walle [mailto:michael at walle.cc]
> Sent: Friday, November 18, 2011 4:22 AM
> To: u-boot at lists.denx.de
> Cc: Wolfgang Denk; Michael Walle; Mike Frysinger; Prafulla
> Wadaskar; Valentin Longchamp; Eric Cooper; Jason Cooper;
> Siddarth Gore; Albert ARIBAUD; Simon Guinot
> Subject: [PATCH v2] mvgbe: remove setting of ethaddr within the
> driver
> 
> A network driver should not touch the environment at all. This
> patch fixes
> this behaviour by removing the code for setting a
> default/randomized MAC
> address.
> 
> Signed-off-by: Michael Walle <michael at walle.cc>
> Acked-by: Mike Frysinger <vapier at gentoo.org>
> Acked-by: Prafulla Wadaskar <prafulla at marvell.com>
> Cc: Mike Frysinger <vapier at gentoo.org>
> Cc: Prafulla Wadaskar <prafulla at marvell.com>
> Cc: Valentin Longchamp <valentin.longchamp at keymile.com>
> Cc: Eric Cooper <ecc at cmu.edu>
> Cc: Jason Cooper <u-boot at lakedaemon.net>
> Cc: Siddarth Gore <gores at marvell.com>
> Cc: Albert ARIBAUD <albert.u.boot at aribaud.net>
> Cc: Simon Guinot <simon.guinot at sequanux.org>
> ---
>  drivers/net/mvgbe.c |   23 -----------------------
>  1 files changed, 0 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
> index c7f7446..21be642 100644
> --- a/drivers/net/mvgbe.c
> +++ b/drivers/net/mvgbe.c
> @@ -647,7 +647,6 @@ int mvgbe_initialize(bd_t *bis)
>  	struct mvgbe_device *dmvgbe;
>  	struct eth_device *dev;
>  	int devnum;
> -	char *s;
>  	u8 used_ports[MAX_MVGBE_DEVS] = CONFIG_MVGBE_PORTS;
> 
>  	for (devnum = 0; devnum < MAX_MVGBE_DEVS; devnum++) {
> @@ -702,16 +701,13 @@ error1:
>  		/* must be less than NAMESIZE (16) */
>  		sprintf(dev->name, "egiga%d", devnum);
> 
> -		/* Extract the MAC address from the environment */
>  		switch (devnum) {
>  		case 0:
>  			dmvgbe->regs = (void *)MVGBE0_BASE;
> -			s = "ethaddr";
>  			break;
>  #if defined(MVGBE1_BASE)
>  		case 1:
>  			dmvgbe->regs = (void *)MVGBE1_BASE;
> -			s = "eth1addr";
>  			break;
>  #endif
>  		default:	/* this should never happen */
> @@ -720,25 +716,6 @@ error1:
>  			return -1;
>  		}
> 
> -		while (!eth_getenv_enetaddr(s, dev->enetaddr)) {
> -			/* Generate Private MAC addr if not set */
> -			dev->enetaddr[0] = 0x02;
> -			dev->enetaddr[1] = 0x50;
> -			dev->enetaddr[2] = 0x43;
> -#if defined (CONFIG_SKIP_LOCAL_MAC_RANDOMIZATION)
> -			/* Generate fixed lower MAC half using devnum */
> -			dev->enetaddr[3] = 0;
> -			dev->enetaddr[4] = 0;
> -			dev->enetaddr[5] = devnum;
> -#else
> -			/* Generate random lower MAC half */
> -			dev->enetaddr[3] = get_random_hex();
> -			dev->enetaddr[4] = get_random_hex();
> -			dev->enetaddr[5] = get_random_hex();
> -#endif
> -			eth_setenv_enetaddr(s, dev->enetaddr);
> -		}
> -
>  		dev->init = (void *)mvgbe_init;
>  		dev->halt = (void *)mvgbe_halt;
>  		dev->send = (void *)mvgbe_send;
> --
> 1.7.2.5

Ack for this patch
Acked-by: Prafulla Wadaskar <prafulla at marvell.com>

Regards..
Prafulla . . .




More information about the U-Boot mailing list