blob: ba54ff07b438cd1e42c33768f060334b7f310834 [file] [log] [blame]
Don Skidmorefe15e8e12010-11-16 19:27:16 -08001/*******************************************************************************
2
3 Intel 10 Gigabit PCI Express Linux driver
Mark Rustade48566962014-07-22 06:50:42 +00004 Copyright(c) 1999 - 2014 Intel Corporation.
Don Skidmorefe15e8e12010-11-16 19:27:16 -08005
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Contact Information:
Jacob Kellerb89aae72014-02-22 01:23:50 +000023 Linux NICS <linux.nics@intel.com>
Don Skidmorefe15e8e12010-11-16 19:27:16 -080024 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26
27*******************************************************************************/
28
29#include <linux/pci.h>
30#include <linux/delay.h>
31#include <linux/sched.h>
32
33#include "ixgbe.h"
34#include "ixgbe_phy.h"
Don Skidmore6a14ee02014-12-05 03:59:50 +000035#include "ixgbe_x540.h"
Don Skidmorefe15e8e12010-11-16 19:27:16 -080036
Jeff Kirsherb0007482013-10-01 04:33:53 -070037#define IXGBE_X540_MAX_TX_QUEUES 128
38#define IXGBE_X540_MAX_RX_QUEUES 128
39#define IXGBE_X540_RAR_ENTRIES 128
40#define IXGBE_X540_MC_TBL_SIZE 128
41#define IXGBE_X540_VFT_TBL_SIZE 128
42#define IXGBE_X540_RX_PB_SIZE 384
Don Skidmorefe15e8e12010-11-16 19:27:16 -080043
44static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw);
45static s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw);
Don Skidmorefe15e8e12010-11-16 19:27:16 -080046static s32 ixgbe_get_swfw_sync_semaphore(struct ixgbe_hw *hw);
47static void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw);
48
Don Skidmore6a14ee02014-12-05 03:59:50 +000049enum ixgbe_media_type ixgbe_get_media_type_X540(struct ixgbe_hw *hw)
Don Skidmorefe15e8e12010-11-16 19:27:16 -080050{
51 return ixgbe_media_type_copper;
52}
53
Don Skidmore6a14ee02014-12-05 03:59:50 +000054s32 ixgbe_get_invariants_X540(struct ixgbe_hw *hw)
Don Skidmorefe15e8e12010-11-16 19:27:16 -080055{
56 struct ixgbe_mac_info *mac = &hw->mac;
57
58 /* Call PHY identify routine to get the phy type */
59 ixgbe_identify_phy_generic(hw);
60
61 mac->mcft_size = IXGBE_X540_MC_TBL_SIZE;
62 mac->vft_size = IXGBE_X540_VFT_TBL_SIZE;
63 mac->num_rar_entries = IXGBE_X540_RAR_ENTRIES;
Jacob Keller6997d4d2014-02-22 01:23:49 +000064 mac->rx_pb_size = IXGBE_X540_RX_PB_SIZE;
Don Skidmorefe15e8e12010-11-16 19:27:16 -080065 mac->max_rx_queues = IXGBE_X540_MAX_RX_QUEUES;
66 mac->max_tx_queues = IXGBE_X540_MAX_TX_QUEUES;
67 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_generic(hw);
68
69 return 0;
70}
71
72/**
73 * ixgbe_setup_mac_link_X540 - Set the auto advertised capabilitires
74 * @hw: pointer to hardware structure
75 * @speed: new link speed
Don Skidmorefe15e8e12010-11-16 19:27:16 -080076 * @autoneg_wait_to_complete: true when waiting for completion is needed
77 **/
Don Skidmore6a14ee02014-12-05 03:59:50 +000078s32 ixgbe_setup_mac_link_X540(struct ixgbe_hw *hw, ixgbe_link_speed speed,
79 bool autoneg_wait_to_complete)
Don Skidmorefe15e8e12010-11-16 19:27:16 -080080{
Josh Hay99b76642012-12-15 03:28:24 +000081 return hw->phy.ops.setup_link_speed(hw, speed,
Jacob Kellere7cf7452014-04-09 06:03:10 +000082 autoneg_wait_to_complete);
Don Skidmorefe15e8e12010-11-16 19:27:16 -080083}
84
85/**
86 * ixgbe_reset_hw_X540 - Perform hardware reset
87 * @hw: pointer to hardware structure
88 *
89 * Resets the hardware by resetting the transmit and receive units, masks
90 * and clears all interrupts, perform a PHY reset, and perform a link (MAC)
91 * reset.
92 **/
Don Skidmore6a14ee02014-12-05 03:59:50 +000093s32 ixgbe_reset_hw_X540(struct ixgbe_hw *hw)
Don Skidmorefe15e8e12010-11-16 19:27:16 -080094{
Alexander Duyck8132b542011-07-15 07:29:44 +000095 s32 status;
96 u32 ctrl, i;
Don Skidmorefe15e8e12010-11-16 19:27:16 -080097
98 /* Call adapter stop to disable tx/rx and clear interrupts */
Emil Tantilovff9d1a52011-08-16 04:35:11 +000099 status = hw->mac.ops.stop_adapter(hw);
Mark Rustade90dd262014-07-22 06:51:08 +0000100 if (status)
101 return status;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800102
Emil Tantilovff9d1a52011-08-16 04:35:11 +0000103 /* flush pending Tx transactions */
104 ixgbe_clear_tx_pending(hw);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800105
Emil Tantilova4297dc2011-02-14 08:45:13 +0000106mac_reset_top:
Emil Tantilov8c838d72011-08-16 08:04:11 +0000107 ctrl = IXGBE_CTRL_RST;
Alexander Duyck8132b542011-07-15 07:29:44 +0000108 ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL);
109 IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800110 IXGBE_WRITE_FLUSH(hw);
111
112 /* Poll for reset bit to self-clear indicating reset is complete */
113 for (i = 0; i < 10; i++) {
114 udelay(1);
115 ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
Alexander Duyck8132b542011-07-15 07:29:44 +0000116 if (!(ctrl & IXGBE_CTRL_RST_MASK))
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800117 break;
118 }
Alexander Duyck8132b542011-07-15 07:29:44 +0000119
120 if (ctrl & IXGBE_CTRL_RST_MASK) {
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800121 status = IXGBE_ERR_RESET_FAILED;
122 hw_dbg(hw, "Reset polling failed to complete.\n");
123 }
Emil Tantilov8c838d72011-08-16 08:04:11 +0000124 msleep(100);
Alexander Duyck8132b542011-07-15 07:29:44 +0000125
Emil Tantilova4297dc2011-02-14 08:45:13 +0000126 /*
127 * Double resets are required for recovery from certain error
128 * conditions. Between resets, it is necessary to stall to allow time
Alexander Duyck8132b542011-07-15 07:29:44 +0000129 * for any pending HW events to complete.
Emil Tantilova4297dc2011-02-14 08:45:13 +0000130 */
131 if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) {
132 hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED;
Emil Tantilova4297dc2011-02-14 08:45:13 +0000133 goto mac_reset_top;
134 }
135
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800136 /* Set the Rx packet buffer size. */
137 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(0), 384 << IXGBE_RXPBSIZE_SHIFT);
138
139 /* Store the permanent mac address */
140 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
141
142 /*
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800143 * Store MAC address from RAR0, clear receive address registers, and
144 * clear the multicast table. Also reset num_rar_entries to 128,
145 * since we modify this value when programming the SAN MAC address.
146 */
Greg Rose93cb38d2011-03-01 04:37:15 +0000147 hw->mac.num_rar_entries = IXGBE_X540_MAX_TX_QUEUES;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800148 hw->mac.ops.init_rx_addrs(hw);
149
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800150 /* Store the permanent SAN mac address */
151 hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr);
152
153 /* Add the SAN MAC address to the RAR only if it's a valid address */
Joe Perchesf8ebc682012-10-24 17:19:02 +0000154 if (is_valid_ether_addr(hw->mac.san_addr)) {
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800155 hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1,
Jacob Kellere7cf7452014-04-09 06:03:10 +0000156 hw->mac.san_addr, 0, IXGBE_RAH_AV);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800157
Alexander Duyck7fa7c9d2012-05-05 05:32:52 +0000158 /* Save the SAN MAC RAR index */
159 hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1;
160
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800161 /* Reserve the last RAR for the SAN MAC address */
162 hw->mac.num_rar_entries--;
163 }
164
165 /* Store the alternative WWNN/WWPN prefix */
166 hw->mac.ops.get_wwn_prefix(hw, &hw->mac.wwnn_prefix,
Jacob Kellere7cf7452014-04-09 06:03:10 +0000167 &hw->mac.wwpn_prefix);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800168
169 return status;
170}
171
172/**
Emil Tantilov7184b7c2011-03-18 08:18:22 +0000173 * ixgbe_start_hw_X540 - Prepare hardware for Tx/Rx
174 * @hw: pointer to hardware structure
175 *
176 * Starts the hardware using the generic start_hw function
177 * and the generation start_hw function.
178 * Then performs revision-specific operations, if any.
179 **/
Don Skidmore6a14ee02014-12-05 03:59:50 +0000180s32 ixgbe_start_hw_X540(struct ixgbe_hw *hw)
Emil Tantilov7184b7c2011-03-18 08:18:22 +0000181{
Mark Rustade90dd262014-07-22 06:51:08 +0000182 s32 ret_val;
Emil Tantilov7184b7c2011-03-18 08:18:22 +0000183
184 ret_val = ixgbe_start_hw_generic(hw);
Mark Rustade90dd262014-07-22 06:51:08 +0000185 if (ret_val)
186 return ret_val;
Emil Tantilov7184b7c2011-03-18 08:18:22 +0000187
Mark Rustade90dd262014-07-22 06:51:08 +0000188 return ixgbe_start_hw_gen2(hw);
Emil Tantilov7184b7c2011-03-18 08:18:22 +0000189}
190
191/**
Emil Tantilov77ed18f2011-03-03 09:24:56 +0000192 * ixgbe_init_eeprom_params_X540 - Initialize EEPROM params
193 * @hw: pointer to hardware structure
194 *
195 * Initializes the EEPROM parameters ixgbe_eeprom_info within the
196 * ixgbe_hw struct in order to set up EEPROM access.
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800197 **/
Don Skidmore6a14ee02014-12-05 03:59:50 +0000198s32 ixgbe_init_eeprom_params_X540(struct ixgbe_hw *hw)
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800199{
200 struct ixgbe_eeprom_info *eeprom = &hw->eeprom;
201 u32 eec;
202 u16 eeprom_size;
203
204 if (eeprom->type == ixgbe_eeprom_uninitialized) {
205 eeprom->semaphore_delay = 10;
206 eeprom->type = ixgbe_flash;
207
208 eec = IXGBE_READ_REG(hw, IXGBE_EEC);
209 eeprom_size = (u16)((eec & IXGBE_EEC_SIZE) >>
Jacob Kellere7cf7452014-04-09 06:03:10 +0000210 IXGBE_EEC_SIZE_SHIFT);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800211 eeprom->word_size = 1 << (eeprom_size +
Jacob Kellere7cf7452014-04-09 06:03:10 +0000212 IXGBE_EEPROM_WORD_SIZE_SHIFT);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800213
214 hw_dbg(hw, "Eeprom params: type = %d, size = %d\n",
Emil Tantilov77ed18f2011-03-03 09:24:56 +0000215 eeprom->type, eeprom->word_size);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800216 }
217
218 return 0;
219}
220
221/**
Emil Tantilov68c70052011-04-20 08:49:06 +0000222 * ixgbe_read_eerd_X540- Read EEPROM word using EERD
223 * @hw: pointer to hardware structure
224 * @offset: offset of word in the EEPROM to read
225 * @data: word read from the EEPROM
226 *
227 * Reads a 16 bit word from the EEPROM using the EERD register.
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800228 **/
Don Skidmoreb93a2222010-11-16 19:27:17 -0800229static s32 ixgbe_read_eerd_X540(struct ixgbe_hw *hw, u16 offset, u16 *data)
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800230{
Mark Rustade48566962014-07-22 06:50:42 +0000231 s32 status;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800232
Mark Rustade48566962014-07-22 06:50:42 +0000233 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
234 return IXGBE_ERR_SWFW_SYNC;
235
236 status = ixgbe_read_eerd_generic(hw, offset, data);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800237
Emil Tantilov6d980c32011-04-13 04:56:15 +0000238 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800239 return status;
240}
241
242/**
Emil Tantilov68c70052011-04-20 08:49:06 +0000243 * ixgbe_read_eerd_buffer_X540 - Read EEPROM word(s) using EERD
244 * @hw: pointer to hardware structure
245 * @offset: offset of word in the EEPROM to read
246 * @words: number of words
247 * @data: word(s) read from the EEPROM
248 *
249 * Reads a 16 bit word(s) from the EEPROM using the EERD register.
250 **/
251static s32 ixgbe_read_eerd_buffer_X540(struct ixgbe_hw *hw,
252 u16 offset, u16 words, u16 *data)
253{
Mark Rustade48566962014-07-22 06:50:42 +0000254 s32 status;
Emil Tantilov68c70052011-04-20 08:49:06 +0000255
Mark Rustade48566962014-07-22 06:50:42 +0000256 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
257 return IXGBE_ERR_SWFW_SYNC;
258
259 status = ixgbe_read_eerd_buffer_generic(hw, offset, words, data);
Emil Tantilov68c70052011-04-20 08:49:06 +0000260
261 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
262 return status;
263}
264
265/**
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000266 * ixgbe_write_eewr_X540 - Write EEPROM word using EEWR
267 * @hw: pointer to hardware structure
268 * @offset: offset of word in the EEPROM to write
269 * @data: word write to the EEPROM
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800270 *
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000271 * Write a 16 bit word to the EEPROM using the EEWR register.
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800272 **/
Don Skidmoreb93a2222010-11-16 19:27:17 -0800273static s32 ixgbe_write_eewr_X540(struct ixgbe_hw *hw, u16 offset, u16 data)
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800274{
Mark Rustade48566962014-07-22 06:50:42 +0000275 s32 status;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800276
Mark Rustade48566962014-07-22 06:50:42 +0000277 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
278 return IXGBE_ERR_SWFW_SYNC;
279
280 status = ixgbe_write_eewr_generic(hw, offset, data);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800281
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000282 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800283 return status;
284}
285
286/**
Emil Tantilov68c70052011-04-20 08:49:06 +0000287 * ixgbe_write_eewr_buffer_X540 - Write EEPROM word(s) using EEWR
288 * @hw: pointer to hardware structure
289 * @offset: offset of word in the EEPROM to write
290 * @words: number of words
291 * @data: word(s) write to the EEPROM
292 *
293 * Write a 16 bit word(s) to the EEPROM using the EEWR register.
294 **/
295static s32 ixgbe_write_eewr_buffer_X540(struct ixgbe_hw *hw,
296 u16 offset, u16 words, u16 *data)
297{
Mark Rustade48566962014-07-22 06:50:42 +0000298 s32 status;
Emil Tantilov68c70052011-04-20 08:49:06 +0000299
Mark Rustade48566962014-07-22 06:50:42 +0000300 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
301 return IXGBE_ERR_SWFW_SYNC;
302
303 status = ixgbe_write_eewr_buffer_generic(hw, offset, words, data);
Emil Tantilov68c70052011-04-20 08:49:06 +0000304
305 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
306 return status;
307}
308
309/**
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000310 * ixgbe_calc_eeprom_checksum_X540 - Calculates and returns the checksum
311 *
312 * This function does not use synchronization for EERD and EEWR. It can
313 * be used internally by function which utilize ixgbe_acquire_swfw_sync_X540.
314 *
315 * @hw: pointer to hardware structure
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800316 **/
Don Skidmore735c35a2014-11-29 05:22:48 +0000317static s32 ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw)
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800318{
319 u16 i;
320 u16 j;
321 u16 checksum = 0;
322 u16 length = 0;
323 u16 pointer = 0;
324 u16 word = 0;
Don Skidmore735c35a2014-11-29 05:22:48 +0000325 u16 checksum_last_word = IXGBE_EEPROM_CHECKSUM;
326 u16 ptr_start = IXGBE_PCIE_ANALOG_PTR;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800327
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000328 /*
329 * Do not use hw->eeprom.ops.read because we do not want to take
330 * the synchronization semaphores here. Instead use
331 * ixgbe_read_eerd_generic
332 */
333
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800334 /* Include 0x0-0x3F in the checksum */
Don Skidmore735c35a2014-11-29 05:22:48 +0000335 for (i = 0; i < checksum_last_word; i++) {
336 if (ixgbe_read_eerd_generic(hw, i, &word)) {
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800337 hw_dbg(hw, "EEPROM read failed\n");
Don Skidmore735c35a2014-11-29 05:22:48 +0000338 return IXGBE_ERR_EEPROM;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800339 }
340 checksum += word;
341 }
342
343 /*
344 * Include all data from pointers 0x3, 0x6-0xE. This excludes the
345 * FW, PHY module, and PCIe Expansion/Option ROM pointers.
346 */
Don Skidmore735c35a2014-11-29 05:22:48 +0000347 for (i = ptr_start; i < IXGBE_FW_PTR; i++) {
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800348 if (i == IXGBE_PHY_PTR || i == IXGBE_OPTION_ROM_PTR)
349 continue;
350
Don Skidmore735c35a2014-11-29 05:22:48 +0000351 if (ixgbe_read_eerd_generic(hw, i, &pointer)) {
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800352 hw_dbg(hw, "EEPROM read failed\n");
353 break;
354 }
355
356 /* Skip pointer section if the pointer is invalid. */
357 if (pointer == 0xFFFF || pointer == 0 ||
358 pointer >= hw->eeprom.word_size)
359 continue;
360
Don Skidmore735c35a2014-11-29 05:22:48 +0000361 if (ixgbe_read_eerd_generic(hw, pointer, &length)) {
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800362 hw_dbg(hw, "EEPROM read failed\n");
Don Skidmore735c35a2014-11-29 05:22:48 +0000363 return IXGBE_ERR_EEPROM;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800364 break;
365 }
366
367 /* Skip pointer section if length is invalid. */
368 if (length == 0xFFFF || length == 0 ||
369 (pointer + length) >= hw->eeprom.word_size)
370 continue;
371
Don Skidmore735c35a2014-11-29 05:22:48 +0000372 for (j = pointer + 1; j <= pointer + length; j++) {
373 if (ixgbe_read_eerd_generic(hw, j, &word)) {
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800374 hw_dbg(hw, "EEPROM read failed\n");
Don Skidmore735c35a2014-11-29 05:22:48 +0000375 return IXGBE_ERR_EEPROM;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800376 }
377 checksum += word;
378 }
379 }
380
381 checksum = (u16)IXGBE_EEPROM_SUM - checksum;
382
Don Skidmore735c35a2014-11-29 05:22:48 +0000383 return (s32)checksum;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800384}
385
386/**
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000387 * ixgbe_validate_eeprom_checksum_X540 - Validate EEPROM checksum
388 * @hw: pointer to hardware structure
389 * @checksum_val: calculated checksum
390 *
391 * Performs checksum calculation and validates the EEPROM checksum. If the
392 * caller does not need checksum_val, the value can be NULL.
393 **/
394static s32 ixgbe_validate_eeprom_checksum_X540(struct ixgbe_hw *hw,
395 u16 *checksum_val)
396{
397 s32 status;
398 u16 checksum;
399 u16 read_checksum = 0;
400
Mark Rustade48566962014-07-22 06:50:42 +0000401 /* Read the first word from the EEPROM. If this times out or fails, do
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000402 * not continue or we could be in for a very long wait while every
403 * EEPROM read fails
404 */
405 status = hw->eeprom.ops.read(hw, 0, &checksum);
Mark Rustade48566962014-07-22 06:50:42 +0000406 if (status) {
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000407 hw_dbg(hw, "EEPROM read failed\n");
Mark Rustade48566962014-07-22 06:50:42 +0000408 return status;
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000409 }
410
Mark Rustade48566962014-07-22 06:50:42 +0000411 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
412 return IXGBE_ERR_SWFW_SYNC;
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000413
Don Skidmore735c35a2014-11-29 05:22:48 +0000414 status = hw->eeprom.ops.calc_checksum(hw);
415 if (status < 0)
416 goto out;
417
418 checksum = (u16)(status & 0xffff);
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000419
Mark Rustade48566962014-07-22 06:50:42 +0000420 /* Do not use hw->eeprom.ops.read because we do not want to take
421 * the synchronization semaphores twice here.
422 */
423 status = ixgbe_read_eerd_generic(hw, IXGBE_EEPROM_CHECKSUM,
424 &read_checksum);
Don Skidmore735c35a2014-11-29 05:22:48 +0000425 if (status)
426 goto out;
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000427
Don Skidmore735c35a2014-11-29 05:22:48 +0000428 /* Verify read checksum from EEPROM is the same as
429 * calculated checksum
430 */
431 if (read_checksum != checksum) {
432 hw_dbg(hw, "Invalid EEPROM checksum");
433 status = IXGBE_ERR_EEPROM_CHECKSUM;
434 }
Mark Rustade48566962014-07-22 06:50:42 +0000435
436 /* If the user cares, return the calculated checksum */
437 if (checksum_val)
438 *checksum_val = checksum;
439
Don Skidmore735c35a2014-11-29 05:22:48 +0000440out:
441 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
Mark Rustade48566962014-07-22 06:50:42 +0000442
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000443 return status;
444}
445
446/**
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800447 * ixgbe_update_eeprom_checksum_X540 - Updates the EEPROM checksum and flash
448 * @hw: pointer to hardware structure
449 *
450 * After writing EEPROM to shadow RAM using EEWR register, software calculates
451 * checksum and updates the EEPROM and instructs the hardware to update
452 * the flash.
453 **/
Don Skidmoreb93a2222010-11-16 19:27:17 -0800454static s32 ixgbe_update_eeprom_checksum_X540(struct ixgbe_hw *hw)
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800455{
456 s32 status;
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000457 u16 checksum;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800458
Mark Rustade48566962014-07-22 06:50:42 +0000459 /* Read the first word from the EEPROM. If this times out or fails, do
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000460 * not continue or we could be in for a very long wait while every
461 * EEPROM read fails
462 */
463 status = hw->eeprom.ops.read(hw, 0, &checksum);
Mark Rustade48566962014-07-22 06:50:42 +0000464 if (status) {
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000465 hw_dbg(hw, "EEPROM read failed\n");
Mark Rustade48566962014-07-22 06:50:42 +0000466 return status;
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000467 }
468
Mark Rustade48566962014-07-22 06:50:42 +0000469 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
470 return IXGBE_ERR_SWFW_SYNC;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800471
Don Skidmore735c35a2014-11-29 05:22:48 +0000472 status = hw->eeprom.ops.calc_checksum(hw);
473 if (status < 0)
474 goto out;
475
476 checksum = (u16)(status & 0xffff);
Mark Rustade48566962014-07-22 06:50:42 +0000477
478 /* Do not use hw->eeprom.ops.write because we do not want to
479 * take the synchronization semaphores twice here.
480 */
481 status = ixgbe_write_eewr_generic(hw, IXGBE_EEPROM_CHECKSUM, checksum);
Don Skidmore735c35a2014-11-29 05:22:48 +0000482 if (status)
483 goto out;
Mark Rustade48566962014-07-22 06:50:42 +0000484
Don Skidmore735c35a2014-11-29 05:22:48 +0000485 status = ixgbe_update_flash_X540(hw);
486
487out:
Mark Rustade48566962014-07-22 06:50:42 +0000488 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800489 return status;
490}
491
492/**
493 * ixgbe_update_flash_X540 - Instruct HW to copy EEPROM to Flash device
494 * @hw: pointer to hardware structure
495 *
496 * Set FLUP (bit 23) of the EEC register to instruct Hardware to copy
497 * EEPROM from shadow RAM to the flash device.
498 **/
499static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw)
500{
501 u32 flup;
Mark Rustade90dd262014-07-22 06:51:08 +0000502 s32 status;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800503
504 status = ixgbe_poll_flash_update_done_X540(hw);
505 if (status == IXGBE_ERR_EEPROM) {
506 hw_dbg(hw, "Flash update time out\n");
Mark Rustade90dd262014-07-22 06:51:08 +0000507 return status;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800508 }
509
510 flup = IXGBE_READ_REG(hw, IXGBE_EEC) | IXGBE_EEC_FLUP;
511 IXGBE_WRITE_REG(hw, IXGBE_EEC, flup);
512
513 status = ixgbe_poll_flash_update_done_X540(hw);
Emil Tantilov2ea5ea52011-03-12 08:56:38 +0000514 if (status == 0)
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800515 hw_dbg(hw, "Flash update complete\n");
516 else
517 hw_dbg(hw, "Flash update time out\n");
518
519 if (hw->revision_id == 0) {
520 flup = IXGBE_READ_REG(hw, IXGBE_EEC);
521
522 if (flup & IXGBE_EEC_SEC1VAL) {
523 flup |= IXGBE_EEC_FLUP;
524 IXGBE_WRITE_REG(hw, IXGBE_EEC, flup);
525 }
526
527 status = ixgbe_poll_flash_update_done_X540(hw);
Emil Tantilov2ea5ea52011-03-12 08:56:38 +0000528 if (status == 0)
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800529 hw_dbg(hw, "Flash update complete\n");
530 else
531 hw_dbg(hw, "Flash update time out\n");
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800532 }
Mark Rustade90dd262014-07-22 06:51:08 +0000533
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800534 return status;
535}
536
537/**
538 * ixgbe_poll_flash_update_done_X540 - Poll flash update status
539 * @hw: pointer to hardware structure
540 *
541 * Polls the FLUDONE (bit 26) of the EEC Register to determine when the
542 * flash update is done.
543 **/
544static s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw)
545{
546 u32 i;
547 u32 reg;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800548
549 for (i = 0; i < IXGBE_FLUDONE_ATTEMPTS; i++) {
550 reg = IXGBE_READ_REG(hw, IXGBE_EEC);
Mark Rustade90dd262014-07-22 06:51:08 +0000551 if (reg & IXGBE_EEC_FLUDONE)
552 return 0;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800553 udelay(5);
554 }
Mark Rustade90dd262014-07-22 06:51:08 +0000555 return IXGBE_ERR_EEPROM;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800556}
557
558/**
559 * ixgbe_acquire_swfw_sync_X540 - Acquire SWFW semaphore
560 * @hw: pointer to hardware structure
561 * @mask: Mask to specify which semaphore to acquire
562 *
563 * Acquires the SWFW semaphore thought the SW_FW_SYNC register for
564 * the specified function (CSR, PHY0, PHY1, NVM, Flash)
565 **/
Don Skidmore6a14ee02014-12-05 03:59:50 +0000566s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask)
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800567{
568 u32 swfw_sync;
569 u32 swmask = mask;
570 u32 fwmask = mask << 5;
571 u32 hwmask = 0;
572 u32 timeout = 200;
573 u32 i;
574
575 if (swmask == IXGBE_GSSR_EEP_SM)
576 hwmask = IXGBE_GSSR_FLASH_SM;
577
578 for (i = 0; i < timeout; i++) {
579 /*
580 * SW NVM semaphore bit is used for access to all
581 * SW_FW_SYNC bits (not just NVM)
582 */
583 if (ixgbe_get_swfw_sync_semaphore(hw))
584 return IXGBE_ERR_SWFW_SYNC;
585
586 swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC);
587 if (!(swfw_sync & (fwmask | swmask | hwmask))) {
588 swfw_sync |= swmask;
589 IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC, swfw_sync);
590 ixgbe_release_swfw_sync_semaphore(hw);
591 break;
592 } else {
593 /*
594 * Firmware currently using resource (fwmask),
595 * hardware currently using resource (hwmask),
596 * or other software thread currently using
597 * resource (swmask)
598 */
599 ixgbe_release_swfw_sync_semaphore(hw);
Don Skidmore032b4322011-03-18 09:32:53 +0000600 usleep_range(5000, 10000);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800601 }
602 }
603
604 /*
605 * If the resource is not released by the FW/HW the SW can assume that
606 * the FW/HW malfunctions. In that case the SW should sets the
607 * SW bit(s) of the requested resource(s) while ignoring the
608 * corresponding FW/HW bits in the SW_FW_SYNC register.
609 */
610 if (i >= timeout) {
611 swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC);
612 if (swfw_sync & (fwmask | hwmask)) {
613 if (ixgbe_get_swfw_sync_semaphore(hw))
614 return IXGBE_ERR_SWFW_SYNC;
615
616 swfw_sync |= swmask;
617 IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC, swfw_sync);
618 ixgbe_release_swfw_sync_semaphore(hw);
619 }
620 }
621
Don Skidmore032b4322011-03-18 09:32:53 +0000622 usleep_range(5000, 10000);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800623 return 0;
624}
625
626/**
627 * ixgbe_release_swfw_sync_X540 - Release SWFW semaphore
628 * @hw: pointer to hardware structure
629 * @mask: Mask to specify which semaphore to release
630 *
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300631 * Releases the SWFW semaphore through the SW_FW_SYNC register
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800632 * for the specified function (CSR, PHY0, PHY1, EVM, Flash)
633 **/
Don Skidmore6a14ee02014-12-05 03:59:50 +0000634void ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask)
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800635{
636 u32 swfw_sync;
637 u32 swmask = mask;
638
639 ixgbe_get_swfw_sync_semaphore(hw);
640
641 swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC);
642 swfw_sync &= ~swmask;
643 IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC, swfw_sync);
644
645 ixgbe_release_swfw_sync_semaphore(hw);
Don Skidmore032b4322011-03-18 09:32:53 +0000646 usleep_range(5000, 10000);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800647}
648
649/**
Mark Rustadacb1ce22014-07-22 06:50:47 +0000650 * ixgbe_get_swfw_sync_semaphore - Get hardware semaphore
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800651 * @hw: pointer to hardware structure
652 *
653 * Sets the hardware semaphores so SW/FW can gain control of shared resources
Mark Rustadacb1ce22014-07-22 06:50:47 +0000654 */
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800655static s32 ixgbe_get_swfw_sync_semaphore(struct ixgbe_hw *hw)
656{
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800657 u32 timeout = 2000;
658 u32 i;
659 u32 swsm;
660
661 /* Get SMBI software semaphore between device drivers first */
662 for (i = 0; i < timeout; i++) {
Mark Rustadacb1ce22014-07-22 06:50:47 +0000663 /* If the SMBI bit is 0 when we read it, then the bit will be
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800664 * set and we have the semaphore
665 */
666 swsm = IXGBE_READ_REG(hw, IXGBE_SWSM);
Mark Rustadacb1ce22014-07-22 06:50:47 +0000667 if (!(swsm & IXGBE_SWSM_SMBI))
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800668 break;
Mark Rustadd819fc52014-07-22 06:50:36 +0000669 usleep_range(50, 100);
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800670 }
671
Mark Rustadacb1ce22014-07-22 06:50:47 +0000672 if (i == timeout) {
673 hw_dbg(hw,
674 "Software semaphore SMBI between device drivers not granted.\n");
675 return IXGBE_ERR_EEPROM;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800676 }
677
Mark Rustadacb1ce22014-07-22 06:50:47 +0000678 /* Now get the semaphore between SW/FW through the REGSMP bit */
679 for (i = 0; i < timeout; i++) {
680 swsm = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC);
681 if (!(swsm & IXGBE_SWFW_REGSMP))
682 return 0;
683
684 usleep_range(50, 100);
685 }
686
687 return IXGBE_ERR_EEPROM;
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800688}
689
690/**
691 * ixgbe_release_nvm_semaphore - Release hardware semaphore
692 * @hw: pointer to hardware structure
693 *
694 * This function clears hardware semaphore bits.
695 **/
696static void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw)
697{
698 u32 swsm;
699
700 /* Release both semaphores by writing 0 to the bits REGSMP and SMBI */
701
702 swsm = IXGBE_READ_REG(hw, IXGBE_SWSM);
703 swsm &= ~IXGBE_SWSM_SMBI;
704 IXGBE_WRITE_REG(hw, IXGBE_SWSM, swsm);
705
706 swsm = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC);
707 swsm &= ~IXGBE_SWFW_REGSMP;
708 IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC, swsm);
709
710 IXGBE_WRITE_FLUSH(hw);
711}
712
Emil Tantilov98508c92011-04-08 01:24:05 +0000713/**
714 * ixgbe_blink_led_start_X540 - Blink LED based on index.
715 * @hw: pointer to hardware structure
716 * @index: led number to blink
717 *
718 * Devices that implement the version 2 interface:
719 * X540
720 **/
Don Skidmore6a14ee02014-12-05 03:59:50 +0000721s32 ixgbe_blink_led_start_X540(struct ixgbe_hw *hw, u32 index)
Emil Tantilov98508c92011-04-08 01:24:05 +0000722{
723 u32 macc_reg;
724 u32 ledctl_reg;
Emil Tantilov8d233632011-10-29 06:54:55 +0000725 ixgbe_link_speed speed;
726 bool link_up;
Emil Tantilov98508c92011-04-08 01:24:05 +0000727
728 /*
Emil Tantilov8d233632011-10-29 06:54:55 +0000729 * Link should be up in order for the blink bit in the LED control
730 * register to work. Force link and speed in the MAC if link is down.
731 * This will be reversed when we stop the blinking.
Emil Tantilov98508c92011-04-08 01:24:05 +0000732 */
Emil Tantilov8d233632011-10-29 06:54:55 +0000733 hw->mac.ops.check_link(hw, &speed, &link_up, false);
Joe Perches23677ce2012-02-09 11:17:23 +0000734 if (!link_up) {
Emil Tantilov8d233632011-10-29 06:54:55 +0000735 macc_reg = IXGBE_READ_REG(hw, IXGBE_MACC);
736 macc_reg |= IXGBE_MACC_FLU | IXGBE_MACC_FSV_10G | IXGBE_MACC_FS;
737 IXGBE_WRITE_REG(hw, IXGBE_MACC, macc_reg);
738 }
Emil Tantilov98508c92011-04-08 01:24:05 +0000739 /* Set the LED to LINK_UP + BLINK. */
740 ledctl_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
741 ledctl_reg &= ~IXGBE_LED_MODE_MASK(index);
742 ledctl_reg |= IXGBE_LED_BLINK(index);
743 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, ledctl_reg);
744 IXGBE_WRITE_FLUSH(hw);
745
746 return 0;
747}
748
749/**
750 * ixgbe_blink_led_stop_X540 - Stop blinking LED based on index.
751 * @hw: pointer to hardware structure
752 * @index: led number to stop blinking
753 *
754 * Devices that implement the version 2 interface:
755 * X540
756 **/
Don Skidmore6a14ee02014-12-05 03:59:50 +0000757s32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index)
Emil Tantilov98508c92011-04-08 01:24:05 +0000758{
759 u32 macc_reg;
760 u32 ledctl_reg;
761
762 /* Restore the LED to its default value. */
763 ledctl_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
764 ledctl_reg &= ~IXGBE_LED_MODE_MASK(index);
765 ledctl_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index);
766 ledctl_reg &= ~IXGBE_LED_BLINK(index);
767 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, ledctl_reg);
768
769 /* Unforce link and speed in the MAC. */
770 macc_reg = IXGBE_READ_REG(hw, IXGBE_MACC);
771 macc_reg &= ~(IXGBE_MACC_FLU | IXGBE_MACC_FSV_10G | IXGBE_MACC_FS);
772 IXGBE_WRITE_REG(hw, IXGBE_MACC, macc_reg);
773 IXGBE_WRITE_FLUSH(hw);
774
775 return 0;
776}
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800777static struct ixgbe_mac_operations mac_ops_X540 = {
778 .init_hw = &ixgbe_init_hw_generic,
779 .reset_hw = &ixgbe_reset_hw_X540,
Emil Tantilov7184b7c2011-03-18 08:18:22 +0000780 .start_hw = &ixgbe_start_hw_X540,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800781 .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic,
782 .get_media_type = &ixgbe_get_media_type_X540,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800783 .enable_rx_dma = &ixgbe_enable_rx_dma_generic,
784 .get_mac_addr = &ixgbe_get_mac_addr_generic,
785 .get_san_mac_addr = &ixgbe_get_san_mac_addr_generic,
Emil Tantilovb776d102011-03-31 09:36:18 +0000786 .get_device_caps = &ixgbe_get_device_caps_generic,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800787 .get_wwn_prefix = &ixgbe_get_wwn_prefix_generic,
788 .stop_adapter = &ixgbe_stop_adapter_generic,
789 .get_bus_info = &ixgbe_get_bus_info_generic,
790 .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie,
791 .read_analog_reg8 = NULL,
792 .write_analog_reg8 = NULL,
793 .setup_link = &ixgbe_setup_mac_link_X540,
John Fastabend80605c652011-05-02 12:34:10 +0000794 .set_rxpba = &ixgbe_set_rxpba_generic,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800795 .check_link = &ixgbe_check_mac_link_generic,
796 .get_link_capabilities = &ixgbe_get_copper_link_capabilities_generic,
797 .led_on = &ixgbe_led_on_generic,
798 .led_off = &ixgbe_led_off_generic,
Emil Tantilov98508c92011-04-08 01:24:05 +0000799 .blink_led_start = &ixgbe_blink_led_start_X540,
800 .blink_led_stop = &ixgbe_blink_led_stop_X540,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800801 .set_rar = &ixgbe_set_rar_generic,
802 .clear_rar = &ixgbe_clear_rar_generic,
803 .set_vmdq = &ixgbe_set_vmdq_generic,
Alexander Duyck7fa7c9d2012-05-05 05:32:52 +0000804 .set_vmdq_san_mac = &ixgbe_set_vmdq_san_mac_generic,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800805 .clear_vmdq = &ixgbe_clear_vmdq_generic,
806 .init_rx_addrs = &ixgbe_init_rx_addrs_generic,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800807 .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic,
808 .enable_mc = &ixgbe_enable_mc_generic,
809 .disable_mc = &ixgbe_disable_mc_generic,
810 .clear_vfta = &ixgbe_clear_vfta_generic,
811 .set_vfta = &ixgbe_set_vfta_generic,
812 .fc_enable = &ixgbe_fc_enable_generic,
Emil Tantilov9612de92011-05-07 07:40:20 +0000813 .set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800814 .init_uta_tables = &ixgbe_init_uta_tables_generic,
815 .setup_sfp = NULL,
Greg Rose3377eba792010-12-07 08:16:45 +0000816 .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing,
817 .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing,
Don Skidmore5e655102011-02-25 01:58:04 +0000818 .acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X540,
819 .release_swfw_sync = &ixgbe_release_swfw_sync_X540,
Atita Shirwaikard2f5e7f2012-02-18 02:58:58 +0000820 .disable_rx_buff = &ixgbe_disable_rx_buff_generic,
821 .enable_rx_buff = &ixgbe_enable_rx_buff_generic,
Don Skidmore3ca8bc62012-04-12 00:33:31 +0000822 .get_thermal_sensor_data = NULL,
823 .init_thermal_sensor_thresh = NULL,
Don Skidmore429d6a32014-02-27 20:32:41 -0800824 .prot_autoc_read = &prot_autoc_read_generic,
825 .prot_autoc_write = &prot_autoc_write_generic,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800826};
827
828static struct ixgbe_eeprom_operations eeprom_ops_X540 = {
829 .init_params = &ixgbe_init_eeprom_params_X540,
830 .read = &ixgbe_read_eerd_X540,
Emil Tantilov68c70052011-04-20 08:49:06 +0000831 .read_buffer = &ixgbe_read_eerd_buffer_X540,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800832 .write = &ixgbe_write_eewr_X540,
Emil Tantilov68c70052011-04-20 08:49:06 +0000833 .write_buffer = &ixgbe_write_eewr_buffer_X540,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800834 .calc_checksum = &ixgbe_calc_eeprom_checksum_X540,
Emil Tantiloveb9c3e32011-03-24 00:57:50 +0000835 .validate_checksum = &ixgbe_validate_eeprom_checksum_X540,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800836 .update_checksum = &ixgbe_update_eeprom_checksum_X540,
837};
838
839static struct ixgbe_phy_operations phy_ops_X540 = {
840 .identify = &ixgbe_identify_phy_generic,
841 .identify_sfp = &ixgbe_identify_sfp_module_generic,
842 .init = NULL,
Don Skidmoreb60c5dd2011-02-18 19:29:46 +0000843 .reset = NULL,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800844 .read_reg = &ixgbe_read_phy_reg_generic,
845 .write_reg = &ixgbe_write_phy_reg_generic,
846 .setup_link = &ixgbe_setup_phy_link_generic,
847 .setup_link_speed = &ixgbe_setup_phy_link_speed_generic,
848 .read_i2c_byte = &ixgbe_read_i2c_byte_generic,
849 .write_i2c_byte = &ixgbe_write_i2c_byte_generic,
Emil Tantilov07ce8702012-12-19 07:14:17 +0000850 .read_i2c_sff8472 = &ixgbe_read_i2c_sff8472_generic,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800851 .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic,
852 .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic,
853 .check_overtemp = &ixgbe_tn_check_overtemp,
Emil Tantilov3e7307f2011-09-21 09:02:50 +0000854 .get_firmware_version = &ixgbe_get_phy_firmware_version_generic,
Don Skidmorefe15e8e12010-11-16 19:27:16 -0800855};
856
857struct ixgbe_info ixgbe_X540_info = {
858 .mac = ixgbe_mac_X540,
859 .get_invariants = &ixgbe_get_invariants_X540,
860 .mac_ops = &mac_ops_X540,
861 .eeprom_ops = &eeprom_ops_X540,
862 .phy_ops = &phy_ops_X540,
863 .mbx_ops = &mbx_ops_generic,
864};