diff options
author | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2008-03-28 12:15:16 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-03-28 22:15:00 -0400 |
commit | 318a94d68979cbe9cc98a3050b4b7be2f08513c8 (patch) | |
tree | 32fdd0bd9f4a0c9dcc2a958b18820286a9acdcec /drivers/net/e1000e | |
parent | e2de3eb69c40c01739ce9b154c65e51d94d72966 (diff) |
e1000e: reorganize PHY and flow control interface
This reorganization moves the PHY status into a separate
struct. Flow Control setup is moved into this struct as well
and frame size away from here into the adapter struct where its
inly use is.
The post-link-up code is now a separate function and moved out
of the watchdog function itself. This allows us to track the
es2lan restart issue a bit easier.
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r-- | drivers/net/e1000e/82571.c | 12 | ||||
-rw-r--r-- | drivers/net/e1000e/e1000.h | 5 | ||||
-rw-r--r-- | drivers/net/e1000e/es2lan.c | 14 | ||||
-rw-r--r-- | drivers/net/e1000e/ethtool.c | 64 | ||||
-rw-r--r-- | drivers/net/e1000e/hw.h | 26 | ||||
-rw-r--r-- | drivers/net/e1000e/ich8lan.c | 15 | ||||
-rw-r--r-- | drivers/net/e1000e/lib.c | 65 | ||||
-rw-r--r-- | drivers/net/e1000e/netdev.c | 151 | ||||
-rw-r--r-- | drivers/net/e1000e/phy.c | 12 |
9 files changed, 205 insertions, 159 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index f5a4d40000cd..f7e1619b974e 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
@@ -75,7 +75,7 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) | |||
75 | struct e1000_phy_info *phy = &hw->phy; | 75 | struct e1000_phy_info *phy = &hw->phy; |
76 | s32 ret_val; | 76 | s32 ret_val; |
77 | 77 | ||
78 | if (hw->media_type != e1000_media_type_copper) { | 78 | if (hw->phy.media_type != e1000_media_type_copper) { |
79 | phy->type = e1000_phy_none; | 79 | phy->type = e1000_phy_none; |
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
@@ -195,16 +195,16 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) | |||
195 | case E1000_DEV_ID_82571EB_FIBER: | 195 | case E1000_DEV_ID_82571EB_FIBER: |
196 | case E1000_DEV_ID_82572EI_FIBER: | 196 | case E1000_DEV_ID_82572EI_FIBER: |
197 | case E1000_DEV_ID_82571EB_QUAD_FIBER: | 197 | case E1000_DEV_ID_82571EB_QUAD_FIBER: |
198 | hw->media_type = e1000_media_type_fiber; | 198 | hw->phy.media_type = e1000_media_type_fiber; |
199 | break; | 199 | break; |
200 | case E1000_DEV_ID_82571EB_SERDES: | 200 | case E1000_DEV_ID_82571EB_SERDES: |
201 | case E1000_DEV_ID_82572EI_SERDES: | 201 | case E1000_DEV_ID_82572EI_SERDES: |
202 | case E1000_DEV_ID_82571EB_SERDES_DUAL: | 202 | case E1000_DEV_ID_82571EB_SERDES_DUAL: |
203 | case E1000_DEV_ID_82571EB_SERDES_QUAD: | 203 | case E1000_DEV_ID_82571EB_SERDES_QUAD: |
204 | hw->media_type = e1000_media_type_internal_serdes; | 204 | hw->phy.media_type = e1000_media_type_internal_serdes; |
205 | break; | 205 | break; |
206 | default: | 206 | default: |
207 | hw->media_type = e1000_media_type_copper; | 207 | hw->phy.media_type = e1000_media_type_copper; |
208 | break; | 208 | break; |
209 | } | 209 | } |
210 | 210 | ||
@@ -216,7 +216,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) | |||
216 | mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) ? 1 : 0; | 216 | mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) ? 1 : 0; |
217 | 217 | ||
218 | /* check for link */ | 218 | /* check for link */ |
219 | switch (hw->media_type) { | 219 | switch (hw->phy.media_type) { |
220 | case e1000_media_type_copper: | 220 | case e1000_media_type_copper: |
221 | func->setup_physical_interface = e1000_setup_copper_link_82571; | 221 | func->setup_physical_interface = e1000_setup_copper_link_82571; |
222 | func->check_for_link = e1000e_check_for_copper_link; | 222 | func->check_for_link = e1000e_check_for_copper_link; |
@@ -1015,7 +1015,7 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw) | |||
1015 | * set it to full. | 1015 | * set it to full. |
1016 | */ | 1016 | */ |
1017 | if (hw->mac.type == e1000_82573) | 1017 | if (hw->mac.type == e1000_82573) |
1018 | hw->mac.fc = e1000_fc_full; | 1018 | hw->fc.type = e1000_fc_full; |
1019 | 1019 | ||
1020 | return e1000e_setup_link(hw); | 1020 | return e1000e_setup_link(hw); |
1021 | } | 1021 | } |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 499adb26dc1b..b941a6b509c4 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -234,6 +234,8 @@ struct e1000_adapter { | |||
234 | 234 | ||
235 | unsigned int rx_ps_pages; | 235 | unsigned int rx_ps_pages; |
236 | u16 rx_ps_bsize0; | 236 | u16 rx_ps_bsize0; |
237 | u32 max_frame_size; | ||
238 | u32 min_frame_size; | ||
237 | 239 | ||
238 | /* OS defined structs */ | 240 | /* OS defined structs */ |
239 | struct net_device *netdev; | 241 | struct net_device *netdev; |
@@ -258,7 +260,7 @@ struct e1000_adapter { | |||
258 | u32 wol; | 260 | u32 wol; |
259 | u32 pba; | 261 | u32 pba; |
260 | 262 | ||
261 | u8 fc_autoneg; | 263 | bool fc_autoneg; |
262 | 264 | ||
263 | unsigned long led_status; | 265 | unsigned long led_status; |
264 | 266 | ||
@@ -305,6 +307,7 @@ struct e1000_info { | |||
305 | #define FLAG_MSI_ENABLED (1 << 27) | 307 | #define FLAG_MSI_ENABLED (1 << 27) |
306 | #define FLAG_RX_CSUM_ENABLED (1 << 28) | 308 | #define FLAG_RX_CSUM_ENABLED (1 << 28) |
307 | #define FLAG_TSO_FORCE (1 << 29) | 309 | #define FLAG_TSO_FORCE (1 << 29) |
310 | #define FLAG_RX_RESTART_NOW (1 << 30) | ||
308 | 311 | ||
309 | #define E1000_RX_DESC_PS(R, i) \ | 312 | #define E1000_RX_DESC_PS(R, i) \ |
310 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) | 313 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) |
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c index df2782473910..e3f4aeefeae2 100644 --- a/drivers/net/e1000e/es2lan.c +++ b/drivers/net/e1000e/es2lan.c | |||
@@ -119,7 +119,7 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw) | |||
119 | struct e1000_phy_info *phy = &hw->phy; | 119 | struct e1000_phy_info *phy = &hw->phy; |
120 | s32 ret_val; | 120 | s32 ret_val; |
121 | 121 | ||
122 | if (hw->media_type != e1000_media_type_copper) { | 122 | if (hw->phy.media_type != e1000_media_type_copper) { |
123 | phy->type = e1000_phy_none; | 123 | phy->type = e1000_phy_none; |
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
@@ -198,10 +198,10 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) | |||
198 | /* Set media type */ | 198 | /* Set media type */ |
199 | switch (adapter->pdev->device) { | 199 | switch (adapter->pdev->device) { |
200 | case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: | 200 | case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: |
201 | hw->media_type = e1000_media_type_internal_serdes; | 201 | hw->phy.media_type = e1000_media_type_internal_serdes; |
202 | break; | 202 | break; |
203 | default: | 203 | default: |
204 | hw->media_type = e1000_media_type_copper; | 204 | hw->phy.media_type = e1000_media_type_copper; |
205 | break; | 205 | break; |
206 | } | 206 | } |
207 | 207 | ||
@@ -213,7 +213,7 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) | |||
213 | mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) ? 1 : 0; | 213 | mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) ? 1 : 0; |
214 | 214 | ||
215 | /* check for link */ | 215 | /* check for link */ |
216 | switch (hw->media_type) { | 216 | switch (hw->phy.media_type) { |
217 | case e1000_media_type_copper: | 217 | case e1000_media_type_copper: |
218 | func->setup_physical_interface = e1000_setup_copper_link_80003es2lan; | 218 | func->setup_physical_interface = e1000_setup_copper_link_80003es2lan; |
219 | func->check_for_link = e1000e_check_for_copper_link; | 219 | func->check_for_link = e1000e_check_for_copper_link; |
@@ -591,7 +591,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) | |||
591 | 591 | ||
592 | udelay(1); | 592 | udelay(1); |
593 | 593 | ||
594 | if (hw->phy.wait_for_link) { | 594 | if (hw->phy.autoneg_wait_to_complete) { |
595 | hw_dbg(hw, "Waiting for forced speed/duplex link " | 595 | hw_dbg(hw, "Waiting for forced speed/duplex link " |
596 | "on GG82563 phy.\n"); | 596 | "on GG82563 phy.\n"); |
597 | 597 | ||
@@ -682,7 +682,7 @@ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, | |||
682 | { | 682 | { |
683 | s32 ret_val; | 683 | s32 ret_val; |
684 | 684 | ||
685 | if (hw->media_type == e1000_media_type_copper) { | 685 | if (hw->phy.media_type == e1000_media_type_copper) { |
686 | ret_val = e1000e_get_speed_and_duplex_copper(hw, | 686 | ret_val = e1000e_get_speed_and_duplex_copper(hw, |
687 | speed, | 687 | speed, |
688 | duplex); | 688 | duplex); |
@@ -854,7 +854,7 @@ static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw) | |||
854 | /* Transmit Arbitration Control 0 */ | 854 | /* Transmit Arbitration Control 0 */ |
855 | reg = er32(TARC0); | 855 | reg = er32(TARC0); |
856 | reg &= ~(0xF << 27); /* 30:27 */ | 856 | reg &= ~(0xF << 27); /* 30:27 */ |
857 | if (hw->media_type != e1000_media_type_copper) | 857 | if (hw->phy.media_type != e1000_media_type_copper) |
858 | reg &= ~(1 << 20); | 858 | reg &= ~(1 << 20); |
859 | ew32(TARC0, reg); | 859 | ew32(TARC0, reg); |
860 | 860 | ||
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 3b94a87b5272..4ae00567bba6 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -111,7 +111,7 @@ static int e1000_get_settings(struct net_device *netdev, | |||
111 | struct e1000_hw *hw = &adapter->hw; | 111 | struct e1000_hw *hw = &adapter->hw; |
112 | u32 status; | 112 | u32 status; |
113 | 113 | ||
114 | if (hw->media_type == e1000_media_type_copper) { | 114 | if (hw->phy.media_type == e1000_media_type_copper) { |
115 | 115 | ||
116 | ecmd->supported = (SUPPORTED_10baseT_Half | | 116 | ecmd->supported = (SUPPORTED_10baseT_Half | |
117 | SUPPORTED_10baseT_Full | | 117 | SUPPORTED_10baseT_Full | |
@@ -165,7 +165,7 @@ static int e1000_get_settings(struct net_device *netdev, | |||
165 | ecmd->duplex = -1; | 165 | ecmd->duplex = -1; |
166 | } | 166 | } |
167 | 167 | ||
168 | ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) || | 168 | ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) || |
169 | hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; | 169 | hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; |
170 | return 0; | 170 | return 0; |
171 | } | 171 | } |
@@ -187,7 +187,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) | |||
187 | mac->autoneg = 0; | 187 | mac->autoneg = 0; |
188 | 188 | ||
189 | /* Fiber NICs only allow 1000 gbps Full duplex */ | 189 | /* Fiber NICs only allow 1000 gbps Full duplex */ |
190 | if ((adapter->hw.media_type == e1000_media_type_fiber) && | 190 | if ((adapter->hw.phy.media_type == e1000_media_type_fiber) && |
191 | spddplx != (SPEED_1000 + DUPLEX_FULL)) { | 191 | spddplx != (SPEED_1000 + DUPLEX_FULL)) { |
192 | ndev_err(adapter->netdev, "Unsupported Speed/Duplex " | 192 | ndev_err(adapter->netdev, "Unsupported Speed/Duplex " |
193 | "configuration\n"); | 193 | "configuration\n"); |
@@ -241,7 +241,7 @@ static int e1000_set_settings(struct net_device *netdev, | |||
241 | 241 | ||
242 | if (ecmd->autoneg == AUTONEG_ENABLE) { | 242 | if (ecmd->autoneg == AUTONEG_ENABLE) { |
243 | hw->mac.autoneg = 1; | 243 | hw->mac.autoneg = 1; |
244 | if (hw->media_type == e1000_media_type_fiber) | 244 | if (hw->phy.media_type == e1000_media_type_fiber) |
245 | hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full | | 245 | hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full | |
246 | ADVERTISED_FIBRE | | 246 | ADVERTISED_FIBRE | |
247 | ADVERTISED_Autoneg; | 247 | ADVERTISED_Autoneg; |
@@ -250,6 +250,8 @@ static int e1000_set_settings(struct net_device *netdev, | |||
250 | ADVERTISED_TP | | 250 | ADVERTISED_TP | |
251 | ADVERTISED_Autoneg; | 251 | ADVERTISED_Autoneg; |
252 | ecmd->advertising = hw->phy.autoneg_advertised; | 252 | ecmd->advertising = hw->phy.autoneg_advertised; |
253 | if (adapter->fc_autoneg) | ||
254 | hw->fc.original_type = e1000_fc_default; | ||
253 | } else { | 255 | } else { |
254 | if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) { | 256 | if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) { |
255 | clear_bit(__E1000_RESETTING, &adapter->state); | 257 | clear_bit(__E1000_RESETTING, &adapter->state); |
@@ -279,11 +281,11 @@ static void e1000_get_pauseparam(struct net_device *netdev, | |||
279 | pause->autoneg = | 281 | pause->autoneg = |
280 | (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); | 282 | (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); |
281 | 283 | ||
282 | if (hw->mac.fc == e1000_fc_rx_pause) { | 284 | if (hw->fc.type == e1000_fc_rx_pause) { |
283 | pause->rx_pause = 1; | 285 | pause->rx_pause = 1; |
284 | } else if (hw->mac.fc == e1000_fc_tx_pause) { | 286 | } else if (hw->fc.type == e1000_fc_tx_pause) { |
285 | pause->tx_pause = 1; | 287 | pause->tx_pause = 1; |
286 | } else if (hw->mac.fc == e1000_fc_full) { | 288 | } else if (hw->fc.type == e1000_fc_full) { |
287 | pause->rx_pause = 1; | 289 | pause->rx_pause = 1; |
288 | pause->tx_pause = 1; | 290 | pause->tx_pause = 1; |
289 | } | 291 | } |
@@ -302,18 +304,18 @@ static int e1000_set_pauseparam(struct net_device *netdev, | |||
302 | msleep(1); | 304 | msleep(1); |
303 | 305 | ||
304 | if (pause->rx_pause && pause->tx_pause) | 306 | if (pause->rx_pause && pause->tx_pause) |
305 | hw->mac.fc = e1000_fc_full; | 307 | hw->fc.type = e1000_fc_full; |
306 | else if (pause->rx_pause && !pause->tx_pause) | 308 | else if (pause->rx_pause && !pause->tx_pause) |
307 | hw->mac.fc = e1000_fc_rx_pause; | 309 | hw->fc.type = e1000_fc_rx_pause; |
308 | else if (!pause->rx_pause && pause->tx_pause) | 310 | else if (!pause->rx_pause && pause->tx_pause) |
309 | hw->mac.fc = e1000_fc_tx_pause; | 311 | hw->fc.type = e1000_fc_tx_pause; |
310 | else if (!pause->rx_pause && !pause->tx_pause) | 312 | else if (!pause->rx_pause && !pause->tx_pause) |
311 | hw->mac.fc = e1000_fc_none; | 313 | hw->fc.type = e1000_fc_none; |
312 | 314 | ||
313 | hw->mac.original_fc = hw->mac.fc; | 315 | hw->fc.original_type = hw->fc.type; |
314 | 316 | ||
315 | if (adapter->fc_autoneg == AUTONEG_ENABLE) { | 317 | if (adapter->fc_autoneg == AUTONEG_ENABLE) { |
316 | hw->mac.fc = e1000_fc_default; | 318 | hw->fc.type = e1000_fc_default; |
317 | if (netif_running(adapter->netdev)) { | 319 | if (netif_running(adapter->netdev)) { |
318 | e1000e_down(adapter); | 320 | e1000e_down(adapter); |
319 | e1000e_up(adapter); | 321 | e1000e_up(adapter); |
@@ -321,7 +323,7 @@ static int e1000_set_pauseparam(struct net_device *netdev, | |||
321 | e1000e_reset(adapter); | 323 | e1000e_reset(adapter); |
322 | } | 324 | } |
323 | } else { | 325 | } else { |
324 | retval = ((hw->media_type == e1000_media_type_fiber) ? | 326 | retval = ((hw->phy.media_type == e1000_media_type_fiber) ? |
325 | hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw)); | 327 | hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw)); |
326 | } | 328 | } |
327 | 329 | ||
@@ -1187,21 +1189,21 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1187 | u32 ctrl_reg = 0; | 1189 | u32 ctrl_reg = 0; |
1188 | u32 stat_reg = 0; | 1190 | u32 stat_reg = 0; |
1189 | 1191 | ||
1190 | adapter->hw.mac.autoneg = 0; | 1192 | hw->mac.autoneg = 0; |
1191 | 1193 | ||
1192 | if (adapter->hw.phy.type == e1000_phy_m88) { | 1194 | if (hw->phy.type == e1000_phy_m88) { |
1193 | /* Auto-MDI/MDIX Off */ | 1195 | /* Auto-MDI/MDIX Off */ |
1194 | e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808); | 1196 | e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808); |
1195 | /* reset to update Auto-MDI/MDIX */ | 1197 | /* reset to update Auto-MDI/MDIX */ |
1196 | e1e_wphy(hw, PHY_CONTROL, 0x9140); | 1198 | e1e_wphy(hw, PHY_CONTROL, 0x9140); |
1197 | /* autoneg off */ | 1199 | /* autoneg off */ |
1198 | e1e_wphy(hw, PHY_CONTROL, 0x8140); | 1200 | e1e_wphy(hw, PHY_CONTROL, 0x8140); |
1199 | } else if (adapter->hw.phy.type == e1000_phy_gg82563) | 1201 | } else if (hw->phy.type == e1000_phy_gg82563) |
1200 | e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC); | 1202 | e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC); |
1201 | 1203 | ||
1202 | ctrl_reg = er32(CTRL); | 1204 | ctrl_reg = er32(CTRL); |
1203 | 1205 | ||
1204 | if (adapter->hw.phy.type == e1000_phy_ife) { | 1206 | if (hw->phy.type == e1000_phy_ife) { |
1205 | /* force 100, set loopback */ | 1207 | /* force 100, set loopback */ |
1206 | e1e_wphy(hw, PHY_CONTROL, 0x6100); | 1208 | e1e_wphy(hw, PHY_CONTROL, 0x6100); |
1207 | 1209 | ||
@@ -1224,8 +1226,8 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1224 | E1000_CTRL_FD); /* Force Duplex to FULL */ | 1226 | E1000_CTRL_FD); /* Force Duplex to FULL */ |
1225 | } | 1227 | } |
1226 | 1228 | ||
1227 | if (adapter->hw.media_type == e1000_media_type_copper && | 1229 | if (hw->phy.media_type == e1000_media_type_copper && |
1228 | adapter->hw.phy.type == e1000_phy_m88) { | 1230 | hw->phy.type == e1000_phy_m88) { |
1229 | ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ | 1231 | ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ |
1230 | } else { | 1232 | } else { |
1231 | /* | 1233 | /* |
@@ -1243,7 +1245,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1243 | * Disable the receiver on the PHY so when a cable is plugged in, the | 1245 | * Disable the receiver on the PHY so when a cable is plugged in, the |
1244 | * PHY does not begin to autoneg when a cable is reconnected to the NIC. | 1246 | * PHY does not begin to autoneg when a cable is reconnected to the NIC. |
1245 | */ | 1247 | */ |
1246 | if (adapter->hw.phy.type == e1000_phy_m88) | 1248 | if (hw->phy.type == e1000_phy_m88) |
1247 | e1000_phy_disable_receiver(adapter); | 1249 | e1000_phy_disable_receiver(adapter); |
1248 | 1250 | ||
1249 | udelay(500); | 1251 | udelay(500); |
@@ -1333,8 +1335,8 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter) | |||
1333 | struct e1000_hw *hw = &adapter->hw; | 1335 | struct e1000_hw *hw = &adapter->hw; |
1334 | u32 rctl; | 1336 | u32 rctl; |
1335 | 1337 | ||
1336 | if (hw->media_type == e1000_media_type_fiber || | 1338 | if (hw->phy.media_type == e1000_media_type_fiber || |
1337 | hw->media_type == e1000_media_type_internal_serdes) { | 1339 | hw->phy.media_type == e1000_media_type_internal_serdes) { |
1338 | switch (hw->mac.type) { | 1340 | switch (hw->mac.type) { |
1339 | case e1000_80003es2lan: | 1341 | case e1000_80003es2lan: |
1340 | return e1000_set_es2lan_mac_loopback(adapter); | 1342 | return e1000_set_es2lan_mac_loopback(adapter); |
@@ -1349,7 +1351,7 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter) | |||
1349 | ew32(RCTL, rctl); | 1351 | ew32(RCTL, rctl); |
1350 | return 0; | 1352 | return 0; |
1351 | } | 1353 | } |
1352 | } else if (hw->media_type == e1000_media_type_copper) { | 1354 | } else if (hw->phy.media_type == e1000_media_type_copper) { |
1353 | return e1000_integrated_phy_loopback(adapter); | 1355 | return e1000_integrated_phy_loopback(adapter); |
1354 | } | 1356 | } |
1355 | 1357 | ||
@@ -1368,8 +1370,8 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter) | |||
1368 | 1370 | ||
1369 | switch (hw->mac.type) { | 1371 | switch (hw->mac.type) { |
1370 | case e1000_80003es2lan: | 1372 | case e1000_80003es2lan: |
1371 | if (hw->media_type == e1000_media_type_fiber || | 1373 | if (hw->phy.media_type == e1000_media_type_fiber || |
1372 | hw->media_type == e1000_media_type_internal_serdes) { | 1374 | hw->phy.media_type == e1000_media_type_internal_serdes) { |
1373 | /* restore CTRL_EXT, stealing space from tx_fifo_head */ | 1375 | /* restore CTRL_EXT, stealing space from tx_fifo_head */ |
1374 | ew32(CTRL_EXT, adapter->tx_fifo_head); | 1376 | ew32(CTRL_EXT, adapter->tx_fifo_head); |
1375 | adapter->tx_fifo_head = 0; | 1377 | adapter->tx_fifo_head = 0; |
@@ -1377,8 +1379,8 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter) | |||
1377 | /* fall through */ | 1379 | /* fall through */ |
1378 | case e1000_82571: | 1380 | case e1000_82571: |
1379 | case e1000_82572: | 1381 | case e1000_82572: |
1380 | if (hw->media_type == e1000_media_type_fiber || | 1382 | if (hw->phy.media_type == e1000_media_type_fiber || |
1381 | hw->media_type == e1000_media_type_internal_serdes) { | 1383 | hw->phy.media_type == e1000_media_type_internal_serdes) { |
1382 | #define E1000_SERDES_LB_OFF 0x400 | 1384 | #define E1000_SERDES_LB_OFF 0x400 |
1383 | ew32(SCTL, E1000_SERDES_LB_OFF); | 1385 | ew32(SCTL, E1000_SERDES_LB_OFF); |
1384 | msleep(10); | 1386 | msleep(10); |
@@ -1528,7 +1530,7 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data) | |||
1528 | struct e1000_hw *hw = &adapter->hw; | 1530 | struct e1000_hw *hw = &adapter->hw; |
1529 | 1531 | ||
1530 | *data = 0; | 1532 | *data = 0; |
1531 | if (hw->media_type == e1000_media_type_internal_serdes) { | 1533 | if (hw->phy.media_type == e1000_media_type_internal_serdes) { |
1532 | int i = 0; | 1534 | int i = 0; |
1533 | hw->mac.serdes_has_link = 0; | 1535 | hw->mac.serdes_has_link = 0; |
1534 | 1536 | ||
@@ -1624,9 +1626,9 @@ static void e1000_diag_test(struct net_device *netdev, | |||
1624 | adapter->hw.mac.autoneg = autoneg; | 1626 | adapter->hw.mac.autoneg = autoneg; |
1625 | 1627 | ||
1626 | /* force this routine to wait until autoneg complete/timeout */ | 1628 | /* force this routine to wait until autoneg complete/timeout */ |
1627 | adapter->hw.phy.wait_for_link = 1; | 1629 | adapter->hw.phy.autoneg_wait_to_complete = 1; |
1628 | e1000e_reset(adapter); | 1630 | e1000e_reset(adapter); |
1629 | adapter->hw.phy.wait_for_link = 0; | 1631 | adapter->hw.phy.autoneg_wait_to_complete = 0; |
1630 | 1632 | ||
1631 | clear_bit(__E1000_TESTING, &adapter->state); | 1633 | clear_bit(__E1000_TESTING, &adapter->state); |
1632 | if (if_running) | 1634 | if (if_running) |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index b582d78f0531..0b4145a73229 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -400,7 +400,7 @@ enum e1000_rev_polarity{ | |||
400 | e1000_rev_polarity_undefined = 0xFF | 400 | e1000_rev_polarity_undefined = 0xFF |
401 | }; | 401 | }; |
402 | 402 | ||
403 | enum e1000_fc_mode { | 403 | enum e1000_fc_type { |
404 | e1000_fc_none = 0, | 404 | e1000_fc_none = 0, |
405 | e1000_fc_rx_pause, | 405 | e1000_fc_rx_pause, |
406 | e1000_fc_tx_pause, | 406 | e1000_fc_tx_pause, |
@@ -727,16 +727,12 @@ struct e1000_mac_info { | |||
727 | u8 perm_addr[6]; | 727 | u8 perm_addr[6]; |
728 | 728 | ||
729 | enum e1000_mac_type type; | 729 | enum e1000_mac_type type; |
730 | enum e1000_fc_mode fc; | ||
731 | enum e1000_fc_mode original_fc; | ||
732 | 730 | ||
733 | u32 collision_delta; | 731 | u32 collision_delta; |
734 | u32 ledctl_default; | 732 | u32 ledctl_default; |
735 | u32 ledctl_mode1; | 733 | u32 ledctl_mode1; |
736 | u32 ledctl_mode2; | 734 | u32 ledctl_mode2; |
737 | u32 max_frame_size; | ||
738 | u32 mc_filter_type; | 735 | u32 mc_filter_type; |
739 | u32 min_frame_size; | ||
740 | u32 tx_packet_delta; | 736 | u32 tx_packet_delta; |
741 | u32 txcw; | 737 | u32 txcw; |
742 | 738 | ||
@@ -747,9 +743,6 @@ struct e1000_mac_info { | |||
747 | u16 ifs_step_size; | 743 | u16 ifs_step_size; |
748 | u16 mta_reg_count; | 744 | u16 mta_reg_count; |
749 | u16 rar_entry_count; | 745 | u16 rar_entry_count; |
750 | u16 fc_high_water; | ||
751 | u16 fc_low_water; | ||
752 | u16 fc_pause_time; | ||
753 | 746 | ||
754 | u8 forced_speed_duplex; | 747 | u8 forced_speed_duplex; |
755 | 748 | ||
@@ -779,6 +772,8 @@ struct e1000_phy_info { | |||
779 | u32 reset_delay_us; /* in usec */ | 772 | u32 reset_delay_us; /* in usec */ |
780 | u32 revision; | 773 | u32 revision; |
781 | 774 | ||
775 | enum e1000_media_type media_type; | ||
776 | |||
782 | u16 autoneg_advertised; | 777 | u16 autoneg_advertised; |
783 | u16 autoneg_mask; | 778 | u16 autoneg_mask; |
784 | u16 cable_length; | 779 | u16 cable_length; |
@@ -791,7 +786,7 @@ struct e1000_phy_info { | |||
791 | bool is_mdix; | 786 | bool is_mdix; |
792 | bool polarity_correction; | 787 | bool polarity_correction; |
793 | bool speed_downgraded; | 788 | bool speed_downgraded; |
794 | bool wait_for_link; | 789 | bool autoneg_wait_to_complete; |
795 | }; | 790 | }; |
796 | 791 | ||
797 | struct e1000_nvm_info { | 792 | struct e1000_nvm_info { |
@@ -816,6 +811,16 @@ struct e1000_bus_info { | |||
816 | u16 func; | 811 | u16 func; |
817 | }; | 812 | }; |
818 | 813 | ||
814 | struct e1000_fc_info { | ||
815 | u32 high_water; /* Flow control high-water mark */ | ||
816 | u32 low_water; /* Flow control low-water mark */ | ||
817 | u16 pause_time; /* Flow control pause timer */ | ||
818 | bool send_xon; /* Flow control send XON */ | ||
819 | bool strict_ieee; /* Strict IEEE mode */ | ||
820 | enum e1000_fc_type type; /* Type of flow control */ | ||
821 | enum e1000_fc_type original_type; | ||
822 | }; | ||
823 | |||
819 | struct e1000_dev_spec_82571 { | 824 | struct e1000_dev_spec_82571 { |
820 | bool laa_is_present; | 825 | bool laa_is_present; |
821 | bool alt_mac_addr_is_present; | 826 | bool alt_mac_addr_is_present; |
@@ -840,6 +845,7 @@ struct e1000_hw { | |||
840 | u8 __iomem *flash_address; | 845 | u8 __iomem *flash_address; |
841 | 846 | ||
842 | struct e1000_mac_info mac; | 847 | struct e1000_mac_info mac; |
848 | struct e1000_fc_info fc; | ||
843 | struct e1000_phy_info phy; | 849 | struct e1000_phy_info phy; |
844 | struct e1000_nvm_info nvm; | 850 | struct e1000_nvm_info nvm; |
845 | struct e1000_bus_info bus; | 851 | struct e1000_bus_info bus; |
@@ -849,8 +855,6 @@ struct e1000_hw { | |||
849 | struct e1000_dev_spec_82571 e82571; | 855 | struct e1000_dev_spec_82571 e82571; |
850 | struct e1000_dev_spec_ich8lan ich8lan; | 856 | struct e1000_dev_spec_ich8lan ich8lan; |
851 | } dev_spec; | 857 | } dev_spec; |
852 | |||
853 | enum e1000_media_type media_type; | ||
854 | }; | 858 | }; |
855 | 859 | ||
856 | #ifdef DEBUG | 860 | #ifdef DEBUG |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index eed1b449691a..e358a773e67a 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -298,7 +298,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter) | |||
298 | struct e1000_mac_info *mac = &hw->mac; | 298 | struct e1000_mac_info *mac = &hw->mac; |
299 | 299 | ||
300 | /* Set media type function pointer */ | 300 | /* Set media type function pointer */ |
301 | hw->media_type = e1000_media_type_copper; | 301 | hw->phy.media_type = e1000_media_type_copper; |
302 | 302 | ||
303 | /* Set mta register count */ | 303 | /* Set mta register count */ |
304 | mac->mta_reg_count = 32; | 304 | mac->mta_reg_count = 32; |
@@ -453,7 +453,7 @@ static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw) | |||
453 | 453 | ||
454 | udelay(1); | 454 | udelay(1); |
455 | 455 | ||
456 | if (phy->wait_for_link) { | 456 | if (phy->autoneg_wait_to_complete) { |
457 | hw_dbg(hw, "Waiting for forced speed/duplex link on IFE phy.\n"); | 457 | hw_dbg(hw, "Waiting for forced speed/duplex link on IFE phy.\n"); |
458 | 458 | ||
459 | ret_val = e1000e_phy_has_link_generic(hw, | 459 | ret_val = e1000e_phy_has_link_generic(hw, |
@@ -1852,7 +1852,6 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw) | |||
1852 | **/ | 1852 | **/ |
1853 | static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw) | 1853 | static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw) |
1854 | { | 1854 | { |
1855 | struct e1000_mac_info *mac = &hw->mac; | ||
1856 | s32 ret_val; | 1855 | s32 ret_val; |
1857 | 1856 | ||
1858 | if (e1000_check_reset_block(hw)) | 1857 | if (e1000_check_reset_block(hw)) |
@@ -1863,19 +1862,19 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw) | |||
1863 | * the default flow control setting, so we explicitly | 1862 | * the default flow control setting, so we explicitly |
1864 | * set it to full. | 1863 | * set it to full. |
1865 | */ | 1864 | */ |
1866 | if (mac->fc == e1000_fc_default) | 1865 | if (hw->fc.type == e1000_fc_default) |
1867 | mac->fc = e1000_fc_full; | 1866 | hw->fc.type = e1000_fc_full; |
1868 | 1867 | ||
1869 | mac->original_fc = mac->fc; | 1868 | hw->fc.original_type = hw->fc.type; |
1870 | 1869 | ||
1871 | hw_dbg(hw, "After fix-ups FlowControl is now = %x\n", mac->fc); | 1870 | hw_dbg(hw, "After fix-ups FlowControl is now = %x\n", hw->fc.type); |
1872 | 1871 | ||
1873 | /* Continue to configure the copper link. */ | 1872 | /* Continue to configure the copper link. */ |
1874 | ret_val = e1000_setup_copper_link_ich8lan(hw); | 1873 | ret_val = e1000_setup_copper_link_ich8lan(hw); |
1875 | if (ret_val) | 1874 | if (ret_val) |
1876 | return ret_val; | 1875 | return ret_val; |
1877 | 1876 | ||
1878 | ew32(FCTTV, mac->fc_pause_time); | 1877 | ew32(FCTTV, hw->fc.pause_time); |
1879 | 1878 | ||
1880 | return e1000e_set_fc_watermarks(hw); | 1879 | return e1000e_set_fc_watermarks(hw); |
1881 | } | 1880 | } |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 9c3ce719e8da..ea3ff6369c86 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -603,7 +603,6 @@ s32 e1000e_check_for_serdes_link(struct e1000_hw *hw) | |||
603 | **/ | 603 | **/ |
604 | static s32 e1000_set_default_fc_generic(struct e1000_hw *hw) | 604 | static s32 e1000_set_default_fc_generic(struct e1000_hw *hw) |
605 | { | 605 | { |
606 | struct e1000_mac_info *mac = &hw->mac; | ||
607 | s32 ret_val; | 606 | s32 ret_val; |
608 | u16 nvm_data; | 607 | u16 nvm_data; |
609 | 608 | ||
@@ -624,12 +623,12 @@ static s32 e1000_set_default_fc_generic(struct e1000_hw *hw) | |||
624 | } | 623 | } |
625 | 624 | ||
626 | if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 0) | 625 | if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 0) |
627 | mac->fc = e1000_fc_none; | 626 | hw->fc.type = e1000_fc_none; |
628 | else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == | 627 | else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == |
629 | NVM_WORD0F_ASM_DIR) | 628 | NVM_WORD0F_ASM_DIR) |
630 | mac->fc = e1000_fc_tx_pause; | 629 | hw->fc.type = e1000_fc_tx_pause; |
631 | else | 630 | else |
632 | mac->fc = e1000_fc_full; | 631 | hw->fc.type = e1000_fc_full; |
633 | 632 | ||
634 | return 0; | 633 | return 0; |
635 | } | 634 | } |
@@ -660,7 +659,7 @@ s32 e1000e_setup_link(struct e1000_hw *hw) | |||
660 | * If flow control is set to default, set flow control based on | 659 | * If flow control is set to default, set flow control based on |
661 | * the EEPROM flow control settings. | 660 | * the EEPROM flow control settings. |
662 | */ | 661 | */ |
663 | if (mac->fc == e1000_fc_default) { | 662 | if (hw->fc.type == e1000_fc_default) { |
664 | ret_val = e1000_set_default_fc_generic(hw); | 663 | ret_val = e1000_set_default_fc_generic(hw); |
665 | if (ret_val) | 664 | if (ret_val) |
666 | return ret_val; | 665 | return ret_val; |
@@ -671,9 +670,9 @@ s32 e1000e_setup_link(struct e1000_hw *hw) | |||
671 | * in case we get disconnected and then reconnected into a different | 670 | * in case we get disconnected and then reconnected into a different |
672 | * hub or switch with different Flow Control capabilities. | 671 | * hub or switch with different Flow Control capabilities. |
673 | */ | 672 | */ |
674 | mac->original_fc = mac->fc; | 673 | hw->fc.original_type = hw->fc.type; |
675 | 674 | ||
676 | hw_dbg(hw, "After fix-ups FlowControl is now = %x\n", mac->fc); | 675 | hw_dbg(hw, "After fix-ups FlowControl is now = %x\n", hw->fc.type); |
677 | 676 | ||
678 | /* Call the necessary media_type subroutine to configure the link. */ | 677 | /* Call the necessary media_type subroutine to configure the link. */ |
679 | ret_val = mac->ops.setup_physical_interface(hw); | 678 | ret_val = mac->ops.setup_physical_interface(hw); |
@@ -691,7 +690,7 @@ s32 e1000e_setup_link(struct e1000_hw *hw) | |||
691 | ew32(FCAH, FLOW_CONTROL_ADDRESS_HIGH); | 690 | ew32(FCAH, FLOW_CONTROL_ADDRESS_HIGH); |
692 | ew32(FCAL, FLOW_CONTROL_ADDRESS_LOW); | 691 | ew32(FCAL, FLOW_CONTROL_ADDRESS_LOW); |
693 | 692 | ||
694 | ew32(FCTTV, mac->fc_pause_time); | 693 | ew32(FCTTV, hw->fc.pause_time); |
695 | 694 | ||
696 | return e1000e_set_fc_watermarks(hw); | 695 | return e1000e_set_fc_watermarks(hw); |
697 | } | 696 | } |
@@ -725,7 +724,7 @@ static s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw) | |||
725 | * do not support receiving pause frames). | 724 | * do not support receiving pause frames). |
726 | * 3: Both Rx and Tx flow control (symmetric) are enabled. | 725 | * 3: Both Rx and Tx flow control (symmetric) are enabled. |
727 | */ | 726 | */ |
728 | switch (mac->fc) { | 727 | switch (hw->fc.type) { |
729 | case e1000_fc_none: | 728 | case e1000_fc_none: |
730 | /* Flow control completely disabled by a software over-ride. */ | 729 | /* Flow control completely disabled by a software over-ride. */ |
731 | txcw = (E1000_TXCW_ANE | E1000_TXCW_FD); | 730 | txcw = (E1000_TXCW_ANE | E1000_TXCW_FD); |
@@ -857,7 +856,7 @@ s32 e1000e_setup_fiber_serdes_link(struct e1000_hw *hw) | |||
857 | * detect a signal. If we have a signal, then poll for a "Link-Up" | 856 | * detect a signal. If we have a signal, then poll for a "Link-Up" |
858 | * indication. | 857 | * indication. |
859 | */ | 858 | */ |
860 | if (hw->media_type == e1000_media_type_internal_serdes || | 859 | if (hw->phy.media_type == e1000_media_type_internal_serdes || |
861 | (er32(CTRL) & E1000_CTRL_SWDPIN1)) { | 860 | (er32(CTRL) & E1000_CTRL_SWDPIN1)) { |
862 | ret_val = e1000_poll_fiber_serdes_link_generic(hw); | 861 | ret_val = e1000_poll_fiber_serdes_link_generic(hw); |
863 | } else { | 862 | } else { |
@@ -898,7 +897,6 @@ void e1000e_config_collision_dist(struct e1000_hw *hw) | |||
898 | **/ | 897 | **/ |
899 | s32 e1000e_set_fc_watermarks(struct e1000_hw *hw) | 898 | s32 e1000e_set_fc_watermarks(struct e1000_hw *hw) |
900 | { | 899 | { |
901 | struct e1000_mac_info *mac = &hw->mac; | ||
902 | u32 fcrtl = 0, fcrth = 0; | 900 | u32 fcrtl = 0, fcrth = 0; |
903 | 901 | ||
904 | /* | 902 | /* |
@@ -908,15 +906,15 @@ s32 e1000e_set_fc_watermarks(struct e1000_hw *hw) | |||
908 | * ability to transmit pause frames is not enabled, then these | 906 | * ability to transmit pause frames is not enabled, then these |
909 | * registers will be set to 0. | 907 | * registers will be set to 0. |
910 | */ | 908 | */ |
911 | if (mac->fc & e1000_fc_tx_pause) { | 909 | if (hw->fc.type & e1000_fc_tx_pause) { |
912 | /* | 910 | /* |
913 | * We need to set up the Receive Threshold high and low water | 911 | * We need to set up the Receive Threshold high and low water |
914 | * marks as well as (optionally) enabling the transmission of | 912 | * marks as well as (optionally) enabling the transmission of |
915 | * XON frames. | 913 | * XON frames. |
916 | */ | 914 | */ |
917 | fcrtl = mac->fc_low_water; | 915 | fcrtl = hw->fc.low_water; |
918 | fcrtl |= E1000_FCRTL_XONE; | 916 | fcrtl |= E1000_FCRTL_XONE; |
919 | fcrth = mac->fc_high_water; | 917 | fcrth = hw->fc.high_water; |
920 | } | 918 | } |
921 | ew32(FCRTL, fcrtl); | 919 | ew32(FCRTL, fcrtl); |
922 | ew32(FCRTH, fcrth); | 920 | ew32(FCRTH, fcrth); |
@@ -936,7 +934,6 @@ s32 e1000e_set_fc_watermarks(struct e1000_hw *hw) | |||
936 | **/ | 934 | **/ |
937 | s32 e1000e_force_mac_fc(struct e1000_hw *hw) | 935 | s32 e1000e_force_mac_fc(struct e1000_hw *hw) |
938 | { | 936 | { |
939 | struct e1000_mac_info *mac = &hw->mac; | ||
940 | u32 ctrl; | 937 | u32 ctrl; |
941 | 938 | ||
942 | ctrl = er32(CTRL); | 939 | ctrl = er32(CTRL); |
@@ -948,7 +945,7 @@ s32 e1000e_force_mac_fc(struct e1000_hw *hw) | |||
948 | * receive flow control. | 945 | * receive flow control. |
949 | * | 946 | * |
950 | * The "Case" statement below enables/disable flow control | 947 | * The "Case" statement below enables/disable flow control |
951 | * according to the "mac->fc" parameter. | 948 | * according to the "hw->fc.type" parameter. |
952 | * | 949 | * |
953 | * The possible values of the "fc" parameter are: | 950 | * The possible values of the "fc" parameter are: |
954 | * 0: Flow control is completely disabled | 951 | * 0: Flow control is completely disabled |
@@ -959,9 +956,9 @@ s32 e1000e_force_mac_fc(struct e1000_hw *hw) | |||
959 | * 3: Both Rx and Tx flow control (symmetric) is enabled. | 956 | * 3: Both Rx and Tx flow control (symmetric) is enabled. |
960 | * other: No other values should be possible at this point. | 957 | * other: No other values should be possible at this point. |
961 | */ | 958 | */ |
962 | hw_dbg(hw, "mac->fc = %u\n", mac->fc); | 959 | hw_dbg(hw, "hw->fc.type = %u\n", hw->fc.type); |
963 | 960 | ||
964 | switch (mac->fc) { | 961 | switch (hw->fc.type) { |
965 | case e1000_fc_none: | 962 | case e1000_fc_none: |
966 | ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE)); | 963 | ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE)); |
967 | break; | 964 | break; |
@@ -1009,11 +1006,11 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw) | |||
1009 | * configuration of the MAC to match the "fc" parameter. | 1006 | * configuration of the MAC to match the "fc" parameter. |
1010 | */ | 1007 | */ |
1011 | if (mac->autoneg_failed) { | 1008 | if (mac->autoneg_failed) { |
1012 | if (hw->media_type == e1000_media_type_fiber || | 1009 | if (hw->phy.media_type == e1000_media_type_fiber || |
1013 | hw->media_type == e1000_media_type_internal_serdes) | 1010 | hw->phy.media_type == e1000_media_type_internal_serdes) |
1014 | ret_val = e1000e_force_mac_fc(hw); | 1011 | ret_val = e1000e_force_mac_fc(hw); |
1015 | } else { | 1012 | } else { |
1016 | if (hw->media_type == e1000_media_type_copper) | 1013 | if (hw->phy.media_type == e1000_media_type_copper) |
1017 | ret_val = e1000e_force_mac_fc(hw); | 1014 | ret_val = e1000e_force_mac_fc(hw); |
1018 | } | 1015 | } |
1019 | 1016 | ||
@@ -1028,7 +1025,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw) | |||
1028 | * has completed, and if so, how the PHY and link partner has | 1025 | * has completed, and if so, how the PHY and link partner has |
1029 | * flow control configured. | 1026 | * flow control configured. |
1030 | */ | 1027 | */ |
1031 | if ((hw->media_type == e1000_media_type_copper) && mac->autoneg) { | 1028 | if ((hw->phy.media_type == e1000_media_type_copper) && mac->autoneg) { |
1032 | /* | 1029 | /* |
1033 | * Read the MII Status Register and check to see if AutoNeg | 1030 | * Read the MII Status Register and check to see if AutoNeg |
1034 | * has completed. We read this twice because this reg has | 1031 | * has completed. We read this twice because this reg has |
@@ -1105,11 +1102,11 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw) | |||
1105 | * ONLY. Hence, we must now check to see if we need to | 1102 | * ONLY. Hence, we must now check to see if we need to |
1106 | * turn OFF the TRANSMISSION of PAUSE frames. | 1103 | * turn OFF the TRANSMISSION of PAUSE frames. |
1107 | */ | 1104 | */ |
1108 | if (mac->original_fc == e1000_fc_full) { | 1105 | if (hw->fc.original_type == e1000_fc_full) { |
1109 | mac->fc = e1000_fc_full; | 1106 | hw->fc.type = e1000_fc_full; |
1110 | hw_dbg(hw, "Flow Control = FULL.\r\n"); | 1107 | hw_dbg(hw, "Flow Control = FULL.\r\n"); |
1111 | } else { | 1108 | } else { |
1112 | mac->fc = e1000_fc_rx_pause; | 1109 | hw->fc.type = e1000_fc_rx_pause; |
1113 | hw_dbg(hw, "Flow Control = " | 1110 | hw_dbg(hw, "Flow Control = " |
1114 | "RX PAUSE frames only.\r\n"); | 1111 | "RX PAUSE frames only.\r\n"); |
1115 | } | 1112 | } |
@@ -1127,8 +1124,8 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw) | |||
1127 | (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && | 1124 | (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && |
1128 | (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && | 1125 | (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && |
1129 | (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { | 1126 | (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { |
1130 | mac->fc = e1000_fc_tx_pause; | 1127 | hw->fc.type = e1000_fc_tx_pause; |
1131 | hw_dbg(hw, "Flow Control = TX PAUSE frames only.\r\n"); | 1128 | hw_dbg(hw, "Flow Control = Tx PAUSE frames only.\r\n"); |
1132 | } | 1129 | } |
1133 | /* | 1130 | /* |
1134 | * For transmitting PAUSE frames ONLY. | 1131 | * For transmitting PAUSE frames ONLY. |
@@ -1143,14 +1140,14 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw) | |||
1143 | (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && | 1140 | (mii_nway_adv_reg & NWAY_AR_ASM_DIR) && |
1144 | !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && | 1141 | !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && |
1145 | (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { | 1142 | (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { |
1146 | mac->fc = e1000_fc_rx_pause; | 1143 | hw->fc.type = e1000_fc_rx_pause; |
1147 | hw_dbg(hw, "Flow Control = RX PAUSE frames only.\r\n"); | 1144 | hw_dbg(hw, "Flow Control = Rx PAUSE frames only.\r\n"); |
1148 | } else { | 1145 | } else { |
1149 | /* | 1146 | /* |
1150 | * Per the IEEE spec, at this point flow control | 1147 | * Per the IEEE spec, at this point flow control |
1151 | * should be disabled. | 1148 | * should be disabled. |
1152 | */ | 1149 | */ |
1153 | mac->fc = e1000_fc_none; | 1150 | hw->fc.type = e1000_fc_none; |
1154 | hw_dbg(hw, "Flow Control = NONE.\r\n"); | 1151 | hw_dbg(hw, "Flow Control = NONE.\r\n"); |
1155 | } | 1152 | } |
1156 | 1153 | ||
@@ -1166,7 +1163,7 @@ s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw) | |||
1166 | } | 1163 | } |
1167 | 1164 | ||
1168 | if (duplex == HALF_DUPLEX) | 1165 | if (duplex == HALF_DUPLEX) |
1169 | mac->fc = e1000_fc_none; | 1166 | hw->fc.type = e1000_fc_none; |
1170 | 1167 | ||
1171 | /* | 1168 | /* |
1172 | * Now we call a subroutine to actually force the MAC | 1169 | * Now we call a subroutine to actually force the MAC |
@@ -1436,7 +1433,7 @@ s32 e1000e_blink_led(struct e1000_hw *hw) | |||
1436 | u32 ledctl_blink = 0; | 1433 | u32 ledctl_blink = 0; |
1437 | u32 i; | 1434 | u32 i; |
1438 | 1435 | ||
1439 | if (hw->media_type == e1000_media_type_fiber) { | 1436 | if (hw->phy.media_type == e1000_media_type_fiber) { |
1440 | /* always blink LED0 for PCI-E fiber */ | 1437 | /* always blink LED0 for PCI-E fiber */ |
1441 | ledctl_blink = E1000_LEDCTL_LED0_BLINK | | 1438 | ledctl_blink = E1000_LEDCTL_LED0_BLINK | |
1442 | (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED0_MODE_SHIFT); | 1439 | (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED0_MODE_SHIFT); |
@@ -1468,7 +1465,7 @@ s32 e1000e_led_on_generic(struct e1000_hw *hw) | |||
1468 | { | 1465 | { |
1469 | u32 ctrl; | 1466 | u32 ctrl; |
1470 | 1467 | ||
1471 | switch (hw->media_type) { | 1468 | switch (hw->phy.media_type) { |
1472 | case e1000_media_type_fiber: | 1469 | case e1000_media_type_fiber: |
1473 | ctrl = er32(CTRL); | 1470 | ctrl = er32(CTRL); |
1474 | ctrl &= ~E1000_CTRL_SWDPIN0; | 1471 | ctrl &= ~E1000_CTRL_SWDPIN0; |
@@ -1495,7 +1492,7 @@ s32 e1000e_led_off_generic(struct e1000_hw *hw) | |||
1495 | { | 1492 | { |
1496 | u32 ctrl; | 1493 | u32 ctrl; |
1497 | 1494 | ||
1498 | switch (hw->media_type) { | 1495 | switch (hw->phy.media_type) { |
1499 | case e1000_media_type_fiber: | 1496 | case e1000_media_type_fiber: |
1500 | ctrl = er32(CTRL); | 1497 | ctrl = er32(CTRL); |
1501 | ctrl |= E1000_CTRL_SWDPIN0; | 1498 | ctrl |= E1000_CTRL_SWDPIN0; |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 2e07534c35f7..d70bde03619e 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -878,6 +878,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data) | |||
878 | /* disable receives */ | 878 | /* disable receives */ |
879 | u32 rctl = er32(RCTL); | 879 | u32 rctl = er32(RCTL); |
880 | ew32(RCTL, rctl & ~E1000_RCTL_EN); | 880 | ew32(RCTL, rctl & ~E1000_RCTL_EN); |
881 | adapter->flags |= FLAG_RX_RESTART_NOW; | ||
881 | } | 882 | } |
882 | /* guard against interrupt when we're going down */ | 883 | /* guard against interrupt when we're going down */ |
883 | if (!test_bit(__E1000_DOWN, &adapter->state)) | 884 | if (!test_bit(__E1000_DOWN, &adapter->state)) |
@@ -944,6 +945,7 @@ static irqreturn_t e1000_intr(int irq, void *data) | |||
944 | /* disable receives */ | 945 | /* disable receives */ |
945 | rctl = er32(RCTL); | 946 | rctl = er32(RCTL); |
946 | ew32(RCTL, rctl & ~E1000_RCTL_EN); | 947 | ew32(RCTL, rctl & ~E1000_RCTL_EN); |
948 | adapter->flags |= FLAG_RX_RESTART_NOW; | ||
947 | } | 949 | } |
948 | /* guard against interrupt when we're going down */ | 950 | /* guard against interrupt when we're going down */ |
949 | if (!test_bit(__E1000_DOWN, &adapter->state)) | 951 | if (!test_bit(__E1000_DOWN, &adapter->state)) |
@@ -1794,6 +1796,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1794 | } | 1796 | } |
1795 | 1797 | ||
1796 | ew32(RCTL, rctl); | 1798 | ew32(RCTL, rctl); |
1799 | /* just started the receive unit, no need to restart */ | ||
1800 | adapter->flags &= ~FLAG_RX_RESTART_NOW; | ||
1797 | } | 1801 | } |
1798 | 1802 | ||
1799 | /** | 1803 | /** |
@@ -2003,7 +2007,7 @@ void e1000e_power_up_phy(struct e1000_adapter *adapter) | |||
2003 | u16 mii_reg = 0; | 2007 | u16 mii_reg = 0; |
2004 | 2008 | ||
2005 | /* Just clear the power down bit to wake the phy back up */ | 2009 | /* Just clear the power down bit to wake the phy back up */ |
2006 | if (adapter->hw.media_type == e1000_media_type_copper) { | 2010 | if (adapter->hw.phy.media_type == e1000_media_type_copper) { |
2007 | /* | 2011 | /* |
2008 | * According to the manual, the phy will retain its | 2012 | * According to the manual, the phy will retain its |
2009 | * settings across a power-down/up cycle | 2013 | * settings across a power-down/up cycle |
@@ -2032,7 +2036,7 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter) | |||
2032 | return; | 2036 | return; |
2033 | 2037 | ||
2034 | /* non-copper PHY? */ | 2038 | /* non-copper PHY? */ |
2035 | if (adapter->hw.media_type != e1000_media_type_copper) | 2039 | if (adapter->hw.phy.media_type != e1000_media_type_copper) |
2036 | return; | 2040 | return; |
2037 | 2041 | ||
2038 | /* reset is blocked because of a SoL/IDER session */ | 2042 | /* reset is blocked because of a SoL/IDER session */ |
@@ -2061,15 +2065,16 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter) | |||
2061 | void e1000e_reset(struct e1000_adapter *adapter) | 2065 | void e1000e_reset(struct e1000_adapter *adapter) |
2062 | { | 2066 | { |
2063 | struct e1000_mac_info *mac = &adapter->hw.mac; | 2067 | struct e1000_mac_info *mac = &adapter->hw.mac; |
2068 | struct e1000_fc_info *fc = &adapter->hw.fc; | ||
2064 | struct e1000_hw *hw = &adapter->hw; | 2069 | struct e1000_hw *hw = &adapter->hw; |
2065 | u32 tx_space, min_tx_space, min_rx_space; | 2070 | u32 tx_space, min_tx_space, min_rx_space; |
2066 | u32 pba; | 2071 | u32 pba = adapter->pba; |
2067 | u16 hwm; | 2072 | u16 hwm; |
2068 | 2073 | ||
2069 | /* reset Packet Buffer Allocation to default */ | 2074 | /* reset Packet Buffer Allocation to default */ |
2070 | ew32(PBA, adapter->pba); | 2075 | ew32(PBA, pba); |
2071 | 2076 | ||
2072 | if (mac->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN ) { | 2077 | if (adapter->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN) { |
2073 | /* | 2078 | /* |
2074 | * To maintain wire speed transmits, the Tx FIFO should be | 2079 | * To maintain wire speed transmits, the Tx FIFO should be |
2075 | * large enough to accommodate two full transmit packets, | 2080 | * large enough to accommodate two full transmit packets, |
@@ -2086,13 +2091,14 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
2086 | /* | 2091 | /* |
2087 | * the Tx fifo also stores 16 bytes of information about the tx | 2092 | * the Tx fifo also stores 16 bytes of information about the tx |
2088 | * but don't include ethernet FCS because hardware appends it | 2093 | * but don't include ethernet FCS because hardware appends it |
2089 | */ min_tx_space = (mac->max_frame_size + | 2094 | */ |
2095 | min_tx_space = (adapter->max_frame_size + | ||
2090 | sizeof(struct e1000_tx_desc) - | 2096 | sizeof(struct e1000_tx_desc) - |
2091 | ETH_FCS_LEN) * 2; | 2097 | ETH_FCS_LEN) * 2; |
2092 | min_tx_space = ALIGN(min_tx_space, 1024); | 2098 | min_tx_space = ALIGN(min_tx_space, 1024); |
2093 | min_tx_space >>= 10; | 2099 | min_tx_space >>= 10; |
2094 | /* software strips receive CRC, so leave room for it */ | 2100 | /* software strips receive CRC, so leave room for it */ |
2095 | min_rx_space = mac->max_frame_size; | 2101 | min_rx_space = adapter->max_frame_size; |
2096 | min_rx_space = ALIGN(min_rx_space, 1024); | 2102 | min_rx_space = ALIGN(min_rx_space, 1024); |
2097 | min_rx_space >>= 10; | 2103 | min_rx_space >>= 10; |
2098 | 2104 | ||
@@ -2131,20 +2137,21 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
2131 | * - the full Rx FIFO size minus one full frame | 2137 | * - the full Rx FIFO size minus one full frame |
2132 | */ | 2138 | */ |
2133 | if (adapter->flags & FLAG_HAS_ERT) | 2139 | if (adapter->flags & FLAG_HAS_ERT) |
2134 | hwm = min(((adapter->pba << 10) * 9 / 10), | 2140 | hwm = min(((pba << 10) * 9 / 10), |
2135 | ((adapter->pba << 10) - (E1000_ERT_2048 << 3))); | 2141 | ((pba << 10) - (E1000_ERT_2048 << 3))); |
2136 | else | 2142 | else |
2137 | hwm = min(((adapter->pba << 10) * 9 / 10), | 2143 | hwm = min(((pba << 10) * 9 / 10), |
2138 | ((adapter->pba << 10) - mac->max_frame_size)); | 2144 | ((pba << 10) - adapter->max_frame_size)); |
2139 | 2145 | ||
2140 | mac->fc_high_water = hwm & 0xFFF8; /* 8-byte granularity */ | 2146 | fc->high_water = hwm & 0xFFF8; /* 8-byte granularity */ |
2141 | mac->fc_low_water = mac->fc_high_water - 8; | 2147 | fc->low_water = fc->high_water - 8; |
2142 | 2148 | ||
2143 | if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) | 2149 | if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) |
2144 | mac->fc_pause_time = 0xFFFF; | 2150 | fc->pause_time = 0xFFFF; |
2145 | else | 2151 | else |
2146 | mac->fc_pause_time = E1000_FC_PAUSE_TIME; | 2152 | fc->pause_time = E1000_FC_PAUSE_TIME; |
2147 | mac->fc = mac->original_fc; | 2153 | fc->send_xon = 1; |
2154 | fc->type = fc->original_type; | ||
2148 | 2155 | ||
2149 | /* Allow time for pending master requests to run */ | 2156 | /* Allow time for pending master requests to run */ |
2150 | mac->ops.reset_hw(hw); | 2157 | mac->ops.reset_hw(hw); |
@@ -2259,13 +2266,12 @@ void e1000e_reinit_locked(struct e1000_adapter *adapter) | |||
2259 | **/ | 2266 | **/ |
2260 | static int __devinit e1000_sw_init(struct e1000_adapter *adapter) | 2267 | static int __devinit e1000_sw_init(struct e1000_adapter *adapter) |
2261 | { | 2268 | { |
2262 | struct e1000_hw *hw = &adapter->hw; | ||
2263 | struct net_device *netdev = adapter->netdev; | 2269 | struct net_device *netdev = adapter->netdev; |
2264 | 2270 | ||
2265 | adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN; | 2271 | adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN; |
2266 | adapter->rx_ps_bsize0 = 128; | 2272 | adapter->rx_ps_bsize0 = 128; |
2267 | hw->mac.max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; | 2273 | adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; |
2268 | hw->mac.min_frame_size = ETH_ZLEN + ETH_FCS_LEN; | 2274 | adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; |
2269 | 2275 | ||
2270 | adapter->tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); | 2276 | adapter->tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); |
2271 | if (!adapter->tx_ring) | 2277 | if (!adapter->tx_ring) |
@@ -2611,7 +2617,7 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
2611 | /* Tx Dropped needs to be maintained elsewhere */ | 2617 | /* Tx Dropped needs to be maintained elsewhere */ |
2612 | 2618 | ||
2613 | /* Phy Stats */ | 2619 | /* Phy Stats */ |
2614 | if (hw->media_type == e1000_media_type_copper) { | 2620 | if (hw->phy.media_type == e1000_media_type_copper) { |
2615 | if ((adapter->link_speed == SPEED_1000) && | 2621 | if ((adapter->link_speed == SPEED_1000) && |
2616 | (!e1e_rphy(hw, PHY_1000T_STATUS, &phy_tmp))) { | 2622 | (!e1e_rphy(hw, PHY_1000T_STATUS, &phy_tmp))) { |
2617 | phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; | 2623 | phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; |
@@ -2629,8 +2635,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter) | |||
2629 | 2635 | ||
2630 | static void e1000_print_link_info(struct e1000_adapter *adapter) | 2636 | static void e1000_print_link_info(struct e1000_adapter *adapter) |
2631 | { | 2637 | { |
2632 | struct net_device *netdev = adapter->netdev; | ||
2633 | struct e1000_hw *hw = &adapter->hw; | 2638 | struct e1000_hw *hw = &adapter->hw; |
2639 | struct net_device *netdev = adapter->netdev; | ||
2634 | u32 ctrl = er32(CTRL); | 2640 | u32 ctrl = er32(CTRL); |
2635 | 2641 | ||
2636 | ndev_info(netdev, | 2642 | ndev_info(netdev, |
@@ -2644,6 +2650,62 @@ static void e1000_print_link_info(struct e1000_adapter *adapter) | |||
2644 | ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); | 2650 | ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); |
2645 | } | 2651 | } |
2646 | 2652 | ||
2653 | static bool e1000_has_link(struct e1000_adapter *adapter) | ||
2654 | { | ||
2655 | struct e1000_hw *hw = &adapter->hw; | ||
2656 | bool link_active = 0; | ||
2657 | s32 ret_val = 0; | ||
2658 | |||
2659 | /* | ||
2660 | * get_link_status is set on LSC (link status) interrupt or | ||
2661 | * Rx sequence error interrupt. get_link_status will stay | ||
2662 | * false until the check_for_link establishes link | ||
2663 | * for copper adapters ONLY | ||
2664 | */ | ||
2665 | switch (hw->phy.media_type) { | ||
2666 | case e1000_media_type_copper: | ||
2667 | if (hw->mac.get_link_status) { | ||
2668 | ret_val = hw->mac.ops.check_for_link(hw); | ||
2669 | link_active = !hw->mac.get_link_status; | ||
2670 | } else { | ||
2671 | link_active = 1; | ||
2672 | } | ||
2673 | break; | ||
2674 | case e1000_media_type_fiber: | ||
2675 | ret_val = hw->mac.ops.check_for_link(hw); | ||
2676 | link_active = !!(er32(STATUS) & E1000_STATUS_LU); | ||
2677 | break; | ||
2678 | case e1000_media_type_internal_serdes: | ||
2679 | ret_val = hw->mac.ops.check_for_link(hw); | ||
2680 | link_active = adapter->hw.mac.serdes_has_link; | ||
2681 | break; | ||
2682 | default: | ||
2683 | case e1000_media_type_unknown: | ||
2684 | break; | ||
2685 | } | ||
2686 | |||
2687 | if ((ret_val == E1000_ERR_PHY) && (hw->phy.type == e1000_phy_igp_3) && | ||
2688 | (er32(CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) { | ||
2689 | /* See e1000_kmrn_lock_loss_workaround_ich8lan() */ | ||
2690 | ndev_info(adapter->netdev, | ||
2691 | "Gigabit has been disabled, downgrading speed\n"); | ||
2692 | } | ||
2693 | |||
2694 | return link_active; | ||
2695 | } | ||
2696 | |||
2697 | static void e1000e_enable_receives(struct e1000_adapter *adapter) | ||
2698 | { | ||
2699 | /* make sure the receive unit is started */ | ||
2700 | if ((adapter->flags & FLAG_RX_NEEDS_RESTART) && | ||
2701 | (adapter->flags & FLAG_RX_RESTART_NOW)) { | ||
2702 | struct e1000_hw *hw = &adapter->hw; | ||
2703 | u32 rctl = er32(RCTL); | ||
2704 | ew32(RCTL, rctl | E1000_RCTL_EN); | ||
2705 | adapter->flags &= ~FLAG_RX_RESTART_NOW; | ||
2706 | } | ||
2707 | } | ||
2708 | |||
2647 | /** | 2709 | /** |
2648 | * e1000_watchdog - Timer Call-back | 2710 | * e1000_watchdog - Timer Call-back |
2649 | * @data: pointer to adapter cast into an unsigned long | 2711 | * @data: pointer to adapter cast into an unsigned long |
@@ -2662,42 +2724,27 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
2662 | { | 2724 | { |
2663 | struct e1000_adapter *adapter = container_of(work, | 2725 | struct e1000_adapter *adapter = container_of(work, |
2664 | struct e1000_adapter, watchdog_task); | 2726 | struct e1000_adapter, watchdog_task); |
2665 | |||
2666 | struct net_device *netdev = adapter->netdev; | 2727 | struct net_device *netdev = adapter->netdev; |
2667 | struct e1000_mac_info *mac = &adapter->hw.mac; | 2728 | struct e1000_mac_info *mac = &adapter->hw.mac; |
2668 | struct e1000_ring *tx_ring = adapter->tx_ring; | 2729 | struct e1000_ring *tx_ring = adapter->tx_ring; |
2669 | struct e1000_hw *hw = &adapter->hw; | 2730 | struct e1000_hw *hw = &adapter->hw; |
2670 | u32 link, tctl; | 2731 | u32 link, tctl; |
2671 | s32 ret_val; | ||
2672 | int tx_pending = 0; | 2732 | int tx_pending = 0; |
2673 | 2733 | ||
2674 | if ((netif_carrier_ok(netdev)) && | 2734 | link = e1000_has_link(adapter); |
2675 | (er32(STATUS) & E1000_STATUS_LU)) | 2735 | if ((netif_carrier_ok(netdev)) && link) { |
2736 | e1000e_enable_receives(adapter); | ||
2676 | goto link_up; | 2737 | goto link_up; |
2677 | |||
2678 | ret_val = mac->ops.check_for_link(hw); | ||
2679 | if ((ret_val == E1000_ERR_PHY) && | ||
2680 | (adapter->hw.phy.type == e1000_phy_igp_3) && | ||
2681 | (er32(CTRL) & | ||
2682 | E1000_PHY_CTRL_GBE_DISABLE)) { | ||
2683 | /* See e1000_kmrn_lock_loss_workaround_ich8lan() */ | ||
2684 | ndev_info(netdev, | ||
2685 | "Gigabit has been disabled, downgrading speed\n"); | ||
2686 | } | 2738 | } |
2687 | 2739 | ||
2688 | if ((e1000e_enable_tx_pkt_filtering(hw)) && | 2740 | if ((e1000e_enable_tx_pkt_filtering(hw)) && |
2689 | (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)) | 2741 | (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)) |
2690 | e1000_update_mng_vlan(adapter); | 2742 | e1000_update_mng_vlan(adapter); |
2691 | 2743 | ||
2692 | if ((adapter->hw.media_type == e1000_media_type_internal_serdes) && | ||
2693 | !(er32(TXCW) & E1000_TXCW_ANE)) | ||
2694 | link = adapter->hw.mac.serdes_has_link; | ||
2695 | else | ||
2696 | link = er32(STATUS) & E1000_STATUS_LU; | ||
2697 | |||
2698 | if (link) { | 2744 | if (link) { |
2699 | if (!netif_carrier_ok(netdev)) { | 2745 | if (!netif_carrier_ok(netdev)) { |
2700 | bool txb2b = 1; | 2746 | bool txb2b = 1; |
2747 | /* update snapshot of PHY registers on LSC */ | ||
2701 | mac->ops.get_link_up_info(&adapter->hw, | 2748 | mac->ops.get_link_up_info(&adapter->hw, |
2702 | &adapter->link_speed, | 2749 | &adapter->link_speed, |
2703 | &adapter->link_duplex); | 2750 | &adapter->link_duplex); |
@@ -2770,13 +2817,6 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
2770 | if (!test_bit(__E1000_DOWN, &adapter->state)) | 2817 | if (!test_bit(__E1000_DOWN, &adapter->state)) |
2771 | mod_timer(&adapter->phy_info_timer, | 2818 | mod_timer(&adapter->phy_info_timer, |
2772 | round_jiffies(jiffies + 2 * HZ)); | 2819 | round_jiffies(jiffies + 2 * HZ)); |
2773 | } else { | ||
2774 | /* make sure the receive unit is started */ | ||
2775 | if (adapter->flags & FLAG_RX_NEEDS_RESTART) { | ||
2776 | u32 rctl = er32(RCTL); | ||
2777 | ew32(RCTL, rctl | | ||
2778 | E1000_RCTL_EN); | ||
2779 | } | ||
2780 | } | 2820 | } |
2781 | } else { | 2821 | } else { |
2782 | if (netif_carrier_ok(netdev)) { | 2822 | if (netif_carrier_ok(netdev)) { |
@@ -3413,7 +3453,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
3413 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) | 3453 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
3414 | msleep(1); | 3454 | msleep(1); |
3415 | /* e1000e_down has a dependency on max_frame_size */ | 3455 | /* e1000e_down has a dependency on max_frame_size */ |
3416 | adapter->hw.mac.max_frame_size = max_frame; | 3456 | adapter->max_frame_size = max_frame; |
3417 | if (netif_running(netdev)) | 3457 | if (netif_running(netdev)) |
3418 | e1000e_down(adapter); | 3458 | e1000e_down(adapter); |
3419 | 3459 | ||
@@ -3462,7 +3502,7 @@ static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, | |||
3462 | struct mii_ioctl_data *data = if_mii(ifr); | 3502 | struct mii_ioctl_data *data = if_mii(ifr); |
3463 | unsigned long irq_flags; | 3503 | unsigned long irq_flags; |
3464 | 3504 | ||
3465 | if (adapter->hw.media_type != e1000_media_type_copper) | 3505 | if (adapter->hw.phy.media_type != e1000_media_type_copper) |
3466 | return -EOPNOTSUPP; | 3506 | return -EOPNOTSUPP; |
3467 | 3507 | ||
3468 | switch (cmd) { | 3508 | switch (cmd) { |
@@ -3544,8 +3584,9 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3544 | E1000_CTRL_EN_PHY_PWR_MGMT; | 3584 | E1000_CTRL_EN_PHY_PWR_MGMT; |
3545 | ew32(CTRL, ctrl); | 3585 | ew32(CTRL, ctrl); |
3546 | 3586 | ||
3547 | if (adapter->hw.media_type == e1000_media_type_fiber || | 3587 | if (adapter->hw.phy.media_type == e1000_media_type_fiber || |
3548 | adapter->hw.media_type == e1000_media_type_internal_serdes) { | 3588 | adapter->hw.phy.media_type == |
3589 | e1000_media_type_internal_serdes) { | ||
3549 | /* keep the laser running in D3 */ | 3590 | /* keep the laser running in D3 */ |
3550 | ctrl_ext = er32(CTRL_EXT); | 3591 | ctrl_ext = er32(CTRL_EXT); |
3551 | ctrl_ext |= E1000_CTRL_EXT_SDP7_DATA; | 3592 | ctrl_ext |= E1000_CTRL_EXT_SDP7_DATA; |
@@ -3939,10 +3980,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
3939 | 3980 | ||
3940 | hw->mac.ops.get_bus_info(&adapter->hw); | 3981 | hw->mac.ops.get_bus_info(&adapter->hw); |
3941 | 3982 | ||
3942 | adapter->hw.phy.wait_for_link = 0; | 3983 | adapter->hw.phy.autoneg_wait_to_complete = 0; |
3943 | 3984 | ||
3944 | /* Copper options */ | 3985 | /* Copper options */ |
3945 | if (adapter->hw.media_type == e1000_media_type_copper) { | 3986 | if (adapter->hw.phy.media_type == e1000_media_type_copper) { |
3946 | adapter->hw.phy.mdix = AUTO_ALL_MODES; | 3987 | adapter->hw.phy.mdix = AUTO_ALL_MODES; |
3947 | adapter->hw.phy.disable_polarity_correction = 0; | 3988 | adapter->hw.phy.disable_polarity_correction = 0; |
3948 | adapter->hw.phy.ms_type = e1000_ms_hw_default; | 3989 | adapter->hw.phy.ms_type = e1000_ms_hw_default; |
@@ -4028,8 +4069,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4028 | /* Initialize link parameters. User can change them with ethtool */ | 4069 | /* Initialize link parameters. User can change them with ethtool */ |
4029 | adapter->hw.mac.autoneg = 1; | 4070 | adapter->hw.mac.autoneg = 1; |
4030 | adapter->fc_autoneg = 1; | 4071 | adapter->fc_autoneg = 1; |
4031 | adapter->hw.mac.original_fc = e1000_fc_default; | 4072 | adapter->hw.fc.original_type = e1000_fc_default; |
4032 | adapter->hw.mac.fc = e1000_fc_default; | 4073 | adapter->hw.fc.type = e1000_fc_default; |
4033 | adapter->hw.phy.autoneg_advertised = 0x2f; | 4074 | adapter->hw.phy.autoneg_advertised = 0x2f; |
4034 | 4075 | ||
4035 | /* ring size defaults */ | 4076 | /* ring size defaults */ |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index a2da1c422354..3a4574caa75b 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -714,7 +714,7 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) | |||
714 | * other: No software override. The flow control configuration | 714 | * other: No software override. The flow control configuration |
715 | * in the EEPROM is used. | 715 | * in the EEPROM is used. |
716 | */ | 716 | */ |
717 | switch (hw->mac.fc) { | 717 | switch (hw->fc.type) { |
718 | case e1000_fc_none: | 718 | case e1000_fc_none: |
719 | /* | 719 | /* |
720 | * Flow control (Rx & Tx) is completely disabled by a | 720 | * Flow control (Rx & Tx) is completely disabled by a |
@@ -822,7 +822,7 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) | |||
822 | * Does the user want to wait for Auto-Neg to complete here, or | 822 | * Does the user want to wait for Auto-Neg to complete here, or |
823 | * check at a later time (for example, callback routine). | 823 | * check at a later time (for example, callback routine). |
824 | */ | 824 | */ |
825 | if (phy->wait_for_link) { | 825 | if (phy->autoneg_wait_to_complete) { |
826 | ret_val = e1000_wait_autoneg(hw); | 826 | ret_val = e1000_wait_autoneg(hw); |
827 | if (ret_val) { | 827 | if (ret_val) { |
828 | hw_dbg(hw, "Error while waiting for " | 828 | hw_dbg(hw, "Error while waiting for " |
@@ -937,7 +937,7 @@ s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw) | |||
937 | 937 | ||
938 | udelay(1); | 938 | udelay(1); |
939 | 939 | ||
940 | if (phy->wait_for_link) { | 940 | if (phy->autoneg_wait_to_complete) { |
941 | hw_dbg(hw, "Waiting for forced speed/duplex link on IGP phy.\n"); | 941 | hw_dbg(hw, "Waiting for forced speed/duplex link on IGP phy.\n"); |
942 | 942 | ||
943 | ret_val = e1000e_phy_has_link_generic(hw, | 943 | ret_val = e1000e_phy_has_link_generic(hw, |
@@ -1009,7 +1009,7 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
1009 | 1009 | ||
1010 | udelay(1); | 1010 | udelay(1); |
1011 | 1011 | ||
1012 | if (phy->wait_for_link) { | 1012 | if (phy->autoneg_wait_to_complete) { |
1013 | hw_dbg(hw, "Waiting for forced speed/duplex link on M88 phy.\n"); | 1013 | hw_dbg(hw, "Waiting for forced speed/duplex link on M88 phy.\n"); |
1014 | 1014 | ||
1015 | ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, | 1015 | ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, |
@@ -1084,7 +1084,7 @@ void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl) | |||
1084 | u32 ctrl; | 1084 | u32 ctrl; |
1085 | 1085 | ||
1086 | /* Turn off flow control when forcing speed/duplex */ | 1086 | /* Turn off flow control when forcing speed/duplex */ |
1087 | mac->fc = e1000_fc_none; | 1087 | hw->fc.type = e1000_fc_none; |
1088 | 1088 | ||
1089 | /* Force speed/duplex on the mac */ | 1089 | /* Force speed/duplex on the mac */ |
1090 | ctrl = er32(CTRL); | 1090 | ctrl = er32(CTRL); |
@@ -1508,7 +1508,7 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw) | |||
1508 | u16 phy_data; | 1508 | u16 phy_data; |
1509 | bool link; | 1509 | bool link; |
1510 | 1510 | ||
1511 | if (hw->media_type != e1000_media_type_copper) { | 1511 | if (hw->phy.media_type != e1000_media_type_copper) { |
1512 | hw_dbg(hw, "Phy info is only valid for copper media\n"); | 1512 | hw_dbg(hw, "Phy info is only valid for copper media\n"); |
1513 | return -E1000_ERR_CONFIG; | 1513 | return -E1000_ERR_CONFIG; |
1514 | } | 1514 | } |