aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/ich8lan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000e/ich8lan.c')
-rw-r--r--drivers/net/e1000e/ich8lan.c216
1 files changed, 21 insertions, 195 deletions
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 {
195static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw); 195static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw);
196static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw); 196static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw);
197static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw); 197static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw);
198static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw);
199static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank); 198static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank);
200static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw, 199static 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 **/
750static 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 **/
1272static 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 **/
1326static 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 **/
1353static 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,