Lines Matching refs:hw
11 static s32 e1000_check_downshift(struct e1000_hw *hw);
12 static s32 e1000_check_polarity(struct e1000_hw *hw,
14 static void e1000_clear_hw_cntrs(struct e1000_hw *hw);
15 static void e1000_clear_vfta(struct e1000_hw *hw);
16 static s32 e1000_config_dsp_after_link_change(struct e1000_hw *hw,
18 static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw);
19 static s32 e1000_detect_gig_phy(struct e1000_hw *hw);
20 static s32 e1000_get_auto_rd_done(struct e1000_hw *hw);
21 static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length,
23 static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw);
24 static s32 e1000_id_led_init(struct e1000_hw *hw);
25 static void e1000_init_rx_addrs(struct e1000_hw *hw);
26 static s32 e1000_phy_igp_get_info(struct e1000_hw *hw,
28 static s32 e1000_phy_m88_get_info(struct e1000_hw *hw,
30 static s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
31 static s32 e1000_wait_autoneg(struct e1000_hw *hw);
32 static void e1000_write_reg_io(struct e1000_hw *hw, u32 offset, u32 value);
33 static s32 e1000_set_phy_type(struct e1000_hw *hw);
34 static void e1000_phy_init_script(struct e1000_hw *hw);
35 static s32 e1000_setup_copper_link(struct e1000_hw *hw);
36 static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw);
37 static s32 e1000_adjust_serdes_amplitude(struct e1000_hw *hw);
38 static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw);
39 static s32 e1000_config_mac_to_phy(struct e1000_hw *hw);
40 static void e1000_raise_mdi_clk(struct e1000_hw *hw, u32 *ctrl);
41 static void e1000_lower_mdi_clk(struct e1000_hw *hw, u32 *ctrl);
42 static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, u32 data, u16 count);
43 static u16 e1000_shift_in_mdi_bits(struct e1000_hw *hw);
44 static s32 e1000_phy_reset_dsp(struct e1000_hw *hw);
45 static s32 e1000_write_eeprom_spi(struct e1000_hw *hw, u16 offset,
47 static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset,
49 static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw);
50 static void e1000_raise_ee_clk(struct e1000_hw *hw, u32 *eecd);
51 static void e1000_lower_ee_clk(struct e1000_hw *hw, u32 *eecd);
52 static void e1000_shift_out_ee_bits(struct e1000_hw *hw, u16 data, u16 count);
53 static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr,
55 static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr,
57 static u16 e1000_shift_in_ee_bits(struct e1000_hw *hw, u16 count);
58 static s32 e1000_acquire_eeprom(struct e1000_hw *hw);
59 static void e1000_release_eeprom(struct e1000_hw *hw);
60 static void e1000_standby_eeprom(struct e1000_hw *hw);
61 static s32 e1000_set_vco_speed(struct e1000_hw *hw);
62 static s32 e1000_polarity_reversal_workaround(struct e1000_hw *hw);
63 static s32 e1000_set_phy_mode(struct e1000_hw *hw);
64 static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words,
66 static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words,
92 static s32 e1000_set_phy_type(struct e1000_hw *hw) in e1000_set_phy_type() argument
94 if (hw->mac_type == e1000_undefined) in e1000_set_phy_type()
97 switch (hw->phy_id) { in e1000_set_phy_type()
103 hw->phy_type = e1000_phy_m88; in e1000_set_phy_type()
106 if (hw->mac_type == e1000_82541 || in e1000_set_phy_type()
107 hw->mac_type == e1000_82541_rev_2 || in e1000_set_phy_type()
108 hw->mac_type == e1000_82547 || in e1000_set_phy_type()
109 hw->mac_type == e1000_82547_rev_2) in e1000_set_phy_type()
110 hw->phy_type = e1000_phy_igp; in e1000_set_phy_type()
113 hw->phy_type = e1000_phy_8211; in e1000_set_phy_type()
116 hw->phy_type = e1000_phy_8201; in e1000_set_phy_type()
120 hw->phy_type = e1000_phy_undefined; in e1000_set_phy_type()
131 static void e1000_phy_init_script(struct e1000_hw *hw) in e1000_phy_init_script() argument
135 if (hw->phy_init_script) { in e1000_phy_init_script()
141 e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); in e1000_phy_init_script()
144 e1000_write_phy_reg(hw, 0x2F5B, 0x0003); in e1000_phy_init_script()
147 e1000_write_phy_reg(hw, 0x0000, 0x0140); in e1000_phy_init_script()
150 switch (hw->mac_type) { in e1000_phy_init_script()
153 e1000_write_phy_reg(hw, 0x1F95, 0x0001); in e1000_phy_init_script()
154 e1000_write_phy_reg(hw, 0x1F71, 0xBD21); in e1000_phy_init_script()
155 e1000_write_phy_reg(hw, 0x1F79, 0x0018); in e1000_phy_init_script()
156 e1000_write_phy_reg(hw, 0x1F30, 0x1600); in e1000_phy_init_script()
157 e1000_write_phy_reg(hw, 0x1F31, 0x0014); in e1000_phy_init_script()
158 e1000_write_phy_reg(hw, 0x1F32, 0x161C); in e1000_phy_init_script()
159 e1000_write_phy_reg(hw, 0x1F94, 0x0003); in e1000_phy_init_script()
160 e1000_write_phy_reg(hw, 0x1F96, 0x003F); in e1000_phy_init_script()
161 e1000_write_phy_reg(hw, 0x2010, 0x0008); in e1000_phy_init_script()
166 e1000_write_phy_reg(hw, 0x1F73, 0x0099); in e1000_phy_init_script()
172 e1000_write_phy_reg(hw, 0x0000, 0x3300); in e1000_phy_init_script()
176 e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); in e1000_phy_init_script()
178 if (hw->mac_type == e1000_82547) { in e1000_phy_init_script()
182 e1000_read_phy_reg(hw, in e1000_phy_init_script()
187 e1000_read_phy_reg(hw, in e1000_phy_init_script()
210 e1000_write_phy_reg(hw, in e1000_phy_init_script()
213 e1000_write_phy_reg(hw, in e1000_phy_init_script()
225 s32 e1000_set_mac_type(struct e1000_hw *hw) in e1000_set_mac_type() argument
227 switch (hw->device_id) { in e1000_set_mac_type()
229 switch (hw->revision_id) { in e1000_set_mac_type()
231 hw->mac_type = e1000_82542_rev2_0; in e1000_set_mac_type()
234 hw->mac_type = e1000_82542_rev2_1; in e1000_set_mac_type()
243 hw->mac_type = e1000_82543; in e1000_set_mac_type()
249 hw->mac_type = e1000_82544; in e1000_set_mac_type()
256 hw->mac_type = e1000_82540; in e1000_set_mac_type()
260 hw->mac_type = e1000_82545; in e1000_set_mac_type()
265 hw->mac_type = e1000_82545_rev_3; in e1000_set_mac_type()
270 hw->mac_type = e1000_82546; in e1000_set_mac_type()
278 hw->mac_type = e1000_82546_rev_3; in e1000_set_mac_type()
283 hw->mac_type = e1000_82541; in e1000_set_mac_type()
289 hw->mac_type = e1000_82541_rev_2; in e1000_set_mac_type()
293 hw->mac_type = e1000_82547; in e1000_set_mac_type()
296 hw->mac_type = e1000_82547_rev_2; in e1000_set_mac_type()
299 hw->mac_type = e1000_ce4100; in e1000_set_mac_type()
306 switch (hw->mac_type) { in e1000_set_mac_type()
311 hw->asf_firmware_present = true; in e1000_set_mac_type()
320 if (hw->mac_type == e1000_82543) in e1000_set_mac_type()
321 hw->bad_tx_carr_stats_fd = true; in e1000_set_mac_type()
323 if (hw->mac_type > e1000_82544) in e1000_set_mac_type()
324 hw->has_smbus = true; in e1000_set_mac_type()
333 void e1000_set_media_type(struct e1000_hw *hw) in e1000_set_media_type() argument
337 if (hw->mac_type != e1000_82543) { in e1000_set_media_type()
339 hw->tbi_compatibility_en = false; in e1000_set_media_type()
342 switch (hw->device_id) { in e1000_set_media_type()
345 hw->media_type = e1000_media_type_internal_serdes; in e1000_set_media_type()
348 switch (hw->mac_type) { in e1000_set_media_type()
351 hw->media_type = e1000_media_type_fiber; in e1000_set_media_type()
354 hw->media_type = e1000_media_type_copper; in e1000_set_media_type()
359 hw->media_type = e1000_media_type_fiber; in e1000_set_media_type()
361 hw->tbi_compatibility_en = false; in e1000_set_media_type()
363 hw->media_type = e1000_media_type_copper; in e1000_set_media_type()
376 s32 e1000_reset_hw(struct e1000_hw *hw) in e1000_reset_hw() argument
385 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_reset_hw()
387 e1000_pci_clear_mwi(hw); in e1000_reset_hw()
403 hw->tbi_compatibility_on = false; in e1000_reset_hw()
413 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { in e1000_reset_hw()
426 switch (hw->mac_type) { in e1000_reset_hw()
436 E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST)); in e1000_reset_hw()
453 switch (hw->mac_type) { in e1000_reset_hw()
476 ret_val = e1000_get_auto_rd_done(hw); in e1000_reset_hw()
483 if (hw->mac_type >= e1000_82540) { in e1000_reset_hw()
489 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { in e1000_reset_hw()
490 e1000_phy_init_script(hw); in e1000_reset_hw()
507 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_reset_hw()
508 if (hw->pci_cmd_word & PCI_COMMAND_INVALIDATE) in e1000_reset_hw()
509 e1000_pci_set_mwi(hw); in e1000_reset_hw()
525 s32 e1000_init_hw(struct e1000_hw *hw) in e1000_init_hw() argument
534 ret_val = e1000_id_led_init(hw); in e1000_init_hw()
541 e1000_set_media_type(hw); in e1000_init_hw()
545 if (hw->mac_type < e1000_82545_rev_3) in e1000_init_hw()
547 e1000_clear_vfta(hw); in e1000_init_hw()
550 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_init_hw()
552 e1000_pci_clear_mwi(hw); in e1000_init_hw()
561 e1000_init_rx_addrs(hw); in e1000_init_hw()
564 if (hw->mac_type == e1000_82542_rev2_0) { in e1000_init_hw()
568 if (hw->pci_cmd_word & PCI_COMMAND_INVALIDATE) in e1000_init_hw()
569 e1000_pci_set_mwi(hw); in e1000_init_hw()
576 E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); in e1000_init_hw()
588 if (hw->dma_fairness && hw->mac_type <= e1000_82543) { in e1000_init_hw()
593 switch (hw->mac_type) { in e1000_init_hw()
601 if (hw->bus_type == e1000_bus_type_pcix && in e1000_init_hw()
602 e1000_pcix_get_mmrbc(hw) > 2048) in e1000_init_hw()
603 e1000_pcix_set_mmrbc(hw, 2048); in e1000_init_hw()
608 ret_val = e1000_setup_link(hw); in e1000_init_hw()
611 if (hw->mac_type > e1000_82544) { in e1000_init_hw()
624 e1000_clear_hw_cntrs(hw); in e1000_init_hw()
626 if (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER || in e1000_init_hw()
627 hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3) { in e1000_init_hw()
643 static s32 e1000_adjust_serdes_amplitude(struct e1000_hw *hw) in e1000_adjust_serdes_amplitude() argument
648 if (hw->media_type != e1000_media_type_internal_serdes) in e1000_adjust_serdes_amplitude()
651 switch (hw->mac_type) { in e1000_adjust_serdes_amplitude()
659 ret_val = e1000_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1, in e1000_adjust_serdes_amplitude()
668 e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data); in e1000_adjust_serdes_amplitude()
686 s32 e1000_setup_link(struct e1000_hw *hw) in e1000_setup_link() argument
700 if (hw->fc == E1000_FC_DEFAULT) { in e1000_setup_link()
701 ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, in e1000_setup_link()
708 hw->fc = E1000_FC_NONE; in e1000_setup_link()
711 hw->fc = E1000_FC_TX_PAUSE; in e1000_setup_link()
713 hw->fc = E1000_FC_FULL; in e1000_setup_link()
720 if (hw->mac_type == e1000_82542_rev2_0) in e1000_setup_link()
721 hw->fc &= (~E1000_FC_TX_PAUSE); in e1000_setup_link()
723 if ((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1)) in e1000_setup_link()
724 hw->fc &= (~E1000_FC_RX_PAUSE); in e1000_setup_link()
726 hw->original_fc = hw->fc; in e1000_setup_link()
728 e_dbg("After fix-ups FlowControl is now = %x\n", hw->fc); in e1000_setup_link()
737 if (hw->mac_type == e1000_82543) { in e1000_setup_link()
738 ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, in e1000_setup_link()
750 ret_val = (hw->media_type == e1000_media_type_copper) ? in e1000_setup_link()
751 e1000_setup_copper_link(hw) : e1000_setup_fiber_serdes_link(hw); in e1000_setup_link()
764 ew32(FCTTV, hw->fc_pause_time); in e1000_setup_link()
772 if (!(hw->fc & E1000_FC_TX_PAUSE)) { in e1000_setup_link()
780 if (hw->fc_send_xon) { in e1000_setup_link()
781 ew32(FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE)); in e1000_setup_link()
782 ew32(FCRTH, hw->fc_high_water); in e1000_setup_link()
784 ew32(FCRTL, hw->fc_low_water); in e1000_setup_link()
785 ew32(FCRTH, hw->fc_high_water); in e1000_setup_link()
799 static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw) in e1000_setup_fiber_serdes_link() argument
815 if (hw->media_type == e1000_media_type_fiber) in e1000_setup_fiber_serdes_link()
816 signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; in e1000_setup_fiber_serdes_link()
818 ret_val = e1000_adjust_serdes_amplitude(hw); in e1000_setup_fiber_serdes_link()
826 ret_val = e1000_set_vco_speed(hw); in e1000_setup_fiber_serdes_link()
830 e1000_config_collision_dist(hw); in e1000_setup_fiber_serdes_link()
848 switch (hw->fc) { in e1000_setup_fiber_serdes_link()
892 hw->txcw = txcw; in e1000_setup_fiber_serdes_link()
902 if (hw->media_type == e1000_media_type_internal_serdes || in e1000_setup_fiber_serdes_link()
913 hw->autoneg_failed = 1; in e1000_setup_fiber_serdes_link()
919 ret_val = e1000_check_for_link(hw); in e1000_setup_fiber_serdes_link()
924 hw->autoneg_failed = 0; in e1000_setup_fiber_serdes_link()
926 hw->autoneg_failed = 0; in e1000_setup_fiber_serdes_link()
941 static s32 e1000_copper_link_rtl_setup(struct e1000_hw *hw) in e1000_copper_link_rtl_setup() argument
946 ret_val = e1000_phy_reset(hw); in e1000_copper_link_rtl_setup()
955 static s32 gbe_dhg_phy_setup(struct e1000_hw *hw) in gbe_dhg_phy_setup() argument
960 switch (hw->phy_type) { in gbe_dhg_phy_setup()
962 ret_val = e1000_copper_link_rtl_setup(hw); in gbe_dhg_phy_setup()
981 ret_val = e1000_copper_link_rtl_setup(hw); in gbe_dhg_phy_setup()
1002 static s32 e1000_copper_link_preconfig(struct e1000_hw *hw) in e1000_copper_link_preconfig() argument
1013 if (hw->mac_type > e1000_82543) { in e1000_copper_link_preconfig()
1021 ret_val = e1000_phy_hw_reset(hw); in e1000_copper_link_preconfig()
1027 ret_val = e1000_detect_gig_phy(hw); in e1000_copper_link_preconfig()
1032 e_dbg("Phy ID = %x\n", hw->phy_id); in e1000_copper_link_preconfig()
1035 ret_val = e1000_set_phy_mode(hw); in e1000_copper_link_preconfig()
1039 if ((hw->mac_type == e1000_82545_rev_3) || in e1000_copper_link_preconfig()
1040 (hw->mac_type == e1000_82546_rev_3)) { in e1000_copper_link_preconfig()
1042 e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_copper_link_preconfig()
1045 e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_copper_link_preconfig()
1048 if (hw->mac_type <= e1000_82543 || in e1000_copper_link_preconfig()
1049 hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || in e1000_copper_link_preconfig()
1050 hw->mac_type == e1000_82541_rev_2 || in e1000_copper_link_preconfig()
1051 hw->mac_type == e1000_82547_rev_2) in e1000_copper_link_preconfig()
1052 hw->phy_reset_disable = false; in e1000_copper_link_preconfig()
1061 static s32 e1000_copper_link_igp_setup(struct e1000_hw *hw) in e1000_copper_link_igp_setup() argument
1067 if (hw->phy_reset_disable) in e1000_copper_link_igp_setup()
1070 ret_val = e1000_phy_reset(hw); in e1000_copper_link_igp_setup()
1085 if (hw->phy_type == e1000_phy_igp) { in e1000_copper_link_igp_setup()
1087 ret_val = e1000_set_d3_lplu_state(hw, false); in e1000_copper_link_igp_setup()
1095 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); in e1000_copper_link_igp_setup()
1099 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { in e1000_copper_link_igp_setup()
1100 hw->dsp_config_state = e1000_dsp_config_disabled; in e1000_copper_link_igp_setup()
1105 hw->mdix = 1; in e1000_copper_link_igp_setup()
1108 hw->dsp_config_state = e1000_dsp_config_enabled; in e1000_copper_link_igp_setup()
1111 switch (hw->mdix) { in e1000_copper_link_igp_setup()
1124 ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); in e1000_copper_link_igp_setup()
1129 if (hw->autoneg) { in e1000_copper_link_igp_setup()
1130 e1000_ms_type phy_ms_setting = hw->master_slave; in e1000_copper_link_igp_setup()
1132 if (hw->ffe_config_state == e1000_ffe_config_active) in e1000_copper_link_igp_setup()
1133 hw->ffe_config_state = e1000_ffe_config_enabled; in e1000_copper_link_igp_setup()
1135 if (hw->dsp_config_state == e1000_dsp_config_activated) in e1000_copper_link_igp_setup()
1136 hw->dsp_config_state = e1000_dsp_config_enabled; in e1000_copper_link_igp_setup()
1142 if (hw->autoneg_advertised == ADVERTISE_1000_FULL) { in e1000_copper_link_igp_setup()
1145 e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_copper_link_igp_setup()
1151 e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_copper_link_igp_setup()
1157 e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); in e1000_copper_link_igp_setup()
1162 e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); in e1000_copper_link_igp_setup()
1167 ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); in e1000_copper_link_igp_setup()
1172 hw->original_master_slave = (phy_data & CR_1000T_MS_ENABLE) ? in e1000_copper_link_igp_setup()
1191 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); in e1000_copper_link_igp_setup()
1203 static s32 e1000_copper_link_mgp_setup(struct e1000_hw *hw) in e1000_copper_link_mgp_setup() argument
1208 if (hw->phy_reset_disable) in e1000_copper_link_mgp_setup()
1212 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_copper_link_mgp_setup()
1227 switch (hw->mdix) { in e1000_copper_link_mgp_setup()
1250 if (hw->disable_polarity_correction == 1) in e1000_copper_link_mgp_setup()
1252 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_copper_link_mgp_setup()
1256 if (hw->phy_revision < M88E1011_I_REV_4) { in e1000_copper_link_mgp_setup()
1261 e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, in e1000_copper_link_mgp_setup()
1268 if ((hw->phy_revision == E1000_REVISION_2) && in e1000_copper_link_mgp_setup()
1269 (hw->phy_id == M88E1111_I_PHY_ID)) { in e1000_copper_link_mgp_setup()
1273 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_mgp_setup()
1284 ret_val = e1000_write_phy_reg(hw, in e1000_copper_link_mgp_setup()
1293 ret_val = e1000_phy_reset(hw); in e1000_copper_link_mgp_setup()
1309 static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) in e1000_copper_link_autoneg() argument
1317 hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT; in e1000_copper_link_autoneg()
1322 if (hw->autoneg_advertised == 0) in e1000_copper_link_autoneg()
1323 hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; in e1000_copper_link_autoneg()
1326 if (hw->phy_type == e1000_phy_8201) in e1000_copper_link_autoneg()
1327 hw->autoneg_advertised &= AUTONEG_ADVERTISE_10_100_ALL; in e1000_copper_link_autoneg()
1330 ret_val = e1000_phy_setup_autoneg(hw); in e1000_copper_link_autoneg()
1340 ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); in e1000_copper_link_autoneg()
1345 ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); in e1000_copper_link_autoneg()
1352 if (hw->wait_autoneg_complete) { in e1000_copper_link_autoneg()
1353 ret_val = e1000_wait_autoneg(hw); in e1000_copper_link_autoneg()
1361 hw->get_link_status = true; in e1000_copper_link_autoneg()
1379 static s32 e1000_copper_link_postconfig(struct e1000_hw *hw) in e1000_copper_link_postconfig() argument
1383 if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_ce4100)) { in e1000_copper_link_postconfig()
1384 e1000_config_collision_dist(hw); in e1000_copper_link_postconfig()
1386 ret_val = e1000_config_mac_to_phy(hw); in e1000_copper_link_postconfig()
1392 ret_val = e1000_config_fc_after_link_up(hw); in e1000_copper_link_postconfig()
1399 if (hw->phy_type == e1000_phy_igp) { in e1000_copper_link_postconfig()
1400 ret_val = e1000_config_dsp_after_link_change(hw, true); in e1000_copper_link_postconfig()
1416 static s32 e1000_setup_copper_link(struct e1000_hw *hw) in e1000_setup_copper_link() argument
1423 ret_val = e1000_copper_link_preconfig(hw); in e1000_setup_copper_link()
1427 if (hw->phy_type == e1000_phy_igp) { in e1000_setup_copper_link()
1428 ret_val = e1000_copper_link_igp_setup(hw); in e1000_setup_copper_link()
1431 } else if (hw->phy_type == e1000_phy_m88) { in e1000_setup_copper_link()
1432 ret_val = e1000_copper_link_mgp_setup(hw); in e1000_setup_copper_link()
1436 ret_val = gbe_dhg_phy_setup(hw); in e1000_setup_copper_link()
1443 if (hw->autoneg) { in e1000_setup_copper_link()
1447 ret_val = e1000_copper_link_autoneg(hw); in e1000_setup_copper_link()
1455 ret_val = e1000_phy_force_speed_duplex(hw); in e1000_setup_copper_link()
1466 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_setup_copper_link()
1469 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_setup_copper_link()
1475 ret_val = e1000_copper_link_postconfig(hw); in e1000_setup_copper_link()
1495 s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) in e1000_phy_setup_autoneg() argument
1502 ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1507 ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); in e1000_phy_setup_autoneg()
1510 else if (hw->phy_type == e1000_phy_8201) in e1000_phy_setup_autoneg()
1527 e_dbg("autoneg_advertised %x\n", hw->autoneg_advertised); in e1000_phy_setup_autoneg()
1530 if (hw->autoneg_advertised & ADVERTISE_10_HALF) { in e1000_phy_setup_autoneg()
1536 if (hw->autoneg_advertised & ADVERTISE_10_FULL) { in e1000_phy_setup_autoneg()
1542 if (hw->autoneg_advertised & ADVERTISE_100_HALF) { in e1000_phy_setup_autoneg()
1548 if (hw->autoneg_advertised & ADVERTISE_100_FULL) { in e1000_phy_setup_autoneg()
1554 if (hw->autoneg_advertised & ADVERTISE_1000_HALF) { in e1000_phy_setup_autoneg()
1560 if (hw->autoneg_advertised & ADVERTISE_1000_FULL) { in e1000_phy_setup_autoneg()
1582 switch (hw->fc) { in e1000_phy_setup_autoneg()
1619 ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); in e1000_phy_setup_autoneg()
1625 if (hw->phy_type == e1000_phy_8201) { in e1000_phy_setup_autoneg()
1628 ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, in e1000_phy_setup_autoneg()
1643 static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw) in e1000_phy_force_speed_duplex() argument
1653 hw->fc = E1000_FC_NONE; in e1000_phy_force_speed_duplex()
1655 e_dbg("hw->fc = %d\n", hw->fc); in e1000_phy_force_speed_duplex()
1668 ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg); in e1000_phy_force_speed_duplex()
1677 if (hw->forced_speed_duplex == e1000_100_full || in e1000_phy_force_speed_duplex()
1678 hw->forced_speed_duplex == e1000_10_full) { in e1000_phy_force_speed_duplex()
1695 if (hw->forced_speed_duplex == e1000_100_full || in e1000_phy_force_speed_duplex()
1696 hw->forced_speed_duplex == e1000_100_half) { in e1000_phy_force_speed_duplex()
1710 e1000_config_collision_dist(hw); in e1000_phy_force_speed_duplex()
1715 if (hw->phy_type == e1000_phy_m88) { in e1000_phy_force_speed_duplex()
1717 e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_phy_force_speed_duplex()
1726 e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_phy_force_speed_duplex()
1741 e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); in e1000_phy_force_speed_duplex()
1749 e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); in e1000_phy_force_speed_duplex()
1755 ret_val = e1000_write_phy_reg(hw, PHY_CTRL, mii_ctrl_reg); in e1000_phy_force_speed_duplex()
1768 if (hw->wait_autoneg_complete) { in e1000_phy_force_speed_duplex()
1779 e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_phy_force_speed_duplex()
1784 e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_phy_force_speed_duplex()
1792 if ((i == 0) && (hw->phy_type == e1000_phy_m88)) { in e1000_phy_force_speed_duplex()
1796 ret_val = e1000_phy_reset_dsp(hw); in e1000_phy_force_speed_duplex()
1813 e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_phy_force_speed_duplex()
1818 e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_phy_force_speed_duplex()
1824 if (hw->phy_type == e1000_phy_m88) { in e1000_phy_force_speed_duplex()
1831 e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, in e1000_phy_force_speed_duplex()
1838 e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, in e1000_phy_force_speed_duplex()
1848 e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_phy_force_speed_duplex()
1854 e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); in e1000_phy_force_speed_duplex()
1858 if ((hw->mac_type == e1000_82544 || in e1000_phy_force_speed_duplex()
1859 hw->mac_type == e1000_82543) && in e1000_phy_force_speed_duplex()
1860 (!hw->autoneg) && in e1000_phy_force_speed_duplex()
1861 (hw->forced_speed_duplex == e1000_10_full || in e1000_phy_force_speed_duplex()
1862 hw->forced_speed_duplex == e1000_10_half)) { in e1000_phy_force_speed_duplex()
1863 ret_val = e1000_polarity_reversal_workaround(hw); in e1000_phy_force_speed_duplex()
1879 void e1000_config_collision_dist(struct e1000_hw *hw) in e1000_config_collision_dist() argument
1883 if (hw->mac_type < e1000_82543) in e1000_config_collision_dist()
1905 static s32 e1000_config_mac_to_phy(struct e1000_hw *hw) in e1000_config_mac_to_phy() argument
1914 if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_ce4100)) in e1000_config_mac_to_phy()
1924 switch (hw->phy_type) { in e1000_config_mac_to_phy()
1926 ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); in e1000_config_mac_to_phy()
1940 e1000_config_collision_dist(hw); in e1000_config_mac_to_phy()
1946 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, in e1000_config_mac_to_phy()
1956 e1000_config_collision_dist(hw); in e1000_config_mac_to_phy()
1984 s32 e1000_force_mac_fc(struct e1000_hw *hw) in e1000_force_mac_fc() argument
2009 switch (hw->fc) { in e1000_force_mac_fc()
2030 if (hw->mac_type == e1000_82542_rev2_0) in e1000_force_mac_fc()
2048 static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw) in e1000_config_fc_after_link_up() argument
2061 if (((hw->media_type == e1000_media_type_fiber) && in e1000_config_fc_after_link_up()
2062 (hw->autoneg_failed)) || in e1000_config_fc_after_link_up()
2063 ((hw->media_type == e1000_media_type_internal_serdes) && in e1000_config_fc_after_link_up()
2064 (hw->autoneg_failed)) || in e1000_config_fc_after_link_up()
2065 ((hw->media_type == e1000_media_type_copper) && in e1000_config_fc_after_link_up()
2066 (!hw->autoneg))) { in e1000_config_fc_after_link_up()
2067 ret_val = e1000_force_mac_fc(hw); in e1000_config_fc_after_link_up()
2079 if ((hw->media_type == e1000_media_type_copper) && hw->autoneg) { in e1000_config_fc_after_link_up()
2084 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_config_fc_after_link_up()
2087 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_config_fc_after_link_up()
2098 ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, in e1000_config_fc_after_link_up()
2102 ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, in e1000_config_fc_after_link_up()
2151 if (hw->original_fc == E1000_FC_FULL) { in e1000_config_fc_after_link_up()
2152 hw->fc = E1000_FC_FULL; in e1000_config_fc_after_link_up()
2155 hw->fc = E1000_FC_RX_PAUSE; in e1000_config_fc_after_link_up()
2172 hw->fc = E1000_FC_TX_PAUSE; in e1000_config_fc_after_link_up()
2188 hw->fc = E1000_FC_RX_PAUSE; in e1000_config_fc_after_link_up()
2214 else if ((hw->original_fc == E1000_FC_NONE || in e1000_config_fc_after_link_up()
2215 hw->original_fc == E1000_FC_TX_PAUSE) || in e1000_config_fc_after_link_up()
2216 hw->fc_strict_ieee) { in e1000_config_fc_after_link_up()
2217 hw->fc = E1000_FC_NONE; in e1000_config_fc_after_link_up()
2220 hw->fc = E1000_FC_RX_PAUSE; in e1000_config_fc_after_link_up()
2230 e1000_get_speed_and_duplex(hw, &speed, &duplex); in e1000_config_fc_after_link_up()
2238 hw->fc = E1000_FC_NONE; in e1000_config_fc_after_link_up()
2243 ret_val = e1000_force_mac_fc(hw); in e1000_config_fc_after_link_up()
2264 static s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw) in e1000_check_for_serdes_link_generic() argument
2283 if (hw->autoneg_failed == 0) { in e1000_check_for_serdes_link_generic()
2284 hw->autoneg_failed = 1; in e1000_check_for_serdes_link_generic()
2290 ew32(TXCW, (hw->txcw & ~E1000_TXCW_ANE)); in e1000_check_for_serdes_link_generic()
2298 ret_val = e1000_config_fc_after_link_up(hw); in e1000_check_for_serdes_link_generic()
2310 ew32(TXCW, hw->txcw); in e1000_check_for_serdes_link_generic()
2313 hw->serdes_has_link = true; in e1000_check_for_serdes_link_generic()
2324 hw->serdes_has_link = true; in e1000_check_for_serdes_link_generic()
2328 hw->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
2341 hw->serdes_has_link = true; in e1000_check_for_serdes_link_generic()
2345 hw->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
2350 hw->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
2354 hw->serdes_has_link = false; in e1000_check_for_serdes_link_generic()
2370 s32 e1000_check_for_link(struct e1000_hw *hw) in e1000_check_for_link() argument
2385 if ((hw->media_type == e1000_media_type_fiber) || in e1000_check_for_link()
2386 (hw->media_type == e1000_media_type_internal_serdes)) { in e1000_check_for_link()
2389 if (hw->media_type == e1000_media_type_fiber) { in e1000_check_for_link()
2391 hw->get_link_status = false; in e1000_check_for_link()
2401 if ((hw->media_type == e1000_media_type_copper) && hw->get_link_status) { in e1000_check_for_link()
2407 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_check_for_link()
2410 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_check_for_link()
2415 hw->get_link_status = false; in e1000_check_for_link()
2419 e1000_check_downshift(hw); in e1000_check_for_link()
2430 if ((hw->mac_type == e1000_82544 || in e1000_check_for_link()
2431 hw->mac_type == e1000_82543) && in e1000_check_for_link()
2432 (!hw->autoneg) && in e1000_check_for_link()
2433 (hw->forced_speed_duplex == e1000_10_full || in e1000_check_for_link()
2434 hw->forced_speed_duplex == e1000_10_half)) { in e1000_check_for_link()
2437 e1000_polarity_reversal_workaround(hw); in e1000_check_for_link()
2445 e1000_config_dsp_after_link_change(hw, false); in e1000_check_for_link()
2452 if (!hw->autoneg) in e1000_check_for_link()
2456 e1000_config_dsp_after_link_change(hw, true); in e1000_check_for_link()
2466 if ((hw->mac_type >= e1000_82544) && in e1000_check_for_link()
2467 (hw->mac_type != e1000_ce4100)) in e1000_check_for_link()
2468 e1000_config_collision_dist(hw); in e1000_check_for_link()
2470 ret_val = e1000_config_mac_to_phy(hw); in e1000_check_for_link()
2483 ret_val = e1000_config_fc_after_link_up(hw); in e1000_check_for_link()
2497 if (hw->tbi_compatibility_en) { in e1000_check_for_link()
2501 e1000_get_speed_and_duplex(hw, &speed, &duplex); in e1000_check_for_link()
2512 if (hw->tbi_compatibility_on) { in e1000_check_for_link()
2519 hw->tbi_compatibility_on = false; in e1000_check_for_link()
2528 if (!hw->tbi_compatibility_on) { in e1000_check_for_link()
2529 hw->tbi_compatibility_on = true; in e1000_check_for_link()
2538 if ((hw->media_type == e1000_media_type_fiber) || in e1000_check_for_link()
2539 (hw->media_type == e1000_media_type_internal_serdes)) in e1000_check_for_link()
2540 e1000_check_for_serdes_link_generic(hw); in e1000_check_for_link()
2553 s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex) in e1000_get_speed_and_duplex() argument
2559 if (hw->mac_type >= e1000_82543) { in e1000_get_speed_and_duplex()
2589 if (hw->phy_type == e1000_phy_igp && hw->speed_downgraded) { in e1000_get_speed_and_duplex()
2590 ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_data); in e1000_get_speed_and_duplex()
2598 e1000_read_phy_reg(hw, PHY_LP_ABILITY, &phy_data); in e1000_get_speed_and_duplex()
2618 static s32 e1000_wait_autoneg(struct e1000_hw *hw) in e1000_wait_autoneg() argument
2631 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_wait_autoneg()
2634 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_wait_autoneg()
2650 static void e1000_raise_mdi_clk(struct e1000_hw *hw, u32 *ctrl) in e1000_raise_mdi_clk() argument
2665 static void e1000_lower_mdi_clk(struct e1000_hw *hw, u32 *ctrl) in e1000_lower_mdi_clk() argument
2683 static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, u32 data, u16 count) in e1000_shift_out_mdi_bits() argument
2716 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_out_mdi_bits()
2717 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_out_mdi_bits()
2729 static u16 e1000_shift_in_mdi_bits(struct e1000_hw *hw) in e1000_shift_in_mdi_bits() argument
2757 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2758 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2762 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2767 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2770 e1000_raise_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2771 e1000_lower_mdi_clk(hw, &ctrl); in e1000_shift_in_mdi_bits()
2785 s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 reg_addr, u16 *phy_data) in e1000_read_phy_reg() argument
2792 if ((hw->phy_type == e1000_phy_igp) && in e1000_read_phy_reg()
2794 ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, in e1000_read_phy_reg()
2800 ret_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, in e1000_read_phy_reg()
2808 static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, in e1000_read_phy_reg_ex() argument
2813 const u32 phy_addr = (hw->mac_type == e1000_ce4100) ? hw->phy_addr : 1; in e1000_read_phy_reg_ex()
2820 if (hw->mac_type > e1000_82543) { in e1000_read_phy_reg_ex()
2825 if (hw->mac_type == e1000_ce4100) { in e1000_read_phy_reg_ex()
2885 e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); in e1000_read_phy_reg_ex()
2902 e1000_shift_out_mdi_bits(hw, mdic, 14); in e1000_read_phy_reg_ex()
2908 *phy_data = e1000_shift_in_mdi_bits(hw); in e1000_read_phy_reg_ex()
2922 s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 reg_addr, u16 phy_data) in e1000_write_phy_reg() argument
2929 if ((hw->phy_type == e1000_phy_igp) && in e1000_write_phy_reg()
2931 ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, in e1000_write_phy_reg()
2939 ret_val = e1000_write_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, in e1000_write_phy_reg()
2946 static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, in e1000_write_phy_reg_ex() argument
2951 const u32 phy_addr = (hw->mac_type == e1000_ce4100) ? hw->phy_addr : 1; in e1000_write_phy_reg_ex()
2958 if (hw->mac_type > e1000_82543) { in e1000_write_phy_reg_ex()
2964 if (hw->mac_type == e1000_ce4100) { in e1000_write_phy_reg_ex()
3014 e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); in e1000_write_phy_reg_ex()
3027 e1000_shift_out_mdi_bits(hw, mdic, 32); in e1000_write_phy_reg_ex()
3039 s32 e1000_phy_hw_reset(struct e1000_hw *hw) in e1000_phy_hw_reset() argument
3046 if (hw->mac_type > e1000_82543) { in e1000_phy_hw_reset()
3078 if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { in e1000_phy_hw_reset()
3087 return e1000_get_phy_cfg_done(hw); in e1000_phy_hw_reset()
3097 s32 e1000_phy_reset(struct e1000_hw *hw) in e1000_phy_reset() argument
3102 switch (hw->phy_type) { in e1000_phy_reset()
3104 ret_val = e1000_phy_hw_reset(hw); in e1000_phy_reset()
3109 ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); in e1000_phy_reset()
3114 ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); in e1000_phy_reset()
3122 if (hw->phy_type == e1000_phy_igp) in e1000_phy_reset()
3123 e1000_phy_init_script(hw); in e1000_phy_reset()
3134 static s32 e1000_detect_gig_phy(struct e1000_hw *hw) in e1000_detect_gig_phy() argument
3140 if (hw->phy_id != 0) in e1000_detect_gig_phy()
3144 ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); in e1000_detect_gig_phy()
3148 hw->phy_id = (u32)(phy_id_high << 16); in e1000_detect_gig_phy()
3150 ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low); in e1000_detect_gig_phy()
3154 hw->phy_id |= (u32)(phy_id_low & PHY_REVISION_MASK); in e1000_detect_gig_phy()
3155 hw->phy_revision = (u32)phy_id_low & ~PHY_REVISION_MASK; in e1000_detect_gig_phy()
3157 switch (hw->mac_type) { in e1000_detect_gig_phy()
3159 if (hw->phy_id == M88E1000_E_PHY_ID) in e1000_detect_gig_phy()
3163 if (hw->phy_id == M88E1000_I_PHY_ID) in e1000_detect_gig_phy()
3171 if (hw->phy_id == M88E1011_I_PHY_ID) in e1000_detect_gig_phy()
3175 if ((hw->phy_id == RTL8211B_PHY_ID) || in e1000_detect_gig_phy()
3176 (hw->phy_id == RTL8201N_PHY_ID) || in e1000_detect_gig_phy()
3177 (hw->phy_id == M88E1118_E_PHY_ID)) in e1000_detect_gig_phy()
3184 if (hw->phy_id == IGP01E1000_I_PHY_ID) in e1000_detect_gig_phy()
3188 e_dbg("Invalid MAC type %d\n", hw->mac_type); in e1000_detect_gig_phy()
3191 phy_init_status = e1000_set_phy_type(hw); in e1000_detect_gig_phy()
3194 e_dbg("PHY ID 0x%X detected\n", hw->phy_id); in e1000_detect_gig_phy()
3197 e_dbg("Invalid PHY ID 0x%X\n", hw->phy_id); in e1000_detect_gig_phy()
3207 static s32 e1000_phy_reset_dsp(struct e1000_hw *hw) in e1000_phy_reset_dsp() argument
3212 ret_val = e1000_write_phy_reg(hw, 29, 0x001d); in e1000_phy_reset_dsp()
3215 ret_val = e1000_write_phy_reg(hw, 30, 0x00c1); in e1000_phy_reset_dsp()
3218 ret_val = e1000_write_phy_reg(hw, 30, 0x0000); in e1000_phy_reset_dsp()
3234 static s32 e1000_phy_igp_get_info(struct e1000_hw *hw, in e1000_phy_igp_get_info() argument
3244 phy_info->downshift = (e1000_downshift) hw->speed_downgraded; in e1000_phy_igp_get_info()
3253 ret_val = e1000_check_polarity(hw, &polarity); in e1000_phy_igp_get_info()
3259 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data); in e1000_phy_igp_get_info()
3271 ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); in e1000_phy_igp_get_info()
3283 ret_val = e1000_get_cable_length(hw, &min_length, &max_length); in e1000_phy_igp_get_info()
3312 static s32 e1000_phy_m88_get_info(struct e1000_hw *hw, in e1000_phy_m88_get_info() argument
3322 phy_info->downshift = (e1000_downshift) hw->speed_downgraded; in e1000_phy_m88_get_info()
3324 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); in e1000_phy_m88_get_info()
3338 ret_val = e1000_check_polarity(hw, &polarity); in e1000_phy_m88_get_info()
3343 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); in e1000_phy_m88_get_info()
3358 ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); in e1000_phy_m88_get_info()
3380 s32 e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info) in e1000_phy_get_info() argument
3394 if (hw->media_type != e1000_media_type_copper) { in e1000_phy_get_info()
3399 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_phy_get_info()
3403 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); in e1000_phy_get_info()
3412 if (hw->phy_type == e1000_phy_igp) in e1000_phy_get_info()
3413 return e1000_phy_igp_get_info(hw, phy_info); in e1000_phy_get_info()
3414 else if ((hw->phy_type == e1000_phy_8211) || in e1000_phy_get_info()
3415 (hw->phy_type == e1000_phy_8201)) in e1000_phy_get_info()
3418 return e1000_phy_m88_get_info(hw, phy_info); in e1000_phy_get_info()
3421 s32 e1000_validate_mdi_setting(struct e1000_hw *hw) in e1000_validate_mdi_setting() argument
3423 if (!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) { in e1000_validate_mdi_setting()
3425 hw->mdix = 1; in e1000_validate_mdi_setting()
3438 s32 e1000_init_eeprom_params(struct e1000_hw *hw) in e1000_init_eeprom_params() argument
3440 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_init_eeprom_params()
3445 switch (hw->mac_type) { in e1000_init_eeprom_params()
3510 ret_val = e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size); in e1000_init_eeprom_params()
3532 static void e1000_raise_ee_clk(struct e1000_hw *hw, u32 *eecd) in e1000_raise_ee_clk() argument
3540 udelay(hw->eeprom.delay_usec); in e1000_raise_ee_clk()
3548 static void e1000_lower_ee_clk(struct e1000_hw *hw, u32 *eecd) in e1000_lower_ee_clk() argument
3556 udelay(hw->eeprom.delay_usec); in e1000_lower_ee_clk()
3565 static void e1000_shift_out_ee_bits(struct e1000_hw *hw, u16 data, u16 count) in e1000_shift_out_ee_bits() argument
3567 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_shift_out_ee_bits()
3599 e1000_raise_ee_clk(hw, &eecd); in e1000_shift_out_ee_bits()
3600 e1000_lower_ee_clk(hw, &eecd); in e1000_shift_out_ee_bits()
3616 static u16 e1000_shift_in_ee_bits(struct e1000_hw *hw, u16 count) in e1000_shift_in_ee_bits() argument
3636 e1000_raise_ee_clk(hw, &eecd); in e1000_shift_in_ee_bits()
3644 e1000_lower_ee_clk(hw, &eecd); in e1000_shift_in_ee_bits()
3657 static s32 e1000_acquire_eeprom(struct e1000_hw *hw) in e1000_acquire_eeprom() argument
3659 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_acquire_eeprom()
3665 if (hw->mac_type > e1000_82544) { in e1000_acquire_eeprom()
3708 static void e1000_standby_eeprom(struct e1000_hw *hw) in e1000_standby_eeprom() argument
3710 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_standby_eeprom()
3757 static void e1000_release_eeprom(struct e1000_hw *hw) in e1000_release_eeprom() argument
3763 if (hw->eeprom.type == e1000_eeprom_spi) { in e1000_release_eeprom()
3770 udelay(hw->eeprom.delay_usec); in e1000_release_eeprom()
3771 } else if (hw->eeprom.type == e1000_eeprom_microwire) { in e1000_release_eeprom()
3783 udelay(hw->eeprom.delay_usec); in e1000_release_eeprom()
3789 udelay(hw->eeprom.delay_usec); in e1000_release_eeprom()
3793 if (hw->mac_type > e1000_82544) { in e1000_release_eeprom()
3803 static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw) in e1000_spi_eeprom_ready() argument
3815 e1000_shift_out_ee_bits(hw, EEPROM_RDSR_OPCODE_SPI, in e1000_spi_eeprom_ready()
3816 hw->eeprom.opcode_bits); in e1000_spi_eeprom_ready()
3817 spi_stat_reg = (u8)e1000_shift_in_ee_bits(hw, 8); in e1000_spi_eeprom_ready()
3824 e1000_standby_eeprom(hw); in e1000_spi_eeprom_ready()
3845 s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) in e1000_read_eeprom() argument
3850 ret = e1000_do_read_eeprom(hw, offset, words, data); in e1000_read_eeprom()
3855 static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, in e1000_do_read_eeprom() argument
3858 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_do_read_eeprom()
3861 if (hw->mac_type == e1000_ce4100) { in e1000_do_read_eeprom()
3883 if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) in e1000_do_read_eeprom()
3893 if (e1000_spi_eeprom_ready(hw)) { in e1000_do_read_eeprom()
3894 e1000_release_eeprom(hw); in e1000_do_read_eeprom()
3898 e1000_standby_eeprom(hw); in e1000_do_read_eeprom()
3907 e1000_shift_out_ee_bits(hw, read_opcode, eeprom->opcode_bits); in e1000_do_read_eeprom()
3908 e1000_shift_out_ee_bits(hw, (u16)(offset * 2), in e1000_do_read_eeprom()
3919 word_in = e1000_shift_in_ee_bits(hw, 16); in e1000_do_read_eeprom()
3925 e1000_shift_out_ee_bits(hw, in e1000_do_read_eeprom()
3928 e1000_shift_out_ee_bits(hw, (u16)(offset + i), in e1000_do_read_eeprom()
3934 data[i] = e1000_shift_in_ee_bits(hw, 16); in e1000_do_read_eeprom()
3935 e1000_standby_eeprom(hw); in e1000_do_read_eeprom()
3941 e1000_release_eeprom(hw); in e1000_do_read_eeprom()
3954 s32 e1000_validate_eeprom_checksum(struct e1000_hw *hw) in e1000_validate_eeprom_checksum() argument
3960 if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { in e1000_validate_eeprom_checksum()
3969 if ((hw->subsystem_vendor_id == 0x103C) && (eeprom_data == 0x16d6)) in e1000_validate_eeprom_checksum()
3988 s32 e1000_update_eeprom_checksum(struct e1000_hw *hw) in e1000_update_eeprom_checksum() argument
3994 if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { in e1000_update_eeprom_checksum()
4001 if (e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) { in e1000_update_eeprom_checksum()
4018 s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) in e1000_write_eeprom() argument
4023 ret = e1000_do_write_eeprom(hw, offset, words, data); in e1000_write_eeprom()
4028 static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, in e1000_do_write_eeprom() argument
4031 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_do_write_eeprom()
4034 if (hw->mac_type == e1000_ce4100) { in e1000_do_write_eeprom()
4051 if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) in e1000_do_write_eeprom()
4055 status = e1000_write_eeprom_microwire(hw, offset, words, data); in e1000_do_write_eeprom()
4057 status = e1000_write_eeprom_spi(hw, offset, words, data); in e1000_do_write_eeprom()
4062 e1000_release_eeprom(hw); in e1000_do_write_eeprom()
4074 static s32 e1000_write_eeprom_spi(struct e1000_hw *hw, u16 offset, u16 words, in e1000_write_eeprom_spi() argument
4077 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_write_eeprom_spi()
4083 if (e1000_spi_eeprom_ready(hw)) in e1000_write_eeprom_spi()
4086 e1000_standby_eeprom(hw); in e1000_write_eeprom_spi()
4090 e1000_shift_out_ee_bits(hw, EEPROM_WREN_OPCODE_SPI, in e1000_write_eeprom_spi()
4093 e1000_standby_eeprom(hw); in e1000_write_eeprom_spi()
4102 e1000_shift_out_ee_bits(hw, write_opcode, eeprom->opcode_bits); in e1000_write_eeprom_spi()
4104 e1000_shift_out_ee_bits(hw, (u16)((offset + widx) * 2), in e1000_write_eeprom_spi()
4116 e1000_shift_out_ee_bits(hw, word_out, 16); in e1000_write_eeprom_spi()
4125 e1000_standby_eeprom(hw); in e1000_write_eeprom_spi()
4141 static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset, in e1000_write_eeprom_microwire() argument
4144 struct e1000_eeprom_info *eeprom = &hw->eeprom; in e1000_write_eeprom_microwire()
4155 e1000_shift_out_ee_bits(hw, EEPROM_EWEN_OPCODE_MICROWIRE, in e1000_write_eeprom_microwire()
4158 e1000_shift_out_ee_bits(hw, 0, (u16)(eeprom->address_bits - 2)); in e1000_write_eeprom_microwire()
4161 e1000_standby_eeprom(hw); in e1000_write_eeprom_microwire()
4165 e1000_shift_out_ee_bits(hw, EEPROM_WRITE_OPCODE_MICROWIRE, in e1000_write_eeprom_microwire()
4168 e1000_shift_out_ee_bits(hw, (u16)(offset + words_written), in e1000_write_eeprom_microwire()
4172 e1000_shift_out_ee_bits(hw, data[words_written], 16); in e1000_write_eeprom_microwire()
4177 e1000_standby_eeprom(hw); in e1000_write_eeprom_microwire()
4196 e1000_standby_eeprom(hw); in e1000_write_eeprom_microwire()
4208 e1000_shift_out_ee_bits(hw, EEPROM_EWDS_OPCODE_MICROWIRE, in e1000_write_eeprom_microwire()
4211 e1000_shift_out_ee_bits(hw, 0, (u16)(eeprom->address_bits - 2)); in e1000_write_eeprom_microwire()
4223 s32 e1000_read_mac_addr(struct e1000_hw *hw) in e1000_read_mac_addr() argument
4230 if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { in e1000_read_mac_addr()
4234 hw->perm_mac_addr[i] = (u8)(eeprom_data & 0x00FF); in e1000_read_mac_addr()
4235 hw->perm_mac_addr[i + 1] = (u8)(eeprom_data >> 8); in e1000_read_mac_addr()
4238 switch (hw->mac_type) { in e1000_read_mac_addr()
4244 hw->perm_mac_addr[5] ^= 0x01; in e1000_read_mac_addr()
4249 hw->mac_addr[i] = hw->perm_mac_addr[i]; in e1000_read_mac_addr()
4261 static void e1000_init_rx_addrs(struct e1000_hw *hw) in e1000_init_rx_addrs() argument
4269 e1000_rar_set(hw, hw->mac_addr, 0); in e1000_init_rx_addrs()
4278 E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); in e1000_init_rx_addrs()
4280 E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); in e1000_init_rx_addrs()
4290 u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) in e1000_hash_mc_addr() argument
4297 switch (hw->mc_filter_type) { in e1000_hash_mc_addr()
4330 void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) in e1000_rar_set() argument
4359 switch (hw->mac_type) { in e1000_rar_set()
4366 E1000_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); in e1000_rar_set()
4368 E1000_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high); in e1000_rar_set()
4378 void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) in e1000_write_vfta() argument
4382 if ((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) { in e1000_write_vfta()
4383 temp = E1000_READ_REG_ARRAY(hw, VFTA, (offset - 1)); in e1000_write_vfta()
4384 E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); in e1000_write_vfta()
4386 E1000_WRITE_REG_ARRAY(hw, VFTA, (offset - 1), temp); in e1000_write_vfta()
4389 E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); in e1000_write_vfta()
4398 static void e1000_clear_vfta(struct e1000_hw *hw) in e1000_clear_vfta() argument
4403 E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0); in e1000_clear_vfta()
4408 static s32 e1000_id_led_init(struct e1000_hw *hw) in e1000_id_led_init() argument
4417 if (hw->mac_type < e1000_82540) { in e1000_id_led_init()
4423 hw->ledctl_default = ledctl; in e1000_id_led_init()
4424 hw->ledctl_mode1 = hw->ledctl_default; in e1000_id_led_init()
4425 hw->ledctl_mode2 = hw->ledctl_default; in e1000_id_led_init()
4427 if (e1000_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) { in e1000_id_led_init()
4443 hw->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init()
4444 hw->ledctl_mode1 |= ledctl_on << (i << 3); in e1000_id_led_init()
4449 hw->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init()
4450 hw->ledctl_mode1 |= ledctl_off << (i << 3); in e1000_id_led_init()
4460 hw->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init()
4461 hw->ledctl_mode2 |= ledctl_on << (i << 3); in e1000_id_led_init()
4466 hw->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); in e1000_id_led_init()
4467 hw->ledctl_mode2 |= ledctl_off << (i << 3); in e1000_id_led_init()
4483 s32 e1000_setup_led(struct e1000_hw *hw) in e1000_setup_led() argument
4488 switch (hw->mac_type) { in e1000_setup_led()
4500 ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_setup_led()
4501 &hw->phy_spd_default); in e1000_setup_led()
4504 ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_setup_led()
4505 (u16)(hw->phy_spd_default & in e1000_setup_led()
4511 if (hw->media_type == e1000_media_type_fiber) { in e1000_setup_led()
4514 hw->ledctl_default = ledctl; in e1000_setup_led()
4522 } else if (hw->media_type == e1000_media_type_copper) in e1000_setup_led()
4523 ew32(LEDCTL, hw->ledctl_mode1); in e1000_setup_led()
4534 s32 e1000_cleanup_led(struct e1000_hw *hw) in e1000_cleanup_led() argument
4538 switch (hw->mac_type) { in e1000_cleanup_led()
4550 ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_cleanup_led()
4551 hw->phy_spd_default); in e1000_cleanup_led()
4557 ew32(LEDCTL, hw->ledctl_default); in e1000_cleanup_led()
4568 s32 e1000_led_on(struct e1000_hw *hw) in e1000_led_on() argument
4572 switch (hw->mac_type) { in e1000_led_on()
4581 if (hw->media_type == e1000_media_type_fiber) { in e1000_led_on()
4592 if (hw->media_type == e1000_media_type_fiber) { in e1000_led_on()
4596 } else if (hw->media_type == e1000_media_type_copper) { in e1000_led_on()
4597 ew32(LEDCTL, hw->ledctl_mode2); in e1000_led_on()
4612 s32 e1000_led_off(struct e1000_hw *hw) in e1000_led_off() argument
4616 switch (hw->mac_type) { in e1000_led_off()
4625 if (hw->media_type == e1000_media_type_fiber) { in e1000_led_off()
4636 if (hw->media_type == e1000_media_type_fiber) { in e1000_led_off()
4640 } else if (hw->media_type == e1000_media_type_copper) { in e1000_led_off()
4641 ew32(LEDCTL, hw->ledctl_mode1); in e1000_led_off()
4656 static void e1000_clear_hw_cntrs(struct e1000_hw *hw) in e1000_clear_hw_cntrs() argument
4712 if (hw->mac_type < e1000_82543) in e1000_clear_hw_cntrs()
4722 if (hw->mac_type <= e1000_82544) in e1000_clear_hw_cntrs()
4739 void e1000_reset_adaptive(struct e1000_hw *hw) in e1000_reset_adaptive() argument
4741 if (hw->adaptive_ifs) { in e1000_reset_adaptive()
4742 if (!hw->ifs_params_forced) { in e1000_reset_adaptive()
4743 hw->current_ifs_val = 0; in e1000_reset_adaptive()
4744 hw->ifs_min_val = IFS_MIN; in e1000_reset_adaptive()
4745 hw->ifs_max_val = IFS_MAX; in e1000_reset_adaptive()
4746 hw->ifs_step_size = IFS_STEP; in e1000_reset_adaptive()
4747 hw->ifs_ratio = IFS_RATIO; in e1000_reset_adaptive()
4749 hw->in_ifs_mode = false; in e1000_reset_adaptive()
4763 void e1000_update_adaptive(struct e1000_hw *hw) in e1000_update_adaptive() argument
4765 if (hw->adaptive_ifs) { in e1000_update_adaptive()
4766 if ((hw->collision_delta * hw->ifs_ratio) > hw->tx_packet_delta) { in e1000_update_adaptive()
4767 if (hw->tx_packet_delta > MIN_NUM_XMITS) { in e1000_update_adaptive()
4768 hw->in_ifs_mode = true; in e1000_update_adaptive()
4769 if (hw->current_ifs_val < hw->ifs_max_val) { in e1000_update_adaptive()
4770 if (hw->current_ifs_val == 0) in e1000_update_adaptive()
4771 hw->current_ifs_val = in e1000_update_adaptive()
4772 hw->ifs_min_val; in e1000_update_adaptive()
4774 hw->current_ifs_val += in e1000_update_adaptive()
4775 hw->ifs_step_size; in e1000_update_adaptive()
4776 ew32(AIT, hw->current_ifs_val); in e1000_update_adaptive()
4780 if (hw->in_ifs_mode && in e1000_update_adaptive()
4781 (hw->tx_packet_delta <= MIN_NUM_XMITS)) { in e1000_update_adaptive()
4782 hw->current_ifs_val = 0; in e1000_update_adaptive()
4783 hw->in_ifs_mode = false; in e1000_update_adaptive()
4798 void e1000_get_bus_info(struct e1000_hw *hw) in e1000_get_bus_info() argument
4802 switch (hw->mac_type) { in e1000_get_bus_info()
4805 hw->bus_type = e1000_bus_type_pci; in e1000_get_bus_info()
4806 hw->bus_speed = e1000_bus_speed_unknown; in e1000_get_bus_info()
4807 hw->bus_width = e1000_bus_width_unknown; in e1000_get_bus_info()
4811 hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ? in e1000_get_bus_info()
4814 if (hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) { in e1000_get_bus_info()
4815 hw->bus_speed = (hw->bus_type == e1000_bus_type_pci) ? in e1000_get_bus_info()
4817 } else if (hw->bus_type == e1000_bus_type_pci) { in e1000_get_bus_info()
4818 hw->bus_speed = (status & E1000_STATUS_PCI66) ? in e1000_get_bus_info()
4823 hw->bus_speed = e1000_bus_speed_66; in e1000_get_bus_info()
4826 hw->bus_speed = e1000_bus_speed_100; in e1000_get_bus_info()
4829 hw->bus_speed = e1000_bus_speed_133; in e1000_get_bus_info()
4832 hw->bus_speed = e1000_bus_speed_reserved; in e1000_get_bus_info()
4836 hw->bus_width = (status & E1000_STATUS_BUS64) ? in e1000_get_bus_info()
4851 static void e1000_write_reg_io(struct e1000_hw *hw, u32 offset, u32 value) in e1000_write_reg_io() argument
4853 unsigned long io_addr = hw->io_base; in e1000_write_reg_io()
4854 unsigned long io_data = hw->io_base + 4; in e1000_write_reg_io()
4856 e1000_io_write(hw, io_addr, offset); in e1000_write_reg_io()
4857 e1000_io_write(hw, io_data, value); in e1000_write_reg_io()
4874 static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length, in e1000_get_cable_length() argument
4885 if (hw->phy_type == e1000_phy_m88) { in e1000_get_cable_length()
4886 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, in e1000_get_cable_length()
4917 } else if (hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ in e1000_get_cable_length()
4929 e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data); in e1000_get_cable_length()
4987 static s32 e1000_check_polarity(struct e1000_hw *hw, in e1000_check_polarity() argument
4993 if (hw->phy_type == e1000_phy_m88) { in e1000_check_polarity()
4995 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, in e1000_check_polarity()
5002 } else if (hw->phy_type == e1000_phy_igp) { in e1000_check_polarity()
5004 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, in e1000_check_polarity()
5016 e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG, in e1000_check_polarity()
5050 static s32 e1000_check_downshift(struct e1000_hw *hw) in e1000_check_downshift() argument
5055 if (hw->phy_type == e1000_phy_igp) { in e1000_check_downshift()
5056 ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, in e1000_check_downshift()
5061 hw->speed_downgraded = in e1000_check_downshift()
5063 } else if (hw->phy_type == e1000_phy_m88) { in e1000_check_downshift()
5064 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, in e1000_check_downshift()
5069 hw->speed_downgraded = FIELD_GET(M88E1000_PSSR_DOWNSHIFT, in e1000_check_downshift()
5083 static s32 e1000_1000Mb_check_cable_length(struct e1000_hw *hw) in e1000_1000Mb_check_cable_length() argument
5089 ret_val = e1000_get_cable_length(hw, &min_length, &max_length); in e1000_1000Mb_check_cable_length()
5093 if (hw->dsp_config_state != e1000_dsp_config_enabled) in e1000_1000Mb_check_cable_length()
5098 ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], in e1000_1000Mb_check_cable_length()
5105 ret_val = e1000_write_phy_reg(hw, dsp_reg_array[i], in e1000_1000Mb_check_cable_length()
5110 hw->dsp_config_state = e1000_dsp_config_activated; in e1000_1000Mb_check_cable_length()
5116 ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); in e1000_1000Mb_check_cable_length()
5122 ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, in e1000_1000Mb_check_cable_length()
5129 hw->ffe_config_state = e1000_ffe_config_active; in e1000_1000Mb_check_cable_length()
5131 ret_val = e1000_write_phy_reg(hw, in e1000_1000Mb_check_cable_length()
5160 static s32 e1000_config_dsp_after_link_change(struct e1000_hw *hw, bool link_up) in e1000_config_dsp_after_link_change() argument
5165 if (hw->phy_type != e1000_phy_igp) in e1000_config_dsp_after_link_change()
5169 ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); in e1000_config_dsp_after_link_change()
5176 ret_val = e1000_1000Mb_check_cable_length(hw); in e1000_config_dsp_after_link_change()
5181 if (hw->dsp_config_state == e1000_dsp_config_activated) { in e1000_config_dsp_after_link_change()
5186 e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); in e1000_config_dsp_after_link_change()
5192 ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); in e1000_config_dsp_after_link_change()
5199 ret_val = e1000_write_phy_reg(hw, 0x0000, in e1000_config_dsp_after_link_change()
5205 e1000_read_phy_reg(hw, dsp_reg_array[i], in e1000_config_dsp_after_link_change()
5214 e1000_write_phy_reg(hw, dsp_reg_array[i], in e1000_config_dsp_after_link_change()
5220 ret_val = e1000_write_phy_reg(hw, 0x0000, in e1000_config_dsp_after_link_change()
5229 e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); in e1000_config_dsp_after_link_change()
5234 hw->dsp_config_state = e1000_dsp_config_enabled; in e1000_config_dsp_after_link_change()
5237 if (hw->ffe_config_state == e1000_ffe_config_active) { in e1000_config_dsp_after_link_change()
5242 e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); in e1000_config_dsp_after_link_change()
5248 ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); in e1000_config_dsp_after_link_change()
5255 ret_val = e1000_write_phy_reg(hw, 0x0000, in e1000_config_dsp_after_link_change()
5260 e1000_write_phy_reg(hw, IGP01E1000_PHY_DSP_FFE, in e1000_config_dsp_after_link_change()
5265 ret_val = e1000_write_phy_reg(hw, 0x0000, in e1000_config_dsp_after_link_change()
5274 e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); in e1000_config_dsp_after_link_change()
5279 hw->ffe_config_state = e1000_ffe_config_enabled; in e1000_config_dsp_after_link_change()
5293 static s32 e1000_set_phy_mode(struct e1000_hw *hw) in e1000_set_phy_mode() argument
5298 if ((hw->mac_type == e1000_82545_rev_3) && in e1000_set_phy_mode()
5299 (hw->media_type == e1000_media_type_copper)) { in e1000_set_phy_mode()
5301 e1000_read_eeprom(hw, EEPROM_PHY_CLASS_WORD, 1, in e1000_set_phy_mode()
5309 e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, in e1000_set_phy_mode()
5314 e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, in e1000_set_phy_mode()
5319 hw->phy_reset_disable = false; in e1000_set_phy_mode()
5339 static s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active) in e1000_set_d3_lplu_state() argument
5344 if (hw->phy_type != e1000_phy_igp) in e1000_set_d3_lplu_state()
5351 if (hw->mac_type == e1000_82541_rev_2 || in e1000_set_d3_lplu_state()
5352 hw->mac_type == e1000_82547_rev_2) { in e1000_set_d3_lplu_state()
5354 e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, &phy_data); in e1000_set_d3_lplu_state()
5360 if (hw->mac_type == e1000_82541_rev_2 || in e1000_set_d3_lplu_state()
5361 hw->mac_type == e1000_82547_rev_2) { in e1000_set_d3_lplu_state()
5364 e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_set_d3_lplu_state()
5375 if (hw->smart_speed == e1000_smart_speed_on) { in e1000_set_d3_lplu_state()
5377 e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5384 e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5388 } else if (hw->smart_speed == e1000_smart_speed_off) { in e1000_set_d3_lplu_state()
5390 e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5397 e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5402 } else if ((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) || in e1000_set_d3_lplu_state()
5403 (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL) || in e1000_set_d3_lplu_state()
5404 (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) { in e1000_set_d3_lplu_state()
5405 if (hw->mac_type == e1000_82541_rev_2 || in e1000_set_d3_lplu_state()
5406 hw->mac_type == e1000_82547_rev_2) { in e1000_set_d3_lplu_state()
5409 e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, in e1000_set_d3_lplu_state()
5417 e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5424 e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in e1000_set_d3_lplu_state()
5438 static s32 e1000_set_vco_speed(struct e1000_hw *hw) in e1000_set_vco_speed() argument
5444 switch (hw->mac_type) { in e1000_set_vco_speed()
5455 e1000_read_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, &default_page); in e1000_set_vco_speed()
5459 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005); in e1000_set_vco_speed()
5463 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); in e1000_set_vco_speed()
5468 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); in e1000_set_vco_speed()
5474 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004); in e1000_set_vco_speed()
5478 ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); in e1000_set_vco_speed()
5483 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); in e1000_set_vco_speed()
5488 e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, default_page); in e1000_set_vco_speed()
5502 u32 e1000_enable_mng_pass_thru(struct e1000_hw *hw) in e1000_enable_mng_pass_thru() argument
5506 if (hw->asf_firmware_present) { in e1000_enable_mng_pass_thru()
5518 static s32 e1000_polarity_reversal_workaround(struct e1000_hw *hw) in e1000_polarity_reversal_workaround() argument
5528 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); in e1000_polarity_reversal_workaround()
5531 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFFF); in e1000_polarity_reversal_workaround()
5535 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); in e1000_polarity_reversal_workaround()
5545 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_polarity_reversal_workaround()
5549 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_polarity_reversal_workaround()
5563 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); in e1000_polarity_reversal_workaround()
5567 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFF0); in e1000_polarity_reversal_workaround()
5571 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFF00); in e1000_polarity_reversal_workaround()
5575 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x0000); in e1000_polarity_reversal_workaround()
5579 ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); in e1000_polarity_reversal_workaround()
5589 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_polarity_reversal_workaround()
5593 ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); in e1000_polarity_reversal_workaround()
5612 static s32 e1000_get_auto_rd_done(struct e1000_hw *hw) in e1000_get_auto_rd_done() argument
5626 static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw) in e1000_get_phy_cfg_done() argument