/* Restarts PHY auto-negotiation and wait until it's over.  */
void PHY_auto_negotiate(void)
/* Restarts PHY auto-negotiation and wait until it's over.  */
void PHY_auto_negotiate(void)
{
	uint16_t reg;
	reg = MDIO_read( PHYREG_MIIMCR );
	MDIO_write( PHYREG_MIIMCR,
		(uint16_t)( MIIMCR_ENABLE_AUTONEGOTIATION |
		MIIMCR_RESTART_AUTONEGOTIATION |
		reg) );
	for( ;; ) {
		reg = MDIO_read( PHYREG_MIIMSR );
		if( (reg & MIIMSR_ANC) != 0 ) {
			break;
		} else {
			vTaskDelay( 200 );
		}
	}
}