[U-Boot] [PATCH 2/9] mvgbe: Support preserving the existing MAC address

Mike Frysinger
2011-04-30T04:17:47Z

On Tuesday, April 26, 2011 00:23:47 Michael Spang wrote:
> On Mon, Apr 25, 2011 at 7:37 AM, Tabi Timur-B04825 wrote:
> > On Sun, Apr 24, 2011 at 6:50 PM, Wolfgang Denk wrote:
> >> And please add documentation for the new CONFIG_PRESERVE_LOCAL_MAC to
> >> the README.
> >
> > We have something similar already on Freescale parts, but it does
> > sometimes cause problems. If the environment ethaddr is already set,
> > it is left alone. Otherwise, the MAC address is read from EEPROM.
> >
> > So we could use CONFIG_PRESERVE_LOCAL_MAC to alter this behavior (i.e.
> > always use the EEPROM). However, the current default is already
> > CONFIG_PRESERVE_LOCAL_MAC, so can we change this to something like
> > CONFIG_OVERRIDE_LOCAL_MAC?
>
> I don't think the option you want is the same. If there's a MAC in the
> environment, I want to use it. Otherwise, I want U-Boot to leave the
> MAC alone because the manufacturer assigned MAC was written to the
> interface's registers before U-Boot started.

so implement this in your board file in misc_init_r or board_eth_init. have
the code do something like:
uchar enetaddr[6];
if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
/* ... read current MAC out of the driver's registers ... */
eth_setenv_enetaddr("ethaddr", enetaddr);
}

then you dont need ugly config hacks in random drivers
-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/20110430/d0fbe5fa/attachment.pgp