aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/82571.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000e/82571.c')
-rw-r--r--drivers/net/e1000e/82571.c332
1 files changed, 282 insertions, 50 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index d3d4a57e2450..8295f2192439 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.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 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2011 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,
@@ -52,6 +52,11 @@
52 (ID_LED_DEF1_DEF2)) 52 (ID_LED_DEF1_DEF2))
53 53
54#define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 54#define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000
55#define AN_RETRY_COUNT 5 /* Autoneg Retry Count value */
56#define E1000_BASE1000T_STATUS 10
57#define E1000_IDLE_ERROR_COUNT_MASK 0xFF
58#define E1000_RECEIVE_ERROR_COUNTER 21
59#define E1000_RECEIVE_ERROR_MAX 0xFFFF
55 60
56#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */ 61#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */
57 62
@@ -70,6 +75,11 @@ static bool e1000_check_mng_mode_82574(struct e1000_hw *hw);
70static s32 e1000_led_on_82574(struct e1000_hw *hw); 75static s32 e1000_led_on_82574(struct e1000_hw *hw);
71static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); 76static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw);
72static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw); 77static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw);
78static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw);
79static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw);
80static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw);
81static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active);
82static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active);
73 83
74/** 84/**
75 * e1000_init_phy_params_82571 - Init PHY func ptrs. 85 * e1000_init_phy_params_82571 - Init PHY func ptrs.
@@ -103,6 +113,10 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
103 case e1000_82574: 113 case e1000_82574:
104 case e1000_82583: 114 case e1000_82583:
105 phy->type = e1000_phy_bm; 115 phy->type = e1000_phy_bm;
116 phy->ops.acquire = e1000_get_hw_semaphore_82574;
117 phy->ops.release = e1000_put_hw_semaphore_82574;
118 phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82574;
119 phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82574;
106 break; 120 break;
107 default: 121 default:
108 return -E1000_ERR_PHY; 122 return -E1000_ERR_PHY;
@@ -111,29 +125,36 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
111 125
112 /* This can only be done after all function pointers are setup. */ 126 /* This can only be done after all function pointers are setup. */
113 ret_val = e1000_get_phy_id_82571(hw); 127 ret_val = e1000_get_phy_id_82571(hw);
128 if (ret_val) {
129 e_dbg("Error getting PHY ID\n");
130 return ret_val;
131 }
114 132
115 /* Verify phy id */ 133 /* Verify phy id */
116 switch (hw->mac.type) { 134 switch (hw->mac.type) {
117 case e1000_82571: 135 case e1000_82571:
118 case e1000_82572: 136 case e1000_82572:
119 if (phy->id != IGP01E1000_I_PHY_ID) 137 if (phy->id != IGP01E1000_I_PHY_ID)
120 return -E1000_ERR_PHY; 138 ret_val = -E1000_ERR_PHY;
121 break; 139 break;
122 case e1000_82573: 140 case e1000_82573:
123 if (phy->id != M88E1111_I_PHY_ID) 141 if (phy->id != M88E1111_I_PHY_ID)
124 return -E1000_ERR_PHY; 142 ret_val = -E1000_ERR_PHY;
125 break; 143 break;
126 case e1000_82574: 144 case e1000_82574:
127 case e1000_82583: 145 case e1000_82583:
128 if (phy->id != BME1000_E_PHY_ID_R2) 146 if (phy->id != BME1000_E_PHY_ID_R2)
129 return -E1000_ERR_PHY; 147 ret_val = -E1000_ERR_PHY;
130 break; 148 break;
131 default: 149 default:
132 return -E1000_ERR_PHY; 150 ret_val = -E1000_ERR_PHY;
133 break; 151 break;
134 } 152 }
135 153
136 return 0; 154 if (ret_val)
155 e_dbg("PHY ID unknown: type = 0x%08x\n", phy->id);
156
157 return ret_val;
137} 158}
138 159
139/** 160/**
@@ -196,6 +217,17 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
196 break; 217 break;
197 } 218 }
198 219
220 /* Function Pointers */
221 switch (hw->mac.type) {
222 case e1000_82574:
223 case e1000_82583:
224 nvm->ops.acquire = e1000_get_hw_semaphore_82574;
225 nvm->ops.release = e1000_put_hw_semaphore_82574;
226 break;
227 default:
228 break;
229 }
230
199 return 0; 231 return 0;
200} 232}
201 233
@@ -268,6 +300,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
268 func->set_lan_id = e1000_set_lan_id_single_port; 300 func->set_lan_id = e1000_set_lan_id_single_port;
269 func->check_mng_mode = e1000e_check_mng_mode_generic; 301 func->check_mng_mode = e1000e_check_mng_mode_generic;
270 func->led_on = e1000e_led_on_generic; 302 func->led_on = e1000e_led_on_generic;
303 func->blink_led = e1000e_blink_led_generic;
271 304
272 /* FWSM register */ 305 /* FWSM register */
273 mac->has_fwsm = true; 306 mac->has_fwsm = true;
@@ -288,6 +321,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
288 default: 321 default:
289 func->check_mng_mode = e1000e_check_mng_mode_generic; 322 func->check_mng_mode = e1000e_check_mng_mode_generic;
290 func->led_on = e1000e_led_on_generic; 323 func->led_on = e1000e_led_on_generic;
324 func->blink_led = e1000e_blink_led_generic;
291 325
292 /* FWSM register */ 326 /* FWSM register */
293 mac->has_fwsm = true; 327 mac->has_fwsm = true;
@@ -296,7 +330,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
296 330
297 /* 331 /*
298 * Ensure that the inter-port SWSM.SMBI lock bit is clear before 332 * Ensure that the inter-port SWSM.SMBI lock bit is clear before
299 * first NVM or PHY acess. This should be done for single-port 333 * first NVM or PHY access. This should be done for single-port
300 * devices, and for one port only on dual-port devices so that 334 * devices, and for one port only on dual-port devices so that
301 * for those devices we can still use the SMBI lock to synchronize 335 * for those devices we can still use the SMBI lock to synchronize
302 * inter-port accesses to the PHY & NVM. 336 * inter-port accesses to the PHY & NVM.
@@ -399,9 +433,6 @@ static s32 e1000_get_variants_82571(struct e1000_adapter *adapter)
399 case e1000_82573: 433 case e1000_82573:
400 case e1000_82574: 434 case e1000_82574:
401 case e1000_82583: 435 case e1000_82583:
402 /* Disable ASPM L0s due to hardware errata */
403 e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L0S);
404
405 if (pdev->device == E1000_DEV_ID_82573L) { 436 if (pdev->device == E1000_DEV_ID_82573L) {
406 adapter->flags |= FLAG_HAS_JUMBO_FRAMES; 437 adapter->flags |= FLAG_HAS_JUMBO_FRAMES;
407 adapter->max_hw_frame_size = DEFAULT_JUMBO; 438 adapter->max_hw_frame_size = DEFAULT_JUMBO;
@@ -538,6 +569,146 @@ static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw)
538 swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); 569 swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI);
539 ew32(SWSM, swsm); 570 ew32(SWSM, swsm);
540} 571}
572/**
573 * e1000_get_hw_semaphore_82573 - Acquire hardware semaphore
574 * @hw: pointer to the HW structure
575 *
576 * Acquire the HW semaphore during reset.
577 *
578 **/
579static s32 e1000_get_hw_semaphore_82573(struct e1000_hw *hw)
580{
581 u32 extcnf_ctrl;
582 s32 ret_val = 0;
583 s32 i = 0;
584
585 extcnf_ctrl = er32(EXTCNF_CTRL);
586 extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
587 do {
588 ew32(EXTCNF_CTRL, extcnf_ctrl);
589 extcnf_ctrl = er32(EXTCNF_CTRL);
590
591 if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP)
592 break;
593
594 extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
595
596 usleep_range(2000, 4000);
597 i++;
598 } while (i < MDIO_OWNERSHIP_TIMEOUT);
599
600 if (i == MDIO_OWNERSHIP_TIMEOUT) {
601 /* Release semaphores */
602 e1000_put_hw_semaphore_82573(hw);
603 e_dbg("Driver can't access the PHY\n");
604 ret_val = -E1000_ERR_PHY;
605 goto out;
606 }
607
608out:
609 return ret_val;
610}
611
612/**
613 * e1000_put_hw_semaphore_82573 - Release hardware semaphore
614 * @hw: pointer to the HW structure
615 *
616 * Release hardware semaphore used during reset.
617 *
618 **/
619static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw)
620{
621 u32 extcnf_ctrl;
622
623 extcnf_ctrl = er32(EXTCNF_CTRL);
624 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
625 ew32(EXTCNF_CTRL, extcnf_ctrl);
626}
627
628static DEFINE_MUTEX(swflag_mutex);
629
630/**
631 * e1000_get_hw_semaphore_82574 - Acquire hardware semaphore
632 * @hw: pointer to the HW structure
633 *
634 * Acquire the HW semaphore to access the PHY or NVM.
635 *
636 **/
637static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw)
638{
639 s32 ret_val;
640
641 mutex_lock(&swflag_mutex);
642 ret_val = e1000_get_hw_semaphore_82573(hw);
643 if (ret_val)
644 mutex_unlock(&swflag_mutex);
645 return ret_val;
646}
647
648/**
649 * e1000_put_hw_semaphore_82574 - Release hardware semaphore
650 * @hw: pointer to the HW structure
651 *
652 * Release hardware semaphore used to access the PHY or NVM
653 *
654 **/
655static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw)
656{
657 e1000_put_hw_semaphore_82573(hw);
658 mutex_unlock(&swflag_mutex);
659}
660
661/**
662 * e1000_set_d0_lplu_state_82574 - Set Low Power Linkup D0 state
663 * @hw: pointer to the HW structure
664 * @active: true to enable LPLU, false to disable
665 *
666 * Sets the LPLU D0 state according to the active flag.
667 * LPLU will not be activated unless the
668 * device autonegotiation advertisement meets standards of
669 * either 10 or 10/100 or 10/100/1000 at all duplexes.
670 * This is a function pointer entry point only called by
671 * PHY setup routines.
672 **/
673static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active)
674{
675 u16 data = er32(POEMB);
676
677 if (active)
678 data |= E1000_PHY_CTRL_D0A_LPLU;
679 else
680 data &= ~E1000_PHY_CTRL_D0A_LPLU;
681
682 ew32(POEMB, data);
683 return 0;
684}
685
686/**
687 * e1000_set_d3_lplu_state_82574 - Sets low power link up state for D3
688 * @hw: pointer to the HW structure
689 * @active: boolean used to enable/disable lplu
690 *
691 * The low power link up (lplu) state is set to the power management level D3
692 * when active is true, else clear lplu for D3. LPLU
693 * is used during Dx states where the power conservation is most important.
694 * During driver activity, SmartSpeed should be enabled so performance is
695 * maintained.
696 **/
697static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active)
698{
699 u16 data = er32(POEMB);
700
701 if (!active) {
702 data &= ~E1000_PHY_CTRL_NOND0A_LPLU;
703 } else if ((hw->phy.autoneg_advertised == E1000_ALL_SPEED_DUPLEX) ||
704 (hw->phy.autoneg_advertised == E1000_ALL_NOT_GIG) ||
705 (hw->phy.autoneg_advertised == E1000_ALL_10_SPEED)) {
706 data |= E1000_PHY_CTRL_NOND0A_LPLU;
707 }
708
709 ew32(POEMB, data);
710 return 0;
711}
541 712
542/** 713/**
543 * e1000_acquire_nvm_82571 - Request for access to the EEPROM 714 * e1000_acquire_nvm_82571 - Request for access to the EEPROM
@@ -558,8 +729,6 @@ static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw)
558 729
559 switch (hw->mac.type) { 730 switch (hw->mac.type) {
560 case e1000_82573: 731 case e1000_82573:
561 case e1000_82574:
562 case e1000_82583:
563 break; 732 break;
564 default: 733 default:
565 ret_val = e1000e_acquire_nvm(hw); 734 ret_val = e1000e_acquire_nvm(hw);
@@ -646,7 +815,7 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
646 815
647 /* Check for pending operations. */ 816 /* Check for pending operations. */
648 for (i = 0; i < E1000_FLASH_UPDATES; i++) { 817 for (i = 0; i < E1000_FLASH_UPDATES; i++) {
649 msleep(1); 818 usleep_range(1000, 2000);
650 if ((er32(EECD) & E1000_EECD_FLUPD) == 0) 819 if ((er32(EECD) & E1000_EECD_FLUPD) == 0)
651 break; 820 break;
652 } 821 }
@@ -670,7 +839,7 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
670 ew32(EECD, eecd); 839 ew32(EECD, eecd);
671 840
672 for (i = 0; i < E1000_FLASH_UPDATES; i++) { 841 for (i = 0; i < E1000_FLASH_UPDATES; i++) {
673 msleep(1); 842 usleep_range(1000, 2000);
674 if ((er32(EECD) & E1000_EECD_FLUPD) == 0) 843 if ((er32(EECD) & E1000_EECD_FLUPD) == 0)
675 break; 844 break;
676 } 845 }
@@ -760,7 +929,7 @@ static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw)
760 if (er32(EEMNGCTL) & 929 if (er32(EEMNGCTL) &
761 E1000_NVM_CFG_DONE_PORT_0) 930 E1000_NVM_CFG_DONE_PORT_0)
762 break; 931 break;
763 msleep(1); 932 usleep_range(1000, 2000);
764 timeout--; 933 timeout--;
765 } 934 }
766 if (!timeout) { 935 if (!timeout) {
@@ -849,9 +1018,8 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
849 **/ 1018 **/
850static s32 e1000_reset_hw_82571(struct e1000_hw *hw) 1019static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
851{ 1020{
852 u32 ctrl, extcnf_ctrl, ctrl_ext, icr; 1021 u32 ctrl, ctrl_ext;
853 s32 ret_val; 1022 s32 ret_val;
854 u16 i = 0;
855 1023
856 /* 1024 /*
857 * Prevent the PCI-E bus from sticking if there is no TLP connection 1025 * Prevent the PCI-E bus from sticking if there is no TLP connection
@@ -868,7 +1036,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
868 ew32(TCTL, E1000_TCTL_PSP); 1036 ew32(TCTL, E1000_TCTL_PSP);
869 e1e_flush(); 1037 e1e_flush();
870 1038
871 msleep(10); 1039 usleep_range(10000, 20000);
872 1040
873 /* 1041 /*
874 * Must acquire the MDIO ownership before MAC reset. 1042 * Must acquire the MDIO ownership before MAC reset.
@@ -876,33 +1044,33 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
876 */ 1044 */
877 switch (hw->mac.type) { 1045 switch (hw->mac.type) {
878 case e1000_82573: 1046 case e1000_82573:
1047 ret_val = e1000_get_hw_semaphore_82573(hw);
1048 break;
879 case e1000_82574: 1049 case e1000_82574:
880 case e1000_82583: 1050 case e1000_82583:
881 extcnf_ctrl = er32(EXTCNF_CTRL); 1051 ret_val = e1000_get_hw_semaphore_82574(hw);
882 extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
883
884 do {
885 ew32(EXTCNF_CTRL, extcnf_ctrl);
886 extcnf_ctrl = er32(EXTCNF_CTRL);
887
888 if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP)
889 break;
890
891 extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
892
893 msleep(2);
894 i++;
895 } while (i < MDIO_OWNERSHIP_TIMEOUT);
896 break; 1052 break;
897 default: 1053 default:
898 break; 1054 break;
899 } 1055 }
1056 if (ret_val)
1057 e_dbg("Cannot acquire MDIO ownership\n");
900 1058
901 ctrl = er32(CTRL); 1059 ctrl = er32(CTRL);
902 1060
903 e_dbg("Issuing a global reset to MAC\n"); 1061 e_dbg("Issuing a global reset to MAC\n");
904 ew32(CTRL, ctrl | E1000_CTRL_RST); 1062 ew32(CTRL, ctrl | E1000_CTRL_RST);
905 1063
1064 /* Must release MDIO ownership and mutex after MAC reset. */
1065 switch (hw->mac.type) {
1066 case e1000_82574:
1067 case e1000_82583:
1068 e1000_put_hw_semaphore_82574(hw);
1069 break;
1070 default:
1071 break;
1072 }
1073
906 if (hw->nvm.type == e1000_nvm_flash_hw) { 1074 if (hw->nvm.type == e1000_nvm_flash_hw) {
907 udelay(10); 1075 udelay(10);
908 ctrl_ext = er32(CTRL_EXT); 1076 ctrl_ext = er32(CTRL_EXT);
@@ -934,7 +1102,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
934 1102
935 /* Clear any pending interrupt events. */ 1103 /* Clear any pending interrupt events. */
936 ew32(IMC, 0xffffffff); 1104 ew32(IMC, 0xffffffff);
937 icr = er32(ICR); 1105 er32(ICR);
938 1106
939 if (hw->mac.type == e1000_82571) { 1107 if (hw->mac.type == e1000_82571) {
940 /* Install any alternate MAC address into RAR0 */ 1108 /* Install any alternate MAC address into RAR0 */
@@ -1141,7 +1309,7 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
1141 * apply workaround for hardware errata documented in errata 1309 * apply workaround for hardware errata documented in errata
1142 * docs Fixes issue where some error prone or unreliable PCIe 1310 * docs Fixes issue where some error prone or unreliable PCIe
1143 * completions are occurring, particularly with ASPM enabled. 1311 * completions are occurring, particularly with ASPM enabled.
1144 * Without fix, issue can cause tx timeouts. 1312 * Without fix, issue can cause Tx timeouts.
1145 */ 1313 */
1146 reg = er32(GCR2); 1314 reg = er32(GCR2);
1147 reg |= 1; 1315 reg |= 1;
@@ -1243,6 +1411,39 @@ static s32 e1000_led_on_82574(struct e1000_hw *hw)
1243} 1411}
1244 1412
1245/** 1413/**
1414 * e1000_check_phy_82574 - check 82574 phy hung state
1415 * @hw: pointer to the HW structure
1416 *
1417 * Returns whether phy is hung or not
1418 **/
1419bool e1000_check_phy_82574(struct e1000_hw *hw)
1420{
1421 u16 status_1kbt = 0;
1422 u16 receive_errors = 0;
1423 bool phy_hung = false;
1424 s32 ret_val = 0;
1425
1426 /*
1427 * Read PHY Receive Error counter first, if its is max - all F's then
1428 * read the Base1000T status register If both are max then PHY is hung.
1429 */
1430 ret_val = e1e_rphy(hw, E1000_RECEIVE_ERROR_COUNTER, &receive_errors);
1431
1432 if (ret_val)
1433 goto out;
1434 if (receive_errors == E1000_RECEIVE_ERROR_MAX) {
1435 ret_val = e1e_rphy(hw, E1000_BASE1000T_STATUS, &status_1kbt);
1436 if (ret_val)
1437 goto out;
1438 if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) ==
1439 E1000_IDLE_ERROR_COUNT_MASK)
1440 phy_hung = true;
1441 }
1442out:
1443 return phy_hung;
1444}
1445
1446/**
1246 * e1000_setup_link_82571 - Setup flow control and link settings 1447 * e1000_setup_link_82571 - Setup flow control and link settings
1247 * @hw: pointer to the HW structure 1448 * @hw: pointer to the HW structure
1248 * 1449 *
@@ -1365,6 +1566,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
1365 u32 rxcw; 1566 u32 rxcw;
1366 u32 ctrl; 1567 u32 ctrl;
1367 u32 status; 1568 u32 status;
1569 u32 txcw;
1570 u32 i;
1368 s32 ret_val = 0; 1571 s32 ret_val = 0;
1369 1572
1370 ctrl = er32(CTRL); 1573 ctrl = er32(CTRL);
@@ -1385,8 +1588,10 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
1385 e1000_serdes_link_autoneg_progress; 1588 e1000_serdes_link_autoneg_progress;
1386 mac->serdes_has_link = false; 1589 mac->serdes_has_link = false;
1387 e_dbg("AN_UP -> AN_PROG\n"); 1590 e_dbg("AN_UP -> AN_PROG\n");
1591 } else {
1592 mac->serdes_has_link = true;
1388 } 1593 }
1389 break; 1594 break;
1390 1595
1391 case e1000_serdes_link_forced_up: 1596 case e1000_serdes_link_forced_up:
1392 /* 1597 /*
@@ -1394,8 +1599,10 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
1394 * auto-negotiation in the TXCW register and disable 1599 * auto-negotiation in the TXCW register and disable
1395 * forced link in the Device Control register in an 1600 * forced link in the Device Control register in an
1396 * attempt to auto-negotiate with our link partner. 1601 * attempt to auto-negotiate with our link partner.
1602 * If the partner code word is null, stop forcing
1603 * and restart auto negotiation.
1397 */ 1604 */
1398 if (rxcw & E1000_RXCW_C) { 1605 if ((rxcw & E1000_RXCW_C) || !(rxcw & E1000_RXCW_CW)) {
1399 /* Enable autoneg, and unforce link up */ 1606 /* Enable autoneg, and unforce link up */
1400 ew32(TXCW, mac->txcw); 1607 ew32(TXCW, mac->txcw);
1401 ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); 1608 ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
@@ -1403,6 +1610,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
1403 e1000_serdes_link_autoneg_progress; 1610 e1000_serdes_link_autoneg_progress;
1404 mac->serdes_has_link = false; 1611 mac->serdes_has_link = false;
1405 e_dbg("FORCED_UP -> AN_PROG\n"); 1612 e_dbg("FORCED_UP -> AN_PROG\n");
1613 } else {
1614 mac->serdes_has_link = true;
1406 } 1615 }
1407 break; 1616 break;
1408 1617
@@ -1458,6 +1667,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
1458 ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); 1667 ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
1459 mac->serdes_link_state = 1668 mac->serdes_link_state =
1460 e1000_serdes_link_autoneg_progress; 1669 e1000_serdes_link_autoneg_progress;
1670 mac->serdes_has_link = false;
1461 e_dbg("DOWN -> AN_PROG\n"); 1671 e_dbg("DOWN -> AN_PROG\n");
1462 break; 1672 break;
1463 } 1673 }
@@ -1468,16 +1678,32 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
1468 e_dbg("ANYSTATE -> DOWN\n"); 1678 e_dbg("ANYSTATE -> DOWN\n");
1469 } else { 1679 } else {
1470 /* 1680 /*
1471 * We have sync, and can tolerate one invalid (IV) 1681 * Check several times, if Sync and Config
1472 * codeword before declaring link down, so reread 1682 * both are consistently 1 then simply ignore
1473 * to look again. 1683 * the Invalid bit and restart Autoneg
1474 */ 1684 */
1475 udelay(10); 1685 for (i = 0; i < AN_RETRY_COUNT; i++) {
1476 rxcw = er32(RXCW); 1686 udelay(10);
1477 if (rxcw & E1000_RXCW_IV) { 1687 rxcw = er32(RXCW);
1478 mac->serdes_link_state = e1000_serdes_link_down; 1688 if ((rxcw & E1000_RXCW_IV) &&
1689 !((rxcw & E1000_RXCW_SYNCH) &&
1690 (rxcw & E1000_RXCW_C))) {
1691 mac->serdes_has_link = false;
1692 mac->serdes_link_state =
1693 e1000_serdes_link_down;
1694 e_dbg("ANYSTATE -> DOWN\n");
1695 break;
1696 }
1697 }
1698
1699 if (i == AN_RETRY_COUNT) {
1700 txcw = er32(TXCW);
1701 txcw |= E1000_TXCW_ANE;
1702 ew32(TXCW, txcw);
1703 mac->serdes_link_state =
1704 e1000_serdes_link_autoneg_progress;
1479 mac->serdes_has_link = false; 1705 mac->serdes_has_link = false;
1480 e_dbg("ANYSTATE -> DOWN\n"); 1706 e_dbg("ANYSTATE -> AN_PROG\n");
1481 } 1707 }
1482 } 1708 }
1483 } 1709 }
@@ -1801,7 +2027,8 @@ struct e1000_info e1000_82571_info = {
1801 | FLAG_RESET_OVERWRITES_LAA /* errata */ 2027 | FLAG_RESET_OVERWRITES_LAA /* errata */
1802 | FLAG_TARC_SPEED_MODE_BIT /* errata */ 2028 | FLAG_TARC_SPEED_MODE_BIT /* errata */
1803 | FLAG_APME_CHECK_PORT_B, 2029 | FLAG_APME_CHECK_PORT_B,
1804 .flags2 = FLAG2_DISABLE_ASPM_L1, /* errata 13 */ 2030 .flags2 = FLAG2_DISABLE_ASPM_L1 /* errata 13 */
2031 | FLAG2_DMA_BURST,
1805 .pba = 38, 2032 .pba = 38,
1806 .max_hw_frame_size = DEFAULT_JUMBO, 2033 .max_hw_frame_size = DEFAULT_JUMBO,
1807 .get_variants = e1000_get_variants_82571, 2034 .get_variants = e1000_get_variants_82571,
@@ -1819,7 +2046,8 @@ struct e1000_info e1000_82572_info = {
1819 | FLAG_RX_CSUM_ENABLED 2046 | FLAG_RX_CSUM_ENABLED
1820 | FLAG_HAS_CTRLEXT_ON_LOAD 2047 | FLAG_HAS_CTRLEXT_ON_LOAD
1821 | FLAG_TARC_SPEED_MODE_BIT, /* errata */ 2048 | FLAG_TARC_SPEED_MODE_BIT, /* errata */
1822 .flags2 = FLAG2_DISABLE_ASPM_L1, /* errata 13 */ 2049 .flags2 = FLAG2_DISABLE_ASPM_L1 /* errata 13 */
2050 | FLAG2_DMA_BURST,
1823 .pba = 38, 2051 .pba = 38,
1824 .max_hw_frame_size = DEFAULT_JUMBO, 2052 .max_hw_frame_size = DEFAULT_JUMBO,
1825 .get_variants = e1000_get_variants_82571, 2053 .get_variants = e1000_get_variants_82571,
@@ -1837,7 +2065,8 @@ struct e1000_info e1000_82573_info = {
1837 | FLAG_HAS_SMART_POWER_DOWN 2065 | FLAG_HAS_SMART_POWER_DOWN
1838 | FLAG_HAS_AMT 2066 | FLAG_HAS_AMT
1839 | FLAG_HAS_SWSM_ON_LOAD, 2067 | FLAG_HAS_SWSM_ON_LOAD,
1840 .flags2 = FLAG2_DISABLE_ASPM_L1, 2068 .flags2 = FLAG2_DISABLE_ASPM_L1
2069 | FLAG2_DISABLE_ASPM_L0S,
1841 .pba = 20, 2070 .pba = 20,
1842 .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, 2071 .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
1843 .get_variants = e1000_get_variants_82571, 2072 .get_variants = e1000_get_variants_82571,
@@ -1857,7 +2086,9 @@ struct e1000_info e1000_82574_info = {
1857 | FLAG_HAS_SMART_POWER_DOWN 2086 | FLAG_HAS_SMART_POWER_DOWN
1858 | FLAG_HAS_AMT 2087 | FLAG_HAS_AMT
1859 | FLAG_HAS_CTRLEXT_ON_LOAD, 2088 | FLAG_HAS_CTRLEXT_ON_LOAD,
1860 .pba = 36, 2089 .flags2 = FLAG2_CHECK_PHY_HANG
2090 | FLAG2_DISABLE_ASPM_L0S,
2091 .pba = 32,
1861 .max_hw_frame_size = DEFAULT_JUMBO, 2092 .max_hw_frame_size = DEFAULT_JUMBO,
1862 .get_variants = e1000_get_variants_82571, 2093 .get_variants = e1000_get_variants_82571,
1863 .mac_ops = &e82571_mac_ops, 2094 .mac_ops = &e82571_mac_ops,
@@ -1874,7 +2105,8 @@ struct e1000_info e1000_82583_info = {
1874 | FLAG_HAS_SMART_POWER_DOWN 2105 | FLAG_HAS_SMART_POWER_DOWN
1875 | FLAG_HAS_AMT 2106 | FLAG_HAS_AMT
1876 | FLAG_HAS_CTRLEXT_ON_LOAD, 2107 | FLAG_HAS_CTRLEXT_ON_LOAD,
1877 .pba = 36, 2108 .flags2 = FLAG2_DISABLE_ASPM_L0S,
2109 .pba = 32,
1878 .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, 2110 .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
1879 .get_variants = e1000_get_variants_82571, 2111 .get_variants = e1000_get_variants_82571,
1880 .mac_ops = &e82571_mac_ops, 2112 .mac_ops = &e82571_mac_ops,