aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000
diff options
context:
space:
mode:
authorMallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com>2005-10-04 06:58:59 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-04 06:58:59 -0400
commit868d5309942927dc86f57009420c5d366ec05daa (patch)
treec251bfd8341b6bf30064dd0ae50d790d8df65f7e /drivers/net/e1000
parentcc6e7c44f4b8ab13acf5521cd4b312848122179f (diff)
e1000: Support for 82571 and 82572 controllers
Signed-off-by: Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com> Signed-off-by: Ganesh Venkatesan <ganesh.venkatesan@intel.com> Signed-off-by: John Ronciak <john.ronciak@intel.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r--drivers/net/e1000/e1000_ethtool.c9
-rw-r--r--drivers/net/e1000/e1000_hw.c219
-rw-r--r--drivers/net/e1000/e1000_hw.h96
-rw-r--r--drivers/net/e1000/e1000_main.c102
4 files changed, 372 insertions, 54 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 8f3a13420278..5f9a36bb77f5 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -696,6 +696,11 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
696 * Some bits that get toggled are ignored. 696 * Some bits that get toggled are ignored.
697 */ 697 */
698 switch (adapter->hw.mac_type) { 698 switch (adapter->hw.mac_type) {
699 /* there are several bits on newer hardware that are r/w */
700 case e1000_82571:
701 case e1000_82572:
702 toggle = 0x7FFFF3FF;
703 break;
699 case e1000_82573: 704 case e1000_82573:
700 toggle = 0x7FFFF033; 705 toggle = 0x7FFFF033;
701 break; 706 break;
@@ -1245,6 +1250,8 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter)
1245 case e1000_82541_rev_2: 1250 case e1000_82541_rev_2:
1246 case e1000_82547: 1251 case e1000_82547:
1247 case e1000_82547_rev_2: 1252 case e1000_82547_rev_2:
1253 case e1000_82571:
1254 case e1000_82572:
1248 case e1000_82573: 1255 case e1000_82573:
1249 return e1000_integrated_phy_loopback(adapter); 1256 return e1000_integrated_phy_loopback(adapter);
1250 break; 1257 break;
@@ -1625,7 +1632,7 @@ e1000_phys_id(struct net_device *netdev, uint32_t data)
1625 if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) 1632 if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ))
1626 data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); 1633 data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ);
1627 1634
1628 if(adapter->hw.mac_type < e1000_82573) { 1635 if(adapter->hw.mac_type < e1000_82571) {
1629 if(!adapter->blink_timer.function) { 1636 if(!adapter->blink_timer.function) {
1630 init_timer(&adapter->blink_timer); 1637 init_timer(&adapter->blink_timer);
1631 adapter->blink_timer.function = e1000_led_blink_callback; 1638 adapter->blink_timer.function = e1000_led_blink_callback;
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 045f5426ab9a..7d627dd89a3d 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -83,14 +83,14 @@ uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] =
83 83
84static const 84static const
85uint16_t e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] = 85uint16_t e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] =
86 { 8, 13, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 86 { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21,
87 22, 24, 27, 30, 32, 35, 37, 40, 42, 44, 47, 49, 51, 54, 56, 58, 87 0, 0, 0, 3, 6, 10, 13, 16, 19, 23, 26, 29, 32, 35, 38, 41,
88 32, 35, 38, 41, 44, 47, 50, 53, 55, 58, 61, 63, 66, 69, 71, 74, 88 6, 10, 14, 18, 22, 26, 30, 33, 37, 41, 44, 48, 51, 54, 58, 61,
89 43, 47, 51, 54, 58, 61, 64, 67, 71, 74, 77, 80, 82, 85, 88, 90, 89 21, 26, 31, 35, 40, 44, 49, 53, 57, 61, 65, 68, 72, 75, 79, 82,
90 57, 62, 66, 70, 74, 77, 81, 85, 88, 91, 94, 97, 100, 103, 106, 108, 90 40, 45, 51, 56, 61, 66, 70, 75, 79, 83, 87, 91, 94, 98, 101, 104,
91 73, 78, 82, 87, 91, 95, 98, 102, 105, 109, 112, 114, 117, 119, 122, 124, 91 60, 66, 72, 77, 82, 87, 92, 96, 100, 104, 108, 111, 114, 117, 119, 121,
92 91, 96, 101, 105, 109, 113, 116, 119, 122, 125, 127, 128, 128, 128, 128, 128, 92 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
93 108, 113, 117, 121, 124, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}; 93 104, 109, 114, 118, 121, 124};
94 94
95 95
96/****************************************************************************** 96/******************************************************************************
@@ -286,7 +286,6 @@ e1000_set_mac_type(struct e1000_hw *hw)
286 case E1000_DEV_ID_82546GB_FIBER: 286 case E1000_DEV_ID_82546GB_FIBER:
287 case E1000_DEV_ID_82546GB_SERDES: 287 case E1000_DEV_ID_82546GB_SERDES:
288 case E1000_DEV_ID_82546GB_PCIE: 288 case E1000_DEV_ID_82546GB_PCIE:
289 case E1000_DEV_ID_82546GB_QUAD_COPPER:
290 hw->mac_type = e1000_82546_rev_3; 289 hw->mac_type = e1000_82546_rev_3;
291 break; 290 break;
292 case E1000_DEV_ID_82541EI: 291 case E1000_DEV_ID_82541EI:
@@ -305,8 +304,19 @@ e1000_set_mac_type(struct e1000_hw *hw)
305 case E1000_DEV_ID_82547GI: 304 case E1000_DEV_ID_82547GI:
306 hw->mac_type = e1000_82547_rev_2; 305 hw->mac_type = e1000_82547_rev_2;
307 break; 306 break;
307 case E1000_DEV_ID_82571EB_COPPER:
308 case E1000_DEV_ID_82571EB_FIBER:
309 case E1000_DEV_ID_82571EB_SERDES:
310 hw->mac_type = e1000_82571;
311 break;
312 case E1000_DEV_ID_82572EI_COPPER:
313 case E1000_DEV_ID_82572EI_FIBER:
314 case E1000_DEV_ID_82572EI_SERDES:
315 hw->mac_type = e1000_82572;
316 break;
308 case E1000_DEV_ID_82573E: 317 case E1000_DEV_ID_82573E:
309 case E1000_DEV_ID_82573E_IAMT: 318 case E1000_DEV_ID_82573E_IAMT:
319 case E1000_DEV_ID_82573L:
310 hw->mac_type = e1000_82573; 320 hw->mac_type = e1000_82573;
311 break; 321 break;
312 default: 322 default:
@@ -315,6 +325,8 @@ e1000_set_mac_type(struct e1000_hw *hw)
315 } 325 }
316 326
317 switch(hw->mac_type) { 327 switch(hw->mac_type) {
328 case e1000_82571:
329 case e1000_82572:
318 case e1000_82573: 330 case e1000_82573:
319 hw->eeprom_semaphore_present = TRUE; 331 hw->eeprom_semaphore_present = TRUE;
320 /* fall through */ 332 /* fall through */
@@ -351,6 +363,8 @@ e1000_set_media_type(struct e1000_hw *hw)
351 switch (hw->device_id) { 363 switch (hw->device_id) {
352 case E1000_DEV_ID_82545GM_SERDES: 364 case E1000_DEV_ID_82545GM_SERDES:
353 case E1000_DEV_ID_82546GB_SERDES: 365 case E1000_DEV_ID_82546GB_SERDES:
366 case E1000_DEV_ID_82571EB_SERDES:
367 case E1000_DEV_ID_82572EI_SERDES:
354 hw->media_type = e1000_media_type_internal_serdes; 368 hw->media_type = e1000_media_type_internal_serdes;
355 break; 369 break;
356 default: 370 default:
@@ -523,6 +537,8 @@ e1000_reset_hw(struct e1000_hw *hw)
523 E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); 537 E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
524 E1000_WRITE_FLUSH(hw); 538 E1000_WRITE_FLUSH(hw);
525 /* fall through */ 539 /* fall through */
540 case e1000_82571:
541 case e1000_82572:
526 ret_val = e1000_get_auto_rd_done(hw); 542 ret_val = e1000_get_auto_rd_done(hw);
527 if(ret_val) 543 if(ret_val)
528 /* We don't want to continue accessing MAC registers. */ 544 /* We don't want to continue accessing MAC registers. */
@@ -683,6 +699,9 @@ e1000_init_hw(struct e1000_hw *hw)
683 switch (hw->mac_type) { 699 switch (hw->mac_type) {
684 default: 700 default:
685 break; 701 break;
702 case e1000_82571:
703 case e1000_82572:
704 ctrl |= (1 << 22);
686 case e1000_82573: 705 case e1000_82573:
687 ctrl |= E1000_TXDCTL_COUNT_DESC; 706 ctrl |= E1000_TXDCTL_COUNT_DESC;
688 break; 707 break;
@@ -694,6 +713,25 @@ e1000_init_hw(struct e1000_hw *hw)
694 e1000_enable_tx_pkt_filtering(hw); 713 e1000_enable_tx_pkt_filtering(hw);
695 } 714 }
696 715
716 switch (hw->mac_type) {
717 default:
718 break;
719 case e1000_82571:
720 ctrl = E1000_READ_REG(hw, TXDCTL1);
721 ctrl &= ~E1000_TXDCTL_WTHRESH;
722 ctrl |= E1000_TXDCTL_COUNT_DESC | E1000_TXDCTL_FULL_TX_DESC_WB;
723 ctrl |= (1 << 22);
724 E1000_WRITE_REG(hw, TXDCTL1, ctrl);
725 break;
726 }
727
728
729
730 if (hw->mac_type == e1000_82573) {
731 uint32_t gcr = E1000_READ_REG(hw, GCR);
732 gcr |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX;
733 E1000_WRITE_REG(hw, GCR, gcr);
734 }
697 735
698 /* Clear all of the statistics registers (clear on read). It is 736 /* Clear all of the statistics registers (clear on read). It is
699 * important that we do this after we have tried to establish link 737 * important that we do this after we have tried to establish link
@@ -878,6 +916,14 @@ e1000_setup_fiber_serdes_link(struct e1000_hw *hw)
878 916
879 DEBUGFUNC("e1000_setup_fiber_serdes_link"); 917 DEBUGFUNC("e1000_setup_fiber_serdes_link");
880 918
919 /* On 82571 and 82572 Fiber connections, SerDes loopback mode persists
920 * until explicitly turned off or a power cycle is performed. A read to
921 * the register does not indicate its status. Therefore, we ensure
922 * loopback mode is disabled during initialization.
923 */
924 if (hw->mac_type == e1000_82571 || hw->mac_type == e1000_82572)
925 E1000_WRITE_REG(hw, SCTL, E1000_DISABLE_SERDES_LOOPBACK);
926
881 /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be 927 /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be
882 * set when the optics detect a signal. On older adapters, it will be 928 * set when the optics detect a signal. On older adapters, it will be
883 * cleared when there is a signal. This applies to fiber media only. 929 * cleared when there is a signal. This applies to fiber media only.
@@ -2943,6 +2989,8 @@ e1000_phy_reset(struct e1000_hw *hw)
2943 2989
2944 switch (hw->mac_type) { 2990 switch (hw->mac_type) {
2945 case e1000_82541_rev_2: 2991 case e1000_82541_rev_2:
2992 case e1000_82571:
2993 case e1000_82572:
2946 ret_val = e1000_phy_hw_reset(hw); 2994 ret_val = e1000_phy_hw_reset(hw);
2947 if(ret_val) 2995 if(ret_val)
2948 return ret_val; 2996 return ret_val;
@@ -2981,6 +3029,16 @@ e1000_detect_gig_phy(struct e1000_hw *hw)
2981 3029
2982 DEBUGFUNC("e1000_detect_gig_phy"); 3030 DEBUGFUNC("e1000_detect_gig_phy");
2983 3031
3032 /* The 82571 firmware may still be configuring the PHY. In this
3033 * case, we cannot access the PHY until the configuration is done. So
3034 * we explicitly set the PHY values. */
3035 if(hw->mac_type == e1000_82571 ||
3036 hw->mac_type == e1000_82572) {
3037 hw->phy_id = IGP01E1000_I_PHY_ID;
3038 hw->phy_type = e1000_phy_igp_2;
3039 return E1000_SUCCESS;
3040 }
3041
2984 /* Read the PHY ID Registers to identify which PHY is onboard. */ 3042 /* Read the PHY ID Registers to identify which PHY is onboard. */
2985 ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); 3043 ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high);
2986 if(ret_val) 3044 if(ret_val)
@@ -3334,6 +3392,21 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
3334 eeprom->use_eerd = FALSE; 3392 eeprom->use_eerd = FALSE;
3335 eeprom->use_eewr = FALSE; 3393 eeprom->use_eewr = FALSE;
3336 break; 3394 break;
3395 case e1000_82571:
3396 case e1000_82572:
3397 eeprom->type = e1000_eeprom_spi;
3398 eeprom->opcode_bits = 8;
3399 eeprom->delay_usec = 1;
3400 if (eecd & E1000_EECD_ADDR_BITS) {
3401 eeprom->page_size = 32;
3402 eeprom->address_bits = 16;
3403 } else {
3404 eeprom->page_size = 8;
3405 eeprom->address_bits = 8;
3406 }
3407 eeprom->use_eerd = FALSE;
3408 eeprom->use_eewr = FALSE;
3409 break;
3337 case e1000_82573: 3410 case e1000_82573:
3338 eeprom->type = e1000_eeprom_spi; 3411 eeprom->type = e1000_eeprom_spi;
3339 eeprom->opcode_bits = 8; 3412 eeprom->opcode_bits = 8;
@@ -3543,25 +3616,26 @@ e1000_acquire_eeprom(struct e1000_hw *hw)
3543 eecd = E1000_READ_REG(hw, EECD); 3616 eecd = E1000_READ_REG(hw, EECD);
3544 3617
3545 if (hw->mac_type != e1000_82573) { 3618 if (hw->mac_type != e1000_82573) {
3546 /* Request EEPROM Access */ 3619 /* Request EEPROM Access */
3547 if(hw->mac_type > e1000_82544) { 3620 if(hw->mac_type > e1000_82544) {
3548 eecd |= E1000_EECD_REQ; 3621 eecd |= E1000_EECD_REQ;
3549 E1000_WRITE_REG(hw, EECD, eecd);
3550 eecd = E1000_READ_REG(hw, EECD);
3551 while((!(eecd & E1000_EECD_GNT)) &&
3552 (i < E1000_EEPROM_GRANT_ATTEMPTS)) {
3553 i++;
3554 udelay(5);
3555 eecd = E1000_READ_REG(hw, EECD);
3556 }
3557 if(!(eecd & E1000_EECD_GNT)) {
3558 eecd &= ~E1000_EECD_REQ;
3559 E1000_WRITE_REG(hw, EECD, eecd); 3622 E1000_WRITE_REG(hw, EECD, eecd);
3560 DEBUGOUT("Could not acquire EEPROM grant\n"); 3623 eecd = E1000_READ_REG(hw, EECD);
3561 return -E1000_ERR_EEPROM; 3624 while((!(eecd & E1000_EECD_GNT)) &&
3625 (i < E1000_EEPROM_GRANT_ATTEMPTS)) {
3626 i++;
3627 udelay(5);
3628 eecd = E1000_READ_REG(hw, EECD);
3629 }
3630 if(!(eecd & E1000_EECD_GNT)) {
3631 eecd &= ~E1000_EECD_REQ;
3632 E1000_WRITE_REG(hw, EECD, eecd);
3633 DEBUGOUT("Could not acquire EEPROM grant\n");
3634 e1000_put_hw_eeprom_semaphore(hw);
3635 return -E1000_ERR_EEPROM;
3636 }
3562 } 3637 }
3563 } 3638 }
3564 }
3565 3639
3566 /* Setup EEPROM for Read/Write */ 3640 /* Setup EEPROM for Read/Write */
3567 3641
@@ -4064,7 +4138,7 @@ e1000_write_eeprom(struct e1000_hw *hw,
4064 return -E1000_ERR_EEPROM; 4138 return -E1000_ERR_EEPROM;
4065 } 4139 }
4066 4140
4067 /* 82573 reads only through eerd */ 4141 /* 82573 writes only through eewr */
4068 if(eeprom->use_eewr == TRUE) 4142 if(eeprom->use_eewr == TRUE)
4069 return e1000_write_eeprom_eewr(hw, offset, words, data); 4143 return e1000_write_eeprom_eewr(hw, offset, words, data);
4070 4144
@@ -4353,9 +4427,16 @@ e1000_read_mac_addr(struct e1000_hw * hw)
4353 hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); 4427 hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF);
4354 hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); 4428 hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8);
4355 } 4429 }
4356 if(((hw->mac_type == e1000_82546) || (hw->mac_type == e1000_82546_rev_3)) && 4430 switch (hw->mac_type) {
4357 (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) 4431 default:
4432 break;
4433 case e1000_82546:
4434 case e1000_82546_rev_3:
4435 case e1000_82571:
4436 if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)
4358 hw->perm_mac_addr[5] ^= 0x01; 4437 hw->perm_mac_addr[5] ^= 0x01;
4438 break;
4439 }
4359 4440
4360 for(i = 0; i < NODE_ADDRESS_SIZE; i++) 4441 for(i = 0; i < NODE_ADDRESS_SIZE; i++)
4361 hw->mac_addr[i] = hw->perm_mac_addr[i]; 4442 hw->mac_addr[i] = hw->perm_mac_addr[i];
@@ -4385,6 +4466,12 @@ e1000_init_rx_addrs(struct e1000_hw *hw)
4385 e1000_rar_set(hw, hw->mac_addr, 0); 4466 e1000_rar_set(hw, hw->mac_addr, 0);
4386 4467
4387 rar_num = E1000_RAR_ENTRIES; 4468 rar_num = E1000_RAR_ENTRIES;
4469
4470 /* Reserve a spot for the Locally Administered Address to work around
4471 * an 82571 issue in which a reset on one port will reload the MAC on
4472 * the other port. */
4473 if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE))
4474 rar_num -= 1;
4388 /* Zero out the other 15 receive addresses. */ 4475 /* Zero out the other 15 receive addresses. */
4389 DEBUGOUT("Clearing RAR[1-15]\n"); 4476 DEBUGOUT("Clearing RAR[1-15]\n");
4390 for(i = 1; i < rar_num; i++) { 4477 for(i = 1; i < rar_num; i++) {
@@ -4427,6 +4514,12 @@ e1000_mc_addr_list_update(struct e1000_hw *hw,
4427 /* Clear RAR[1-15] */ 4514 /* Clear RAR[1-15] */
4428 DEBUGOUT(" Clearing RAR[1-15]\n"); 4515 DEBUGOUT(" Clearing RAR[1-15]\n");
4429 num_rar_entry = E1000_RAR_ENTRIES; 4516 num_rar_entry = E1000_RAR_ENTRIES;
4517 /* Reserve a spot for the Locally Administered Address to work around
4518 * an 82571 issue in which a reset on one port will reload the MAC on
4519 * the other port. */
4520 if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE))
4521 num_rar_entry -= 1;
4522
4430 for(i = rar_used_count; i < num_rar_entry; i++) { 4523 for(i = rar_used_count; i < num_rar_entry; i++) {
4431 E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); 4524 E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
4432 E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); 4525 E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
@@ -4984,7 +5077,6 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw)
4984 temp = E1000_READ_REG(hw, ICTXQEC); 5077 temp = E1000_READ_REG(hw, ICTXQEC);
4985 temp = E1000_READ_REG(hw, ICTXQMTC); 5078 temp = E1000_READ_REG(hw, ICTXQMTC);
4986 temp = E1000_READ_REG(hw, ICRXDMTC); 5079 temp = E1000_READ_REG(hw, ICRXDMTC);
4987
4988} 5080}
4989 5081
4990/****************************************************************************** 5082/******************************************************************************
@@ -5151,6 +5243,8 @@ e1000_get_bus_info(struct e1000_hw *hw)
5151 hw->bus_speed = e1000_bus_speed_unknown; 5243 hw->bus_speed = e1000_bus_speed_unknown;
5152 hw->bus_width = e1000_bus_width_unknown; 5244 hw->bus_width = e1000_bus_width_unknown;
5153 break; 5245 break;
5246 case e1000_82571:
5247 case e1000_82572:
5154 case e1000_82573: 5248 case e1000_82573:
5155 hw->bus_type = e1000_bus_type_pci_express; 5249 hw->bus_type = e1000_bus_type_pci_express;
5156 hw->bus_speed = e1000_bus_speed_2500; 5250 hw->bus_speed = e1000_bus_speed_2500;
@@ -5250,6 +5344,7 @@ e1000_get_cable_length(struct e1000_hw *hw,
5250 int32_t ret_val; 5344 int32_t ret_val;
5251 uint16_t agc_value = 0; 5345 uint16_t agc_value = 0;
5252 uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE; 5346 uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE;
5347 uint16_t max_agc = 0;
5253 uint16_t i, phy_data; 5348 uint16_t i, phy_data;
5254 uint16_t cable_length; 5349 uint16_t cable_length;
5255 5350
@@ -5338,6 +5433,40 @@ e1000_get_cable_length(struct e1000_hw *hw,
5338 IGP01E1000_AGC_RANGE) : 0; 5433 IGP01E1000_AGC_RANGE) : 0;
5339 *max_length = e1000_igp_cable_length_table[agc_value] + 5434 *max_length = e1000_igp_cable_length_table[agc_value] +
5340 IGP01E1000_AGC_RANGE; 5435 IGP01E1000_AGC_RANGE;
5436 } else if (hw->phy_type == e1000_phy_igp_2) {
5437 uint16_t agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] =
5438 {IGP02E1000_PHY_AGC_A,
5439 IGP02E1000_PHY_AGC_B,
5440 IGP02E1000_PHY_AGC_C,
5441 IGP02E1000_PHY_AGC_D};
5442 /* Read the AGC registers for all channels */
5443 for (i = 0; i < IGP02E1000_PHY_CHANNEL_NUM; i++) {
5444 ret_val = e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data);
5445 if (ret_val)
5446 return ret_val;
5447
5448 /* Getting bits 15:9, which represent the combination of course and
5449 * fine gain values. The result is a number that can be put into
5450 * the lookup table to obtain the approximate cable length. */
5451 cur_agc = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) &
5452 IGP02E1000_AGC_LENGTH_MASK;
5453
5454 /* Remove min & max AGC values from calculation. */
5455 if (e1000_igp_2_cable_length_table[min_agc] > e1000_igp_2_cable_length_table[cur_agc])
5456 min_agc = cur_agc;
5457 if (e1000_igp_2_cable_length_table[max_agc] < e1000_igp_2_cable_length_table[cur_agc])
5458 max_agc = cur_agc;
5459
5460 agc_value += e1000_igp_2_cable_length_table[cur_agc];
5461 }
5462
5463 agc_value -= (e1000_igp_2_cable_length_table[min_agc] + e1000_igp_2_cable_length_table[max_agc]);
5464 agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2);
5465
5466 /* Calculate cable length with the error range of +/- 10 meters. */
5467 *min_length = ((agc_value - IGP02E1000_AGC_RANGE) > 0) ?
5468 (agc_value - IGP02E1000_AGC_RANGE) : 0;
5469 *max_length = agc_value + IGP02E1000_AGC_RANGE;
5341 } 5470 }
5342 5471
5343 return E1000_SUCCESS; 5472 return E1000_SUCCESS;
@@ -6465,6 +6594,8 @@ e1000_get_auto_rd_done(struct e1000_hw *hw)
6465 default: 6594 default:
6466 msec_delay(5); 6595 msec_delay(5);
6467 break; 6596 break;
6597 case e1000_82571:
6598 case e1000_82572:
6468 case e1000_82573: 6599 case e1000_82573:
6469 while(timeout) { 6600 while(timeout) {
6470 if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break; 6601 if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break;
@@ -6494,10 +6625,31 @@ e1000_get_auto_rd_done(struct e1000_hw *hw)
6494int32_t 6625int32_t
6495e1000_get_phy_cfg_done(struct e1000_hw *hw) 6626e1000_get_phy_cfg_done(struct e1000_hw *hw)
6496{ 6627{
6628 int32_t timeout = PHY_CFG_TIMEOUT;
6629 uint32_t cfg_mask = E1000_EEPROM_CFG_DONE;
6630
6497 DEBUGFUNC("e1000_get_phy_cfg_done"); 6631 DEBUGFUNC("e1000_get_phy_cfg_done");
6498 6632
6499 /* Simply wait for 10ms */ 6633 switch (hw->mac_type) {
6500 msec_delay(10); 6634 default:
6635 msec_delay(10);
6636 break;
6637 case e1000_82571:
6638 case e1000_82572:
6639 while (timeout) {
6640 if (E1000_READ_REG(hw, EEMNGCTL) & cfg_mask)
6641 break;
6642 else
6643 msec_delay(1);
6644 timeout--;
6645 }
6646
6647 if (!timeout) {
6648 DEBUGOUT("MNG configuration cycle has not completed.\n");
6649 return -E1000_ERR_RESET;
6650 }
6651 break;
6652 }
6501 6653
6502 return E1000_SUCCESS; 6654 return E1000_SUCCESS;
6503} 6655}
@@ -6569,8 +6721,7 @@ e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw)
6569 return; 6721 return;
6570 6722
6571 swsm = E1000_READ_REG(hw, SWSM); 6723 swsm = E1000_READ_REG(hw, SWSM);
6572 /* Release both semaphores. */ 6724 swsm &= ~(E1000_SWSM_SWESMBI);
6573 swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI);
6574 E1000_WRITE_REG(hw, SWSM, swsm); 6725 E1000_WRITE_REG(hw, SWSM, swsm);
6575} 6726}
6576 6727
@@ -6606,6 +6757,8 @@ e1000_arc_subsystem_valid(struct e1000_hw *hw)
6606 * if this is the case. We read FWSM to determine the manageability mode. 6757 * if this is the case. We read FWSM to determine the manageability mode.
6607 */ 6758 */
6608 switch (hw->mac_type) { 6759 switch (hw->mac_type) {
6760 case e1000_82571:
6761 case e1000_82572:
6609 case e1000_82573: 6762 case e1000_82573:
6610 fwsm = E1000_READ_REG(hw, FWSM); 6763 fwsm = E1000_READ_REG(hw, FWSM);
6611 if((fwsm & E1000_FWSM_MODE_MASK) != 0) 6764 if((fwsm & E1000_FWSM_MODE_MASK) != 0)
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index 51c2b3a18b6f..4f2c196dc314 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -57,6 +57,8 @@ typedef enum {
57 e1000_82541_rev_2, 57 e1000_82541_rev_2,
58 e1000_82547, 58 e1000_82547,
59 e1000_82547_rev_2, 59 e1000_82547_rev_2,
60 e1000_82571,
61 e1000_82572,
60 e1000_82573, 62 e1000_82573,
61 e1000_num_macs 63 e1000_num_macs
62} e1000_mac_type; 64} e1000_mac_type;
@@ -478,10 +480,16 @@ uint8_t e1000_arc_subsystem_valid(struct e1000_hw *hw);
478#define E1000_DEV_ID_82546GB_SERDES 0x107B 480#define E1000_DEV_ID_82546GB_SERDES 0x107B
479#define E1000_DEV_ID_82546GB_PCIE 0x108A 481#define E1000_DEV_ID_82546GB_PCIE 0x108A
480#define E1000_DEV_ID_82547EI 0x1019 482#define E1000_DEV_ID_82547EI 0x1019
483#define E1000_DEV_ID_82571EB_COPPER 0x105E
484#define E1000_DEV_ID_82571EB_FIBER 0x105F
485#define E1000_DEV_ID_82571EB_SERDES 0x1060
486#define E1000_DEV_ID_82572EI_COPPER 0x107D
487#define E1000_DEV_ID_82572EI_FIBER 0x107E
488#define E1000_DEV_ID_82572EI_SERDES 0x107F
481#define E1000_DEV_ID_82573E 0x108B 489#define E1000_DEV_ID_82573E 0x108B
482#define E1000_DEV_ID_82573E_IAMT 0x108C 490#define E1000_DEV_ID_82573E_IAMT 0x108C
491#define E1000_DEV_ID_82573L 0x109A
483 492
484#define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099
485 493
486#define NODE_ADDRESS_SIZE 6 494#define NODE_ADDRESS_SIZE 6
487#define ETH_LENGTH_OF_ADDRESS 6 495#define ETH_LENGTH_OF_ADDRESS 6
@@ -833,6 +841,8 @@ struct e1000_ffvt_entry {
833#define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX 841#define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX
834#define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX 842#define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX
835 843
844#define E1000_DISABLE_SERDES_LOOPBACK 0x0400
845
836/* Register Set. (82543, 82544) 846/* Register Set. (82543, 82544)
837 * 847 *
838 * Registers are defined to be 32 bits and should be accessed as 32 bit values. 848 * Registers are defined to be 32 bits and should be accessed as 32 bit values.
@@ -853,6 +863,7 @@ struct e1000_ffvt_entry {
853#define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ 863#define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */
854#define E1000_FLA 0x0001C /* Flash Access - RW */ 864#define E1000_FLA 0x0001C /* Flash Access - RW */
855#define E1000_MDIC 0x00020 /* MDI Control - RW */ 865#define E1000_MDIC 0x00020 /* MDI Control - RW */
866#define E1000_SCTL 0x00024 /* SerDes Control - RW */
856#define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ 867#define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */
857#define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ 868#define E1000_FCAH 0x0002C /* Flow Control Address High -RW */
858#define E1000_FCT 0x00030 /* Flow Control Type - RW */ 869#define E1000_FCT 0x00030 /* Flow Control Type - RW */
@@ -864,6 +875,12 @@ struct e1000_ffvt_entry {
864#define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ 875#define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */
865#define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */ 876#define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */
866#define E1000_RCTL 0x00100 /* RX Control - RW */ 877#define E1000_RCTL 0x00100 /* RX Control - RW */
878#define E1000_RDTR1 0x02820 /* RX Delay Timer (1) - RW */
879#define E1000_RDBAL1 0x02900 /* RX Descriptor Base Address Low (1) - RW */
880#define E1000_RDBAH1 0x02904 /* RX Descriptor Base Address High (1) - RW */
881#define E1000_RDLEN1 0x02908 /* RX Descriptor Length (1) - RW */
882#define E1000_RDH1 0x02910 /* RX Descriptor Head (1) - RW */
883#define E1000_RDT1 0x02918 /* RX Descriptor Tail (1) - RW */
867#define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */ 884#define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */
868#define E1000_TXCW 0x00178 /* TX Configuration Word - RW */ 885#define E1000_TXCW 0x00178 /* TX Configuration Word - RW */
869#define E1000_RXCW 0x00180 /* RX Configuration Word - RO */ 886#define E1000_RXCW 0x00180 /* RX Configuration Word - RO */
@@ -895,6 +912,12 @@ struct e1000_ffvt_entry {
895#define E1000_RDH 0x02810 /* RX Descriptor Head - RW */ 912#define E1000_RDH 0x02810 /* RX Descriptor Head - RW */
896#define E1000_RDT 0x02818 /* RX Descriptor Tail - RW */ 913#define E1000_RDT 0x02818 /* RX Descriptor Tail - RW */
897#define E1000_RDTR 0x02820 /* RX Delay Timer - RW */ 914#define E1000_RDTR 0x02820 /* RX Delay Timer - RW */
915#define E1000_RDBAL0 E1000_RDBAL /* RX Desc Base Address Low (0) - RW */
916#define E1000_RDBAH0 E1000_RDBAH /* RX Desc Base Address High (0) - RW */
917#define E1000_RDLEN0 E1000_RDLEN /* RX Desc Length (0) - RW */
918#define E1000_RDH0 E1000_RDH /* RX Desc Head (0) - RW */
919#define E1000_RDT0 E1000_RDT /* RX Desc Tail (0) - RW */
920#define E1000_RDTR0 E1000_RDTR /* RX Delay Timer (0) - RW */
898#define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */ 921#define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */
899#define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */ 922#define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */
900#define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */ 923#define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */
@@ -980,15 +1003,15 @@ struct e1000_ffvt_entry {
980#define E1000_BPTC 0x040F4 /* Broadcast Packets TX Count - R/clr */ 1003#define E1000_BPTC 0x040F4 /* Broadcast Packets TX Count - R/clr */
981#define E1000_TSCTC 0x040F8 /* TCP Segmentation Context TX - R/clr */ 1004#define E1000_TSCTC 0x040F8 /* TCP Segmentation Context TX - R/clr */
982#define E1000_TSCTFC 0x040FC /* TCP Segmentation Context TX Fail - R/clr */ 1005#define E1000_TSCTFC 0x040FC /* TCP Segmentation Context TX Fail - R/clr */
983#define E1000_IAC 0x4100 /* Interrupt Assertion Count */ 1006#define E1000_IAC 0x04100 /* Interrupt Assertion Count */
984#define E1000_ICRXPTC 0x4104 /* Interrupt Cause Rx Packet Timer Expire Count */ 1007#define E1000_ICRXPTC 0x04104 /* Interrupt Cause Rx Packet Timer Expire Count */
985#define E1000_ICRXATC 0x4108 /* Interrupt Cause Rx Absolute Timer Expire Count */ 1008#define E1000_ICRXATC 0x04108 /* Interrupt Cause Rx Absolute Timer Expire Count */
986#define E1000_ICTXPTC 0x410C /* Interrupt Cause Tx Packet Timer Expire Count */ 1009#define E1000_ICTXPTC 0x0410C /* Interrupt Cause Tx Packet Timer Expire Count */
987#define E1000_ICTXATC 0x4110 /* Interrupt Cause Tx Absolute Timer Expire Count */ 1010#define E1000_ICTXATC 0x04110 /* Interrupt Cause Tx Absolute Timer Expire Count */
988#define E1000_ICTXQEC 0x4118 /* Interrupt Cause Tx Queue Empty Count */ 1011#define E1000_ICTXQEC 0x04118 /* Interrupt Cause Tx Queue Empty Count */
989#define E1000_ICTXQMTC 0x411C /* Interrupt Cause Tx Queue Minimum Threshold Count */ 1012#define E1000_ICTXQMTC 0x0411C /* Interrupt Cause Tx Queue Minimum Threshold Count */
990#define E1000_ICRXDMTC 0x4120 /* Interrupt Cause Rx Descriptor Minimum Threshold Count */ 1013#define E1000_ICRXDMTC 0x04120 /* Interrupt Cause Rx Descriptor Minimum Threshold Count */
991#define E1000_ICRXOC 0x4124 /* Interrupt Cause Receiver Overrun Count */ 1014#define E1000_ICRXOC 0x04124 /* Interrupt Cause Receiver Overrun Count */
992#define E1000_RXCSUM 0x05000 /* RX Checksum Control - RW */ 1015#define E1000_RXCSUM 0x05000 /* RX Checksum Control - RW */
993#define E1000_RFCTL 0x05008 /* Receive Filter Control*/ 1016#define E1000_RFCTL 0x05008 /* Receive Filter Control*/
994#define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ 1017#define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */
@@ -1018,6 +1041,14 @@ struct e1000_ffvt_entry {
1018#define E1000_FWSM 0x05B54 /* FW Semaphore */ 1041#define E1000_FWSM 0x05B54 /* FW Semaphore */
1019#define E1000_FFLT_DBG 0x05F04 /* Debug Register */ 1042#define E1000_FFLT_DBG 0x05F04 /* Debug Register */
1020#define E1000_HICR 0x08F00 /* Host Inteface Control */ 1043#define E1000_HICR 0x08F00 /* Host Inteface Control */
1044
1045/* RSS registers */
1046#define E1000_CPUVEC 0x02C10 /* CPU Vector Register - RW */
1047#define E1000_MRQC 0x05818 /* Multiple Receive Control - RW */
1048#define E1000_RETA 0x05C00 /* Redirection Table - RW Array */
1049#define E1000_RSSRK 0x05C80 /* RSS Random Key - RW Array */
1050#define E1000_RSSIM 0x05864 /* RSS Interrupt Mask */
1051#define E1000_RSSIR 0x05868 /* RSS Interrupt Request */
1021/* Register Set (82542) 1052/* Register Set (82542)
1022 * 1053 *
1023 * Some of the 82542 registers are located at different offsets than they are 1054 * Some of the 82542 registers are located at different offsets than they are
@@ -1032,6 +1063,7 @@ struct e1000_ffvt_entry {
1032#define E1000_82542_CTRL_EXT E1000_CTRL_EXT 1063#define E1000_82542_CTRL_EXT E1000_CTRL_EXT
1033#define E1000_82542_FLA E1000_FLA 1064#define E1000_82542_FLA E1000_FLA
1034#define E1000_82542_MDIC E1000_MDIC 1065#define E1000_82542_MDIC E1000_MDIC
1066#define E1000_82542_SCTL E1000_SCTL
1035#define E1000_82542_FCAL E1000_FCAL 1067#define E1000_82542_FCAL E1000_FCAL
1036#define E1000_82542_FCAH E1000_FCAH 1068#define E1000_82542_FCAH E1000_FCAH
1037#define E1000_82542_FCT E1000_FCT 1069#define E1000_82542_FCT E1000_FCT
@@ -1049,6 +1081,18 @@ struct e1000_ffvt_entry {
1049#define E1000_82542_RDLEN 0x00118 1081#define E1000_82542_RDLEN 0x00118
1050#define E1000_82542_RDH 0x00120 1082#define E1000_82542_RDH 0x00120
1051#define E1000_82542_RDT 0x00128 1083#define E1000_82542_RDT 0x00128
1084#define E1000_82542_RDTR0 E1000_82542_RDTR
1085#define E1000_82542_RDBAL0 E1000_82542_RDBAL
1086#define E1000_82542_RDBAH0 E1000_82542_RDBAH
1087#define E1000_82542_RDLEN0 E1000_82542_RDLEN
1088#define E1000_82542_RDH0 E1000_82542_RDH
1089#define E1000_82542_RDT0 E1000_82542_RDT
1090#define E1000_82542_RDTR1 0x00130
1091#define E1000_82542_RDBAL1 0x00138
1092#define E1000_82542_RDBAH1 0x0013C
1093#define E1000_82542_RDLEN1 0x00140
1094#define E1000_82542_RDH1 0x00148
1095#define E1000_82542_RDT1 0x00150
1052#define E1000_82542_FCRTH 0x00160 1096#define E1000_82542_FCRTH 0x00160
1053#define E1000_82542_FCRTL 0x00168 1097#define E1000_82542_FCRTL 0x00168
1054#define E1000_82542_FCTTV E1000_FCTTV 1098#define E1000_82542_FCTTV E1000_FCTTV
@@ -1197,6 +1241,13 @@ struct e1000_ffvt_entry {
1197#define E1000_82542_ICRXOC E1000_ICRXOC 1241#define E1000_82542_ICRXOC E1000_ICRXOC
1198#define E1000_82542_HICR E1000_HICR 1242#define E1000_82542_HICR E1000_HICR
1199 1243
1244#define E1000_82542_CPUVEC E1000_CPUVEC
1245#define E1000_82542_MRQC E1000_MRQC
1246#define E1000_82542_RETA E1000_RETA
1247#define E1000_82542_RSSRK E1000_RSSRK
1248#define E1000_82542_RSSIM E1000_RSSIM
1249#define E1000_82542_RSSIR E1000_RSSIR
1250
1200/* Statistics counters collected by the MAC */ 1251/* Statistics counters collected by the MAC */
1201struct e1000_hw_stats { 1252struct e1000_hw_stats {
1202 uint64_t crcerrs; 1253 uint64_t crcerrs;
@@ -1336,6 +1387,7 @@ struct e1000_hw {
1336 boolean_t serdes_link_down; 1387 boolean_t serdes_link_down;
1337 boolean_t tbi_compatibility_en; 1388 boolean_t tbi_compatibility_en;
1338 boolean_t tbi_compatibility_on; 1389 boolean_t tbi_compatibility_on;
1390 boolean_t laa_is_present;
1339 boolean_t phy_reset_disable; 1391 boolean_t phy_reset_disable;
1340 boolean_t fc_send_xon; 1392 boolean_t fc_send_xon;
1341 boolean_t fc_strict_ieee; 1393 boolean_t fc_strict_ieee;
@@ -1374,6 +1426,7 @@ struct e1000_hw {
1374#define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */ 1426#define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */
1375#define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ 1427#define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */
1376#define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ 1428#define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */
1429#define E1000_CTRL_D_UD_EN 0x00002000 /* Dock/Undock enable */
1377#define E1000_CTRL_D_UD_POLARITY 0x00004000 /* Defined polarity of Dock/Undock indication in SDP[0] */ 1430#define E1000_CTRL_D_UD_POLARITY 0x00004000 /* Defined polarity of Dock/Undock indication in SDP[0] */
1378#define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ 1431#define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */
1379#define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ 1432#define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */
@@ -1491,6 +1544,8 @@ struct e1000_hw {
1491#define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 1544#define E1000_CTRL_EXT_WR_WMARK_320 0x01000000
1492#define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 1545#define E1000_CTRL_EXT_WR_WMARK_384 0x02000000
1493#define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 1546#define E1000_CTRL_EXT_WR_WMARK_448 0x03000000
1547#define E1000_CTRL_EXT_CANC 0x04000000 /* Interrupt delay cancellation */
1548#define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */
1494#define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ 1549#define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */
1495#define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ 1550#define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */
1496 1551
@@ -1524,6 +1579,7 @@ struct e1000_hw {
1524#define E1000_LEDCTL_LED2_BLINK 0x00800000 1579#define E1000_LEDCTL_LED2_BLINK 0x00800000
1525#define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 1580#define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000
1526#define E1000_LEDCTL_LED3_MODE_SHIFT 24 1581#define E1000_LEDCTL_LED3_MODE_SHIFT 24
1582#define E1000_LEDCTL_LED3_BLINK_RATE 0x20000000
1527#define E1000_LEDCTL_LED3_IVRT 0x40000000 1583#define E1000_LEDCTL_LED3_IVRT 0x40000000
1528#define E1000_LEDCTL_LED3_BLINK 0x80000000 1584#define E1000_LEDCTL_LED3_BLINK 0x80000000
1529 1585
@@ -1784,6 +1840,16 @@ struct e1000_hw {
1784#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ 1840#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */
1785#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ 1841#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */
1786 1842
1843/* Multiple Receive Queue Control */
1844#define E1000_MRQC_ENABLE_MASK 0x00000003
1845#define E1000_MRQC_ENABLE_RSS_2Q 0x00000001
1846#define E1000_MRQC_ENABLE_RSS_INT 0x00000004
1847#define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000
1848#define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000
1849#define E1000_MRQC_RSS_FIELD_IPV4 0x00020000
1850#define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00040000
1851#define E1000_MRQC_RSS_FIELD_IPV6_EX 0x00080000
1852#define E1000_MRQC_RSS_FIELD_IPV6 0x00100000
1787 1853
1788/* Definitions for power management and wakeup registers */ 1854/* Definitions for power management and wakeup registers */
1789/* Wake Up Control */ 1855/* Wake Up Control */
@@ -1928,6 +1994,7 @@ struct e1000_host_command_info {
1928#define E1000_MDALIGN 4096 1994#define E1000_MDALIGN 4096
1929 1995
1930#define E1000_GCR_BEM32 0x00400000 1996#define E1000_GCR_BEM32 0x00400000
1997#define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000
1931/* Function Active and Power State to MNG */ 1998/* Function Active and Power State to MNG */
1932#define E1000_FACTPS_FUNC0_POWER_STATE_MASK 0x00000003 1999#define E1000_FACTPS_FUNC0_POWER_STATE_MASK 0x00000003
1933#define E1000_FACTPS_LAN0_VALID 0x00000004 2000#define E1000_FACTPS_LAN0_VALID 0x00000004
@@ -1980,6 +2047,7 @@ struct e1000_host_command_info {
1980/* EEPROM Word Offsets */ 2047/* EEPROM Word Offsets */
1981#define EEPROM_COMPAT 0x0003 2048#define EEPROM_COMPAT 0x0003
1982#define EEPROM_ID_LED_SETTINGS 0x0004 2049#define EEPROM_ID_LED_SETTINGS 0x0004
2050#define EEPROM_VERSION 0x0005
1983#define EEPROM_SERDES_AMPLITUDE 0x0006 /* For SERDES output amplitude adjustment. */ 2051#define EEPROM_SERDES_AMPLITUDE 0x0006 /* For SERDES output amplitude adjustment. */
1984#define EEPROM_PHY_CLASS_WORD 0x0007 2052#define EEPROM_PHY_CLASS_WORD 0x0007
1985#define EEPROM_INIT_CONTROL1_REG 0x000A 2053#define EEPROM_INIT_CONTROL1_REG 0x000A
@@ -1990,6 +2058,8 @@ struct e1000_host_command_info {
1990#define EEPROM_FLASH_VERSION 0x0032 2058#define EEPROM_FLASH_VERSION 0x0032
1991#define EEPROM_CHECKSUM_REG 0x003F 2059#define EEPROM_CHECKSUM_REG 0x003F
1992 2060
2061#define E1000_EEPROM_CFG_DONE 0x00040000 /* MNG config cycle done */
2062
1993/* Word definitions for ID LED Settings */ 2063/* Word definitions for ID LED Settings */
1994#define ID_LED_RESERVED_0000 0x0000 2064#define ID_LED_RESERVED_0000 0x0000
1995#define ID_LED_RESERVED_FFFF 0xFFFF 2065#define ID_LED_RESERVED_FFFF 0xFFFF
@@ -2108,6 +2178,8 @@ struct e1000_host_command_info {
2108#define E1000_PBA_22K 0x0016 2178#define E1000_PBA_22K 0x0016
2109#define E1000_PBA_24K 0x0018 2179#define E1000_PBA_24K 0x0018
2110#define E1000_PBA_30K 0x001E 2180#define E1000_PBA_30K 0x001E
2181#define E1000_PBA_32K 0x0020
2182#define E1000_PBA_38K 0x0026
2111#define E1000_PBA_40K 0x0028 2183#define E1000_PBA_40K 0x0028
2112#define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */ 2184#define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */
2113 2185
@@ -2592,11 +2664,11 @@ struct e1000_host_command_info {
2592 2664
2593/* 7 bits (3 Coarse + 4 Fine) --> 128 optional values */ 2665/* 7 bits (3 Coarse + 4 Fine) --> 128 optional values */
2594#define IGP01E1000_AGC_LENGTH_TABLE_SIZE 128 2666#define IGP01E1000_AGC_LENGTH_TABLE_SIZE 128
2595#define IGP02E1000_AGC_LENGTH_TABLE_SIZE 128 2667#define IGP02E1000_AGC_LENGTH_TABLE_SIZE 113
2596 2668
2597/* The precision error of the cable length is +/- 10 meters */ 2669/* The precision error of the cable length is +/- 10 meters */
2598#define IGP01E1000_AGC_RANGE 10 2670#define IGP01E1000_AGC_RANGE 10
2599#define IGP02E1000_AGC_RANGE 10 2671#define IGP02E1000_AGC_RANGE 15
2600 2672
2601/* IGP01E1000 PCS Initialization register */ 2673/* IGP01E1000 PCS Initialization register */
2602/* bits 3:6 in the PCS registers stores the channels polarity */ 2674/* bits 3:6 in the PCS registers stores the channels polarity */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index c062b0ad8262..407abb2c0548 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -398,6 +398,10 @@ e1000_reset(struct e1000_adapter *adapter)
398 case e1000_82547_rev_2: 398 case e1000_82547_rev_2:
399 pba = E1000_PBA_30K; 399 pba = E1000_PBA_30K;
400 break; 400 break;
401 case e1000_82571:
402 case e1000_82572:
403 pba = E1000_PBA_38K;
404 break;
401 case e1000_82573: 405 case e1000_82573:
402 pba = E1000_PBA_12K; 406 pba = E1000_PBA_12K;
403 break; 407 break;
@@ -475,6 +479,7 @@ e1000_probe(struct pci_dev *pdev,
475 struct net_device *netdev; 479 struct net_device *netdev;
476 struct e1000_adapter *adapter; 480 struct e1000_adapter *adapter;
477 unsigned long mmio_start, mmio_len; 481 unsigned long mmio_start, mmio_len;
482 uint32_t ctrl_ext;
478 uint32_t swsm; 483 uint32_t swsm;
479 484
480 static int cards_found = 0; 485 static int cards_found = 0;
@@ -688,6 +693,12 @@ e1000_probe(struct pci_dev *pdev,
688 693
689 /* Let firmware know the driver has taken over */ 694 /* Let firmware know the driver has taken over */
690 switch(adapter->hw.mac_type) { 695 switch(adapter->hw.mac_type) {
696 case e1000_82571:
697 case e1000_82572:
698 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
699 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
700 ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
701 break;
691 case e1000_82573: 702 case e1000_82573:
692 swsm = E1000_READ_REG(&adapter->hw, SWSM); 703 swsm = E1000_READ_REG(&adapter->hw, SWSM);
693 E1000_WRITE_REG(&adapter->hw, SWSM, 704 E1000_WRITE_REG(&adapter->hw, SWSM,
@@ -732,6 +743,7 @@ e1000_remove(struct pci_dev *pdev)
732{ 743{
733 struct net_device *netdev = pci_get_drvdata(pdev); 744 struct net_device *netdev = pci_get_drvdata(pdev);
734 struct e1000_adapter *adapter = netdev_priv(netdev); 745 struct e1000_adapter *adapter = netdev_priv(netdev);
746 uint32_t ctrl_ext;
735 uint32_t manc, swsm; 747 uint32_t manc, swsm;
736 748
737 flush_scheduled_work(); 749 flush_scheduled_work();
@@ -746,6 +758,12 @@ e1000_remove(struct pci_dev *pdev)
746 } 758 }
747 759
748 switch(adapter->hw.mac_type) { 760 switch(adapter->hw.mac_type) {
761 case e1000_82571:
762 case e1000_82572:
763 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
764 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
765 ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
766 break;
749 case e1000_82573: 767 case e1000_82573:
750 swsm = E1000_READ_REG(&adapter->hw, SWSM); 768 swsm = E1000_READ_REG(&adapter->hw, SWSM);
751 E1000_WRITE_REG(&adapter->hw, SWSM, 769 E1000_WRITE_REG(&adapter->hw, SWSM,
@@ -1236,7 +1254,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter)
1236 rctl |= E1000_RCTL_LPE; 1254 rctl |= E1000_RCTL_LPE;
1237 1255
1238 /* Setup buffer sizes */ 1256 /* Setup buffer sizes */
1239 if(adapter->hw.mac_type == e1000_82573) { 1257 if(adapter->hw.mac_type >= e1000_82571) {
1240 /* We can now specify buffers in 1K increments. 1258 /* We can now specify buffers in 1K increments.
1241 * BSIZE and BSEX are ignored in this case. */ 1259 * BSIZE and BSEX are ignored in this case. */
1242 rctl |= adapter->rx_buffer_len << 0x11; 1260 rctl |= adapter->rx_buffer_len << 0x11;
@@ -1352,7 +1370,7 @@ e1000_configure_rx(struct e1000_adapter *adapter)
1352 if(adapter->rx_csum == TRUE) { 1370 if(adapter->rx_csum == TRUE) {
1353 rxcsum |= E1000_RXCSUM_TUOFL; 1371 rxcsum |= E1000_RXCSUM_TUOFL;
1354 1372
1355 /* Enable 82573 IPv4 payload checksum for UDP fragments 1373 /* Enable 82571 IPv4 payload checksum for UDP fragments
1356 * Must be used in conjunction with packet-split. */ 1374 * Must be used in conjunction with packet-split. */
1357 if((adapter->hw.mac_type > e1000_82547_rev_2) && 1375 if((adapter->hw.mac_type > e1000_82547_rev_2) &&
1358 (adapter->rx_ps)) { 1376 (adapter->rx_ps)) {
@@ -1608,6 +1626,22 @@ e1000_set_mac(struct net_device *netdev, void *p)
1608 1626
1609 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0); 1627 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0);
1610 1628
1629 /* With 82571 controllers, LAA may be overwritten (with the default)
1630 * due to controller reset from the other port. */
1631 if (adapter->hw.mac_type == e1000_82571) {
1632 /* activate the work around */
1633 adapter->hw.laa_is_present = 1;
1634
1635 /* Hold a copy of the LAA in RAR[14] This is done so that
1636 * between the time RAR[0] gets clobbered and the time it
1637 * gets fixed (in e1000_watchdog), the actual LAA is in one
1638 * of the RARs and no incoming packets directed to this port
1639 * are dropped. Eventaully the LAA will be in RAR[0] and
1640 * RAR[14] */
1641 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr,
1642 E1000_RAR_ENTRIES - 1);
1643 }
1644
1611 if(adapter->hw.mac_type == e1000_82542_rev2_0) 1645 if(adapter->hw.mac_type == e1000_82542_rev2_0)
1612 e1000_leave_82542_rst(adapter); 1646 e1000_leave_82542_rst(adapter);
1613 1647
@@ -1633,9 +1667,12 @@ e1000_set_multi(struct net_device *netdev)
1633 unsigned long flags; 1667 unsigned long flags;
1634 uint32_t rctl; 1668 uint32_t rctl;
1635 uint32_t hash_value; 1669 uint32_t hash_value;
1636 int i; 1670 int i, rar_entries = E1000_RAR_ENTRIES;
1637 1671
1638 spin_lock_irqsave(&adapter->tx_lock, flags); 1672 spin_lock_irqsave(&adapter->tx_lock, flags);
1673 /* reserve RAR[14] for LAA over-write work-around */
1674 if (adapter->hw.mac_type == e1000_82571)
1675 rar_entries--;
1639 1676
1640 /* Check for Promiscuous and All Multicast modes */ 1677 /* Check for Promiscuous and All Multicast modes */
1641 1678
@@ -1660,11 +1697,12 @@ e1000_set_multi(struct net_device *netdev)
1660 /* load the first 14 multicast address into the exact filters 1-14 1697 /* load the first 14 multicast address into the exact filters 1-14
1661 * RAR 0 is used for the station MAC adddress 1698 * RAR 0 is used for the station MAC adddress
1662 * if there are not 14 addresses, go ahead and clear the filters 1699 * if there are not 14 addresses, go ahead and clear the filters
1700 * -- with 82571 controllers only 0-13 entries are filled here
1663 */ 1701 */
1664 mc_ptr = netdev->mc_list; 1702 mc_ptr = netdev->mc_list;
1665 1703
1666 for(i = 1; i < E1000_RAR_ENTRIES; i++) { 1704 for(i = 1; i < rar_entries; i++) {
1667 if(mc_ptr) { 1705 if (mc_ptr) {
1668 e1000_rar_set(hw, mc_ptr->dmi_addr, i); 1706 e1000_rar_set(hw, mc_ptr->dmi_addr, i);
1669 mc_ptr = mc_ptr->next; 1707 mc_ptr = mc_ptr->next;
1670 } else { 1708 } else {
@@ -1848,6 +1886,11 @@ e1000_watchdog_task(struct e1000_adapter *adapter)
1848 /* Force detection of hung controller every watchdog period */ 1886 /* Force detection of hung controller every watchdog period */
1849 adapter->detect_tx_hung = TRUE; 1887 adapter->detect_tx_hung = TRUE;
1850 1888
1889 /* With 82571 controllers, LAA may be overwritten due to controller
1890 * reset from the other port. Set the appropriate LAA in RAR[0] */
1891 if (adapter->hw.mac_type == e1000_82571 && adapter->hw.laa_is_present)
1892 e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0);
1893
1851 /* Reset the timer */ 1894 /* Reset the timer */
1852 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); 1895 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
1853} 1896}
@@ -2269,6 +2312,27 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2269 local_irq_restore(flags); 2312 local_irq_restore(flags);
2270 return NETDEV_TX_LOCKED; 2313 return NETDEV_TX_LOCKED;
2271 } 2314 }
2315#ifdef NETIF_F_TSO
2316 /* TSO Workaround for 82571/2 Controllers -- if skb->data
2317 * points to just header, pull a few bytes of payload from
2318 * frags into skb->data */
2319 if (skb_shinfo(skb)->tso_size) {
2320 uint8_t hdr_len;
2321 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
2322 if (skb->data_len && (hdr_len < (skb->len - skb->data_len)) &&
2323 (adapter->hw.mac_type == e1000_82571 ||
2324 adapter->hw.mac_type == e1000_82572)) {
2325 unsigned int pull_size;
2326 pull_size = min((unsigned int)4, skb->data_len);
2327 if (!__pskb_pull_tail(skb, pull_size)) {
2328 printk(KERN_ERR "__pskb_pull_tail failed.\n");
2329 dev_kfree_skb_any(skb);
2330 return -EFAULT;
2331 }
2332 }
2333 }
2334#endif
2335
2272 if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) ) 2336 if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) )
2273 e1000_transfer_dhcp_info(adapter, skb); 2337 e1000_transfer_dhcp_info(adapter, skb);
2274 2338
@@ -2310,7 +2374,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2310 tx_flags |= E1000_TX_FLAGS_CSUM; 2374 tx_flags |= E1000_TX_FLAGS_CSUM;
2311 2375
2312 /* Old method was to assume IPv4 packet by default if TSO was enabled. 2376 /* Old method was to assume IPv4 packet by default if TSO was enabled.
2313 * 82573 hardware supports TSO capabilities for IPv6 as well... 2377 * 82571 hardware supports TSO capabilities for IPv6 as well...
2314 * no longer assume, we must. */ 2378 * no longer assume, we must. */
2315 if(likely(skb->protocol == ntohs(ETH_P_IP))) 2379 if(likely(skb->protocol == ntohs(ETH_P_IP)))
2316 tx_flags |= E1000_TX_FLAGS_IPV4; 2380 tx_flags |= E1000_TX_FLAGS_IPV4;
@@ -2389,9 +2453,18 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
2389 return -EINVAL; 2453 return -EINVAL;
2390 } 2454 }
2391 2455
2392#define MAX_STD_JUMBO_FRAME_SIZE 9216 2456#define MAX_STD_JUMBO_FRAME_SIZE 9234
2393 /* might want this to be bigger enum check... */ 2457 /* might want this to be bigger enum check... */
2394 if (adapter->hw.mac_type == e1000_82573 && 2458 /* 82571 controllers limit jumbo frame size to 10500 bytes */
2459 if ((adapter->hw.mac_type == e1000_82571 ||
2460 adapter->hw.mac_type == e1000_82572) &&
2461 max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
2462 DPRINTK(PROBE, ERR, "MTU > 9216 bytes not supported "
2463 "on 82571 and 82572 controllers.\n");
2464 return -EINVAL;
2465 }
2466
2467 if(adapter->hw.mac_type == e1000_82573 &&
2395 max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { 2468 max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) {
2396 DPRINTK(PROBE, ERR, "Jumbo Frames not supported " 2469 DPRINTK(PROBE, ERR, "Jumbo Frames not supported "
2397 "on 82573\n"); 2470 "on 82573\n");
@@ -3716,6 +3789,12 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
3716 } 3789 }
3717 3790
3718 switch(adapter->hw.mac_type) { 3791 switch(adapter->hw.mac_type) {
3792 case e1000_82571:
3793 case e1000_82572:
3794 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
3795 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
3796 ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
3797 break;
3719 case e1000_82573: 3798 case e1000_82573:
3720 swsm = E1000_READ_REG(&adapter->hw, SWSM); 3799 swsm = E1000_READ_REG(&adapter->hw, SWSM);
3721 E1000_WRITE_REG(&adapter->hw, SWSM, 3800 E1000_WRITE_REG(&adapter->hw, SWSM,
@@ -3738,6 +3817,7 @@ e1000_resume(struct pci_dev *pdev)
3738 struct net_device *netdev = pci_get_drvdata(pdev); 3817 struct net_device *netdev = pci_get_drvdata(pdev);
3739 struct e1000_adapter *adapter = netdev_priv(netdev); 3818 struct e1000_adapter *adapter = netdev_priv(netdev);
3740 uint32_t manc, ret_val, swsm; 3819 uint32_t manc, ret_val, swsm;
3820 uint32_t ctrl_ext;
3741 3821
3742 pci_set_power_state(pdev, PCI_D0); 3822 pci_set_power_state(pdev, PCI_D0);
3743 pci_restore_state(pdev); 3823 pci_restore_state(pdev);
@@ -3763,6 +3843,12 @@ e1000_resume(struct pci_dev *pdev)
3763 } 3843 }
3764 3844
3765 switch(adapter->hw.mac_type) { 3845 switch(adapter->hw.mac_type) {
3846 case e1000_82571:
3847 case e1000_82572:
3848 ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
3849 E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
3850 ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
3851 break;
3766 case e1000_82573: 3852 case e1000_82573:
3767 swsm = E1000_READ_REG(&adapter->hw, SWSM); 3853 swsm = E1000_READ_REG(&adapter->hw, SWSM);
3768 E1000_WRITE_REG(&adapter->hw, SWSM, 3854 E1000_WRITE_REG(&adapter->hw, SWSM,