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?