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

Michael Walle michael at walle.cc
Thu Oct 27 12:22:28 CEST 2011


Am Do, 27.10.2011, 11:12 schrieb Prafulla Wadaskar:
>> > 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.
Ok, but that is not my problem ;) And even if this macro is set, the wrong
environment variable will still be set (in this case not a randomized mac
address, but :00:00:<devnum> suffix).

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

ok, so the second option still applies, that is eth_register() returns a
device index. the current eth_register always returns zero, in fact all
drivers in the uboot source don't check the return code. so here we could
return the device index.

@wolfgang: any opinion on that? or any other idea how to pass the ethernet
device number to a network driver?

-- 
Michael



More information about the U-Boot mailing list