FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_set_phy_speed_duplex - force PHY speed and duplex
 *	@phy: the PHY to operate on
 *	@speed: requested PHY speed
 *	@duplex: requested PHY duplex
 *
 *	Force a 10/100/1000 PHY's speed and duplex.  This also disables
 *	auto-negotiation except for GigE, where auto-negotiation is mandatory.
 */
force PHY speed and duplex
@phy: the PHY to operate on
@speed: requested PHY speed
@duplex: requested PHY duplex

Force a 10/100/1000 PHY's speed and duplex.  This also disables
auto-negotiation except for GigE, where auto-negotiation is mandatory.
force PHY speed and duplex @phy : the PHY to operate on @speed : requested PHY speed @duplex : requested PHY duplex Force a 10 / 100 / 1000 PHY ' s speed and duplex . This also disables auto - negotiation except for GigE where auto - negotiation is mandatory .
int t3_set_phy_speed_duplex(struct cphy *phy, int speed, int duplex)
{
	int err;
	unsigned int ctl;
	err = mdio_read(phy, 0, MII_BMCR, &ctl);
	if (err)
		return err;
	if (speed >= 0) {
		ctl &= ~(BMCR_SPEED100 | BMCR_SPEED1000 | BMCR_ANENABLE);
		if (speed == SPEED_100)
			ctl |= BMCR_SPEED100;
		else if (speed == SPEED_1000)
			ctl |= BMCR_SPEED1000;
	}
	if (duplex >= 0) {
		ctl &= ~(BMCR_FULLDPLX | BMCR_ANENABLE);
		if (duplex == DUPLEX_FULL)
			ctl |= BMCR_FULLDPLX;
	}
	if (ctl & BMCR_SPEED1000)  
		ctl |= BMCR_ANENABLE;
	return mdio_write(phy, 0, MII_BMCR, ctl);
}
int t3_set_phy_speed_duplex ( struct cphy * phy , int speed , int duplex ) { int err ; unsigned int ctl ; err = mdio_read ( phy , 0 , MII_BMCR , & ctl ) ; if ( err ) return err ; if ( speed >= 0 ) { ctl &= ~ ( BMCR_SPEED100 | BMCR_SPEED1000 | BMCR_ANENABLE ) ; if ( speed == SPEED_100 ) ctl |= BMCR_SPEED100 ; else if ( speed == SPEED_1000 ) ctl |= BMCR_SPEED1000 ; } if ( duplex >= 0 ) { ctl &= ~ ( BMCR_FULLDPLX | BMCR_ANENABLE ) ; if ( duplex == DUPLEX_FULL ) ctl |= BMCR_FULLDPLX ; } if ( ctl & BMCR_SPEED1000 ) ctl |= BMCR_ANENABLE ; return mdio_write ( phy , 0 , MII_BMCR , ctl ) ; }
t3_set_phy_speed_duplex - force PHY speed and duplex
      @phy: the PHY to operate on
      @speed: requested PHY speed
      @duplex: requested PHY duplex
t3_set_phy_speed_duplex - force PHY speed and duplex @phy : the PHY to operate on @speed : requested PHY speed @duplex : requested PHY duplex
/* auto-negotiation required for GigE */