src/dpdk/drivers/net/e1000/base/e1000_82575.c
s32 e1000_set_eee_i354(struct e1000_hw *hw, bool adv1G, bool adv100M)
{
	struct e1000_phy_info *phy = &hw->phy;
	s32 ret_val = E1000_SUCCESS;
	u16 phy_data;

	DEBUGFUNC("e1000_set_eee_i354");

	if ((hw->phy.media_type != e1000_media_type_copper) ||
	    ((phy->id != M88E1543_E_PHY_ID) &&
	    (phy->id != M88E1512_E_PHY_ID)))
		goto out;

	if (!hw->dev_spec._82575.eee_disable) {
		/* Switch to PHY page 18. */
		ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 18);
		if (ret_val)
			goto out;

		ret_val = phy->ops.read_reg(hw, E1000_M88E1543_EEE_CTRL_1,
					    &phy_data);
		if (ret_val)
			goto out;

		phy_data |= E1000_M88E1543_EEE_CTRL_1_MS;
		ret_val = phy->ops.write_reg(hw, E1000_M88E1543_EEE_CTRL_1,
					     phy_data);
		if (ret_val)
			goto out;

		/* Return the PHY to page 0. */
		ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 0);
		if (ret_val)
			goto out;

		/* Turn on EEE advertisement. */
		ret_val = e1000_read_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
					       E1000_EEE_ADV_DEV_I354,
					       &phy_data);
		if (ret_val)
			goto out;

		if (adv100M)
			phy_data |= E1000_EEE_ADV_100_SUPPORTED;
		else
			phy_data &= ~E1000_EEE_ADV_100_SUPPORTED;

		if (adv1G)
			phy_data |= E1000_EEE_ADV_1000_SUPPORTED;
		else
			phy_data &= ~E1000_EEE_ADV_1000_SUPPORTED;

		ret_val = e1000_write_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
						E1000_EEE_ADV_DEV_I354,
						phy_data);
	} else {
		/* Turn off EEE advertisement. */
		ret_val = e1000_read_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
					       E1000_EEE_ADV_DEV_I354,
					       &phy_data);
		if (ret_val)
			goto out;

		phy_data &= ~(E1000_EEE_ADV_100_SUPPORTED |
			      E1000_EEE_ADV_1000_SUPPORTED);
		ret_val = e1000_write_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
						E1000_EEE_ADV_DEV_I354,
						phy_data);
	}

out:
	return ret_val;
}
/**
 *  e1000_set_eee_i354 - Enable/disable EEE support
 *  @hw: pointer to the HW structure
 *  @adv1G: boolean flag enabling 1G EEE advertisement
 *  @adv100M: boolean flag enabling 100M EEE advertisement
 *
 *  Enable/disable EEE legacy mode based on setting in dev_spec structure.
 *
 **/
Enable/disable EEE support
@hw: pointer to the HW structure
@adv1G: boolean flag enabling 1G EEE advertisement
@adv100M: boolean flag enabling 100M EEE advertisement

Enable/disable EEE legacy mode based on setting in dev_spec structure.
Enable / disable EEE support @hw : pointer to the HW structure @adv1G : boolean flag enabling 1G EEE advertisement @adv100M : boolean flag enabling 100M EEE advertisement Enable / disable EEE legacy mode based on setting in dev_spec structure .
s32 e1000_set_eee_i354(struct e1000_hw *hw, bool adv1G, bool adv100M)
{
	struct e1000_phy_info *phy = &hw->phy;
	s32 ret_val = E1000_SUCCESS;
	u16 phy_data;
	DEBUGFUNC("e1000_set_eee_i354");
	if ((hw->phy.media_type != e1000_media_type_copper) ||
	    ((phy->id != M88E1543_E_PHY_ID) &&
	    (phy->id != M88E1512_E_PHY_ID)))
		goto out;
	if (!hw->dev_spec._82575.eee_disable) {
		ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 18);
		if (ret_val)
			goto out;
		ret_val = phy->ops.read_reg(hw, E1000_M88E1543_EEE_CTRL_1,
					    &phy_data);
		if (ret_val)
			goto out;
		phy_data |= E1000_M88E1543_EEE_CTRL_1_MS;
		ret_val = phy->ops.write_reg(hw, E1000_M88E1543_EEE_CTRL_1,
					     phy_data);
		if (ret_val)
			goto out;
		ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 0);
		if (ret_val)
			goto out;
		ret_val = e1000_read_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
					       E1000_EEE_ADV_DEV_I354,
					       &phy_data);
		if (ret_val)
			goto out;
		if (adv100M)
			phy_data |= E1000_EEE_ADV_100_SUPPORTED;
		else
			phy_data &= ~E1000_EEE_ADV_100_SUPPORTED;
		if (adv1G)
			phy_data |= E1000_EEE_ADV_1000_SUPPORTED;
		else
			phy_data &= ~E1000_EEE_ADV_1000_SUPPORTED;
		ret_val = e1000_write_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
						E1000_EEE_ADV_DEV_I354,
						phy_data);
	} else {
		ret_val = e1000_read_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
					       E1000_EEE_ADV_DEV_I354,
					       &phy_data);
		if (ret_val)
			goto out;
		phy_data &= ~(E1000_EEE_ADV_100_SUPPORTED |
			      E1000_EEE_ADV_1000_SUPPORTED);
		ret_val = e1000_write_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
						E1000_EEE_ADV_DEV_I354,
						phy_data);
	}
out:
	return ret_val;
}
s32 e1000_set_eee_i354 ( struct e1000_hw * hw , bool adv1G , bool adv100M ) { struct e1000_phy_info * phy = & hw -> phy ; s32 ret_val = E1000_SUCCESS ; u16 phy_data ; DEBUGFUNC ( " " ) ; if ( ( hw -> phy . media_type != e1000_media_type_copper ) || ( ( phy -> id != M88E1543_E_PHY_ID ) && ( phy -> id != M88E1512_E_PHY_ID ) ) ) goto out ; if ( ! hw -> dev_spec . _82575 . eee_disable ) { ret_val = phy -> ops . write_reg ( hw , E1000_M88E1543_PAGE_ADDR , 18 ) ; if ( ret_val ) goto out ; ret_val = phy -> ops . read_reg ( hw , E1000_M88E1543_EEE_CTRL_1 , & phy_data ) ; if ( ret_val ) goto out ; phy_data |= E1000_M88E1543_EEE_CTRL_1_MS ; ret_val = phy -> ops . write_reg ( hw , E1000_M88E1543_EEE_CTRL_1 , phy_data ) ; if ( ret_val ) goto out ; ret_val = phy -> ops . write_reg ( hw , E1000_M88E1543_PAGE_ADDR , 0 ) ; if ( ret_val ) goto out ; ret_val = e1000_read_xmdio_reg ( hw , E1000_EEE_ADV_ADDR_I354 , E1000_EEE_ADV_DEV_I354 , & phy_data ) ; if ( ret_val ) goto out ; if ( adv100M ) phy_data |= E1000_EEE_ADV_100_SUPPORTED ; else phy_data &= ~ E1000_EEE_ADV_100_SUPPORTED ; if ( adv1G ) phy_data |= E1000_EEE_ADV_1000_SUPPORTED ; else phy_data &= ~ E1000_EEE_ADV_1000_SUPPORTED ; ret_val = e1000_write_xmdio_reg ( hw , E1000_EEE_ADV_ADDR_I354 , E1000_EEE_ADV_DEV_I354 , phy_data ) ; } else { ret_val = e1000_read_xmdio_reg ( hw , E1000_EEE_ADV_ADDR_I354 , E1000_EEE_ADV_DEV_I354 , & phy_data ) ; if ( ret_val ) goto out ; phy_data &= ~ ( E1000_EEE_ADV_100_SUPPORTED | E1000_EEE_ADV_1000_SUPPORTED ) ; ret_val = e1000_write_xmdio_reg ( hw , E1000_EEE_ADV_ADDR_I354 , E1000_EEE_ADV_DEV_I354 , phy_data ) ; } out : return ret_val ; }
e1000_set_eee_i354 - Enable/disable EEE support
  @hw: pointer to the HW structure
  @adv1G: boolean flag enabling 1G EEE advertisement
  @adv100M: boolean flag enabling 100M EEE advertisement
e1000_set_eee_i354 - Enable / disable EEE support @hw : pointer to the HW structure @adv1G : boolean flag enabling 1G EEE advertisement @adv100M : boolean flag enabling 100M EEE advertisement
/* Switch to PHY page 18. */ /* Return the PHY to page 0. */ /* Turn on EEE advertisement. */ /* Turn off EEE advertisement. */