u16 ctrl, ct1000, adv; u16 ledctrl, ledover; 
u16 ctrl, ct1000, adv, pg, ledctrl, ledover; 
static void sky2_phy_init(struct sky2_hw *hw, unsigned port){	struct sky2_port *sky2 = netdev_priv(hw->dev[port]);	u16 ctrl, ct1000, adv;	u16 ledctrl, ledover;	pr_debug("phy reset autoneg=%s advertising=0x%x pause rx=%s tx=%s\n",		 sky2->autoneg == AUTONEG_ENABLE ? "enable" : "disable",		 sky2->advertising,		 sky2->rx_pause ? "on" : "off",		 sky2->tx_pause ? "on" : "off");	if (sky2->autoneg == AUTONEG_ENABLE &&	    hw->chip_id != CHIP_ID_YUKON_XL) {		u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL);		ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK |			  PHY_M_EC_MAC_S_MSK);		ectrl |= PHY_M_EC_MAC_S(MAC_TX_CLK_25_MHZ);		if (hw->chip_id == CHIP_ID_YUKON_EC)			ectrl |= PHY_M_EC_DSC_2(2) | PHY_M_EC_DOWN_S_ENA;		else			ectrl |= PHY_M_EC_M_DSC(2) | PHY_M_EC_S_DSC(3);		gm_phy_write(hw, port, PHY_MARV_EXT_CTRL, ectrl);	}	ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL);	if (hw->copper) {		if (hw->chip_id == CHIP_ID_YUKON_FE) {			/* enable automatic crossover */			ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO) >> 1;		} else {			/* disable energy detect */			ctrl &= ~PHY_M_PC_EN_DET_MSK;			/* enable automatic crossover */			ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO);			if (sky2->autoneg == AUTONEG_ENABLE &&			    hw->chip_id == CHIP_ID_YUKON_XL) {				ctrl &= ~PHY_M_PC_DSC_MSK;				ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA;			}		}		gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl);	} else {		/* workaround for deviation #4.88 (CRC errors) */		/* disable Automatic Crossover */		ctrl &= ~PHY_M_PC_MDIX_MSK;		gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl);		if (hw->chip_id == CHIP_ID_YUKON_XL) {			/* Fiber: select 1000BASE-X only mode MAC Specific Ctrl Reg. */			gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 2);			ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL);			ctrl &= ~PHY_M_MAC_MD_MSK;			ctrl |= PHY_M_MAC_MODE_SEL(PHY_M_MAC_MD_1000BX);			gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl);			/* select page 1 to access Fiber registers */			gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 1);		}		ctrl &= ~(PHY_M_PC_MDIX_MSK | PHY_M_MAC_MD_MSK);		ctrl |= PHY_M_MAC_MODE_SEL(PHY_M_MAC_MD_1000BX);	}	ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL);	if (sky2->autoneg == AUTONEG_DISABLE)		ctrl &= ~PHY_CT_ANE;	else		ctrl |= PHY_CT_ANE;	ctrl |= PHY_CT_RESET;	gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl);	ctrl = 0;	ct1000 = 0;	adv = PHY_AN_CSMA;	if (sky2->autoneg == AUTONEG_ENABLE) {		if (hw->copper) {			if (sky2->advertising & ADVERTISED_1000baseT_Full)				ct1000 |= PHY_M_1000C_AFD;			if (sky2->advertising & ADVERTISED_1000baseT_Half)				ct1000 |= PHY_M_1000C_AHD;			if (sky2->advertising & ADVERTISED_100baseT_Full)				adv |= PHY_M_AN_100_FD;			if (sky2->advertising & ADVERTISED_100baseT_Half)				adv |= PHY_M_AN_100_HD;			if (sky2->advertising & ADVERTISED_10baseT_Full)				adv |= PHY_M_AN_10_FD;			if (sky2->advertising & ADVERTISED_10baseT_Half)				adv |= PHY_M_AN_10_HD;		} else	/* special defines for FIBER (88E1011S only) */			adv |= PHY_M_AN_1000X_AHD | PHY_M_AN_1000X_AFD;		/* Set Flow-control capabilities */		if (sky2->tx_pause && sky2->rx_pause)			adv |= PHY_AN_PAUSE_CAP;		/* symmetric */		else if (sky2->rx_pause && !sky2->tx_pause)			adv |= PHY_AN_PAUSE_ASYM|PHY_AN_PAUSE_CAP;		else if (!sky2->rx_pause && sky2->tx_pause)			adv |= PHY_AN_PAUSE_ASYM;	/* local */		/* Restart Auto-negotiation */		ctrl |= PHY_CT_ANE | PHY_CT_RE_CFG;	} else {		/* forced speed/duplex settings */		ct1000 = PHY_M_1000C_MSE;		if (sky2->duplex == DUPLEX_FULL)			ctrl |= PHY_CT_DUP_MD;		switch (sky2->speed) {		case SPEED_1000:			ctrl |= PHY_CT_SP1000;			break;		case SPEED_100:			ctrl |= PHY_CT_SP100;			break;		}		ctrl |= PHY_CT_RESET;	}	if (hw->chip_id != CHIP_ID_YUKON_FE)		gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, ct1000);	gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv);	gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl);	/* Setup Phy LED's */	ledctrl = PHY_M_LED_PULS_DUR(PULS_170MS);	ledover = 0;	switch (hw->chip_id) {	case CHIP_ID_YUKON_FE:		/* on 88E3082 these bits are at 11..9 (shifted left) */		ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) << 1;		ctrl = gm_phy_read(hw, port, PHY_MARV_FE_LED_PAR);		/* delete ACT LED control bits */		ctrl &= ~PHY_M_FELP_LED1_MSK;		/* change ACT LED control to blink mode */		ctrl |= PHY_M_FELP_LED1_CTRL(LED_PAR_CTRL_ACT_BL);		gm_phy_write(hw, port, PHY_MARV_FE_LED_PAR, ctrl);		break;	case CHIP_ID_YUKON_XL:		ctrl = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);		/* select page 3 to access LED control register */		gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3);		/* set LED Function Control register */		gm_phy_write(hw, port, PHY_MARV_PHY_CTRL,			     (PHY_M_LEDC_LOS_CTRL(1) |		/* LINK/ACT */			      PHY_M_LEDC_INIT_CTRL(7) |		/* 10 Mbps */			      PHY_M_LEDC_STA1_CTRL(7) |		/* 100 Mbps */			      PHY_M_LEDC_STA0_CTRL(7)));		/* 1000 Mbps */		/* set Polarity Control register */		gm_phy_write(hw, port, PHY_MARV_PHY_STAT,			     (PHY_M_POLC_LS1_P_MIX(4) | PHY_M_POLC_IS0_P_MIX(4) |			      PHY_M_POLC_LOS_CTRL(2) | PHY_M_POLC_INIT_CTRL(2) |			      PHY_M_POLC_STA1_CTRL(2) | PHY_M_POLC_STA0_CTRL(2)));		/* restore page register */		gm_phy_write(hw, port, PHY_MARV_EXT_ADR, ctrl);		break;	default:		/* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */		ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) | PHY_M_LEDC_TX_CTRL;		/* turn off the Rx LED (LED_RX) */		ledover |= PHY_M_LED_MO_RX(MO_LED_OFF);	}	gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);	if (sky2->autoneg == AUTONEG_DISABLE || sky2->speed == SPEED_100) {		/* turn on 100 Mbps LED (LED_LINK100) */		ledover |= PHY_M_LED_MO_100(MO_LED_ON);	}	if (ledover)		gm_phy_write(hw, port, PHY_MARV_LED_OVER, ledover);	/* Enable phy interrupt on autonegotiation complete (or link up) */	if (sky2->autoneg == AUTONEG_ENABLE)		gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_COMPL);	else		gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/793b883ed12a6ae6e2901ddb5e038b77d6f0c0ac/sky2.c/buggy/drivers/net/sky2.c