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

  • From: Eric BENARD / Free <ebenard@xxxxxxx>
  • To: linux-cirrus@xxxxxxxxxxxxx
  • Date: Mon, 11 Jul 2005 14:08:24 +0200

Michael Burian wrote:
> When doing
> 
> ifconfig eth0 up  # simplest case that reproduces the error
> 
> and no cable is connected the whole system hangs until a cable get's
> connected again.
> 
> Here's a code snippet[1] of the function I suspect to cause this.
> The whole driver is part of the patch at [2].
> 
> 
> 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 ;-)

Eric


Other related posts: