kernels/linux-2.4.0/drivers/net/tlan.c
/*********************************************************************
	 *	TLan_PhyDetect
	 *
	 *	Returns:
	 *		Nothing
	 *	Parms:
	 *		dev	A pointer to the device structure of the adapter
	 *			for which the PHY needs determined.
	 *
	 *	So far I've found that adapters which have external PHYs
	 *	may also use the internal PHY for part of the functionality.
	 *	(eg, AUI/Thinnet).  This function finds out if this TLAN
	 *	chip has an internal PHY, and then finds the first external
	 *	PHY (starting from address 0) if it exists).
	 *
	 ********************************************************************/
TLan_PhyDetect
Returns:
Nothing
Parms:
dev     A pointer to the device structure of the adapter
for which the PHY needs determined.

So far I've found that adapters which have external PHYs
may also use the internal PHY for part of the functionality.
.  This function finds out if this TLAN
chip has an internal PHY, and then finds the first external
PHY (starting from address 0) if it exists).
TLan_PhyDetect Returns : Nothing Parms : dev A pointer to the device structure of the adapter for which the PHY needs determined . So far I ' ve found that adapters which have external PHYs may also use the internal PHY for part of the functionality . . This function finds out if this TLAN chip has an internal PHY and then finds the first external PHY ( starting from address 0 ) if it exists ) .
void TLan_PhyDetect( struct net_device *dev )
{
	TLanPrivateInfo *priv = (TLanPrivateInfo *) dev->priv;
	u16		control;
	u16		hi;
	u16		lo;
	u32		phy;
	if ( priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY ) {
		priv->phyNum = 0xFFFF;
		return;
	}
	TLan_MiiReadReg( dev, TLAN_PHY_MAX_ADDR, MII_GEN_ID_HI, &hi );
	if ( hi != 0xFFFF ) {
		priv->phy[0] = TLAN_PHY_MAX_ADDR;
	} else {
		priv->phy[0] = TLAN_PHY_NONE;
	}
	priv->phy[1] = TLAN_PHY_NONE;
	for ( phy = 0; phy <= TLAN_PHY_MAX_ADDR; phy++ ) {
		TLan_MiiReadReg( dev, phy, MII_GEN_CTL, &control );
		TLan_MiiReadReg( dev, phy, MII_GEN_ID_HI, &hi );
		TLan_MiiReadReg( dev, phy, MII_GEN_ID_LO, &lo );
		if ( ( control != 0xFFFF ) || ( hi != 0xFFFF ) || ( lo != 0xFFFF ) ) {
			TLAN_DBG( TLAN_DEBUG_GNRL, "PHY found at %02x %04x %04x %04x\n", phy, control, hi, lo );
			if ( ( priv->phy[1] == TLAN_PHY_NONE ) && ( phy != TLAN_PHY_MAX_ADDR ) ) {
				priv->phy[1] = phy;
			}
		}
	}
	if ( priv->phy[1] != TLAN_PHY_NONE ) {
		priv->phyNum = 1;
	} else if ( priv->phy[0] != TLAN_PHY_NONE ) {
		priv->phyNum = 0;
	} else {
		printk( "TLAN:  Cannot initialize device, no PHY was found!\n" );
	}
}
void TLan_PhyDetect ( struct net_device * dev ) { TLanPrivateInfo * priv = ( TLanPrivateInfo * ) dev -> priv ; u16 control ; u16 hi ; u16 lo ; u32 phy ; if ( priv -> adapter -> flags & TLAN_ADAPTER_UNMANAGED_PHY ) { priv -> phyNum = 0xFFFF ; return ; } TLan_MiiReadReg ( dev , TLAN_PHY_MAX_ADDR , MII_GEN_ID_HI , & hi ) ; if ( hi != 0xFFFF ) { priv -> phy [ 0 ] = TLAN_PHY_MAX_ADDR ; } else { priv -> phy [ 0 ] = TLAN_PHY_NONE ; } priv -> phy [ 1 ] = TLAN_PHY_NONE ; for ( phy = 0 ; phy <= TLAN_PHY_MAX_ADDR ; phy ++ ) { TLan_MiiReadReg ( dev , phy , MII_GEN_CTL , & control ) ; TLan_MiiReadReg ( dev , phy , MII_GEN_ID_HI , & hi ) ; TLan_MiiReadReg ( dev , phy , MII_GEN_ID_LO , & lo ) ; if ( ( control != 0xFFFF ) || ( hi != 0xFFFF ) || ( lo != 0xFFFF ) ) { TLAN_DBG ( TLAN_DEBUG_GNRL , " \n " , phy , control , hi , lo ) ; if ( ( priv -> phy [ 1 ] == TLAN_PHY_NONE ) && ( phy != TLAN_PHY_MAX_ADDR ) ) { priv -> phy [ 1 ] = phy ; } } } if ( priv -> phy [ 1 ] != TLAN_PHY_NONE ) { priv -> phyNum = 1 ; } else if ( priv -> phy [ 0 ] != TLAN_PHY_NONE ) { priv -> phyNum = 0 ; } else { printk ( " \n " ) ; } }
TLan_PhyDetect
      Returns:
              Nothing
      Parms:
              dev     A pointer to the device structure of the adapter
                      for which the PHY needs determined.
TLan_PhyDetect Returns : Nothing Parms : dev A pointer to the device structure of the adapter for which the PHY needs determined .