Lines Matching +full:hw +full:- +full:flow +full:- +full:ctrl

2   SPDX-License-Identifier: BSD-3-Clause
4 Copyright (c) 2001-2020, Intel Corporation
48 static s32 e1000_init_phy_params_82540(struct e1000_hw *hw);
49 static s32 e1000_init_nvm_params_82540(struct e1000_hw *hw);
50 static s32 e1000_init_mac_params_82540(struct e1000_hw *hw);
51 static s32 e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw);
52 static void e1000_clear_hw_cntrs_82540(struct e1000_hw *hw);
53 static s32 e1000_init_hw_82540(struct e1000_hw *hw);
54 static s32 e1000_reset_hw_82540(struct e1000_hw *hw);
55 static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw);
56 static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw);
57 static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw);
58 static s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw);
59 static void e1000_power_down_phy_copper_82540(struct e1000_hw *hw);
60 static s32 e1000_read_mac_addr_82540(struct e1000_hw *hw);
63 * e1000_init_phy_params_82540 - Init PHY func ptrs.
64 * @hw: pointer to the HW structure
66 static s32 e1000_init_phy_params_82540(struct e1000_hw *hw) in e1000_init_phy_params_82540() argument
68 struct e1000_phy_info *phy = &hw->phy; in e1000_init_phy_params_82540()
71 phy->addr = 1; in e1000_init_phy_params_82540()
72 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; in e1000_init_phy_params_82540()
73 phy->reset_delay_us = 10000; in e1000_init_phy_params_82540()
74 phy->type = e1000_phy_m88; in e1000_init_phy_params_82540()
77 phy->ops.check_polarity = e1000_check_polarity_m88; in e1000_init_phy_params_82540()
78 phy->ops.commit = e1000_phy_sw_reset_generic; in e1000_init_phy_params_82540()
79 phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; in e1000_init_phy_params_82540()
80 phy->ops.get_cable_length = e1000_get_cable_length_m88; in e1000_init_phy_params_82540()
81 phy->ops.get_cfg_done = e1000_get_cfg_done_generic; in e1000_init_phy_params_82540()
82 phy->ops.read_reg = e1000_read_phy_reg_m88; in e1000_init_phy_params_82540()
83 phy->ops.reset = e1000_phy_hw_reset_generic; in e1000_init_phy_params_82540()
84 phy->ops.write_reg = e1000_write_phy_reg_m88; in e1000_init_phy_params_82540()
85 phy->ops.get_info = e1000_get_phy_info_m88; in e1000_init_phy_params_82540()
86 phy->ops.power_up = e1000_power_up_phy_copper; in e1000_init_phy_params_82540()
87 phy->ops.power_down = e1000_power_down_phy_copper_82540; in e1000_init_phy_params_82540()
89 ret_val = e1000_get_phy_id(hw); in e1000_init_phy_params_82540()
94 switch (hw->mac.type) { in e1000_init_phy_params_82540()
100 if (phy->id == M88E1011_I_PHY_ID) in e1000_init_phy_params_82540()
104 ret_val = -E1000_ERR_PHY; in e1000_init_phy_params_82540()
114 * e1000_init_nvm_params_82540 - Init NVM func ptrs.
115 * @hw: pointer to the HW structure
117 static s32 e1000_init_nvm_params_82540(struct e1000_hw *hw) in e1000_init_nvm_params_82540() argument
119 struct e1000_nvm_info *nvm = &hw->nvm; in e1000_init_nvm_params_82540()
120 u32 eecd = E1000_READ_REG(hw, E1000_EECD); in e1000_init_nvm_params_82540()
124 nvm->type = e1000_nvm_eeprom_microwire; in e1000_init_nvm_params_82540()
125 nvm->delay_usec = 50; in e1000_init_nvm_params_82540()
126 nvm->opcode_bits = 3; in e1000_init_nvm_params_82540()
127 switch (nvm->override) { in e1000_init_nvm_params_82540()
129 nvm->address_bits = 8; in e1000_init_nvm_params_82540()
130 nvm->word_size = 256; in e1000_init_nvm_params_82540()
133 nvm->address_bits = 6; in e1000_init_nvm_params_82540()
134 nvm->word_size = 64; in e1000_init_nvm_params_82540()
137 nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6; in e1000_init_nvm_params_82540()
138 nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64; in e1000_init_nvm_params_82540()
143 nvm->ops.acquire = e1000_acquire_nvm_generic; in e1000_init_nvm_params_82540()
144 nvm->ops.read = e1000_read_nvm_microwire; in e1000_init_nvm_params_82540()
145 nvm->ops.release = e1000_release_nvm_generic; in e1000_init_nvm_params_82540()
146 nvm->ops.update = e1000_update_nvm_checksum_generic; in e1000_init_nvm_params_82540()
147 nvm->ops.valid_led_default = e1000_valid_led_default_generic; in e1000_init_nvm_params_82540()
148 nvm->ops.validate = e1000_validate_nvm_checksum_generic; in e1000_init_nvm_params_82540()
149 nvm->ops.write = e1000_write_nvm_microwire; in e1000_init_nvm_params_82540()
155 * e1000_init_mac_params_82540 - Init MAC func ptrs.
156 * @hw: pointer to the HW structure
158 static s32 e1000_init_mac_params_82540(struct e1000_hw *hw) in e1000_init_mac_params_82540() argument
160 struct e1000_mac_info *mac = &hw->mac; in e1000_init_mac_params_82540()
166 switch (hw->device_id) { in e1000_init_mac_params_82540()
171 hw->phy.media_type = e1000_media_type_fiber; in e1000_init_mac_params_82540()
175 hw->phy.media_type = e1000_media_type_internal_serdes; in e1000_init_mac_params_82540()
178 hw->phy.media_type = e1000_media_type_copper; in e1000_init_mac_params_82540()
183 mac->mta_reg_count = 128; in e1000_init_mac_params_82540()
185 mac->rar_entry_count = E1000_RAR_ENTRIES; in e1000_init_mac_params_82540()
190 mac->ops.get_bus_info = e1000_get_bus_info_pci_generic; in e1000_init_mac_params_82540()
192 mac->ops.set_lan_id = e1000_set_lan_id_multi_port_pci; in e1000_init_mac_params_82540()
194 mac->ops.reset_hw = e1000_reset_hw_82540; in e1000_init_mac_params_82540()
195 /* hw initialization */ in e1000_init_mac_params_82540()
196 mac->ops.init_hw = e1000_init_hw_82540; in e1000_init_mac_params_82540()
198 mac->ops.setup_link = e1000_setup_link_generic; in e1000_init_mac_params_82540()
200 mac->ops.setup_physical_interface = in e1000_init_mac_params_82540()
201 (hw->phy.media_type == e1000_media_type_copper) in e1000_init_mac_params_82540()
205 switch (hw->phy.media_type) { in e1000_init_mac_params_82540()
207 mac->ops.check_for_link = e1000_check_for_copper_link_generic; in e1000_init_mac_params_82540()
210 mac->ops.check_for_link = e1000_check_for_fiber_link_generic; in e1000_init_mac_params_82540()
213 mac->ops.check_for_link = e1000_check_for_serdes_link_generic; in e1000_init_mac_params_82540()
216 ret_val = -E1000_ERR_CONFIG; in e1000_init_mac_params_82540()
221 mac->ops.get_link_up_info = in e1000_init_mac_params_82540()
222 (hw->phy.media_type == e1000_media_type_copper) in e1000_init_mac_params_82540()
226 mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; in e1000_init_mac_params_82540()
228 mac->ops.write_vfta = e1000_write_vfta_generic; in e1000_init_mac_params_82540()
230 mac->ops.clear_vfta = e1000_clear_vfta_generic; in e1000_init_mac_params_82540()
232 mac->ops.read_mac_addr = e1000_read_mac_addr_82540; in e1000_init_mac_params_82540()
234 mac->ops.id_led_init = e1000_id_led_init_generic; in e1000_init_mac_params_82540()
236 mac->ops.setup_led = e1000_setup_led_generic; in e1000_init_mac_params_82540()
238 mac->ops.cleanup_led = e1000_cleanup_led_generic; in e1000_init_mac_params_82540()
240 mac->ops.led_on = e1000_led_on_generic; in e1000_init_mac_params_82540()
241 mac->ops.led_off = e1000_led_off_generic; in e1000_init_mac_params_82540()
243 mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_82540; in e1000_init_mac_params_82540()
250 * e1000_init_function_pointers_82540 - Init func ptrs.
251 * @hw: pointer to the HW structure
255 void e1000_init_function_pointers_82540(struct e1000_hw *hw) in e1000_init_function_pointers_82540() argument
259 hw->mac.ops.init_params = e1000_init_mac_params_82540; in e1000_init_function_pointers_82540()
260 hw->nvm.ops.init_params = e1000_init_nvm_params_82540; in e1000_init_function_pointers_82540()
261 hw->phy.ops.init_params = e1000_init_phy_params_82540; in e1000_init_function_pointers_82540()
265 * e1000_reset_hw_82540 - Reset hardware
266 * @hw: pointer to the HW structure
270 static s32 e1000_reset_hw_82540(struct e1000_hw *hw) in e1000_reset_hw_82540() argument
272 u32 ctrl, manc; in e1000_reset_hw_82540() local
278 E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF); in e1000_reset_hw_82540()
280 E1000_WRITE_REG(hw, E1000_RCTL, 0); in e1000_reset_hw_82540()
281 E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP); in e1000_reset_hw_82540()
282 E1000_WRITE_FLUSH(hw); in e1000_reset_hw_82540()
290 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_reset_hw_82540()
293 switch (hw->mac.type) { in e1000_reset_hw_82540()
296 E1000_WRITE_REG(hw, E1000_CTRL_DUP, ctrl | E1000_CTRL_RST); in e1000_reset_hw_82540()
300 * These controllers can't ack the 64-bit write when in e1000_reset_hw_82540()
301 * issuing the reset, so we use IO-mapping as a in e1000_reset_hw_82540()
304 E1000_WRITE_REG_IO(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); in e1000_reset_hw_82540()
311 /* Disable HW ARPs on ASF enabled adapters */ in e1000_reset_hw_82540()
312 manc = E1000_READ_REG(hw, E1000_MANC); in e1000_reset_hw_82540()
314 E1000_WRITE_REG(hw, E1000_MANC, manc); in e1000_reset_hw_82540()
316 E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); in e1000_reset_hw_82540()
317 E1000_READ_REG(hw, E1000_ICR); in e1000_reset_hw_82540()
323 * e1000_init_hw_82540 - Initialize hardware
324 * @hw: pointer to the HW structure
328 static s32 e1000_init_hw_82540(struct e1000_hw *hw) in e1000_init_hw_82540() argument
330 struct e1000_mac_info *mac = &hw->mac; in e1000_init_hw_82540()
338 ret_val = mac->ops.id_led_init(hw); in e1000_init_hw_82540()
346 if (mac->type < e1000_82545_rev_3) in e1000_init_hw_82540()
347 E1000_WRITE_REG(hw, E1000_VET, 0); in e1000_init_hw_82540()
349 mac->ops.clear_vfta(hw); in e1000_init_hw_82540()
352 e1000_init_rx_addrs_generic(hw, mac->rar_entry_count); in e1000_init_hw_82540()
356 for (i = 0; i < mac->mta_reg_count; i++) { in e1000_init_hw_82540()
357 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); in e1000_init_hw_82540()
366 E1000_WRITE_FLUSH(hw); in e1000_init_hw_82540()
369 if (mac->type < e1000_82545_rev_3) in e1000_init_hw_82540()
370 e1000_pcix_mmrbc_workaround_generic(hw); in e1000_init_hw_82540()
372 /* Setup link and flow control */ in e1000_init_hw_82540()
373 ret_val = mac->ops.setup_link(hw); in e1000_init_hw_82540()
375 txdctl = E1000_READ_REG(hw, E1000_TXDCTL(0)); in e1000_init_hw_82540()
378 E1000_WRITE_REG(hw, E1000_TXDCTL(0), txdctl); in e1000_init_hw_82540()
386 e1000_clear_hw_cntrs_82540(hw); in e1000_init_hw_82540()
388 if ((hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER) || in e1000_init_hw_82540()
389 (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3)) { in e1000_init_hw_82540()
390 ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); in e1000_init_hw_82540()
396 E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); in e1000_init_hw_82540()
403 * e1000_setup_copper_link_82540 - Configure copper link settings
404 * @hw: pointer to the HW structure
406 * Calls the appropriate function to configure the link for auto-neg or forced
408 * to configure collision distance and flow control are called. If link is
409 * not established, we return -E1000_ERR_PHY (-2).
411 static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw) in e1000_setup_copper_link_82540() argument
413 u32 ctrl; in e1000_setup_copper_link_82540() local
419 ctrl = E1000_READ_REG(hw, E1000_CTRL); in e1000_setup_copper_link_82540()
420 ctrl |= E1000_CTRL_SLU; in e1000_setup_copper_link_82540()
421 ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); in e1000_setup_copper_link_82540()
422 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); in e1000_setup_copper_link_82540()
424 ret_val = e1000_set_phy_mode_82540(hw); in e1000_setup_copper_link_82540()
428 if (hw->mac.type == e1000_82545_rev_3 || in e1000_setup_copper_link_82540()
429 hw->mac.type == e1000_82546_rev_3) { in e1000_setup_copper_link_82540()
430 ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, in e1000_setup_copper_link_82540()
435 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, in e1000_setup_copper_link_82540()
441 ret_val = e1000_copper_link_setup_m88(hw); in e1000_setup_copper_link_82540()
445 ret_val = e1000_setup_copper_link_generic(hw); in e1000_setup_copper_link_82540()
452 * e1000_setup_fiber_serdes_link_82540 - Setup link for fiber/serdes
453 * @hw: pointer to the HW structure
457 * distance and flow control for fiber and serdes links. Upon successful
460 static s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw) in e1000_setup_fiber_serdes_link_82540() argument
462 struct e1000_mac_info *mac = &hw->mac; in e1000_setup_fiber_serdes_link_82540()
467 switch (mac->type) { in e1000_setup_fiber_serdes_link_82540()
470 if (hw->phy.media_type == e1000_media_type_internal_serdes) { in e1000_setup_fiber_serdes_link_82540()
475 ret_val = e1000_adjust_serdes_amplitude_82540(hw); in e1000_setup_fiber_serdes_link_82540()
480 ret_val = e1000_set_vco_speed_82540(hw); in e1000_setup_fiber_serdes_link_82540()
487 ret_val = e1000_setup_fiber_serdes_link_generic(hw); in e1000_setup_fiber_serdes_link_82540()
494 * e1000_adjust_serdes_amplitude_82540 - Adjust amplitude based on EEPROM
495 * @hw: pointer to the HW structure
499 static s32 e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw) in e1000_adjust_serdes_amplitude_82540() argument
506 ret_val = hw->nvm.ops.read(hw, NVM_SERDES_AMPLITUDE, 1, &nvm_data); in e1000_adjust_serdes_amplitude_82540()
513 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_EXT_CTRL, in e1000_adjust_serdes_amplitude_82540()
524 * e1000_set_vco_speed_82540 - Set VCO speed for better performance
525 * @hw: pointer to the HW structure
529 static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw) in e1000_set_vco_speed_82540() argument
539 ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_PAGE_SELECT, in e1000_set_vco_speed_82540()
544 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005); in e1000_set_vco_speed_82540()
548 ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); in e1000_set_vco_speed_82540()
553 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); in e1000_set_vco_speed_82540()
559 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004); in e1000_set_vco_speed_82540()
563 ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); in e1000_set_vco_speed_82540()
568 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); in e1000_set_vco_speed_82540()
572 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, in e1000_set_vco_speed_82540()
580 * e1000_set_phy_mode_82540 - Set PHY to class A mode
581 * @hw: pointer to the HW structure
586 * 2. Restart auto-negotiation or force link.
588 static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw) in e1000_set_phy_mode_82540() argument
595 if (hw->mac.type != e1000_82545_rev_3) in e1000_set_phy_mode_82540()
598 ret_val = hw->nvm.ops.read(hw, NVM_PHY_CLASS_WORD, 1, &nvm_data); in e1000_set_phy_mode_82540()
600 ret_val = -E1000_ERR_PHY; in e1000_set_phy_mode_82540()
605 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, in e1000_set_phy_mode_82540()
608 ret_val = -E1000_ERR_PHY; in e1000_set_phy_mode_82540()
611 ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, in e1000_set_phy_mode_82540()
614 ret_val = -E1000_ERR_PHY; in e1000_set_phy_mode_82540()
625 * e1000_power_down_phy_copper_82540 - Remove link in case of PHY power down
626 * @hw: pointer to the HW structure
631 static void e1000_power_down_phy_copper_82540(struct e1000_hw *hw) in e1000_power_down_phy_copper_82540() argument
634 if (!(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_SMBUS_EN)) in e1000_power_down_phy_copper_82540()
635 e1000_power_down_phy_copper(hw); in e1000_power_down_phy_copper_82540()
641 * e1000_clear_hw_cntrs_82540 - Clear device specific hardware counters
642 * @hw: pointer to the HW structure
646 static void e1000_clear_hw_cntrs_82540(struct e1000_hw *hw) in e1000_clear_hw_cntrs_82540() argument
650 e1000_clear_hw_cntrs_base_generic(hw); in e1000_clear_hw_cntrs_82540()
652 E1000_READ_REG(hw, E1000_PRC64); in e1000_clear_hw_cntrs_82540()
653 E1000_READ_REG(hw, E1000_PRC127); in e1000_clear_hw_cntrs_82540()
654 E1000_READ_REG(hw, E1000_PRC255); in e1000_clear_hw_cntrs_82540()
655 E1000_READ_REG(hw, E1000_PRC511); in e1000_clear_hw_cntrs_82540()
656 E1000_READ_REG(hw, E1000_PRC1023); in e1000_clear_hw_cntrs_82540()
657 E1000_READ_REG(hw, E1000_PRC1522); in e1000_clear_hw_cntrs_82540()
658 E1000_READ_REG(hw, E1000_PTC64); in e1000_clear_hw_cntrs_82540()
659 E1000_READ_REG(hw, E1000_PTC127); in e1000_clear_hw_cntrs_82540()
660 E1000_READ_REG(hw, E1000_PTC255); in e1000_clear_hw_cntrs_82540()
661 E1000_READ_REG(hw, E1000_PTC511); in e1000_clear_hw_cntrs_82540()
662 E1000_READ_REG(hw, E1000_PTC1023); in e1000_clear_hw_cntrs_82540()
663 E1000_READ_REG(hw, E1000_PTC1522); in e1000_clear_hw_cntrs_82540()
665 E1000_READ_REG(hw, E1000_ALGNERRC); in e1000_clear_hw_cntrs_82540()
666 E1000_READ_REG(hw, E1000_RXERRC); in e1000_clear_hw_cntrs_82540()
667 E1000_READ_REG(hw, E1000_TNCRS); in e1000_clear_hw_cntrs_82540()
668 E1000_READ_REG(hw, E1000_CEXTERR); in e1000_clear_hw_cntrs_82540()
669 E1000_READ_REG(hw, E1000_TSCTC); in e1000_clear_hw_cntrs_82540()
670 E1000_READ_REG(hw, E1000_TSCTFC); in e1000_clear_hw_cntrs_82540()
672 E1000_READ_REG(hw, E1000_MGTPRC); in e1000_clear_hw_cntrs_82540()
673 E1000_READ_REG(hw, E1000_MGTPDC); in e1000_clear_hw_cntrs_82540()
674 E1000_READ_REG(hw, E1000_MGTPTC); in e1000_clear_hw_cntrs_82540()
678 * e1000_read_mac_addr_82540 - Read device MAC address
679 * @hw: pointer to the HW structure
691 s32 e1000_read_mac_addr_82540(struct e1000_hw *hw) in e1000_read_mac_addr_82540() argument
700 ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); in e1000_read_mac_addr_82540()
705 hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); in e1000_read_mac_addr_82540()
706 hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); in e1000_read_mac_addr_82540()
710 if (hw->bus.func == E1000_FUNC_1) in e1000_read_mac_addr_82540()
711 hw->mac.perm_addr[5] ^= 1; in e1000_read_mac_addr_82540()
714 hw->mac.addr[i] = hw->mac.perm_addr[i]; in e1000_read_mac_addr_82540()