From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: add opencore 10/100 ethernet mac driver
Date: Wed, 24 Mar 2010 03:54:46 -0400 [thread overview]
Message-ID: <201003240354.46999.vapier@gentoo.org> (raw)
In-Reply-To: <1269411881-8850-1-git-send-email-thomas@wytron.com.tw>
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
next prev parent reply other threads:[~2010-03-24 7:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-24 6:24 [U-Boot] [PATCH] net: add opencore 10/100 ethernet mac driver Thomas Chou
2010-03-24 7:54 ` Mike Frysinger [this message]
2010-03-24 13:38 ` Thomas Chou
2010-03-24 13:34 ` [U-Boot] [PATCH v2] " Thomas Chou
2010-03-31 3:07 ` Scott McNutt
2010-03-31 4:07 ` Ben Warren
2010-04-01 7:09 ` Michal Simek
2010-04-05 6:31 ` Ben Warren
2010-04-07 3:34 ` Thomas Chou
2010-04-07 17:26 ` Ben Warren
2010-04-15 14:32 ` [U-Boot] [PATCH v3] " Thomas Chou
2010-04-26 6:12 ` Ben Warren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201003240354.46999.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox