[U-Boot] [PATCH] net: add opencore 10/100 ethernet mac driver
Thomas Chou
thomas at wytron.com.tw
Wed Mar 24 14:38:33 CET 2010
On 03/24/2010 03:54 PM, Mike Frysinger wrote:
> On Wednesday 24 March 2010 02:24:41 Thomas Chou wrote:
>
>> +static int ethoc_set_mac_address(struct eth_device *dev, void *addr)
>> +{
>> + struct ethoc *priv = (void *)dev->priv;
>> + u8 *mac = (u8 *) addr;
>> +
>> + ethoc_write(priv, MAC_ADDR0, (mac[2]<< 24) | (mac[3]<< 16) |
>> + (mac[4]<< 8) | (mac[5]<< 0));
>> + ethoc_write(priv, MAC_ADDR1, (mac[0]<< 8) | (mac[1]<< 0));
>> +
>> + return 0;
>> +}
>> +
>> +static int ethoc_init(struct eth_device *dev, bd_t * bd)
>> +{
>> + eth_getenv_enetaddr("ethaddr", dev->enetaddr);
>> + ethoc_set_mac_address(dev, dev->enetaddr);
>>
> yikes ! drivers shouldnt be poking the env -- the common net layer handles
> syncing the env and the eth_device structure for you. so the code should
> simply be:
> ethoc_set_mac_address(dev);
>
> and that function works off of dev->enetaddr. or pass it dev->enetaddr and
> have it work off the specified buffer. your choice.
> -mike
>
Hi Mike,
Thank you. Please review the update.
Best regards,
Thomas
More information about the U-Boot
mailing list