From 7cd8443aede537e3869450426839e8b3be87c3e5 Mon Sep 17 00:00:00 2001 From: RichardBarry Date: Sat, 7 Feb 2009 17:48:12 +0000 Subject: [PATCH] Add hardware bug workaround for auto-negotiate errata. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@691 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../RTOSDemo/webserver/FEC.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Demo/ColdFire_MCF52233_Eclipse/RTOSDemo/webserver/FEC.c b/Demo/ColdFire_MCF52233_Eclipse/RTOSDemo/webserver/FEC.c index 98d082daf..ac6ff6498 100644 --- a/Demo/ColdFire_MCF52233_Eclipse/RTOSDemo/webserver/FEC.c +++ b/Demo/ColdFire_MCF52233_Eclipse/RTOSDemo/webserver/FEC.c @@ -81,8 +81,8 @@ static unsigned portBASE_TYPE uxNextRxBuffer = 0, uxIndexToBufferOwner = 0; /*-----------------------------------------------------------*/ -/* - * Enable all the required interrupts in the FEC and in the interrupt controller. +/* + * Enable all the required interrupts in the FEC and in the interrupt controller. */ static void prvEnableFECInterrupts( void ); @@ -95,7 +95,7 @@ static void prvResetFEC( portBASE_TYPE xCalledFromISR ); /* * FUNCTION ADAPTED FROM FREESCALE SUPPLIED SOURCE - * + * * Write a value to a PHY's MII register. * * Parameters: @@ -370,6 +370,7 @@ void vFECInit( void ) { unsigned portSHORT usData; struct uip_eth_addr xAddr; +unsigned portBASE_TYPE ux; /* The MAC address is set at the foot of FreeRTOSConfig.h. */ const unsigned portCHAR ucMACAddress[6] = @@ -451,6 +452,18 @@ const unsigned portCHAR ucMACAddress[6] = /* Wait for auto negotiate to complete. */ do { + ux++; + if( ux > 10 ) + { + /* Hardware bug workaround! Force 100Mbps half duplex. */ + while( !fec_mii_read( configPHY_ADDRESS, 0, &usData ) ){}; + usData &= ~0x2000; /* 10Mbps */ + usData &= ~0x0100; /* Half Duplex */ + usData &= ~0x1000; /* Manual Mode */ + while( !fec_mii_write( configPHY_ADDRESS, 0, usData ) ){}; + while( !fec_mii_write( configPHY_ADDRESS, 0, (usData|0x0200) )){}; /* Force re-negotiate */ + break; + } vTaskDelay( fecLINK_DELAY ); fec_mii_read( configPHY_ADDRESS, PHY_BMSR, &usData ); -- 2.39.5