[U-Boot] net, kirkwood_egiga: init mac address before using network commands

Wolfgang Denk
2010-03-30T08:01:33Z

Dear Heiko Schocher,

In message <4BB18E5F.6060705@denx.de> you wrote:
> initialize mac address with the value from "ethaddr", before
> doing some network commands. This is not in line with u-boot
> design principle "not to initalize not used devices", and
> maybe should go away, if there is a solution for passing
> the mac address to arm linux kernels.
>
> Tested on the suen3 board.
>
> Signed-off-by: Heiko Schocher <hs@denx.de>
> ---
> posting this patch as a result of this discussion:
>
> http://lists.denx.de/pipermail/u-boot/2010-March/069025.html

Hm... it seems I misunderstood you there :-(

You wrote (here:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/76173/focus=76338):

| > know about these, of course). So if kirkwood_egiga is clean (in this
| > respect), there is no need to change it.
|
| It ends in the same problem, as the fec_mxc.c driver has ...

At this point I thought that you were referring to the problem that
the fec_mxc.c would under certain conditions ignore the "ethaddr"
environment setting.

> }
>
> - while (!eth_getenv_enetaddr(s, dev->enetaddr)) {
> + if (!eth_getenv_enetaddr(s, dev->enetaddr)) {

I think this change is actually not related to the other modifi-
cations in this patch. Axctually, it is not even needed. OK, you can
call it paranoid and a waste of time to re-check the setting of the
environment variable after running setenv(), but then it's not a real
bug either. In any case it is unrelated and should not be mixed into
this commit.

> dev->enetaddr[0] = 0x02;
> dev->enetaddr[1] = 0x50;
> @@ -688,6 +688,7 @@ int kirkwood_egiga_initialize(bd_t * bis)
> dev->enetaddr[5] = get_random_hex();
> eth_setenv_enetaddr(s, dev->enetaddr);
> }
> + port_uc_addr_set(dkwgbe->regs, dev->enetaddr);

This is another issue - this is not a bug fix.

I will leave it up to others (especially Ben) to comment on this part.

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
Sometimes a man will tell his bartender things he'll never tell his doctor.
-- Dr. Phillip Boyce, "The Menagerie" ("The Cage"),
stardate unknown.