[U-Boot] Defer net initialization

Alexander Stein
2010-06-01T10:14:46Z

Dear Wolgfang,

Am Dienstag, 1. Juni 2010 10:48:25 schrieben Sie:
> > I think this thread focus on another problem: setting the MAC address. I
> > have a MAC in the ethaddr environment variable which gets used properly.
>
> You are wrong. The thread is exactly discussing the issue you are
> suffering from. The whole discussion is basicly around the decision
> which parts of the hardware (especially the Ethernet hardware) should
> be initialized where and when.
>
> > I traced the call graph a bit down. So on every startup eth_initialize is
> > called from start_armboot which then calls board_eth_init which calls
> > macb_eth_initialize (in my board source). And macb_eth_initialize takes
> > very long if no cable is plugged.
>
> Please read the docs referred to in the thread mentioned above
> (especially doc/README.drivers.eth, but there are some pretty
> explanative comments in the thread, which is why I point you at it) to
> understand why the implementationon your board is not in line with the
> intended design.
>
> eth_initialize should NOT wait for a link state.
>
> > How could I avoid calling eth_initialize during startup but before using
> > the first net related command?
>
> You ask the wrong question. Ity is perfectly OK to call
> eth_initialize() which is supposed to register the available network
> drivers, but this should NOT include to actually initialize the
> hardware. So it's the lower layers that are wrong in your port.

This macb driver is fine so far. eth_initialize doesn't startup the hardware
e.g. checking for link etc.
The problem was a defined CONFIG_RESET_PHY_R. Inside reset_phy
> eth_init(gd->bd);
is called which actually starts the hardwre resulting in timeouts as
described. According to the comment above this line (seems to be copied to
every at91 board implementation) this is only needed if linux has a NFS root
which needs a preinitialized ethernet device.
But as we have a jffs2 rootfs this could be ignored.

Thanks for your hints and help.

Best regards
Alexander