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

Michael Walle
2011-10-25T21:10:30Z

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.

> 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.

--
Michael