From: Mike Frysinger Date: Wed, 24 Mar 2010 03:54:46 -0400 Subject: [U-Boot] [PATCH] net: add opencore 10/100 ethernet mac driver In-Reply-To: <1269411881-8850-1-git-send-email-thomas@wytron.com.tw> References: <1269411881-8850-1-git-send-email-thomas@wytron.com.tw> Message-ID: <201003240354.46999.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20100324/83fb1a3e/attachment.pgp