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

Michael Walle
2011-10-07T10:48:40Z

Am Fr, 7.10.2011, 10:26 schrieb Prafulla Wadaskar:
>> -----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 environmen
>> varibale
>> ethaddr.
>
> So if there is only one eth port available, the associated environment
> variable should be ethaddr, this is understood.
> Is there any issue with this?
Are you asking me or the list? (if the question was for me, remember that
there might be _only_ the egiga1 device.)

> Then I have anther question in my mind-
> Why not we name eth0addr for environment variable associated with egiga0
> to maintain consistency with naming and used ports?

If i get it right, there is another problem with setting the environment
variable from the driver itself.

eth_register() and eth_init() using an own index to enumerate the devices.
Eg. if an e1000 is registered before the the associated environment
variable would be eth1addr for the first mvgbe device and eth2addr for the
second.

This patch only fixes the case where no other network device is
registered. (The current behaviour just works with egiga0 being the only
or the first and egiga1 being the second device).

--
Michael