diff options
Diffstat (limited to 'drivers/net/e1000e/82571.c')
-rw-r--r-- | drivers/net/e1000e/82571.c | 77 |
1 files changed, 70 insertions, 7 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index e57e4097ef1b..cb6c7b1c1fb8 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
@@ -78,6 +78,8 @@ static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw); | |||
78 | static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw); | 78 | static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw); |
79 | static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw); | 79 | static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw); |
80 | static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw); | 80 | static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw); |
81 | static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active); | ||
82 | static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active); | ||
81 | 83 | ||
82 | /** | 84 | /** |
83 | * e1000_init_phy_params_82571 - Init PHY func ptrs. | 85 | * e1000_init_phy_params_82571 - Init PHY func ptrs. |
@@ -113,6 +115,8 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) | |||
113 | phy->type = e1000_phy_bm; | 115 | phy->type = e1000_phy_bm; |
114 | phy->ops.acquire = e1000_get_hw_semaphore_82574; | 116 | phy->ops.acquire = e1000_get_hw_semaphore_82574; |
115 | phy->ops.release = e1000_put_hw_semaphore_82574; | 117 | phy->ops.release = e1000_put_hw_semaphore_82574; |
118 | phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82574; | ||
119 | phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82574; | ||
116 | break; | 120 | break; |
117 | default: | 121 | default: |
118 | return -E1000_ERR_PHY; | 122 | return -E1000_ERR_PHY; |
@@ -121,29 +125,36 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) | |||
121 | 125 | ||
122 | /* This can only be done after all function pointers are setup. */ | 126 | /* This can only be done after all function pointers are setup. */ |
123 | ret_val = e1000_get_phy_id_82571(hw); | 127 | ret_val = e1000_get_phy_id_82571(hw); |
128 | if (ret_val) { | ||
129 | e_dbg("Error getting PHY ID\n"); | ||
130 | return ret_val; | ||
131 | } | ||
124 | 132 | ||
125 | /* Verify phy id */ | 133 | /* Verify phy id */ |
126 | switch (hw->mac.type) { | 134 | switch (hw->mac.type) { |
127 | case e1000_82571: | 135 | case e1000_82571: |
128 | case e1000_82572: | 136 | case e1000_82572: |
129 | if (phy->id != IGP01E1000_I_PHY_ID) | 137 | if (phy->id != IGP01E1000_I_PHY_ID) |
130 | return -E1000_ERR_PHY; | 138 | ret_val = -E1000_ERR_PHY; |
131 | break; | 139 | break; |
132 | case e1000_82573: | 140 | case e1000_82573: |
133 | if (phy->id != M88E1111_I_PHY_ID) | 141 | if (phy->id != M88E1111_I_PHY_ID) |
134 | return -E1000_ERR_PHY; | 142 | ret_val = -E1000_ERR_PHY; |
135 | break; | 143 | break; |
136 | case e1000_82574: | 144 | case e1000_82574: |
137 | case e1000_82583: | 145 | case e1000_82583: |
138 | if (phy->id != BME1000_E_PHY_ID_R2) | 146 | if (phy->id != BME1000_E_PHY_ID_R2) |
139 | return -E1000_ERR_PHY; | 147 | ret_val = -E1000_ERR_PHY; |
140 | break; | 148 | break; |
141 | default: | 149 | default: |
142 | return -E1000_ERR_PHY; | 150 | ret_val = -E1000_ERR_PHY; |
143 | break; | 151 | break; |
144 | } | 152 | } |
145 | 153 | ||
146 | return 0; | 154 | if (ret_val) |
155 | e_dbg("PHY ID unknown: type = 0x%08x\n", phy->id); | ||
156 | |||
157 | return ret_val; | ||
147 | } | 158 | } |
148 | 159 | ||
149 | /** | 160 | /** |
@@ -649,6 +660,58 @@ static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw) | |||
649 | } | 660 | } |
650 | 661 | ||
651 | /** | 662 | /** |
663 | * e1000_set_d0_lplu_state_82574 - Set Low Power Linkup D0 state | ||
664 | * @hw: pointer to the HW structure | ||
665 | * @active: true to enable LPLU, false to disable | ||
666 | * | ||
667 | * Sets the LPLU D0 state according to the active flag. | ||
668 | * LPLU will not be activated unless the | ||
669 | * device autonegotiation advertisement meets standards of | ||
670 | * either 10 or 10/100 or 10/100/1000 at all duplexes. | ||
671 | * This is a function pointer entry point only called by | ||
672 | * PHY setup routines. | ||
673 | **/ | ||
674 | static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active) | ||
675 | { | ||
676 | u16 data = er32(POEMB); | ||
677 | |||
678 | if (active) | ||
679 | data |= E1000_PHY_CTRL_D0A_LPLU; | ||
680 | else | ||
681 | data &= ~E1000_PHY_CTRL_D0A_LPLU; | ||
682 | |||
683 | ew32(POEMB, data); | ||
684 | return 0; | ||
685 | } | ||
686 | |||
687 | /** | ||
688 | * e1000_set_d3_lplu_state_82574 - Sets low power link up state for D3 | ||
689 | * @hw: pointer to the HW structure | ||
690 | * @active: boolean used to enable/disable lplu | ||
691 | * | ||
692 | * The low power link up (lplu) state is set to the power management level D3 | ||
693 | * when active is true, else clear lplu for D3. LPLU | ||
694 | * is used during Dx states where the power conservation is most important. | ||
695 | * During driver activity, SmartSpeed should be enabled so performance is | ||
696 | * maintained. | ||
697 | **/ | ||
698 | static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active) | ||
699 | { | ||
700 | u16 data = er32(POEMB); | ||
701 | |||
702 | if (!active) { | ||
703 | data &= ~E1000_PHY_CTRL_NOND0A_LPLU; | ||
704 | } else if ((hw->phy.autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || | ||
705 | (hw->phy.autoneg_advertised == E1000_ALL_NOT_GIG) || | ||
706 | (hw->phy.autoneg_advertised == E1000_ALL_10_SPEED)) { | ||
707 | data |= E1000_PHY_CTRL_NOND0A_LPLU; | ||
708 | } | ||
709 | |||
710 | ew32(POEMB, data); | ||
711 | return 0; | ||
712 | } | ||
713 | |||
714 | /** | ||
652 | * e1000_acquire_nvm_82571 - Request for access to the EEPROM | 715 | * e1000_acquire_nvm_82571 - Request for access to the EEPROM |
653 | * @hw: pointer to the HW structure | 716 | * @hw: pointer to the HW structure |
654 | * | 717 | * |
@@ -956,7 +1019,7 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) | |||
956 | **/ | 1019 | **/ |
957 | static s32 e1000_reset_hw_82571(struct e1000_hw *hw) | 1020 | static s32 e1000_reset_hw_82571(struct e1000_hw *hw) |
958 | { | 1021 | { |
959 | u32 ctrl, ctrl_ext, icr; | 1022 | u32 ctrl, ctrl_ext; |
960 | s32 ret_val; | 1023 | s32 ret_val; |
961 | 1024 | ||
962 | /* | 1025 | /* |
@@ -1040,7 +1103,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) | |||
1040 | 1103 | ||
1041 | /* Clear any pending interrupt events. */ | 1104 | /* Clear any pending interrupt events. */ |
1042 | ew32(IMC, 0xffffffff); | 1105 | ew32(IMC, 0xffffffff); |
1043 | icr = er32(ICR); | 1106 | er32(ICR); |
1044 | 1107 | ||
1045 | if (hw->mac.type == e1000_82571) { | 1108 | if (hw->mac.type == e1000_82571) { |
1046 | /* Install any alternate MAC address into RAR0 */ | 1109 | /* Install any alternate MAC address into RAR0 */ |