public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ARM: fdt support: Add usbethaddr as an acceptable MAC
Date: Wed, 2 Oct 2013 15:19:58 -0400	[thread overview]
Message-ID: <20131002191958.GJ15917@bill-the-cat> (raw)
In-Reply-To: <1380740415-25704-1-git-send-email-dmurphy@ti.com>

On Wed, Oct 02, 2013 at 02:00:15PM -0500, Dan Murphy wrote:

> A board that has a USB ethernet device only may set the usbetheraddr
> and not the ethaddr.
> ethaddr will be the default MAC address that is chosen and if that
> is not populated then the usbethaddr is looked at.  If neither are set
> then then device tree blob is not modified.
> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>  common/fdt_support.c |   12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index b034c98..fef7e60 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -450,8 +450,18 @@ void fdt_fixup_ethernet(void *fdt)
>  	if (node < 0)
>  		return;
>  
> +	if (!getenv("ethaddr")) {
> +		if (getenv("usbethaddr")) {
> +			strcpy(mac, "usbethaddr");
> +		} else {
> +			debug("No ethernet MAC Address defined\n");
> +			return;
> +		}
> +	} else {
> +		strcpy(mac, "ethaddr");
> +	}
> +
>  	i = 0;
> -	strcpy(mac, "ethaddr");
>  	while ((tmp = getenv(mac)) != NULL) {
>  		sprintf(enet, "ethernet%d", i);
>  		path = fdt_getprop(fdt, node, enet, NULL);

The problem is we may well have both.  I think we need to re-work the
function slightly to be:
while ((tmp = getenv(mac)) != NULL) {
  do_fdt_fixup_ethernet_x(tmp, fdt, node, enet, i)
}
if (getenv("usbethaddr"))
  do_fdt_fixup_ethernet_x("usbethaddr", fdt, ...)

Where the name of the new function, and parameter order also makes sense
and is complete of course.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131002/0f68cb87/attachment.pgp>

  reply	other threads:[~2013-10-02 19:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-02 19:00 [U-Boot] [PATCH] ARM: fdt support: Add usbethaddr as an acceptable MAC Dan Murphy
2013-10-02 19:19 ` Tom Rini [this message]
2013-10-02 20:14   ` Dan Murphy
2013-10-02 20:19     ` Tom Rini
2013-10-02 20:21       ` Dan Murphy
2013-10-09 15:04         ` Dan Murphy
2014-06-19 15:19 ` [U-Boot] " Tom Rini

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=20131002191958.GJ15917@bill-the-cat \
    --to=trini@ti.com \
    --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