src/dpdk/drivers/net/ixgbe/base/ixgbe_x550.c
s32 ixgbe_setup_phy_loopback_x550em(struct ixgbe_hw *hw)
{
	s32 status;
	u32 reg_val;

	/* Disable AN and force speed to 10G Serial. */
	status = hw->mac.ops.read_iosf_sb_reg(hw,
					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
	reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_MASK;
	reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_10G;
	status = hw->mac.ops.write_iosf_sb_reg(hw,
					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
	if (status != IXGBE_SUCCESS)
		return status;

	/* Set near-end loopback clocks. */
	status = hw->mac.ops.read_iosf_sb_reg(hw,
				IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_32B;
	reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_KRPCS;
	status = hw->mac.ops.write_iosf_sb_reg(hw,
				IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
	if (status != IXGBE_SUCCESS)
		return status;

	/* Set loopback enable. */
	status = hw->mac.ops.read_iosf_sb_reg(hw,
				IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	reg_val |= IXGBE_KRM_PMD_DFX_BURNIN_TX_RX_KR_LB_MASK;
	status = hw->mac.ops.write_iosf_sb_reg(hw,
				IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
	if (status != IXGBE_SUCCESS)
		return status;

	/* Training bypass. */
	status = hw->mac.ops.read_iosf_sb_reg(hw,
				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	reg_val |= IXGBE_KRM_RX_TRN_LINKUP_CTRL_PROTOCOL_BYPASS;
	status = hw->mac.ops.write_iosf_sb_reg(hw,
				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);

	return status;
}
/**
 * ixgbe_setup_phy_loopback_x550em - Configure the KR PHY for loopback.
 * @hw: pointer to hardware structure
 *
 * Configures the integrated KR PHY to use internal loopback mode.
 **/
Configure the KR PHY for loopback.
@hw: pointer to hardware structure

Configures the integrated KR PHY to use internal loopback mode.
Configure the KR PHY for loopback . @hw : pointer to hardware structure Configures the integrated KR PHY to use internal loopback mode .
s32 ixgbe_setup_phy_loopback_x550em(struct ixgbe_hw *hw)
{
	s32 status;
	u32 reg_val;
	status = hw->mac.ops.read_iosf_sb_reg(hw,
					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
	reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_MASK;
	reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_10G;
	status = hw->mac.ops.write_iosf_sb_reg(hw,
					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	status = hw->mac.ops.read_iosf_sb_reg(hw,
				IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_32B;
	reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_KRPCS;
	status = hw->mac.ops.write_iosf_sb_reg(hw,
				IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	status = hw->mac.ops.read_iosf_sb_reg(hw,
				IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	reg_val |= IXGBE_KRM_PMD_DFX_BURNIN_TX_RX_KR_LB_MASK;
	status = hw->mac.ops.write_iosf_sb_reg(hw,
				IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	status = hw->mac.ops.read_iosf_sb_reg(hw,
				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
	if (status != IXGBE_SUCCESS)
		return status;
	reg_val |= IXGBE_KRM_RX_TRN_LINKUP_CTRL_PROTOCOL_BYPASS;
	status = hw->mac.ops.write_iosf_sb_reg(hw,
				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
	return status;
}
s32 ixgbe_setup_phy_loopback_x550em ( struct ixgbe_hw * hw ) { s32 status ; u32 reg_val ; status = hw -> mac . ops . read_iosf_sb_reg ( hw , IXGBE_KRM_LINK_CTRL_1 ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , & reg_val ) ; if ( status != IXGBE_SUCCESS ) return status ; reg_val &= ~ IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE ; reg_val &= ~ IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_MASK ; reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_10G ; status = hw -> mac . ops . write_iosf_sb_reg ( hw , IXGBE_KRM_LINK_CTRL_1 ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , reg_val ) ; if ( status != IXGBE_SUCCESS ) return status ; status = hw -> mac . ops . read_iosf_sb_reg ( hw , IXGBE_KRM_PORT_CAR_GEN_CTRL ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , & reg_val ) ; if ( status != IXGBE_SUCCESS ) return status ; reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_32B ; reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_KRPCS ; status = hw -> mac . ops . write_iosf_sb_reg ( hw , IXGBE_KRM_PORT_CAR_GEN_CTRL ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , reg_val ) ; if ( status != IXGBE_SUCCESS ) return status ; status = hw -> mac . ops . read_iosf_sb_reg ( hw , IXGBE_KRM_PMD_DFX_BURNIN ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , & reg_val ) ; if ( status != IXGBE_SUCCESS ) return status ; reg_val |= IXGBE_KRM_PMD_DFX_BURNIN_TX_RX_KR_LB_MASK ; status = hw -> mac . ops . write_iosf_sb_reg ( hw , IXGBE_KRM_PMD_DFX_BURNIN ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , reg_val ) ; if ( status != IXGBE_SUCCESS ) return status ; status = hw -> mac . ops . read_iosf_sb_reg ( hw , IXGBE_KRM_RX_TRN_LINKUP_CTRL ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , & reg_val ) ; if ( status != IXGBE_SUCCESS ) return status ; reg_val |= IXGBE_KRM_RX_TRN_LINKUP_CTRL_PROTOCOL_BYPASS ; status = hw -> mac . ops . write_iosf_sb_reg ( hw , IXGBE_KRM_RX_TRN_LINKUP_CTRL ( hw -> bus . lan_id ) , IXGBE_SB_IOSF_TARGET_KR_PHY , reg_val ) ; return status ; }
ixgbe_setup_phy_loopback_x550em - Configure the KR PHY for loopback.
ixgbe_setup_phy_loopback_x550em - Configure the KR PHY for loopback .
/* Disable AN and force speed to 10G Serial. */ /* Set near-end loopback clocks. */ /* Set loopback enable. */ /* Training bypass. */