[U-Boot] [PATCH] mvgbe: fix network device indices

Prafulla Wadaskar
2011-10-27T09:12:35Z

> -----Original Message-----
> From: Michael Walle [mailto:michael at walle.cc]
> Sent: Wednesday, October 26, 2011 2:41 AM
> To: Prafulla Wadaskar
> Cc: u-boot at lists.denx.de; Mike Frysinger
> Subject: Re: [U-Boot] [PATCH] mvgbe: fix network device indices
>
> Am Freitag 21 Oktober 2011, 10:09:15 schrieben Sie:
> > > -----Original Message-----
> > > From: u-boot-bounces at lists.denx.de [mailto:u-boot-
> bounces at lists.denx.de]
> > > On Behalf Of Michael Walle
> > > Sent: Friday, October 07, 2011 3:53 AM
> > > To: u-boot at lists.denx.de
> > > Subject: [U-Boot] [PATCH] mvgbe: fix network device indices
> > >
> > > Don't assume that the MAC address of egiga0 rsp. egiga1 is
> ethaddr rsp.
> > > eth1addr. If there is only a egiga1 device, u-boot will
> enumerate it as
> > > device 0 and therefore the MAC address is set with the
> environment
> > > varibale
> > > ethaddr.
> >
> > Hi
> >
> > If I understood it correctly,
> > In current implementation, if only egiga1 device is enabled
> on the board,
> > then it will assign MAC address associated with environment
> variable
> > "ethaddr".
> yes but the current mvgbe driver will check eth1addr and set it
> to a random
> value if not set.

Yes, but this may be avoided by defining CONFIG_SKIP_LOCAL_MAC_RANDOMIZATION as done for edminiv2 board.

>
> > This patch will make environment variable "egiga1" available
> in such case.
> > Right?
> mh? This patch will use the same enumeration as the net/eth.c
> code in
> eth_initialize(). At least if there is no other ethernet driver
> than mvgbe.
> So ethaddr is set to a random value instead of eth1addr, which
> eth_initialize() then use the set the mac address.
>
> > If so, then this is not the case with only mvgbe, it is
> applicable for all
> > network drivers.
> yeah other drivers also set eth(N)addr sometimes, which suffers
> from the same
> problem. maybe a driver could provide some callback to
> initialize a macaddress
> or eth_register returns the device index which in turn could be
> used to get
> the proper ethNaddr environment variable.

I think right place to provide solution for this problem is net/eth.c.
The suggested change is logical but doing this will affect all u-boot users. May be some more opinion on this will be helpful.

Regards..
Prafulla . . .

>
> --
> Michael