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.c625
1 files changed, 272 insertions, 353 deletions
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index eff3f4783655..8b5e157e9c87 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2008 Intel Corporation. 4 Copyright(c) 1999 - 2009 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -54,11 +54,6 @@
54 * 82578DC Gigabit Network Connection 54 * 82578DC Gigabit Network Connection
55 */ 55 */
56 56
57#include <linux/netdevice.h>
58#include <linux/ethtool.h>
59#include <linux/delay.h>
60#include <linux/pci.h>
61
62#include "e1000.h" 57#include "e1000.h"
63 58
64#define ICH_FLASH_GFPREG 0x0000 59#define ICH_FLASH_GFPREG 0x0000
@@ -143,6 +138,10 @@
143#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */ 138#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */
144#define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */ 139#define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */
145 140
141/* KMRN Mode Control */
142#define HV_KMRN_MODE_CTRL PHY_REG(769, 16)
143#define HV_KMRN_MDIO_SLOW 0x0400
144
146/* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ 145/* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
147/* Offset 04h HSFSTS */ 146/* Offset 04h HSFSTS */
148union ich8_hws_flash_status { 147union ich8_hws_flash_status {
@@ -200,7 +199,6 @@ union ich8_flash_protected_range {
200static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw); 199static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw);
201static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw); 200static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw);
202static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw); 201static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw);
203static s32 e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw);
204static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank); 202static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank);
205static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw, 203static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw,
206 u32 offset, u8 byte); 204 u32 offset, u8 byte);
@@ -222,9 +220,10 @@ static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw);
222static s32 e1000_led_on_pchlan(struct e1000_hw *hw); 220static s32 e1000_led_on_pchlan(struct e1000_hw *hw);
223static s32 e1000_led_off_pchlan(struct e1000_hw *hw); 221static s32 e1000_led_off_pchlan(struct e1000_hw *hw);
224static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active); 222static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active);
223static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw);
225static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw); 224static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw);
226static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link); 225static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
227static s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); 226static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw);
228 227
229static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) 228static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
230{ 229{
@@ -265,28 +264,54 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
265 phy->addr = 1; 264 phy->addr = 1;
266 phy->reset_delay_us = 100; 265 phy->reset_delay_us = 100;
267 266
268 phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan; 267 phy->ops.read_reg = e1000_read_phy_reg_hv;
269 phy->ops.read_phy_reg = e1000_read_phy_reg_hv; 268 phy->ops.read_reg_locked = e1000_read_phy_reg_hv_locked;
270 phy->ops.read_phy_reg_locked = e1000_read_phy_reg_hv_locked;
271 phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan; 269 phy->ops.set_d0_lplu_state = e1000_set_lplu_state_pchlan;
272 phy->ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan; 270 phy->ops.set_d3_lplu_state = e1000_set_lplu_state_pchlan;
273 phy->ops.write_phy_reg = e1000_write_phy_reg_hv; 271 phy->ops.write_reg = e1000_write_phy_reg_hv;
274 phy->ops.write_phy_reg_locked = e1000_write_phy_reg_hv_locked; 272 phy->ops.write_reg_locked = e1000_write_phy_reg_hv_locked;
273 phy->ops.power_up = e1000_power_up_phy_copper;
274 phy->ops.power_down = e1000_power_down_phy_copper_ich8lan;
275 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; 275 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
276 276
277 phy->id = e1000_phy_unknown; 277 phy->id = e1000_phy_unknown;
278 e1000e_get_phy_id(hw); 278 ret_val = e1000e_get_phy_id(hw);
279 if (ret_val)
280 goto out;
281 if ((phy->id == 0) || (phy->id == PHY_REVISION_MASK)) {
282 /*
283 * In case the PHY needs to be in mdio slow mode (eg. 82577),
284 * set slow mode and try to get the PHY id again.
285 */
286 ret_val = e1000_set_mdio_slow_mode_hv(hw);
287 if (ret_val)
288 goto out;
289 ret_val = e1000e_get_phy_id(hw);
290 if (ret_val)
291 goto out;
292 }
279 phy->type = e1000e_get_phy_type_from_id(phy->id); 293 phy->type = e1000e_get_phy_type_from_id(phy->id);
280 294
281 if (phy->type == e1000_phy_82577) { 295 switch (phy->type) {
296 case e1000_phy_82577:
282 phy->ops.check_polarity = e1000_check_polarity_82577; 297 phy->ops.check_polarity = e1000_check_polarity_82577;
283 phy->ops.force_speed_duplex = 298 phy->ops.force_speed_duplex =
284 e1000_phy_force_speed_duplex_82577; 299 e1000_phy_force_speed_duplex_82577;
285 phy->ops.get_cable_length = e1000_get_cable_length_82577; 300 phy->ops.get_cable_length = e1000_get_cable_length_82577;
286 phy->ops.get_phy_info = e1000_get_phy_info_82577; 301 phy->ops.get_info = e1000_get_phy_info_82577;
287 phy->ops.commit_phy = e1000e_phy_sw_reset; 302 phy->ops.commit = e1000e_phy_sw_reset;
303 case e1000_phy_82578:
304 phy->ops.check_polarity = e1000_check_polarity_m88;
305 phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_m88;
306 phy->ops.get_cable_length = e1000e_get_cable_length_m88;
307 phy->ops.get_info = e1000e_get_phy_info_m88;
308 break;
309 default:
310 ret_val = -E1000_ERR_PHY;
311 break;
288 } 312 }
289 313
314out:
290 return ret_val; 315 return ret_val;
291} 316}
292 317
@@ -305,17 +330,22 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
305 phy->addr = 1; 330 phy->addr = 1;
306 phy->reset_delay_us = 100; 331 phy->reset_delay_us = 100;
307 332
333 phy->ops.power_up = e1000_power_up_phy_copper;
334 phy->ops.power_down = e1000_power_down_phy_copper_ich8lan;
335
308 /* 336 /*
309 * We may need to do this twice - once for IGP and if that fails, 337 * We may need to do this twice - once for IGP and if that fails,
310 * we'll set BM func pointers and try again 338 * we'll set BM func pointers and try again
311 */ 339 */
312 ret_val = e1000e_determine_phy_address(hw); 340 ret_val = e1000e_determine_phy_address(hw);
313 if (ret_val) { 341 if (ret_val) {
314 hw->phy.ops.write_phy_reg = e1000e_write_phy_reg_bm; 342 phy->ops.write_reg = e1000e_write_phy_reg_bm;
315 hw->phy.ops.read_phy_reg = e1000e_read_phy_reg_bm; 343 phy->ops.read_reg = e1000e_read_phy_reg_bm;
316 ret_val = e1000e_determine_phy_address(hw); 344 ret_val = e1000e_determine_phy_address(hw);
317 if (ret_val) 345 if (ret_val) {
346 e_dbg("Cannot determine PHY addr. Erroring out\n");
318 return ret_val; 347 return ret_val;
348 }
319 } 349 }
320 350
321 phy->id = 0; 351 phy->id = 0;
@@ -332,29 +362,36 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
332 case IGP03E1000_E_PHY_ID: 362 case IGP03E1000_E_PHY_ID:
333 phy->type = e1000_phy_igp_3; 363 phy->type = e1000_phy_igp_3;
334 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; 364 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
335 phy->ops.read_phy_reg_locked = e1000e_read_phy_reg_igp_locked; 365 phy->ops.read_reg_locked = e1000e_read_phy_reg_igp_locked;
336 phy->ops.write_phy_reg_locked = e1000e_write_phy_reg_igp_locked; 366 phy->ops.write_reg_locked = e1000e_write_phy_reg_igp_locked;
367 phy->ops.get_info = e1000e_get_phy_info_igp;
368 phy->ops.check_polarity = e1000_check_polarity_igp;
369 phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_igp;
337 break; 370 break;
338 case IFE_E_PHY_ID: 371 case IFE_E_PHY_ID:
339 case IFE_PLUS_E_PHY_ID: 372 case IFE_PLUS_E_PHY_ID:
340 case IFE_C_E_PHY_ID: 373 case IFE_C_E_PHY_ID:
341 phy->type = e1000_phy_ife; 374 phy->type = e1000_phy_ife;
342 phy->autoneg_mask = E1000_ALL_NOT_GIG; 375 phy->autoneg_mask = E1000_ALL_NOT_GIG;
376 phy->ops.get_info = e1000_get_phy_info_ife;
377 phy->ops.check_polarity = e1000_check_polarity_ife;
378 phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_ife;
343 break; 379 break;
344 case BME1000_E_PHY_ID: 380 case BME1000_E_PHY_ID:
345 phy->type = e1000_phy_bm; 381 phy->type = e1000_phy_bm;
346 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; 382 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
347 hw->phy.ops.read_phy_reg = e1000e_read_phy_reg_bm; 383 phy->ops.read_reg = e1000e_read_phy_reg_bm;
348 hw->phy.ops.write_phy_reg = e1000e_write_phy_reg_bm; 384 phy->ops.write_reg = e1000e_write_phy_reg_bm;
349 hw->phy.ops.commit_phy = e1000e_phy_sw_reset; 385 phy->ops.commit = e1000e_phy_sw_reset;
386 phy->ops.get_info = e1000e_get_phy_info_m88;
387 phy->ops.check_polarity = e1000_check_polarity_m88;
388 phy->ops.force_speed_duplex = e1000e_phy_force_speed_duplex_m88;
350 break; 389 break;
351 default: 390 default:
352 return -E1000_ERR_PHY; 391 return -E1000_ERR_PHY;
353 break; 392 break;
354 } 393 }
355 394
356 phy->ops.check_polarity = e1000_check_polarity_ife_ich8lan;
357
358 return 0; 395 return 0;
359} 396}
360 397
@@ -374,7 +411,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
374 411
375 /* Can't read flash registers if the register set isn't mapped. */ 412 /* Can't read flash registers if the register set isn't mapped. */
376 if (!hw->flash_address) { 413 if (!hw->flash_address) {
377 hw_dbg(hw, "ERROR: Flash registers not mapped\n"); 414 e_dbg("ERROR: Flash registers not mapped\n");
378 return -E1000_ERR_CONFIG; 415 return -E1000_ERR_CONFIG;
379 } 416 }
380 417
@@ -407,7 +444,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
407 444
408 /* Clear shadow ram */ 445 /* Clear shadow ram */
409 for (i = 0; i < nvm->word_size; i++) { 446 for (i = 0; i < nvm->word_size; i++) {
410 dev_spec->shadow_ram[i].modified = 0; 447 dev_spec->shadow_ram[i].modified = false;
411 dev_spec->shadow_ram[i].value = 0xFFFF; 448 dev_spec->shadow_ram[i].value = 0xFFFF;
412 } 449 }
413 450
@@ -436,7 +473,9 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
436 if (mac->type == e1000_ich8lan) 473 if (mac->type == e1000_ich8lan)
437 mac->rar_entry_count--; 474 mac->rar_entry_count--;
438 /* Set if manageability features are enabled. */ 475 /* Set if manageability features are enabled. */
439 mac->arc_subsystem_valid = 1; 476 mac->arc_subsystem_valid = true;
477 /* Adaptive IFS supported */
478 mac->adaptive_ifs = true;
440 479
441 /* LED operations */ 480 /* LED operations */
442 switch (mac->type) { 481 switch (mac->type) {
@@ -470,7 +509,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
470 509
471 /* Enable PCS Lock-loss workaround for ICH8 */ 510 /* Enable PCS Lock-loss workaround for ICH8 */
472 if (mac->type == e1000_ich8lan) 511 if (mac->type == e1000_ich8lan)
473 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, 1); 512 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true);
474 513
475 return 0; 514 return 0;
476} 515}
@@ -556,7 +595,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
556 */ 595 */
557 ret_val = e1000e_config_fc_after_link_up(hw); 596 ret_val = e1000e_config_fc_after_link_up(hw);
558 if (ret_val) 597 if (ret_val)
559 hw_dbg(hw, "Error configuring flow control\n"); 598 e_dbg("Error configuring flow control\n");
560 599
561out: 600out:
562 return ret_val; 601 return ret_val;
@@ -636,8 +675,6 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
636 u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT; 675 u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT;
637 s32 ret_val = 0; 676 s32 ret_val = 0;
638 677
639 might_sleep();
640
641 mutex_lock(&swflag_mutex); 678 mutex_lock(&swflag_mutex);
642 679
643 while (timeout) { 680 while (timeout) {
@@ -650,7 +687,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
650 } 687 }
651 688
652 if (!timeout) { 689 if (!timeout) {
653 hw_dbg(hw, "SW/FW/HW has locked the resource for too long.\n"); 690 e_dbg("SW/FW/HW has locked the resource for too long.\n");
654 ret_val = -E1000_ERR_CONFIG; 691 ret_val = -E1000_ERR_CONFIG;
655 goto out; 692 goto out;
656 } 693 }
@@ -670,7 +707,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
670 } 707 }
671 708
672 if (!timeout) { 709 if (!timeout) {
673 hw_dbg(hw, "Failed to acquire the semaphore.\n"); 710 e_dbg("Failed to acquire the semaphore.\n");
674 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; 711 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
675 ew32(EXTCNF_CTRL, extcnf_ctrl); 712 ew32(EXTCNF_CTRL, extcnf_ctrl);
676 ret_val = -E1000_ERR_CONFIG; 713 ret_val = -E1000_ERR_CONFIG;
@@ -714,7 +751,9 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
714 **/ 751 **/
715static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw) 752static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw)
716{ 753{
717 u32 fwsm = er32(FWSM); 754 u32 fwsm;
755
756 fwsm = er32(FWSM);
718 757
719 return (fwsm & E1000_FWSM_MODE_MASK) == 758 return (fwsm & E1000_FWSM_MODE_MASK) ==
720 (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT); 759 (E1000_ICH_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
@@ -738,77 +777,6 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)
738} 777}
739 778
740/** 779/**
741 * e1000_phy_force_speed_duplex_ich8lan - Force PHY speed & duplex
742 * @hw: pointer to the HW structure
743 *
744 * Forces the speed and duplex settings of the PHY.
745 * This is a function pointer entry point only called by
746 * PHY setup routines.
747 **/
748static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw)
749{
750 struct e1000_phy_info *phy = &hw->phy;
751 s32 ret_val;
752 u16 data;
753 bool link;
754
755 if (phy->type != e1000_phy_ife) {
756 ret_val = e1000e_phy_force_speed_duplex_igp(hw);
757 return ret_val;
758 }
759
760 ret_val = e1e_rphy(hw, PHY_CONTROL, &data);
761 if (ret_val)
762 return ret_val;
763
764 e1000e_phy_force_speed_duplex_setup(hw, &data);
765
766 ret_val = e1e_wphy(hw, PHY_CONTROL, data);
767 if (ret_val)
768 return ret_val;
769
770 /* Disable MDI-X support for 10/100 */
771 ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, &data);
772 if (ret_val)
773 return ret_val;
774
775 data &= ~IFE_PMC_AUTO_MDIX;
776 data &= ~IFE_PMC_FORCE_MDIX;
777
778 ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, data);
779 if (ret_val)
780 return ret_val;
781
782 hw_dbg(hw, "IFE PMC: %X\n", data);
783
784 udelay(1);
785
786 if (phy->autoneg_wait_to_complete) {
787 hw_dbg(hw, "Waiting for forced speed/duplex link on IFE phy.\n");
788
789 ret_val = e1000e_phy_has_link_generic(hw,
790 PHY_FORCE_LIMIT,
791 100000,
792 &link);
793 if (ret_val)
794 return ret_val;
795
796 if (!link)
797 hw_dbg(hw, "Link taking longer than expected.\n");
798
799 /* Try once more */
800 ret_val = e1000e_phy_has_link_generic(hw,
801 PHY_FORCE_LIMIT,
802 100000,
803 &link);
804 if (ret_val)
805 return ret_val;
806 }
807
808 return 0;
809}
810
811/**
812 * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration 780 * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration
813 * @hw: pointer to the HW structure 781 * @hw: pointer to the HW structure
814 * 782 *
@@ -822,7 +790,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
822 s32 ret_val; 790 s32 ret_val;
823 u16 word_addr, reg_data, reg_addr, phy_page = 0; 791 u16 word_addr, reg_data, reg_addr, phy_page = 0;
824 792
825 ret_val = hw->phy.ops.acquire_phy(hw); 793 ret_val = hw->phy.ops.acquire(hw);
826 if (ret_val) 794 if (ret_val)
827 return ret_val; 795 return ret_val;
828 796
@@ -918,7 +886,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
918 reg_addr &= PHY_REG_MASK; 886 reg_addr &= PHY_REG_MASK;
919 reg_addr |= phy_page; 887 reg_addr |= phy_page;
920 888
921 ret_val = phy->ops.write_phy_reg_locked(hw, 889 ret_val = phy->ops.write_reg_locked(hw,
922 (u32)reg_addr, 890 (u32)reg_addr,
923 reg_data); 891 reg_data);
924 if (ret_val) 892 if (ret_val)
@@ -927,7 +895,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
927 } 895 }
928 896
929out: 897out:
930 hw->phy.ops.release_phy(hw); 898 hw->phy.ops.release(hw);
931 return ret_val; 899 return ret_val;
932} 900}
933 901
@@ -951,15 +919,14 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link)
951 goto out; 919 goto out;
952 920
953 /* Wrap the whole flow with the sw flag */ 921 /* Wrap the whole flow with the sw flag */
954 ret_val = hw->phy.ops.acquire_phy(hw); 922 ret_val = hw->phy.ops.acquire(hw);
955 if (ret_val) 923 if (ret_val)
956 goto out; 924 goto out;
957 925
958 /* Disable K1 when link is 1Gbps, otherwise use the NVM setting */ 926 /* Disable K1 when link is 1Gbps, otherwise use the NVM setting */
959 if (link) { 927 if (link) {
960 if (hw->phy.type == e1000_phy_82578) { 928 if (hw->phy.type == e1000_phy_82578) {
961 ret_val = hw->phy.ops.read_phy_reg_locked(hw, 929 ret_val = hw->phy.ops.read_reg_locked(hw, BM_CS_STATUS,
962 BM_CS_STATUS,
963 &status_reg); 930 &status_reg);
964 if (ret_val) 931 if (ret_val)
965 goto release; 932 goto release;
@@ -975,8 +942,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link)
975 } 942 }
976 943
977 if (hw->phy.type == e1000_phy_82577) { 944 if (hw->phy.type == e1000_phy_82577) {
978 ret_val = hw->phy.ops.read_phy_reg_locked(hw, 945 ret_val = hw->phy.ops.read_reg_locked(hw, HV_M_STATUS,
979 HV_M_STATUS,
980 &status_reg); 946 &status_reg);
981 if (ret_val) 947 if (ret_val)
982 goto release; 948 goto release;
@@ -992,14 +958,14 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link)
992 } 958 }
993 959
994 /* Link stall fix for link up */ 960 /* Link stall fix for link up */
995 ret_val = hw->phy.ops.write_phy_reg_locked(hw, PHY_REG(770, 19), 961 ret_val = hw->phy.ops.write_reg_locked(hw, PHY_REG(770, 19),
996 0x0100); 962 0x0100);
997 if (ret_val) 963 if (ret_val)
998 goto release; 964 goto release;
999 965
1000 } else { 966 } else {
1001 /* Link stall fix for link down */ 967 /* Link stall fix for link down */
1002 ret_val = hw->phy.ops.write_phy_reg_locked(hw, PHY_REG(770, 19), 968 ret_val = hw->phy.ops.write_reg_locked(hw, PHY_REG(770, 19),
1003 0x4100); 969 0x4100);
1004 if (ret_val) 970 if (ret_val)
1005 goto release; 971 goto release;
@@ -1008,7 +974,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link)
1008 ret_val = e1000_configure_k1_ich8lan(hw, k1_enable); 974 ret_val = e1000_configure_k1_ich8lan(hw, k1_enable);
1009 975
1010release: 976release:
1011 hw->phy.ops.release_phy(hw); 977 hw->phy.ops.release(hw);
1012out: 978out:
1013 return ret_val; 979 return ret_val;
1014} 980}
@@ -1023,7 +989,7 @@ out:
1023 * 989 *
1024 * Success returns 0, Failure returns -E1000_ERR_PHY (-2) 990 * Success returns 0, Failure returns -E1000_ERR_PHY (-2)
1025 **/ 991 **/
1026static s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable) 992s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable)
1027{ 993{
1028 s32 ret_val = 0; 994 s32 ret_val = 0;
1029 u32 ctrl_reg = 0; 995 u32 ctrl_reg = 0;
@@ -1084,7 +1050,7 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1084 if (hw->mac.type != e1000_pchlan) 1050 if (hw->mac.type != e1000_pchlan)
1085 return ret_val; 1051 return ret_val;
1086 1052
1087 ret_val = hw->phy.ops.acquire_phy(hw); 1053 ret_val = hw->phy.ops.acquire(hw);
1088 if (ret_val) 1054 if (ret_val)
1089 return ret_val; 1055 return ret_val;
1090 1056
@@ -1098,7 +1064,7 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1098 1064
1099 mac_reg = er32(PHY_CTRL); 1065 mac_reg = er32(PHY_CTRL);
1100 1066
1101 ret_val = hw->phy.ops.read_phy_reg_locked(hw, HV_OEM_BITS, &oem_reg); 1067 ret_val = hw->phy.ops.read_reg_locked(hw, HV_OEM_BITS, &oem_reg);
1102 if (ret_val) 1068 if (ret_val)
1103 goto out; 1069 goto out;
1104 1070
@@ -1120,26 +1086,54 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
1120 /* Restart auto-neg to activate the bits */ 1086 /* Restart auto-neg to activate the bits */
1121 if (!e1000_check_reset_block(hw)) 1087 if (!e1000_check_reset_block(hw))
1122 oem_reg |= HV_OEM_BITS_RESTART_AN; 1088 oem_reg |= HV_OEM_BITS_RESTART_AN;
1123 ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg); 1089 ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg);
1124 1090
1125out: 1091out:
1126 hw->phy.ops.release_phy(hw); 1092 hw->phy.ops.release(hw);
1127 1093
1128 return ret_val; 1094 return ret_val;
1129} 1095}
1130 1096
1131 1097
1132/** 1098/**
1099 * e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode
1100 * @hw: pointer to the HW structure
1101 **/
1102static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw)
1103{
1104 s32 ret_val;
1105 u16 data;
1106
1107 ret_val = e1e_rphy(hw, HV_KMRN_MODE_CTRL, &data);
1108 if (ret_val)
1109 return ret_val;
1110
1111 data |= HV_KMRN_MDIO_SLOW;
1112
1113 ret_val = e1e_wphy(hw, HV_KMRN_MODE_CTRL, data);
1114
1115 return ret_val;
1116}
1117
1118/**
1133 * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be 1119 * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be
1134 * done after every PHY reset. 1120 * done after every PHY reset.
1135 **/ 1121 **/
1136static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) 1122static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
1137{ 1123{
1138 s32 ret_val = 0; 1124 s32 ret_val = 0;
1125 u16 phy_data;
1139 1126
1140 if (hw->mac.type != e1000_pchlan) 1127 if (hw->mac.type != e1000_pchlan)
1141 return ret_val; 1128 return ret_val;
1142 1129
1130 /* Set MDIO slow mode before any other MDIO access */
1131 if (hw->phy.type == e1000_phy_82577) {
1132 ret_val = e1000_set_mdio_slow_mode_hv(hw);
1133 if (ret_val)
1134 goto out;
1135 }
1136
1143 if (((hw->phy.type == e1000_phy_82577) && 1137 if (((hw->phy.type == e1000_phy_82577) &&
1144 ((hw->phy.revision == 1) || (hw->phy.revision == 2))) || 1138 ((hw->phy.revision == 1) || (hw->phy.revision == 2))) ||
1145 ((hw->phy.type == e1000_phy_82578) && (hw->phy.revision == 1))) { 1139 ((hw->phy.type == e1000_phy_82578) && (hw->phy.revision == 1))) {
@@ -1166,22 +1160,38 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
1166 } 1160 }
1167 1161
1168 /* Select page 0 */ 1162 /* Select page 0 */
1169 ret_val = hw->phy.ops.acquire_phy(hw); 1163 ret_val = hw->phy.ops.acquire(hw);
1170 if (ret_val) 1164 if (ret_val)
1171 return ret_val; 1165 return ret_val;
1172 1166
1173 hw->phy.addr = 1; 1167 hw->phy.addr = 1;
1174 ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0); 1168 ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0);
1169 hw->phy.ops.release(hw);
1175 if (ret_val) 1170 if (ret_val)
1176 goto out; 1171 goto out;
1177 hw->phy.ops.release_phy(hw);
1178 1172
1179 /* 1173 /*
1180 * Configure the K1 Si workaround during phy reset assuming there is 1174 * Configure the K1 Si workaround during phy reset assuming there is
1181 * link so that it disables K1 if link is in 1Gbps. 1175 * link so that it disables K1 if link is in 1Gbps.
1182 */ 1176 */
1183 ret_val = e1000_k1_gig_workaround_hv(hw, true); 1177 ret_val = e1000_k1_gig_workaround_hv(hw, true);
1178 if (ret_val)
1179 goto out;
1184 1180
1181 /* Workaround for link disconnects on a busy hub in half duplex */
1182 ret_val = hw->phy.ops.acquire(hw);
1183 if (ret_val)
1184 goto out;
1185 ret_val = hw->phy.ops.read_reg_locked(hw,
1186 PHY_REG(BM_PORT_CTRL_PAGE, 17),
1187 &phy_data);
1188 if (ret_val)
1189 goto release;
1190 ret_val = hw->phy.ops.write_reg_locked(hw,
1191 PHY_REG(BM_PORT_CTRL_PAGE, 17),
1192 phy_data & 0x00FF);
1193release:
1194 hw->phy.ops.release(hw);
1185out: 1195out:
1186 return ret_val; 1196 return ret_val;
1187} 1197}
@@ -1210,7 +1220,7 @@ static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw)
1210 * leave the PHY in a bad state possibly resulting in no link. 1220 * leave the PHY in a bad state possibly resulting in no link.
1211 */ 1221 */
1212 if (loop == 0) 1222 if (loop == 0)
1213 hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n"); 1223 e_dbg("LAN_INIT_DONE not set, increase timeout\n");
1214 1224
1215 /* Clear the Init Done bit for the next init event */ 1225 /* Clear the Init Done bit for the next init event */
1216 data = er32(STATUS); 1226 data = er32(STATUS);
@@ -1238,6 +1248,7 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
1238 /* Allow time for h/w to get to a quiescent state after reset */ 1248 /* Allow time for h/w to get to a quiescent state after reset */
1239 mdelay(10); 1249 mdelay(10);
1240 1250
1251 /* Perform any necessary post-reset workarounds */
1241 if (hw->mac.type == e1000_pchlan) { 1252 if (hw->mac.type == e1000_pchlan) {
1242 ret_val = e1000_hv_phy_workarounds_ich8lan(hw); 1253 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
1243 if (ret_val) 1254 if (ret_val)
@@ -1262,122 +1273,6 @@ out:
1262} 1273}
1263 1274
1264/** 1275/**
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 hw_dbg(hw, "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 1276 * e1000_set_lplu_state_pchlan - Set Low Power Link Up state
1382 * @hw: pointer to the HW structure 1277 * @hw: pointer to the HW structure
1383 * @active: true to enable LPLU, false to disable 1278 * @active: true to enable LPLU, false to disable
@@ -1412,7 +1307,7 @@ out:
1412/** 1307/**
1413 * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state 1308 * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state
1414 * @hw: pointer to the HW structure 1309 * @hw: pointer to the HW structure
1415 * @active: TRUE to enable LPLU, FALSE to disable 1310 * @active: true to enable LPLU, false to disable
1416 * 1311 *
1417 * Sets the LPLU D0 state according to the active flag. When 1312 * Sets the LPLU D0 state according to the active flag. When
1418 * activating LPLU this function also disables smart speed 1313 * activating LPLU this function also disables smart speed
@@ -1498,7 +1393,7 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
1498/** 1393/**
1499 * e1000_set_d3_lplu_state_ich8lan - Set Low Power Linkup D3 state 1394 * e1000_set_d3_lplu_state_ich8lan - Set Low Power Linkup D3 state
1500 * @hw: pointer to the HW structure 1395 * @hw: pointer to the HW structure
1501 * @active: TRUE to enable LPLU, FALSE to disable 1396 * @active: true to enable LPLU, false to disable
1502 * 1397 *
1503 * Sets the LPLU D3 state according to the active flag. When 1398 * Sets the LPLU D3 state according to the active flag. When
1504 * activating LPLU this function also disables smart speed 1399 * activating LPLU this function also disables smart speed
@@ -1611,7 +1506,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank)
1611 1506
1612 return 0; 1507 return 0;
1613 } 1508 }
1614 hw_dbg(hw, "Unable to determine valid NVM bank via EEC - " 1509 e_dbg("Unable to determine valid NVM bank via EEC - "
1615 "reading flash signature\n"); 1510 "reading flash signature\n");
1616 /* fall-thru */ 1511 /* fall-thru */
1617 default: 1512 default:
@@ -1641,7 +1536,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank)
1641 return 0; 1536 return 0;
1642 } 1537 }
1643 1538
1644 hw_dbg(hw, "ERROR: No valid NVM bank present\n"); 1539 e_dbg("ERROR: No valid NVM bank present\n");
1645 return -E1000_ERR_NVM; 1540 return -E1000_ERR_NVM;
1646 } 1541 }
1647 1542
@@ -1669,16 +1564,16 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1669 1564
1670 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || 1565 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
1671 (words == 0)) { 1566 (words == 0)) {
1672 hw_dbg(hw, "nvm parameter(s) out of bounds\n"); 1567 e_dbg("nvm parameter(s) out of bounds\n");
1673 ret_val = -E1000_ERR_NVM; 1568 ret_val = -E1000_ERR_NVM;
1674 goto out; 1569 goto out;
1675 } 1570 }
1676 1571
1677 nvm->ops.acquire_nvm(hw); 1572 nvm->ops.acquire(hw);
1678 1573
1679 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); 1574 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
1680 if (ret_val) { 1575 if (ret_val) {
1681 hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n"); 1576 e_dbg("Could not detect valid bank, assuming bank 0\n");
1682 bank = 0; 1577 bank = 0;
1683 } 1578 }
1684 1579
@@ -1700,11 +1595,11 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1700 } 1595 }
1701 } 1596 }
1702 1597
1703 nvm->ops.release_nvm(hw); 1598 nvm->ops.release(hw);
1704 1599
1705out: 1600out:
1706 if (ret_val) 1601 if (ret_val)
1707 hw_dbg(hw, "NVM read error: %d\n", ret_val); 1602 e_dbg("NVM read error: %d\n", ret_val);
1708 1603
1709 return ret_val; 1604 return ret_val;
1710} 1605}
@@ -1726,7 +1621,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
1726 1621
1727 /* Check if the flash descriptor is valid */ 1622 /* Check if the flash descriptor is valid */
1728 if (hsfsts.hsf_status.fldesvalid == 0) { 1623 if (hsfsts.hsf_status.fldesvalid == 0) {
1729 hw_dbg(hw, "Flash descriptor invalid. " 1624 e_dbg("Flash descriptor invalid. "
1730 "SW Sequencing must be used."); 1625 "SW Sequencing must be used.");
1731 return -E1000_ERR_NVM; 1626 return -E1000_ERR_NVM;
1732 } 1627 }
@@ -1749,7 +1644,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
1749 if (hsfsts.hsf_status.flcinprog == 0) { 1644 if (hsfsts.hsf_status.flcinprog == 0) {
1750 /* 1645 /*
1751 * There is no cycle running at present, 1646 * There is no cycle running at present,
1752 * so we can start a cycle 1647 * so we can start a cycle.
1753 * Begin by setting Flash Cycle Done. 1648 * Begin by setting Flash Cycle Done.
1754 */ 1649 */
1755 hsfsts.hsf_status.flcdone = 1; 1650 hsfsts.hsf_status.flcdone = 1;
@@ -1757,7 +1652,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
1757 ret_val = 0; 1652 ret_val = 0;
1758 } else { 1653 } else {
1759 /* 1654 /*
1760 * otherwise poll for sometime so the current 1655 * Otherwise poll for sometime so the current
1761 * cycle has a chance to end before giving up. 1656 * cycle has a chance to end before giving up.
1762 */ 1657 */
1763 for (i = 0; i < ICH_FLASH_READ_COMMAND_TIMEOUT; i++) { 1658 for (i = 0; i < ICH_FLASH_READ_COMMAND_TIMEOUT; i++) {
@@ -1776,7 +1671,7 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
1776 hsfsts.hsf_status.flcdone = 1; 1671 hsfsts.hsf_status.flcdone = 1;
1777 ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); 1672 ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
1778 } else { 1673 } else {
1779 hw_dbg(hw, "Flash controller busy, cannot get access"); 1674 e_dbg("Flash controller busy, cannot get access");
1780 } 1675 }
1781 } 1676 }
1782 1677
@@ -1926,7 +1821,7 @@ static s32 e1000_read_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
1926 /* Repeat for some time before giving up. */ 1821 /* Repeat for some time before giving up. */
1927 continue; 1822 continue;
1928 } else if (hsfsts.hsf_status.flcdone == 0) { 1823 } else if (hsfsts.hsf_status.flcdone == 0) {
1929 hw_dbg(hw, "Timeout error - flash cycle " 1824 e_dbg("Timeout error - flash cycle "
1930 "did not complete."); 1825 "did not complete.");
1931 break; 1826 break;
1932 } 1827 }
@@ -1954,18 +1849,18 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1954 1849
1955 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || 1850 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
1956 (words == 0)) { 1851 (words == 0)) {
1957 hw_dbg(hw, "nvm parameter(s) out of bounds\n"); 1852 e_dbg("nvm parameter(s) out of bounds\n");
1958 return -E1000_ERR_NVM; 1853 return -E1000_ERR_NVM;
1959 } 1854 }
1960 1855
1961 nvm->ops.acquire_nvm(hw); 1856 nvm->ops.acquire(hw);
1962 1857
1963 for (i = 0; i < words; i++) { 1858 for (i = 0; i < words; i++) {
1964 dev_spec->shadow_ram[offset+i].modified = 1; 1859 dev_spec->shadow_ram[offset+i].modified = true;
1965 dev_spec->shadow_ram[offset+i].value = data[i]; 1860 dev_spec->shadow_ram[offset+i].value = data[i];
1966 } 1861 }
1967 1862
1968 nvm->ops.release_nvm(hw); 1863 nvm->ops.release(hw);
1969 1864
1970 return 0; 1865 return 0;
1971} 1866}
@@ -1996,7 +1891,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1996 if (nvm->type != e1000_nvm_flash_sw) 1891 if (nvm->type != e1000_nvm_flash_sw)
1997 goto out; 1892 goto out;
1998 1893
1999 nvm->ops.acquire_nvm(hw); 1894 nvm->ops.acquire(hw);
2000 1895
2001 /* 1896 /*
2002 * We're writing to the opposite bank so if we're on bank 1, 1897 * We're writing to the opposite bank so if we're on bank 1,
@@ -2005,7 +1900,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2005 */ 1900 */
2006 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); 1901 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
2007 if (ret_val) { 1902 if (ret_val) {
2008 hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n"); 1903 e_dbg("Could not detect valid bank, assuming bank 0\n");
2009 bank = 0; 1904 bank = 0;
2010 } 1905 }
2011 1906
@@ -2014,7 +1909,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2014 old_bank_offset = 0; 1909 old_bank_offset = 0;
2015 ret_val = e1000_erase_flash_bank_ich8lan(hw, 1); 1910 ret_val = e1000_erase_flash_bank_ich8lan(hw, 1);
2016 if (ret_val) { 1911 if (ret_val) {
2017 nvm->ops.release_nvm(hw); 1912 nvm->ops.release(hw);
2018 goto out; 1913 goto out;
2019 } 1914 }
2020 } else { 1915 } else {
@@ -2022,7 +1917,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2022 new_bank_offset = 0; 1917 new_bank_offset = 0;
2023 ret_val = e1000_erase_flash_bank_ich8lan(hw, 0); 1918 ret_val = e1000_erase_flash_bank_ich8lan(hw, 0);
2024 if (ret_val) { 1919 if (ret_val) {
2025 nvm->ops.release_nvm(hw); 1920 nvm->ops.release(hw);
2026 goto out; 1921 goto out;
2027 } 1922 }
2028 } 1923 }
@@ -2079,8 +1974,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2079 */ 1974 */
2080 if (ret_val) { 1975 if (ret_val) {
2081 /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */ 1976 /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
2082 hw_dbg(hw, "Flash commit failed.\n"); 1977 e_dbg("Flash commit failed.\n");
2083 nvm->ops.release_nvm(hw); 1978 nvm->ops.release(hw);
2084 goto out; 1979 goto out;
2085 } 1980 }
2086 1981
@@ -2093,7 +1988,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2093 act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD; 1988 act_offset = new_bank_offset + E1000_ICH_NVM_SIG_WORD;
2094 ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data); 1989 ret_val = e1000_read_flash_word_ich8lan(hw, act_offset, &data);
2095 if (ret_val) { 1990 if (ret_val) {
2096 nvm->ops.release_nvm(hw); 1991 nvm->ops.release(hw);
2097 goto out; 1992 goto out;
2098 } 1993 }
2099 data &= 0xBFFF; 1994 data &= 0xBFFF;
@@ -2101,7 +1996,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2101 act_offset * 2 + 1, 1996 act_offset * 2 + 1,
2102 (u8)(data >> 8)); 1997 (u8)(data >> 8));
2103 if (ret_val) { 1998 if (ret_val) {
2104 nvm->ops.release_nvm(hw); 1999 nvm->ops.release(hw);
2105 goto out; 2000 goto out;
2106 } 2001 }
2107 2002
@@ -2114,17 +2009,17 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2114 act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1; 2009 act_offset = (old_bank_offset + E1000_ICH_NVM_SIG_WORD) * 2 + 1;
2115 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0); 2010 ret_val = e1000_retry_write_flash_byte_ich8lan(hw, act_offset, 0);
2116 if (ret_val) { 2011 if (ret_val) {
2117 nvm->ops.release_nvm(hw); 2012 nvm->ops.release(hw);
2118 goto out; 2013 goto out;
2119 } 2014 }
2120 2015
2121 /* Great! Everything worked, we can now clear the cached entries. */ 2016 /* Great! Everything worked, we can now clear the cached entries. */
2122 for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) { 2017 for (i = 0; i < E1000_ICH8_SHADOW_RAM_WORDS; i++) {
2123 dev_spec->shadow_ram[i].modified = 0; 2018 dev_spec->shadow_ram[i].modified = false;
2124 dev_spec->shadow_ram[i].value = 0xFFFF; 2019 dev_spec->shadow_ram[i].value = 0xFFFF;
2125 } 2020 }
2126 2021
2127 nvm->ops.release_nvm(hw); 2022 nvm->ops.release(hw);
2128 2023
2129 /* 2024 /*
2130 * Reload the EEPROM, or else modifications will not appear 2025 * Reload the EEPROM, or else modifications will not appear
@@ -2135,7 +2030,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
2135 2030
2136out: 2031out:
2137 if (ret_val) 2032 if (ret_val)
2138 hw_dbg(hw, "NVM update error: %d\n", ret_val); 2033 e_dbg("NVM update error: %d\n", ret_val);
2139 2034
2140 return ret_val; 2035 return ret_val;
2141} 2036}
@@ -2193,7 +2088,7 @@ void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
2193 union ich8_hws_flash_status hsfsts; 2088 union ich8_hws_flash_status hsfsts;
2194 u32 gfpreg; 2089 u32 gfpreg;
2195 2090
2196 nvm->ops.acquire_nvm(hw); 2091 nvm->ops.acquire(hw);
2197 2092
2198 gfpreg = er32flash(ICH_FLASH_GFPREG); 2093 gfpreg = er32flash(ICH_FLASH_GFPREG);
2199 2094
@@ -2214,7 +2109,7 @@ void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
2214 hsfsts.hsf_status.flockdn = true; 2109 hsfsts.hsf_status.flockdn = true;
2215 ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval); 2110 ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval);
2216 2111
2217 nvm->ops.release_nvm(hw); 2112 nvm->ops.release(hw);
2218} 2113}
2219 2114
2220/** 2115/**
@@ -2285,7 +2180,7 @@ static s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
2285 /* Repeat for some time before giving up. */ 2180 /* Repeat for some time before giving up. */
2286 continue; 2181 continue;
2287 if (hsfsts.hsf_status.flcdone == 0) { 2182 if (hsfsts.hsf_status.flcdone == 0) {
2288 hw_dbg(hw, "Timeout error - flash cycle " 2183 e_dbg("Timeout error - flash cycle "
2289 "did not complete."); 2184 "did not complete.");
2290 break; 2185 break;
2291 } 2186 }
@@ -2330,7 +2225,7 @@ static s32 e1000_retry_write_flash_byte_ich8lan(struct e1000_hw *hw,
2330 return ret_val; 2225 return ret_val;
2331 2226
2332 for (program_retries = 0; program_retries < 100; program_retries++) { 2227 for (program_retries = 0; program_retries < 100; program_retries++) {
2333 hw_dbg(hw, "Retrying Byte %2.2X at offset %u\n", byte, offset); 2228 e_dbg("Retrying Byte %2.2X at offset %u\n", byte, offset);
2334 udelay(100); 2229 udelay(100);
2335 ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte); 2230 ret_val = e1000_write_flash_byte_ich8lan(hw, offset, byte);
2336 if (!ret_val) 2231 if (!ret_val)
@@ -2360,9 +2255,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)
2360 u32 flash_bank_size = nvm->flash_bank_size * 2; 2255 u32 flash_bank_size = nvm->flash_bank_size * 2;
2361 s32 ret_val; 2256 s32 ret_val;
2362 s32 count = 0; 2257 s32 count = 0;
2363 s32 iteration; 2258 s32 j, iteration, sector_size;
2364 s32 sector_size;
2365 s32 j;
2366 2259
2367 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); 2260 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
2368 2261
@@ -2465,7 +2358,7 @@ static s32 e1000_valid_led_default_ich8lan(struct e1000_hw *hw, u16 *data)
2465 2358
2466 ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data); 2359 ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data);
2467 if (ret_val) { 2360 if (ret_val) {
2468 hw_dbg(hw, "NVM Read Error\n"); 2361 e_dbg("NVM Read Error\n");
2469 return ret_val; 2362 return ret_val;
2470 } 2363 }
2471 2364
@@ -2595,10 +2488,10 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2595 */ 2488 */
2596 ret_val = e1000e_disable_pcie_master(hw); 2489 ret_val = e1000e_disable_pcie_master(hw);
2597 if (ret_val) { 2490 if (ret_val) {
2598 hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); 2491 e_dbg("PCI-E Master disable polling has failed.\n");
2599 } 2492 }
2600 2493
2601 hw_dbg(hw, "Masking off all interrupts\n"); 2494 e_dbg("Masking off all interrupts\n");
2602 ew32(IMC, 0xffffffff); 2495 ew32(IMC, 0xffffffff);
2603 2496
2604 /* 2497 /*
@@ -2649,14 +2542,17 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2649 ctrl |= E1000_CTRL_PHY_RST; 2542 ctrl |= E1000_CTRL_PHY_RST;
2650 } 2543 }
2651 ret_val = e1000_acquire_swflag_ich8lan(hw); 2544 ret_val = e1000_acquire_swflag_ich8lan(hw);
2652 /* Whether or not the swflag was acquired, we need to reset the part */ 2545 e_dbg("Issuing a global reset to ich8lan\n");
2653 hw_dbg(hw, "Issuing a global reset to ich8lan\n");
2654 ew32(CTRL, (ctrl | E1000_CTRL_RST)); 2546 ew32(CTRL, (ctrl | E1000_CTRL_RST));
2655 msleep(20); 2547 msleep(20);
2656 2548
2657 if (!ret_val) 2549 if (!ret_val)
2658 e1000_release_swflag_ich8lan(hw); 2550 e1000_release_swflag_ich8lan(hw);
2659 2551
2552 /* Perform any necessary post-reset workarounds */
2553 if (hw->mac.type == e1000_pchlan)
2554 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
2555
2660 if (ctrl & E1000_CTRL_PHY_RST) 2556 if (ctrl & E1000_CTRL_PHY_RST)
2661 ret_val = hw->phy.ops.get_cfg_done(hw); 2557 ret_val = hw->phy.ops.get_cfg_done(hw);
2662 2558
@@ -2670,7 +2566,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2670 * return with an error. This can happen in situations 2566 * return with an error. This can happen in situations
2671 * where there is no eeprom and prevents getting link. 2567 * where there is no eeprom and prevents getting link.
2672 */ 2568 */
2673 hw_dbg(hw, "Auto Read Done did not complete\n"); 2569 e_dbg("Auto Read Done did not complete\n");
2674 } 2570 }
2675 } 2571 }
2676 /* Dummy read to clear the phy wakeup bit after lcd reset */ 2572 /* Dummy read to clear the phy wakeup bit after lcd reset */
@@ -2701,9 +2597,6 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2701 kab |= E1000_KABGTXD_BGSQLBIAS; 2597 kab |= E1000_KABGTXD_BGSQLBIAS;
2702 ew32(KABGTXD, kab); 2598 ew32(KABGTXD, kab);
2703 2599
2704 if (hw->mac.type == e1000_pchlan)
2705 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
2706
2707out: 2600out:
2708 return ret_val; 2601 return ret_val;
2709} 2602}
@@ -2731,16 +2624,15 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
2731 2624
2732 /* Initialize identification LED */ 2625 /* Initialize identification LED */
2733 ret_val = mac->ops.id_led_init(hw); 2626 ret_val = mac->ops.id_led_init(hw);
2734 if (ret_val) { 2627 if (ret_val)
2735 hw_dbg(hw, "Error initializing identification LED\n"); 2628 e_dbg("Error initializing identification LED\n");
2736 return ret_val; 2629 /* This is not fatal and we should not stop init due to this */
2737 }
2738 2630
2739 /* Setup the receive address. */ 2631 /* Setup the receive address. */
2740 e1000e_init_rx_addrs(hw, mac->rar_entry_count); 2632 e1000e_init_rx_addrs(hw, mac->rar_entry_count);
2741 2633
2742 /* Zero out the Multicast HASH table */ 2634 /* Zero out the Multicast HASH table */
2743 hw_dbg(hw, "Zeroing the MTA\n"); 2635 e_dbg("Zeroing the MTA\n");
2744 for (i = 0; i < mac->mta_reg_count; i++) 2636 for (i = 0; i < mac->mta_reg_count; i++)
2745 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); 2637 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
2746 2638
@@ -2750,7 +2642,7 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
2750 * Reset the phy after disabling host wakeup to reset the Rx buffer. 2642 * Reset the phy after disabling host wakeup to reset the Rx buffer.
2751 */ 2643 */
2752 if (hw->phy.type == e1000_phy_82578) { 2644 if (hw->phy.type == e1000_phy_82578) {
2753 hw->phy.ops.read_phy_reg(hw, BM_WUC, &i); 2645 hw->phy.ops.read_reg(hw, BM_WUC, &i);
2754 ret_val = e1000_phy_hw_reset_ich8lan(hw); 2646 ret_val = e1000_phy_hw_reset_ich8lan(hw);
2755 if (ret_val) 2647 if (ret_val)
2756 return ret_val; 2648 return ret_val;
@@ -2848,6 +2740,16 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw)
2848 reg &= ~(1 << 31); 2740 reg &= ~(1 << 31);
2849 ew32(STATUS, reg); 2741 ew32(STATUS, reg);
2850 } 2742 }
2743
2744 /*
2745 * work-around descriptor data corruption issue during nfs v2 udp
2746 * traffic, just disable the nfs filtering capability
2747 */
2748 reg = er32(RFCTL);
2749 reg |= (E1000_RFCTL_NFSW_DIS | E1000_RFCTL_NFSR_DIS);
2750 ew32(RFCTL, reg);
2751
2752 return;
2851} 2753}
2852 2754
2853/** 2755/**
@@ -2886,7 +2788,7 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
2886 */ 2788 */
2887 hw->fc.current_mode = hw->fc.requested_mode; 2789 hw->fc.current_mode = hw->fc.requested_mode;
2888 2790
2889 hw_dbg(hw, "After fix-ups FlowControl is now = %x\n", 2791 e_dbg("After fix-ups FlowControl is now = %x\n",
2890 hw->fc.current_mode); 2792 hw->fc.current_mode);
2891 2793
2892 /* Continue to configure the copper link. */ 2794 /* Continue to configure the copper link. */
@@ -2897,7 +2799,7 @@ static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw)
2897 ew32(FCTTV, hw->fc.pause_time); 2799 ew32(FCTTV, hw->fc.pause_time);
2898 if ((hw->phy.type == e1000_phy_82578) || 2800 if ((hw->phy.type == e1000_phy_82578) ||
2899 (hw->phy.type == e1000_phy_82577)) { 2801 (hw->phy.type == e1000_phy_82577)) {
2900 ret_val = hw->phy.ops.write_phy_reg(hw, 2802 ret_val = hw->phy.ops.write_reg(hw,
2901 PHY_REG(BM_PORT_CTRL_PAGE, 27), 2803 PHY_REG(BM_PORT_CTRL_PAGE, 27),
2902 hw->fc.pause_time); 2804 hw->fc.pause_time);
2903 if (ret_val) 2805 if (ret_val)
@@ -2931,14 +2833,16 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw)
2931 * and increase the max iterations when polling the phy; 2833 * and increase the max iterations when polling the phy;
2932 * this fixes erroneous timeouts at 10Mbps. 2834 * this fixes erroneous timeouts at 10Mbps.
2933 */ 2835 */
2934 ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF); 2836 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_TIMEOUTS, 0xFFFF);
2935 if (ret_val) 2837 if (ret_val)
2936 return ret_val; 2838 return ret_val;
2937 ret_val = e1000e_read_kmrn_reg(hw, GG82563_REG(0x34, 9), &reg_data); 2839 ret_val = e1000e_read_kmrn_reg(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
2840 &reg_data);
2938 if (ret_val) 2841 if (ret_val)
2939 return ret_val; 2842 return ret_val;
2940 reg_data |= 0x3F; 2843 reg_data |= 0x3F;
2941 ret_val = e1000e_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data); 2844 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
2845 reg_data);
2942 if (ret_val) 2846 if (ret_val)
2943 return ret_val; 2847 return ret_val;
2944 2848
@@ -2960,7 +2864,7 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw)
2960 return ret_val; 2864 return ret_val;
2961 break; 2865 break;
2962 case e1000_phy_ife: 2866 case e1000_phy_ife:
2963 ret_val = hw->phy.ops.read_phy_reg(hw, IFE_PHY_MDIX_CONTROL, 2867 ret_val = hw->phy.ops.read_reg(hw, IFE_PHY_MDIX_CONTROL,
2964 &reg_data); 2868 &reg_data);
2965 if (ret_val) 2869 if (ret_val)
2966 return ret_val; 2870 return ret_val;
@@ -2979,7 +2883,7 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw)
2979 reg_data |= IFE_PMC_AUTO_MDIX; 2883 reg_data |= IFE_PMC_AUTO_MDIX;
2980 break; 2884 break;
2981 } 2885 }
2982 ret_val = hw->phy.ops.write_phy_reg(hw, IFE_PHY_MDIX_CONTROL, 2886 ret_val = hw->phy.ops.write_reg(hw, IFE_PHY_MDIX_CONTROL,
2983 reg_data); 2887 reg_data);
2984 if (ret_val) 2888 if (ret_val)
2985 return ret_val; 2889 return ret_val;
@@ -3092,8 +2996,8 @@ static s32 e1000_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw)
3092 * @hw: pointer to the HW structure 2996 * @hw: pointer to the HW structure
3093 * @state: boolean value used to set the current Kumeran workaround state 2997 * @state: boolean value used to set the current Kumeran workaround state
3094 * 2998 *
3095 * If ICH8, set the current Kumeran workaround state (enabled - TRUE 2999 * If ICH8, set the current Kumeran workaround state (enabled - true
3096 * /disabled - FALSE). 3000 * /disabled - false).
3097 **/ 3001 **/
3098void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, 3002void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
3099 bool state) 3003 bool state)
@@ -3101,7 +3005,7 @@ void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
3101 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; 3005 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
3102 3006
3103 if (hw->mac.type != e1000_ich8lan) { 3007 if (hw->mac.type != e1000_ich8lan) {
3104 hw_dbg(hw, "Workaround applies to ICH8 only.\n"); 3008 e_dbg("Workaround applies to ICH8 only.\n");
3105 return; 3009 return;
3106 } 3010 }
3107 3011
@@ -3209,6 +3113,7 @@ void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)
3209 u32 phy_ctrl; 3113 u32 phy_ctrl;
3210 3114
3211 switch (hw->mac.type) { 3115 switch (hw->mac.type) {
3116 case e1000_ich8lan:
3212 case e1000_ich9lan: 3117 case e1000_ich9lan:
3213 case e1000_ich10lan: 3118 case e1000_ich10lan:
3214 case e1000_pchlan: 3119 case e1000_pchlan:
@@ -3281,7 +3186,7 @@ static s32 e1000_led_off_ich8lan(struct e1000_hw *hw)
3281 **/ 3186 **/
3282static s32 e1000_setup_led_pchlan(struct e1000_hw *hw) 3187static s32 e1000_setup_led_pchlan(struct e1000_hw *hw)
3283{ 3188{
3284 return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG, 3189 return hw->phy.ops.write_reg(hw, HV_LED_CONFIG,
3285 (u16)hw->mac.ledctl_mode1); 3190 (u16)hw->mac.ledctl_mode1);
3286} 3191}
3287 3192
@@ -3293,7 +3198,7 @@ static s32 e1000_setup_led_pchlan(struct e1000_hw *hw)
3293 **/ 3198 **/
3294static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw) 3199static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw)
3295{ 3200{
3296 return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG, 3201 return hw->phy.ops.write_reg(hw, HV_LED_CONFIG,
3297 (u16)hw->mac.ledctl_default); 3202 (u16)hw->mac.ledctl_default);
3298} 3203}
3299 3204
@@ -3325,7 +3230,7 @@ static s32 e1000_led_on_pchlan(struct e1000_hw *hw)
3325 } 3230 }
3326 } 3231 }
3327 3232
3328 return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG, data); 3233 return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, data);
3329} 3234}
3330 3235
3331/** 3236/**
@@ -3356,7 +3261,7 @@ static s32 e1000_led_off_pchlan(struct e1000_hw *hw)
3356 } 3261 }
3357 } 3262 }
3358 3263
3359 return hw->phy.ops.write_phy_reg(hw, HV_LED_CONFIG, data); 3264 return hw->phy.ops.write_reg(hw, HV_LED_CONFIG, data);
3360} 3265}
3361 3266
3362/** 3267/**
@@ -3379,8 +3284,7 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
3379 if (status & E1000_STATUS_PHYRA) 3284 if (status & E1000_STATUS_PHYRA)
3380 ew32(STATUS, status & ~E1000_STATUS_PHYRA); 3285 ew32(STATUS, status & ~E1000_STATUS_PHYRA);
3381 else 3286 else
3382 hw_dbg(hw, 3287 e_dbg("PHY Reset Asserted not set - needs delay\n");
3383 "PHY Reset Asserted not set - needs delay\n");
3384 } 3288 }
3385 3289
3386 e1000e_get_cfg_done(hw); 3290 e1000e_get_cfg_done(hw);
@@ -3395,7 +3299,7 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
3395 } else { 3299 } else {
3396 if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) { 3300 if (e1000_valid_nvm_bank_detect_ich8lan(hw, &bank)) {
3397 /* Maybe we should do a basic PHY config */ 3301 /* Maybe we should do a basic PHY config */
3398 hw_dbg(hw, "EEPROM not present\n"); 3302 e_dbg("EEPROM not present\n");
3399 return -E1000_ERR_CONFIG; 3303 return -E1000_ERR_CONFIG;
3400 } 3304 }
3401 } 3305 }
@@ -3404,6 +3308,23 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
3404} 3308}
3405 3309
3406/** 3310/**
3311 * e1000_power_down_phy_copper_ich8lan - Remove link during PHY power down
3312 * @hw: pointer to the HW structure
3313 *
3314 * In the case of a PHY power down to save power, or to turn off link during a
3315 * driver unload, or wake on lan is not enabled, remove the link.
3316 **/
3317static void e1000_power_down_phy_copper_ich8lan(struct e1000_hw *hw)
3318{
3319 /* If the management interface is not enabled, then power down */
3320 if (!(hw->mac.ops.check_mng_mode(hw) ||
3321 hw->phy.ops.check_reset_block(hw)))
3322 e1000_power_down_phy_copper(hw);
3323
3324 return;
3325}
3326
3327/**
3407 * e1000_clear_hw_cntrs_ich8lan - Clear statistical counters 3328 * e1000_clear_hw_cntrs_ich8lan - Clear statistical counters
3408 * @hw: pointer to the HW structure 3329 * @hw: pointer to the HW structure
3409 * 3330 *
@@ -3412,42 +3333,41 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
3412 **/ 3333 **/
3413static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) 3334static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
3414{ 3335{
3415 u32 temp;
3416 u16 phy_data; 3336 u16 phy_data;
3417 3337
3418 e1000e_clear_hw_cntrs_base(hw); 3338 e1000e_clear_hw_cntrs_base(hw);
3419 3339
3420 temp = er32(ALGNERRC); 3340 er32(ALGNERRC);
3421 temp = er32(RXERRC); 3341 er32(RXERRC);
3422 temp = er32(TNCRS); 3342 er32(TNCRS);
3423 temp = er32(CEXTERR); 3343 er32(CEXTERR);
3424 temp = er32(TSCTC); 3344 er32(TSCTC);
3425 temp = er32(TSCTFC); 3345 er32(TSCTFC);
3426 3346
3427 temp = er32(MGTPRC); 3347 er32(MGTPRC);
3428 temp = er32(MGTPDC); 3348 er32(MGTPDC);
3429 temp = er32(MGTPTC); 3349 er32(MGTPTC);
3430 3350
3431 temp = er32(IAC); 3351 er32(IAC);
3432 temp = er32(ICRXOC); 3352 er32(ICRXOC);
3433 3353
3434 /* Clear PHY statistics registers */ 3354 /* Clear PHY statistics registers */
3435 if ((hw->phy.type == e1000_phy_82578) || 3355 if ((hw->phy.type == e1000_phy_82578) ||
3436 (hw->phy.type == e1000_phy_82577)) { 3356 (hw->phy.type == e1000_phy_82577)) {
3437 hw->phy.ops.read_phy_reg(hw, HV_SCC_UPPER, &phy_data); 3357 hw->phy.ops.read_reg(hw, HV_SCC_UPPER, &phy_data);
3438 hw->phy.ops.read_phy_reg(hw, HV_SCC_LOWER, &phy_data); 3358 hw->phy.ops.read_reg(hw, HV_SCC_LOWER, &phy_data);
3439 hw->phy.ops.read_phy_reg(hw, HV_ECOL_UPPER, &phy_data); 3359 hw->phy.ops.read_reg(hw, HV_ECOL_UPPER, &phy_data);
3440 hw->phy.ops.read_phy_reg(hw, HV_ECOL_LOWER, &phy_data); 3360 hw->phy.ops.read_reg(hw, HV_ECOL_LOWER, &phy_data);
3441 hw->phy.ops.read_phy_reg(hw, HV_MCC_UPPER, &phy_data); 3361 hw->phy.ops.read_reg(hw, HV_MCC_UPPER, &phy_data);
3442 hw->phy.ops.read_phy_reg(hw, HV_MCC_LOWER, &phy_data); 3362 hw->phy.ops.read_reg(hw, HV_MCC_LOWER, &phy_data);
3443 hw->phy.ops.read_phy_reg(hw, HV_LATECOL_UPPER, &phy_data); 3363 hw->phy.ops.read_reg(hw, HV_LATECOL_UPPER, &phy_data);
3444 hw->phy.ops.read_phy_reg(hw, HV_LATECOL_LOWER, &phy_data); 3364 hw->phy.ops.read_reg(hw, HV_LATECOL_LOWER, &phy_data);
3445 hw->phy.ops.read_phy_reg(hw, HV_COLC_UPPER, &phy_data); 3365 hw->phy.ops.read_reg(hw, HV_COLC_UPPER, &phy_data);
3446 hw->phy.ops.read_phy_reg(hw, HV_COLC_LOWER, &phy_data); 3366 hw->phy.ops.read_reg(hw, HV_COLC_LOWER, &phy_data);
3447 hw->phy.ops.read_phy_reg(hw, HV_DC_UPPER, &phy_data); 3367 hw->phy.ops.read_reg(hw, HV_DC_UPPER, &phy_data);
3448 hw->phy.ops.read_phy_reg(hw, HV_DC_LOWER, &phy_data); 3368 hw->phy.ops.read_reg(hw, HV_DC_LOWER, &phy_data);
3449 hw->phy.ops.read_phy_reg(hw, HV_TNCRS_UPPER, &phy_data); 3369 hw->phy.ops.read_reg(hw, HV_TNCRS_UPPER, &phy_data);
3450 hw->phy.ops.read_phy_reg(hw, HV_TNCRS_LOWER, &phy_data); 3370 hw->phy.ops.read_reg(hw, HV_TNCRS_LOWER, &phy_data);
3451 } 3371 }
3452} 3372}
3453 3373
@@ -3458,6 +3378,7 @@ static struct e1000_mac_operations ich8_mac_ops = {
3458 /* cleanup_led dependent on mac type */ 3378 /* cleanup_led dependent on mac type */
3459 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, 3379 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan,
3460 .get_bus_info = e1000_get_bus_info_ich8lan, 3380 .get_bus_info = e1000_get_bus_info_ich8lan,
3381 .set_lan_id = e1000_set_lan_id_single_port,
3461 .get_link_up_info = e1000_get_link_up_info_ich8lan, 3382 .get_link_up_info = e1000_get_link_up_info_ich8lan,
3462 /* led_on dependent on mac type */ 3383 /* led_on dependent on mac type */
3463 /* led_off dependent on mac type */ 3384 /* led_off dependent on mac type */
@@ -3470,29 +3391,27 @@ static struct e1000_mac_operations ich8_mac_ops = {
3470}; 3391};
3471 3392
3472static struct e1000_phy_operations ich8_phy_ops = { 3393static struct e1000_phy_operations ich8_phy_ops = {
3473 .acquire_phy = e1000_acquire_swflag_ich8lan, 3394 .acquire = e1000_acquire_swflag_ich8lan,
3474 .check_reset_block = e1000_check_reset_block_ich8lan, 3395 .check_reset_block = e1000_check_reset_block_ich8lan,
3475 .commit_phy = NULL, 3396 .commit = NULL,
3476 .force_speed_duplex = e1000_phy_force_speed_duplex_ich8lan,
3477 .get_cfg_done = e1000_get_cfg_done_ich8lan, 3397 .get_cfg_done = e1000_get_cfg_done_ich8lan,
3478 .get_cable_length = e1000e_get_cable_length_igp_2, 3398 .get_cable_length = e1000e_get_cable_length_igp_2,
3479 .get_phy_info = e1000_get_phy_info_ich8lan, 3399 .read_reg = e1000e_read_phy_reg_igp,
3480 .read_phy_reg = e1000e_read_phy_reg_igp, 3400 .release = e1000_release_swflag_ich8lan,
3481 .release_phy = e1000_release_swflag_ich8lan, 3401 .reset = e1000_phy_hw_reset_ich8lan,
3482 .reset_phy = e1000_phy_hw_reset_ich8lan,
3483 .set_d0_lplu_state = e1000_set_d0_lplu_state_ich8lan, 3402 .set_d0_lplu_state = e1000_set_d0_lplu_state_ich8lan,
3484 .set_d3_lplu_state = e1000_set_d3_lplu_state_ich8lan, 3403 .set_d3_lplu_state = e1000_set_d3_lplu_state_ich8lan,
3485 .write_phy_reg = e1000e_write_phy_reg_igp, 3404 .write_reg = e1000e_write_phy_reg_igp,
3486}; 3405};
3487 3406
3488static struct e1000_nvm_operations ich8_nvm_ops = { 3407static struct e1000_nvm_operations ich8_nvm_ops = {
3489 .acquire_nvm = e1000_acquire_nvm_ich8lan, 3408 .acquire = e1000_acquire_nvm_ich8lan,
3490 .read_nvm = e1000_read_nvm_ich8lan, 3409 .read = e1000_read_nvm_ich8lan,
3491 .release_nvm = e1000_release_nvm_ich8lan, 3410 .release = e1000_release_nvm_ich8lan,
3492 .update_nvm = e1000_update_nvm_checksum_ich8lan, 3411 .update = e1000_update_nvm_checksum_ich8lan,
3493 .valid_led_default = e1000_valid_led_default_ich8lan, 3412 .valid_led_default = e1000_valid_led_default_ich8lan,
3494 .validate_nvm = e1000_validate_nvm_checksum_ich8lan, 3413 .validate = e1000_validate_nvm_checksum_ich8lan,
3495 .write_nvm = e1000_write_nvm_ich8lan, 3414 .write = e1000_write_nvm_ich8lan,
3496}; 3415};
3497 3416
3498struct e1000_info e1000_ich8_info = { 3417struct e1000_info e1000_ich8_info = {