FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_link_start - apply link configuration to MAC/PHY
 *	@phy: the PHY to setup
 *	@mac: the MAC to setup
 *	@lc: the requested link configuration
 *
 *	Set up a port's MAC and PHY according to a desired link configuration.
 *	- If the PHY can auto-negotiate first decide what to advertise, then
 *	  enable/disable auto-negotiation as desired, and reset.
 *	- If the PHY does not auto-negotiate just reset it.
 *	- If auto-negotiation is off set the MAC to the proper speed/duplex/FC,
 *	  otherwise do it later based on the outcome of auto-negotiation.
 */
apply link configuration to MAC/PHY
@phy: the PHY to setup
@mac: the MAC to setup
@lc: the requested link configuration

Set up a port's MAC and PHY according to a desired link configuration.
- If the PHY can auto-negotiate first decide what to advertise, then
enable/disable auto-negotiation as desired, and reset.
- If the PHY does not auto-negotiate just reset it.
- If auto-negotiation is off set the MAC to the proper speed/duplex/FC,
otherwise do it later based on the outcome of auto-negotiation.
apply link configuration to MAC / PHY @phy : the PHY to setup @mac : the MAC to setup @lc : the requested link configuration Set up a port ' s MAC and PHY according to a desired link configuration . - If the PHY can auto - negotiate first decide what to advertise then enable / disable auto - negotiation as desired and reset . - If the PHY does not auto - negotiate just reset it . - If auto - negotiation is off set the MAC to the proper speed / duplex / FC otherwise do it later based on the outcome of auto - negotiation .
int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc)
{
	unsigned int fc = lc->requested_fc & (PAUSE_RX | PAUSE_TX);
	lc->link_ok = 0;
	if (lc->supported & SUPPORTED_Autoneg) {
		lc->advertising &= ~(ADVERTISED_Asym_Pause | ADVERTISED_Pause);
		if (fc) {
			lc->advertising |= ADVERTISED_Asym_Pause;
			if (fc & PAUSE_RX)
				lc->advertising |= ADVERTISED_Pause;
		}
		phy->ops->advertise(phy, lc->advertising);
		if (lc->autoneg == AUTONEG_DISABLE) {
			lc->speed = lc->requested_speed;
			lc->duplex = lc->requested_duplex;
			lc->fc = (unsigned char)fc;
			t3_mac_set_speed_duplex_fc(mac, lc->speed, lc->duplex,
						   fc);
			phy->ops->set_speed_duplex(phy, lc->speed, lc->duplex);
			if (!is_10G(phy->adapter))
				phy->ops->power_down(phy, 0);
		} else
			phy->ops->autoneg_enable(phy);
	} else {
		t3_mac_set_speed_duplex_fc(mac, -1, -1, fc);
		lc->fc = (unsigned char)fc;
		phy->ops->reset(phy, 0);
	}
	return 0;
}
int t3_link_start ( struct cphy * phy , struct cmac * mac , struct link_config * lc ) { unsigned int fc = lc -> requested_fc & ( PAUSE_RX | PAUSE_TX ) ; lc -> link_ok = 0 ; if ( lc -> supported & SUPPORTED_Autoneg ) { lc -> advertising &= ~ ( ADVERTISED_Asym_Pause | ADVERTISED_Pause ) ; if ( fc ) { lc -> advertising |= ADVERTISED_Asym_Pause ; if ( fc & PAUSE_RX ) lc -> advertising |= ADVERTISED_Pause ; } phy -> ops -> advertise ( phy , lc -> advertising ) ; if ( lc -> autoneg == AUTONEG_DISABLE ) { lc -> speed = lc -> requested_speed ; lc -> duplex = lc -> requested_duplex ; lc -> fc = ( unsigned char ) fc ; t3_mac_set_speed_duplex_fc ( mac , lc -> speed , lc -> duplex , fc ) ; phy -> ops -> set_speed_duplex ( phy , lc -> speed , lc -> duplex ) ; if ( ! is_10G ( phy -> adapter ) ) phy -> ops -> power_down ( phy , 0 ) ; } else phy -> ops -> autoneg_enable ( phy ) ; } else { t3_mac_set_speed_duplex_fc ( mac , -1 , -1 , fc ) ; lc -> fc = ( unsigned char ) fc ; phy -> ops -> reset ( phy , 0 ) ; } return 0 ; }
t3_link_start - apply link configuration to MAC/PHY
      @phy: the PHY to setup
      @mac: the MAC to setup
      @lc: the requested link configuration
t3_link_start - apply link configuration to MAC / PHY @phy : the PHY to setup @mac : the MAC to setup @lc : the requested link configuration
/* Also disables autoneg */ /* PR 5666. Power phy up when doing an ifup */