fp@2324: /******************************************************************************* fp@2324: fp@2324: Intel PRO/1000 Linux driver fp@2324: Copyright(c) 1999 - 2009 Intel Corporation. fp@2324: fp@2324: This program is free software; you can redistribute it and/or modify it fp@2324: under the terms and conditions of the GNU General Public License, fp@2324: version 2, as published by the Free Software Foundation. fp@2324: fp@2324: This program is distributed in the hope it will be useful, but WITHOUT fp@2324: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or fp@2324: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for fp@2324: more details. fp@2324: fp@2324: You should have received a copy of the GNU General Public License along with fp@2324: this program; if not, write to the Free Software Foundation, Inc., fp@2324: 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. fp@2324: fp@2324: The full GNU General Public License is included in this distribution in fp@2324: the file called "COPYING". fp@2324: fp@2324: Contact Information: fp@2324: Linux NICS fp@2324: e1000-devel Mailing List fp@2324: Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 fp@2324: fp@2324: *******************************************************************************/ fp@2324: fp@2324: /* fp@2324: * 82571EB Gigabit Ethernet Controller fp@2324: * 82571EB Gigabit Ethernet Controller (Copper) fp@2324: * 82571EB Gigabit Ethernet Controller (Fiber) fp@2324: * 82571EB Dual Port Gigabit Mezzanine Adapter fp@2324: * 82571EB Quad Port Gigabit Mezzanine Adapter fp@2324: * 82571PT Gigabit PT Quad Port Server ExpressModule fp@2324: * 82572EI Gigabit Ethernet Controller (Copper) fp@2324: * 82572EI Gigabit Ethernet Controller (Fiber) fp@2324: * 82572EI Gigabit Ethernet Controller fp@2324: * 82573V Gigabit Ethernet Controller (Copper) fp@2324: * 82573E Gigabit Ethernet Controller (Copper) fp@2324: * 82573L Gigabit Ethernet Controller fp@2324: * 82574L Gigabit Network Connection fp@2324: * 82583V Gigabit Network Connection fp@2324: */ fp@2324: fp@2324: #include "e1000-2.6.33-ethercat.h" fp@2324: fp@2324: #define ID_LED_RESERVED_F746 0xF746 fp@2324: #define ID_LED_DEFAULT_82573 ((ID_LED_DEF1_DEF2 << 12) | \ fp@2324: (ID_LED_OFF1_ON2 << 8) | \ fp@2324: (ID_LED_DEF1_DEF2 << 4) | \ fp@2324: (ID_LED_DEF1_DEF2)) fp@2324: fp@2324: #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 fp@2324: fp@2324: #define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */ fp@2324: fp@2324: static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); fp@2324: static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw); fp@2324: static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw); fp@2324: static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw); fp@2324: static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, fp@2324: u16 words, u16 *data); fp@2324: static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw); fp@2324: static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); fp@2324: static s32 e1000_setup_link_82571(struct e1000_hw *hw); fp@2324: static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); fp@2324: static void e1000_clear_vfta_82571(struct e1000_hw *hw); fp@2324: static bool e1000_check_mng_mode_82574(struct e1000_hw *hw); fp@2324: static s32 e1000_led_on_82574(struct e1000_hw *hw); fp@2324: static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); fp@2324: static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw); fp@2324: fp@2324: /** fp@2324: * e1000_init_phy_params_82571 - Init PHY func ptrs. fp@2324: * @hw: pointer to the HW structure fp@2324: **/ fp@2324: static s32 e1000_init_phy_params_82571(struct e1000_hw *hw) fp@2324: { fp@2324: struct e1000_phy_info *phy = &hw->phy; fp@2324: s32 ret_val; fp@2324: fp@2324: if (hw->phy.media_type != e1000_media_type_copper) { fp@2324: phy->type = e1000_phy_none; fp@2324: return 0; fp@2324: } fp@2324: fp@2324: phy->addr = 1; fp@2324: phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; fp@2324: phy->reset_delay_us = 100; fp@2324: fp@2324: phy->ops.power_up = e1000_power_up_phy_copper; fp@2324: phy->ops.power_down = e1000_power_down_phy_copper_82571; fp@2324: fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82571: fp@2324: case e1000_82572: fp@2324: phy->type = e1000_phy_igp_2; fp@2324: break; fp@2324: case e1000_82573: fp@2324: phy->type = e1000_phy_m88; fp@2324: break; fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: phy->type = e1000_phy_bm; fp@2324: break; fp@2324: default: fp@2324: return -E1000_ERR_PHY; fp@2324: break; fp@2324: } fp@2324: fp@2324: /* This can only be done after all function pointers are setup. */ fp@2324: ret_val = e1000_get_phy_id_82571(hw); fp@2324: fp@2324: /* Verify phy id */ fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82571: fp@2324: case e1000_82572: fp@2324: if (phy->id != IGP01E1000_I_PHY_ID) fp@2324: return -E1000_ERR_PHY; fp@2324: break; fp@2324: case e1000_82573: fp@2324: if (phy->id != M88E1111_I_PHY_ID) fp@2324: return -E1000_ERR_PHY; fp@2324: break; fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: if (phy->id != BME1000_E_PHY_ID_R2) fp@2324: return -E1000_ERR_PHY; fp@2324: break; fp@2324: default: fp@2324: return -E1000_ERR_PHY; fp@2324: break; fp@2324: } fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_init_nvm_params_82571 - Init NVM func ptrs. fp@2324: * @hw: pointer to the HW structure fp@2324: **/ fp@2324: static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) fp@2324: { fp@2324: struct e1000_nvm_info *nvm = &hw->nvm; fp@2324: u32 eecd = er32(EECD); fp@2324: u16 size; fp@2324: fp@2324: nvm->opcode_bits = 8; fp@2324: nvm->delay_usec = 1; fp@2324: switch (nvm->override) { fp@2324: case e1000_nvm_override_spi_large: fp@2324: nvm->page_size = 32; fp@2324: nvm->address_bits = 16; fp@2324: break; fp@2324: case e1000_nvm_override_spi_small: fp@2324: nvm->page_size = 8; fp@2324: nvm->address_bits = 8; fp@2324: break; fp@2324: default: fp@2324: nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; fp@2324: nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8; fp@2324: break; fp@2324: } fp@2324: fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: if (((eecd >> 15) & 0x3) == 0x3) { fp@2324: nvm->type = e1000_nvm_flash_hw; fp@2324: nvm->word_size = 2048; fp@2324: /* fp@2324: * Autonomous Flash update bit must be cleared due fp@2324: * to Flash update issue. fp@2324: */ fp@2324: eecd &= ~E1000_EECD_AUPDEN; fp@2324: ew32(EECD, eecd); fp@2324: break; fp@2324: } fp@2324: /* Fall Through */ fp@2324: default: fp@2324: nvm->type = e1000_nvm_eeprom_spi; fp@2324: size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> fp@2324: E1000_EECD_SIZE_EX_SHIFT); fp@2324: /* fp@2324: * Added to a constant, "size" becomes the left-shift value fp@2324: * for setting word_size. fp@2324: */ fp@2324: size += NVM_WORD_SIZE_BASE_SHIFT; fp@2324: fp@2324: /* EEPROM access above 16k is unsupported */ fp@2324: if (size > 14) fp@2324: size = 14; fp@2324: nvm->word_size = 1 << size; fp@2324: break; fp@2324: } fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_init_mac_params_82571 - Init MAC func ptrs. fp@2324: * @hw: pointer to the HW structure fp@2324: **/ fp@2324: static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter) fp@2324: { fp@2324: struct e1000_hw *hw = &adapter->hw; fp@2324: struct e1000_mac_info *mac = &hw->mac; fp@2324: struct e1000_mac_operations *func = &mac->ops; fp@2324: u32 swsm = 0; fp@2324: u32 swsm2 = 0; fp@2324: bool force_clear_smbi = false; fp@2324: fp@2324: /* Set media type */ fp@2324: switch (adapter->pdev->device) { fp@2324: case E1000_DEV_ID_82571EB_FIBER: fp@2324: case E1000_DEV_ID_82572EI_FIBER: fp@2324: case E1000_DEV_ID_82571EB_QUAD_FIBER: fp@2324: hw->phy.media_type = e1000_media_type_fiber; fp@2324: break; fp@2324: case E1000_DEV_ID_82571EB_SERDES: fp@2324: case E1000_DEV_ID_82572EI_SERDES: fp@2324: case E1000_DEV_ID_82571EB_SERDES_DUAL: fp@2324: case E1000_DEV_ID_82571EB_SERDES_QUAD: fp@2324: hw->phy.media_type = e1000_media_type_internal_serdes; fp@2324: break; fp@2324: default: fp@2324: hw->phy.media_type = e1000_media_type_copper; fp@2324: break; fp@2324: } fp@2324: fp@2324: /* Set mta register count */ fp@2324: mac->mta_reg_count = 128; fp@2324: /* Set rar entry count */ fp@2324: mac->rar_entry_count = E1000_RAR_ENTRIES; fp@2324: /* Set if manageability features are enabled. */ fp@2324: mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) fp@2324: ? true : false; fp@2324: /* Adaptive IFS supported */ fp@2324: mac->adaptive_ifs = true; fp@2324: fp@2324: /* check for link */ fp@2324: switch (hw->phy.media_type) { fp@2324: case e1000_media_type_copper: fp@2324: func->setup_physical_interface = e1000_setup_copper_link_82571; fp@2324: func->check_for_link = e1000e_check_for_copper_link; fp@2324: func->get_link_up_info = e1000e_get_speed_and_duplex_copper; fp@2324: break; fp@2324: case e1000_media_type_fiber: fp@2324: func->setup_physical_interface = fp@2324: e1000_setup_fiber_serdes_link_82571; fp@2324: func->check_for_link = e1000e_check_for_fiber_link; fp@2324: func->get_link_up_info = fp@2324: e1000e_get_speed_and_duplex_fiber_serdes; fp@2324: break; fp@2324: case e1000_media_type_internal_serdes: fp@2324: func->setup_physical_interface = fp@2324: e1000_setup_fiber_serdes_link_82571; fp@2324: func->check_for_link = e1000_check_for_serdes_link_82571; fp@2324: func->get_link_up_info = fp@2324: e1000e_get_speed_and_duplex_fiber_serdes; fp@2324: break; fp@2324: default: fp@2324: return -E1000_ERR_CONFIG; fp@2324: break; fp@2324: } fp@2324: fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: func->check_mng_mode = e1000_check_mng_mode_82574; fp@2324: func->led_on = e1000_led_on_82574; fp@2324: break; fp@2324: default: fp@2324: func->check_mng_mode = e1000e_check_mng_mode_generic; fp@2324: func->led_on = e1000e_led_on_generic; fp@2324: break; fp@2324: } fp@2324: fp@2324: /* fp@2324: * Ensure that the inter-port SWSM.SMBI lock bit is clear before fp@2324: * first NVM or PHY acess. This should be done for single-port fp@2324: * devices, and for one port only on dual-port devices so that fp@2324: * for those devices we can still use the SMBI lock to synchronize fp@2324: * inter-port accesses to the PHY & NVM. fp@2324: */ fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82571: fp@2324: case e1000_82572: fp@2324: swsm2 = er32(SWSM2); fp@2324: fp@2324: if (!(swsm2 & E1000_SWSM2_LOCK)) { fp@2324: /* Only do this for the first interface on this card */ fp@2324: ew32(SWSM2, fp@2324: swsm2 | E1000_SWSM2_LOCK); fp@2324: force_clear_smbi = true; fp@2324: } else fp@2324: force_clear_smbi = false; fp@2324: break; fp@2324: default: fp@2324: force_clear_smbi = true; fp@2324: break; fp@2324: } fp@2324: fp@2324: if (force_clear_smbi) { fp@2324: /* Make sure SWSM.SMBI is clear */ fp@2324: swsm = er32(SWSM); fp@2324: if (swsm & E1000_SWSM_SMBI) { fp@2324: /* This bit should not be set on a first interface, and fp@2324: * indicates that the bootagent or EFI code has fp@2324: * improperly left this bit enabled fp@2324: */ fp@2324: e_dbg("Please update your 82571 Bootagent\n"); fp@2324: } fp@2324: ew32(SWSM, swsm & ~E1000_SWSM_SMBI); fp@2324: } fp@2324: fp@2324: /* fp@2324: * Initialze device specific counter of SMBI acquisition fp@2324: * timeouts. fp@2324: */ fp@2324: hw->dev_spec.e82571.smb_counter = 0; fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: static s32 e1000_get_variants_82571(struct e1000_adapter *adapter) fp@2324: { fp@2324: struct e1000_hw *hw = &adapter->hw; fp@2324: static int global_quad_port_a; /* global port a indication */ fp@2324: struct pci_dev *pdev = adapter->pdev; fp@2324: u16 eeprom_data = 0; fp@2324: int is_port_b = er32(STATUS) & E1000_STATUS_FUNC_1; fp@2324: s32 rc; fp@2324: fp@2324: rc = e1000_init_mac_params_82571(adapter); fp@2324: if (rc) fp@2324: return rc; fp@2324: fp@2324: rc = e1000_init_nvm_params_82571(hw); fp@2324: if (rc) fp@2324: return rc; fp@2324: fp@2324: rc = e1000_init_phy_params_82571(hw); fp@2324: if (rc) fp@2324: return rc; fp@2324: fp@2324: /* tag quad port adapters first, it's used below */ fp@2324: switch (pdev->device) { fp@2324: case E1000_DEV_ID_82571EB_QUAD_COPPER: fp@2324: case E1000_DEV_ID_82571EB_QUAD_FIBER: fp@2324: case E1000_DEV_ID_82571EB_QUAD_COPPER_LP: fp@2324: case E1000_DEV_ID_82571PT_QUAD_COPPER: fp@2324: adapter->flags |= FLAG_IS_QUAD_PORT; fp@2324: /* mark the first port */ fp@2324: if (global_quad_port_a == 0) fp@2324: adapter->flags |= FLAG_IS_QUAD_PORT_A; fp@2324: /* Reset for multiple quad port adapters */ fp@2324: global_quad_port_a++; fp@2324: if (global_quad_port_a == 4) fp@2324: global_quad_port_a = 0; fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: fp@2324: switch (adapter->hw.mac.type) { fp@2324: case e1000_82571: fp@2324: /* these dual ports don't have WoL on port B at all */ fp@2324: if (((pdev->device == E1000_DEV_ID_82571EB_FIBER) || fp@2324: (pdev->device == E1000_DEV_ID_82571EB_SERDES) || fp@2324: (pdev->device == E1000_DEV_ID_82571EB_COPPER)) && fp@2324: (is_port_b)) fp@2324: adapter->flags &= ~FLAG_HAS_WOL; fp@2324: /* quad ports only support WoL on port A */ fp@2324: if (adapter->flags & FLAG_IS_QUAD_PORT && fp@2324: (!(adapter->flags & FLAG_IS_QUAD_PORT_A))) fp@2324: adapter->flags &= ~FLAG_HAS_WOL; fp@2324: /* Does not support WoL on any port */ fp@2324: if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD) fp@2324: adapter->flags &= ~FLAG_HAS_WOL; fp@2324: break; fp@2324: fp@2324: case e1000_82573: fp@2324: if (pdev->device == E1000_DEV_ID_82573L) { fp@2324: if (e1000_read_nvm(&adapter->hw, NVM_INIT_3GIO_3, 1, fp@2324: &eeprom_data) < 0) fp@2324: break; fp@2324: if (!(eeprom_data & NVM_WORD1A_ASPM_MASK)) { fp@2324: adapter->flags |= FLAG_HAS_JUMBO_FRAMES; fp@2324: adapter->max_hw_frame_size = DEFAULT_JUMBO; fp@2324: } fp@2324: } fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_get_phy_id_82571 - Retrieve the PHY ID and revision fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Reads the PHY registers and stores the PHY ID and possibly the PHY fp@2324: * revision in the hardware structure. fp@2324: **/ fp@2324: static s32 e1000_get_phy_id_82571(struct e1000_hw *hw) fp@2324: { fp@2324: struct e1000_phy_info *phy = &hw->phy; fp@2324: s32 ret_val; fp@2324: u16 phy_id = 0; fp@2324: fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82571: fp@2324: case e1000_82572: fp@2324: /* fp@2324: * The 82571 firmware may still be configuring the PHY. fp@2324: * In this case, we cannot access the PHY until the fp@2324: * configuration is done. So we explicitly set the fp@2324: * PHY ID. fp@2324: */ fp@2324: phy->id = IGP01E1000_I_PHY_ID; fp@2324: break; fp@2324: case e1000_82573: fp@2324: return e1000e_get_phy_id(hw); fp@2324: break; fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: ret_val = e1e_rphy(hw, PHY_ID1, &phy_id); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: phy->id = (u32)(phy_id << 16); fp@2324: udelay(20); fp@2324: ret_val = e1e_rphy(hw, PHY_ID2, &phy_id); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: phy->id |= (u32)(phy_id); fp@2324: phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); fp@2324: break; fp@2324: default: fp@2324: return -E1000_ERR_PHY; fp@2324: break; fp@2324: } fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_get_hw_semaphore_82571 - Acquire hardware semaphore fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Acquire the HW semaphore to access the PHY or NVM fp@2324: **/ fp@2324: static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw) fp@2324: { fp@2324: u32 swsm; fp@2324: s32 sw_timeout = hw->nvm.word_size + 1; fp@2324: s32 fw_timeout = hw->nvm.word_size + 1; fp@2324: s32 i = 0; fp@2324: fp@2324: /* fp@2324: * If we have timedout 3 times on trying to acquire fp@2324: * the inter-port SMBI semaphore, there is old code fp@2324: * operating on the other port, and it is not fp@2324: * releasing SMBI. Modify the number of times that fp@2324: * we try for the semaphore to interwork with this fp@2324: * older code. fp@2324: */ fp@2324: if (hw->dev_spec.e82571.smb_counter > 2) fp@2324: sw_timeout = 1; fp@2324: fp@2324: /* Get the SW semaphore */ fp@2324: while (i < sw_timeout) { fp@2324: swsm = er32(SWSM); fp@2324: if (!(swsm & E1000_SWSM_SMBI)) fp@2324: break; fp@2324: fp@2324: udelay(50); fp@2324: i++; fp@2324: } fp@2324: fp@2324: if (i == sw_timeout) { fp@2324: e_dbg("Driver can't access device - SMBI bit is set.\n"); fp@2324: hw->dev_spec.e82571.smb_counter++; fp@2324: } fp@2324: /* Get the FW semaphore. */ fp@2324: for (i = 0; i < fw_timeout; i++) { fp@2324: swsm = er32(SWSM); fp@2324: ew32(SWSM, swsm | E1000_SWSM_SWESMBI); fp@2324: fp@2324: /* Semaphore acquired if bit latched */ fp@2324: if (er32(SWSM) & E1000_SWSM_SWESMBI) fp@2324: break; fp@2324: fp@2324: udelay(50); fp@2324: } fp@2324: fp@2324: if (i == fw_timeout) { fp@2324: /* Release semaphores */ fp@2324: e1000_put_hw_semaphore_82571(hw); fp@2324: e_dbg("Driver can't access the NVM\n"); fp@2324: return -E1000_ERR_NVM; fp@2324: } fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_put_hw_semaphore_82571 - Release hardware semaphore fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Release hardware semaphore used to access the PHY or NVM fp@2324: **/ fp@2324: static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw) fp@2324: { fp@2324: u32 swsm; fp@2324: fp@2324: swsm = er32(SWSM); fp@2324: swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); fp@2324: ew32(SWSM, swsm); fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_acquire_nvm_82571 - Request for access to the EEPROM fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * To gain access to the EEPROM, first we must obtain a hardware semaphore. fp@2324: * Then for non-82573 hardware, set the EEPROM access request bit and wait fp@2324: * for EEPROM access grant bit. If the access grant bit is not set, release fp@2324: * hardware semaphore. fp@2324: **/ fp@2324: static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw) fp@2324: { fp@2324: s32 ret_val; fp@2324: fp@2324: ret_val = e1000_get_hw_semaphore_82571(hw); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: break; fp@2324: default: fp@2324: ret_val = e1000e_acquire_nvm(hw); fp@2324: break; fp@2324: } fp@2324: fp@2324: if (ret_val) fp@2324: e1000_put_hw_semaphore_82571(hw); fp@2324: fp@2324: return ret_val; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_release_nvm_82571 - Release exclusive access to EEPROM fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Stop any current commands to the EEPROM and clear the EEPROM request bit. fp@2324: **/ fp@2324: static void e1000_release_nvm_82571(struct e1000_hw *hw) fp@2324: { fp@2324: e1000e_release_nvm(hw); fp@2324: e1000_put_hw_semaphore_82571(hw); fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_write_nvm_82571 - Write to EEPROM using appropriate interface fp@2324: * @hw: pointer to the HW structure fp@2324: * @offset: offset within the EEPROM to be written to fp@2324: * @words: number of words to write fp@2324: * @data: 16 bit word(s) to be written to the EEPROM fp@2324: * fp@2324: * For non-82573 silicon, write data to EEPROM at offset using SPI interface. fp@2324: * fp@2324: * If e1000e_update_nvm_checksum is not called after this function, the fp@2324: * EEPROM will most likely contain an invalid checksum. fp@2324: **/ fp@2324: static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words, fp@2324: u16 *data) fp@2324: { fp@2324: s32 ret_val; fp@2324: fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: ret_val = e1000_write_nvm_eewr_82571(hw, offset, words, data); fp@2324: break; fp@2324: case e1000_82571: fp@2324: case e1000_82572: fp@2324: ret_val = e1000e_write_nvm_spi(hw, offset, words, data); fp@2324: break; fp@2324: default: fp@2324: ret_val = -E1000_ERR_NVM; fp@2324: break; fp@2324: } fp@2324: fp@2324: return ret_val; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_update_nvm_checksum_82571 - Update EEPROM checksum fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Updates the EEPROM checksum by reading/adding each word of the EEPROM fp@2324: * up to the checksum. Then calculates the EEPROM checksum and writes the fp@2324: * value to the EEPROM. fp@2324: **/ fp@2324: static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw) fp@2324: { fp@2324: u32 eecd; fp@2324: s32 ret_val; fp@2324: u16 i; fp@2324: fp@2324: ret_val = e1000e_update_nvm_checksum_generic(hw); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: /* fp@2324: * If our nvm is an EEPROM, then we're done fp@2324: * otherwise, commit the checksum to the flash NVM. fp@2324: */ fp@2324: if (hw->nvm.type != e1000_nvm_flash_hw) fp@2324: return ret_val; fp@2324: fp@2324: /* Check for pending operations. */ fp@2324: for (i = 0; i < E1000_FLASH_UPDATES; i++) { fp@2324: msleep(1); fp@2324: if ((er32(EECD) & E1000_EECD_FLUPD) == 0) fp@2324: break; fp@2324: } fp@2324: fp@2324: if (i == E1000_FLASH_UPDATES) fp@2324: return -E1000_ERR_NVM; fp@2324: fp@2324: /* Reset the firmware if using STM opcode. */ fp@2324: if ((er32(FLOP) & 0xFF00) == E1000_STM_OPCODE) { fp@2324: /* fp@2324: * The enabling of and the actual reset must be done fp@2324: * in two write cycles. fp@2324: */ fp@2324: ew32(HICR, E1000_HICR_FW_RESET_ENABLE); fp@2324: e1e_flush(); fp@2324: ew32(HICR, E1000_HICR_FW_RESET); fp@2324: } fp@2324: fp@2324: /* Commit the write to flash */ fp@2324: eecd = er32(EECD) | E1000_EECD_FLUPD; fp@2324: ew32(EECD, eecd); fp@2324: fp@2324: for (i = 0; i < E1000_FLASH_UPDATES; i++) { fp@2324: msleep(1); fp@2324: if ((er32(EECD) & E1000_EECD_FLUPD) == 0) fp@2324: break; fp@2324: } fp@2324: fp@2324: if (i == E1000_FLASH_UPDATES) fp@2324: return -E1000_ERR_NVM; fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_validate_nvm_checksum_82571 - Validate EEPROM checksum fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Calculates the EEPROM checksum by reading/adding each word of the EEPROM fp@2324: * and then verifies that the sum of the EEPROM is equal to 0xBABA. fp@2324: **/ fp@2324: static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw) fp@2324: { fp@2324: if (hw->nvm.type == e1000_nvm_flash_hw) fp@2324: e1000_fix_nvm_checksum_82571(hw); fp@2324: fp@2324: return e1000e_validate_nvm_checksum_generic(hw); fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_write_nvm_eewr_82571 - Write to EEPROM for 82573 silicon fp@2324: * @hw: pointer to the HW structure fp@2324: * @offset: offset within the EEPROM to be written to fp@2324: * @words: number of words to write fp@2324: * @data: 16 bit word(s) to be written to the EEPROM fp@2324: * fp@2324: * After checking for invalid values, poll the EEPROM to ensure the previous fp@2324: * command has completed before trying to write the next word. After write fp@2324: * poll for completion. fp@2324: * fp@2324: * If e1000e_update_nvm_checksum is not called after this function, the fp@2324: * EEPROM will most likely contain an invalid checksum. fp@2324: **/ fp@2324: static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, fp@2324: u16 words, u16 *data) fp@2324: { fp@2324: struct e1000_nvm_info *nvm = &hw->nvm; fp@2324: u32 i, eewr = 0; fp@2324: s32 ret_val = 0; fp@2324: fp@2324: /* fp@2324: * A check for invalid values: offset too large, too many words, fp@2324: * and not enough words. fp@2324: */ fp@2324: if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || fp@2324: (words == 0)) { fp@2324: e_dbg("nvm parameter(s) out of bounds\n"); fp@2324: return -E1000_ERR_NVM; fp@2324: } fp@2324: fp@2324: for (i = 0; i < words; i++) { fp@2324: eewr = (data[i] << E1000_NVM_RW_REG_DATA) | fp@2324: ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) | fp@2324: E1000_NVM_RW_REG_START; fp@2324: fp@2324: ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE); fp@2324: if (ret_val) fp@2324: break; fp@2324: fp@2324: ew32(EEWR, eewr); fp@2324: fp@2324: ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE); fp@2324: if (ret_val) fp@2324: break; fp@2324: } fp@2324: fp@2324: return ret_val; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_get_cfg_done_82571 - Poll for configuration done fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Reads the management control register for the config done bit to be set. fp@2324: **/ fp@2324: static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw) fp@2324: { fp@2324: s32 timeout = PHY_CFG_TIMEOUT; fp@2324: fp@2324: while (timeout) { fp@2324: if (er32(EEMNGCTL) & fp@2324: E1000_NVM_CFG_DONE_PORT_0) fp@2324: break; fp@2324: msleep(1); fp@2324: timeout--; fp@2324: } fp@2324: if (!timeout) { fp@2324: e_dbg("MNG configuration cycle has not completed.\n"); fp@2324: return -E1000_ERR_RESET; fp@2324: } fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state fp@2324: * @hw: pointer to the HW structure fp@2324: * @active: true to enable LPLU, false to disable fp@2324: * fp@2324: * Sets the LPLU D0 state according to the active flag. When activating LPLU fp@2324: * this function also disables smart speed and vice versa. LPLU will not be fp@2324: * activated unless the device autonegotiation advertisement meets standards fp@2324: * of either 10 or 10/100 or 10/100/1000 at all duplexes. This is a function fp@2324: * pointer entry point only called by PHY setup routines. fp@2324: **/ fp@2324: static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) fp@2324: { fp@2324: struct e1000_phy_info *phy = &hw->phy; fp@2324: s32 ret_val; fp@2324: u16 data; fp@2324: fp@2324: ret_val = e1e_rphy(hw, IGP02E1000_PHY_POWER_MGMT, &data); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: if (active) { fp@2324: data |= IGP02E1000_PM_D0_LPLU; fp@2324: ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: /* When LPLU is enabled, we should disable SmartSpeed */ fp@2324: ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data); fp@2324: data &= ~IGP01E1000_PSCFR_SMART_SPEED; fp@2324: ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: } else { fp@2324: data &= ~IGP02E1000_PM_D0_LPLU; fp@2324: ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); fp@2324: /* fp@2324: * LPLU and SmartSpeed are mutually exclusive. LPLU is used fp@2324: * during Dx states where the power conservation is most fp@2324: * important. During driver activity we should enable fp@2324: * SmartSpeed, so performance is maintained. fp@2324: */ fp@2324: if (phy->smart_speed == e1000_smart_speed_on) { fp@2324: ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, fp@2324: &data); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: data |= IGP01E1000_PSCFR_SMART_SPEED; fp@2324: ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, fp@2324: data); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: } else if (phy->smart_speed == e1000_smart_speed_off) { fp@2324: ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, fp@2324: &data); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: data &= ~IGP01E1000_PSCFR_SMART_SPEED; fp@2324: ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, fp@2324: data); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: } fp@2324: } fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_reset_hw_82571 - Reset hardware fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * This resets the hardware into a known state. fp@2324: **/ fp@2324: static s32 e1000_reset_hw_82571(struct e1000_hw *hw) fp@2324: { fp@2324: u32 ctrl, extcnf_ctrl, ctrl_ext, icr; fp@2324: s32 ret_val; fp@2324: u16 i = 0; fp@2324: fp@2324: /* fp@2324: * Prevent the PCI-E bus from sticking if there is no TLP connection fp@2324: * on the last TLP read/write transaction when MAC is reset. fp@2324: */ fp@2324: ret_val = e1000e_disable_pcie_master(hw); fp@2324: if (ret_val) fp@2324: e_dbg("PCI-E Master disable polling has failed.\n"); fp@2324: fp@2324: e_dbg("Masking off all interrupts\n"); fp@2324: ew32(IMC, 0xffffffff); fp@2324: fp@2324: ew32(RCTL, 0); fp@2324: ew32(TCTL, E1000_TCTL_PSP); fp@2324: e1e_flush(); fp@2324: fp@2324: msleep(10); fp@2324: fp@2324: /* fp@2324: * Must acquire the MDIO ownership before MAC reset. fp@2324: * Ownership defaults to firmware after a reset. fp@2324: */ fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: extcnf_ctrl = er32(EXTCNF_CTRL); fp@2324: extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; fp@2324: fp@2324: do { fp@2324: ew32(EXTCNF_CTRL, extcnf_ctrl); fp@2324: extcnf_ctrl = er32(EXTCNF_CTRL); fp@2324: fp@2324: if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP) fp@2324: break; fp@2324: fp@2324: extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; fp@2324: fp@2324: msleep(2); fp@2324: i++; fp@2324: } while (i < MDIO_OWNERSHIP_TIMEOUT); fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: fp@2324: ctrl = er32(CTRL); fp@2324: fp@2324: e_dbg("Issuing a global reset to MAC\n"); fp@2324: ew32(CTRL, ctrl | E1000_CTRL_RST); fp@2324: fp@2324: if (hw->nvm.type == e1000_nvm_flash_hw) { fp@2324: udelay(10); fp@2324: ctrl_ext = er32(CTRL_EXT); fp@2324: ctrl_ext |= E1000_CTRL_EXT_EE_RST; fp@2324: ew32(CTRL_EXT, ctrl_ext); fp@2324: e1e_flush(); fp@2324: } fp@2324: fp@2324: ret_val = e1000e_get_auto_rd_done(hw); fp@2324: if (ret_val) fp@2324: /* We don't want to continue accessing MAC registers. */ fp@2324: return ret_val; fp@2324: fp@2324: /* fp@2324: * Phy configuration from NVM just starts after EECD_AUTO_RD is set. fp@2324: * Need to wait for Phy configuration completion before accessing fp@2324: * NVM and Phy. fp@2324: */ fp@2324: fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: msleep(25); fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: fp@2324: /* Clear any pending interrupt events. */ fp@2324: ew32(IMC, 0xffffffff); fp@2324: icr = er32(ICR); fp@2324: fp@2324: if (hw->mac.type == e1000_82571 && fp@2324: hw->dev_spec.e82571.alt_mac_addr_is_present) fp@2324: e1000e_set_laa_state_82571(hw, true); fp@2324: fp@2324: /* Reinitialize the 82571 serdes link state machine */ fp@2324: if (hw->phy.media_type == e1000_media_type_internal_serdes) fp@2324: hw->mac.serdes_link_state = e1000_serdes_link_down; fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_init_hw_82571 - Initialize hardware fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * This inits the hardware readying it for operation. fp@2324: **/ fp@2324: static s32 e1000_init_hw_82571(struct e1000_hw *hw) fp@2324: { fp@2324: struct e1000_mac_info *mac = &hw->mac; fp@2324: u32 reg_data; fp@2324: s32 ret_val; fp@2324: u16 i, rar_count = mac->rar_entry_count; fp@2324: fp@2324: e1000_initialize_hw_bits_82571(hw); fp@2324: fp@2324: /* Initialize identification LED */ fp@2324: ret_val = e1000e_id_led_init(hw); fp@2324: if (ret_val) fp@2324: e_dbg("Error initializing identification LED\n"); fp@2324: /* This is not fatal and we should not stop init due to this */ fp@2324: fp@2324: /* Disabling VLAN filtering */ fp@2324: e_dbg("Initializing the IEEE VLAN\n"); fp@2324: mac->ops.clear_vfta(hw); fp@2324: fp@2324: /* Setup the receive address. */ fp@2324: /* fp@2324: * If, however, a locally administered address was assigned to the fp@2324: * 82571, we must reserve a RAR for it to work around an issue where fp@2324: * resetting one port will reload the MAC on the other port. fp@2324: */ fp@2324: if (e1000e_get_laa_state_82571(hw)) fp@2324: rar_count--; fp@2324: e1000e_init_rx_addrs(hw, rar_count); fp@2324: fp@2324: /* Zero out the Multicast HASH table */ fp@2324: e_dbg("Zeroing the MTA\n"); fp@2324: for (i = 0; i < mac->mta_reg_count; i++) fp@2324: E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); fp@2324: fp@2324: /* Setup link and flow control */ fp@2324: ret_val = e1000_setup_link_82571(hw); fp@2324: fp@2324: /* Set the transmit descriptor write-back policy */ fp@2324: reg_data = er32(TXDCTL(0)); fp@2324: reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | fp@2324: E1000_TXDCTL_FULL_TX_DESC_WB | fp@2324: E1000_TXDCTL_COUNT_DESC; fp@2324: ew32(TXDCTL(0), reg_data); fp@2324: fp@2324: /* ...for both queues. */ fp@2324: switch (mac->type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: e1000e_enable_tx_pkt_filtering(hw); fp@2324: reg_data = er32(GCR); fp@2324: reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; fp@2324: ew32(GCR, reg_data); fp@2324: break; fp@2324: default: fp@2324: reg_data = er32(TXDCTL(1)); fp@2324: reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | fp@2324: E1000_TXDCTL_FULL_TX_DESC_WB | fp@2324: E1000_TXDCTL_COUNT_DESC; fp@2324: ew32(TXDCTL(1), reg_data); fp@2324: break; fp@2324: } fp@2324: fp@2324: /* fp@2324: * Clear all of the statistics registers (clear on read). It is fp@2324: * important that we do this after we have tried to establish link fp@2324: * because the symbol error count will increment wildly if there fp@2324: * is no link. fp@2324: */ fp@2324: e1000_clear_hw_cntrs_82571(hw); fp@2324: fp@2324: return ret_val; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_initialize_hw_bits_82571 - Initialize hardware-dependent bits fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Initializes required hardware-dependent bits needed for normal operation. fp@2324: **/ fp@2324: static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw) fp@2324: { fp@2324: u32 reg; fp@2324: fp@2324: /* Transmit Descriptor Control 0 */ fp@2324: reg = er32(TXDCTL(0)); fp@2324: reg |= (1 << 22); fp@2324: ew32(TXDCTL(0), reg); fp@2324: fp@2324: /* Transmit Descriptor Control 1 */ fp@2324: reg = er32(TXDCTL(1)); fp@2324: reg |= (1 << 22); fp@2324: ew32(TXDCTL(1), reg); fp@2324: fp@2324: /* Transmit Arbitration Control 0 */ fp@2324: reg = er32(TARC(0)); fp@2324: reg &= ~(0xF << 27); /* 30:27 */ fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82571: fp@2324: case e1000_82572: fp@2324: reg |= (1 << 23) | (1 << 24) | (1 << 25) | (1 << 26); fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: ew32(TARC(0), reg); fp@2324: fp@2324: /* Transmit Arbitration Control 1 */ fp@2324: reg = er32(TARC(1)); fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82571: fp@2324: case e1000_82572: fp@2324: reg &= ~((1 << 29) | (1 << 30)); fp@2324: reg |= (1 << 22) | (1 << 24) | (1 << 25) | (1 << 26); fp@2324: if (er32(TCTL) & E1000_TCTL_MULR) fp@2324: reg &= ~(1 << 28); fp@2324: else fp@2324: reg |= (1 << 28); fp@2324: ew32(TARC(1), reg); fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: fp@2324: /* Device Control */ fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: reg = er32(CTRL); fp@2324: reg &= ~(1 << 29); fp@2324: ew32(CTRL, reg); fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: fp@2324: /* Extended Device Control */ fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: reg = er32(CTRL_EXT); fp@2324: reg &= ~(1 << 23); fp@2324: reg |= (1 << 22); fp@2324: ew32(CTRL_EXT, reg); fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: fp@2324: if (hw->mac.type == e1000_82571) { fp@2324: reg = er32(PBA_ECC); fp@2324: reg |= E1000_PBA_ECC_CORR_EN; fp@2324: ew32(PBA_ECC, reg); fp@2324: } fp@2324: /* fp@2324: * Workaround for hardware errata. fp@2324: * Ensure that DMA Dynamic Clock gating is disabled on 82571 and 82572 fp@2324: */ fp@2324: fp@2324: if ((hw->mac.type == e1000_82571) || fp@2324: (hw->mac.type == e1000_82572)) { fp@2324: reg = er32(CTRL_EXT); fp@2324: reg &= ~E1000_CTRL_EXT_DMA_DYN_CLK_EN; fp@2324: ew32(CTRL_EXT, reg); fp@2324: } fp@2324: fp@2324: fp@2324: /* PCI-Ex Control Registers */ fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: reg = er32(GCR); fp@2324: reg |= (1 << 22); fp@2324: ew32(GCR, reg); fp@2324: fp@2324: /* fp@2324: * Workaround for hardware errata. fp@2324: * apply workaround for hardware errata documented in errata fp@2324: * docs Fixes issue where some error prone or unreliable PCIe fp@2324: * completions are occurring, particularly with ASPM enabled. fp@2324: * Without fix, issue can cause tx timeouts. fp@2324: */ fp@2324: reg = er32(GCR2); fp@2324: reg |= 1; fp@2324: ew32(GCR2, reg); fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: fp@2324: return; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_clear_vfta_82571 - Clear VLAN filter table fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Clears the register array which contains the VLAN filter table by fp@2324: * setting all the values to 0. fp@2324: **/ fp@2324: static void e1000_clear_vfta_82571(struct e1000_hw *hw) fp@2324: { fp@2324: u32 offset; fp@2324: u32 vfta_value = 0; fp@2324: u32 vfta_offset = 0; fp@2324: u32 vfta_bit_in_reg = 0; fp@2324: fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: if (hw->mng_cookie.vlan_id != 0) { fp@2324: /* fp@2324: * The VFTA is a 4096b bit-field, each identifying fp@2324: * a single VLAN ID. The following operations fp@2324: * determine which 32b entry (i.e. offset) into the fp@2324: * array we want to set the VLAN ID (i.e. bit) of fp@2324: * the manageability unit. fp@2324: */ fp@2324: vfta_offset = (hw->mng_cookie.vlan_id >> fp@2324: E1000_VFTA_ENTRY_SHIFT) & fp@2324: E1000_VFTA_ENTRY_MASK; fp@2324: vfta_bit_in_reg = 1 << (hw->mng_cookie.vlan_id & fp@2324: E1000_VFTA_ENTRY_BIT_SHIFT_MASK); fp@2324: } fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { fp@2324: /* fp@2324: * If the offset we want to clear is the same offset of the fp@2324: * manageability VLAN ID, then clear all bits except that of fp@2324: * the manageability unit. fp@2324: */ fp@2324: vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; fp@2324: E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, vfta_value); fp@2324: e1e_flush(); fp@2324: } fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_check_mng_mode_82574 - Check manageability is enabled fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Reads the NVM Initialization Control Word 2 and returns true fp@2324: * (>0) if any manageability is enabled, else false (0). fp@2324: **/ fp@2324: static bool e1000_check_mng_mode_82574(struct e1000_hw *hw) fp@2324: { fp@2324: u16 data; fp@2324: fp@2324: e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data); fp@2324: return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_led_on_82574 - Turn LED on fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Turn LED on. fp@2324: **/ fp@2324: static s32 e1000_led_on_82574(struct e1000_hw *hw) fp@2324: { fp@2324: u32 ctrl; fp@2324: u32 i; fp@2324: fp@2324: ctrl = hw->mac.ledctl_mode2; fp@2324: if (!(E1000_STATUS_LU & er32(STATUS))) { fp@2324: /* fp@2324: * If no link, then turn LED on by setting the invert bit fp@2324: * for each LED that's "on" (0x0E) in ledctl_mode2. fp@2324: */ fp@2324: for (i = 0; i < 4; i++) fp@2324: if (((hw->mac.ledctl_mode2 >> (i * 8)) & 0xFF) == fp@2324: E1000_LEDCTL_MODE_LED_ON) fp@2324: ctrl |= (E1000_LEDCTL_LED0_IVRT << (i * 8)); fp@2324: } fp@2324: ew32(LEDCTL, ctrl); fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_update_mc_addr_list_82571 - Update Multicast addresses fp@2324: * @hw: pointer to the HW structure fp@2324: * @mc_addr_list: array of multicast addresses to program fp@2324: * @mc_addr_count: number of multicast addresses to program fp@2324: * @rar_used_count: the first RAR register free to program fp@2324: * @rar_count: total number of supported Receive Address Registers fp@2324: * fp@2324: * Updates the Receive Address Registers and Multicast Table Array. fp@2324: * The caller must have a packed mc_addr_list of multicast addresses. fp@2324: * The parameter rar_count will usually be hw->mac.rar_entry_count fp@2324: * unless there are workarounds that change this. fp@2324: **/ fp@2324: static void e1000_update_mc_addr_list_82571(struct e1000_hw *hw, fp@2324: u8 *mc_addr_list, fp@2324: u32 mc_addr_count, fp@2324: u32 rar_used_count, fp@2324: u32 rar_count) fp@2324: { fp@2324: if (e1000e_get_laa_state_82571(hw)) fp@2324: rar_count--; fp@2324: fp@2324: e1000e_update_mc_addr_list_generic(hw, mc_addr_list, mc_addr_count, fp@2324: rar_used_count, rar_count); fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_setup_link_82571 - Setup flow control and link settings fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Determines which flow control settings to use, then configures flow fp@2324: * control. Calls the appropriate media-specific link configuration fp@2324: * function. Assuming the adapter has a valid link partner, a valid link fp@2324: * should be established. Assumes the hardware has previously been reset fp@2324: * and the transmitter and receiver are not enabled. fp@2324: **/ fp@2324: static s32 e1000_setup_link_82571(struct e1000_hw *hw) fp@2324: { fp@2324: /* fp@2324: * 82573 does not have a word in the NVM to determine fp@2324: * the default flow control setting, so we explicitly fp@2324: * set it to full. fp@2324: */ fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: if (hw->fc.requested_mode == e1000_fc_default) fp@2324: hw->fc.requested_mode = e1000_fc_full; fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: fp@2324: return e1000e_setup_link(hw); fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_setup_copper_link_82571 - Configure copper link settings fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Configures the link for auto-neg or forced speed and duplex. Then we check fp@2324: * for link, once link is established calls to configure collision distance fp@2324: * and flow control are called. fp@2324: **/ fp@2324: static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw) fp@2324: { fp@2324: u32 ctrl; fp@2324: s32 ret_val; fp@2324: fp@2324: ctrl = er32(CTRL); fp@2324: ctrl |= E1000_CTRL_SLU; fp@2324: ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); fp@2324: ew32(CTRL, ctrl); fp@2324: fp@2324: switch (hw->phy.type) { fp@2324: case e1000_phy_m88: fp@2324: case e1000_phy_bm: fp@2324: ret_val = e1000e_copper_link_setup_m88(hw); fp@2324: break; fp@2324: case e1000_phy_igp_2: fp@2324: ret_val = e1000e_copper_link_setup_igp(hw); fp@2324: break; fp@2324: default: fp@2324: return -E1000_ERR_PHY; fp@2324: break; fp@2324: } fp@2324: fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: ret_val = e1000e_setup_copper_link(hw); fp@2324: fp@2324: return ret_val; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_setup_fiber_serdes_link_82571 - Setup link for fiber/serdes fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Configures collision distance and flow control for fiber and serdes links. fp@2324: * Upon successful setup, poll for link. fp@2324: **/ fp@2324: static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) fp@2324: { fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82571: fp@2324: case e1000_82572: fp@2324: /* fp@2324: * If SerDes loopback mode is entered, there is no form fp@2324: * of reset to take the adapter out of that mode. So we fp@2324: * have to explicitly take the adapter out of loopback fp@2324: * mode. This prevents drivers from twiddling their thumbs fp@2324: * if another tool failed to take it out of loopback mode. fp@2324: */ fp@2324: ew32(SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK); fp@2324: break; fp@2324: default: fp@2324: break; fp@2324: } fp@2324: fp@2324: return e1000e_setup_fiber_serdes_link(hw); fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_check_for_serdes_link_82571 - Check for link (Serdes) fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Reports the link state as up or down. fp@2324: * fp@2324: * If autonegotiation is supported by the link partner, the link state is fp@2324: * determined by the result of autonegotiation. This is the most likely case. fp@2324: * If autonegotiation is not supported by the link partner, and the link fp@2324: * has a valid signal, force the link up. fp@2324: * fp@2324: * The link state is represented internally here by 4 states: fp@2324: * fp@2324: * 1) down fp@2324: * 2) autoneg_progress fp@2324: * 3) autoneg_complete (the link sucessfully autonegotiated) fp@2324: * 4) forced_up (the link has been forced up, it did not autonegotiate) fp@2324: * fp@2324: **/ fp@2324: static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) fp@2324: { fp@2324: struct e1000_mac_info *mac = &hw->mac; fp@2324: u32 rxcw; fp@2324: u32 ctrl; fp@2324: u32 status; fp@2324: s32 ret_val = 0; fp@2324: fp@2324: ctrl = er32(CTRL); fp@2324: status = er32(STATUS); fp@2324: rxcw = er32(RXCW); fp@2324: fp@2324: if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) { fp@2324: fp@2324: /* Receiver is synchronized with no invalid bits. */ fp@2324: switch (mac->serdes_link_state) { fp@2324: case e1000_serdes_link_autoneg_complete: fp@2324: if (!(status & E1000_STATUS_LU)) { fp@2324: /* fp@2324: * We have lost link, retry autoneg before fp@2324: * reporting link failure fp@2324: */ fp@2324: mac->serdes_link_state = fp@2324: e1000_serdes_link_autoneg_progress; fp@2324: mac->serdes_has_link = false; fp@2324: e_dbg("AN_UP -> AN_PROG\n"); fp@2324: } fp@2324: break; fp@2324: fp@2324: case e1000_serdes_link_forced_up: fp@2324: /* fp@2324: * If we are receiving /C/ ordered sets, re-enable fp@2324: * auto-negotiation in the TXCW register and disable fp@2324: * forced link in the Device Control register in an fp@2324: * attempt to auto-negotiate with our link partner. fp@2324: */ fp@2324: if (rxcw & E1000_RXCW_C) { fp@2324: /* Enable autoneg, and unforce link up */ fp@2324: ew32(TXCW, mac->txcw); fp@2324: ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); fp@2324: mac->serdes_link_state = fp@2324: e1000_serdes_link_autoneg_progress; fp@2324: mac->serdes_has_link = false; fp@2324: e_dbg("FORCED_UP -> AN_PROG\n"); fp@2324: } fp@2324: break; fp@2324: fp@2324: case e1000_serdes_link_autoneg_progress: fp@2324: if (rxcw & E1000_RXCW_C) { fp@2324: /* fp@2324: * We received /C/ ordered sets, meaning the fp@2324: * link partner has autonegotiated, and we can fp@2324: * trust the Link Up (LU) status bit. fp@2324: */ fp@2324: if (status & E1000_STATUS_LU) { fp@2324: mac->serdes_link_state = fp@2324: e1000_serdes_link_autoneg_complete; fp@2324: e_dbg("AN_PROG -> AN_UP\n"); fp@2324: mac->serdes_has_link = true; fp@2324: } else { fp@2324: /* Autoneg completed, but failed. */ fp@2324: mac->serdes_link_state = fp@2324: e1000_serdes_link_down; fp@2324: e_dbg("AN_PROG -> DOWN\n"); fp@2324: } fp@2324: } else { fp@2324: /* fp@2324: * The link partner did not autoneg. fp@2324: * Force link up and full duplex, and change fp@2324: * state to forced. fp@2324: */ fp@2324: ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); fp@2324: ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD); fp@2324: ew32(CTRL, ctrl); fp@2324: fp@2324: /* Configure Flow Control after link up. */ fp@2324: ret_val = e1000e_config_fc_after_link_up(hw); fp@2324: if (ret_val) { fp@2324: e_dbg("Error config flow control\n"); fp@2324: break; fp@2324: } fp@2324: mac->serdes_link_state = fp@2324: e1000_serdes_link_forced_up; fp@2324: mac->serdes_has_link = true; fp@2324: e_dbg("AN_PROG -> FORCED_UP\n"); fp@2324: } fp@2324: break; fp@2324: fp@2324: case e1000_serdes_link_down: fp@2324: default: fp@2324: /* fp@2324: * The link was down but the receiver has now gained fp@2324: * valid sync, so lets see if we can bring the link fp@2324: * up. fp@2324: */ fp@2324: ew32(TXCW, mac->txcw); fp@2324: ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); fp@2324: mac->serdes_link_state = fp@2324: e1000_serdes_link_autoneg_progress; fp@2324: e_dbg("DOWN -> AN_PROG\n"); fp@2324: break; fp@2324: } fp@2324: } else { fp@2324: if (!(rxcw & E1000_RXCW_SYNCH)) { fp@2324: mac->serdes_has_link = false; fp@2324: mac->serdes_link_state = e1000_serdes_link_down; fp@2324: e_dbg("ANYSTATE -> DOWN\n"); fp@2324: } else { fp@2324: /* fp@2324: * We have sync, and can tolerate one invalid (IV) fp@2324: * codeword before declaring link down, so reread fp@2324: * to look again. fp@2324: */ fp@2324: udelay(10); fp@2324: rxcw = er32(RXCW); fp@2324: if (rxcw & E1000_RXCW_IV) { fp@2324: mac->serdes_link_state = e1000_serdes_link_down; fp@2324: mac->serdes_has_link = false; fp@2324: e_dbg("ANYSTATE -> DOWN\n"); fp@2324: } fp@2324: } fp@2324: } fp@2324: fp@2324: return ret_val; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_valid_led_default_82571 - Verify a valid default LED config fp@2324: * @hw: pointer to the HW structure fp@2324: * @data: pointer to the NVM (EEPROM) fp@2324: * fp@2324: * Read the EEPROM for the current default LED configuration. If the fp@2324: * LED configuration is not valid, set to a valid LED configuration. fp@2324: **/ fp@2324: static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data) fp@2324: { fp@2324: s32 ret_val; fp@2324: fp@2324: ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data); fp@2324: if (ret_val) { fp@2324: e_dbg("NVM Read Error\n"); fp@2324: return ret_val; fp@2324: } fp@2324: fp@2324: switch (hw->mac.type) { fp@2324: case e1000_82573: fp@2324: case e1000_82574: fp@2324: case e1000_82583: fp@2324: if (*data == ID_LED_RESERVED_F746) fp@2324: *data = ID_LED_DEFAULT_82573; fp@2324: break; fp@2324: default: fp@2324: if (*data == ID_LED_RESERVED_0000 || fp@2324: *data == ID_LED_RESERVED_FFFF) fp@2324: *data = ID_LED_DEFAULT; fp@2324: break; fp@2324: } fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000e_get_laa_state_82571 - Get locally administered address state fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Retrieve and return the current locally administered address state. fp@2324: **/ fp@2324: bool e1000e_get_laa_state_82571(struct e1000_hw *hw) fp@2324: { fp@2324: if (hw->mac.type != e1000_82571) fp@2324: return false; fp@2324: fp@2324: return hw->dev_spec.e82571.laa_is_present; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000e_set_laa_state_82571 - Set locally administered address state fp@2324: * @hw: pointer to the HW structure fp@2324: * @state: enable/disable locally administered address fp@2324: * fp@2324: * Enable/Disable the current locally administered address state. fp@2324: **/ fp@2324: void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state) fp@2324: { fp@2324: if (hw->mac.type != e1000_82571) fp@2324: return; fp@2324: fp@2324: hw->dev_spec.e82571.laa_is_present = state; fp@2324: fp@2324: /* If workaround is activated... */ fp@2324: if (state) fp@2324: /* fp@2324: * Hold a copy of the LAA in RAR[14] This is done so that fp@2324: * between the time RAR[0] gets clobbered and the time it fp@2324: * gets fixed, the actual LAA is in one of the RARs and no fp@2324: * incoming packets directed to this port are dropped. fp@2324: * Eventually the LAA will be in RAR[0] and RAR[14]. fp@2324: */ fp@2324: e1000e_rar_set(hw, hw->mac.addr, hw->mac.rar_entry_count - 1); fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_fix_nvm_checksum_82571 - Fix EEPROM checksum fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Verifies that the EEPROM has completed the update. After updating the fp@2324: * EEPROM, we need to check bit 15 in work 0x23 for the checksum fix. If fp@2324: * the checksum fix is not implemented, we need to set the bit and update fp@2324: * the checksum. Otherwise, if bit 15 is set and the checksum is incorrect, fp@2324: * we need to return bad checksum. fp@2324: **/ fp@2324: static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw) fp@2324: { fp@2324: struct e1000_nvm_info *nvm = &hw->nvm; fp@2324: s32 ret_val; fp@2324: u16 data; fp@2324: fp@2324: if (nvm->type != e1000_nvm_flash_hw) fp@2324: return 0; fp@2324: fp@2324: /* fp@2324: * Check bit 4 of word 10h. If it is 0, firmware is done updating fp@2324: * 10h-12h. Checksum may need to be fixed. fp@2324: */ fp@2324: ret_val = e1000_read_nvm(hw, 0x10, 1, &data); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: if (!(data & 0x10)) { fp@2324: /* fp@2324: * Read 0x23 and check bit 15. This bit is a 1 fp@2324: * when the checksum has already been fixed. If fp@2324: * the checksum is still wrong and this bit is a fp@2324: * 1, we need to return bad checksum. Otherwise, fp@2324: * we need to set this bit to a 1 and update the fp@2324: * checksum. fp@2324: */ fp@2324: ret_val = e1000_read_nvm(hw, 0x23, 1, &data); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: fp@2324: if (!(data & 0x8000)) { fp@2324: data |= 0x8000; fp@2324: ret_val = e1000_write_nvm(hw, 0x23, 1, &data); fp@2324: if (ret_val) fp@2324: return ret_val; fp@2324: ret_val = e1000e_update_nvm_checksum(hw); fp@2324: } fp@2324: } fp@2324: fp@2324: return 0; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_power_down_phy_copper_82571 - Remove link during PHY power down fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * In the case of a PHY power down to save power, or to turn off link during a fp@2324: * driver unload, or wake on lan is not enabled, remove the link. fp@2324: **/ fp@2324: static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw) fp@2324: { fp@2324: struct e1000_phy_info *phy = &hw->phy; fp@2324: struct e1000_mac_info *mac = &hw->mac; fp@2324: fp@2324: if (!(phy->ops.check_reset_block)) fp@2324: return; fp@2324: fp@2324: /* If the management interface is not enabled, then power down */ fp@2324: if (!(mac->ops.check_mng_mode(hw) || phy->ops.check_reset_block(hw))) fp@2324: e1000_power_down_phy_copper(hw); fp@2324: fp@2324: return; fp@2324: } fp@2324: fp@2324: /** fp@2324: * e1000_clear_hw_cntrs_82571 - Clear device specific hardware counters fp@2324: * @hw: pointer to the HW structure fp@2324: * fp@2324: * Clears the hardware counters by reading the counter registers. fp@2324: **/ fp@2324: static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw) fp@2324: { fp@2324: e1000e_clear_hw_cntrs_base(hw); fp@2324: fp@2324: er32(PRC64); fp@2324: er32(PRC127); fp@2324: er32(PRC255); fp@2324: er32(PRC511); fp@2324: er32(PRC1023); fp@2324: er32(PRC1522); fp@2324: er32(PTC64); fp@2324: er32(PTC127); fp@2324: er32(PTC255); fp@2324: er32(PTC511); fp@2324: er32(PTC1023); fp@2324: er32(PTC1522); fp@2324: fp@2324: er32(ALGNERRC); fp@2324: er32(RXERRC); fp@2324: er32(TNCRS); fp@2324: er32(CEXTERR); fp@2324: er32(TSCTC); fp@2324: er32(TSCTFC); fp@2324: fp@2324: er32(MGTPRC); fp@2324: er32(MGTPDC); fp@2324: er32(MGTPTC); fp@2324: fp@2324: er32(IAC); fp@2324: er32(ICRXOC); fp@2324: fp@2324: er32(ICRXPTC); fp@2324: er32(ICRXATC); fp@2324: er32(ICTXPTC); fp@2324: er32(ICTXATC); fp@2324: er32(ICTXQEC); fp@2324: er32(ICTXQMTC); fp@2324: er32(ICRXDMTC); fp@2324: } fp@2324: fp@2324: static struct e1000_mac_operations e82571_mac_ops = { fp@2324: /* .check_mng_mode: mac type dependent */ fp@2324: /* .check_for_link: media type dependent */ fp@2324: .id_led_init = e1000e_id_led_init, fp@2324: .cleanup_led = e1000e_cleanup_led_generic, fp@2324: .clear_hw_cntrs = e1000_clear_hw_cntrs_82571, fp@2324: .get_bus_info = e1000e_get_bus_info_pcie, fp@2324: /* .get_link_up_info: media type dependent */ fp@2324: /* .led_on: mac type dependent */ fp@2324: .led_off = e1000e_led_off_generic, fp@2324: .update_mc_addr_list = e1000_update_mc_addr_list_82571, fp@2324: .write_vfta = e1000_write_vfta_generic, fp@2324: .clear_vfta = e1000_clear_vfta_82571, fp@2324: .reset_hw = e1000_reset_hw_82571, fp@2324: .init_hw = e1000_init_hw_82571, fp@2324: .setup_link = e1000_setup_link_82571, fp@2324: /* .setup_physical_interface: media type dependent */ fp@2324: .setup_led = e1000e_setup_led_generic, fp@2324: }; fp@2324: fp@2324: static struct e1000_phy_operations e82_phy_ops_igp = { fp@2324: .acquire = e1000_get_hw_semaphore_82571, fp@2324: .check_polarity = e1000_check_polarity_igp, fp@2324: .check_reset_block = e1000e_check_reset_block_generic, fp@2324: .commit = NULL, fp@2324: .force_speed_duplex = e1000e_phy_force_speed_duplex_igp, fp@2324: .get_cfg_done = e1000_get_cfg_done_82571, fp@2324: .get_cable_length = e1000e_get_cable_length_igp_2, fp@2324: .get_info = e1000e_get_phy_info_igp, fp@2324: .read_reg = e1000e_read_phy_reg_igp, fp@2324: .release = e1000_put_hw_semaphore_82571, fp@2324: .reset = e1000e_phy_hw_reset_generic, fp@2324: .set_d0_lplu_state = e1000_set_d0_lplu_state_82571, fp@2324: .set_d3_lplu_state = e1000e_set_d3_lplu_state, fp@2324: .write_reg = e1000e_write_phy_reg_igp, fp@2324: .cfg_on_link_up = NULL, fp@2324: }; fp@2324: fp@2324: static struct e1000_phy_operations e82_phy_ops_m88 = { fp@2324: .acquire = e1000_get_hw_semaphore_82571, fp@2324: .check_polarity = e1000_check_polarity_m88, fp@2324: .check_reset_block = e1000e_check_reset_block_generic, fp@2324: .commit = e1000e_phy_sw_reset, fp@2324: .force_speed_duplex = e1000e_phy_force_speed_duplex_m88, fp@2324: .get_cfg_done = e1000e_get_cfg_done, fp@2324: .get_cable_length = e1000e_get_cable_length_m88, fp@2324: .get_info = e1000e_get_phy_info_m88, fp@2324: .read_reg = e1000e_read_phy_reg_m88, fp@2324: .release = e1000_put_hw_semaphore_82571, fp@2324: .reset = e1000e_phy_hw_reset_generic, fp@2324: .set_d0_lplu_state = e1000_set_d0_lplu_state_82571, fp@2324: .set_d3_lplu_state = e1000e_set_d3_lplu_state, fp@2324: .write_reg = e1000e_write_phy_reg_m88, fp@2324: .cfg_on_link_up = NULL, fp@2324: }; fp@2324: fp@2324: static struct e1000_phy_operations e82_phy_ops_bm = { fp@2324: .acquire = e1000_get_hw_semaphore_82571, fp@2324: .check_polarity = e1000_check_polarity_m88, fp@2324: .check_reset_block = e1000e_check_reset_block_generic, fp@2324: .commit = e1000e_phy_sw_reset, fp@2324: .force_speed_duplex = e1000e_phy_force_speed_duplex_m88, fp@2324: .get_cfg_done = e1000e_get_cfg_done, fp@2324: .get_cable_length = e1000e_get_cable_length_m88, fp@2324: .get_info = e1000e_get_phy_info_m88, fp@2324: .read_reg = e1000e_read_phy_reg_bm2, fp@2324: .release = e1000_put_hw_semaphore_82571, fp@2324: .reset = e1000e_phy_hw_reset_generic, fp@2324: .set_d0_lplu_state = e1000_set_d0_lplu_state_82571, fp@2324: .set_d3_lplu_state = e1000e_set_d3_lplu_state, fp@2324: .write_reg = e1000e_write_phy_reg_bm2, fp@2324: .cfg_on_link_up = NULL, fp@2324: }; fp@2324: fp@2324: static struct e1000_nvm_operations e82571_nvm_ops = { fp@2324: .acquire = e1000_acquire_nvm_82571, fp@2324: .read = e1000e_read_nvm_eerd, fp@2324: .release = e1000_release_nvm_82571, fp@2324: .update = e1000_update_nvm_checksum_82571, fp@2324: .valid_led_default = e1000_valid_led_default_82571, fp@2324: .validate = e1000_validate_nvm_checksum_82571, fp@2324: .write = e1000_write_nvm_82571, fp@2324: }; fp@2324: fp@2324: struct e1000_info e1000_82571_info = { fp@2324: .mac = e1000_82571, fp@2324: .flags = FLAG_HAS_HW_VLAN_FILTER fp@2324: | FLAG_HAS_JUMBO_FRAMES fp@2324: | FLAG_HAS_WOL fp@2324: | FLAG_APME_IN_CTRL3 fp@2324: | FLAG_RX_CSUM_ENABLED fp@2324: | FLAG_HAS_CTRLEXT_ON_LOAD fp@2324: | FLAG_HAS_SMART_POWER_DOWN fp@2324: | FLAG_RESET_OVERWRITES_LAA /* errata */ fp@2324: | FLAG_TARC_SPEED_MODE_BIT /* errata */ fp@2324: | FLAG_APME_CHECK_PORT_B, fp@2324: .pba = 38, fp@2324: .max_hw_frame_size = DEFAULT_JUMBO, fp@2324: .get_variants = e1000_get_variants_82571, fp@2324: .mac_ops = &e82571_mac_ops, fp@2324: .phy_ops = &e82_phy_ops_igp, fp@2324: .nvm_ops = &e82571_nvm_ops, fp@2324: }; fp@2324: fp@2324: struct e1000_info e1000_82572_info = { fp@2324: .mac = e1000_82572, fp@2324: .flags = FLAG_HAS_HW_VLAN_FILTER fp@2324: | FLAG_HAS_JUMBO_FRAMES fp@2324: | FLAG_HAS_WOL fp@2324: | FLAG_APME_IN_CTRL3 fp@2324: | FLAG_RX_CSUM_ENABLED fp@2324: | FLAG_HAS_CTRLEXT_ON_LOAD fp@2324: | FLAG_TARC_SPEED_MODE_BIT, /* errata */ fp@2324: .pba = 38, fp@2324: .max_hw_frame_size = DEFAULT_JUMBO, fp@2324: .get_variants = e1000_get_variants_82571, fp@2324: .mac_ops = &e82571_mac_ops, fp@2324: .phy_ops = &e82_phy_ops_igp, fp@2324: .nvm_ops = &e82571_nvm_ops, fp@2324: }; fp@2324: fp@2324: struct e1000_info e1000_82573_info = { fp@2324: .mac = e1000_82573, fp@2324: .flags = FLAG_HAS_HW_VLAN_FILTER fp@2324: | FLAG_HAS_JUMBO_FRAMES fp@2324: | FLAG_HAS_WOL fp@2324: | FLAG_APME_IN_CTRL3 fp@2324: | FLAG_RX_CSUM_ENABLED fp@2324: | FLAG_HAS_SMART_POWER_DOWN fp@2324: | FLAG_HAS_AMT fp@2324: | FLAG_HAS_ERT fp@2324: | FLAG_HAS_SWSM_ON_LOAD, fp@2324: .pba = 20, fp@2324: .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, fp@2324: .get_variants = e1000_get_variants_82571, fp@2324: .mac_ops = &e82571_mac_ops, fp@2324: .phy_ops = &e82_phy_ops_m88, fp@2324: .nvm_ops = &e82571_nvm_ops, fp@2324: }; fp@2324: fp@2324: struct e1000_info e1000_82574_info = { fp@2324: .mac = e1000_82574, fp@2324: .flags = FLAG_HAS_HW_VLAN_FILTER fp@2324: | FLAG_HAS_MSIX fp@2324: | FLAG_HAS_JUMBO_FRAMES fp@2324: | FLAG_HAS_WOL fp@2324: | FLAG_APME_IN_CTRL3 fp@2324: | FLAG_RX_CSUM_ENABLED fp@2324: | FLAG_HAS_SMART_POWER_DOWN fp@2324: | FLAG_HAS_AMT fp@2324: | FLAG_HAS_CTRLEXT_ON_LOAD, fp@2324: .pba = 20, fp@2324: .max_hw_frame_size = DEFAULT_JUMBO, fp@2324: .get_variants = e1000_get_variants_82571, fp@2324: .mac_ops = &e82571_mac_ops, fp@2324: .phy_ops = &e82_phy_ops_bm, fp@2324: .nvm_ops = &e82571_nvm_ops, fp@2324: }; fp@2324: fp@2324: struct e1000_info e1000_82583_info = { fp@2324: .mac = e1000_82583, fp@2324: .flags = FLAG_HAS_HW_VLAN_FILTER fp@2324: | FLAG_HAS_WOL fp@2324: | FLAG_APME_IN_CTRL3 fp@2324: | FLAG_RX_CSUM_ENABLED fp@2324: | FLAG_HAS_SMART_POWER_DOWN fp@2324: | FLAG_HAS_AMT fp@2324: | FLAG_HAS_CTRLEXT_ON_LOAD, fp@2324: .pba = 20, fp@2324: .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, fp@2324: .get_variants = e1000_get_variants_82571, fp@2324: .mac_ops = &e82571_mac_ops, fp@2324: .phy_ops = &e82_phy_ops_bm, fp@2324: .nvm_ops = &e82571_nvm_ops, fp@2324: }; fp@2324: