[PATCH 1/3] fec: restart autoneg at open instead of init

Eric Bénard eric at eukrea.com
Fri Sep 7 03:51:13 EDT 2012


Hi Sascha,

Le Fri, 7 Sep 2012 09:47:34 +0200,
Sascha Hauer <s.hauer at pengutronix.de> a écrit :

> On Fri, Sep 07, 2012 at 09:30:00AM +0200, Eric Bénard wrote:
> > Hi Sascha,
> > 
> > Le Fri, 7 Sep 2012 08:57:03 +0200,
> > Sascha Hauer <s.hauer at pengutronix.de> a écrit :
> > 
> > > Hi Eric,
> > > 
> > > On Thu, Sep 06, 2012 at 09:39:29PM +0200, Eric Bénard wrote:
> > > > this saves some time during boot when ethernet is not needed in barebox
> > > 
> > > Is this really significant on your hardware? I made a measurement here
> > > and the miidev_restart_aneg() takes 130us on an i.MX27 board.
> > > 
> > > The original intention of doing it at init time was that autonegotation
> > > is already completed when we actually use the network. And this time
> > > really is significant:
> > > 
> > > without the patch:
> > > 
> > > barebox at Phytec phyCORE-i.MX27:/ time ping 192.168.23.4
> > > warning: No MAC address set. Using random address 62:FE:FE:0B:09:A8
> > > phy0: Link is up - 100/Full
> > > host 192.168.23.4 is alive
> > > time: 10ms
> > > 
> > > with the patch:
> > > 
> > > barebox at Phytec phyCORE-i.MX27:/ time ping 192.168.23.4
> > > warning: No MAC address set. Using random address A6:1B:AB:80:FA:E7
> > > phy0: Link is up - 100/Full
> > > host 192.168.23.4 is alive
> > > time: 2040ms
> > > 
> > that strange. I don't see why miidev_restart_aneg() would take less
> > time at boot than at open.
> 
> Well, it does not really take longer. The difference is that if you are
> sitting before your board it usually takes a few seconds to interrupt
> autoboot, think what you want to do, and finally enter some network
> command. In the meantime autonegotiation will be complete. If we start
> autonegotiation at open time, we will always have to wait for the full
> autonegotiation time after starting the first network command.
> 
I didn't check but on my board, the problem may be similar to the 1G
wrong detection : if miidev_restart_aneg is trying to acess the phy
when the MII link is not yet initialized, then it would wait 1s for
the reset to timeout in miidev_restart_aneg which would explain why I
save 1s with this patch.

Eric



More information about the barebox mailing list