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.c334
1 files changed, 247 insertions, 87 deletions
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 9e23f50fb9cd..99df2abf82a9 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -338,9 +338,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
338{ 338{
339 struct e1000_nvm_info *nvm = &hw->nvm; 339 struct e1000_nvm_info *nvm = &hw->nvm;
340 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; 340 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
341 u32 gfpreg; 341 u32 gfpreg, sector_base_addr, sector_end_addr;
342 u32 sector_base_addr;
343 u32 sector_end_addr;
344 u16 i; 342 u16 i;
345 343
346 /* Can't read flash registers if the register set isn't mapped. */ 344 /* Can't read flash registers if the register set isn't mapped. */
@@ -446,6 +444,95 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
446 return 0; 444 return 0;
447} 445}
448 446
447/**
448 * e1000_check_for_copper_link_ich8lan - Check for link (Copper)
449 * @hw: pointer to the HW structure
450 *
451 * Checks to see of the link status of the hardware has changed. If a
452 * change in link status has been detected, then we read the PHY registers
453 * to get the current speed/duplex if link exists.
454 **/
455static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
456{
457 struct e1000_mac_info *mac = &hw->mac;
458 s32 ret_val;
459 bool link;
460
461 /*
462 * We only want to go out to the PHY registers to see if Auto-Neg
463 * has completed and/or if our link status has changed. The
464 * get_link_status flag is set upon receiving a Link Status
465 * Change or Rx Sequence Error interrupt.
466 */
467 if (!mac->get_link_status) {
468 ret_val = 0;
469 goto out;
470 }
471
472 if (hw->mac.type == e1000_pchlan) {
473 ret_val = e1000e_write_kmrn_reg(hw,
474 E1000_KMRNCTRLSTA_K1_CONFIG,
475 E1000_KMRNCTRLSTA_K1_ENABLE);
476 if (ret_val)
477 goto out;
478 }
479
480 /*
481 * First we want to see if the MII Status Register reports
482 * link. If so, then we want to get the current speed/duplex
483 * of the PHY.
484 */
485 ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
486 if (ret_val)
487 goto out;
488
489 if (!link)
490 goto out; /* No link detected */
491
492 mac->get_link_status = false;
493
494 if (hw->phy.type == e1000_phy_82578) {
495 ret_val = e1000_link_stall_workaround_hv(hw);
496 if (ret_val)
497 goto out;
498 }
499
500 /*
501 * Check if there was DownShift, must be checked
502 * immediately after link-up
503 */
504 e1000e_check_downshift(hw);
505
506 /*
507 * If we are forcing speed/duplex, then we simply return since
508 * we have already determined whether we have link or not.
509 */
510 if (!mac->autoneg) {
511 ret_val = -E1000_ERR_CONFIG;
512 goto out;
513 }
514
515 /*
516 * Auto-Neg is enabled. Auto Speed Detection takes care
517 * of MAC speed/duplex configuration. So we only need to
518 * configure Collision Distance in the MAC.
519 */
520 e1000e_config_collision_dist(hw);
521
522 /*
523 * Configure Flow Control now that Auto-Neg has completed.
524 * First, we need to restore the desired flow control
525 * settings because we may have had to re-autoneg with a
526 * different link partner.
527 */
528 ret_val = e1000e_config_fc_after_link_up(hw);
529 if (ret_val)
530 hw_dbg(hw, "Error configuring flow control\n");
531
532out:
533 return ret_val;
534}
535
449static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) 536static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
450{ 537{
451 struct e1000_hw *hw = &adapter->hw; 538 struct e1000_hw *hw = &adapter->hw;
@@ -490,8 +577,8 @@ static DEFINE_MUTEX(nvm_mutex);
490 **/ 577 **/
491static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) 578static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
492{ 579{
493 u32 extcnf_ctrl; 580 u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT;
494 u32 timeout = PHY_CFG_TIMEOUT; 581 s32 ret_val = 0;
495 582
496 might_sleep(); 583 might_sleep();
497 584
@@ -499,28 +586,46 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
499 586
500 while (timeout) { 587 while (timeout) {
501 extcnf_ctrl = er32(EXTCNF_CTRL); 588 extcnf_ctrl = er32(EXTCNF_CTRL);
589 if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG))
590 break;
502 591
503 if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)) { 592 mdelay(1);
504 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; 593 timeout--;
505 ew32(EXTCNF_CTRL, extcnf_ctrl); 594 }
595
596 if (!timeout) {
597 hw_dbg(hw, "SW/FW/HW has locked the resource for too long.\n");
598 ret_val = -E1000_ERR_CONFIG;
599 goto out;
600 }
601
602 timeout = PHY_CFG_TIMEOUT * 2;
603
604 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
605 ew32(EXTCNF_CTRL, extcnf_ctrl);
606
607 while (timeout) {
608 extcnf_ctrl = er32(EXTCNF_CTRL);
609 if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
610 break;
506 611
507 extcnf_ctrl = er32(EXTCNF_CTRL);
508 if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
509 break;
510 }
511 mdelay(1); 612 mdelay(1);
512 timeout--; 613 timeout--;
513 } 614 }
514 615
515 if (!timeout) { 616 if (!timeout) {
516 hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); 617 hw_dbg(hw, "Failed to acquire the semaphore.\n");
517 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; 618 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
518 ew32(EXTCNF_CTRL, extcnf_ctrl); 619 ew32(EXTCNF_CTRL, extcnf_ctrl);
519 mutex_unlock(&nvm_mutex); 620 ret_val = -E1000_ERR_CONFIG;
520 return -E1000_ERR_CONFIG; 621 goto out;
521 } 622 }
522 623
523 return 0; 624out:
625 if (ret_val)
626 mutex_unlock(&nvm_mutex);
627
628 return ret_val;
524} 629}
525 630
526/** 631/**
@@ -694,6 +799,38 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
694} 799}
695 800
696/** 801/**
802 * e1000_lan_init_done_ich8lan - Check for PHY config completion
803 * @hw: pointer to the HW structure
804 *
805 * Check the appropriate indication the MAC has finished configuring the
806 * PHY after a software reset.
807 **/
808static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw)
809{
810 u32 data, loop = E1000_ICH8_LAN_INIT_TIMEOUT;
811
812 /* Wait for basic configuration completes before proceeding */
813 do {
814 data = er32(STATUS);
815 data &= E1000_STATUS_LAN_INIT_DONE;
816 udelay(100);
817 } while ((!data) && --loop);
818
819 /*
820 * If basic configuration is incomplete before the above loop
821 * count reaches 0, loading the configuration from NVM will
822 * leave the PHY in a bad state possibly resulting in no link.
823 */
824 if (loop == 0)
825 hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n");
826
827 /* Clear the Init Done bit for the next init event */
828 data = er32(STATUS);
829 data &= ~E1000_STATUS_LAN_INIT_DONE;
830 ew32(STATUS, data);
831}
832
833/**
697 * e1000_phy_hw_reset_ich8lan - Performs a PHY reset 834 * e1000_phy_hw_reset_ich8lan - Performs a PHY reset
698 * @hw: pointer to the HW structure 835 * @hw: pointer to the HW structure
699 * 836 *
@@ -707,13 +844,15 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
707 u32 i; 844 u32 i;
708 u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; 845 u32 data, cnf_size, cnf_base_addr, sw_cfg_mask;
709 s32 ret_val; 846 s32 ret_val;
710 u16 loop = E1000_ICH8_LAN_INIT_TIMEOUT;
711 u16 word_addr, reg_data, reg_addr, phy_page = 0; 847 u16 word_addr, reg_data, reg_addr, phy_page = 0;
712 848
713 ret_val = e1000e_phy_hw_reset_generic(hw); 849 ret_val = e1000e_phy_hw_reset_generic(hw);
714 if (ret_val) 850 if (ret_val)
715 return ret_val; 851 return ret_val;
716 852
853 /* Allow time for h/w to get to a quiescent state after reset */
854 mdelay(10);
855
717 if (hw->mac.type == e1000_pchlan) { 856 if (hw->mac.type == e1000_pchlan) {
718 ret_val = e1000_hv_phy_workarounds_ich8lan(hw); 857 ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
719 if (ret_val) 858 if (ret_val)
@@ -741,26 +880,8 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
741 if (!(data & sw_cfg_mask)) 880 if (!(data & sw_cfg_mask))
742 return 0; 881 return 0;
743 882
744 /* Wait for basic configuration completes before proceeding*/ 883 /* Wait for basic configuration completes before proceeding */
745 do { 884 e1000_lan_init_done_ich8lan(hw);
746 data = er32(STATUS);
747 data &= E1000_STATUS_LAN_INIT_DONE;
748 udelay(100);
749 } while ((!data) && --loop);
750
751 /*
752 * If basic configuration is incomplete before the above loop
753 * count reaches 0, loading the configuration from NVM will
754 * leave the PHY in a bad state possibly resulting in no link.
755 */
756 if (loop == 0) {
757 hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n");
758 }
759
760 /* Clear the Init Done bit for the next init event */
761 data = er32(STATUS);
762 data &= ~E1000_STATUS_LAN_INIT_DONE;
763 ew32(STATUS, data);
764 885
765 /* 886 /*
766 * Make sure HW does not configure LCD from PHY 887 * Make sure HW does not configure LCD from PHY
@@ -961,12 +1082,14 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
961 phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; 1082 phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU;
962 ew32(PHY_CTRL, phy_ctrl); 1083 ew32(PHY_CTRL, phy_ctrl);
963 1084
1085 if (phy->type != e1000_phy_igp_3)
1086 return 0;
1087
964 /* 1088 /*
965 * Call gig speed drop workaround on LPLU before accessing 1089 * Call gig speed drop workaround on LPLU before accessing
966 * any PHY registers 1090 * any PHY registers
967 */ 1091 */
968 if ((hw->mac.type == e1000_ich8lan) && 1092 if (hw->mac.type == e1000_ich8lan)
969 (hw->phy.type == e1000_phy_igp_3))
970 e1000e_gig_downshift_workaround_ich8lan(hw); 1093 e1000e_gig_downshift_workaround_ich8lan(hw);
971 1094
972 /* When LPLU is enabled, we should disable SmartSpeed */ 1095 /* When LPLU is enabled, we should disable SmartSpeed */
@@ -979,6 +1102,9 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
979 phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; 1102 phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU;
980 ew32(PHY_CTRL, phy_ctrl); 1103 ew32(PHY_CTRL, phy_ctrl);
981 1104
1105 if (phy->type != e1000_phy_igp_3)
1106 return 0;
1107
982 /* 1108 /*
983 * LPLU and SmartSpeed are mutually exclusive. LPLU is used 1109 * LPLU and SmartSpeed are mutually exclusive. LPLU is used
984 * during Dx states where the power conservation is most 1110 * during Dx states where the power conservation is most
@@ -1038,6 +1164,10 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
1038 if (!active) { 1164 if (!active) {
1039 phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; 1165 phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU;
1040 ew32(PHY_CTRL, phy_ctrl); 1166 ew32(PHY_CTRL, phy_ctrl);
1167
1168 if (phy->type != e1000_phy_igp_3)
1169 return 0;
1170
1041 /* 1171 /*
1042 * LPLU and SmartSpeed are mutually exclusive. LPLU is used 1172 * LPLU and SmartSpeed are mutually exclusive. LPLU is used
1043 * during Dx states where the power conservation is most 1173 * during Dx states where the power conservation is most
@@ -1073,12 +1203,14 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active)
1073 phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; 1203 phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU;
1074 ew32(PHY_CTRL, phy_ctrl); 1204 ew32(PHY_CTRL, phy_ctrl);
1075 1205
1206 if (phy->type != e1000_phy_igp_3)
1207 return 0;
1208
1076 /* 1209 /*
1077 * Call gig speed drop workaround on LPLU before accessing 1210 * Call gig speed drop workaround on LPLU before accessing
1078 * any PHY registers 1211 * any PHY registers
1079 */ 1212 */
1080 if ((hw->mac.type == e1000_ich8lan) && 1213 if (hw->mac.type == e1000_ich8lan)
1081 (hw->phy.type == e1000_phy_igp_3))
1082 e1000e_gig_downshift_workaround_ich8lan(hw); 1214 e1000e_gig_downshift_workaround_ich8lan(hw);
1083 1215
1084 /* When LPLU is enabled, we should disable SmartSpeed */ 1216 /* When LPLU is enabled, we should disable SmartSpeed */
@@ -1175,7 +1307,7 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1175 struct e1000_nvm_info *nvm = &hw->nvm; 1307 struct e1000_nvm_info *nvm = &hw->nvm;
1176 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; 1308 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
1177 u32 act_offset; 1309 u32 act_offset;
1178 s32 ret_val; 1310 s32 ret_val = 0;
1179 u32 bank = 0; 1311 u32 bank = 0;
1180 u16 i, word; 1312 u16 i, word;
1181 1313
@@ -1190,12 +1322,15 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1190 goto out; 1322 goto out;
1191 1323
1192 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); 1324 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
1193 if (ret_val) 1325 if (ret_val) {
1194 goto release; 1326 hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n");
1327 bank = 0;
1328 }
1195 1329
1196 act_offset = (bank) ? nvm->flash_bank_size : 0; 1330 act_offset = (bank) ? nvm->flash_bank_size : 0;
1197 act_offset += offset; 1331 act_offset += offset;
1198 1332
1333 ret_val = 0;
1199 for (i = 0; i < words; i++) { 1334 for (i = 0; i < words; i++) {
1200 if ((dev_spec->shadow_ram) && 1335 if ((dev_spec->shadow_ram) &&
1201 (dev_spec->shadow_ram[offset+i].modified)) { 1336 (dev_spec->shadow_ram[offset+i].modified)) {
@@ -1210,7 +1345,6 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1210 } 1345 }
1211 } 1346 }
1212 1347
1213release:
1214 e1000_release_swflag_ich8lan(hw); 1348 e1000_release_swflag_ich8lan(hw);
1215 1349
1216out: 1350out:
@@ -1461,7 +1595,6 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1461{ 1595{
1462 struct e1000_nvm_info *nvm = &hw->nvm; 1596 struct e1000_nvm_info *nvm = &hw->nvm;
1463 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; 1597 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
1464 s32 ret_val;
1465 u16 i; 1598 u16 i;
1466 1599
1467 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || 1600 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
@@ -1470,17 +1603,11 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1470 return -E1000_ERR_NVM; 1603 return -E1000_ERR_NVM;
1471 } 1604 }
1472 1605
1473 ret_val = e1000_acquire_swflag_ich8lan(hw);
1474 if (ret_val)
1475 return ret_val;
1476
1477 for (i = 0; i < words; i++) { 1606 for (i = 0; i < words; i++) {
1478 dev_spec->shadow_ram[offset+i].modified = 1; 1607 dev_spec->shadow_ram[offset+i].modified = 1;
1479 dev_spec->shadow_ram[offset+i].value = data[i]; 1608 dev_spec->shadow_ram[offset+i].value = data[i];
1480 } 1609 }
1481 1610
1482 e1000_release_swflag_ich8lan(hw);
1483
1484 return 0; 1611 return 0;
1485} 1612}
1486 1613
@@ -1521,8 +1648,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1521 */ 1648 */
1522 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); 1649 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
1523 if (ret_val) { 1650 if (ret_val) {
1524 e1000_release_swflag_ich8lan(hw); 1651 hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n");
1525 goto out; 1652 bank = 0;
1526 } 1653 }
1527 1654
1528 if (bank == 0) { 1655 if (bank == 0) {
@@ -1905,19 +2032,15 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)
1905 break; 2032 break;
1906 case 1: 2033 case 1:
1907 sector_size = ICH_FLASH_SEG_SIZE_4K; 2034 sector_size = ICH_FLASH_SEG_SIZE_4K;
1908 iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_4K; 2035 iteration = 1;
1909 break; 2036 break;
1910 case 2: 2037 case 2:
1911 if (hw->mac.type == e1000_ich9lan) { 2038 sector_size = ICH_FLASH_SEG_SIZE_8K;
1912 sector_size = ICH_FLASH_SEG_SIZE_8K; 2039 iteration = 1;
1913 iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_8K;
1914 } else {
1915 return -E1000_ERR_NVM;
1916 }
1917 break; 2040 break;
1918 case 3: 2041 case 3:
1919 sector_size = ICH_FLASH_SEG_SIZE_64K; 2042 sector_size = ICH_FLASH_SEG_SIZE_64K;
1920 iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_64K; 2043 iteration = 1;
1921 break; 2044 break;
1922 default: 2045 default:
1923 return -E1000_ERR_NVM; 2046 return -E1000_ERR_NVM;
@@ -1925,7 +2048,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)
1925 2048
1926 /* Start with the base address, then add the sector offset. */ 2049 /* Start with the base address, then add the sector offset. */
1927 flash_linear_addr = hw->nvm.flash_base_addr; 2050 flash_linear_addr = hw->nvm.flash_base_addr;
1928 flash_linear_addr += (bank) ? (sector_size * iteration) : 0; 2051 flash_linear_addr += (bank) ? flash_bank_size : 0;
1929 2052
1930 for (j = 0; j < iteration ; j++) { 2053 for (j = 0; j < iteration ; j++) {
1931 do { 2054 do {
@@ -2143,6 +2266,12 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2143 ctrl = er32(CTRL); 2266 ctrl = er32(CTRL);
2144 2267
2145 if (!e1000_check_reset_block(hw)) { 2268 if (!e1000_check_reset_block(hw)) {
2269 /* Clear PHY Reset Asserted bit */
2270 if (hw->mac.type >= e1000_pchlan) {
2271 u32 status = er32(STATUS);
2272 ew32(STATUS, status & ~E1000_STATUS_PHYRA);
2273 }
2274
2146 /* 2275 /*
2147 * PHY HW reset requires MAC CORE reset at the same 2276 * PHY HW reset requires MAC CORE reset at the same
2148 * time to make sure the interface between MAC and the 2277 * time to make sure the interface between MAC and the
@@ -2156,23 +2285,34 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
2156 ew32(CTRL, (ctrl | E1000_CTRL_RST)); 2285 ew32(CTRL, (ctrl | E1000_CTRL_RST));
2157 msleep(20); 2286 msleep(20);
2158 2287
2159 if (!ret_val) { 2288 if (!ret_val)
2160 /* release the swflag because it is not reset by
2161 * hardware reset
2162 */
2163 e1000_release_swflag_ich8lan(hw); 2289 e1000_release_swflag_ich8lan(hw);
2164 }
2165 2290
2166 ret_val = e1000e_get_auto_rd_done(hw); 2291 if (ctrl & E1000_CTRL_PHY_RST)
2167 if (ret_val) { 2292 ret_val = hw->phy.ops.get_cfg_done(hw);
2168 /* 2293
2169 * When auto config read does not complete, do not 2294 if (hw->mac.type >= e1000_ich10lan) {
2170 * return with an error. This can happen in situations 2295 e1000_lan_init_done_ich8lan(hw);
2171 * where there is no eeprom and prevents getting link. 2296 } else {
2172 */ 2297 ret_val = e1000e_get_auto_rd_done(hw);
2173 hw_dbg(hw, "Auto Read Done did not complete\n"); 2298 if (ret_val) {
2299 /*
2300 * When auto config read does not complete, do not
2301 * return with an error. This can happen in situations
2302 * where there is no eeprom and prevents getting link.
2303 */
2304 hw_dbg(hw, "Auto Read Done did not complete\n");
2305 }
2174 } 2306 }
2175 2307
2308 /*
2309 * For PCH, this write will make sure that any noise
2310 * will be detected as a CRC error and be dropped rather than show up
2311 * as a bad packet to the DMA engine.
2312 */
2313 if (hw->mac.type == e1000_pchlan)
2314 ew32(CRC_OFFSET, 0x65656565);
2315
2176 ew32(IMC, 0xffffffff); 2316 ew32(IMC, 0xffffffff);
2177 icr = er32(ICR); 2317 icr = er32(ICR);
2178 2318
@@ -2222,6 +2362,18 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
2222 for (i = 0; i < mac->mta_reg_count; i++) 2362 for (i = 0; i < mac->mta_reg_count; i++)
2223 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); 2363 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
2224 2364
2365 /*
2366 * The 82578 Rx buffer will stall if wakeup is enabled in host and
2367 * the ME. Reading the BM_WUC register will clear the host wakeup bit.
2368 * Reset the phy after disabling host wakeup to reset the Rx buffer.
2369 */
2370 if (hw->phy.type == e1000_phy_82578) {
2371 hw->phy.ops.read_phy_reg(hw, BM_WUC, &i);
2372 ret_val = e1000_phy_hw_reset_ich8lan(hw);
2373 if (ret_val)
2374 return ret_val;
2375 }
2376
2225 /* Setup link and flow control */ 2377 /* Setup link and flow control */
2226 ret_val = e1000_setup_link_ich8lan(hw); 2378 ret_val = e1000_setup_link_ich8lan(hw);
2227 2379
@@ -2254,16 +2406,6 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
2254 ew32(CTRL_EXT, ctrl_ext); 2406 ew32(CTRL_EXT, ctrl_ext);
2255 2407
2256 /* 2408 /*
2257 * The 82578 Rx buffer will stall if wakeup is enabled in host and
2258 * the ME. Reading the BM_WUC register will clear the host wakeup bit.
2259 * Reset the phy after disabling host wakeup to reset the Rx buffer.
2260 */
2261 if (hw->phy.type == e1000_phy_82578) {
2262 e1e_rphy(hw, BM_WUC, &i);
2263 e1000e_phy_hw_reset_generic(hw);
2264 }
2265
2266 /*
2267 * Clear all of the statistics registers (clear on read). It is 2409 * Clear all of the statistics registers (clear on read). It is
2268 * important that we do this after we have tried to establish link 2410 * important that we do this after we have tried to establish link
2269 * because the symbol error count will increment wildly if there 2411 * because the symbol error count will increment wildly if there
@@ -2485,6 +2627,14 @@ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed,
2485 if (ret_val) 2627 if (ret_val)
2486 return ret_val; 2628 return ret_val;
2487 2629
2630 if ((hw->mac.type == e1000_pchlan) && (*speed == SPEED_1000)) {
2631 ret_val = e1000e_write_kmrn_reg(hw,
2632 E1000_KMRNCTRLSTA_K1_CONFIG,
2633 E1000_KMRNCTRLSTA_K1_DISABLE);
2634 if (ret_val)
2635 return ret_val;
2636 }
2637
2488 if ((hw->mac.type == e1000_ich8lan) && 2638 if ((hw->mac.type == e1000_ich8lan) &&
2489 (hw->phy.type == e1000_phy_igp_3) && 2639 (hw->phy.type == e1000_phy_igp_3) &&
2490 (*speed == SPEED_1000)) { 2640 (*speed == SPEED_1000)) {
@@ -2850,6 +3000,16 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
2850{ 3000{
2851 u32 bank = 0; 3001 u32 bank = 0;
2852 3002
3003 if (hw->mac.type >= e1000_pchlan) {
3004 u32 status = er32(STATUS);
3005
3006 if (status & E1000_STATUS_PHYRA)
3007 ew32(STATUS, status & ~E1000_STATUS_PHYRA);
3008 else
3009 hw_dbg(hw,
3010 "PHY Reset Asserted not set - needs delay\n");
3011 }
3012
2853 e1000e_get_cfg_done(hw); 3013 e1000e_get_cfg_done(hw);
2854 3014
2855 /* If EEPROM is not marked present, init the IGP 3 PHY manually */ 3015 /* If EEPROM is not marked present, init the IGP 3 PHY manually */
@@ -2921,7 +3081,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw)
2921static struct e1000_mac_operations ich8_mac_ops = { 3081static struct e1000_mac_operations ich8_mac_ops = {
2922 .id_led_init = e1000e_id_led_init, 3082 .id_led_init = e1000e_id_led_init,
2923 .check_mng_mode = e1000_check_mng_mode_ich8lan, 3083 .check_mng_mode = e1000_check_mng_mode_ich8lan,
2924 .check_for_link = e1000e_check_for_copper_link, 3084 .check_for_link = e1000_check_for_copper_link_ich8lan,
2925 /* cleanup_led dependent on mac type */ 3085 /* cleanup_led dependent on mac type */
2926 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, 3086 .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan,
2927 .get_bus_info = e1000_get_bus_info_ich8lan, 3087 .get_bus_info = e1000_get_bus_info_ich8lan,