(mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) && (nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) /* enable/disable MDI/MDI-X auto-switching */ mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, nic->mii.force_media ? 0 : NCONFIG_AUTO_SWITCH); 
(mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000))) { /* enable/disable MDI/MDI-X auto-switching. MDI/MDI-X auto-switching is disabled for 82551ER/QM chips */ if((nic->mac == mac_82551_E) || (nic->mac == mac_82551_F) || (nic->mac == mac_82551_10) || (nic->mii.force_media) || !(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled)) mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, 0); else mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, NCONFIG_AUTO_SWITCH); } 
static int e100_phy_init(struct nic *nic){	struct net_device *netdev = nic->netdev;	u32 addr;	u16 bmcr, stat, id_lo, id_hi, cong;	/* Discover phy addr by searching addrs in order {1,0,2,..., 31} */	for(addr = 0; addr < 32; addr++) {		nic->mii.phy_id = (addr == 0) ? 1 : (addr == 1) ? 0 : addr;		bmcr = mdio_read(netdev, nic->mii.phy_id, MII_BMCR);		stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR);		stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR);		if(!((bmcr == 0xFFFF) || ((stat == 0) && (bmcr == 0))))			break;	}	DPRINTK(HW, DEBUG, "phy_addr = %d\n", nic->mii.phy_id);	if(addr == 32)		return -EAGAIN;	/* Selected the phy and isolate the rest */	for(addr = 0; addr < 32; addr++) {		if(addr != nic->mii.phy_id) {			mdio_write(netdev, addr, MII_BMCR, BMCR_ISOLATE);		} else {			bmcr = mdio_read(netdev, addr, MII_BMCR);			mdio_write(netdev, addr, MII_BMCR,				bmcr & ~BMCR_ISOLATE);		}	}	/* Get phy ID */	id_lo = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID1);	id_hi = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID2);	nic->phy = (u32)id_hi << 16 | (u32)id_lo;	DPRINTK(HW, DEBUG, "phy ID = 0x%08X\n", nic->phy);	/* Handle National tx phys */#define NCS_PHY_MODEL_MASK	0xFFF0FFFF	if((nic->phy & NCS_PHY_MODEL_MASK) == phy_nsc_tx) {		/* Disable congestion control */		cong = mdio_read(netdev, nic->mii.phy_id, MII_NSC_CONG);		cong |= NSC_CONG_TXREADY;		cong &= ~NSC_CONG_ENABLE;		mdio_write(netdev, nic->mii.phy_id, MII_NSC_CONG, cong);	}	if((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && 		(mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) && 		(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled)))		/* enable/disable MDI/MDI-X auto-switching */		mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG,			nic->mii.force_media ? 0 : NCONFIG_AUTO_SWITCH);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/648951451e6d2d532d4ace2f8e9c5cdf1d563e83/e100.c/clean/drivers/net/e100.c