129
131
/* Release the semaphore */
130
ixgbe_release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM);
131
/* Delay obtaining semaphore again to allow FW access */
132
msleep(hw->eeprom.semaphore_delay);
132
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM);
134
* Delay obtaining semaphore again to allow FW access,
135
* semaphore_delay is in ms usleep_range needs us.
137
usleep_range(hw->eeprom.semaphore_delay * 1000,
138
hw->eeprom.semaphore_delay * 2000);
134
140
/* Now restart DSP by setting Restart_AN and clearing LMS */
135
141
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, ((IXGBE_READ_REG(hw,
1740
1750
* ixgbe_start_hw_82599 - Prepare hardware for Tx/Rx
1741
1751
* @hw: pointer to hardware structure
1743
* Starts the hardware using the generic start_hw function.
1744
* Then performs device-specific:
1745
* Clears the rate limiter registers.
1753
* Starts the hardware using the generic start_hw function
1754
* and the generation start_hw function.
1755
* Then performs revision-specific operations, if any.
1747
1757
static s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw)
1752
1761
ret_val = ixgbe_start_hw_generic(hw);
1754
/* Clear the rate limiters */
1755
for (q_num = 0; q_num < hw->mac.max_tx_queues; q_num++) {
1756
IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, q_num);
1757
IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, 0);
1759
IXGBE_WRITE_FLUSH(hw);
1765
ret_val = ixgbe_start_hw_gen2(hw);
1761
1769
/* We need to run link autotry after the driver loads */
1762
1770
hw->mac.autotry_restart = true;
1771
hw->mac.rx_pb_size = IXGBE_82599_RX_PB_SIZE;
1764
1773
if (ret_val == 0)
1765
1774
ret_val = ixgbe_verify_fw_version_82599(hw);
1767
1776
return ret_val;
1971
* ixgbe_get_device_caps_82599 - Get additional device capabilities
1972
* @hw: pointer to hardware structure
1973
* @device_caps: the EEPROM word with the extra device capabilities
1975
* This function will read the EEPROM location for the device capabilities,
1976
* and return the word through device_caps.
1978
static s32 ixgbe_get_device_caps_82599(struct ixgbe_hw *hw, u16 *device_caps)
1980
hw->eeprom.ops.read(hw, IXGBE_DEVICE_CAPS, device_caps);
1986
1980
* ixgbe_verify_fw_version_82599 - verify fw version for 82599
1987
1981
* @hw: pointer to hardware structure
2028
* ixgbe_verify_lesm_fw_enabled_82599 - Checks LESM FW module state.
2029
* @hw: pointer to hardware structure
2031
* Returns true if the LESM FW module is present and enabled. Otherwise
2032
* returns false. Smart Speed must be disabled if LESM FW module is enabled.
2034
static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw)
2036
bool lesm_enabled = false;
2037
u16 fw_offset, fw_lesm_param_offset, fw_lesm_state;
2040
/* get the offset to the Firmware Module block */
2041
status = hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset);
2043
if ((status != 0) ||
2044
(fw_offset == 0) || (fw_offset == 0xFFFF))
2047
/* get the offset to the LESM Parameters block */
2048
status = hw->eeprom.ops.read(hw, (fw_offset +
2049
IXGBE_FW_LESM_PARAMETERS_PTR),
2050
&fw_lesm_param_offset);
2052
if ((status != 0) ||
2053
(fw_lesm_param_offset == 0) || (fw_lesm_param_offset == 0xFFFF))
2056
/* get the lesm state word */
2057
status = hw->eeprom.ops.read(hw, (fw_lesm_param_offset +
2058
IXGBE_FW_LESM_STATE_1),
2061
if ((status == 0) &&
2062
(fw_lesm_state & IXGBE_FW_LESM_STATE_ENABLED))
2063
lesm_enabled = true;
2066
return lesm_enabled;
2070
* ixgbe_read_eeprom_buffer_82599 - Read EEPROM word(s) using
2071
* fastest available method
2073
* @hw: pointer to hardware structure
2074
* @offset: offset of word in EEPROM to read
2075
* @words: number of words
2076
* @data: word(s) read from the EEPROM
2078
* Retrieves 16 bit word(s) read from EEPROM
2080
static s32 ixgbe_read_eeprom_buffer_82599(struct ixgbe_hw *hw, u16 offset,
2081
u16 words, u16 *data)
2083
struct ixgbe_eeprom_info *eeprom = &hw->eeprom;
2084
s32 ret_val = IXGBE_ERR_CONFIG;
2087
* If EEPROM is detected and can be addressed using 14 bits,
2088
* use EERD otherwise use bit bang
2090
if ((eeprom->type == ixgbe_eeprom_spi) &&
2091
(offset + (words - 1) <= IXGBE_EERD_MAX_ADDR))
2092
ret_val = ixgbe_read_eerd_buffer_generic(hw, offset, words,
2095
ret_val = ixgbe_read_eeprom_buffer_bit_bang_generic(hw, offset,
2103
* ixgbe_read_eeprom_82599 - Read EEPROM word using
2104
* fastest available method
2106
* @hw: pointer to hardware structure
2107
* @offset: offset of word in the EEPROM to read
2108
* @data: word read from the EEPROM
2110
* Reads a 16 bit word from the EEPROM
2112
static s32 ixgbe_read_eeprom_82599(struct ixgbe_hw *hw,
2113
u16 offset, u16 *data)
2115
struct ixgbe_eeprom_info *eeprom = &hw->eeprom;
2116
s32 ret_val = IXGBE_ERR_CONFIG;
2119
* If EEPROM is detected and can be addressed using 14 bits,
2120
* use EERD otherwise use bit bang
2122
if ((eeprom->type == ixgbe_eeprom_spi) &&
2123
(offset <= IXGBE_EERD_MAX_ADDR))
2124
ret_val = ixgbe_read_eerd_generic(hw, offset, data);
2126
ret_val = ixgbe_read_eeprom_bit_bang_generic(hw, offset, data);
2033
2131
static struct ixgbe_mac_operations mac_ops_82599 = {
2034
2132
.init_hw = &ixgbe_init_hw_generic,
2035
2133
.reset_hw = &ixgbe_reset_hw_82599,
2040
2138
.enable_rx_dma = &ixgbe_enable_rx_dma_82599,
2041
2139
.get_mac_addr = &ixgbe_get_mac_addr_generic,
2042
2140
.get_san_mac_addr = &ixgbe_get_san_mac_addr_generic,
2043
.get_device_caps = &ixgbe_get_device_caps_82599,
2141
.get_device_caps = &ixgbe_get_device_caps_generic,
2044
2142
.get_wwn_prefix = &ixgbe_get_wwn_prefix_generic,
2045
2143
.stop_adapter = &ixgbe_stop_adapter_generic,
2046
2144
.get_bus_info = &ixgbe_get_bus_info_generic,
2077
2175
static struct ixgbe_eeprom_operations eeprom_ops_82599 = {
2078
2176
.init_params = &ixgbe_init_eeprom_params_generic,
2079
.read = &ixgbe_read_eerd_generic,
2177
.read = &ixgbe_read_eeprom_82599,
2178
.read_buffer = &ixgbe_read_eeprom_buffer_82599,
2080
2179
.write = &ixgbe_write_eeprom_generic,
2180
.write_buffer = &ixgbe_write_eeprom_buffer_bit_bang_generic,
2081
2181
.calc_checksum = &ixgbe_calc_eeprom_checksum_generic,
2082
2182
.validate_checksum = &ixgbe_validate_eeprom_checksum_generic,
2083
2183
.update_checksum = &ixgbe_update_eeprom_checksum_generic,