Hello,

I think there is an issue in if_at91.c for detecting if the Phy is idle.
The bit is set to one when idle not zero and so in at91_read_phy there was
an infinite loop.

The below patch fixes the error and the comments.

Index: packages/devs/eth/arm/at91/current/src/if_at91.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/arm/at91/current/src/if_at91.c,v
retrieving revision 1.3
diff -u -w -b -r1.3 if_at91.c
--- packages/devs/eth/arm/at91/current/src/if_at91.c    29 Jan 2009
17:47:59 -0000  1.3
+++ packages/devs/eth/arm/at91/current/src/if_at91.c    28 Jul 2010 21:40:09
-0000
@@ -224,7 +224,7 @@
 
    HAL_WRITE_UINT32(AT91_EMAC + AT91_EMAC_MAN, val);
 
-   /* Wait until IDLE bit in Network Status register is cleared */
+   /* Wait until IDLE bit in Network Status register is set */
    while (cnt < 1000000)
    {
       HAL_READ_UINT32((AT91_EMAC + AT91_EMAC_NSR), val);
@@ -252,11 +252,11 @@
 
 
    HAL_WRITE_UINT32(AT91_EMAC + AT91_EMAC_MAN, val);
-   /* Wait until IDLE bit in Network Status register is cleared */
+   /* Wait until IDLE bit in Network Status register is set */
    do
    {
       HAL_READ_UINT32((AT91_EMAC + AT91_EMAC_NSR), val);
-   }while(val & AT91_EMAC_NSR_IDLE);
+   }while(!(val & AT91_EMAC_NSR_IDLE));
    
    HAL_DELAY_US(50);
 



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply via email to