[U-Boot] [PATCH] net/eth.c: fix eth_write_hwaddr() to use dev->enetaddr as fall back

Dirk Behme dirk.behme at de.bosch.com
Tue Jan 17 17:17:41 CET 2012


Dear Wolfgang and all,

On 17.01.2012 10:52, Wolfgang Denk wrote:
> Dear Zach Sadecki,
> 
> In message <4F149CCB.6070307 at itwatchdogs.com> you wrote:
>> This patch will also fix a problem with mx28 boards that are depending 
>> on the OCOTP bits to set the MAC address (like the Denx m28 board).  Now 
>> it simply fails with a "Warning: failed to set MAC address" if there's 
>> no environment variable instead of using the OCOTP bits like it should.  
>> This patch will fix that.
> 
> But there _should_ always be a warning message if the environment
> variable is missing.

Let's see if I can summarize the issue:

If I understood correctly, we are talking about

http://git.denx.de/?p=u-boot.git;a=commitdiff;h=7616e7850804c7c69e0a22c179dfcba9e8f3f587

and there

int eth_initialize(bd_t *bis)
{
...
-  eth_getenv_enetaddr_by_index(eth_number, env_enetaddr);

versus

+int eth_write_hwaddr(...)
+{
...
+ if (!eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr))
+   return -1;

I.e. the unconditional call of eth_getenv_enetaddr_by_index() was
replaced by a return -1 if the environment variable is missing
(resulting in "Warning: failed to set MAC address"? Btw: That's wrong?
It should be "Warning: failed to get MAC address from the environment"?)


Now, Eric's patch [1] (which needs an update of the commit message, 
sure, but was acked by the author of the original patch [2]) tries to 
re-introduce the original behavior:

+ eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr);

So, what I understand for i.MXxx, Zach and Eric are talking about:

If the environment variable is missing, the system can use the OCOTP
bits to set the MAC address. If the return -1 is removed by using Eric's
patch.

And for overo:

 From Philip's mail, on an overo based product that uses the SMSC911x
ethernet chip, if the environment variable is missing, the MAC address
is set via EEPROM connected to the SMSC911x chip.


I.e. on these systems, with Eric's patch, we get a correct MAC address,
even if the environment variable is missing. This sounds like a good 
option (?).

The question is then: Do we want a "Warning: failed to set MAC address"
message, even if the MAC is set correctly? But not from the environment
variable, but somehow read from the HW?

I know you will correct what I missed in this summary ;)

Best regards

Dirk

[1] http://lists.denx.de/pipermail/u-boot/2011-August/098686.html

[2] http://lists.denx.de/pipermail/u-boot/2011-August/098690.html





More information about the U-Boot mailing list