diff options
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r-- | drivers/net/e1000e/e1000.h | 6 | ||||
-rw-r--r-- | drivers/net/e1000e/ich8lan.c | 216 | ||||
-rw-r--r-- | drivers/net/e1000e/phy.c | 191 |
3 files changed, 204 insertions, 209 deletions
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index b9f9e7836fad..cebbd9079d53 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -590,6 +590,12 @@ extern s32 e1000_get_phy_info_82577(struct e1000_hw *hw); | |||
590 | extern s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw); | 590 | extern s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw); |
591 | extern s32 e1000_get_cable_length_82577(struct e1000_hw *hw); | 591 | extern s32 e1000_get_cable_length_82577(struct e1000_hw *hw); |
592 | 592 | ||
593 | extern s32 e1000_check_polarity_m88(struct e1000_hw *hw); | ||
594 | extern s32 e1000_get_phy_info_ife(struct e1000_hw *hw); | ||
595 | extern s32 e1000_check_polarity_ife(struct e1000_hw *hw); | ||
596 | extern s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw); | ||
597 | extern s32 e1000_check_polarity_igp(struct e1000_hw *hw); | ||
598 | |||
593 | static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw) | 599 | static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw) |
594 | { | 600 | { |
595 | return hw->phy.ops.reset(hw); | 601 | return hw->phy.ops.reset(hw); |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 6efb77fbbd70..7b33be98a2ca 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -195,7 +195,6 @@ union ich8_flash_protected_range { | |||
195 | static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw); | 195 | static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw); |
196 | static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw); | 196 | static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw); |
197 | static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw); | 197 | static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw); |
198 | static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw); | ||
199 | static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank); | 198 | static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank); |
200 | static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw, | 199 | static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw, |
201 | u32 offset, u8 byte); | 200 | u32 offset, u8 byte); |
@@ -260,7 +259,6 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
260 | phy->addr = 1; | 259 | phy->addr = 1; |
261 | phy->reset_delay_us = 100; | 260 | phy->reset_delay_us = 100; |
262 | 261 | ||
263 | phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan; | ||
264 | phy->ops.read_reg = e1000_read_phy_reg_hv; | 262 | phy->ops.read_reg = e1000_read_phy_reg_hv; |
265 | phy->ops.read_reg_locked = e1000_read_phy_reg_hv_locked; | 263 | phy->ops.read_reg_locked = e1000_read_phy_reg_hv_locked; |
266 | phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan; | 264 | phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan; |
@@ -275,13 +273,23 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
275 | e1000e_get_phy_id(hw); | 273 | e1000e_get_phy_id(hw); |
276 | phy->type = e1000e_get_phy_type_from_id(phy->id); | 274 | phy->type = e1000e_get_phy_type_from_id(phy->id); |
277 | 275 | ||
278 | if (phy->type == e1000_phy_82577) { | 276 | switch (phy->type) { |
277 | case e1000_phy_82577: | ||
279 | phy->ops.check_polarity = e1000_check_polarity_82577; | 278 | phy->ops.check_polarity = e1000_check_polarity_82577; |
280 | phy->ops.force_speed_duplex = | 279 | phy->ops.force_speed_duplex = |
281 | e1000_phy_force_speed_duplex_82577; | 280 | e1000_phy_force_speed_duplex_82577; |
282 | phy->ops.get_cable_length = e1000_get_cable_length_82577; | 281 | phy->ops.get_cable_length = e1000_get_cable_length_82577; |
283 | phy->ops.get_info = e1000_get_phy_info_82577; | 282 | phy->ops.get_info = e1000_get_phy_info_82577; |
284 | phy->ops.commit = e1000e_phy_sw_reset; | 283 | phy->ops.commit = e1000e_phy_sw_reset; |
284 | case e1000_phy_82578: | ||
285 | phy->ops.check_polarity = e1000_check_polarity_m88; | ||
286 | phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_m88; | ||
287 | phy->ops.get_cable_length = e1000e_get_cable_length_m88; | ||
288 | phy->ops.get_info = e1000e_get_phy_info_m88; | ||
289 | break; | ||
290 | default: | ||
291 | ret_val = -E1000_ERR_PHY; | ||
292 | break; | ||
285 | } | 293 | } |
286 | 294 | ||
287 | return ret_val; | 295 | return ret_val; |
@@ -336,12 +344,18 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) | |||
336 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 344 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
337 | phy->ops.read_reg_locked = e1000e_read_phy_reg_igp_locked; | 345 | phy->ops.read_reg_locked = e1000e_read_phy_reg_igp_locked; |
338 | phy->ops.write_reg_locked = e1000e_write_phy_reg_igp_locked; | 346 | phy->ops.write_reg_locked = e1000e_write_phy_reg_igp_locked; |
347 | phy->ops.get_info = e1000e_get_phy_info_igp; | ||
348 | phy->ops.check_polarity = e1000_check_polarity_igp; | ||
349 | phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_igp; | ||
339 | break; | 350 | break; |
340 | case IFE_E_PHY_ID: | 351 | case IFE_E_PHY_ID: |
341 | case IFE_PLUS_E_PHY_ID: | 352 | case IFE_PLUS_E_PHY_ID: |
342 | case IFE_C_E_PHY_ID: | 353 | case IFE_C_E_PHY_ID: |
343 | phy->type = e1000_phy_ife; | 354 | phy->type = e1000_phy_ife; |
344 | phy->autoneg_mask = E1000_ALL_NOT_GIG; | 355 | phy->autoneg_mask = E1000_ALL_NOT_GIG; |
356 | phy->ops.get_info = e1000_get_phy_info_ife; | ||
357 | phy->ops.check_polarity = e1000_check_polarity_ife; | ||
358 | phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_ife; | ||
345 | break; | 359 | break; |
346 | case BME1000_E_PHY_ID: | 360 | case BME1000_E_PHY_ID: |
347 | phy->type = e1000_phy_bm; | 361 | phy->type = e1000_phy_bm; |
@@ -349,14 +363,15 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) | |||
349 | phy->ops.read_reg = e1000e_read_phy_reg_bm; | 363 | phy->ops.read_reg = e1000e_read_phy_reg_bm; |
350 | phy->ops.write_reg = e1000e_write_phy_reg_bm; | 364 | phy->ops.write_reg = e1000e_write_phy_reg_bm; |
351 | phy->ops.commit = e1000e_phy_sw_reset; | 365 | phy->ops.commit = e1000e_phy_sw_reset; |
366 | phy->ops.get_info = e1000e_get_phy_info_m88; | ||
367 | phy->ops.check_polarity = e1000_check_polarity_m88; | ||
368 | phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_m88; | ||
352 | break; | 369 | break; |
353 | default: | 370 | default: |
354 | return -E1000_ERR_PHY; | 371 | return -E1000_ERR_PHY; |
355 | break; | 372 | break; |
356 | } | 373 | } |
357 | 374 | ||
358 | phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan; | ||
359 | |||
360 | return 0; | 375 | return 0; |
361 | } | 376 | } |
362 | 377 | ||
@@ -740,77 +755,6 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) | |||
740 | } | 755 | } |
741 | 756 | ||
742 | /** | 757 | /** |
743 | * e1000_phy_force_speed_duplex_ich8lan - Force PHY speed & duplex | ||
744 | * @hw: pointer to the HW structure | ||
745 | * | ||
746 | * Forces the speed and duplex settings of the PHY. | ||
747 | * This is a function pointer entry point only called by | ||
748 | * PHY setup routines. | ||
749 | **/ | ||
750 | static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw) | ||
751 | { | ||
752 | struct e1000_phy_info *phy = &hw->phy; | ||
753 | s32 ret_val; | ||
754 | u16 data; | ||
755 | bool link; | ||
756 | |||
757 | if (phy->type != e1000_phy_ife) { | ||
758 | ret_val = e1000e_phy_force_speed_duplex_igp(hw); | ||
759 | return ret_val; | ||
760 | } | ||
761 | |||
762 | ret_val = e1e_rphy(hw, PHY_CONTROL, &data); | ||
763 | if (ret_val) | ||
764 | return ret_val; | ||
765 | |||
766 | e1000e_phy_force_speed_duplex_setup(hw, &data); | ||
767 | |||
768 | ret_val = e1e_wphy(hw, PHY_CONTROL, data); | ||
769 | if (ret_val) | ||
770 | return ret_val; | ||
771 | |||
772 | /* Disable MDI-X support for 10/100 */ | ||
773 | ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); | ||
774 | if (ret_val) | ||
775 | return ret_val; | ||
776 | |||
777 | data &= ~IFE_PMC_AUTO_MDIX; | ||
778 | data &= ~IFE_PMC_FORCE_MDIX; | ||
779 | |||
780 | ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, data); | ||
781 | if (ret_val) | ||
782 | return ret_val; | ||
783 | |||
784 | e_dbg("IFE PMC: %X\n", data); | ||
785 | |||
786 | udelay(1); | ||
787 | |||
788 | if (phy->autoneg_wait_to_complete) { | ||
789 | e_dbg("Waiting for forced speed/duplex link on IFE phy.\n"); | ||
790 | |||
791 | ret_val = e1000e_phy_has_link_generic(hw, | ||
792 | PHY_FORCE_LIMIT, | ||
793 | 100000, | ||
794 | &link); | ||
795 | if (ret_val) | ||
796 | return ret_val; | ||
797 | |||
798 | if (!link) | ||
799 | e_dbg("Link taking longer than expected.\n"); | ||
800 | |||
801 | /* Try once more */ | ||
802 | ret_val = e1000e_phy_has_link_generic(hw, | ||
803 | PHY_FORCE_LIMIT, | ||
804 | 100000, | ||
805 | &link); | ||
806 | if (ret_val) | ||
807 | return ret_val; | ||
808 | } | ||
809 | |||
810 | return 0; | ||
811 | } | ||
812 | |||
813 | /** | ||
814 | * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration | 758 | * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration |
815 | * @hw: pointer to the HW structure | 759 | * @hw: pointer to the HW structure |
816 | * | 760 | * |
@@ -1262,122 +1206,6 @@ out: | |||
1262 | } | 1206 | } |
1263 | 1207 | ||
1264 | /** | 1208 | /** |
1265 | * e1000_get_phy_info_ife_ich8lan - Retrieves various IFE PHY states | ||
1266 | * @hw: pointer to the HW structure | ||
1267 | * | ||
1268 | * Populates "phy" structure with various feature states. | ||
1269 | * This function is only called by other family-specific | ||
1270 | * routines. | ||
1271 | **/ | ||
1272 | static s32 e1000_get_phy_info_ife_ich8lan(struct e1000_hw *hw) | ||
1273 | { | ||
1274 | struct e1000_phy_info *phy = &hw->phy; | ||
1275 | s32 ret_val; | ||
1276 | u16 data; | ||
1277 | bool link; | ||
1278 | |||
1279 | ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); | ||
1280 | if (ret_val) | ||
1281 | return ret_val; | ||
1282 | |||
1283 | if (!link) { | ||
1284 | e_dbg("Phy info is only valid if link is up\n"); | ||
1285 | return -E1000_ERR_CONFIG; | ||
1286 | } | ||
1287 | |||
1288 | ret_val = e1e_rphy(hw, IFE_PHY_SPECIAL_CONTROL, &data); | ||
1289 | if (ret_val) | ||
1290 | return ret_val; | ||
1291 | phy->polarity_correction = (!(data & IFE_PSC_AUTO_POLARITY_DISABLE)); | ||
1292 | |||
1293 | if (phy->polarity_correction) { | ||
1294 | ret_val = phy->ops.check_polarity(hw); | ||
1295 | if (ret_val) | ||
1296 | return ret_val; | ||
1297 | } else { | ||
1298 | /* Polarity is forced */ | ||
1299 | phy->cable_polarity = (data & IFE_PSC_FORCE_POLARITY) | ||
1300 | ? e1000_rev_polarity_reversed | ||
1301 | : e1000_rev_polarity_normal; | ||
1302 | } | ||
1303 | |||
1304 | ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); | ||
1305 | if (ret_val) | ||
1306 | return ret_val; | ||
1307 | |||
1308 | phy->is_mdix = (data & IFE_PMC_MDIX_STATUS); | ||
1309 | |||
1310 | /* The following parameters are undefined for 10/100 operation. */ | ||
1311 | phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; | ||
1312 | phy->local_rx = e1000_1000t_rx_status_undefined; | ||
1313 | phy->remote_rx = e1000_1000t_rx_status_undefined; | ||
1314 | |||
1315 | return 0; | ||
1316 | } | ||
1317 | |||
1318 | /** | ||
1319 | * e1000_get_phy_info_ich8lan - Calls appropriate PHY type get_phy_info | ||
1320 | * @hw: pointer to the HW structure | ||
1321 | * | ||
1322 | * Wrapper for calling the get_phy_info routines for the appropriate phy type. | ||
1323 | * This is a function pointer entry point called by drivers | ||
1324 | * or other shared routines. | ||
1325 | **/ | ||
1326 | static s32 e1000_get_phy_info_ich8lan(struct e1000_hw *hw) | ||
1327 | { | ||
1328 | switch (hw->phy.type) { | ||
1329 | case e1000_phy_ife: | ||
1330 | return e1000_get_phy_info_ife_ich8lan(hw); | ||
1331 | break; | ||
1332 | case e1000_phy_igp_3: | ||
1333 | case e1000_phy_bm: | ||
1334 | case e1000_phy_82578: | ||
1335 | case e1000_phy_82577: | ||
1336 | return e1000e_get_phy_info_igp(hw); | ||
1337 | break; | ||
1338 | default: | ||
1339 | break; | ||
1340 | } | ||
1341 | |||
1342 | return -E1000_ERR_PHY_TYPE; | ||
1343 | } | ||
1344 | |||
1345 | /** | ||
1346 | * e1000_check_polarity_ife_ich8lan - Check cable polarity for IFE PHY | ||
1347 | * @hw: pointer to the HW structure | ||
1348 | * | ||
1349 | * Polarity is determined on the polarity reversal feature being enabled. | ||
1350 | * This function is only called by other family-specific | ||
1351 | * routines. | ||
1352 | **/ | ||
1353 | static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw) | ||
1354 | { | ||
1355 | struct e1000_phy_info *phy = &hw->phy; | ||
1356 | s32 ret_val; | ||
1357 | u16 phy_data, offset, mask; | ||
1358 | |||
1359 | /* | ||
1360 | * Polarity is determined based on the reversal feature being enabled. | ||
1361 | */ | ||
1362 | if (phy->polarity_correction) { | ||
1363 | offset = IFE_PHY_EXTENDED_STATUS_CONTROL; | ||
1364 | mask = IFE_PESC_POLARITY_REVERSED; | ||
1365 | } else { | ||
1366 | offset = IFE_PHY_SPECIAL_CONTROL; | ||
1367 | mask = IFE_PSC_FORCE_POLARITY; | ||
1368 | } | ||
1369 | |||
1370 | ret_val = e1e_rphy(hw, offset, &phy_data); | ||
1371 | |||
1372 | if (!ret_val) | ||
1373 | phy->cable_polarity = (phy_data & mask) | ||
1374 | ? e1000_rev_polarity_reversed | ||
1375 | : e1000_rev_polarity_normal; | ||
1376 | |||
1377 | return ret_val; | ||
1378 | } | ||
1379 | |||
1380 | /** | ||
1381 | * e1000_set_lplu_state_pchlan - Set Low Power Link Up state | 1209 | * e1000_set_lplu_state_pchlan - Set Low Power Link Up state |
1382 | * @hw: pointer to the HW structure | 1210 | * @hw: pointer to the HW structure |
1383 | * @active: true to enable LPLU, false to disable | 1211 | * @active: true to enable LPLU, false to disable |
@@ -3485,10 +3313,8 @@ static struct e1000_phy_operations ich8_phy_ops = { | |||
3485 | .acquire = e1000_acquire_swflag_ich8lan, | 3313 | .acquire = e1000_acquire_swflag_ich8lan, |
3486 | .check_reset_block = e1000_check_reset_block_ich8lan, | 3314 | .check_reset_block = e1000_check_reset_block_ich8lan, |
3487 | .commit = NULL, | 3315 | .commit = NULL, |
3488 | .force_speed_duplex = e1000_phy_force_speed_duplex_ich8lan, | ||
3489 | .get_cfg_done = e1000_get_cfg_done_ich8lan, | 3316 | .get_cfg_done = e1000_get_cfg_done_ich8lan, |
3490 | .get_cable_length = e1000e_get_cable_length_igp_2, | 3317 | .get_cable_length = e1000e_get_cable_length_igp_2, |
3491 | .get_info = e1000_get_phy_info_ich8lan, | ||
3492 | .read_reg = e1000e_read_phy_reg_igp, | 3318 | .read_reg = e1000e_read_phy_reg_igp, |
3493 | .release = e1000_release_swflag_ich8lan, | 3319 | .release = e1000_release_swflag_ich8lan, |
3494 | .reset = e1000_phy_hw_reset_ich8lan, | 3320 | .reset = e1000_phy_hw_reset_ich8lan, |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index 67a718862e70..55a2c0acfee7 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -1322,17 +1322,22 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
1322 | return ret_val; | 1322 | return ret_val; |
1323 | 1323 | ||
1324 | if (!link) { | 1324 | if (!link) { |
1325 | /* | 1325 | if (hw->phy.type != e1000_phy_m88) { |
1326 | * We didn't get link. | 1326 | e_dbg("Link taking longer than expected.\n"); |
1327 | * Reset the DSP and cross our fingers. | 1327 | } else { |
1328 | */ | 1328 | /* |
1329 | ret_val = e1e_wphy(hw, M88E1000_PHY_PAGE_SELECT, | 1329 | * We didn't get link. |
1330 | 0x001d); | 1330 | * Reset the DSP and cross our fingers. |
1331 | if (ret_val) | 1331 | */ |
1332 | return ret_val; | 1332 | ret_val = e1e_wphy(hw, |
1333 | ret_val = e1000e_phy_reset_dsp(hw); | 1333 | M88E1000_PHY_PAGE_SELECT, |
1334 | if (ret_val) | 1334 | 0x001d); |
1335 | return ret_val; | 1335 | if (ret_val) |
1336 | return ret_val; | ||
1337 | ret_val = e1000e_phy_reset_dsp(hw); | ||
1338 | if (ret_val) | ||
1339 | return ret_val; | ||
1340 | } | ||
1336 | } | 1341 | } |
1337 | 1342 | ||
1338 | /* Try once more */ | 1343 | /* Try once more */ |
@@ -1342,6 +1347,9 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
1342 | return ret_val; | 1347 | return ret_val; |
1343 | } | 1348 | } |
1344 | 1349 | ||
1350 | if (hw->phy.type != e1000_phy_m88) | ||
1351 | return 0; | ||
1352 | |||
1345 | ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); | 1353 | ret_val = e1e_rphy(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); |
1346 | if (ret_val) | 1354 | if (ret_val) |
1347 | return ret_val; | 1355 | return ret_val; |
@@ -1371,6 +1379,73 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
1371 | } | 1379 | } |
1372 | 1380 | ||
1373 | /** | 1381 | /** |
1382 | * e1000_phy_force_speed_duplex_ife - Force PHY speed & duplex | ||
1383 | * @hw: pointer to the HW structure | ||
1384 | * | ||
1385 | * Forces the speed and duplex settings of the PHY. | ||
1386 | * This is a function pointer entry point only called by | ||
1387 | * PHY setup routines. | ||
1388 | **/ | ||
1389 | s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw) | ||
1390 | { | ||
1391 | struct e1000_phy_info *phy = &hw->phy; | ||
1392 | s32 ret_val; | ||
1393 | u16 data; | ||
1394 | bool link; | ||
1395 | |||
1396 | ret_val = e1e_rphy(hw, PHY_CONTROL, &data); | ||
1397 | if (ret_val) | ||
1398 | goto out; | ||
1399 | |||
1400 | e1000e_phy_force_speed_duplex_setup(hw, &data); | ||
1401 | |||
1402 | ret_val = e1e_wphy(hw, PHY_CONTROL, data); | ||
1403 | if (ret_val) | ||
1404 | goto out; | ||
1405 | |||
1406 | /* Disable MDI-X support for 10/100 */ | ||
1407 | ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); | ||
1408 | if (ret_val) | ||
1409 | goto out; | ||
1410 | |||
1411 | data &= ~IFE_PMC_AUTO_MDIX; | ||
1412 | data &= ~IFE_PMC_FORCE_MDIX; | ||
1413 | |||
1414 | ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, data); | ||
1415 | if (ret_val) | ||
1416 | goto out; | ||
1417 | |||
1418 | e_dbg("IFE PMC: %X\n", data); | ||
1419 | |||
1420 | udelay(1); | ||
1421 | |||
1422 | if (phy->autoneg_wait_to_complete) { | ||
1423 | e_dbg("Waiting for forced speed/duplex link on IFE phy.\n"); | ||
1424 | |||
1425 | ret_val = e1000e_phy_has_link_generic(hw, | ||
1426 | PHY_FORCE_LIMIT, | ||
1427 | 100000, | ||
1428 | &link); | ||
1429 | if (ret_val) | ||
1430 | goto out; | ||
1431 | |||
1432 | if (!link) | ||
1433 | e_dbg("Link taking longer than expected.\n"); | ||
1434 | |||
1435 | /* Try once more */ | ||
1436 | ret_val = e1000e_phy_has_link_generic(hw, | ||
1437 | PHY_FORCE_LIMIT, | ||
1438 | 100000, | ||
1439 | &link); | ||
1440 | if (ret_val) | ||
1441 | goto out; | ||
1442 | } | ||
1443 | |||
1444 | out: | ||
1445 | return ret_val; | ||
1446 | } | ||
1447 | |||
1448 | /** | ||
1374 | * e1000e_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex | 1449 | * e1000e_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex |
1375 | * @hw: pointer to the HW structure | 1450 | * @hw: pointer to the HW structure |
1376 | * @phy_ctrl: pointer to current value of PHY_CONTROL | 1451 | * @phy_ctrl: pointer to current value of PHY_CONTROL |
@@ -1557,7 +1632,7 @@ s32 e1000e_check_downshift(struct e1000_hw *hw) | |||
1557 | * | 1632 | * |
1558 | * Polarity is determined based on the PHY specific status register. | 1633 | * Polarity is determined based on the PHY specific status register. |
1559 | **/ | 1634 | **/ |
1560 | static s32 e1000_check_polarity_m88(struct e1000_hw *hw) | 1635 | s32 e1000_check_polarity_m88(struct e1000_hw *hw) |
1561 | { | 1636 | { |
1562 | struct e1000_phy_info *phy = &hw->phy; | 1637 | struct e1000_phy_info *phy = &hw->phy; |
1563 | s32 ret_val; | 1638 | s32 ret_val; |
@@ -1582,7 +1657,7 @@ static s32 e1000_check_polarity_m88(struct e1000_hw *hw) | |||
1582 | * Polarity is determined based on the PHY port status register, and the | 1657 | * Polarity is determined based on the PHY port status register, and the |
1583 | * current speed (since there is no polarity at 100Mbps). | 1658 | * current speed (since there is no polarity at 100Mbps). |
1584 | **/ | 1659 | **/ |
1585 | static s32 e1000_check_polarity_igp(struct e1000_hw *hw) | 1660 | s32 e1000_check_polarity_igp(struct e1000_hw *hw) |
1586 | { | 1661 | { |
1587 | struct e1000_phy_info *phy = &hw->phy; | 1662 | struct e1000_phy_info *phy = &hw->phy; |
1588 | s32 ret_val; | 1663 | s32 ret_val; |
@@ -1620,6 +1695,39 @@ static s32 e1000_check_polarity_igp(struct e1000_hw *hw) | |||
1620 | } | 1695 | } |
1621 | 1696 | ||
1622 | /** | 1697 | /** |
1698 | * e1000_check_polarity_ife - Check cable polarity for IFE PHY | ||
1699 | * @hw: pointer to the HW structure | ||
1700 | * | ||
1701 | * Polarity is determined on the polarity reversal feature being enabled. | ||
1702 | **/ | ||
1703 | s32 e1000_check_polarity_ife(struct e1000_hw *hw) | ||
1704 | { | ||
1705 | struct e1000_phy_info *phy = &hw->phy; | ||
1706 | s32 ret_val; | ||
1707 | u16 phy_data, offset, mask; | ||
1708 | |||
1709 | /* | ||
1710 | * Polarity is determined based on the reversal feature being enabled. | ||
1711 | */ | ||
1712 | if (phy->polarity_correction) { | ||
1713 | offset = IFE_PHY_EXTENDED_STATUS_CONTROL; | ||
1714 | mask = IFE_PESC_POLARITY_REVERSED; | ||
1715 | } else { | ||
1716 | offset = IFE_PHY_SPECIAL_CONTROL; | ||
1717 | mask = IFE_PSC_FORCE_POLARITY; | ||
1718 | } | ||
1719 | |||
1720 | ret_val = e1e_rphy(hw, offset, &phy_data); | ||
1721 | |||
1722 | if (!ret_val) | ||
1723 | phy->cable_polarity = (phy_data & mask) | ||
1724 | ? e1000_rev_polarity_reversed | ||
1725 | : e1000_rev_polarity_normal; | ||
1726 | |||
1727 | return ret_val; | ||
1728 | } | ||
1729 | |||
1730 | /** | ||
1623 | * e1000_wait_autoneg - Wait for auto-neg completion | 1731 | * e1000_wait_autoneg - Wait for auto-neg completion |
1624 | * @hw: pointer to the HW structure | 1732 | * @hw: pointer to the HW structure |
1625 | * | 1733 | * |
@@ -1823,7 +1931,7 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw) | |||
1823 | u16 phy_data; | 1931 | u16 phy_data; |
1824 | bool link; | 1932 | bool link; |
1825 | 1933 | ||
1826 | if (hw->phy.media_type != e1000_media_type_copper) { | 1934 | if (phy->media_type != e1000_media_type_copper) { |
1827 | e_dbg("Phy info is only valid for copper media\n"); | 1935 | e_dbg("Phy info is only valid for copper media\n"); |
1828 | return -E1000_ERR_CONFIG; | 1936 | return -E1000_ERR_CONFIG; |
1829 | } | 1937 | } |
@@ -1944,6 +2052,61 @@ s32 e1000e_get_phy_info_igp(struct e1000_hw *hw) | |||
1944 | } | 2052 | } |
1945 | 2053 | ||
1946 | /** | 2054 | /** |
2055 | * e1000_get_phy_info_ife - Retrieves various IFE PHY states | ||
2056 | * @hw: pointer to the HW structure | ||
2057 | * | ||
2058 | * Populates "phy" structure with various feature states. | ||
2059 | **/ | ||
2060 | s32 e1000_get_phy_info_ife(struct e1000_hw *hw) | ||
2061 | { | ||
2062 | struct e1000_phy_info *phy = &hw->phy; | ||
2063 | s32 ret_val; | ||
2064 | u16 data; | ||
2065 | bool link; | ||
2066 | |||
2067 | ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); | ||
2068 | if (ret_val) | ||
2069 | goto out; | ||
2070 | |||
2071 | if (!link) { | ||
2072 | e_dbg("Phy info is only valid if link is up\n"); | ||
2073 | ret_val = -E1000_ERR_CONFIG; | ||
2074 | goto out; | ||
2075 | } | ||
2076 | |||
2077 | ret_val = e1e_rphy(hw, IFE_PHY_SPECIAL_CONTROL, &data); | ||
2078 | if (ret_val) | ||
2079 | goto out; | ||
2080 | phy->polarity_correction = (data & IFE_PSC_AUTO_POLARITY_DISABLE) | ||
2081 | ? false : true; | ||
2082 | |||
2083 | if (phy->polarity_correction) { | ||
2084 | ret_val = e1000_check_polarity_ife(hw); | ||
2085 | if (ret_val) | ||
2086 | goto out; | ||
2087 | } else { | ||
2088 | /* Polarity is forced */ | ||
2089 | phy->cable_polarity = (data & IFE_PSC_FORCE_POLARITY) | ||
2090 | ? e1000_rev_polarity_reversed | ||
2091 | : e1000_rev_polarity_normal; | ||
2092 | } | ||
2093 | |||
2094 | ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data); | ||
2095 | if (ret_val) | ||
2096 | goto out; | ||
2097 | |||
2098 | phy->is_mdix = (data & IFE_PMC_MDIX_STATUS) ? true : false; | ||
2099 | |||
2100 | /* The following parameters are undefined for 10/100 operation. */ | ||
2101 | phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED; | ||
2102 | phy->local_rx = e1000_1000t_rx_status_undefined; | ||
2103 | phy->remote_rx = e1000_1000t_rx_status_undefined; | ||
2104 | |||
2105 | out: | ||
2106 | return ret_val; | ||
2107 | } | ||
2108 | |||
2109 | /** | ||
1947 | * e1000e_phy_sw_reset - PHY software reset | 2110 | * e1000e_phy_sw_reset - PHY software reset |
1948 | * @hw: pointer to the HW structure | 2111 | * @hw: pointer to the HW structure |
1949 | * | 2112 | * |