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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > +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?




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux