[U-Boot] [PATCH] ne2000: take MAC address from config if available

Wolfgang Denk wd at denx.de
Sun Dec 14 12:12:24 CET 2008


Dear Daniel Mack,

In message <20081203010154.GE2012 at buzzloop.caiaq.de> you wrote:
> This adds CONFIG_NE2000_NOPROM. If set, the ethernet MAC address is taken
> from the environment variable 'ethaddr' and the NIC is configured
> accordingly. Needed for boards that don't have an EEPROM to store this
> setting permanently.
> 
> Signed-off-by: Daniel Mack <daniel at caiaq.de>
> 
> ---
>  ne2000_base.c |   38 ++++++++++++++++++++++++++++----------
>   1 file changed, 28 insertions(+), 10 deletions(-)

Why do we need a special CONFIG_ option? is it not possible to detect
(by software) that there is no EEPROM available, and auto-adjust?

Note that there is existing policy how to handle the  situation  that
we have both a MAC address stored in some other storeage (like EEPROM
on  the  NIC)  and  in  the  "ethaddr"  environment variable (see for
example drivers/net/cs8900.c). In the end, the code shall always only
rely on the U-Boot environment settings.

The system will test if MAC addresses are set in EEPROM and in the
envrionment; then it should behave as follows:

* If there is no MAC address in the EEPROM, then do nothing, i. e.
  rely on any previously existing envrionment settings.

* If there is a MAC address in the EEPROM, and ther eis no
  corresponding "ethaddr" environment variable defined, then
  initialize (setenv()) this variable with the value read from the
  EEPROM.

* If there is a MAC address in the EEPROM, and there is a value in
  the "ethaddr" environment variable, and both are identical, we use
  that value and everything is fine.

* If there is a MAC address in the EEPROM, and there is a value in
  the "ethaddr" environment variable, and both are different, we
  issue a warning "Warning: MAC addresses don't match: ... HW MAC
  address: ... "ethaddr" value: ..." and then use the value from the
  ENVIRONMENT.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There was no difference between  the  behavior  of  a  god  and  the
operations of pure chance..."   - Thomas Pynchon, _Gravity's Rainbow_


More information about the U-Boot mailing list