Lines Matching +full:read +full:- +full:out
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2007 - 2018 Intel Corporation. */
61 * igb_write_vfta_i350 - Write value to VLAN filter table
71 struct igb_adapter *adapter = hw->back; in igb_write_vfta_i350()
74 for (i = 10; i--;) in igb_write_vfta_i350()
78 adapter->shadow_vfta[offset] = value; in igb_write_vfta_i350()
82 * igb_sgmii_uses_mdio_82575 - Determine if I2C pins are for external MDIO
93 switch (hw->mac.type) { in igb_sgmii_uses_mdio_82575()
114 * igb_check_for_link_media_swap - Check which M88E1112 interface linked
121 struct e1000_phy_info *phy = &hw->phy; in igb_check_for_link_media_swap()
127 ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0); in igb_check_for_link_media_swap()
131 ret_val = phy->ops.read_reg(hw, E1000_M88E1112_STATUS, &data); in igb_check_for_link_media_swap()
139 ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 1); in igb_check_for_link_media_swap()
143 ret_val = phy->ops.read_reg(hw, E1000_M88E1112_STATUS, &data); in igb_check_for_link_media_swap()
152 if (port && (hw->dev_spec._82575.media_port != port)) { in igb_check_for_link_media_swap()
153 hw->dev_spec._82575.media_port = port; in igb_check_for_link_media_swap()
154 hw->dev_spec._82575.media_changed = true; in igb_check_for_link_media_swap()
159 ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0); in igb_check_for_link_media_swap()
166 ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0); in igb_check_for_link_media_swap()
175 * igb_init_phy_params_82575 - Init PHY func ptrs.
180 struct e1000_phy_info *phy = &hw->phy; in igb_init_phy_params_82575()
184 if (hw->phy.media_type != e1000_media_type_copper) { in igb_init_phy_params_82575()
185 phy->type = e1000_phy_none; in igb_init_phy_params_82575()
186 goto out; in igb_init_phy_params_82575()
189 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; in igb_init_phy_params_82575()
190 phy->reset_delay_us = 100; in igb_init_phy_params_82575()
195 phy->ops.reset = igb_phy_hw_reset_sgmii_82575; in igb_init_phy_params_82575()
198 phy->ops.reset = igb_phy_hw_reset; in igb_init_phy_params_82575()
206 phy->ops.read_reg = igb_read_phy_reg_sgmii_82575; in igb_init_phy_params_82575()
207 phy->ops.write_reg = igb_write_phy_reg_sgmii_82575; in igb_init_phy_params_82575()
209 switch (hw->mac.type) { in igb_init_phy_params_82575()
215 phy->ops.read_reg = igb_read_phy_reg_82580; in igb_init_phy_params_82575()
216 phy->ops.write_reg = igb_write_phy_reg_82580; in igb_init_phy_params_82575()
219 phy->ops.read_reg = igb_read_phy_reg_igp; in igb_init_phy_params_82575()
220 phy->ops.write_reg = igb_write_phy_reg_igp; in igb_init_phy_params_82575()
225 hw->bus.func = (rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) >> in igb_init_phy_params_82575()
228 /* Set phy->phy_addr and phy->id. */ in igb_init_phy_params_82575()
234 switch (phy->id) { in igb_init_phy_params_82575()
240 phy->type = e1000_phy_m88; in igb_init_phy_params_82575()
241 phy->ops.check_polarity = igb_check_polarity_m88; in igb_init_phy_params_82575()
242 phy->ops.get_phy_info = igb_get_phy_info_m88; in igb_init_phy_params_82575()
243 if (phy->id != M88E1111_I_PHY_ID) in igb_init_phy_params_82575()
244 phy->ops.get_cable_length = in igb_init_phy_params_82575()
247 phy->ops.get_cable_length = igb_get_cable_length_m88; in igb_init_phy_params_82575()
248 phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_m88; in igb_init_phy_params_82575()
250 if (phy->id == M88E1112_E_PHY_ID) { in igb_init_phy_params_82575()
253 ret_val = phy->ops.write_reg(hw, in igb_init_phy_params_82575()
257 goto out; in igb_init_phy_params_82575()
259 ret_val = phy->ops.read_reg(hw, in igb_init_phy_params_82575()
263 goto out; in igb_init_phy_params_82575()
269 hw->mac.ops.check_for_link = in igb_init_phy_params_82575()
272 if (phy->id == M88E1512_E_PHY_ID) { in igb_init_phy_params_82575()
275 goto out; in igb_init_phy_params_82575()
277 if (phy->id == M88E1543_E_PHY_ID) { in igb_init_phy_params_82575()
280 goto out; in igb_init_phy_params_82575()
284 phy->type = e1000_phy_igp_3; in igb_init_phy_params_82575()
285 phy->ops.get_phy_info = igb_get_phy_info_igp; in igb_init_phy_params_82575()
286 phy->ops.get_cable_length = igb_get_cable_length_igp_2; in igb_init_phy_params_82575()
287 phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_igp; in igb_init_phy_params_82575()
288 phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82575; in igb_init_phy_params_82575()
289 phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state; in igb_init_phy_params_82575()
293 phy->type = e1000_phy_82580; in igb_init_phy_params_82575()
294 phy->ops.force_speed_duplex = in igb_init_phy_params_82575()
296 phy->ops.get_cable_length = igb_get_cable_length_82580; in igb_init_phy_params_82575()
297 phy->ops.get_phy_info = igb_get_phy_info_82580; in igb_init_phy_params_82575()
298 phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82580; in igb_init_phy_params_82575()
299 phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state_82580; in igb_init_phy_params_82575()
302 phy->type = e1000_phy_i210; in igb_init_phy_params_82575()
303 phy->ops.check_polarity = igb_check_polarity_m88; in igb_init_phy_params_82575()
304 phy->ops.get_cfg_done = igb_get_cfg_done_i210; in igb_init_phy_params_82575()
305 phy->ops.get_phy_info = igb_get_phy_info_m88; in igb_init_phy_params_82575()
306 phy->ops.get_cable_length = igb_get_cable_length_m88_gen2; in igb_init_phy_params_82575()
307 phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82580; in igb_init_phy_params_82575()
308 phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state_82580; in igb_init_phy_params_82575()
309 phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_m88; in igb_init_phy_params_82575()
312 phy->type = e1000_phy_bcm54616; in igb_init_phy_params_82575()
315 ret_val = -E1000_ERR_PHY; in igb_init_phy_params_82575()
316 goto out; in igb_init_phy_params_82575()
319 out: in igb_init_phy_params_82575()
324 * igb_init_nvm_params_82575 - Init NVM func ptrs.
329 struct e1000_nvm_info *nvm = &hw->nvm; in igb_init_nvm_params_82575()
336 /* Added to a constant, "size" becomes the left-shift value in igb_init_nvm_params_82575()
341 /* Just in case size is out of range, cap it to the largest in igb_init_nvm_params_82575()
347 nvm->word_size = BIT(size); in igb_init_nvm_params_82575()
348 nvm->opcode_bits = 8; in igb_init_nvm_params_82575()
349 nvm->delay_usec = 1; in igb_init_nvm_params_82575()
351 switch (nvm->override) { in igb_init_nvm_params_82575()
353 nvm->page_size = 32; in igb_init_nvm_params_82575()
354 nvm->address_bits = 16; in igb_init_nvm_params_82575()
357 nvm->page_size = 8; in igb_init_nvm_params_82575()
358 nvm->address_bits = 8; in igb_init_nvm_params_82575()
361 nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; in igb_init_nvm_params_82575()
362 nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? in igb_init_nvm_params_82575()
366 if (nvm->word_size == BIT(15)) in igb_init_nvm_params_82575()
367 nvm->page_size = 128; in igb_init_nvm_params_82575()
369 nvm->type = e1000_nvm_eeprom_spi; in igb_init_nvm_params_82575()
372 nvm->ops.acquire = igb_acquire_nvm_82575; in igb_init_nvm_params_82575()
373 nvm->ops.release = igb_release_nvm_82575; in igb_init_nvm_params_82575()
374 nvm->ops.write = igb_write_nvm_spi; in igb_init_nvm_params_82575()
375 nvm->ops.validate = igb_validate_nvm_checksum; in igb_init_nvm_params_82575()
376 nvm->ops.update = igb_update_nvm_checksum; in igb_init_nvm_params_82575()
377 if (nvm->word_size < BIT(15)) in igb_init_nvm_params_82575()
378 nvm->ops.read = igb_read_nvm_eerd; in igb_init_nvm_params_82575()
380 nvm->ops.read = igb_read_nvm_spi; in igb_init_nvm_params_82575()
383 switch (hw->mac.type) { in igb_init_nvm_params_82575()
385 nvm->ops.validate = igb_validate_nvm_checksum_82580; in igb_init_nvm_params_82575()
386 nvm->ops.update = igb_update_nvm_checksum_82580; in igb_init_nvm_params_82575()
390 nvm->ops.validate = igb_validate_nvm_checksum_i350; in igb_init_nvm_params_82575()
391 nvm->ops.update = igb_update_nvm_checksum_i350; in igb_init_nvm_params_82575()
401 * igb_init_mac_params_82575 - Init MAC func ptrs.
406 struct e1000_mac_info *mac = &hw->mac; in igb_init_mac_params_82575()
407 struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; in igb_init_mac_params_82575()
410 mac->mta_reg_count = 128; in igb_init_mac_params_82575()
412 mac->uta_reg_count = (hw->mac.type == e1000_82575) ? 0 : 128; in igb_init_mac_params_82575()
414 switch (mac->type) { in igb_init_mac_params_82575()
416 mac->rar_entry_count = E1000_RAR_ENTRIES_82576; in igb_init_mac_params_82575()
419 mac->rar_entry_count = E1000_RAR_ENTRIES_82580; in igb_init_mac_params_82575()
423 mac->rar_entry_count = E1000_RAR_ENTRIES_I350; in igb_init_mac_params_82575()
426 mac->rar_entry_count = E1000_RAR_ENTRIES_82575; in igb_init_mac_params_82575()
430 if (mac->type >= e1000_82580) in igb_init_mac_params_82575()
431 mac->ops.reset_hw = igb_reset_hw_82580; in igb_init_mac_params_82575()
433 mac->ops.reset_hw = igb_reset_hw_82575; in igb_init_mac_params_82575()
435 if (mac->type >= e1000_i210) { in igb_init_mac_params_82575()
436 mac->ops.acquire_swfw_sync = igb_acquire_swfw_sync_i210; in igb_init_mac_params_82575()
437 mac->ops.release_swfw_sync = igb_release_swfw_sync_i210; in igb_init_mac_params_82575()
440 mac->ops.acquire_swfw_sync = igb_acquire_swfw_sync_82575; in igb_init_mac_params_82575()
441 mac->ops.release_swfw_sync = igb_release_swfw_sync_82575; in igb_init_mac_params_82575()
444 if ((hw->mac.type == e1000_i350) || (hw->mac.type == e1000_i354)) in igb_init_mac_params_82575()
445 mac->ops.write_vfta = igb_write_vfta_i350; in igb_init_mac_params_82575()
447 mac->ops.write_vfta = igb_write_vfta; in igb_init_mac_params_82575()
450 mac->asf_firmware_present = true; in igb_init_mac_params_82575()
452 mac->arc_subsystem_valid = in igb_init_mac_params_82575()
456 if (mac->type >= e1000_i350) in igb_init_mac_params_82575()
457 dev_spec->eee_disable = false; in igb_init_mac_params_82575()
459 dev_spec->eee_disable = true; in igb_init_mac_params_82575()
461 if (mac->type >= e1000_i210) in igb_init_mac_params_82575()
462 dev_spec->clear_semaphore_once = true; in igb_init_mac_params_82575()
464 mac->ops.setup_physical_interface = in igb_init_mac_params_82575()
465 (hw->phy.media_type == e1000_media_type_copper) in igb_init_mac_params_82575()
469 if (mac->type == e1000_82580 || mac->type == e1000_i350) { in igb_init_mac_params_82575()
470 switch (hw->device_id) { in igb_init_mac_params_82575()
478 hw->dev_spec._82575.mas_capable = true; in igb_init_mac_params_82575()
486 * igb_set_sfp_media_type_82575 - derives SFP module media type.
496 struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; in igb_set_sfp_media_type_82575()
497 struct e1000_sfp_flags *eth_flags = &dev_spec->eth_flags; in igb_set_sfp_media_type_82575()
508 /* Read SFP module data */ in igb_set_sfp_media_type_82575()
516 timeout--; in igb_set_sfp_media_type_82575()
519 goto out; in igb_set_sfp_media_type_82575()
525 goto out; in igb_set_sfp_media_type_82575()
530 dev_spec->module_plugged = true; in igb_set_sfp_media_type_82575()
531 if (eth_flags->e1000_base_lx || eth_flags->e1000_base_sx) { in igb_set_sfp_media_type_82575()
532 hw->phy.media_type = e1000_media_type_internal_serdes; in igb_set_sfp_media_type_82575()
533 } else if (eth_flags->e100_base_fx || eth_flags->e100_base_lx) { in igb_set_sfp_media_type_82575()
534 dev_spec->sgmii_active = true; in igb_set_sfp_media_type_82575()
535 hw->phy.media_type = e1000_media_type_internal_serdes; in igb_set_sfp_media_type_82575()
536 } else if (eth_flags->e1000_base_t) { in igb_set_sfp_media_type_82575()
537 dev_spec->sgmii_active = true; in igb_set_sfp_media_type_82575()
538 hw->phy.media_type = e1000_media_type_copper; in igb_set_sfp_media_type_82575()
540 hw->phy.media_type = e1000_media_type_unknown; in igb_set_sfp_media_type_82575()
542 goto out; in igb_set_sfp_media_type_82575()
545 hw->phy.media_type = e1000_media_type_unknown; in igb_set_sfp_media_type_82575()
548 out: in igb_set_sfp_media_type_82575()
556 struct e1000_mac_info *mac = &hw->mac; in igb_get_invariants_82575()
557 struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; in igb_get_invariants_82575()
562 switch (hw->device_id) { in igb_get_invariants_82575()
566 mac->type = e1000_82575; in igb_get_invariants_82575()
576 mac->type = e1000_82576; in igb_get_invariants_82575()
588 mac->type = e1000_82580; in igb_get_invariants_82575()
594 mac->type = e1000_i350; in igb_get_invariants_82575()
602 mac->type = e1000_i210; in igb_get_invariants_82575()
605 mac->type = e1000_i211; in igb_get_invariants_82575()
610 mac->type = e1000_i354; in igb_get_invariants_82575()
613 return -E1000_ERR_MAC_INIT; in igb_get_invariants_82575()
623 hw->phy.media_type = e1000_media_type_copper; in igb_get_invariants_82575()
624 dev_spec->sgmii_active = false; in igb_get_invariants_82575()
625 dev_spec->module_plugged = false; in igb_get_invariants_82575()
632 hw->phy.media_type = e1000_media_type_internal_serdes; in igb_get_invariants_82575()
637 hw->phy.media_type = e1000_media_type_copper; in igb_get_invariants_82575()
638 dev_spec->sgmii_active = true; in igb_get_invariants_82575()
643 /* read media type from SFP EEPROM */ in igb_get_invariants_82575()
646 (hw->phy.media_type == e1000_media_type_unknown)) { in igb_get_invariants_82575()
650 hw->phy.media_type = e1000_media_type_internal_serdes; in igb_get_invariants_82575()
653 hw->phy.media_type = e1000_media_type_copper; in igb_get_invariants_82575()
654 dev_spec->sgmii_active = true; in igb_get_invariants_82575()
663 if (dev_spec->sgmii_active) in igb_get_invariants_82575()
678 goto out; in igb_get_invariants_82575()
682 switch (hw->mac.type) { in igb_get_invariants_82575()
692 goto out; in igb_get_invariants_82575()
694 /* if part supports SR-IOV then initialize mailbox parameters */ in igb_get_invariants_82575()
695 switch (mac->type) { in igb_get_invariants_82575()
707 out: in igb_get_invariants_82575()
712 * igb_acquire_phy_82575 - Acquire rights to access PHY
722 if (hw->bus.func == E1000_FUNC_1) in igb_acquire_phy_82575()
724 else if (hw->bus.func == E1000_FUNC_2) in igb_acquire_phy_82575()
726 else if (hw->bus.func == E1000_FUNC_3) in igb_acquire_phy_82575()
729 return hw->mac.ops.acquire_swfw_sync(hw, mask); in igb_acquire_phy_82575()
733 * igb_release_phy_82575 - Release rights to access PHY
743 if (hw->bus.func == E1000_FUNC_1) in igb_release_phy_82575()
745 else if (hw->bus.func == E1000_FUNC_2) in igb_release_phy_82575()
747 else if (hw->bus.func == E1000_FUNC_3) in igb_release_phy_82575()
750 hw->mac.ops.release_swfw_sync(hw, mask); in igb_release_phy_82575()
754 * igb_read_phy_reg_sgmii_82575 - Read PHY register using sgmii
756 * @offset: register offset to be read
757 * @data: pointer to the read data
765 s32 ret_val = -E1000_ERR_PARAM; in igb_read_phy_reg_sgmii_82575()
768 hw_dbg("PHY Address %u is out of range\n", offset); in igb_read_phy_reg_sgmii_82575()
769 goto out; in igb_read_phy_reg_sgmii_82575()
772 ret_val = hw->phy.ops.acquire(hw); in igb_read_phy_reg_sgmii_82575()
774 goto out; in igb_read_phy_reg_sgmii_82575()
778 hw->phy.ops.release(hw); in igb_read_phy_reg_sgmii_82575()
780 out: in igb_read_phy_reg_sgmii_82575()
785 * igb_write_phy_reg_sgmii_82575 - Write PHY register using sgmii
796 s32 ret_val = -E1000_ERR_PARAM; in igb_write_phy_reg_sgmii_82575()
800 hw_dbg("PHY Address %d is out of range\n", offset); in igb_write_phy_reg_sgmii_82575()
801 goto out; in igb_write_phy_reg_sgmii_82575()
804 ret_val = hw->phy.ops.acquire(hw); in igb_write_phy_reg_sgmii_82575()
806 goto out; in igb_write_phy_reg_sgmii_82575()
810 hw->phy.ops.release(hw); in igb_write_phy_reg_sgmii_82575()
812 out: in igb_write_phy_reg_sgmii_82575()
817 * igb_get_phy_id_82575 - Retrieve PHY addr and id
825 struct e1000_phy_info *phy = &hw->phy; in igb_get_phy_id_82575()
831 /* Extra read required for some PHY's on i354 */ in igb_get_phy_id_82575()
832 if (hw->mac.type == e1000_i354) in igb_get_phy_id_82575()
836 * we find one that works. For non-SGMII PHYs in igb_get_phy_id_82575()
838 * work. The result of this function should mean phy->phy_addr in igb_get_phy_id_82575()
839 * and phy->id are set correctly. in igb_get_phy_id_82575()
842 phy->addr = 1; in igb_get_phy_id_82575()
844 goto out; in igb_get_phy_id_82575()
848 switch (hw->mac.type) { in igb_get_phy_id_82575()
853 phy->addr = mdic >> E1000_MDIC_PHY_SHIFT; in igb_get_phy_id_82575()
862 phy->addr = mdic >> E1000_MDICNFG_PHY_SHIFT; in igb_get_phy_id_82575()
865 ret_val = -E1000_ERR_PHY; in igb_get_phy_id_82575()
866 goto out; in igb_get_phy_id_82575()
869 goto out; in igb_get_phy_id_82575()
879 * Therefore, we need to test 1-7 in igb_get_phy_id_82575()
881 for (phy->addr = 1; phy->addr < 8; phy->addr++) { in igb_get_phy_id_82575()
884 hw_dbg("Vendor ID 0x%08X read at address %u\n", in igb_get_phy_id_82575()
885 phy_id, phy->addr); in igb_get_phy_id_82575()
892 hw_dbg("PHY address %u was unreadable\n", phy->addr); in igb_get_phy_id_82575()
897 if (phy->addr == 8) { in igb_get_phy_id_82575()
898 phy->addr = 0; in igb_get_phy_id_82575()
899 ret_val = -E1000_ERR_PHY; in igb_get_phy_id_82575()
900 goto out; in igb_get_phy_id_82575()
908 out: in igb_get_phy_id_82575()
913 * igb_phy_hw_reset_sgmii_82575 - Performs a PHY reset
920 struct e1000_phy_info *phy = &hw->phy; in igb_phy_hw_reset_sgmii_82575()
932 ret_val = hw->phy.ops.write_reg(hw, 0x1B, 0x8084); in igb_phy_hw_reset_sgmii_82575()
934 goto out; in igb_phy_hw_reset_sgmii_82575()
938 goto out; in igb_phy_hw_reset_sgmii_82575()
940 if (phy->id == M88E1512_E_PHY_ID) in igb_phy_hw_reset_sgmii_82575()
942 if (phy->id == M88E1543_E_PHY_ID) in igb_phy_hw_reset_sgmii_82575()
944 out: in igb_phy_hw_reset_sgmii_82575()
949 * igb_set_d0_lplu_state_82575 - Set Low Power Linkup D0 state
963 struct e1000_phy_info *phy = &hw->phy; in igb_set_d0_lplu_state_82575()
967 ret_val = phy->ops.read_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data); in igb_set_d0_lplu_state_82575()
969 goto out; in igb_set_d0_lplu_state_82575()
973 ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, in igb_set_d0_lplu_state_82575()
976 goto out; in igb_set_d0_lplu_state_82575()
979 ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in igb_set_d0_lplu_state_82575()
982 ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG, in igb_set_d0_lplu_state_82575()
985 goto out; in igb_set_d0_lplu_state_82575()
988 ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, in igb_set_d0_lplu_state_82575()
995 if (phy->smart_speed == e1000_smart_speed_on) { in igb_set_d0_lplu_state_82575()
996 ret_val = phy->ops.read_reg(hw, in igb_set_d0_lplu_state_82575()
999 goto out; in igb_set_d0_lplu_state_82575()
1002 ret_val = phy->ops.write_reg(hw, in igb_set_d0_lplu_state_82575()
1005 goto out; in igb_set_d0_lplu_state_82575()
1006 } else if (phy->smart_speed == e1000_smart_speed_off) { in igb_set_d0_lplu_state_82575()
1007 ret_val = phy->ops.read_reg(hw, in igb_set_d0_lplu_state_82575()
1010 goto out; in igb_set_d0_lplu_state_82575()
1013 ret_val = phy->ops.write_reg(hw, in igb_set_d0_lplu_state_82575()
1016 goto out; in igb_set_d0_lplu_state_82575()
1020 out: in igb_set_d0_lplu_state_82575()
1025 * igb_set_d0_lplu_state_82580 - Set Low Power Linkup D0 state
1039 struct e1000_phy_info *phy = &hw->phy; in igb_set_d0_lplu_state_82580()
1057 if (phy->smart_speed == e1000_smart_speed_on) in igb_set_d0_lplu_state_82580()
1059 else if (phy->smart_speed == e1000_smart_speed_off) in igb_set_d0_lplu_state_82580()
1067 * igb_set_d3_lplu_state_82580 - Sets low power link up state for D3
1082 struct e1000_phy_info *phy = &hw->phy; in igb_set_d3_lplu_state_82580()
1094 if (phy->smart_speed == e1000_smart_speed_on) in igb_set_d3_lplu_state_82580()
1096 else if (phy->smart_speed == e1000_smart_speed_off) in igb_set_d3_lplu_state_82580()
1098 } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) || in igb_set_d3_lplu_state_82580()
1099 (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || in igb_set_d3_lplu_state_82580()
1100 (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { in igb_set_d3_lplu_state_82580()
1111 * igb_acquire_nvm_82575 - Request for access to EEPROM
1117 * EEPROM access and return -E1000_ERR_NVM (-1).
1123 ret_val = hw->mac.ops.acquire_swfw_sync(hw, E1000_SWFW_EEP_SM); in igb_acquire_nvm_82575()
1125 goto out; in igb_acquire_nvm_82575()
1130 hw->mac.ops.release_swfw_sync(hw, E1000_SWFW_EEP_SM); in igb_acquire_nvm_82575()
1132 out: in igb_acquire_nvm_82575()
1137 * igb_release_nvm_82575 - Release exclusive access to EEPROM
1146 hw->mac.ops.release_swfw_sync(hw, E1000_SWFW_EEP_SM); in igb_release_nvm_82575()
1150 * igb_acquire_swfw_sync_82575 - Acquire SW/FW semaphore
1167 ret_val = -E1000_ERR_SWFW_SYNC; in igb_acquire_swfw_sync_82575()
1168 goto out; in igb_acquire_swfw_sync_82575()
1185 ret_val = -E1000_ERR_SWFW_SYNC; in igb_acquire_swfw_sync_82575()
1186 goto out; in igb_acquire_swfw_sync_82575()
1194 out: in igb_acquire_swfw_sync_82575()
1199 * igb_release_swfw_sync_82575 - Release SW/FW semaphore
1221 * igb_get_cfg_done_82575 - Read config done bit
1224 * Read the management control register for the config done bit for
1225 * completion status. NOTE: silicon which is EEPROM-less will fail trying
1226 * to read the config done bit, so an error is *ONLY* logged and returns
1227 * 0. If we were to return with error, EEPROM-less silicon
1235 if (hw->bus.func == 1) in igb_get_cfg_done_82575()
1237 else if (hw->bus.func == E1000_FUNC_2) in igb_get_cfg_done_82575()
1239 else if (hw->bus.func == E1000_FUNC_3) in igb_get_cfg_done_82575()
1246 timeout--; in igb_get_cfg_done_82575()
1253 (hw->phy.type == e1000_phy_igp_3)) in igb_get_cfg_done_82575()
1260 * igb_get_link_up_info_82575 - Get link speed/duplex info
1274 if (hw->phy.media_type != e1000_media_type_copper) in igb_get_link_up_info_82575()
1285 * igb_check_for_link_82575 - Check for link
1296 if (hw->phy.media_type != e1000_media_type_copper) { in igb_check_for_link_82575()
1303 hw->mac.get_link_status = !hw->mac.serdes_has_link; in igb_check_for_link_82575()
1305 /* Configure Flow Control now that Auto-Neg has completed. in igb_check_for_link_82575()
1307 * settings because we may have had to re-autoneg with a in igb_check_for_link_82575()
1321 * igb_power_up_serdes_link_82575 - Power up the serdes link after shutdown
1329 if ((hw->phy.media_type != e1000_media_type_internal_serdes) && in igb_power_up_serdes_link_82575()
1349 * igb_get_pcs_speed_and_duplex_82575 - Retrieve current speed/duplex
1354 * Using the physical coding sub-layer (PCS), retrieve the current speed and
1360 struct e1000_mac_info *mac = &hw->mac; in igb_get_pcs_speed_and_duplex_82575()
1364 mac->serdes_has_link = false; in igb_get_pcs_speed_and_duplex_82575()
1368 /* Read the PCS Status register for link state. For non-copper mode, in igb_get_pcs_speed_and_duplex_82575()
1379 mac->serdes_has_link = true; in igb_get_pcs_speed_and_duplex_82575()
1396 if (mac->type == e1000_i354) { in igb_get_pcs_speed_and_duplex_82575()
1413 * igb_shutdown_serdes_link_82575 - Remove link during power down
1423 if (hw->phy.media_type != e1000_media_type_internal_serdes && in igb_shutdown_serdes_link_82575()
1445 * igb_reset_hw_82575 - Reset hardware
1456 /* Prevent the PCI-E bus from sticking if there is no TLP connection in igb_reset_hw_82575()
1457 * on the last TLP read/write transaction when MAC is reset. in igb_reset_hw_82575()
1461 hw_dbg("PCI-E Master disable polling has failed.\n"); in igb_reset_hw_82575()
1466 hw_dbg("PCI-E Set completion timeout has failed.\n"); in igb_reset_hw_82575()
1484 /* When auto config read does not complete, do not in igb_reset_hw_82575()
1488 hw_dbg("Auto Read Done did not complete\n"); in igb_reset_hw_82575()
1506 * igb_init_hw_82575 - Initialize hardware
1513 struct e1000_mac_info *mac = &hw->mac; in igb_init_hw_82575()
1515 u16 i, rar_count = mac->rar_entry_count; in igb_init_hw_82575()
1517 if ((hw->mac.type >= e1000_i210) && in igb_init_hw_82575()
1538 /* Zero out the Multicast HASH table */ in igb_init_hw_82575()
1540 for (i = 0; i < mac->mta_reg_count; i++) in igb_init_hw_82575()
1543 /* Zero out the Unicast HASH table */ in igb_init_hw_82575()
1545 for (i = 0; i < mac->uta_reg_count; i++) in igb_init_hw_82575()
1551 /* Clear all of the statistics registers (clear on read). It is in igb_init_hw_82575()
1561 * igb_setup_copper_link_82575 - Configure copper link settings
1564 * Configures the link for auto-neg or forced speed and duplex. Then we check
1580 switch (hw->mac.type) { in igb_setup_copper_link_82575()
1595 goto out; in igb_setup_copper_link_82575()
1597 if (igb_sgmii_active_82575(hw) && !hw->phy.reset_disable) { in igb_setup_copper_link_82575()
1601 ret_val = hw->phy.ops.reset(hw); in igb_setup_copper_link_82575()
1604 goto out; in igb_setup_copper_link_82575()
1607 switch (hw->phy.type) { in igb_setup_copper_link_82575()
1610 switch (hw->phy.id) { in igb_setup_copper_link_82575()
1633 ret_val = -E1000_ERR_PHY; in igb_setup_copper_link_82575()
1638 goto out; in igb_setup_copper_link_82575()
1641 out: in igb_setup_copper_link_82575()
1646 * igb_setup_serdes_link_82575 - Setup link for serdes
1649 * Configure the physical coding sub-layer (PCS) link. The PCS link is
1652 * for auto-negotiation or forces speed/duplex.
1661 if ((hw->phy.media_type != e1000_media_type_internal_serdes) && in igb_setup_serdes_link_82575()
1667 * explicitly turned off or a power cycle is performed. A read to in igb_setup_serdes_link_82575()
1682 if (hw->mac.type == e1000_82575 || hw->mac.type == e1000_82576) { in igb_setup_serdes_link_82575()
1695 pcs_autoneg = hw->mac.autoneg; in igb_setup_serdes_link_82575()
1701 /* autoneg time out should be disabled for SGMII mode */ in igb_setup_serdes_link_82575()
1709 if (hw->mac.type == e1000_82575 || in igb_setup_serdes_link_82575()
1710 hw->mac.type == e1000_82576) { in igb_setup_serdes_link_82575()
1711 ret_val = hw->nvm.ops.read(hw, NVM_COMPAT, 1, &data); in igb_setup_serdes_link_82575()
1713 hw_dbg(KERN_DEBUG "NVM Read Error\n\n"); in igb_setup_serdes_link_82575()
1721 /* non-SGMII modes only supports a speed of 1000/Full for the in igb_setup_serdes_link_82575()
1754 switch (hw->fc.requested_mode) { in igb_setup_serdes_link_82575()
1788 * igb_sgmii_active_82575 - Return sgmii state
1797 struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; in igb_sgmii_active_82575()
1798 return dev_spec->sgmii_active; in igb_sgmii_active_82575()
1802 * igb_reset_init_script_82575 - Inits HW defaults after reset
1810 if (hw->mac.type == e1000_82575) { in igb_reset_init_script_82575()
1838 * igb_read_mac_addr_82575 - Read device MAC address
1851 goto out; in igb_read_mac_addr_82575()
1855 out: in igb_read_mac_addr_82575()
1860 * igb_power_down_phy_copper_82575 - Remove link during PHY power down
1874 * igb_clear_hw_cntrs_82575 - Clear device specific hardware counters
1930 /* This register should not be read in copper configurations */ in igb_clear_hw_cntrs_82575()
1931 if (hw->phy.media_type == e1000_media_type_internal_serdes || in igb_clear_hw_cntrs_82575()
1937 * igb_rx_fifo_flush_82575 - Clean rx fifo after RX enable
1955 if (hw->mac.type != e1000_82575 || in igb_rx_fifo_flush_82575()
1976 hw_dbg("Queue disable timed out after 10ms\n"); in igb_rx_fifo_flush_82575()
2014 * igb_set_pcie_completion_timeout - set pci-e completion timeout
2019 * than the 10ms recommended by the pci-e spec. To address this we need to
2031 goto out; in igb_set_pcie_completion_timeout()
2038 goto out; in igb_set_pcie_completion_timeout()
2048 goto out; in igb_set_pcie_completion_timeout()
2054 out: in igb_set_pcie_completion_timeout()
2063 * igb_vmdq_set_anti_spoofing_pf - enable or disable anti-spoofing
2066 * @pf: Physical Function pool - do not set anti-spoofing for the PF
2068 * enables/disables L2 switch anti-spoofing functionality.
2074 switch (hw->mac.type) { in igb_vmdq_set_anti_spoofing_pf()
2090 /* The PF can spoof - it has to in order to in igb_vmdq_set_anti_spoofing_pf()
2102 * igb_vmdq_set_loopback_pf - enable or disable vmdq loopback
2112 switch (hw->mac.type) { in igb_vmdq_set_loopback_pf()
2138 * igb_vmdq_set_replication_pf - enable or disable vmdq replication
2157 * igb_read_phy_reg_82580 - Read 82580 MDI control register
2159 * @offset: register offset to be read
2160 * @data: pointer to the read data
2163 * information read to data.
2169 ret_val = hw->phy.ops.acquire(hw); in igb_read_phy_reg_82580()
2171 goto out; in igb_read_phy_reg_82580()
2175 hw->phy.ops.release(hw); in igb_read_phy_reg_82580()
2177 out: in igb_read_phy_reg_82580()
2182 * igb_write_phy_reg_82580 - Write 82580 MDI control register
2194 ret_val = hw->phy.ops.acquire(hw); in igb_write_phy_reg_82580()
2196 goto out; in igb_write_phy_reg_82580()
2200 hw->phy.ops.release(hw); in igb_write_phy_reg_82580()
2202 out: in igb_write_phy_reg_82580()
2207 * igb_reset_mdicnfg_82580 - Reset MDICNFG destination and com_mdio bits
2220 if (hw->mac.type != e1000_82580) in igb_reset_mdicnfg_82580()
2221 goto out; in igb_reset_mdicnfg_82580()
2223 goto out; in igb_reset_mdicnfg_82580()
2225 ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A + in igb_reset_mdicnfg_82580()
2226 NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1, in igb_reset_mdicnfg_82580()
2229 hw_dbg("NVM Read Error\n"); in igb_reset_mdicnfg_82580()
2230 goto out; in igb_reset_mdicnfg_82580()
2239 out: in igb_reset_mdicnfg_82580()
2244 * igb_reset_hw_82580 - Reset hardware
2256 bool global_device_reset = hw->dev_spec._82575.global_device_reset; in igb_reset_hw_82580()
2258 hw->dev_spec._82575.global_device_reset = false; in igb_reset_hw_82580()
2263 if (hw->mac.type == e1000_82580) in igb_reset_hw_82580()
2269 /* Prevent the PCI-E bus from sticking if there is no TLP connection in igb_reset_hw_82580()
2270 * on the last TLP read/write transaction when MAC is reset. in igb_reset_hw_82580()
2274 hw_dbg("PCI-E Master disable polling has failed.\n"); in igb_reset_hw_82580()
2286 hw->mac.ops.acquire_swfw_sync(hw, swmbsw_mask)) in igb_reset_hw_82580()
2304 /* When auto config read does not complete, do not in igb_reset_hw_82580()
2308 hw_dbg("Auto Read Done did not complete\n"); in igb_reset_hw_82580()
2327 hw->mac.ops.release_swfw_sync(hw, swmbsw_mask); in igb_reset_hw_82580()
2333 * igb_rxpbs_adjust_82580 - adjust RXPBS value to reflect actual RX PBA size
2353 * igb_validate_nvm_checksum_with_offset - Validate EEPROM
2369 ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data); in igb_validate_nvm_checksum_with_offset()
2371 hw_dbg("NVM Read Error\n"); in igb_validate_nvm_checksum_with_offset()
2372 goto out; in igb_validate_nvm_checksum_with_offset()
2379 ret_val = -E1000_ERR_NVM; in igb_validate_nvm_checksum_with_offset()
2380 goto out; in igb_validate_nvm_checksum_with_offset()
2383 out: in igb_validate_nvm_checksum_with_offset()
2388 * igb_update_nvm_checksum_with_offset - Update EEPROM
2404 ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data); in igb_update_nvm_checksum_with_offset()
2406 hw_dbg("NVM Read Error while updating checksum.\n"); in igb_update_nvm_checksum_with_offset()
2407 goto out; in igb_update_nvm_checksum_with_offset()
2411 checksum = (u16) NVM_SUM - checksum; in igb_update_nvm_checksum_with_offset()
2412 ret_val = hw->nvm.ops.write(hw, (NVM_CHECKSUM_REG + offset), 1, in igb_update_nvm_checksum_with_offset()
2417 out: in igb_update_nvm_checksum_with_offset()
2422 * igb_validate_nvm_checksum_82580 - Validate EEPROM checksum
2436 ret_val = hw->nvm.ops.read(hw, NVM_COMPATIBILITY_REG_3, 1, &nvm_data); in igb_validate_nvm_checksum_82580()
2438 hw_dbg("NVM Read Error\n"); in igb_validate_nvm_checksum_82580()
2439 goto out; in igb_validate_nvm_checksum_82580()
2454 goto out; in igb_validate_nvm_checksum_82580()
2457 out: in igb_validate_nvm_checksum_82580()
2462 * igb_update_nvm_checksum_82580 - Update EEPROM checksum
2475 ret_val = hw->nvm.ops.read(hw, NVM_COMPATIBILITY_REG_3, 1, &nvm_data); in igb_update_nvm_checksum_82580()
2477 hw_dbg("NVM Read Error while updating checksum compatibility bit.\n"); in igb_update_nvm_checksum_82580()
2478 goto out; in igb_update_nvm_checksum_82580()
2484 ret_val = hw->nvm.ops.write(hw, NVM_COMPATIBILITY_REG_3, 1, in igb_update_nvm_checksum_82580()
2488 goto out; in igb_update_nvm_checksum_82580()
2496 goto out; in igb_update_nvm_checksum_82580()
2499 out: in igb_update_nvm_checksum_82580()
2504 * igb_validate_nvm_checksum_i350 - Validate EEPROM checksum
2522 goto out; in igb_validate_nvm_checksum_i350()
2525 out: in igb_validate_nvm_checksum_i350()
2530 * igb_update_nvm_checksum_i350 - Update EEPROM checksum
2547 goto out; in igb_update_nvm_checksum_i350()
2550 out: in igb_update_nvm_checksum_i350()
2555 * __igb_access_emi_reg - Read/write EMI register
2558 * @data: pointer to value to read/write from/to the EMI address
2559 * @read: boolean flag to indicate read or write
2562 u16 *data, bool read) in __igb_access_emi_reg() argument
2566 ret_val = hw->phy.ops.write_reg(hw, E1000_EMIADD, address); in __igb_access_emi_reg()
2570 if (read) in __igb_access_emi_reg()
2571 ret_val = hw->phy.ops.read_reg(hw, E1000_EMIDATA, data); in __igb_access_emi_reg()
2573 ret_val = hw->phy.ops.write_reg(hw, E1000_EMIDATA, *data); in __igb_access_emi_reg()
2579 * igb_read_emi_reg - Read Extended Management Interface register
2582 * @data: value to be read from the EMI address
2590 * igb_set_eee_i350 - Enable/disable EEE support
2602 if ((hw->mac.type < e1000_i350) || in igb_set_eee_i350()
2603 (hw->phy.media_type != e1000_media_type_copper)) in igb_set_eee_i350()
2604 goto out; in igb_set_eee_i350()
2609 if (!(hw->dev_spec._82575.eee_disable)) { in igb_set_eee_i350()
2640 out: in igb_set_eee_i350()
2646 * igb_set_eee_i354 - Enable/disable EEE support
2656 struct e1000_phy_info *phy = &hw->phy; in igb_set_eee_i354()
2660 if ((hw->phy.media_type != e1000_media_type_copper) || in igb_set_eee_i354()
2661 ((phy->id != M88E1543_E_PHY_ID) && in igb_set_eee_i354()
2662 (phy->id != M88E1512_E_PHY_ID))) in igb_set_eee_i354()
2663 goto out; in igb_set_eee_i354()
2665 if (!hw->dev_spec._82575.eee_disable) { in igb_set_eee_i354()
2667 ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 18); in igb_set_eee_i354()
2669 goto out; in igb_set_eee_i354()
2671 ret_val = phy->ops.read_reg(hw, E1000_M88E1543_EEE_CTRL_1, in igb_set_eee_i354()
2674 goto out; in igb_set_eee_i354()
2677 ret_val = phy->ops.write_reg(hw, E1000_M88E1543_EEE_CTRL_1, in igb_set_eee_i354()
2680 goto out; in igb_set_eee_i354()
2683 ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 0); in igb_set_eee_i354()
2685 goto out; in igb_set_eee_i354()
2692 goto out; in igb_set_eee_i354()
2713 goto out; in igb_set_eee_i354()
2722 out: in igb_set_eee_i354()
2727 * igb_get_eee_status_i354 - Get EEE status
2736 struct e1000_phy_info *phy = &hw->phy; in igb_get_eee_status_i354()
2741 if ((hw->phy.media_type != e1000_media_type_copper) || in igb_get_eee_status_i354()
2742 ((phy->id != M88E1543_E_PHY_ID) && in igb_get_eee_status_i354()
2743 (phy->id != M88E1512_E_PHY_ID))) in igb_get_eee_status_i354()
2744 goto out; in igb_get_eee_status_i354()
2750 goto out; in igb_get_eee_status_i354()
2755 out: in igb_get_eee_status_i354()
2774 * igb_get_thermal_sensor_data_generic - Gathers thermal sensor data
2788 struct e1000_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; in igb_get_thermal_sensor_data_generic()
2790 if ((hw->mac.type != e1000_i350) || (hw->bus.func != 0)) in igb_get_thermal_sensor_data_generic()
2793 data->sensor[0].temp = (rd32(E1000_THMJT) & 0xFF); in igb_get_thermal_sensor_data_generic()
2796 hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_offset); in igb_get_thermal_sensor_data_generic()
2800 hw->nvm.ops.read(hw, ets_offset, 1, &ets_cfg); in igb_get_thermal_sensor_data_generic()
2810 hw->nvm.ops.read(hw, (ets_offset + i), 1, &ets_sensor); in igb_get_thermal_sensor_data_generic()
2817 hw->phy.ops.read_i2c_byte(hw, in igb_get_thermal_sensor_data_generic()
2820 &data->sensor[i].temp); in igb_get_thermal_sensor_data_generic()
2826 * igb_init_thermal_sensor_thresh_generic - Sets thermal sensor thresholds
2843 struct e1000_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; in igb_init_thermal_sensor_thresh_generic()
2845 if ((hw->mac.type != e1000_i350) || (hw->bus.func != 0)) in igb_init_thermal_sensor_thresh_generic()
2850 data->sensor[0].location = 0x1; in igb_init_thermal_sensor_thresh_generic()
2851 data->sensor[0].caution_thresh = in igb_init_thermal_sensor_thresh_generic()
2853 data->sensor[0].max_op_thresh = in igb_init_thermal_sensor_thresh_generic()
2857 hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_offset); in igb_init_thermal_sensor_thresh_generic()
2861 hw->nvm.ops.read(hw, ets_offset, 1, &ets_cfg); in igb_init_thermal_sensor_thresh_generic()
2871 hw->nvm.ops.read(hw, (ets_offset + i), 1, &ets_sensor); in igb_init_thermal_sensor_thresh_generic()
2878 hw->phy.ops.write_i2c_byte(hw, in igb_init_thermal_sensor_thresh_generic()
2884 data->sensor[i].location = sensor_location; in igb_init_thermal_sensor_thresh_generic()
2885 data->sensor[i].caution_thresh = therm_limit; in igb_init_thermal_sensor_thresh_generic()
2886 data->sensor[i].max_op_thresh = therm_limit - in igb_init_thermal_sensor_thresh_generic()
2916 .read = igb_read_nvm_eerd,