[PATCH 3/3] ARM: boards: Add MyirTech MYD-YA15XC-T development board support

Alexander Shiyan eagle.alexander923 at gmail.com
Thu Aug 31 02:41:24 PDT 2023


> > +struct id_eeprom {
> > +     u8 hrcw_primary[0x10];
> > +     u8 pn[64];
> > +     u8 sn[64];
> > +     u8 mac0[6];
> > +     u8 mac1[6];
> > +} __packed;
>
> You could describe this as nvmem-cells in the DT and you'd automatically
> get the MAC addresses assigned.
...
> > +     if (!is_valid_ether_addr(eeprom.mac0)) {
> > +             int i, j;
> > +
> > +             /* Make fixed MAC-address based on serial number */
> > +             memcpy(eeprom.mac0, str, sizeof(eeprom.mac0));
> > +             for (i = sizeof(eeprom.mac0); i < len; i++)
> > +                     for (j = 0; j < sizeof(eeprom.mac0); j++)
> > +                             eeprom.mac0[j] ^= str[i];
> > +     }
> > +
> > +     eth_register_ethaddr(0, eeprom.mac0);
> You could check if the nvmem cell exists and only do the fixup
> if it doesn't. Check Marco's recent Debix patches for an example
> of how to call nvmem from board code.

I can't find a way to know if an MAC address that was automatically
assigned via nvmem is valid.
So in this case we always need to use eth_register_ethaddr() manually?



More information about the barebox mailing list