[U-Boot] [PATCH] net: axi_ethernet: Add driver to u-boot
Michal Simek
monstr at monstr.eu
Tue Mar 1 09:19:12 CET 2011
>> +static void setup_mac(struct eth_device *dev)
>> +{
>> + /* Set the MAC address */
>> + int val = ((dev->enetaddr[3] << 24) | (dev->enetaddr[2] << 16) |
>> + (dev->enetaddr[1] << 8) | (dev->enetaddr[0]));
>> + out_be32(dev->iobase + XAE_UAW0_OFFSET, val);
>> +
>> + val = (dev->enetaddr[5] << 8) | dev->enetaddr[4] ;
>> + val |= in_be32(dev->iobase + XAE_UAW1_OFFSET)
>> + & ~XAE_UAW1_UNICASTADDR_MASK;
>> + out_be32(dev->iobase + XAE_UAW1_OFFSET, val);
>> +}
>> ...
>> +static int axiemac_init(struct eth_device *dev, bd_t * bis)
>> +{
>> ...
>> + setup_mac(dev);
>
> this should be moved to eth_device.write_hwaddr in the initialize function.
> then the common layers will call setup_mac for you as needed.
I am not going to use write_hwaddr function because axi emac needs some initialization before you
can write a mac addr that's why I will keep it in the same location as is.
Michal
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
More information about the U-Boot
mailing list