[U-Boot] [PATCH 17/30] lan91c96/smc91111/smc911x: get mac address from environment

Mike Frysinger vapier at gentoo.org
Wed Jun 10 02:30:48 CEST 2009


On Tuesday 09 June 2009 07:53:11 Wolfgang Denk wrote:
> Dear Mike,
>
> In message <1234847451-3210-18-git-send-email-vapier at gentoo.org> you wrote:
> > The environment is the canonical storage location of the mac address, so
> > we're killing off the global data location and moving everything to
> > querying the env directly.
> >
> > Also, do not bother checking the EEPROM if the env is setup.  This
> > simplifies the code greatly.
>
> ...
>
> This patch (see also commit 03f3d8d3b39c,
> http://git.denx.de/?p=u-boot.git;a=commit;h=03f3d8d3b39cf85c0ce7ca903b43670
>1e8aa610b) changed behaviour of some network drivers.
>
> As I just learned (sorry, I missed this in the initial review) it
> drops a warning printed by the old code, when there were valid MAC
> addresses stored both in the U-Boot environment ("ethaddr" variable)
>
> and in the controller's EEPROM:
> > -	if (env_present && rom_valid) { /* if both env and ROM are good */
> > -		if (memcmp (v_env_mac, v_rom_mac, 6) != 0) {
> > -			printf ("\nWarning: MAC addresses don't match:\n");
> > -			printf ("\tHW MAC address:  "
> > -				"%02X:%02X:%02X:%02X:%02X:%02X\n",
> > -				v_rom_mac[0], v_rom_mac[1],
> > -				v_rom_mac[2], v_rom_mac[3],
> > -				v_rom_mac[4], v_rom_mac[5] );
> > -			printf ("\t\"ethaddr\" value: "
> > -				"%02X:%02X:%02X:%02X:%02X:%02X\n",
> > -				v_env_mac[0], v_env_mac[1],
> > -				v_env_mac[2], v_env_mac[3],
> > -				v_env_mac[4], v_env_mac[5]) ;
> > -			debug ("### Set MAC addr from environment\n");
> > -		}
> > -	}
>
> This affects other drivers as well (cs8900 for example, in another
> patch).
>
> Can you please explain what your rationale was for removing this code?

i thought the u-boot design was to not touch hardware it shouldnt be.  if the 
canonical location for eth addr is the env, then what is in the attached 
eeproms is irrelevant as it wont be used if the env is available.  it's also 
not specific to either of these drivers, so if we did choose to make this 
behavior optional via some define, it would make more sense to do it in the 
common eth code rather than copying & pasting it everywhere.
-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/20090609/5bce5289/attachment.pgp 


More information about the U-Boot mailing list