FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_phy_advertise - set the PHY advertisement registers for autoneg
 *	@phy: the PHY to operate on
 *	@advert: bitmap of capabilities the PHY should advertise
 *
 *	Sets a 10/100/1000 PHY's advertisement registers to advertise the
 *	requested capabilities.
 */
set the PHY advertisement registers for autoneg
@phy: the PHY to operate on
@advert: bitmap of capabilities the PHY should advertise

Sets a 10/100/1000 PHY's advertisement registers to advertise the
requested capabilities.
set the PHY advertisement registers for autoneg @phy : the PHY to operate on @advert : bitmap of capabilities the PHY should advertise Sets a 10 / 100 / 1000 PHY ' s advertisement registers to advertise the requested capabilities .
int t3_phy_advertise(struct cphy *phy, unsigned int advert)
{
	int err;
	unsigned int val = 0;
	err = mdio_read(phy, 0, MII_CTRL1000, &val);
	if (err)
		return err;
	val &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL);
	if (advert & ADVERTISED_1000baseT_Half)
		val |= ADVERTISE_1000HALF;
	if (advert & ADVERTISED_1000baseT_Full)
		val |= ADVERTISE_1000FULL;
	err = mdio_write(phy, 0, MII_CTRL1000, val);
	if (err)
		return err;
	val = 1;
	if (advert & ADVERTISED_10baseT_Half)
		val |= ADVERTISE_10HALF;
	if (advert & ADVERTISED_10baseT_Full)
		val |= ADVERTISE_10FULL;
	if (advert & ADVERTISED_100baseT_Half)
		val |= ADVERTISE_100HALF;
	if (advert & ADVERTISED_100baseT_Full)
		val |= ADVERTISE_100FULL;
	if (advert & ADVERTISED_Pause)
		val |= ADVERTISE_PAUSE_CAP;
	if (advert & ADVERTISED_Asym_Pause)
		val |= ADVERTISE_PAUSE_ASYM;
	return mdio_write(phy, 0, MII_ADVERTISE, val);
}
int t3_phy_advertise ( struct cphy * phy , unsigned int advert ) { int err ; unsigned int val = 0 ; err = mdio_read ( phy , 0 , MII_CTRL1000 , & val ) ; if ( err ) return err ; val &= ~ ( ADVERTISE_1000HALF | ADVERTISE_1000FULL ) ; if ( advert & ADVERTISED_1000baseT_Half ) val |= ADVERTISE_1000HALF ; if ( advert & ADVERTISED_1000baseT_Full ) val |= ADVERTISE_1000FULL ; err = mdio_write ( phy , 0 , MII_CTRL1000 , val ) ; if ( err ) return err ; val = 1 ; if ( advert & ADVERTISED_10baseT_Half ) val |= ADVERTISE_10HALF ; if ( advert & ADVERTISED_10baseT_Full ) val |= ADVERTISE_10FULL ; if ( advert & ADVERTISED_100baseT_Half ) val |= ADVERTISE_100HALF ; if ( advert & ADVERTISED_100baseT_Full ) val |= ADVERTISE_100FULL ; if ( advert & ADVERTISED_Pause ) val |= ADVERTISE_PAUSE_CAP ; if ( advert & ADVERTISED_Asym_Pause ) val |= ADVERTISE_PAUSE_ASYM ; return mdio_write ( phy , 0 , MII_ADVERTISE , val ) ; }
t3_phy_advertise - set the PHY advertisement registers for autoneg
      @phy: the PHY to operate on
      @advert: bitmap of capabilities the PHY should advertise
t3_phy_advertise - set the PHY advertisement registers for autoneg @phy : the PHY to operate on @advert : bitmap of capabilities the PHY should advertise