src/dpdk/drivers/net/ixgbe/base/ixgbe_x550.c
s32 ixgbe_setup_internal_phy_t_x550em(struct ixgbe_hw *hw)
{
	ixgbe_link_speed force_speed;
	bool link_up;
	u32 status;
	u16 speed;

	if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper)
		return IXGBE_ERR_CONFIG;

	if (hw->mac.type == ixgbe_mac_X550EM_x &&
	    !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
		/* If link is down, there is no setup necessary so return  */
		status = ixgbe_ext_phy_t_x550em_get_link(hw, &link_up);
		if (status != IXGBE_SUCCESS)
			return status;

		if (!link_up)
			return IXGBE_SUCCESS;

		status = hw->phy.ops.read_reg(hw,
					      IXGBE_MDIO_AUTO_NEG_VENDOR_STAT,
					      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
					      &speed);
		if (status != IXGBE_SUCCESS)
			return status;

		/* If link is still down - no setup is required so return */
		status = ixgbe_ext_phy_t_x550em_get_link(hw, &link_up);
		if (status != IXGBE_SUCCESS)
			return status;
		if (!link_up)
			return IXGBE_SUCCESS;

		/* clear everything but the speed and duplex bits */
		speed &= IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_MASK;

		switch (speed) {
		case IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_10GB_FULL:
			force_speed = IXGBE_LINK_SPEED_10GB_FULL;
			break;
		case IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_1GB_FULL:
			force_speed = IXGBE_LINK_SPEED_1GB_FULL;
			break;
		default:
			/* Internal PHY does not support anything else */
			return IXGBE_ERR_INVALID_LINK_SETTINGS;
		}

		return ixgbe_setup_ixfi_x550em(hw, &force_speed);
	} else {
		speed = IXGBE_LINK_SPEED_10GB_FULL |
			IXGBE_LINK_SPEED_1GB_FULL;
		return ixgbe_setup_kr_speed_x550em(hw, speed);
	}
}
/**
 * ixgbe_setup_internal_phy_t_x550em - Configure KR PHY to X557 link
 * @hw: point to hardware structure
 *
 * Configures the link between the integrated KR PHY and the external X557 PHY
 * The driver will call this function when it gets a link status change
 * interrupt from the X557 PHY. This function configures the link speed
 * between the PHYs to match the link speed of the BASE-T link.
 *
 * A return of a non-zero value indicates an error, and the base driver should
 * not report link up.
 */
Configure KR PHY to X557 link
@hw: point to hardware structure

Configures the link between the integrated KR PHY and the external X557 PHY
The driver will call this function when it gets a link status change
interrupt from the X557 PHY. This function configures the link speed
between the PHYs to match the link speed of the BASE-T link.

A return of a non-zero value indicates an error, and the base driver should
not report link up.
Configure KR PHY to X557 link @hw : point to hardware structure Configures the link between the integrated KR PHY and the external X557 PHY The driver will call this function when it gets a link status change interrupt from the X557 PHY . This function configures the link speed between the PHYs to match the link speed of the BASE - T link . A return of a non - zero value indicates an error and the base driver should not report link up .
s32 ixgbe_setup_internal_phy_t_x550em(struct ixgbe_hw *hw)
{
	ixgbe_link_speed force_speed;
	bool link_up;
	u32 status;
	u16 speed;
	if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper)
		return IXGBE_ERR_CONFIG;
	if (hw->mac.type == ixgbe_mac_X550EM_x &&
	    !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
		status = ixgbe_ext_phy_t_x550em_get_link(hw, &link_up);
		if (status != IXGBE_SUCCESS)
			return status;
		if (!link_up)
			return IXGBE_SUCCESS;
		status = hw->phy.ops.read_reg(hw,
					      IXGBE_MDIO_AUTO_NEG_VENDOR_STAT,
					      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
					      &speed);
		if (status != IXGBE_SUCCESS)
			return status;
		status = ixgbe_ext_phy_t_x550em_get_link(hw, &link_up);
		if (status != IXGBE_SUCCESS)
			return status;
		if (!link_up)
			return IXGBE_SUCCESS;
		speed &= IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_MASK;
		switch (speed) {
		case IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_10GB_FULL:
			force_speed = IXGBE_LINK_SPEED_10GB_FULL;
			break;
		case IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_1GB_FULL:
			force_speed = IXGBE_LINK_SPEED_1GB_FULL;
			break;
		default:
			return IXGBE_ERR_INVALID_LINK_SETTINGS;
		}
		return ixgbe_setup_ixfi_x550em(hw, &force_speed);
	} else {
		speed = IXGBE_LINK_SPEED_10GB_FULL |
			IXGBE_LINK_SPEED_1GB_FULL;
		return ixgbe_setup_kr_speed_x550em(hw, speed);
	}
}
s32 ixgbe_setup_internal_phy_t_x550em ( struct ixgbe_hw * hw ) { ixgbe_link_speed force_speed ; bool link_up ; u32 status ; u16 speed ; if ( hw -> mac . ops . get_media_type ( hw ) != ixgbe_media_type_copper ) return IXGBE_ERR_CONFIG ; if ( hw -> mac . type == ixgbe_mac_X550EM_x && ! ( hw -> phy . nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE ) ) { status = ixgbe_ext_phy_t_x550em_get_link ( hw , & link_up ) ; if ( status != IXGBE_SUCCESS ) return status ; if ( ! link_up ) return IXGBE_SUCCESS ; status = hw -> phy . ops . read_reg ( hw , IXGBE_MDIO_AUTO_NEG_VENDOR_STAT , IXGBE_MDIO_AUTO_NEG_DEV_TYPE , & speed ) ; if ( status != IXGBE_SUCCESS ) return status ; status = ixgbe_ext_phy_t_x550em_get_link ( hw , & link_up ) ; if ( status != IXGBE_SUCCESS ) return status ; if ( ! link_up ) return IXGBE_SUCCESS ; speed &= IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_MASK ; switch ( speed ) { case IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_10GB_FULL : force_speed = IXGBE_LINK_SPEED_10GB_FULL ; break ; case IXGBE_MDIO_AUTO_NEG_VENDOR_STATUS_1GB_FULL : force_speed = IXGBE_LINK_SPEED_1GB_FULL ; break ; default : return IXGBE_ERR_INVALID_LINK_SETTINGS ; } return ixgbe_setup_ixfi_x550em ( hw , & force_speed ) ; } else { speed = IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL ; return ixgbe_setup_kr_speed_x550em ( hw , speed ) ; } }
ixgbe_setup_internal_phy_t_x550em - Configure KR PHY to X557 link
 @hw: point to hardware structure
ixgbe_setup_internal_phy_t_x550em - Configure KR PHY to X557 link @hw : point to hardware structure
/* If link is down, there is no setup necessary so return  */ /* If link is still down - no setup is required so return */ /* clear everything but the speed and duplex bits */ /* Internal PHY does not support anything else */