36 #define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00
37 #define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02
38 #define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10
39 #define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F
41 #define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008
42 #define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800
43 #define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010
45 #define E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT 0x0004
46 #define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000
47 #define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000
49 #define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C
50 #define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004
52 #define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00
53 #define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000
55 #define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8
56 #define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9
59 #define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002
60 #define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060
61 #define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000
62 #define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020
63 #define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060
66 #define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000
71 #define GG82563_MSCR_TX_CLK_MASK 0x0007
72 #define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004
73 #define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005
74 #define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007
76 #define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010
79 #define GG82563_DSPD_CABLE_LENGTH 0x0007
86 #define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800
89 #define GG82563_MAX_KMRN_RETRY 0x5
92 #define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001
96 #define GG82563_ICR_DIS_PADDING 0x0010
103 static const u16 e1000_gg82563_cable_length_table[] = {
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)
108 static s32 e1000_setup_copper_link_80003es2lan(
struct e1000_hw *
hw);
111 static void e1000_initialize_hw_bits_80003es2lan(
struct e1000_hw *
hw);
112 static void e1000_clear_hw_cntrs_80003es2lan(
struct e1000_hw *
hw);
113 static s32 e1000_cfg_kmrn_1000_80003es2lan(
struct e1000_hw *
hw);
115 static s32 e1000_cfg_on_link_up_80003es2lan(
struct e1000_hw *
hw);
120 static void e1000_power_down_phy_copper_80003es2lan(
struct e1000_hw *
hw);
126 static s32 e1000_init_phy_params_80003es2lan(
struct e1000_hw *
hw)
136 phy->
ops.power_down = e1000_power_down_phy_copper_80003es2lan;
158 static s32 e1000_init_nvm_params_80003es2lan(
struct e1000_hw *hw)
204 static s32 e1000_init_mac_params_80003es2lan(
struct e1000_hw *hw)
209 switch (hw->
adapter->pdev->device) {
213 mac->
ops.setup_physical_interface =
219 mac->
ops.setup_physical_interface =
220 e1000_setup_copper_link_80003es2lan;
236 hw->
mac.ops.set_lan_id(hw);
246 rc = e1000_init_mac_params_80003es2lan(hw);
250 rc = e1000_init_nvm_params_80003es2lan(hw);
254 rc = e1000_init_phy_params_80003es2lan(hw);
267 static s32 e1000_acquire_phy_80003es2lan(
struct e1000_hw *hw)
272 return e1000_acquire_swfw_sync_80003es2lan(hw, mask);
281 static void e1000_release_phy_80003es2lan(
struct e1000_hw *hw)
286 e1000_release_swfw_sync_80003es2lan(hw, mask);
296 static s32 e1000_acquire_mac_csr_80003es2lan(
struct e1000_hw *hw)
302 return e1000_acquire_swfw_sync_80003es2lan(hw, mask);
311 static void e1000_release_mac_csr_80003es2lan(
struct e1000_hw *hw)
317 e1000_release_swfw_sync_80003es2lan(hw, mask);
326 static s32 e1000_acquire_nvm_80003es2lan(
struct e1000_hw *hw)
348 static void e1000_release_nvm_80003es2lan(
struct e1000_hw *hw)
366 u32 fwmask = mask << 16;
370 while (i < timeout) {
374 swfw_sync =
er32(SW_FW_SYNC);
375 if (!(swfw_sync & (fwmask | swmask)))
388 e_dbg(
"Driver can't access resource, SW_FW_SYNC timeout.\n");
393 ew32(SW_FW_SYNC, swfw_sync);
408 static void e1000_release_swfw_sync_80003es2lan(
struct e1000_hw *hw,
u16 mask)
415 swfw_sync =
er32(SW_FW_SYNC);
417 ew32(SW_FW_SYNC, swfw_sync);
430 static s32 e1000_read_phy_reg_gg82563_80003es2lan(
struct e1000_hw *hw,
437 ret_val = e1000_acquire_phy_80003es2lan(hw);
455 e1000_release_phy_80003es2lan(hw);
471 e1000_release_phy_80003es2lan(hw);
478 MAX_PHY_REG_ADDRESS & offset,
484 MAX_PHY_REG_ADDRESS & offset,
488 e1000_release_phy_80003es2lan(hw);
501 static s32 e1000_write_phy_reg_gg82563_80003es2lan(
struct e1000_hw *hw,
508 ret_val = e1000_acquire_phy_80003es2lan(hw);
526 e1000_release_phy_80003es2lan(hw);
542 e1000_release_phy_80003es2lan(hw);
549 MAX_PHY_REG_ADDRESS & offset,
555 MAX_PHY_REG_ADDRESS & offset,
559 e1000_release_phy_80003es2lan(hw);
573 static s32 e1000_write_nvm_80003es2lan(
struct e1000_hw *hw,
u16 offset,
586 static s32 e1000_get_cfg_done_80003es2lan(
struct e1000_hw *hw)
591 if (hw->
bus.func == 1)
595 if (
er32(EEMNGCTL) & mask)
601 e_dbg(
"MNG configuration cycle has not completed.\n");
615 static s32 e1000_phy_force_speed_duplex_80003es2lan(
struct e1000_hw *hw)
634 e_dbg(
"GG82563 PSCR: %X\n", phy_data);
651 if (hw->
phy.autoneg_wait_to_complete) {
652 e_dbg(
"Waiting for forced speed/duplex link on GG82563 phy.\n");
707 static s32 e1000_get_cable_length_80003es2lan(
struct e1000_hw *hw)
738 static s32 e1000_get_link_up_info_80003es2lan(
struct e1000_hw *hw,
u16 *speed,
747 hw->
phy.ops.cfg_on_link_up(hw);
763 static s32 e1000_reset_hw_80003es2lan(
struct e1000_hw *hw)
775 e_dbg(
"PCI-E Master disable polling has failed.\n");
777 e_dbg(
"Masking off all interrupts\n");
788 ret_val = e1000_acquire_phy_80003es2lan(hw);
789 e_dbg(
"Issuing a global reset to MAC\n");
791 e1000_release_phy_80003es2lan(hw);
818 static s32 e1000_init_hw_80003es2lan(
struct e1000_hw *hw)
826 e1000_initialize_hw_bits_80003es2lan(hw);
829 ret_val = mac->
ops.id_led_init(hw);
831 e_dbg(
"Error initializing identification LED\n");
835 e_dbg(
"Initializing the IEEE VLAN\n");
836 mac->
ops.clear_vfta(hw);
842 e_dbg(
"Zeroing the MTA\n");
847 ret_val = mac->
ops.setup_link(hw);
857 reg_data =
er32(TXDCTL(0));
860 ew32(TXDCTL(0), reg_data);
863 reg_data =
er32(TXDCTL(1));
866 ew32(TXDCTL(1), reg_data);
874 reg_data =
er32(TCTL_EXT);
877 ew32(TCTL_EXT, reg_data);
880 reg_data =
er32(TIPG);
883 ew32(TIPG, reg_data);
886 reg_data &= ~0x00100000;
892 ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
908 e1000_clear_hw_cntrs_80003es2lan(hw);
919 static void e1000_initialize_hw_bits_80003es2lan(
struct e1000_hw *hw)
924 reg =
er32(TXDCTL(0));
926 ew32(TXDCTL(0), reg);
929 reg =
er32(TXDCTL(1));
931 ew32(TXDCTL(1), reg);
963 static s32 e1000_copper_link_setup_gg82563_80003es2lan(
struct e1000_hw *hw)
1027 e_dbg(
"Error Resetting the PHY\n");
1032 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
1039 ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
1045 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
1060 ctrl_ext =
er32(CTRL_EXT);
1062 ew32(CTRL_EXT, ctrl_ext);
1073 if (!hw->
mac.ops.check_mng_mode(hw)) {
1113 static s32 e1000_setup_copper_link_80003es2lan(
struct e1000_hw *hw)
1129 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
GG82563_REG(0x34, 4),
1133 ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
GG82563_REG(0x34, 9),
1138 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
GG82563_REG(0x34, 9),
1142 ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
1148 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
1154 ret_val = e1000_copper_link_setup_gg82563_80003es2lan(hw);
1169 static s32 e1000_cfg_on_link_up_80003es2lan(
struct e1000_hw *hw)
1182 ret_val = e1000_cfg_kmrn_1000_80003es2lan(hw);
1184 ret_val = e1000_cfg_kmrn_10_100_80003es2lan(hw, duplex);
1198 static s32 e1000_cfg_kmrn_10_100_80003es2lan(
struct e1000_hw *hw,
u16 duplex)
1206 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
1244 static s32 e1000_cfg_kmrn_1000_80003es2lan(
struct e1000_hw *hw)
1252 ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
1290 static s32 e1000_read_kmrn_reg_80003es2lan(
struct e1000_hw *hw,
u32 offset,
1296 ret_val = e1000_acquire_mac_csr_80003es2lan(hw);
1302 ew32(KMRNCTRLSTA, kmrnctrlsta);
1307 kmrnctrlsta =
er32(KMRNCTRLSTA);
1308 *data = (
u16)kmrnctrlsta;
1310 e1000_release_mac_csr_80003es2lan(hw);
1325 static s32 e1000_write_kmrn_reg_80003es2lan(
struct e1000_hw *hw,
u32 offset,
1331 ret_val = e1000_acquire_mac_csr_80003es2lan(hw);
1337 ew32(KMRNCTRLSTA, kmrnctrlsta);
1342 e1000_release_mac_csr_80003es2lan(hw);
1351 static s32 e1000_read_mac_addr_80003es2lan(
struct e1000_hw *hw)
1374 static void e1000_power_down_phy_copper_80003es2lan(
struct e1000_hw *hw)
1377 if (!(hw->
mac.ops.check_mng_mode(hw) ||
1378 hw->
phy.ops.check_reset_block(hw)))
1388 static void e1000_clear_hw_cntrs_80003es2lan(
struct e1000_hw *hw)
1429 .read_mac_addr = e1000_read_mac_addr_80003es2lan,
1435 .clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan,
1438 .get_link_up_info = e1000_get_link_up_info_80003es2lan,
1444 .reset_hw = e1000_reset_hw_80003es2lan,
1445 .init_hw = e1000_init_hw_80003es2lan,
1454 .acquire = e1000_acquire_phy_80003es2lan,
1458 .force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan,
1459 .get_cfg_done = e1000_get_cfg_done_80003es2lan,
1460 .get_cable_length = e1000_get_cable_length_80003es2lan,
1462 .read_reg = e1000_read_phy_reg_gg82563_80003es2lan,
1463 .release = e1000_release_phy_80003es2lan,
1465 .set_d0_lplu_state =
NULL,
1467 .write_reg = e1000_write_phy_reg_gg82563_80003es2lan,
1468 .cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan,
1472 .acquire = e1000_acquire_nvm_80003es2lan,
1474 .release = e1000_release_nvm_80003es2lan,
1479 .write = e1000_write_nvm_80003es2lan,
1496 .get_variants = e1000_get_variants_80003es2lan,
1497 .mac_ops = &es2_mac_ops,
1498 .phy_ops = &es2_phy_ops,
1499 .nvm_ops = &es2_nvm_ops,