Lines Matching refs:hw
35 static s32 e1000_check_downshift(struct e1000_hw *hw);
36 static s32 e1000_check_polarity(struct e1000_hw *hw,
38 static void e1000_clear_hw_cntrs(struct e1000_hw *hw);
39 static void e1000_clear_vfta(struct e1000_hw *hw);
40 static s32 e1000_config_dsp_after_link_change(struct e1000_hw *hw,
42 static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw);
43 static s32 e1000_detect_gig_phy(struct e1000_hw *hw);
44 static s32 e1000_get_auto_rd_done(struct e1000_hw *hw);
45 static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length,
47 static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw);
48 static s32 e1000_id_led_init(struct e1000_hw *hw);
49 static void e1000_init_rx_addrs(struct e1000_hw *hw);
50 static s32 e1000_phy_igp_get_info(struct e1000_hw *hw,
52 static s32 e1000_phy_m88_get_info(struct e1000_hw *hw,
54 static s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
55 static s32 e1000_wait_autoneg(struct e1000_hw *hw);
56 static void e1000_write_reg_io(struct e1000_hw *hw, u32 offset, u32 value);
57 static s32 e1000_set_phy_type(struct e1000_hw *hw);
58 static void e1000_phy_init_script(struct e1000_hw *hw);
59 static s32 e1000_setup_copper_link(struct e1000_hw *hw);
60 static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw);
61 static s32 e1000_adjust_serdes_amplitude(struct e1000_hw *hw);
62 static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw);
63 static s32 e1000_config_mac_to_phy(struct e1000_hw *hw);
64 static void e1000_raise_mdi_clk(struct e1000_hw *hw, u32 *ctrl);
65 static void e1000_lower_mdi_clk(struct e1000_hw *hw, u32 *ctrl);
66 static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, u32 data, u16 count);
67 static u16 e1000_shift_in_mdi_bits(struct e1000_hw *hw);
68 static s32 e1000_phy_reset_dsp(struct e1000_hw *hw);
69 static s32 e1000_write_eeprom_spi(struct e1000_hw *hw, u16 offset,
71 static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset,
73 static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw);
74 static void e1000_raise_ee_clk(struct e1000_hw *hw, u32 *eecd);
75 static void e1000_lower_ee_clk(struct e1000_hw *hw, u32 *eecd);
76 static void e1000_shift_out_ee_bits(struct e1000_hw *hw, u16 data, u16 count);
77 static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr,
79 static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr,
81 static u16 e1000_shift_in_ee_bits(struct e1000_hw *hw, u16 count);
82 static s32 e1000_acquire_eeprom(struct e1000_hw *hw);
83 static void e1000_release_eeprom(struct e1000_hw *hw);
84 static void e1000_standby_eeprom(struct e1000_hw *hw);
85 static s32 e1000_set_vco_speed(struct e1000_hw *hw);
86 static s32 e1000_polarity_reversal_workaround(struct e1000_hw *hw);
87 static s32 e1000_set_phy_mode(struct e1000_hw *hw);
88 static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words,
90 static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words,
116 static s32 e1000_set_phy_type(struct e1000_hw *hw) in e1000_set_phy_type() argument
118 if (hw->mac_type == e1000_undefined) in e1000_set_phy_type()
121 switch (hw->phy_id) { in e1000_set_phy_type()
127 hw->phy_type = e1000_phy_m88; in e1000_set_phy_type()
130 if (hw->mac_type == e1000_82541 || in e1000_set_phy_type()
131 hw->mac_type == e1000_82541_rev_2 || in e1000_set_phy_type()
132 hw->mac_type == e1000_82547 || in e1000_set_phy_type()
133 hw->mac_type == e1000_82547_rev_2) in e1000_set_phy_type()
134 hw->phy_type = e1000_phy_igp; in e1000_set_phy_type()
137 hw->phy_type = e1000_phy_8211; in e1000_set_phy_type()
140 hw->phy_type = e1000_phy_8201; in e1000_set_phy_type()
144 hw->phy_type = e1000_phy_undefined; in e1000_set_phy_type()
155 static void e1000_phy_init_script(struct e1000_hw *hw) in e1000_phy_init_script() argument
160 if (hw->phy_init_script) { in e1000_phy_init_script()
166 ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); in e1000_phy_init_script()
169 e1000_write_phy_reg(hw, 0x2F5B, 0x0003); in e1000_phy_init_script()
172 e1000_write_phy_reg(hw, 0x0000, 0x0140); in e1000_phy_init_script()
175 switch (hw->mac_type) { in e1000_phy_init_script()
178 e1000_write_phy_reg(hw, 0x1F95, 0x0001); in e1000_phy_init_script()
179 e1000_write_phy_reg(hw, 0x1F71, 0xBD21); in e1000_phy_init_script()
180 e1000_write_phy_reg(hw, 0x1F79, 0x0018); in e1000_phy_init_script()
181 e1000_write_phy_reg(hw, 0x1F30, 0x1600); in e1000_phy_init_script()
182 e1000_write_phy_reg(hw, 0x1F31, 0x0014); in e1000_phy_init_script()
183 e1000_write_phy_reg(hw, 0x1F32, 0x161C); in e1000_phy_init_script()
184 e1000_write_phy_reg(hw, 0x1F94, 0x0003); in e1000_phy_init_script()
185 e1000_write_phy_reg(hw, 0x1F96, 0x003F); in e1000_phy_init_script()
186 e1000_write_phy_reg(hw, 0x2010, 0x0008); in e1000_phy_init_script()
191 e1000_write_phy_reg(hw, 0x1F73, 0x0099); in e1000_phy_init_script()
197 e1000_write_phy_reg(hw, 0x0000, 0x3300); in e1000_phy_init_script()
201 e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); in e1000_phy_init_script()
203 if (hw->mac_type == e1000_82547) { in e1000_phy_init_script()
207 e1000_read_phy_reg(hw, in e1000_phy_init_script()
212 e1000_read_phy_reg(hw, in e1000_phy_init_script()
235 e1000_write_phy_reg(hw, in e1000_phy_init_script()
238 e1000_write_phy_reg(hw, in e1000_phy_init_script()
250 s32 e1000_set_mac_type(struct e1000_hw *hw) in e1000_set_mac_type() argument
252 switch (hw->device_id) { in e1000_set_mac_type()
254 switch (hw->revision_id) { in e1000_set_mac_type()
256 hw->mac_type = e1000_82542_rev2_0; in e1000_set_mac_type()
259 hw->mac_type = e1000_82542_rev2_1; in e1000_set_mac_type()
268 hw->mac_type = e1000_82543; in e1000_set_mac_type()
274 hw->mac_type = e1000_82544; in e1000_set_mac_type()
281 hw->mac_type = e1000_82540; in e1000_set_mac_type()
285 hw->mac_type = e1000_82545; in e1000_set_mac_type()
290 hw->mac_type = e1000_82545_rev_3; in e1000_set_mac_type()
295 hw->mac_type = e1000_82546; in e1000_set_mac_type()
303 hw->mac_type = e1000_82546_rev_3; in e1000_set_mac_type()
308 hw->mac_type = e1000_82541; in e1000_set_mac_type()
314 hw->mac_type = e1000_82541_rev_2; in e1000_set_mac_type()
318 hw->mac_type = e1000_82547; in e1000_set_mac_type()
321 hw->mac_type = e1000_82547_rev_2; in e1000_set_mac_type()
324 hw->mac_type = e1000_ce4100; in e1000_set_mac_type()
331 switch (hw->mac_type) { in e1000_set_mac_type()
336 hw->asf_firmware_present = true; in e1000_set_mac_type()
345 if (hw->mac_type == e1000_82543) in e1000_set_mac_type()
346 hw->bad_tx_carr_stats_fd = true; in e1000_set_mac_type()
348 if (hw->mac_type > e1000_82544) in e1000_set_mac_type()
349 hw->has_smbus = true; in e1000_set_mac_type()
358 void e1000_set_media_type(struct e1000_hw *hw) in e1000_set_media_type() argument
362 if (hw->mac_type != e1000_82543) { in e1000_set_media_type()
364 hw->tbi_compatibility_en = false; in e1000_set_media_type()
367 switch (hw->device_id) { in e1000_set_media_type()
370 hw->media_type = e1000_media_type_internal_serdes; in e1000_set_media_type()
373 switch (hw->mac_type) { in e1000_set_media_type()
376 hw->media_type = e1000_media_type_fiber; in e1000_set_media_type()
379 hw->media_type = e1000_media_type_copper; in e1000_set_media_type()
384 hw->media_type = e1000_media_type_fiber; in e1000_set_media_type()
386 hw->tbi_compatibility_en = false; in e1000_set_media_type()
388 hw->media_type = e1000_media_type_copper; in e1000_set_media_type()
401 s32 e1000_reset_hw(struct e1000_hw *hw) in e1000_reset_hw() argument
411 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_reset_hw()
413 e1000_pci_clear_mwi(hw); in e1000_reset_hw()
429 hw->tbi_compatibility_on = false; in e1000_reset_hw()
439 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { in e1000_reset_hw()
452 switch (hw->mac_type) { in e1000_reset_hw()
462 E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST)); in e1000_reset_hw()
479 switch (hw->mac_type) { in e1000_reset_hw()
502 ret_val = e1000_get_auto_rd_done(hw); in e1000_reset_hw()
509 if (hw->mac_type >= e1000_82540) { in e1000_reset_hw()
515 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { in e1000_reset_hw()
516 e1000_phy_init_script(hw); in e1000_reset_hw()
533 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_reset_hw()
534 if (hw->pci_cmd_word & PCI_COMMAND_INVALIDATE) in e1000_reset_hw()
535 e1000_pci_set_mwi(hw); in e1000_reset_hw()
551 s32 e1000_init_hw(struct e1000_hw *hw) in e1000_init_hw() argument
560 ret_val = e1000_id_led_init(hw); in e1000_init_hw()
567 e1000_set_media_type(hw); in e1000_init_hw()
571 if (hw->mac_type < e1000_82545_rev_3) in e1000_init_hw()
573 e1000_clear_vfta(hw); in e1000_init_hw()
576 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_init_hw()
578 e1000_pci_clear_mwi(hw); in e1000_init_hw()
587 e1000_init_rx_addrs(hw); in e1000_init_hw()
590 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_init_hw()
594 if (hw->pci_cmd_word & PCI_COMMAND_INVALIDATE) in e1000_init_hw()
595 e1000_pci_set_mwi(hw); in e1000_init_hw()
602 E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); in e1000_init_hw()
614 if (hw->dma_fairness && hw->mac_type <= e1000_82543) { in e1000_init_hw()
619 switch (hw->mac_type) { in e1000_init_hw()
627 if (hw->bus_type == e1000_bus_type_pcix in e1000_init_hw()
628 && e1000_pcix_get_mmrbc(hw) > 2048) in e1000_init_hw()
629 e1000_pcix_set_mmrbc(hw, 2048); in e1000_init_hw()
634 ret_val = e1000_setup_link(hw); in e1000_init_hw()
637 if (hw->mac_type > e1000_82544) { in e1000_init_hw()
650 e1000_clear_hw_cntrs(hw); in e1000_init_hw()
652 if (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER || in e1000_init_hw()
653 hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3) { in e1000_init_hw()
669 static s32 e1000_adjust_serdes_amplitude(struct e1000_hw *hw) in e1000_adjust_serdes_amplitude() argument
674 if (hw->media_type != e1000_media_type_internal_serdes) in e1000_adjust_serdes_amplitude()
677 switch (hw->mac_type) { in e1000_adjust_serdes_amplitude()
685 ret_val = e1000_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1, in e1000_adjust_serdes_amplitude()
695 e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data); in e1000_adjust_serdes_amplitude()
713 s32 e1000_setup_link(struct e1000_hw *hw) in e1000_setup_link() argument
727 if (hw->fc == E1000_FC_DEFAULT) { in e1000_setup_link()
728 ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, in e1000_setup_link()
735 hw->fc = E1000_FC_NONE; in e1000_setup_link()
738 hw->fc = E1000_FC_TX_PAUSE; in e1000_setup_link()
740 hw->fc = E1000_FC_FULL; in e1000_setup_link()
747 if (hw->mac_type == e1000_82542_rev2_0) in e1000_setup_link()
748 hw->fc &= (~E1000_FC_TX_PAUSE); in e1000_setup_link()
750 if ((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1)) in e1000_setup_link()
751 hw->fc &= (~E1000_FC_RX_PAUSE); in e1000_setup_link()
753 hw->original_fc = hw->fc; in e1000_setup_link()
755 e_dbg("After fix-ups FlowControl is now = %x\n", hw->fc); in e1000_setup_link()
764 if (hw->mac_type == e1000_82543) { in e1000_setup_link()
765 ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, in e1000_setup_link()
777 ret_val = (hw->media_type == e1000_media_type_copper) ? in e1000_setup_link()
778 e1000_setup_copper_link(hw) : e1000_setup_fiber_serdes_link(hw); in e1000_setup_link()
791 ew32(FCTTV, hw->fc_pause_time); in e1000_setup_link()
799 if (!(hw->fc & E1000_FC_TX_PAUSE)) { in e1000_setup_link()
807 if (hw->fc_send_xon) { in e1000_setup_link()
808 ew32(FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE)); in e1000_setup_link()
809 ew32(FCRTH, hw->fc_high_water); in e1000_setup_link()
811 ew32(FCRTL, hw->fc_low_water); in e1000_setup_link()
812 ew32(FCRTH, hw->fc_high_water); in e1000_setup_link()
826 static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw) in e1000_setup_fiber_serdes_link() argument
842 if (hw->media_type == e1000_media_type_fiber) in e1000_setup_fiber_serdes_link()
843 signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; in e1000_setup_fiber_serdes_link()
845 ret_val = e1000_adjust_serdes_amplitude(hw); in e1000_setup_fiber_serdes_link()
853 ret_val = e1000_set_vco_speed(hw); in e1000_setup_fiber_serdes_link()
857 e1000_config_collision_dist(hw); in e1000_setup_fiber_serdes_link()
875 switch (hw->fc) { in e1000_setup_fiber_serdes_link()
919 hw->txcw = txcw; in e1000_setup_fiber_serdes_link()
929 if (hw->media_type == e1000_media_type_internal_serdes || in e1000_setup_fiber_serdes_link()
940 hw->autoneg_failed = 1; in e1000_setup_fiber_serdes_link()
946 ret_val = e1000_check_for_link(hw); in e1000_setup_fiber_serdes_link()
951 hw->autoneg_failed = 0; in e1000_setup_fiber_serdes_link()
953 hw->autoneg_failed = 0; in e1000_setup_fiber_serdes_link()
968 static s32 e1000_copper_link_rtl_setup(struct e1000_hw *hw) in e1000_copper_link_rtl_setup() argument
973 ret_val = e1000_phy_reset(hw); in e1000_copper_link_rtl_setup()
982 static s32 gbe_dhg_phy_setup(struct e1000_hw *hw) in gbe_dhg_phy_setup() argument
987 switch (hw->phy_type) { in gbe_dhg_phy_setup()
989 ret_val = e1000_copper_link_rtl_setup(hw); in gbe_dhg_phy_setup()
1008 ret_val = e1000_copper_link_rtl_setup(hw); in gbe_dhg_phy_setup()
1029 static s32 e1000_copper_link_preconfig(struct e1000_hw *hw) in e1000_copper_link_preconfig() argument
1040 if (hw->mac_type > e1000_82543) { in e1000_copper_link_preconfig()
1048 ret_val = e1000_phy_hw_reset(hw); in e1000_copper_link_preconfig()
1054 ret_val = e1000_detect_gig_phy(hw); in e1000_copper_link_preconfig()
1059 e_dbg("Phy ID = %x\n", hw->phy_id); in e1000_copper_link_preconfig()
1062 ret_val = e1000_set_phy_mode(hw); in e1000_copper_link_preconfig()
1066 if ((hw->mac_type == e1000_82545_rev_3) || in e1000_copper_link_preconfig()
1067 (hw->mac_type == e1000_82546_rev_3)) { in e1000_copper_link_preconfig()
1069 e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_copper_link_preconfig()
1072 e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_copper_link_preconfig()
1075 if (hw->mac_type <= e1000_82543 || in e1000_copper_link_preconfig()
1076 hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || in e1000_copper_link_preconfig()
1077 hw->mac_type == e1000_82541_rev_2 in e1000_copper_link_preconfig()
1078 || hw->mac_type == e1000_82547_rev_2) in e1000_copper_link_preconfig()
1079 hw->phy_reset_disable = false; in e1000_copper_link_preconfig()
1088 static s32 e1000_copper_link_igp_setup(struct e1000_hw *hw) in e1000_copper_link_igp_setup() argument
1094 if (hw->phy_reset_disable) in e1000_copper_link_igp_setup()
1097 ret_val = e1000_phy_reset(hw); in e1000_copper_link_igp_setup()
1112 if (hw->phy_type == e1000_phy_igp) { in e1000_copper_link_igp_setup()
1114 ret_val = e1000_set_d3_lplu_state(hw, false); in e1000_copper_link_igp_setup()
1122 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); in e1000_copper_link_igp_setup()
1126 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { in e1000_copper_link_igp_setup()
1127 hw->dsp_config_state = e1000_dsp_config_disabled; in e1000_copper_link_igp_setup()
1132 hw->mdix = 1; in e1000_copper_link_igp_setup()
1135 hw->dsp_config_state = e1000_dsp_config_enabled; in e1000_copper_link_igp_setup()
1138 switch (hw->mdix) { in e1000_copper_link_igp_setup()
1151 ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); in e1000_copper_link_igp_setup()
1156 if (hw->autoneg) { in e1000_copper_link_igp_setup()
1157 e1000_ms_type phy_ms_setting = hw->master_slave; in e1000_copper_link_igp_setup()
1159 if (hw->ffe_config_state == e1000_ffe_config_active) in e1000_copper_link_igp_setup()
1160 hw->ffe_config_state = e1000_ffe_config_enabled; in e1000_copper_link_igp_setup()
1162 if (hw->dsp_config_state == e1000_dsp_config_activated) in e1000_copper_link_igp_setup()
1163 hw->dsp_config_state = e1000_dsp_config_enabled; in e1000_copper_link_igp_setup()
1169 if (hw->autoneg_advertised == ADVERTISE_1000_FULL) { in e1000_copper_link_igp_setup()
1172 e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_copper_link_igp_setup()
1178 e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_copper_link_igp_setup()
1184 e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); in e1000_copper_link_igp_setup()
1189 e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); in e1000_copper_link_igp_setup()
1194 ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); in e1000_copper_link_igp_setup()
1199 hw->original_master_slave = (phy_data & CR_1000T_MS_ENABLE) ? in e1000_copper_link_igp_setup()
1217 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); in e1000_copper_link_igp_setup()
1229 static s32 e1000_copper_link_mgp_setup(struct e1000_hw *hw) in e1000_copper_link_mgp_setup() argument
1234 if (hw->phy_reset_disable) in e1000_copper_link_mgp_setup()
1238 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_copper_link_mgp_setup()
1253 switch (hw->mdix) { in e1000_copper_link_mgp_setup()
1276 if (hw->disable_polarity_correction == 1) in e1000_copper_link_mgp_setup()
1278 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_copper_link_mgp_setup()
1282 if (hw->phy_revision < M88E1011_I_REV_4) { in e1000_copper_link_mgp_setup()
1287 e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, in e1000_copper_link_mgp_setup()
1294 if ((hw->phy_revision == E1000_REVISION_2) && in e1000_copper_link_mgp_setup()
1295 (hw->phy_id == M88E1111_I_PHY_ID)) { in e1000_copper_link_mgp_setup()
1299 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_mgp_setup()
1310 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_mgp_setup()
1319 ret_val = e1000_phy_reset(hw); in e1000_copper_link_mgp_setup()
1335 static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) in e1000_copper_link_autoneg() argument
1343 hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT; in e1000_copper_link_autoneg()
1348 if (hw->autoneg_advertised == 0) in e1000_copper_link_autoneg()
1349 hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; in e1000_copper_link_autoneg()
1352 if (hw->phy_type == e1000_phy_8201) in e1000_copper_link_autoneg()
1353 hw->autoneg_advertised &= AUTONEG_ADVERTISE_10_100_ALL; in e1000_copper_link_autoneg()
1356 ret_val = e1000_phy_setup_autoneg(hw); in e1000_copper_link_autoneg()
1366 ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); in e1000_copper_link_autoneg()
1371 ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); in e1000_copper_link_autoneg()
1378 if (hw->wait_autoneg_complete) { in e1000_copper_link_autoneg()
1379 ret_val = e1000_wait_autoneg(hw); in e1000_copper_link_autoneg()
1387 hw->get_link_status = true; in e1000_copper_link_autoneg()
1405 static s32 e1000_copper_link_postconfig(struct e1000_hw *hw) in e1000_copper_link_postconfig() argument
1409 if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_ce4100)) { in e1000_copper_link_postconfig()
1410 e1000_config_collision_dist(hw); in e1000_copper_link_postconfig()
1412 ret_val = e1000_config_mac_to_phy(hw); in e1000_copper_link_postconfig()
1418 ret_val = e1000_config_fc_after_link_up(hw); in e1000_copper_link_postconfig()
1425 if (hw->phy_type == e1000_phy_igp) { in e1000_copper_link_postconfig()
1426 ret_val = e1000_config_dsp_after_link_change(hw, true); in e1000_copper_link_postconfig()
1442 static s32 e1000_setup_copper_link(struct e1000_hw *hw) in e1000_setup_copper_link() argument
1449 ret_val = e1000_copper_link_preconfig(hw); in e1000_setup_copper_link()
1453 if (hw->phy_type == e1000_phy_igp) { in e1000_setup_copper_link()
1454 ret_val = e1000_copper_link_igp_setup(hw); in e1000_setup_copper_link()
1457 } else if (hw->phy_type == e1000_phy_m88) { in e1000_setup_copper_link()
1458 ret_val = e1000_copper_link_mgp_setup(hw); in e1000_setup_copper_link()
1462 ret_val = gbe_dhg_phy_setup(hw); in e1000_setup_copper_link()
1469 if (hw->autoneg) { in e1000_setup_copper_link()
1473 ret_val = e1000_copper_link_autoneg(hw); in e1000_setup_copper_link()
1481 ret_val = e1000_phy_force_speed_duplex(hw); in e1000_setup_copper_link()
1492 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_setup_copper_link()
1495 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_setup_copper_link()
1501 ret_val = e1000_copper_link_postconfig(hw); in e1000_setup_copper_link()
1521 s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) in e1000_phy_setup_autoneg() argument
1528 ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1533 ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); in e1000_phy_setup_autoneg()
1536 else if (hw->phy_type == e1000_phy_8201) in e1000_phy_setup_autoneg()
1553 e_dbg("autoneg_advertised %x\n", hw->autoneg_advertised); in e1000_phy_setup_autoneg()
1556 if (hw->autoneg_advertised & ADVERTISE_10_HALF) { in e1000_phy_setup_autoneg()
1562 if (hw->autoneg_advertised & ADVERTISE_10_FULL) { in e1000_phy_setup_autoneg()
1568 if (hw->autoneg_advertised & ADVERTISE_100_HALF) { in e1000_phy_setup_autoneg()
1574 if (hw->autoneg_advertised & ADVERTISE_100_FULL) { in e1000_phy_setup_autoneg()
1580 if (hw->autoneg_advertised & ADVERTISE_1000_HALF) { in e1000_phy_setup_autoneg()
1586 if (hw->autoneg_advertised & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
1608 switch (hw->fc) { in e1000_phy_setup_autoneg()
1645 ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1651 if (hw->phy_type == e1000_phy_8201) { in e1000_phy_setup_autoneg()
1654 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, in e1000_phy_setup_autoneg()
1669 static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw) in e1000_phy_force_speed_duplex() argument
1679 hw->fc = E1000_FC_NONE; in e1000_phy_force_speed_duplex()
1681 e_dbg("hw->fc = %d\n", hw->fc); in e1000_phy_force_speed_duplex()
1694 ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg); in e1000_phy_force_speed_duplex()
1703 if (hw->forced_speed_duplex == e1000_100_full || in e1000_phy_force_speed_duplex()
1704 hw->forced_speed_duplex == e1000_10_full) { in e1000_phy_force_speed_duplex()
1721 if (hw->forced_speed_duplex == e1000_100_full || in e1000_phy_force_speed_duplex()
1722 hw->forced_speed_duplex == e1000_100_half) { in e1000_phy_force_speed_duplex()
1736 e1000_config_collision_dist(hw); in e1000_phy_force_speed_duplex()
1741 if (hw->phy_type == e1000_phy_m88) { in e1000_phy_force_speed_duplex()
1743 e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_phy_force_speed_duplex()
1752 e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_phy_force_speed_duplex()
1767 e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); in e1000_phy_force_speed_duplex()
1775 e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); in e1000_phy_force_speed_duplex()
1781 ret_val = e1000_write_phy_reg(hw, PHY_CTRL, mii_ctrl_reg); in e1000_phy_force_speed_duplex()
1794 if (hw->wait_autoneg_complete) { in e1000_phy_force_speed_duplex()
1805 e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_phy_force_speed_duplex()
1810 e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_phy_force_speed_duplex()
1818 if ((i == 0) && (hw->phy_type == e1000_phy_m88)) { in e1000_phy_force_speed_duplex()
1822 ret_val = e1000_phy_reset_dsp(hw); in e1000_phy_force_speed_duplex()
1839 e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_phy_force_speed_duplex()
1844 e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_phy_force_speed_duplex()
1850 if (hw->phy_type == e1000_phy_m88) { in e1000_phy_force_speed_duplex()
1857 e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, in e1000_phy_force_speed_duplex()
1864 e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, in e1000_phy_force_speed_duplex()
1874 e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_phy_force_speed_duplex()
1880 e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_phy_force_speed_duplex()
1884 if ((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) in e1000_phy_force_speed_duplex()
1885 && (!hw->autoneg) in e1000_phy_force_speed_duplex()
1886 && (hw->forced_speed_duplex == e1000_10_full in e1000_phy_force_speed_duplex()
1887 || hw->forced_speed_duplex == e1000_10_half)) { in e1000_phy_force_speed_duplex()
1888 ret_val = e1000_polarity_reversal_workaround(hw); in e1000_phy_force_speed_duplex()
1904 void e1000_config_collision_dist(struct e1000_hw *hw) in e1000_config_collision_dist() argument
1908 if (hw->mac_type < e1000_82543) in e1000_config_collision_dist()
1931 static s32 e1000_config_mac_to_phy(struct e1000_hw *hw) in e1000_config_mac_to_phy() argument
1940 if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_ce4100)) in e1000_config_mac_to_phy()
1950 switch (hw->phy_type) { in e1000_config_mac_to_phy()
1952 ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); in e1000_config_mac_to_phy()
1966 e1000_config_collision_dist(hw); in e1000_config_mac_to_phy()
1972 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, in e1000_config_mac_to_phy()
1982 e1000_config_collision_dist(hw); in e1000_config_mac_to_phy()
2010 s32 e1000_force_mac_fc(struct e1000_hw *hw) in e1000_force_mac_fc() argument
2035 switch (hw->fc) { in e1000_force_mac_fc()
2056 if (hw->mac_type == e1000_82542_rev2_0) in e1000_force_mac_fc()
2074 static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw) in e1000_config_fc_after_link_up() argument
2087 if (((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) in e1000_config_fc_after_link_up()
2088 || ((hw->media_type == e1000_media_type_internal_serdes) in e1000_config_fc_after_link_up()
2089 && (hw->autoneg_failed)) in e1000_config_fc_after_link_up()
2090 || ((hw->media_type == e1000_media_type_copper) in e1000_config_fc_after_link_up()
2091 && (!hw->autoneg))) { in e1000_config_fc_after_link_up()
2092 ret_val = e1000_force_mac_fc(hw); in e1000_config_fc_after_link_up()
2104 if ((hw->media_type == e1000_media_type_copper) && hw->autoneg) { in e1000_config_fc_after_link_up()
2109 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_config_fc_after_link_up()
2112 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_config_fc_after_link_up()
2123 ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, in e1000_config_fc_after_link_up()
2127 ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, in e1000_config_fc_after_link_up()
2176 if (hw->original_fc == E1000_FC_FULL) { in e1000_config_fc_after_link_up()
2177 hw->fc = E1000_FC_FULL; in e1000_config_fc_after_link_up()
2180 hw->fc = E1000_FC_RX_PAUSE; in e1000_config_fc_after_link_up()
2198 hw->fc = E1000_FC_TX_PAUSE; in e1000_config_fc_after_link_up()
2215 hw->fc = E1000_FC_RX_PAUSE; in e1000_config_fc_after_link_up()
2241 else if ((hw->original_fc == E1000_FC_NONE || in e1000_config_fc_after_link_up()
2242 hw->original_fc == E1000_FC_TX_PAUSE) || in e1000_config_fc_after_link_up()
2243 hw->fc_strict_ieee) { in e1000_config_fc_after_link_up()
2244 hw->fc = E1000_FC_NONE; in e1000_config_fc_after_link_up()
2247 hw->fc = E1000_FC_RX_PAUSE; in e1000_config_fc_after_link_up()
2257 e1000_get_speed_and_duplex(hw, &speed, &duplex); in e1000_config_fc_after_link_up()
2265 hw->fc = E1000_FC_NONE; in e1000_config_fc_after_link_up()
2270 ret_val = e1000_force_mac_fc(hw); in e1000_config_fc_after_link_up()
2291 static s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw) in e1000_check_for_serdes_link_generic() argument
2310 if (hw->autoneg_failed == 0) { in e1000_check_for_serdes_link_generic()
2311 hw->autoneg_failed = 1; in e1000_check_for_serdes_link_generic()
2317 ew32(TXCW, (hw->txcw & ~E1000_TXCW_ANE)); in e1000_check_for_serdes_link_generic()
2325 ret_val = e1000_config_fc_after_link_up(hw); in e1000_check_for_serdes_link_generic()
2337 ew32(TXCW, hw->txcw); in e1000_check_for_serdes_link_generic()
2340 hw->serdes_has_link = true; in e1000_check_for_serdes_link_generic()
2351 hw->serdes_has_link = true; in e1000_check_for_serdes_link_generic()
2355 hw->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
2368 hw->serdes_has_link = true; in e1000_check_for_serdes_link_generic()
2372 hw->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
2377 hw->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
2381 hw->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
2397 s32 e1000_check_for_link(struct e1000_hw *hw) in e1000_check_for_link() argument
2415 if ((hw->media_type == e1000_media_type_fiber) || in e1000_check_for_link()
2416 (hw->media_type == e1000_media_type_internal_serdes)) { in e1000_check_for_link()
2419 if (hw->media_type == e1000_media_type_fiber) { in e1000_check_for_link()
2421 (hw->mac_type > in e1000_check_for_link()
2424 hw->get_link_status = false; in e1000_check_for_link()
2434 if ((hw->media_type == e1000_media_type_copper) && hw->get_link_status) { in e1000_check_for_link()
2440 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_check_for_link()
2443 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_check_for_link()
2448 hw->get_link_status = false; in e1000_check_for_link()
2452 e1000_check_downshift(hw); in e1000_check_for_link()
2463 if ((hw->mac_type == e1000_82544 in e1000_check_for_link()
2464 || hw->mac_type == e1000_82543) && (!hw->autoneg) in e1000_check_for_link()
2465 && (hw->forced_speed_duplex == e1000_10_full in e1000_check_for_link()
2466 || hw->forced_speed_duplex == e1000_10_half)) { in e1000_check_for_link()
2469 e1000_polarity_reversal_workaround(hw); in e1000_check_for_link()
2477 e1000_config_dsp_after_link_change(hw, false); in e1000_check_for_link()
2484 if (!hw->autoneg) in e1000_check_for_link()
2488 e1000_config_dsp_after_link_change(hw, true); in e1000_check_for_link()
2498 if ((hw->mac_type >= e1000_82544) && in e1000_check_for_link()
2499 (hw->mac_type != e1000_ce4100)) in e1000_check_for_link()
2500 e1000_config_collision_dist(hw); in e1000_check_for_link()
2502 ret_val = e1000_config_mac_to_phy(hw); in e1000_check_for_link()
2515 ret_val = e1000_config_fc_after_link_up(hw); in e1000_check_for_link()
2529 if (hw->tbi_compatibility_en) { in e1000_check_for_link()
2532 e1000_get_speed_and_duplex(hw, &speed, &duplex); in e1000_check_for_link()
2542 if (hw->tbi_compatibility_on) { in e1000_check_for_link()
2549 hw->tbi_compatibility_on = false; in e1000_check_for_link()
2558 if (!hw->tbi_compatibility_on) { in e1000_check_for_link()
2559 hw->tbi_compatibility_on = true; in e1000_check_for_link()
2568 if ((hw->media_type == e1000_media_type_fiber) || in e1000_check_for_link()
2569 (hw->media_type == e1000_media_type_internal_serdes)) in e1000_check_for_link()
2570 e1000_check_for_serdes_link_generic(hw); in e1000_check_for_link()
2583 s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex) in e1000_get_speed_and_duplex() argument
2589 if (hw->mac_type >= e1000_82543) { in e1000_get_speed_and_duplex()
2619 if (hw->phy_type == e1000_phy_igp && hw->speed_downgraded) { in e1000_get_speed_and_duplex()
2620 ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_data); in e1000_get_speed_and_duplex()
2628 e1000_read_phy_reg(hw, PHY_LP_ABILITY, &phy_data); in e1000_get_speed_and_duplex()
2648 static s32 e1000_wait_autoneg(struct e1000_hw *hw) in e1000_wait_autoneg() argument
2661 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_wait_autoneg()
2664 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_wait_autoneg()
2680 static void e1000_raise_mdi_clk(struct e1000_hw *hw, u32 *ctrl) in e1000_raise_mdi_clk() argument
2695 static void e1000_lower_mdi_clk(struct e1000_hw *hw, u32 *ctrl) in e1000_lower_mdi_clk() argument
2713 static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, u32 data, u16 count) in e1000_shift_out_mdi_bits() argument
2746 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_out_mdi_bits()
2747 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_out_mdi_bits()
2759 static u16 e1000_shift_in_mdi_bits(struct e1000_hw *hw) in e1000_shift_in_mdi_bits() argument
2787 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2788 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2792 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2797 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2800 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2801 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2815 s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 reg_addr, u16 *phy_data) in e1000_read_phy_reg() argument
2822 if ((hw->phy_type == e1000_phy_igp) && in e1000_read_phy_reg()
2824 ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, in e1000_read_phy_reg()
2832 ret_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, in e1000_read_phy_reg()
2839 static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, in e1000_read_phy_reg_ex() argument
2844 const u32 phy_addr = (hw->mac_type == e1000_ce4100) ? hw->phy_addr : 1; in e1000_read_phy_reg_ex()
2851 if (hw->mac_type > e1000_82543) { in e1000_read_phy_reg_ex()
2856 if (hw->mac_type == e1000_ce4100) { in e1000_read_phy_reg_ex()
2916 e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); in e1000_read_phy_reg_ex()
2933 e1000_shift_out_mdi_bits(hw, mdic, 14); in e1000_read_phy_reg_ex()
2939 *phy_data = e1000_shift_in_mdi_bits(hw); in e1000_read_phy_reg_ex()
2953 s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 reg_addr, u16 phy_data) in e1000_write_phy_reg() argument
2960 if ((hw->phy_type == e1000_phy_igp) && in e1000_write_phy_reg()
2962 ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, in e1000_write_phy_reg()
2970 ret_val = e1000_write_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, in e1000_write_phy_reg()
2977 static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, in e1000_write_phy_reg_ex() argument
2982 const u32 phy_addr = (hw->mac_type == e1000_ce4100) ? hw->phy_addr : 1; in e1000_write_phy_reg_ex()
2989 if (hw->mac_type > e1000_82543) { in e1000_write_phy_reg_ex()
2995 if (hw->mac_type == e1000_ce4100) { in e1000_write_phy_reg_ex()
3045 e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); in e1000_write_phy_reg_ex()
3058 e1000_shift_out_mdi_bits(hw, mdic, 32); in e1000_write_phy_reg_ex()
3070 s32 e1000_phy_hw_reset(struct e1000_hw *hw) in e1000_phy_hw_reset() argument
3077 if (hw->mac_type > e1000_82543) { in e1000_phy_hw_reset()
3109 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { in e1000_phy_hw_reset()
3118 return e1000_get_phy_cfg_done(hw); in e1000_phy_hw_reset()
3128 s32 e1000_phy_reset(struct e1000_hw *hw) in e1000_phy_reset() argument
3133 switch (hw->phy_type) { in e1000_phy_reset()
3135 ret_val = e1000_phy_hw_reset(hw); in e1000_phy_reset()
3140 ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); in e1000_phy_reset()
3145 ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); in e1000_phy_reset()
3153 if (hw->phy_type == e1000_phy_igp) in e1000_phy_reset()
3154 e1000_phy_init_script(hw); in e1000_phy_reset()
3165 static s32 e1000_detect_gig_phy(struct e1000_hw *hw) in e1000_detect_gig_phy() argument
3171 if (hw->phy_id != 0) in e1000_detect_gig_phy()
3175 ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); in e1000_detect_gig_phy()
3179 hw->phy_id = (u32) (phy_id_high << 16); in e1000_detect_gig_phy()
3181 ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low); in e1000_detect_gig_phy()
3185 hw->phy_id |= (u32) (phy_id_low & PHY_REVISION_MASK); in e1000_detect_gig_phy()
3186 hw->phy_revision = (u32) phy_id_low & ~PHY_REVISION_MASK; in e1000_detect_gig_phy()
3188 switch (hw->mac_type) { in e1000_detect_gig_phy()
3190 if (hw->phy_id == M88E1000_E_PHY_ID) in e1000_detect_gig_phy()
3194 if (hw->phy_id == M88E1000_I_PHY_ID) in e1000_detect_gig_phy()
3202 if (hw->phy_id == M88E1011_I_PHY_ID) in e1000_detect_gig_phy()
3206 if ((hw->phy_id == RTL8211B_PHY_ID) || in e1000_detect_gig_phy()
3207 (hw->phy_id == RTL8201N_PHY_ID) || in e1000_detect_gig_phy()
3208 (hw->phy_id == M88E1118_E_PHY_ID)) in e1000_detect_gig_phy()
3215 if (hw->phy_id == IGP01E1000_I_PHY_ID) in e1000_detect_gig_phy()
3219 e_dbg("Invalid MAC type %d\n", hw->mac_type); in e1000_detect_gig_phy()
3222 phy_init_status = e1000_set_phy_type(hw); in e1000_detect_gig_phy()
3225 e_dbg("PHY ID 0x%X detected\n", hw->phy_id); in e1000_detect_gig_phy()
3228 e_dbg("Invalid PHY ID 0x%X\n", hw->phy_id); in e1000_detect_gig_phy()
3238 static s32 e1000_phy_reset_dsp(struct e1000_hw *hw) in e1000_phy_reset_dsp() argument
3243 ret_val = e1000_write_phy_reg(hw, 29, 0x001d); in e1000_phy_reset_dsp()
3246 ret_val = e1000_write_phy_reg(hw, 30, 0x00c1); in e1000_phy_reset_dsp()
3249 ret_val = e1000_write_phy_reg(hw, 30, 0x0000); in e1000_phy_reset_dsp()
3265 static s32 e1000_phy_igp_get_info(struct e1000_hw *hw, in e1000_phy_igp_get_info() argument
3275 phy_info->downshift = (e1000_downshift) hw->speed_downgraded; in e1000_phy_igp_get_info()
3284 ret_val = e1000_check_polarity(hw, &polarity); in e1000_phy_igp_get_info()
3290 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data); in e1000_phy_igp_get_info()
3303 ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); in e1000_phy_igp_get_info()
3315 ret_val = e1000_get_cable_length(hw, &min_length, &max_length); in e1000_phy_igp_get_info()
3344 static s32 e1000_phy_m88_get_info(struct e1000_hw *hw, in e1000_phy_m88_get_info() argument
3354 phy_info->downshift = (e1000_downshift) hw->speed_downgraded; in e1000_phy_m88_get_info()
3356 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_phy_m88_get_info()
3372 ret_val = e1000_check_polarity(hw, &polarity); in e1000_phy_m88_get_info()
3377 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); in e1000_phy_m88_get_info()
3394 ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); in e1000_phy_m88_get_info()
3417 s32 e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info) in e1000_phy_get_info() argument
3431 if (hw->media_type != e1000_media_type_copper) { in e1000_phy_get_info()
3436 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_phy_get_info()
3440 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_phy_get_info()
3449 if (hw->phy_type == e1000_phy_igp) in e1000_phy_get_info()
3450 return e1000_phy_igp_get_info(hw, phy_info); in e1000_phy_get_info()
3451 else if ((hw->phy_type == e1000_phy_8211) || in e1000_phy_get_info()
3452 (hw->phy_type == e1000_phy_8201)) in e1000_phy_get_info()
3455 return e1000_phy_m88_get_info(hw, phy_info); in e1000_phy_get_info()
3458 s32 e1000_validate_mdi_setting(struct e1000_hw *hw) in e1000_validate_mdi_setting() argument
3460 if (!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) { in e1000_validate_mdi_setting()
3462 hw->mdix = 1; in e1000_validate_mdi_setting()
3475 s32 e1000_init_eeprom_params(struct e1000_hw *hw) in e1000_init_eeprom_params() argument
3477 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_init_eeprom_params()
3482 switch (hw->mac_type) { in e1000_init_eeprom_params()
3547 ret_val = e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size); in e1000_init_eeprom_params()
3569 static void e1000_raise_ee_clk(struct e1000_hw *hw, u32 *eecd) in e1000_raise_ee_clk() argument
3577 udelay(hw->eeprom.delay_usec); in e1000_raise_ee_clk()
3585 static void e1000_lower_ee_clk(struct e1000_hw *hw, u32 *eecd) in e1000_lower_ee_clk() argument
3593 udelay(hw->eeprom.delay_usec); in e1000_lower_ee_clk()
3602 static void e1000_shift_out_ee_bits(struct e1000_hw *hw, u16 data, u16 count) in e1000_shift_out_ee_bits() argument
3604 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_shift_out_ee_bits()
3636 e1000_raise_ee_clk(hw, &eecd); in e1000_shift_out_ee_bits()
3637 e1000_lower_ee_clk(hw, &eecd); in e1000_shift_out_ee_bits()
3653 static u16 e1000_shift_in_ee_bits(struct e1000_hw *hw, u16 count) in e1000_shift_in_ee_bits() argument
3673 e1000_raise_ee_clk(hw, &eecd); in e1000_shift_in_ee_bits()
3681 e1000_lower_ee_clk(hw, &eecd); in e1000_shift_in_ee_bits()
3694 static s32 e1000_acquire_eeprom(struct e1000_hw *hw) in e1000_acquire_eeprom() argument
3696 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_acquire_eeprom()
3702 if (hw->mac_type > e1000_82544) { in e1000_acquire_eeprom()
3745 static void e1000_standby_eeprom(struct e1000_hw *hw) in e1000_standby_eeprom() argument
3747 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_standby_eeprom()
3794 static void e1000_release_eeprom(struct e1000_hw *hw) in e1000_release_eeprom() argument
3800 if (hw->eeprom.type == e1000_eeprom_spi) { in e1000_release_eeprom()
3807 udelay(hw->eeprom.delay_usec); in e1000_release_eeprom()
3808 } else if (hw->eeprom.type == e1000_eeprom_microwire) { in e1000_release_eeprom()
3820 udelay(hw->eeprom.delay_usec); in e1000_release_eeprom()
3826 udelay(hw->eeprom.delay_usec); in e1000_release_eeprom()
3830 if (hw->mac_type > e1000_82544) { in e1000_release_eeprom()
3840 static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw) in e1000_spi_eeprom_ready() argument
3852 e1000_shift_out_ee_bits(hw, EEPROM_RDSR_OPCODE_SPI, in e1000_spi_eeprom_ready()
3853 hw->eeprom.opcode_bits); in e1000_spi_eeprom_ready()
3854 spi_stat_reg = (u8) e1000_shift_in_ee_bits(hw, 8); in e1000_spi_eeprom_ready()
3861 e1000_standby_eeprom(hw); in e1000_spi_eeprom_ready()
3882 s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) in e1000_read_eeprom() argument
3886 ret = e1000_do_read_eeprom(hw, offset, words, data); in e1000_read_eeprom()
3891 static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, in e1000_do_read_eeprom() argument
3894 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_do_read_eeprom()
3897 if (hw->mac_type == e1000_ce4100) { in e1000_do_read_eeprom()
3918 if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) in e1000_do_read_eeprom()
3928 if (e1000_spi_eeprom_ready(hw)) { in e1000_do_read_eeprom()
3929 e1000_release_eeprom(hw); in e1000_do_read_eeprom()
3933 e1000_standby_eeprom(hw); in e1000_do_read_eeprom()
3942 e1000_shift_out_ee_bits(hw, read_opcode, eeprom->opcode_bits); in e1000_do_read_eeprom()
3943 e1000_shift_out_ee_bits(hw, (u16) (offset * 2), in e1000_do_read_eeprom()
3954 word_in = e1000_shift_in_ee_bits(hw, 16); in e1000_do_read_eeprom()
3960 e1000_shift_out_ee_bits(hw, in e1000_do_read_eeprom()
3963 e1000_shift_out_ee_bits(hw, (u16) (offset + i), in e1000_do_read_eeprom()
3969 data[i] = e1000_shift_in_ee_bits(hw, 16); in e1000_do_read_eeprom()
3970 e1000_standby_eeprom(hw); in e1000_do_read_eeprom()
3975 e1000_release_eeprom(hw); in e1000_do_read_eeprom()
3988 s32 e1000_validate_eeprom_checksum(struct e1000_hw *hw) in e1000_validate_eeprom_checksum() argument
3994 if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { in e1000_validate_eeprom_checksum()
4003 if ((hw->subsystem_vendor_id == 0x103C) && (eeprom_data == 0x16d6)) in e1000_validate_eeprom_checksum()
4022 s32 e1000_update_eeprom_checksum(struct e1000_hw *hw) in e1000_update_eeprom_checksum() argument
4028 if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { in e1000_update_eeprom_checksum()
4035 if (e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) { in e1000_update_eeprom_checksum()
4052 s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) in e1000_write_eeprom() argument
4056 ret = e1000_do_write_eeprom(hw, offset, words, data); in e1000_write_eeprom()
4061 static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, in e1000_do_write_eeprom() argument
4064 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_do_write_eeprom()
4067 if (hw->mac_type == e1000_ce4100) { in e1000_do_write_eeprom()
4083 if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) in e1000_do_write_eeprom()
4087 status = e1000_write_eeprom_microwire(hw, offset, words, data); in e1000_do_write_eeprom()
4089 status = e1000_write_eeprom_spi(hw, offset, words, data); in e1000_do_write_eeprom()
4094 e1000_release_eeprom(hw); in e1000_do_write_eeprom()
4106 static s32 e1000_write_eeprom_spi(struct e1000_hw *hw, u16 offset, u16 words, in e1000_write_eeprom_spi() argument
4109 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_write_eeprom_spi()
4115 if (e1000_spi_eeprom_ready(hw)) in e1000_write_eeprom_spi()
4118 e1000_standby_eeprom(hw); in e1000_write_eeprom_spi()
4121 e1000_shift_out_ee_bits(hw, EEPROM_WREN_OPCODE_SPI, in e1000_write_eeprom_spi()
4124 e1000_standby_eeprom(hw); in e1000_write_eeprom_spi()
4133 e1000_shift_out_ee_bits(hw, write_opcode, eeprom->opcode_bits); in e1000_write_eeprom_spi()
4135 e1000_shift_out_ee_bits(hw, (u16) ((offset + widx) * 2), in e1000_write_eeprom_spi()
4146 e1000_shift_out_ee_bits(hw, word_out, 16); in e1000_write_eeprom_spi()
4155 e1000_standby_eeprom(hw); in e1000_write_eeprom_spi()
4171 static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset, in e1000_write_eeprom_microwire() argument
4174 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_write_eeprom_microwire()
4185 e1000_shift_out_ee_bits(hw, EEPROM_EWEN_OPCODE_MICROWIRE, in e1000_write_eeprom_microwire()
4188 e1000_shift_out_ee_bits(hw, 0, (u16) (eeprom->address_bits - 2)); in e1000_write_eeprom_microwire()
4191 e1000_standby_eeprom(hw); in e1000_write_eeprom_microwire()
4195 e1000_shift_out_ee_bits(hw, EEPROM_WRITE_OPCODE_MICROWIRE, in e1000_write_eeprom_microwire()
4198 e1000_shift_out_ee_bits(hw, (u16) (offset + words_written), in e1000_write_eeprom_microwire()
4202 e1000_shift_out_ee_bits(hw, data[words_written], 16); in e1000_write_eeprom_microwire()
4207 e1000_standby_eeprom(hw); in e1000_write_eeprom_microwire()
4226 e1000_standby_eeprom(hw); in e1000_write_eeprom_microwire()
4237 e1000_shift_out_ee_bits(hw, EEPROM_EWDS_OPCODE_MICROWIRE, in e1000_write_eeprom_microwire()
4240 e1000_shift_out_ee_bits(hw, 0, (u16) (eeprom->address_bits - 2)); in e1000_write_eeprom_microwire()
4252 s32 e1000_read_mac_addr(struct e1000_hw *hw) in e1000_read_mac_addr() argument
4259 if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { in e1000_read_mac_addr()
4263 hw->perm_mac_addr[i] = (u8) (eeprom_data & 0x00FF); in e1000_read_mac_addr()
4264 hw->perm_mac_addr[i + 1] = (u8) (eeprom_data >> 8); in e1000_read_mac_addr()
4267 switch (hw->mac_type) { in e1000_read_mac_addr()
4273 hw->perm_mac_addr[5] ^= 0x01; in e1000_read_mac_addr()
4278 hw->mac_addr[i] = hw->perm_mac_addr[i]; in e1000_read_mac_addr()
4290 static void e1000_init_rx_addrs(struct e1000_hw *hw) in e1000_init_rx_addrs() argument
4298 e1000_rar_set(hw, hw->mac_addr, 0); in e1000_init_rx_addrs()
4305 E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); in e1000_init_rx_addrs()
4307 E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); in e1000_init_rx_addrs()
4317 u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) in e1000_hash_mc_addr() argument
4324 switch (hw->mc_filter_type) { in e1000_hash_mc_addr()
4357 void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) in e1000_rar_set() argument
4386 switch (hw->mac_type) { in e1000_rar_set()
4393 E1000_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); in e1000_rar_set()
4395 E1000_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high); in e1000_rar_set()
4405 void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) in e1000_write_vfta() argument
4409 if ((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) { in e1000_write_vfta()
4410 temp = E1000_READ_REG_ARRAY(hw, VFTA, (offset - 1)); in e1000_write_vfta()
4411 E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); in e1000_write_vfta()
4413 E1000_WRITE_REG_ARRAY(hw, VFTA, (offset - 1), temp); in e1000_write_vfta()
4416 E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); in e1000_write_vfta()
4425 static void e1000_clear_vfta(struct e1000_hw *hw) in e1000_clear_vfta() argument
4438 E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value); in e1000_clear_vfta()
4443 static s32 e1000_id_led_init(struct e1000_hw *hw) in e1000_id_led_init() argument
4452 if (hw->mac_type < e1000_82540) { in e1000_id_led_init()
4458 hw->ledctl_default = ledctl; in e1000_id_led_init()
4459 hw->ledctl_mode1 = hw->ledctl_default; in e1000_id_led_init()
4460 hw->ledctl_mode2 = hw->ledctl_default; in e1000_id_led_init()
4462 if (e1000_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) { in e1000_id_led_init()
4478 hw->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init()
4479 hw->ledctl_mode1 |= ledctl_on << (i << 3); in e1000_id_led_init()
4484 hw->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init()
4485 hw->ledctl_mode1 |= ledctl_off << (i << 3); in e1000_id_led_init()
4495 hw->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init()
4496 hw->ledctl_mode2 |= ledctl_on << (i << 3); in e1000_id_led_init()
4501 hw->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init()
4502 hw->ledctl_mode2 |= ledctl_off << (i << 3); in e1000_id_led_init()
4518 s32 e1000_setup_led(struct e1000_hw *hw) in e1000_setup_led() argument
4523 switch (hw->mac_type) { in e1000_setup_led()
4535 ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_setup_led()
4536 &hw->phy_spd_default); in e1000_setup_led()
4539 ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_setup_led()
4540 (u16) (hw->phy_spd_default & in e1000_setup_led()
4546 if (hw->media_type == e1000_media_type_fiber) { in e1000_setup_led()
4549 hw->ledctl_default = ledctl; in e1000_setup_led()
4557 } else if (hw->media_type == e1000_media_type_copper) in e1000_setup_led()
4558 ew32(LEDCTL, hw->ledctl_mode1); in e1000_setup_led()
4569 s32 e1000_cleanup_led(struct e1000_hw *hw) in e1000_cleanup_led() argument
4573 switch (hw->mac_type) { in e1000_cleanup_led()
4585 ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_cleanup_led()
4586 hw->phy_spd_default); in e1000_cleanup_led()
4592 ew32(LEDCTL, hw->ledctl_default); in e1000_cleanup_led()
4603 s32 e1000_led_on(struct e1000_hw *hw) in e1000_led_on() argument
4607 switch (hw->mac_type) { in e1000_led_on()
4616 if (hw->media_type == e1000_media_type_fiber) { in e1000_led_on()
4627 if (hw->media_type == e1000_media_type_fiber) { in e1000_led_on()
4631 } else if (hw->media_type == e1000_media_type_copper) { in e1000_led_on()
4632 ew32(LEDCTL, hw->ledctl_mode2); in e1000_led_on()
4647 s32 e1000_led_off(struct e1000_hw *hw) in e1000_led_off() argument
4651 switch (hw->mac_type) { in e1000_led_off()
4660 if (hw->media_type == e1000_media_type_fiber) { in e1000_led_off()
4671 if (hw->media_type == e1000_media_type_fiber) { in e1000_led_off()
4675 } else if (hw->media_type == e1000_media_type_copper) { in e1000_led_off()
4676 ew32(LEDCTL, hw->ledctl_mode1); in e1000_led_off()
4691 static void e1000_clear_hw_cntrs(struct e1000_hw *hw) in e1000_clear_hw_cntrs() argument
4749 if (hw->mac_type < e1000_82543) in e1000_clear_hw_cntrs()
4759 if (hw->mac_type <= e1000_82544) in e1000_clear_hw_cntrs()
4776 void e1000_reset_adaptive(struct e1000_hw *hw) in e1000_reset_adaptive() argument
4778 if (hw->adaptive_ifs) { in e1000_reset_adaptive()
4779 if (!hw->ifs_params_forced) { in e1000_reset_adaptive()
4780 hw->current_ifs_val = 0; in e1000_reset_adaptive()
4781 hw->ifs_min_val = IFS_MIN; in e1000_reset_adaptive()
4782 hw->ifs_max_val = IFS_MAX; in e1000_reset_adaptive()
4783 hw->ifs_step_size = IFS_STEP; in e1000_reset_adaptive()
4784 hw->ifs_ratio = IFS_RATIO; in e1000_reset_adaptive()
4786 hw->in_ifs_mode = false; in e1000_reset_adaptive()
4802 void e1000_update_adaptive(struct e1000_hw *hw) in e1000_update_adaptive() argument
4804 if (hw->adaptive_ifs) { in e1000_update_adaptive()
4805 if ((hw->collision_delta *hw->ifs_ratio) > hw->tx_packet_delta) { in e1000_update_adaptive()
4806 if (hw->tx_packet_delta > MIN_NUM_XMITS) { in e1000_update_adaptive()
4807 hw->in_ifs_mode = true; in e1000_update_adaptive()
4808 if (hw->current_ifs_val < hw->ifs_max_val) { in e1000_update_adaptive()
4809 if (hw->current_ifs_val == 0) in e1000_update_adaptive()
4810 hw->current_ifs_val = in e1000_update_adaptive()
4811 hw->ifs_min_val; in e1000_update_adaptive()
4813 hw->current_ifs_val += in e1000_update_adaptive()
4814 hw->ifs_step_size; in e1000_update_adaptive()
4815 ew32(AIT, hw->current_ifs_val); in e1000_update_adaptive()
4819 if (hw->in_ifs_mode in e1000_update_adaptive()
4820 && (hw->tx_packet_delta <= MIN_NUM_XMITS)) { in e1000_update_adaptive()
4821 hw->current_ifs_val = 0; in e1000_update_adaptive()
4822 hw->in_ifs_mode = false; in e1000_update_adaptive()
4837 void e1000_get_bus_info(struct e1000_hw *hw) in e1000_get_bus_info() argument
4841 switch (hw->mac_type) { in e1000_get_bus_info()
4844 hw->bus_type = e1000_bus_type_pci; in e1000_get_bus_info()
4845 hw->bus_speed = e1000_bus_speed_unknown; in e1000_get_bus_info()
4846 hw->bus_width = e1000_bus_width_unknown; in e1000_get_bus_info()
4850 hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ? in e1000_get_bus_info()
4853 if (hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) { in e1000_get_bus_info()
4854 hw->bus_speed = (hw->bus_type == e1000_bus_type_pci) ? in e1000_get_bus_info()
4856 } else if (hw->bus_type == e1000_bus_type_pci) { in e1000_get_bus_info()
4857 hw->bus_speed = (status & E1000_STATUS_PCI66) ? in e1000_get_bus_info()
4862 hw->bus_speed = e1000_bus_speed_66; in e1000_get_bus_info()
4865 hw->bus_speed = e1000_bus_speed_100; in e1000_get_bus_info()
4868 hw->bus_speed = e1000_bus_speed_133; in e1000_get_bus_info()
4871 hw->bus_speed = e1000_bus_speed_reserved; in e1000_get_bus_info()
4875 hw->bus_width = (status & E1000_STATUS_BUS64) ? in e1000_get_bus_info()
4890 static void e1000_write_reg_io(struct e1000_hw *hw, u32 offset, u32 value) in e1000_write_reg_io() argument
4892 unsigned long io_addr = hw->io_base; in e1000_write_reg_io()
4893 unsigned long io_data = hw->io_base + 4; in e1000_write_reg_io()
4895 e1000_io_write(hw, io_addr, offset); in e1000_write_reg_io()
4896 e1000_io_write(hw, io_data, value); in e1000_write_reg_io()
4913 static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length, in e1000_get_cable_length() argument
4924 if (hw->phy_type == e1000_phy_m88) { in e1000_get_cable_length()
4926 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, in e1000_get_cable_length()
4958 } else if (hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ in e1000_get_cable_length()
4971 e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data); in e1000_get_cable_length()
5029 static s32 e1000_check_polarity(struct e1000_hw *hw, in e1000_check_polarity() argument
5035 if (hw->phy_type == e1000_phy_m88) { in e1000_check_polarity()
5037 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, in e1000_check_polarity()
5045 } else if (hw->phy_type == e1000_phy_igp) { in e1000_check_polarity()
5047 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, in e1000_check_polarity()
5060 e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG, in e1000_check_polarity()
5096 static s32 e1000_check_downshift(struct e1000_hw *hw) in e1000_check_downshift() argument
5101 if (hw->phy_type == e1000_phy_igp) { in e1000_check_downshift()
5102 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, in e1000_check_downshift()
5107 hw->speed_downgraded = in e1000_check_downshift()
5109 } else if (hw->phy_type == e1000_phy_m88) { in e1000_check_downshift()
5110 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, in e1000_check_downshift()
5115 hw->speed_downgraded = (phy_data & M88E1000_PSSR_DOWNSHIFT) >> in e1000_check_downshift()
5129 static s32 e1000_1000Mb_check_cable_length(struct e1000_hw *hw) in e1000_1000Mb_check_cable_length() argument
5135 ret_val = e1000_get_cable_length(hw, &min_length, &max_length); in e1000_1000Mb_check_cable_length()
5139 if (hw->dsp_config_state != e1000_dsp_config_enabled) in e1000_1000Mb_check_cable_length()
5144 ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], in e1000_1000Mb_check_cable_length()
5151 ret_val = e1000_write_phy_reg(hw, dsp_reg_array[i], in e1000_1000Mb_check_cable_length()
5156 hw->dsp_config_state = e1000_dsp_config_activated; in e1000_1000Mb_check_cable_length()
5162 ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); in e1000_1000Mb_check_cable_length()
5168 ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, in e1000_1000Mb_check_cable_length()
5175 hw->ffe_config_state = e1000_ffe_config_active; in e1000_1000Mb_check_cable_length()
5177 ret_val = e1000_write_phy_reg(hw, in e1000_1000Mb_check_cable_length()
5206 static s32 e1000_config_dsp_after_link_change(struct e1000_hw *hw, bool link_up) in e1000_config_dsp_after_link_change() argument
5211 if (hw->phy_type != e1000_phy_igp) in e1000_config_dsp_after_link_change()
5215 ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); in e1000_config_dsp_after_link_change()
5222 ret_val = e1000_1000Mb_check_cable_length(hw); in e1000_config_dsp_after_link_change()
5227 if (hw->dsp_config_state == e1000_dsp_config_activated) { in e1000_config_dsp_after_link_change()
5232 e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); in e1000_config_dsp_after_link_change()
5238 ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); in e1000_config_dsp_after_link_change()
5245 ret_val = e1000_write_phy_reg(hw, 0x0000, in e1000_config_dsp_after_link_change()
5251 e1000_read_phy_reg(hw, dsp_reg_array[i], in e1000_config_dsp_after_link_change()
5260 e1000_write_phy_reg(hw, dsp_reg_array[i], in e1000_config_dsp_after_link_change()
5266 ret_val = e1000_write_phy_reg(hw, 0x0000, in e1000_config_dsp_after_link_change()
5275 e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); in e1000_config_dsp_after_link_change()
5280 hw->dsp_config_state = e1000_dsp_config_enabled; in e1000_config_dsp_after_link_change()
5283 if (hw->ffe_config_state == e1000_ffe_config_active) { in e1000_config_dsp_after_link_change()
5288 e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); in e1000_config_dsp_after_link_change()
5294 ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); in e1000_config_dsp_after_link_change()
5301 ret_val = e1000_write_phy_reg(hw, 0x0000, in e1000_config_dsp_after_link_change()
5306 e1000_write_phy_reg(hw, IGP01E1000_PHY_DSP_FFE, in e1000_config_dsp_after_link_change()
5311 ret_val = e1000_write_phy_reg(hw, 0x0000, in e1000_config_dsp_after_link_change()
5320 e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); in e1000_config_dsp_after_link_change()
5325 hw->ffe_config_state = e1000_ffe_config_enabled; in e1000_config_dsp_after_link_change()
5339 static s32 e1000_set_phy_mode(struct e1000_hw *hw) in e1000_set_phy_mode() argument
5344 if ((hw->mac_type == e1000_82545_rev_3) && in e1000_set_phy_mode()
5345 (hw->media_type == e1000_media_type_copper)) { in e1000_set_phy_mode()
5347 e1000_read_eeprom(hw, EEPROM_PHY_CLASS_WORD, 1, in e1000_set_phy_mode()
5356 e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, in e1000_set_phy_mode()
5361 e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, in e1000_set_phy_mode()
5366 hw->phy_reset_disable = false; in e1000_set_phy_mode()
5386 static s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active) in e1000_set_d3_lplu_state() argument
5391 if (hw->phy_type != e1000_phy_igp) in e1000_set_d3_lplu_state()
5398 if (hw->mac_type == e1000_82541_rev_2 in e1000_set_d3_lplu_state()
5399 || hw->mac_type == e1000_82547_rev_2) { in e1000_set_d3_lplu_state()
5401 e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, &phy_data); in e1000_set_d3_lplu_state()
5407 if (hw->mac_type == e1000_82541_rev_2 || in e1000_set_d3_lplu_state()
5408 hw->mac_type == e1000_82547_rev_2) { in e1000_set_d3_lplu_state()
5411 e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_set_d3_lplu_state()
5422 if (hw->smart_speed == e1000_smart_speed_on) { in e1000_set_d3_lplu_state()
5424 e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5431 e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5435 } else if (hw->smart_speed == e1000_smart_speed_off) { in e1000_set_d3_lplu_state()
5437 e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5444 e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5449 } else if ((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) in e1000_set_d3_lplu_state()
5450 || (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL) in e1000_set_d3_lplu_state()
5451 || (hw->autoneg_advertised == in e1000_set_d3_lplu_state()
5454 if (hw->mac_type == e1000_82541_rev_2 || in e1000_set_d3_lplu_state()
5455 hw->mac_type == e1000_82547_rev_2) { in e1000_set_d3_lplu_state()
5458 e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_set_d3_lplu_state()
5466 e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5473 e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5488 static s32 e1000_set_vco_speed(struct e1000_hw *hw) in e1000_set_vco_speed() argument
5494 switch (hw->mac_type) { in e1000_set_vco_speed()
5505 e1000_read_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, &default_page); in e1000_set_vco_speed()
5509 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005); in e1000_set_vco_speed()
5513 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); in e1000_set_vco_speed()
5518 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); in e1000_set_vco_speed()
5524 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004); in e1000_set_vco_speed()
5528 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); in e1000_set_vco_speed()
5533 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); in e1000_set_vco_speed()
5538 e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, default_page); in e1000_set_vco_speed()
5553 u32 e1000_enable_mng_pass_thru(struct e1000_hw *hw) in e1000_enable_mng_pass_thru() argument
5557 if (hw->asf_firmware_present) { in e1000_enable_mng_pass_thru()
5569 static s32 e1000_polarity_reversal_workaround(struct e1000_hw *hw) in e1000_polarity_reversal_workaround() argument
5579 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); in e1000_polarity_reversal_workaround()
5582 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFFF); in e1000_polarity_reversal_workaround()
5586 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); in e1000_polarity_reversal_workaround()
5596 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_polarity_reversal_workaround()
5600 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_polarity_reversal_workaround()
5614 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); in e1000_polarity_reversal_workaround()
5618 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFF0); in e1000_polarity_reversal_workaround()
5622 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFF00); in e1000_polarity_reversal_workaround()
5626 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x0000); in e1000_polarity_reversal_workaround()
5630 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); in e1000_polarity_reversal_workaround()
5640 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_polarity_reversal_workaround()
5644 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_polarity_reversal_workaround()
5663 static s32 e1000_get_auto_rd_done(struct e1000_hw *hw) in e1000_get_auto_rd_done() argument
5677 static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw) in e1000_get_phy_cfg_done() argument