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

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to