[linux-cirrus] Re: EP93XX Ethernet autonegotiation hangs till link is up

  • From: Jean-Philippe Francois <jp.francois@xxxxxxxxxx>
  • To: linux-cirrus@xxxxxxxxxxxxx
  • Date: Mon, 11 Jul 2005 15:20:02 +0200

On Mon, 2005-07-11 at 14:47, Michael Burian wrote:
> Eric BENARD / Free wrote:
> >>Any ideas what should be done instead of while(1)?
> >>
> > 
> > hi,
> > 
> > I met the same problem and added a timeout like this :
> > 
> > 
> >    U8 timeout;
> > 
> >    phy_wr(4, 0x01e1);  /*Set 802.3, 100M/10M Full/Half ability*/
> >    phy_wr(0,(1<<12)|(1<<9)); /* enable auto negotiation*/
> > 
> >    mdelay(100);
> > 
> >    while (1) {
> >      val = phy_rd(1); /* read BM status Reg*/
> >      if ( val&0x0020) /* if Auto_Neg_complete?*/
> >      {
> >        break;
> >      }
> >      if (25 == timeout++)
> >        break;
> >    }
> > 
> > 
> > this is maybe not the best solution but that works fine and prevent the
> > system to hang ;-)
> 
> Random thoughts:
> 
> I'm not sure if this is the right way
> 
> If the above code works we might be able to completely remove the
> while(1) and "if(25" loop.
> 
> I doubt that something that fails after mdelay(100) will work after
> (mdelay(100) + time_needed_to_execute_phy_rd_25_times), as
> time_needed_to_execute_phy_rd_25_times should be next to zero, right?
> 
Cirrus solution also adds a flag gPhyAutoNegoDone, so that if you hit
the return -1 code path, you still get a chance for auonegotiation when
first packet is transmitted (hard_start_xmit), and then another each
time there is a tx_timeout.

We can :
-keep the actual code and come back to it after mainline submission.
-take Cirrus fix.
-use a workqueue that do link monitoring at regular interval.

JP FranÃois



Other related posts: