diff options
Diffstat (limited to 'drivers/net/ethernet/intel/e1000e/ich8lan.c')
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/ich8lan.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 3b1c1a7e5dac..174507ccd7d7 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
@@ -695,7 +695,7 @@ s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data) | |||
695 | * | 695 | * |
696 | * Assumes the SW/FW/HW Semaphore is already acquired. | 696 | * Assumes the SW/FW/HW Semaphore is already acquired. |
697 | **/ | 697 | **/ |
698 | static s32 e1000_write_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 data) | 698 | s32 e1000_write_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 data) |
699 | { | 699 | { |
700 | return __e1000_access_emi_reg_locked(hw, addr, &data, false); | 700 | return __e1000_access_emi_reg_locked(hw, addr, &data, false); |
701 | } | 701 | } |
@@ -712,11 +712,22 @@ static s32 e1000_set_eee_pchlan(struct e1000_hw *hw) | |||
712 | { | 712 | { |
713 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | 713 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
714 | s32 ret_val; | 714 | s32 ret_val; |
715 | u16 lpi_ctrl; | 715 | u16 lpa, pcs_status, adv, adv_addr, lpi_ctrl, data; |
716 | 716 | ||
717 | if ((hw->phy.type != e1000_phy_82579) && | 717 | switch (hw->phy.type) { |
718 | (hw->phy.type != e1000_phy_i217)) | 718 | case e1000_phy_82579: |
719 | lpa = I82579_EEE_LP_ABILITY; | ||
720 | pcs_status = I82579_EEE_PCS_STATUS; | ||
721 | adv_addr = I82579_EEE_ADVERTISEMENT; | ||
722 | break; | ||
723 | case e1000_phy_i217: | ||
724 | lpa = I217_EEE_LP_ABILITY; | ||
725 | pcs_status = I217_EEE_PCS_STATUS; | ||
726 | adv_addr = I217_EEE_ADVERTISEMENT; | ||
727 | break; | ||
728 | default: | ||
719 | return 0; | 729 | return 0; |
730 | } | ||
720 | 731 | ||
721 | ret_val = hw->phy.ops.acquire(hw); | 732 | ret_val = hw->phy.ops.acquire(hw); |
722 | if (ret_val) | 733 | if (ret_val) |
@@ -731,34 +742,24 @@ static s32 e1000_set_eee_pchlan(struct e1000_hw *hw) | |||
731 | 742 | ||
732 | /* Enable EEE if not disabled by user */ | 743 | /* Enable EEE if not disabled by user */ |
733 | if (!dev_spec->eee_disable) { | 744 | if (!dev_spec->eee_disable) { |
734 | u16 lpa, pcs_status, data; | ||
735 | |||
736 | /* Save off link partner's EEE ability */ | 745 | /* Save off link partner's EEE ability */ |
737 | switch (hw->phy.type) { | ||
738 | case e1000_phy_82579: | ||
739 | lpa = I82579_EEE_LP_ABILITY; | ||
740 | pcs_status = I82579_EEE_PCS_STATUS; | ||
741 | break; | ||
742 | case e1000_phy_i217: | ||
743 | lpa = I217_EEE_LP_ABILITY; | ||
744 | pcs_status = I217_EEE_PCS_STATUS; | ||
745 | break; | ||
746 | default: | ||
747 | ret_val = -E1000_ERR_PHY; | ||
748 | goto release; | ||
749 | } | ||
750 | ret_val = e1000_read_emi_reg_locked(hw, lpa, | 746 | ret_val = e1000_read_emi_reg_locked(hw, lpa, |
751 | &dev_spec->eee_lp_ability); | 747 | &dev_spec->eee_lp_ability); |
752 | if (ret_val) | 748 | if (ret_val) |
753 | goto release; | 749 | goto release; |
754 | 750 | ||
751 | /* Read EEE advertisement */ | ||
752 | ret_val = e1000_read_emi_reg_locked(hw, adv_addr, &adv); | ||
753 | if (ret_val) | ||
754 | goto release; | ||
755 | |||
755 | /* Enable EEE only for speeds in which the link partner is | 756 | /* Enable EEE only for speeds in which the link partner is |
756 | * EEE capable. | 757 | * EEE capable and for which we advertise EEE. |
757 | */ | 758 | */ |
758 | if (dev_spec->eee_lp_ability & I82579_EEE_1000_SUPPORTED) | 759 | if (adv & dev_spec->eee_lp_ability & I82579_EEE_1000_SUPPORTED) |
759 | lpi_ctrl |= I82579_LPI_CTRL_1000_ENABLE; | 760 | lpi_ctrl |= I82579_LPI_CTRL_1000_ENABLE; |
760 | 761 | ||
761 | if (dev_spec->eee_lp_ability & I82579_EEE_100_SUPPORTED) { | 762 | if (adv & dev_spec->eee_lp_ability & I82579_EEE_100_SUPPORTED) { |
762 | e1e_rphy_locked(hw, MII_LPA, &data); | 763 | e1e_rphy_locked(hw, MII_LPA, &data); |
763 | if (data & LPA_100FULL) | 764 | if (data & LPA_100FULL) |
764 | lpi_ctrl |= I82579_LPI_CTRL_100_ENABLE; | 765 | lpi_ctrl |= I82579_LPI_CTRL_100_ENABLE; |
@@ -770,13 +771,13 @@ static s32 e1000_set_eee_pchlan(struct e1000_hw *hw) | |||
770 | dev_spec->eee_lp_ability &= | 771 | dev_spec->eee_lp_ability &= |
771 | ~I82579_EEE_100_SUPPORTED; | 772 | ~I82579_EEE_100_SUPPORTED; |
772 | } | 773 | } |
773 | |||
774 | /* R/Clr IEEE MMD 3.1 bits 11:10 - Tx/Rx LPI Received */ | ||
775 | ret_val = e1000_read_emi_reg_locked(hw, pcs_status, &data); | ||
776 | if (ret_val) | ||
777 | goto release; | ||
778 | } | 774 | } |
779 | 775 | ||
776 | /* R/Clr IEEE MMD 3.1 bits 11:10 - Tx/Rx LPI Received */ | ||
777 | ret_val = e1000_read_emi_reg_locked(hw, pcs_status, &data); | ||
778 | if (ret_val) | ||
779 | goto release; | ||
780 | |||
780 | ret_val = e1e_wphy_locked(hw, I82579_LPI_CTRL, lpi_ctrl); | 781 | ret_val = e1e_wphy_locked(hw, I82579_LPI_CTRL, lpi_ctrl); |
781 | release: | 782 | release: |
782 | hw->phy.ops.release(hw); | 783 | hw->phy.ops.release(hw); |