release/src/linux/linux/drivers/net/tlan.c
/***************************************************************
	 *	TLan_MiiSendData
	 *
	 *	Returns:
	 *		Nothing
	 *	Parms:
	 *		base_port	The base IO port of the adapter	in
	 *				question.
	 *		dev		The address of the PHY to be queried.
	 *		data		The value to be placed on the MII bus.
	 *		num_bits	The number of bits in data that are to
	 *				be placed on the MII bus.
	 *
	 *	This function sends on sequence of bits on the MII
	 *	configuration bus.
	 *
	 **************************************************************/
TLan_MiiSendData
Returns:
Nothing
Parms:
base_port       The base IO port of the adapter in
question.
dev             The address of the PHY to be queried.
data            The value to be placed on the MII bus.
num_bits        The number of bits in data that are to
be placed on the MII bus.

This function sends on sequence of bits on the MII
configuration bus.
TLan_MiiSendData Returns : Nothing Parms : base_port The base IO port of the adapter in question . dev The address of the PHY to be queried . data The value to be placed on the MII bus . num_bits The number of bits in data that are to be placed on the MII bus . This function sends on sequence of bits on the MII configuration bus .
void TLan_MiiSendData( u16 base_port, u32 data, unsigned num_bits )
{
	u16 sio;
	u32 i;
	if ( num_bits == 0 )
		return;
	outw( TLAN_NET_SIO, base_port + TLAN_DIO_ADR );
	sio = base_port + TLAN_DIO_DATA + TLAN_NET_SIO;
	TLan_SetBit( TLAN_NET_SIO_MTXEN, sio );
	for ( i = ( 0x1 << ( num_bits - 1 ) ); i; i >>= 1 ) {
		TLan_ClearBit( TLAN_NET_SIO_MCLK, sio );
		(void) TLan_GetBit( TLAN_NET_SIO_MCLK, sio );
		if ( data & i )
			TLan_SetBit( TLAN_NET_SIO_MDATA, sio );
		else
			TLan_ClearBit( TLAN_NET_SIO_MDATA, sio );
		TLan_SetBit( TLAN_NET_SIO_MCLK, sio );
		(void) TLan_GetBit( TLAN_NET_SIO_MCLK, sio );
	}
}
void TLan_MiiSendData ( u16 base_port , u32 data , unsigned num_bits ) { u16 sio ; u32 i ; if ( num_bits == 0 ) return ; outw ( TLAN_NET_SIO , base_port + TLAN_DIO_ADR ) ; sio = base_port + TLAN_DIO_DATA + TLAN_NET_SIO ; TLan_SetBit ( TLAN_NET_SIO_MTXEN , sio ) ; for ( i = ( 0x1 << ( num_bits - 1 ) ) ; i ; i >>= 1 ) { TLan_ClearBit ( TLAN_NET_SIO_MCLK , sio ) ; ( void ) TLan_GetBit ( TLAN_NET_SIO_MCLK , sio ) ; if ( data & i ) TLan_SetBit ( TLAN_NET_SIO_MDATA , sio ) ; else TLan_ClearBit ( TLAN_NET_SIO_MDATA , sio ) ; TLan_SetBit ( TLAN_NET_SIO_MCLK , sio ) ; ( void ) TLan_GetBit ( TLAN_NET_SIO_MCLK , sio ) ; } }
TLan_MiiSendData
      Returns:
              Nothing
      Parms:
              base_port       The base IO port of the adapter in
                              question.
TLan_MiiSendData Returns : Nothing Parms : base_port The base IO port of the adapter in question .