All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net, fec_mxc: use mac address stored in env before looking in eeprom
Date: Wed, 24 Mar 2010 14:07:13 +0100	[thread overview]
Message-ID: <4BAA0E81.7030407@denx.de> (raw)
In-Reply-To: <4BAA072C.5050100@denx.de>

Hello stefano,

Stefano Babic wrote:
> Heiko Schocher wrote:
> 
> Hi Heiko,
> 
>> Signed-off-by: Heiko Schocher <hs@denx.de>
>> ---
>>  drivers/net/fec_mxc.c |   15 +++++++++++----
>>  1 files changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
>> index 5af9cdb..b5245ec 100644
>> --- a/drivers/net/fec_mxc.c
>> +++ b/drivers/net/fec_mxc.c
>> @@ -749,11 +749,18 @@ static int fec_probe(bd_t *bd)
>>
>>  	eth_register(edev);
>>
>> -	if (fec_get_hwaddr(edev, ethaddr) == 0) {
>> -		printf("got MAC address from EEPROM: %pM\n", ethaddr);
>> -		memcpy(edev->enetaddr, ethaddr, 6);
>> -		fec_set_hwaddr(edev);
>> +	if (!eth_getenv_enetaddr("ethaddr", ethaddr)) {
>> +		/* "ethaddr" is not set in the environment */
>> +		if (fec_get_hwaddr(edev, ethaddr) == 0) {
>> +			printf("got MAC address from EEPROM: %pM\n", ethaddr);
>> +			eth_setenv_enetaddr("ethaddr", ethaddr);
>> +		} else {
>> +			printf ("no MAC found\n");
>> +			return -1;
>> +		}
>>  	}
>> +	memcpy(edev->enetaddr, ethaddr, 6);
>> +	fec_set_hwaddr(edev);
>>
>>  	return 0;
>>  }
> 
> As I understood Ben's comment on my last patch, the driver must not
> touch any environment variable, that is it must not call any
> getenv/setenv function.
> 
> See http://www.mail-archive.com/u-boot at lists.denx.de/msg28329.html

Huh, didn;t see your patch ... sorry!

Hmm.. but if u-boot didn;t use this interface, linux never get
the mac address stored in ethaddr ... so, if using in u-boot
network, linux see/uses the mac address from environment, if
not using network in u-boot, linux uses the mac address stored
in eeprom ...

and if no valid mac address is in eeprom, linux has no valid
mac address, if u-boot don;t uses the interface ...

If I look in the code drivers/net/fec_mxc.c fec_get_hwaddr():

if defined CONFIG_MX51 this function _always_ returns -1, so
if not using this interface, on MX51 based plattforms, the
mac address is never initialized ...

How works this on such plattforms?

bye
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  parent reply	other threads:[~2010-03-24 13:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-24 11:56 [U-Boot] [PATCH] net, fec_mxc: use mac address stored in env before looking in eeprom Heiko Schocher
2010-03-24 12:35 ` Stefano Babic
2010-03-24 12:52   ` Detlev Zundel
2010-03-24 20:39     ` Mike Frysinger
2010-03-24 13:07   ` Heiko Schocher [this message]
2010-03-24 20:35 ` Mike Frysinger
2010-03-25  6:31   ` Heiko Schocher
2010-03-25  9:40     ` Wolfgang Denk
2010-03-25 13:16       ` Detlev Zundel
2010-03-25 14:02         ` Wolfgang Denk
2010-03-26  8:39           ` [U-Boot] Design principles (was: Re: [PATCH] net, fec_mxc: use mac address stored in env before looking in eeprom) Detlev Zundel
2010-03-26 10:40             ` Wolfgang Denk
2010-03-26 11:47               ` [U-Boot] Design principles Detlev Zundel
2010-03-26 12:38                 ` Wolfgang Denk
2010-03-26 13:02                   ` Detlev Zundel
2010-03-26 18:21                     ` Wolfgang Denk
2010-03-27  7:32                       ` Heiko Schocher
2010-03-27 10:21                         ` Wolfgang Denk
2010-03-25 17:49         ` [U-Boot] [PATCH] net, fec_mxc: use mac address stored in env before looking in eeprom Mike Frysinger
2010-03-25 17:38       ` Mike Frysinger
2010-03-25 19:11         ` Wolfgang Denk
2010-03-25 19:22           ` Mike Frysinger

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=4BAA0E81.7030407@denx.de \
    --to=hs@denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.