[PATCH] Check mac-address first in fsl_soc.c
Sergei Shtylyov
sshtylyov at ru.mvista.com
Sat Feb 10 07:58:39 EST 2007
Hello.
Timur Tabi wrote:
>>> The mac-address property in the device tree should be checked first,
>>> before local-mac-address. This is because mac-address contains the most
>>> recent MAC address, whereas local-mac-address is the default address.
>>> Depending on the platform and the version of U-Boot, U-Boot will set
>>> one or the other, or both.
>> Argh, *when* it will be setting both?
> I'm working on a patch now to implement that for 83xx. Whether/when it
> will be applied is anyone's guess.
I'm mainly concerned about 85xx. I guess the needed change should be very
alike...
>>> - mac_addr = (void *)get_property(np, "mac-address", NULL);
>>> - memcpy(fs_enet_data.macaddr, mac_addr, 6);
>>> + mac_addr = get_property(np, "mac-address", NULL);
>>> + if (!mac_addr || (memcmp(mac_addr, "\0\0\0\0\0", 6) == 0)) {
>>> + mac_addr = get_property(np, "local-mac-address", NULL);
>>> + if (!mac_addr || (memcmp(mac_addr, "\0\0\0\0\0", 6) ==
>>> 0)) {
>>> + /* Obsolete */
>>> + mac_addr = get_property(np, "address", NULL);
>>> + }
>>> + }
>>> +
>>> + if (mac_addr)
>>> + memcpy(fs_enet_data.macaddr, mac_addr, 6);
>>
>>
>> These are just asking to be put into a separate function... :-)
> I wanted to keep my patch simple.
That's clearly an over-simplification to repeat the same code thrice.
WBR, Sergei
More information about the Linuxppc-dev
mailing list