aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/es2lan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000e/es2lan.c')
-rw-r--r--drivers/net/e1000e/es2lan.c344
1 files changed, 207 insertions, 137 deletions
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index ae5d73689353..27d21589a69a 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2008 Intel Corporation. 4 Copyright(c) 1999 - 2009 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -31,11 +31,6 @@
31 * 80003ES2LAN Gigabit Ethernet Controller (Serdes) 31 * 80003ES2LAN Gigabit Ethernet Controller (Serdes)
32 */ 32 */
33 33
34#include <linux/netdevice.h>
35#include <linux/ethtool.h>
36#include <linux/delay.h>
37#include <linux/pci.h>
38
39#include "e1000.h" 34#include "e1000.h"
40 35
41#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 36#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00
@@ -51,6 +46,9 @@
51#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 46#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000
52#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 47#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000
53 48
49#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C
50#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004
51
54#define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */ 52#define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */
55#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 53#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000
56 54
@@ -104,6 +102,8 @@
104 */ 102 */
105static const u16 e1000_gg82563_cable_length_table[] = 103static const u16 e1000_gg82563_cable_length_table[] =
106 { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF }; 104 { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF };
105#define GG82563_CABLE_LENGTH_TABLE_SIZE \
106 ARRAY_SIZE(e1000_gg82563_cable_length_table)
107 107
108static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw); 108static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw);
109static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); 109static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask);
@@ -117,12 +117,11 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
117 u16 *data); 117 u16 *data);
118static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, 118static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
119 u16 data); 119 u16 data);
120static void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw);
120 121
121/** 122/**
122 * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. 123 * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs.
123 * @hw: pointer to the HW structure 124 * @hw: pointer to the HW structure
124 *
125 * This is a function pointer entry point called by the api module.
126 **/ 125 **/
127static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw) 126static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw)
128{ 127{
@@ -132,6 +131,9 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw)
132 if (hw->phy.media_type != e1000_media_type_copper) { 131 if (hw->phy.media_type != e1000_media_type_copper) {
133 phy->type = e1000_phy_none; 132 phy->type = e1000_phy_none;
134 return 0; 133 return 0;
134 } else {
135 phy->ops.power_up = e1000_power_up_phy_copper;
136 phy->ops.power_down = e1000_power_down_phy_copper_80003es2lan;
135 } 137 }
136 138
137 phy->addr = 1; 139 phy->addr = 1;
@@ -152,8 +154,6 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw)
152/** 154/**
153 * e1000_init_nvm_params_80003es2lan - Init ESB2 NVM func ptrs. 155 * e1000_init_nvm_params_80003es2lan - Init ESB2 NVM func ptrs.
154 * @hw: pointer to the HW structure 156 * @hw: pointer to the HW structure
155 *
156 * This is a function pointer entry point called by the api module.
157 **/ 157 **/
158static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) 158static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)
159{ 159{
@@ -200,8 +200,6 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)
200/** 200/**
201 * e1000_init_mac_params_80003es2lan - Init ESB2 MAC func ptrs. 201 * e1000_init_mac_params_80003es2lan - Init ESB2 MAC func ptrs.
202 * @hw: pointer to the HW structure 202 * @hw: pointer to the HW structure
203 *
204 * This is a function pointer entry point called by the api module.
205 **/ 203 **/
206static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter) 204static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
207{ 205{
@@ -224,7 +222,10 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
224 /* Set rar entry count */ 222 /* Set rar entry count */
225 mac->rar_entry_count = E1000_RAR_ENTRIES; 223 mac->rar_entry_count = E1000_RAR_ENTRIES;
226 /* Set if manageability features are enabled. */ 224 /* Set if manageability features are enabled. */
227 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) ? 1 : 0; 225 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK)
226 ? true : false;
227 /* Adaptive IFS not supported */
228 mac->adaptive_ifs = false;
228 229
229 /* check for link */ 230 /* check for link */
230 switch (hw->phy.media_type) { 231 switch (hw->phy.media_type) {
@@ -245,6 +246,9 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
245 break; 246 break;
246 } 247 }
247 248
249 /* set lan id for port to determine which phy lock to use */
250 hw->mac.ops.set_lan_id(hw);
251
248 return 0; 252 return 0;
249} 253}
250 254
@@ -272,8 +276,7 @@ static s32 e1000_get_variants_80003es2lan(struct e1000_adapter *adapter)
272 * e1000_acquire_phy_80003es2lan - Acquire rights to access PHY 276 * e1000_acquire_phy_80003es2lan - Acquire rights to access PHY
273 * @hw: pointer to the HW structure 277 * @hw: pointer to the HW structure
274 * 278 *
275 * A wrapper to acquire access rights to the correct PHY. This is a 279 * A wrapper to acquire access rights to the correct PHY.
276 * function pointer entry point called by the api module.
277 **/ 280 **/
278static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw) 281static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw)
279{ 282{
@@ -287,8 +290,7 @@ static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw)
287 * e1000_release_phy_80003es2lan - Release rights to access PHY 290 * e1000_release_phy_80003es2lan - Release rights to access PHY
288 * @hw: pointer to the HW structure 291 * @hw: pointer to the HW structure
289 * 292 *
290 * A wrapper to release access rights to the correct PHY. This is a 293 * A wrapper to release access rights to the correct PHY.
291 * function pointer entry point called by the api module.
292 **/ 294 **/
293static void e1000_release_phy_80003es2lan(struct e1000_hw *hw) 295static void e1000_release_phy_80003es2lan(struct e1000_hw *hw)
294{ 296{
@@ -333,8 +335,7 @@ static void e1000_release_mac_csr_80003es2lan(struct e1000_hw *hw)
333 * e1000_acquire_nvm_80003es2lan - Acquire rights to access NVM 335 * e1000_acquire_nvm_80003es2lan - Acquire rights to access NVM
334 * @hw: pointer to the HW structure 336 * @hw: pointer to the HW structure
335 * 337 *
336 * Acquire the semaphore to access the EEPROM. This is a function 338 * Acquire the semaphore to access the EEPROM.
337 * pointer entry point called by the api module.
338 **/ 339 **/
339static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw) 340static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw)
340{ 341{
@@ -356,8 +357,7 @@ static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw)
356 * e1000_release_nvm_80003es2lan - Relinquish rights to access NVM 357 * e1000_release_nvm_80003es2lan - Relinquish rights to access NVM
357 * @hw: pointer to the HW structure 358 * @hw: pointer to the HW structure
358 * 359 *
359 * Release the semaphore used to access the EEPROM. This is a 360 * Release the semaphore used to access the EEPROM.
360 * function pointer entry point called by the api module.
361 **/ 361 **/
362static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw) 362static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw)
363{ 363{
@@ -399,8 +399,7 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
399 } 399 }
400 400
401 if (i == timeout) { 401 if (i == timeout) {
402 hw_dbg(hw, 402 e_dbg("Driver can't access resource, SW_FW_SYNC timeout.\n");
403 "Driver can't access resource, SW_FW_SYNC timeout.\n");
404 return -E1000_ERR_SWFW_SYNC; 403 return -E1000_ERR_SWFW_SYNC;
405 } 404 }
406 405
@@ -440,8 +439,7 @@ static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
440 * @offset: offset of the register to read 439 * @offset: offset of the register to read
441 * @data: pointer to the data returned from the operation 440 * @data: pointer to the data returned from the operation
442 * 441 *
443 * Read the GG82563 PHY register. This is a function pointer entry 442 * Read the GG82563 PHY register.
444 * point called by the api module.
445 **/ 443 **/
446static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, 444static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
447 u32 offset, u16 *data) 445 u32 offset, u16 *data)
@@ -472,28 +470,36 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
472 return ret_val; 470 return ret_val;
473 } 471 }
474 472
475 /* 473 if (hw->dev_spec.e80003es2lan.mdic_wa_enable == true) {
476 * The "ready" bit in the MDIC register may be incorrectly set 474 /*
477 * before the device has completed the "Page Select" MDI 475 * The "ready" bit in the MDIC register may be incorrectly set
478 * transaction. So we wait 200us after each MDI command... 476 * before the device has completed the "Page Select" MDI
479 */ 477 * transaction. So we wait 200us after each MDI command...
480 udelay(200); 478 */
479 udelay(200);
481 480
482 /* ...and verify the command was successful. */ 481 /* ...and verify the command was successful. */
483 ret_val = e1000e_read_phy_reg_mdic(hw, page_select, &temp); 482 ret_val = e1000e_read_phy_reg_mdic(hw, page_select, &temp);
484 483
485 if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) { 484 if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) {
486 ret_val = -E1000_ERR_PHY; 485 ret_val = -E1000_ERR_PHY;
487 e1000_release_phy_80003es2lan(hw); 486 e1000_release_phy_80003es2lan(hw);
488 return ret_val; 487 return ret_val;
489 } 488 }
490 489
491 udelay(200); 490 udelay(200);
492 491
493 ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 492 ret_val = e1000e_read_phy_reg_mdic(hw,
494 data); 493 MAX_PHY_REG_ADDRESS & offset,
494 data);
495
496 udelay(200);
497 } else {
498 ret_val = e1000e_read_phy_reg_mdic(hw,
499 MAX_PHY_REG_ADDRESS & offset,
500 data);
501 }
495 502
496 udelay(200);
497 e1000_release_phy_80003es2lan(hw); 503 e1000_release_phy_80003es2lan(hw);
498 504
499 return ret_val; 505 return ret_val;
@@ -505,8 +511,7 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
505 * @offset: offset of the register to read 511 * @offset: offset of the register to read
506 * @data: value to write to the register 512 * @data: value to write to the register
507 * 513 *
508 * Write to the GG82563 PHY register. This is a function pointer entry 514 * Write to the GG82563 PHY register.
509 * point called by the api module.
510 **/ 515 **/
511static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, 516static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
512 u32 offset, u16 data) 517 u32 offset, u16 data)
@@ -537,28 +542,35 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
537 return ret_val; 542 return ret_val;
538 } 543 }
539 544
545 if (hw->dev_spec.e80003es2lan.mdic_wa_enable == true) {
546 /*
547 * The "ready" bit in the MDIC register may be incorrectly set
548 * before the device has completed the "Page Select" MDI
549 * transaction. So we wait 200us after each MDI command...
550 */
551 udelay(200);
540 552
541 /* 553 /* ...and verify the command was successful. */
542 * The "ready" bit in the MDIC register may be incorrectly set 554 ret_val = e1000e_read_phy_reg_mdic(hw, page_select, &temp);
543 * before the device has completed the "Page Select" MDI
544 * transaction. So we wait 200us after each MDI command...
545 */
546 udelay(200);
547 555
548 /* ...and verify the command was successful. */ 556 if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) {
549 ret_val = e1000e_read_phy_reg_mdic(hw, page_select, &temp); 557 e1000_release_phy_80003es2lan(hw);
558 return -E1000_ERR_PHY;
559 }
550 560
551 if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) { 561 udelay(200);
552 e1000_release_phy_80003es2lan(hw);
553 return -E1000_ERR_PHY;
554 }
555 562
556 udelay(200); 563 ret_val = e1000e_write_phy_reg_mdic(hw,
564 MAX_PHY_REG_ADDRESS & offset,
565 data);
557 566
558 ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 567 udelay(200);
559 data); 568 } else {
569 ret_val = e1000e_write_phy_reg_mdic(hw,
570 MAX_PHY_REG_ADDRESS & offset,
571 data);
572 }
560 573
561 udelay(200);
562 e1000_release_phy_80003es2lan(hw); 574 e1000_release_phy_80003es2lan(hw);
563 575
564 return ret_val; 576 return ret_val;
@@ -571,8 +583,7 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
571 * @words: number of words to write 583 * @words: number of words to write
572 * @data: buffer of data to write to the NVM 584 * @data: buffer of data to write to the NVM
573 * 585 *
574 * Write "words" of data to the ESB2 NVM. This is a function 586 * Write "words" of data to the ESB2 NVM.
575 * pointer entry point called by the api module.
576 **/ 587 **/
577static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, 588static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset,
578 u16 words, u16 *data) 589 u16 words, u16 *data)
@@ -602,7 +613,7 @@ static s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw)
602 timeout--; 613 timeout--;
603 } 614 }
604 if (!timeout) { 615 if (!timeout) {
605 hw_dbg(hw, "MNG configuration cycle has not completed.\n"); 616 e_dbg("MNG configuration cycle has not completed.\n");
606 return -E1000_ERR_RESET; 617 return -E1000_ERR_RESET;
607 } 618 }
608 619
@@ -635,7 +646,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
635 if (ret_val) 646 if (ret_val)
636 return ret_val; 647 return ret_val;
637 648
638 hw_dbg(hw, "GG82563 PSCR: %X\n", phy_data); 649 e_dbg("GG82563 PSCR: %X\n", phy_data);
639 650
640 ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_data); 651 ret_val = e1e_rphy(hw, PHY_CONTROL, &phy_data);
641 if (ret_val) 652 if (ret_val)
@@ -653,7 +664,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
653 udelay(1); 664 udelay(1);
654 665
655 if (hw->phy.autoneg_wait_to_complete) { 666 if (hw->phy.autoneg_wait_to_complete) {
656 hw_dbg(hw, "Waiting for forced speed/duplex link " 667 e_dbg("Waiting for forced speed/duplex link "
657 "on GG82563 phy.\n"); 668 "on GG82563 phy.\n");
658 669
659 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT, 670 ret_val = e1000e_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
@@ -712,21 +723,27 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
712static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw) 723static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw)
713{ 724{
714 struct e1000_phy_info *phy = &hw->phy; 725 struct e1000_phy_info *phy = &hw->phy;
715 s32 ret_val; 726 s32 ret_val = 0;
716 u16 phy_data; 727 u16 phy_data, index;
717 u16 index;
718 728
719 ret_val = e1e_rphy(hw, GG82563_PHY_DSP_DISTANCE, &phy_data); 729 ret_val = e1e_rphy(hw, GG82563_PHY_DSP_DISTANCE, &phy_data);
720 if (ret_val) 730 if (ret_val)
721 return ret_val; 731 goto out;
722 732
723 index = phy_data & GG82563_DSPD_CABLE_LENGTH; 733 index = phy_data & GG82563_DSPD_CABLE_LENGTH;
734
735 if (index >= GG82563_CABLE_LENGTH_TABLE_SIZE - 5) {
736 ret_val = -E1000_ERR_PHY;
737 goto out;
738 }
739
724 phy->min_cable_length = e1000_gg82563_cable_length_table[index]; 740 phy->min_cable_length = e1000_gg82563_cable_length_table[index];
725 phy->max_cable_length = e1000_gg82563_cable_length_table[index+5]; 741 phy->max_cable_length = e1000_gg82563_cable_length_table[index + 5];
726 742
727 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; 743 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2;
728 744
729 return 0; 745out:
746 return ret_val;
730} 747}
731 748
732/** 749/**
@@ -736,7 +753,6 @@ static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw)
736 * @duplex: pointer to duplex buffer 753 * @duplex: pointer to duplex buffer
737 * 754 *
738 * Retrieve the current speed and duplex configuration. 755 * Retrieve the current speed and duplex configuration.
739 * This is a function pointer entry point called by the api module.
740 **/ 756 **/
741static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, 757static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
742 u16 *duplex) 758 u16 *duplex)
@@ -762,12 +778,10 @@ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
762 * @hw: pointer to the HW structure 778 * @hw: pointer to the HW structure
763 * 779 *
764 * Perform a global reset to the ESB2 controller. 780 * Perform a global reset to the ESB2 controller.
765 * This is a function pointer entry point called by the api module.
766 **/ 781 **/
767static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw) 782static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
768{ 783{
769 u32 ctrl; 784 u32 ctrl, icr;
770 u32 icr;
771 s32 ret_val; 785 s32 ret_val;
772 786
773 /* 787 /*
@@ -776,9 +790,9 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
776 */ 790 */
777 ret_val = e1000e_disable_pcie_master(hw); 791 ret_val = e1000e_disable_pcie_master(hw);
778 if (ret_val) 792 if (ret_val)
779 hw_dbg(hw, "PCI-E Master disable polling has failed.\n"); 793 e_dbg("PCI-E Master disable polling has failed.\n");
780 794
781 hw_dbg(hw, "Masking off all interrupts\n"); 795 e_dbg("Masking off all interrupts\n");
782 ew32(IMC, 0xffffffff); 796 ew32(IMC, 0xffffffff);
783 797
784 ew32(RCTL, 0); 798 ew32(RCTL, 0);
@@ -790,7 +804,7 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
790 ctrl = er32(CTRL); 804 ctrl = er32(CTRL);
791 805
792 ret_val = e1000_acquire_phy_80003es2lan(hw); 806 ret_val = e1000_acquire_phy_80003es2lan(hw);
793 hw_dbg(hw, "Issuing a global reset to MAC\n"); 807 e_dbg("Issuing a global reset to MAC\n");
794 ew32(CTRL, ctrl | E1000_CTRL_RST); 808 ew32(CTRL, ctrl | E1000_CTRL_RST);
795 e1000_release_phy_80003es2lan(hw); 809 e1000_release_phy_80003es2lan(hw);
796 810
@@ -803,7 +817,9 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
803 ew32(IMC, 0xffffffff); 817 ew32(IMC, 0xffffffff);
804 icr = er32(ICR); 818 icr = er32(ICR);
805 819
806 return 0; 820 ret_val = e1000_check_alt_mac_addr_generic(hw);
821
822 return ret_val;
807} 823}
808 824
809/** 825/**
@@ -811,7 +827,6 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
811 * @hw: pointer to the HW structure 827 * @hw: pointer to the HW structure
812 * 828 *
813 * Initialize the hw bits, LED, VFTA, MTA, link and hw counters. 829 * Initialize the hw bits, LED, VFTA, MTA, link and hw counters.
814 * This is a function pointer entry point called by the api module.
815 **/ 830 **/
816static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) 831static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
817{ 832{
@@ -824,20 +839,19 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
824 839
825 /* Initialize identification LED */ 840 /* Initialize identification LED */
826 ret_val = e1000e_id_led_init(hw); 841 ret_val = e1000e_id_led_init(hw);
827 if (ret_val) { 842 if (ret_val)
828 hw_dbg(hw, "Error initializing identification LED\n"); 843 e_dbg("Error initializing identification LED\n");
829 return ret_val; 844 /* This is not fatal and we should not stop init due to this */
830 }
831 845
832 /* Disabling VLAN filtering */ 846 /* Disabling VLAN filtering */
833 hw_dbg(hw, "Initializing the IEEE VLAN\n"); 847 e_dbg("Initializing the IEEE VLAN\n");
834 e1000e_clear_vfta(hw); 848 mac->ops.clear_vfta(hw);
835 849
836 /* Setup the receive address. */ 850 /* Setup the receive address. */
837 e1000e_init_rx_addrs(hw, mac->rar_entry_count); 851 e1000e_init_rx_addrs(hw, mac->rar_entry_count);
838 852
839 /* Zero out the Multicast HASH table */ 853 /* Zero out the Multicast HASH table */
840 hw_dbg(hw, "Zeroing the MTA\n"); 854 e_dbg("Zeroing the MTA\n");
841 for (i = 0; i < mac->mta_reg_count; i++) 855 for (i = 0; i < mac->mta_reg_count; i++)
842 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); 856 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
843 857
@@ -877,6 +891,19 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
877 reg_data &= ~0x00100000; 891 reg_data &= ~0x00100000;
878 E1000_WRITE_REG_ARRAY(hw, E1000_FFLT, 0x0001, reg_data); 892 E1000_WRITE_REG_ARRAY(hw, E1000_FFLT, 0x0001, reg_data);
879 893
894 /* default to true to enable the MDIC W/A */
895 hw->dev_spec.e80003es2lan.mdic_wa_enable = true;
896
897 ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
898 E1000_KMRNCTRLSTA_OFFSET >>
899 E1000_KMRNCTRLSTA_OFFSET_SHIFT,
900 &i);
901 if (!ret_val) {
902 if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) ==
903 E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO)
904 hw->dev_spec.e80003es2lan.mdic_wa_enable = false;
905 }
906
880 /* 907 /*
881 * Clear all of the statistics registers (clear on read). It is 908 * Clear all of the statistics registers (clear on read). It is
882 * important that we do this after we have tried to establish link 909 * important that we do this after we have tried to establish link
@@ -994,7 +1021,7 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
994 /* SW Reset the PHY so all changes take effect */ 1021 /* SW Reset the PHY so all changes take effect */
995 ret_val = e1000e_commit_phy(hw); 1022 ret_val = e1000e_commit_phy(hw);
996 if (ret_val) { 1023 if (ret_val) {
997 hw_dbg(hw, "Error Resetting the PHY\n"); 1024 e_dbg("Error Resetting the PHY\n");
998 return ret_val; 1025 return ret_val;
999 } 1026 }
1000 1027
@@ -1318,6 +1345,46 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
1318} 1345}
1319 1346
1320/** 1347/**
1348 * e1000_read_mac_addr_80003es2lan - Read device MAC address
1349 * @hw: pointer to the HW structure
1350 **/
1351static s32 e1000_read_mac_addr_80003es2lan(struct e1000_hw *hw)
1352{
1353 s32 ret_val = 0;
1354
1355 /*
1356 * If there's an alternate MAC address place it in RAR0
1357 * so that it will override the Si installed default perm
1358 * address.
1359 */
1360 ret_val = e1000_check_alt_mac_addr_generic(hw);
1361 if (ret_val)
1362 goto out;
1363
1364 ret_val = e1000_read_mac_addr_generic(hw);
1365
1366out:
1367 return ret_val;
1368}
1369
1370/**
1371 * e1000_power_down_phy_copper_80003es2lan - Remove link during PHY power down
1372 * @hw: pointer to the HW structure
1373 *
1374 * In the case of a PHY power down to save power, or to turn off link during a
1375 * driver unload, or wake on lan is not enabled, remove the link.
1376 **/
1377static void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw)
1378{
1379 /* If the management interface is not enabled, then power down */
1380 if (!(hw->mac.ops.check_mng_mode(hw) ||
1381 hw->phy.ops.check_reset_block(hw)))
1382 e1000_power_down_phy_copper(hw);
1383
1384 return;
1385}
1386
1387/**
1321 * e1000_clear_hw_cntrs_80003es2lan - Clear device specific hardware counters 1388 * e1000_clear_hw_cntrs_80003es2lan - Clear device specific hardware counters
1322 * @hw: pointer to the HW structure 1389 * @hw: pointer to the HW structure
1323 * 1390 *
@@ -1325,57 +1392,59 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
1325 **/ 1392 **/
1326static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw) 1393static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw)
1327{ 1394{
1328 u32 temp;
1329
1330 e1000e_clear_hw_cntrs_base(hw); 1395 e1000e_clear_hw_cntrs_base(hw);
1331 1396
1332 temp = er32(PRC64); 1397 er32(PRC64);
1333 temp = er32(PRC127); 1398 er32(PRC127);
1334 temp = er32(PRC255); 1399 er32(PRC255);
1335 temp = er32(PRC511); 1400 er32(PRC511);
1336 temp = er32(PRC1023); 1401 er32(PRC1023);
1337 temp = er32(PRC1522); 1402 er32(PRC1522);
1338 temp = er32(PTC64); 1403 er32(PTC64);
1339 temp = er32(PTC127); 1404 er32(PTC127);
1340 temp = er32(PTC255); 1405 er32(PTC255);
1341 temp = er32(PTC511); 1406 er32(PTC511);
1342 temp = er32(PTC1023); 1407 er32(PTC1023);
1343 temp = er32(PTC1522); 1408 er32(PTC1522);
1344 1409
1345 temp = er32(ALGNERRC); 1410 er32(ALGNERRC);
1346 temp = er32(RXERRC); 1411 er32(RXERRC);
1347 temp = er32(TNCRS); 1412 er32(TNCRS);
1348 temp = er32(CEXTERR); 1413 er32(CEXTERR);
1349 temp = er32(TSCTC); 1414 er32(TSCTC);
1350 temp = er32(TSCTFC); 1415 er32(TSCTFC);
1351 1416
1352 temp = er32(MGTPRC); 1417 er32(MGTPRC);
1353 temp = er32(MGTPDC); 1418 er32(MGTPDC);
1354 temp = er32(MGTPTC); 1419 er32(MGTPTC);
1355 1420
1356 temp = er32(IAC); 1421 er32(IAC);
1357 temp = er32(ICRXOC); 1422 er32(ICRXOC);
1358 1423
1359 temp = er32(ICRXPTC); 1424 er32(ICRXPTC);
1360 temp = er32(ICRXATC); 1425 er32(ICRXATC);
1361 temp = er32(ICTXPTC); 1426 er32(ICTXPTC);
1362 temp = er32(ICTXATC); 1427 er32(ICTXATC);
1363 temp = er32(ICTXQEC); 1428 er32(ICTXQEC);
1364 temp = er32(ICTXQMTC); 1429 er32(ICTXQMTC);
1365 temp = er32(ICRXDMTC); 1430 er32(ICRXDMTC);
1366} 1431}
1367 1432
1368static struct e1000_mac_operations es2_mac_ops = { 1433static struct e1000_mac_operations es2_mac_ops = {
1434 .read_mac_addr = e1000_read_mac_addr_80003es2lan,
1369 .id_led_init = e1000e_id_led_init, 1435 .id_led_init = e1000e_id_led_init,
1370 .check_mng_mode = e1000e_check_mng_mode_generic, 1436 .check_mng_mode = e1000e_check_mng_mode_generic,
1371 /* check_for_link dependent on media type */ 1437 /* check_for_link dependent on media type */
1372 .cleanup_led = e1000e_cleanup_led_generic, 1438 .cleanup_led = e1000e_cleanup_led_generic,
1373 .clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan, 1439 .clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan,
1374 .get_bus_info = e1000e_get_bus_info_pcie, 1440 .get_bus_info = e1000e_get_bus_info_pcie,
1441 .set_lan_id = e1000_set_lan_id_multi_port_pcie,
1375 .get_link_up_info = e1000_get_link_up_info_80003es2lan, 1442 .get_link_up_info = e1000_get_link_up_info_80003es2lan,
1376 .led_on = e1000e_led_on_generic, 1443 .led_on = e1000e_led_on_generic,
1377 .led_off = e1000e_led_off_generic, 1444 .led_off = e1000e_led_off_generic,
1378 .update_mc_addr_list = e1000e_update_mc_addr_list_generic, 1445 .update_mc_addr_list = e1000e_update_mc_addr_list_generic,
1446 .write_vfta = e1000_write_vfta_generic,
1447 .clear_vfta = e1000_clear_vfta_generic,
1379 .reset_hw = e1000_reset_hw_80003es2lan, 1448 .reset_hw = e1000_reset_hw_80003es2lan,
1380 .init_hw = e1000_init_hw_80003es2lan, 1449 .init_hw = e1000_init_hw_80003es2lan,
1381 .setup_link = e1000e_setup_link, 1450 .setup_link = e1000e_setup_link,
@@ -1384,30 +1453,31 @@ static struct e1000_mac_operations es2_mac_ops = {
1384}; 1453};
1385 1454
1386static struct e1000_phy_operations es2_phy_ops = { 1455static struct e1000_phy_operations es2_phy_ops = {
1387 .acquire_phy = e1000_acquire_phy_80003es2lan, 1456 .acquire = e1000_acquire_phy_80003es2lan,
1457 .check_polarity = e1000_check_polarity_m88,
1388 .check_reset_block = e1000e_check_reset_block_generic, 1458 .check_reset_block = e1000e_check_reset_block_generic,
1389 .commit_phy = e1000e_phy_sw_reset, 1459 .commit = e1000e_phy_sw_reset,
1390 .force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan, 1460 .force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan,
1391 .get_cfg_done = e1000_get_cfg_done_80003es2lan, 1461 .get_cfg_done = e1000_get_cfg_done_80003es2lan,
1392 .get_cable_length = e1000_get_cable_length_80003es2lan, 1462 .get_cable_length = e1000_get_cable_length_80003es2lan,
1393 .get_phy_info = e1000e_get_phy_info_m88, 1463 .get_info = e1000e_get_phy_info_m88,
1394 .read_phy_reg = e1000_read_phy_reg_gg82563_80003es2lan, 1464 .read_reg = e1000_read_phy_reg_gg82563_80003es2lan,
1395 .release_phy = e1000_release_phy_80003es2lan, 1465 .release = e1000_release_phy_80003es2lan,
1396 .reset_phy = e1000e_phy_hw_reset_generic, 1466 .reset = e1000e_phy_hw_reset_generic,
1397 .set_d0_lplu_state = NULL, 1467 .set_d0_lplu_state = NULL,
1398 .set_d3_lplu_state = e1000e_set_d3_lplu_state, 1468 .set_d3_lplu_state = e1000e_set_d3_lplu_state,
1399 .write_phy_reg = e1000_write_phy_reg_gg82563_80003es2lan, 1469 .write_reg = e1000_write_phy_reg_gg82563_80003es2lan,
1400 .cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan, 1470 .cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan,
1401}; 1471};
1402 1472
1403static struct e1000_nvm_operations es2_nvm_ops = { 1473static struct e1000_nvm_operations es2_nvm_ops = {
1404 .acquire_nvm = e1000_acquire_nvm_80003es2lan, 1474 .acquire = e1000_acquire_nvm_80003es2lan,
1405 .read_nvm = e1000e_read_nvm_eerd, 1475 .read = e1000e_read_nvm_eerd,
1406 .release_nvm = e1000_release_nvm_80003es2lan, 1476 .release = e1000_release_nvm_80003es2lan,
1407 .update_nvm = e1000e_update_nvm_checksum_generic, 1477 .update = e1000e_update_nvm_checksum_generic,
1408 .valid_led_default = e1000e_valid_led_default, 1478 .valid_led_default = e1000e_valid_led_default,
1409 .validate_nvm = e1000e_validate_nvm_checksum_generic, 1479 .validate = e1000e_validate_nvm_checksum_generic,
1410 .write_nvm = e1000_write_nvm_80003es2lan, 1480 .write = e1000_write_nvm_80003es2lan,
1411}; 1481};
1412 1482
1413struct e1000_info e1000_es2_info = { 1483struct e1000_info e1000_es2_info = {