[U-Boot] [PATCH v2] net: e1000: support 'write_hwaddr' in DM

Hannes Schmelzer hannes at schmelzer.or.at
Thu Oct 25 19:34:29 UTC 2018


On 10/25/2018 08:41 PM, Joe Hershberger wrote:
> On Thu, Oct 25, 2018 at 9:26 AM Hannes Schmelzer
> <hannes.schmelzer at br-automation.com> wrote:
Hi Joe,
>
>> +        * reading the current address failed
>> +        */
>> +       if (!ret_val && memcmp(current_mac, mac, 6) == 0)
>> +               return 0;
>> +
>> +       for (i = 0; i < 3; ++i)
>> +               data[i] = mac[i * 2 + 1] << 8 | mac[i * 2];
>> +
>> +       ret_val = e1000_write_eeprom_srwr(hw, 0x0, 3, data);
> This is a pretty uncommon implementation of this driver operation.
> Does the i120 in this case read the MAC directly from the EEPROM?
>
> Usually this function is used to write the hwaddr into the registers
> of the MAC. The .read_rom_hwaddr is used to fetch the hwaddr from the
> EEPROM and that address is used in the case that the U-Boot env has
> not set one.
This implementation is not new, just moved a bit upward in the file to 
avoid forward declaration for non-DM build.
I will double check it, but i guess there will be no change until we've 
no fail behavior of the existing code.

I didn't imagine that this little change would become so big ;-)
I will provide some v3 within next days with the cosmetic cleanup and 
other requested changes.

cheers,
Hannes




More information about the U-Boot mailing list