]> git.sur5r.net Git - freertos/commitdiff
Add hardware bug workaround for auto-negotiate errata.
authorRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 7 Feb 2009 17:48:12 +0000 (17:48 +0000)
committerRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 7 Feb 2009 17:48:12 +0000 (17:48 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@691 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/ColdFire_MCF52233_Eclipse/RTOSDemo/webserver/FEC.c

index 98d082daf03e7b20a1a226ee659c962f66d3dde2..ac6ff6498c36a744cf7d417ee0abdf4302d3600a 100644 (file)
@@ -81,8 +81,8 @@ static unsigned portBASE_TYPE uxNextRxBuffer = 0, uxIndexToBufferOwner = 0;
 \r
 /*-----------------------------------------------------------*/\r
 \r
-/* \r
- * Enable all the required interrupts in the FEC and in the interrupt controller. \r
+/*\r
+ * Enable all the required interrupts in the FEC and in the interrupt controller.\r
  */\r
 static void prvEnableFECInterrupts( void );\r
 \r
@@ -95,7 +95,7 @@ static void prvResetFEC( portBASE_TYPE xCalledFromISR );
 \r
 /*\r
  * FUNCTION ADAPTED FROM FREESCALE SUPPLIED SOURCE\r
- * \r
+ *\r
  * Write a value to a PHY's MII register.\r
  *\r
  * Parameters:\r
@@ -370,6 +370,7 @@ void vFECInit( void )
 {\r
 unsigned portSHORT usData;\r
 struct uip_eth_addr xAddr;\r
+unsigned portBASE_TYPE ux;\r
 \r
 /* The MAC address is set at the foot of FreeRTOSConfig.h. */\r
 const unsigned portCHAR ucMACAddress[6] =\r
@@ -451,6 +452,18 @@ const unsigned portCHAR ucMACAddress[6] =
                /* Wait for auto negotiate to complete. */\r
                do\r
                {\r
+                       ux++;\r
+                       if( ux > 10 )\r
+                       {\r
+                               /* Hardware bug workaround!  Force 100Mbps half duplex. */\r
+                               while( !fec_mii_read( configPHY_ADDRESS, 0, &usData ) ){};\r
+                               usData &= ~0x2000;                                                      /* 10Mbps */\r
+                               usData &= ~0x0100;                                                      /* Half Duplex */\r
+                               usData &= ~0x1000;                                                      /* Manual Mode */\r
+                               while( !fec_mii_write( configPHY_ADDRESS, 0, usData ) ){};\r
+                               while( !fec_mii_write( configPHY_ADDRESS, 0, (usData|0x0200) )){}; /* Force re-negotiate */\r
+                               break;\r
+                       }\r
                        vTaskDelay( fecLINK_DELAY );\r
                        fec_mii_read( configPHY_ADDRESS, PHY_BMSR, &usData );\r
 \r