18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* Copyright(c) 1999 - 2018 Intel Corporation. */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#include <linux/pci.h> 58c2ecf20Sopenharmony_ci#include <linux/delay.h> 68c2ecf20Sopenharmony_ci#include <linux/sched.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include "ixgbe.h" 98c2ecf20Sopenharmony_ci#include "ixgbe_phy.h" 108c2ecf20Sopenharmony_ci#include "ixgbe_x540.h" 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define IXGBE_X540_MAX_TX_QUEUES 128 138c2ecf20Sopenharmony_ci#define IXGBE_X540_MAX_RX_QUEUES 128 148c2ecf20Sopenharmony_ci#define IXGBE_X540_RAR_ENTRIES 128 158c2ecf20Sopenharmony_ci#define IXGBE_X540_MC_TBL_SIZE 128 168c2ecf20Sopenharmony_ci#define IXGBE_X540_VFT_TBL_SIZE 128 178c2ecf20Sopenharmony_ci#define IXGBE_X540_RX_PB_SIZE 384 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistatic s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw); 208c2ecf20Sopenharmony_cistatic s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw); 218c2ecf20Sopenharmony_cistatic s32 ixgbe_get_swfw_sync_semaphore(struct ixgbe_hw *hw); 228c2ecf20Sopenharmony_cistatic void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw); 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cienum ixgbe_media_type ixgbe_get_media_type_X540(struct ixgbe_hw *hw) 258c2ecf20Sopenharmony_ci{ 268c2ecf20Sopenharmony_ci return ixgbe_media_type_copper; 278c2ecf20Sopenharmony_ci} 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cis32 ixgbe_get_invariants_X540(struct ixgbe_hw *hw) 308c2ecf20Sopenharmony_ci{ 318c2ecf20Sopenharmony_ci struct ixgbe_mac_info *mac = &hw->mac; 328c2ecf20Sopenharmony_ci struct ixgbe_phy_info *phy = &hw->phy; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci /* set_phy_power was set by default to NULL */ 358c2ecf20Sopenharmony_ci phy->ops.set_phy_power = ixgbe_set_copper_phy_power; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci mac->mcft_size = IXGBE_X540_MC_TBL_SIZE; 388c2ecf20Sopenharmony_ci mac->vft_size = IXGBE_X540_VFT_TBL_SIZE; 398c2ecf20Sopenharmony_ci mac->num_rar_entries = IXGBE_X540_RAR_ENTRIES; 408c2ecf20Sopenharmony_ci mac->rx_pb_size = IXGBE_X540_RX_PB_SIZE; 418c2ecf20Sopenharmony_ci mac->max_rx_queues = IXGBE_X540_MAX_RX_QUEUES; 428c2ecf20Sopenharmony_ci mac->max_tx_queues = IXGBE_X540_MAX_TX_QUEUES; 438c2ecf20Sopenharmony_ci mac->max_msix_vectors = ixgbe_get_pcie_msix_count_generic(hw); 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci return 0; 468c2ecf20Sopenharmony_ci} 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/** 498c2ecf20Sopenharmony_ci * ixgbe_setup_mac_link_X540 - Set the auto advertised capabilitires 508c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 518c2ecf20Sopenharmony_ci * @speed: new link speed 528c2ecf20Sopenharmony_ci * @autoneg_wait_to_complete: true when waiting for completion is needed 538c2ecf20Sopenharmony_ci **/ 548c2ecf20Sopenharmony_cis32 ixgbe_setup_mac_link_X540(struct ixgbe_hw *hw, ixgbe_link_speed speed, 558c2ecf20Sopenharmony_ci bool autoneg_wait_to_complete) 568c2ecf20Sopenharmony_ci{ 578c2ecf20Sopenharmony_ci return hw->phy.ops.setup_link_speed(hw, speed, 588c2ecf20Sopenharmony_ci autoneg_wait_to_complete); 598c2ecf20Sopenharmony_ci} 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/** 628c2ecf20Sopenharmony_ci * ixgbe_reset_hw_X540 - Perform hardware reset 638c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 648c2ecf20Sopenharmony_ci * 658c2ecf20Sopenharmony_ci * Resets the hardware by resetting the transmit and receive units, masks 668c2ecf20Sopenharmony_ci * and clears all interrupts, perform a PHY reset, and perform a link (MAC) 678c2ecf20Sopenharmony_ci * reset. 688c2ecf20Sopenharmony_ci **/ 698c2ecf20Sopenharmony_cis32 ixgbe_reset_hw_X540(struct ixgbe_hw *hw) 708c2ecf20Sopenharmony_ci{ 718c2ecf20Sopenharmony_ci s32 status; 728c2ecf20Sopenharmony_ci u32 ctrl, i; 738c2ecf20Sopenharmony_ci u32 swfw_mask = hw->phy.phy_semaphore_mask; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci /* Call adapter stop to disable tx/rx and clear interrupts */ 768c2ecf20Sopenharmony_ci status = hw->mac.ops.stop_adapter(hw); 778c2ecf20Sopenharmony_ci if (status) 788c2ecf20Sopenharmony_ci return status; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci /* flush pending Tx transactions */ 818c2ecf20Sopenharmony_ci ixgbe_clear_tx_pending(hw); 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_cimac_reset_top: 848c2ecf20Sopenharmony_ci status = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask); 858c2ecf20Sopenharmony_ci if (status) { 868c2ecf20Sopenharmony_ci hw_dbg(hw, "semaphore failed with %d", status); 878c2ecf20Sopenharmony_ci return -EBUSY; 888c2ecf20Sopenharmony_ci } 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci ctrl = IXGBE_CTRL_RST; 918c2ecf20Sopenharmony_ci ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL); 928c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl); 938c2ecf20Sopenharmony_ci IXGBE_WRITE_FLUSH(hw); 948c2ecf20Sopenharmony_ci hw->mac.ops.release_swfw_sync(hw, swfw_mask); 958c2ecf20Sopenharmony_ci usleep_range(1000, 1200); 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci /* Poll for reset bit to self-clear indicating reset is complete */ 988c2ecf20Sopenharmony_ci for (i = 0; i < 10; i++) { 998c2ecf20Sopenharmony_ci ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); 1008c2ecf20Sopenharmony_ci if (!(ctrl & IXGBE_CTRL_RST_MASK)) 1018c2ecf20Sopenharmony_ci break; 1028c2ecf20Sopenharmony_ci udelay(1); 1038c2ecf20Sopenharmony_ci } 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci if (ctrl & IXGBE_CTRL_RST_MASK) { 1068c2ecf20Sopenharmony_ci status = -EIO; 1078c2ecf20Sopenharmony_ci hw_dbg(hw, "Reset polling failed to complete.\n"); 1088c2ecf20Sopenharmony_ci } 1098c2ecf20Sopenharmony_ci msleep(100); 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci /* 1128c2ecf20Sopenharmony_ci * Double resets are required for recovery from certain error 1138c2ecf20Sopenharmony_ci * conditions. Between resets, it is necessary to stall to allow time 1148c2ecf20Sopenharmony_ci * for any pending HW events to complete. 1158c2ecf20Sopenharmony_ci */ 1168c2ecf20Sopenharmony_ci if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) { 1178c2ecf20Sopenharmony_ci hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; 1188c2ecf20Sopenharmony_ci goto mac_reset_top; 1198c2ecf20Sopenharmony_ci } 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci /* Set the Rx packet buffer size. */ 1228c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(0), 384 << IXGBE_RXPBSIZE_SHIFT); 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci /* Store the permanent mac address */ 1258c2ecf20Sopenharmony_ci hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci /* 1288c2ecf20Sopenharmony_ci * Store MAC address from RAR0, clear receive address registers, and 1298c2ecf20Sopenharmony_ci * clear the multicast table. Also reset num_rar_entries to 128, 1308c2ecf20Sopenharmony_ci * since we modify this value when programming the SAN MAC address. 1318c2ecf20Sopenharmony_ci */ 1328c2ecf20Sopenharmony_ci hw->mac.num_rar_entries = IXGBE_X540_MAX_TX_QUEUES; 1338c2ecf20Sopenharmony_ci hw->mac.ops.init_rx_addrs(hw); 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci /* Store the permanent SAN mac address */ 1368c2ecf20Sopenharmony_ci hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr); 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci /* Add the SAN MAC address to the RAR only if it's a valid address */ 1398c2ecf20Sopenharmony_ci if (is_valid_ether_addr(hw->mac.san_addr)) { 1408c2ecf20Sopenharmony_ci /* Save the SAN MAC RAR index */ 1418c2ecf20Sopenharmony_ci hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci hw->mac.ops.set_rar(hw, hw->mac.san_mac_rar_index, 1448c2ecf20Sopenharmony_ci hw->mac.san_addr, 0, IXGBE_RAH_AV); 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci /* clear VMDq pool/queue selection for this RAR */ 1478c2ecf20Sopenharmony_ci hw->mac.ops.clear_vmdq(hw, hw->mac.san_mac_rar_index, 1488c2ecf20Sopenharmony_ci IXGBE_CLEAR_VMDQ_ALL); 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci /* Reserve the last RAR for the SAN MAC address */ 1518c2ecf20Sopenharmony_ci hw->mac.num_rar_entries--; 1528c2ecf20Sopenharmony_ci } 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci /* Store the alternative WWNN/WWPN prefix */ 1558c2ecf20Sopenharmony_ci hw->mac.ops.get_wwn_prefix(hw, &hw->mac.wwnn_prefix, 1568c2ecf20Sopenharmony_ci &hw->mac.wwpn_prefix); 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci return status; 1598c2ecf20Sopenharmony_ci} 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci/** 1628c2ecf20Sopenharmony_ci * ixgbe_start_hw_X540 - Prepare hardware for Tx/Rx 1638c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 1648c2ecf20Sopenharmony_ci * 1658c2ecf20Sopenharmony_ci * Starts the hardware using the generic start_hw function 1668c2ecf20Sopenharmony_ci * and the generation start_hw function. 1678c2ecf20Sopenharmony_ci * Then performs revision-specific operations, if any. 1688c2ecf20Sopenharmony_ci **/ 1698c2ecf20Sopenharmony_cis32 ixgbe_start_hw_X540(struct ixgbe_hw *hw) 1708c2ecf20Sopenharmony_ci{ 1718c2ecf20Sopenharmony_ci s32 ret_val; 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci ret_val = ixgbe_start_hw_generic(hw); 1748c2ecf20Sopenharmony_ci if (ret_val) 1758c2ecf20Sopenharmony_ci return ret_val; 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci return ixgbe_start_hw_gen2(hw); 1788c2ecf20Sopenharmony_ci} 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci/** 1818c2ecf20Sopenharmony_ci * ixgbe_init_eeprom_params_X540 - Initialize EEPROM params 1828c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 1838c2ecf20Sopenharmony_ci * 1848c2ecf20Sopenharmony_ci * Initializes the EEPROM parameters ixgbe_eeprom_info within the 1858c2ecf20Sopenharmony_ci * ixgbe_hw struct in order to set up EEPROM access. 1868c2ecf20Sopenharmony_ci **/ 1878c2ecf20Sopenharmony_cis32 ixgbe_init_eeprom_params_X540(struct ixgbe_hw *hw) 1888c2ecf20Sopenharmony_ci{ 1898c2ecf20Sopenharmony_ci struct ixgbe_eeprom_info *eeprom = &hw->eeprom; 1908c2ecf20Sopenharmony_ci u32 eec; 1918c2ecf20Sopenharmony_ci u16 eeprom_size; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci if (eeprom->type == ixgbe_eeprom_uninitialized) { 1948c2ecf20Sopenharmony_ci eeprom->semaphore_delay = 10; 1958c2ecf20Sopenharmony_ci eeprom->type = ixgbe_flash; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci eec = IXGBE_READ_REG(hw, IXGBE_EEC(hw)); 1988c2ecf20Sopenharmony_ci eeprom_size = (u16)((eec & IXGBE_EEC_SIZE) >> 1998c2ecf20Sopenharmony_ci IXGBE_EEC_SIZE_SHIFT); 2008c2ecf20Sopenharmony_ci eeprom->word_size = BIT(eeprom_size + 2018c2ecf20Sopenharmony_ci IXGBE_EEPROM_WORD_SIZE_SHIFT); 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci hw_dbg(hw, "Eeprom params: type = %d, size = %d\n", 2048c2ecf20Sopenharmony_ci eeprom->type, eeprom->word_size); 2058c2ecf20Sopenharmony_ci } 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci return 0; 2088c2ecf20Sopenharmony_ci} 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci/** 2118c2ecf20Sopenharmony_ci * ixgbe_read_eerd_X540- Read EEPROM word using EERD 2128c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 2138c2ecf20Sopenharmony_ci * @offset: offset of word in the EEPROM to read 2148c2ecf20Sopenharmony_ci * @data: word read from the EEPROM 2158c2ecf20Sopenharmony_ci * 2168c2ecf20Sopenharmony_ci * Reads a 16 bit word from the EEPROM using the EERD register. 2178c2ecf20Sopenharmony_ci **/ 2188c2ecf20Sopenharmony_cistatic s32 ixgbe_read_eerd_X540(struct ixgbe_hw *hw, u16 offset, u16 *data) 2198c2ecf20Sopenharmony_ci{ 2208c2ecf20Sopenharmony_ci s32 status; 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 2238c2ecf20Sopenharmony_ci return -EBUSY; 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci status = ixgbe_read_eerd_generic(hw, offset, data); 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); 2288c2ecf20Sopenharmony_ci return status; 2298c2ecf20Sopenharmony_ci} 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci/** 2328c2ecf20Sopenharmony_ci * ixgbe_read_eerd_buffer_X540 - Read EEPROM word(s) using EERD 2338c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 2348c2ecf20Sopenharmony_ci * @offset: offset of word in the EEPROM to read 2358c2ecf20Sopenharmony_ci * @words: number of words 2368c2ecf20Sopenharmony_ci * @data: word(s) read from the EEPROM 2378c2ecf20Sopenharmony_ci * 2388c2ecf20Sopenharmony_ci * Reads a 16 bit word(s) from the EEPROM using the EERD register. 2398c2ecf20Sopenharmony_ci **/ 2408c2ecf20Sopenharmony_cistatic s32 ixgbe_read_eerd_buffer_X540(struct ixgbe_hw *hw, 2418c2ecf20Sopenharmony_ci u16 offset, u16 words, u16 *data) 2428c2ecf20Sopenharmony_ci{ 2438c2ecf20Sopenharmony_ci s32 status; 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 2468c2ecf20Sopenharmony_ci return -EBUSY; 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci status = ixgbe_read_eerd_buffer_generic(hw, offset, words, data); 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); 2518c2ecf20Sopenharmony_ci return status; 2528c2ecf20Sopenharmony_ci} 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci/** 2558c2ecf20Sopenharmony_ci * ixgbe_write_eewr_X540 - Write EEPROM word using EEWR 2568c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 2578c2ecf20Sopenharmony_ci * @offset: offset of word in the EEPROM to write 2588c2ecf20Sopenharmony_ci * @data: word write to the EEPROM 2598c2ecf20Sopenharmony_ci * 2608c2ecf20Sopenharmony_ci * Write a 16 bit word to the EEPROM using the EEWR register. 2618c2ecf20Sopenharmony_ci **/ 2628c2ecf20Sopenharmony_cistatic s32 ixgbe_write_eewr_X540(struct ixgbe_hw *hw, u16 offset, u16 data) 2638c2ecf20Sopenharmony_ci{ 2648c2ecf20Sopenharmony_ci s32 status; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 2678c2ecf20Sopenharmony_ci return -EBUSY; 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ci status = ixgbe_write_eewr_generic(hw, offset, data); 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); 2728c2ecf20Sopenharmony_ci return status; 2738c2ecf20Sopenharmony_ci} 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci/** 2768c2ecf20Sopenharmony_ci * ixgbe_write_eewr_buffer_X540 - Write EEPROM word(s) using EEWR 2778c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 2788c2ecf20Sopenharmony_ci * @offset: offset of word in the EEPROM to write 2798c2ecf20Sopenharmony_ci * @words: number of words 2808c2ecf20Sopenharmony_ci * @data: word(s) write to the EEPROM 2818c2ecf20Sopenharmony_ci * 2828c2ecf20Sopenharmony_ci * Write a 16 bit word(s) to the EEPROM using the EEWR register. 2838c2ecf20Sopenharmony_ci **/ 2848c2ecf20Sopenharmony_cistatic s32 ixgbe_write_eewr_buffer_X540(struct ixgbe_hw *hw, 2858c2ecf20Sopenharmony_ci u16 offset, u16 words, u16 *data) 2868c2ecf20Sopenharmony_ci{ 2878c2ecf20Sopenharmony_ci s32 status; 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 2908c2ecf20Sopenharmony_ci return -EBUSY; 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci status = ixgbe_write_eewr_buffer_generic(hw, offset, words, data); 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); 2958c2ecf20Sopenharmony_ci return status; 2968c2ecf20Sopenharmony_ci} 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci/** 2998c2ecf20Sopenharmony_ci * ixgbe_calc_eeprom_checksum_X540 - Calculates and returns the checksum 3008c2ecf20Sopenharmony_ci * 3018c2ecf20Sopenharmony_ci * This function does not use synchronization for EERD and EEWR. It can 3028c2ecf20Sopenharmony_ci * be used internally by function which utilize ixgbe_acquire_swfw_sync_X540. 3038c2ecf20Sopenharmony_ci * 3048c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 3058c2ecf20Sopenharmony_ci **/ 3068c2ecf20Sopenharmony_cistatic s32 ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw) 3078c2ecf20Sopenharmony_ci{ 3088c2ecf20Sopenharmony_ci u16 i; 3098c2ecf20Sopenharmony_ci u16 j; 3108c2ecf20Sopenharmony_ci u16 checksum = 0; 3118c2ecf20Sopenharmony_ci u16 length = 0; 3128c2ecf20Sopenharmony_ci u16 pointer = 0; 3138c2ecf20Sopenharmony_ci u16 word = 0; 3148c2ecf20Sopenharmony_ci u16 checksum_last_word = IXGBE_EEPROM_CHECKSUM; 3158c2ecf20Sopenharmony_ci u16 ptr_start = IXGBE_PCIE_ANALOG_PTR; 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci /* 3188c2ecf20Sopenharmony_ci * Do not use hw->eeprom.ops.read because we do not want to take 3198c2ecf20Sopenharmony_ci * the synchronization semaphores here. Instead use 3208c2ecf20Sopenharmony_ci * ixgbe_read_eerd_generic 3218c2ecf20Sopenharmony_ci */ 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci /* Include 0x0-0x3F in the checksum */ 3248c2ecf20Sopenharmony_ci for (i = 0; i < checksum_last_word; i++) { 3258c2ecf20Sopenharmony_ci if (ixgbe_read_eerd_generic(hw, i, &word)) { 3268c2ecf20Sopenharmony_ci hw_dbg(hw, "EEPROM read failed\n"); 3278c2ecf20Sopenharmony_ci return -EIO; 3288c2ecf20Sopenharmony_ci } 3298c2ecf20Sopenharmony_ci checksum += word; 3308c2ecf20Sopenharmony_ci } 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci /* 3338c2ecf20Sopenharmony_ci * Include all data from pointers 0x3, 0x6-0xE. This excludes the 3348c2ecf20Sopenharmony_ci * FW, PHY module, and PCIe Expansion/Option ROM pointers. 3358c2ecf20Sopenharmony_ci */ 3368c2ecf20Sopenharmony_ci for (i = ptr_start; i < IXGBE_FW_PTR; i++) { 3378c2ecf20Sopenharmony_ci if (i == IXGBE_PHY_PTR || i == IXGBE_OPTION_ROM_PTR) 3388c2ecf20Sopenharmony_ci continue; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci if (ixgbe_read_eerd_generic(hw, i, &pointer)) { 3418c2ecf20Sopenharmony_ci hw_dbg(hw, "EEPROM read failed\n"); 3428c2ecf20Sopenharmony_ci break; 3438c2ecf20Sopenharmony_ci } 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci /* Skip pointer section if the pointer is invalid. */ 3468c2ecf20Sopenharmony_ci if (pointer == 0xFFFF || pointer == 0 || 3478c2ecf20Sopenharmony_ci pointer >= hw->eeprom.word_size) 3488c2ecf20Sopenharmony_ci continue; 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci if (ixgbe_read_eerd_generic(hw, pointer, &length)) { 3518c2ecf20Sopenharmony_ci hw_dbg(hw, "EEPROM read failed\n"); 3528c2ecf20Sopenharmony_ci return -EIO; 3538c2ecf20Sopenharmony_ci } 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci /* Skip pointer section if length is invalid. */ 3568c2ecf20Sopenharmony_ci if (length == 0xFFFF || length == 0 || 3578c2ecf20Sopenharmony_ci (pointer + length) >= hw->eeprom.word_size) 3588c2ecf20Sopenharmony_ci continue; 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci for (j = pointer + 1; j <= pointer + length; j++) { 3618c2ecf20Sopenharmony_ci if (ixgbe_read_eerd_generic(hw, j, &word)) { 3628c2ecf20Sopenharmony_ci hw_dbg(hw, "EEPROM read failed\n"); 3638c2ecf20Sopenharmony_ci return -EIO; 3648c2ecf20Sopenharmony_ci } 3658c2ecf20Sopenharmony_ci checksum += word; 3668c2ecf20Sopenharmony_ci } 3678c2ecf20Sopenharmony_ci } 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci checksum = (u16)IXGBE_EEPROM_SUM - checksum; 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci return (s32)checksum; 3728c2ecf20Sopenharmony_ci} 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci/** 3758c2ecf20Sopenharmony_ci * ixgbe_validate_eeprom_checksum_X540 - Validate EEPROM checksum 3768c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 3778c2ecf20Sopenharmony_ci * @checksum_val: calculated checksum 3788c2ecf20Sopenharmony_ci * 3798c2ecf20Sopenharmony_ci * Performs checksum calculation and validates the EEPROM checksum. If the 3808c2ecf20Sopenharmony_ci * caller does not need checksum_val, the value can be NULL. 3818c2ecf20Sopenharmony_ci **/ 3828c2ecf20Sopenharmony_cistatic s32 ixgbe_validate_eeprom_checksum_X540(struct ixgbe_hw *hw, 3838c2ecf20Sopenharmony_ci u16 *checksum_val) 3848c2ecf20Sopenharmony_ci{ 3858c2ecf20Sopenharmony_ci s32 status; 3868c2ecf20Sopenharmony_ci u16 checksum; 3878c2ecf20Sopenharmony_ci u16 read_checksum = 0; 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci /* Read the first word from the EEPROM. If this times out or fails, do 3908c2ecf20Sopenharmony_ci * not continue or we could be in for a very long wait while every 3918c2ecf20Sopenharmony_ci * EEPROM read fails 3928c2ecf20Sopenharmony_ci */ 3938c2ecf20Sopenharmony_ci status = hw->eeprom.ops.read(hw, 0, &checksum); 3948c2ecf20Sopenharmony_ci if (status) { 3958c2ecf20Sopenharmony_ci hw_dbg(hw, "EEPROM read failed\n"); 3968c2ecf20Sopenharmony_ci return status; 3978c2ecf20Sopenharmony_ci } 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_ci if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 4008c2ecf20Sopenharmony_ci return -EBUSY; 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_ci status = hw->eeprom.ops.calc_checksum(hw); 4038c2ecf20Sopenharmony_ci if (status < 0) 4048c2ecf20Sopenharmony_ci goto out; 4058c2ecf20Sopenharmony_ci 4068c2ecf20Sopenharmony_ci checksum = (u16)(status & 0xffff); 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci /* Do not use hw->eeprom.ops.read because we do not want to take 4098c2ecf20Sopenharmony_ci * the synchronization semaphores twice here. 4108c2ecf20Sopenharmony_ci */ 4118c2ecf20Sopenharmony_ci status = ixgbe_read_eerd_generic(hw, IXGBE_EEPROM_CHECKSUM, 4128c2ecf20Sopenharmony_ci &read_checksum); 4138c2ecf20Sopenharmony_ci if (status) 4148c2ecf20Sopenharmony_ci goto out; 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci /* Verify read checksum from EEPROM is the same as 4178c2ecf20Sopenharmony_ci * calculated checksum 4188c2ecf20Sopenharmony_ci */ 4198c2ecf20Sopenharmony_ci if (read_checksum != checksum) { 4208c2ecf20Sopenharmony_ci hw_dbg(hw, "Invalid EEPROM checksum"); 4218c2ecf20Sopenharmony_ci status = -EIO; 4228c2ecf20Sopenharmony_ci } 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_ci /* If the user cares, return the calculated checksum */ 4258c2ecf20Sopenharmony_ci if (checksum_val) 4268c2ecf20Sopenharmony_ci *checksum_val = checksum; 4278c2ecf20Sopenharmony_ci 4288c2ecf20Sopenharmony_ciout: 4298c2ecf20Sopenharmony_ci hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_ci return status; 4328c2ecf20Sopenharmony_ci} 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_ci/** 4358c2ecf20Sopenharmony_ci * ixgbe_update_eeprom_checksum_X540 - Updates the EEPROM checksum and flash 4368c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 4378c2ecf20Sopenharmony_ci * 4388c2ecf20Sopenharmony_ci * After writing EEPROM to shadow RAM using EEWR register, software calculates 4398c2ecf20Sopenharmony_ci * checksum and updates the EEPROM and instructs the hardware to update 4408c2ecf20Sopenharmony_ci * the flash. 4418c2ecf20Sopenharmony_ci **/ 4428c2ecf20Sopenharmony_cistatic s32 ixgbe_update_eeprom_checksum_X540(struct ixgbe_hw *hw) 4438c2ecf20Sopenharmony_ci{ 4448c2ecf20Sopenharmony_ci s32 status; 4458c2ecf20Sopenharmony_ci u16 checksum; 4468c2ecf20Sopenharmony_ci 4478c2ecf20Sopenharmony_ci /* Read the first word from the EEPROM. If this times out or fails, do 4488c2ecf20Sopenharmony_ci * not continue or we could be in for a very long wait while every 4498c2ecf20Sopenharmony_ci * EEPROM read fails 4508c2ecf20Sopenharmony_ci */ 4518c2ecf20Sopenharmony_ci status = hw->eeprom.ops.read(hw, 0, &checksum); 4528c2ecf20Sopenharmony_ci if (status) { 4538c2ecf20Sopenharmony_ci hw_dbg(hw, "EEPROM read failed\n"); 4548c2ecf20Sopenharmony_ci return status; 4558c2ecf20Sopenharmony_ci } 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_ci if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM)) 4588c2ecf20Sopenharmony_ci return -EBUSY; 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_ci status = hw->eeprom.ops.calc_checksum(hw); 4618c2ecf20Sopenharmony_ci if (status < 0) 4628c2ecf20Sopenharmony_ci goto out; 4638c2ecf20Sopenharmony_ci 4648c2ecf20Sopenharmony_ci checksum = (u16)(status & 0xffff); 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ci /* Do not use hw->eeprom.ops.write because we do not want to 4678c2ecf20Sopenharmony_ci * take the synchronization semaphores twice here. 4688c2ecf20Sopenharmony_ci */ 4698c2ecf20Sopenharmony_ci status = ixgbe_write_eewr_generic(hw, IXGBE_EEPROM_CHECKSUM, checksum); 4708c2ecf20Sopenharmony_ci if (status) 4718c2ecf20Sopenharmony_ci goto out; 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_ci status = ixgbe_update_flash_X540(hw); 4748c2ecf20Sopenharmony_ci 4758c2ecf20Sopenharmony_ciout: 4768c2ecf20Sopenharmony_ci hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); 4778c2ecf20Sopenharmony_ci return status; 4788c2ecf20Sopenharmony_ci} 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_ci/** 4818c2ecf20Sopenharmony_ci * ixgbe_update_flash_X540 - Instruct HW to copy EEPROM to Flash device 4828c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 4838c2ecf20Sopenharmony_ci * 4848c2ecf20Sopenharmony_ci * Set FLUP (bit 23) of the EEC register to instruct Hardware to copy 4858c2ecf20Sopenharmony_ci * EEPROM from shadow RAM to the flash device. 4868c2ecf20Sopenharmony_ci **/ 4878c2ecf20Sopenharmony_cistatic s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw) 4888c2ecf20Sopenharmony_ci{ 4898c2ecf20Sopenharmony_ci u32 flup; 4908c2ecf20Sopenharmony_ci s32 status; 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_ci status = ixgbe_poll_flash_update_done_X540(hw); 4938c2ecf20Sopenharmony_ci if (status == -EIO) { 4948c2ecf20Sopenharmony_ci hw_dbg(hw, "Flash update time out\n"); 4958c2ecf20Sopenharmony_ci return status; 4968c2ecf20Sopenharmony_ci } 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_ci flup = IXGBE_READ_REG(hw, IXGBE_EEC(hw)) | IXGBE_EEC_FLUP; 4998c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_EEC(hw), flup); 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_ci status = ixgbe_poll_flash_update_done_X540(hw); 5028c2ecf20Sopenharmony_ci if (status == 0) 5038c2ecf20Sopenharmony_ci hw_dbg(hw, "Flash update complete\n"); 5048c2ecf20Sopenharmony_ci else 5058c2ecf20Sopenharmony_ci hw_dbg(hw, "Flash update time out\n"); 5068c2ecf20Sopenharmony_ci 5078c2ecf20Sopenharmony_ci if (hw->revision_id == 0) { 5088c2ecf20Sopenharmony_ci flup = IXGBE_READ_REG(hw, IXGBE_EEC(hw)); 5098c2ecf20Sopenharmony_ci 5108c2ecf20Sopenharmony_ci if (flup & IXGBE_EEC_SEC1VAL) { 5118c2ecf20Sopenharmony_ci flup |= IXGBE_EEC_FLUP; 5128c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_EEC(hw), flup); 5138c2ecf20Sopenharmony_ci } 5148c2ecf20Sopenharmony_ci 5158c2ecf20Sopenharmony_ci status = ixgbe_poll_flash_update_done_X540(hw); 5168c2ecf20Sopenharmony_ci if (status == 0) 5178c2ecf20Sopenharmony_ci hw_dbg(hw, "Flash update complete\n"); 5188c2ecf20Sopenharmony_ci else 5198c2ecf20Sopenharmony_ci hw_dbg(hw, "Flash update time out\n"); 5208c2ecf20Sopenharmony_ci } 5218c2ecf20Sopenharmony_ci 5228c2ecf20Sopenharmony_ci return status; 5238c2ecf20Sopenharmony_ci} 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_ci/** 5268c2ecf20Sopenharmony_ci * ixgbe_poll_flash_update_done_X540 - Poll flash update status 5278c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 5288c2ecf20Sopenharmony_ci * 5298c2ecf20Sopenharmony_ci * Polls the FLUDONE (bit 26) of the EEC Register to determine when the 5308c2ecf20Sopenharmony_ci * flash update is done. 5318c2ecf20Sopenharmony_ci **/ 5328c2ecf20Sopenharmony_cistatic s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw) 5338c2ecf20Sopenharmony_ci{ 5348c2ecf20Sopenharmony_ci u32 i; 5358c2ecf20Sopenharmony_ci u32 reg; 5368c2ecf20Sopenharmony_ci 5378c2ecf20Sopenharmony_ci for (i = 0; i < IXGBE_FLUDONE_ATTEMPTS; i++) { 5388c2ecf20Sopenharmony_ci reg = IXGBE_READ_REG(hw, IXGBE_EEC(hw)); 5398c2ecf20Sopenharmony_ci if (reg & IXGBE_EEC_FLUDONE) 5408c2ecf20Sopenharmony_ci return 0; 5418c2ecf20Sopenharmony_ci udelay(5); 5428c2ecf20Sopenharmony_ci } 5438c2ecf20Sopenharmony_ci return -EIO; 5448c2ecf20Sopenharmony_ci} 5458c2ecf20Sopenharmony_ci 5468c2ecf20Sopenharmony_ci/** 5478c2ecf20Sopenharmony_ci * ixgbe_acquire_swfw_sync_X540 - Acquire SWFW semaphore 5488c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 5498c2ecf20Sopenharmony_ci * @mask: Mask to specify which semaphore to acquire 5508c2ecf20Sopenharmony_ci * 5518c2ecf20Sopenharmony_ci * Acquires the SWFW semaphore thought the SW_FW_SYNC register for 5528c2ecf20Sopenharmony_ci * the specified function (CSR, PHY0, PHY1, NVM, Flash) 5538c2ecf20Sopenharmony_ci **/ 5548c2ecf20Sopenharmony_cis32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask) 5558c2ecf20Sopenharmony_ci{ 5568c2ecf20Sopenharmony_ci u32 swmask = mask & IXGBE_GSSR_NVM_PHY_MASK; 5578c2ecf20Sopenharmony_ci u32 swi2c_mask = mask & IXGBE_GSSR_I2C_MASK; 5588c2ecf20Sopenharmony_ci u32 fwmask = swmask << 5; 5598c2ecf20Sopenharmony_ci u32 timeout = 200; 5608c2ecf20Sopenharmony_ci u32 hwmask = 0; 5618c2ecf20Sopenharmony_ci u32 swfw_sync; 5628c2ecf20Sopenharmony_ci u32 i; 5638c2ecf20Sopenharmony_ci 5648c2ecf20Sopenharmony_ci if (swmask & IXGBE_GSSR_EEP_SM) 5658c2ecf20Sopenharmony_ci hwmask = IXGBE_GSSR_FLASH_SM; 5668c2ecf20Sopenharmony_ci 5678c2ecf20Sopenharmony_ci /* SW only mask does not have FW bit pair */ 5688c2ecf20Sopenharmony_ci if (mask & IXGBE_GSSR_SW_MNG_SM) 5698c2ecf20Sopenharmony_ci swmask |= IXGBE_GSSR_SW_MNG_SM; 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ci swmask |= swi2c_mask; 5728c2ecf20Sopenharmony_ci fwmask |= swi2c_mask << 2; 5738c2ecf20Sopenharmony_ci for (i = 0; i < timeout; i++) { 5748c2ecf20Sopenharmony_ci /* SW NVM semaphore bit is used for access to all 5758c2ecf20Sopenharmony_ci * SW_FW_SYNC bits (not just NVM) 5768c2ecf20Sopenharmony_ci */ 5778c2ecf20Sopenharmony_ci if (ixgbe_get_swfw_sync_semaphore(hw)) 5788c2ecf20Sopenharmony_ci return -EBUSY; 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_ci swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw)); 5818c2ecf20Sopenharmony_ci if (!(swfw_sync & (fwmask | swmask | hwmask))) { 5828c2ecf20Sopenharmony_ci swfw_sync |= swmask; 5838c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC(hw), swfw_sync); 5848c2ecf20Sopenharmony_ci ixgbe_release_swfw_sync_semaphore(hw); 5858c2ecf20Sopenharmony_ci usleep_range(5000, 6000); 5868c2ecf20Sopenharmony_ci return 0; 5878c2ecf20Sopenharmony_ci } 5888c2ecf20Sopenharmony_ci /* Firmware currently using resource (fwmask), hardware 5898c2ecf20Sopenharmony_ci * currently using resource (hwmask), or other software 5908c2ecf20Sopenharmony_ci * thread currently using resource (swmask) 5918c2ecf20Sopenharmony_ci */ 5928c2ecf20Sopenharmony_ci ixgbe_release_swfw_sync_semaphore(hw); 5938c2ecf20Sopenharmony_ci usleep_range(5000, 10000); 5948c2ecf20Sopenharmony_ci } 5958c2ecf20Sopenharmony_ci 5968c2ecf20Sopenharmony_ci /* If the resource is not released by the FW/HW the SW can assume that 5978c2ecf20Sopenharmony_ci * the FW/HW malfunctions. In that case the SW should set the SW bit(s) 5988c2ecf20Sopenharmony_ci * of the requested resource(s) while ignoring the corresponding FW/HW 5998c2ecf20Sopenharmony_ci * bits in the SW_FW_SYNC register. 6008c2ecf20Sopenharmony_ci */ 6018c2ecf20Sopenharmony_ci if (ixgbe_get_swfw_sync_semaphore(hw)) 6028c2ecf20Sopenharmony_ci return -EBUSY; 6038c2ecf20Sopenharmony_ci swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw)); 6048c2ecf20Sopenharmony_ci if (swfw_sync & (fwmask | hwmask)) { 6058c2ecf20Sopenharmony_ci swfw_sync |= swmask; 6068c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC(hw), swfw_sync); 6078c2ecf20Sopenharmony_ci ixgbe_release_swfw_sync_semaphore(hw); 6088c2ecf20Sopenharmony_ci usleep_range(5000, 6000); 6098c2ecf20Sopenharmony_ci return 0; 6108c2ecf20Sopenharmony_ci } 6118c2ecf20Sopenharmony_ci /* If the resource is not released by other SW the SW can assume that 6128c2ecf20Sopenharmony_ci * the other SW malfunctions. In that case the SW should clear all SW 6138c2ecf20Sopenharmony_ci * flags that it does not own and then repeat the whole process once 6148c2ecf20Sopenharmony_ci * again. 6158c2ecf20Sopenharmony_ci */ 6168c2ecf20Sopenharmony_ci if (swfw_sync & swmask) { 6178c2ecf20Sopenharmony_ci u32 rmask = IXGBE_GSSR_EEP_SM | IXGBE_GSSR_PHY0_SM | 6188c2ecf20Sopenharmony_ci IXGBE_GSSR_PHY1_SM | IXGBE_GSSR_MAC_CSR_SM | 6198c2ecf20Sopenharmony_ci IXGBE_GSSR_SW_MNG_SM; 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_ci if (swi2c_mask) 6228c2ecf20Sopenharmony_ci rmask |= IXGBE_GSSR_I2C_MASK; 6238c2ecf20Sopenharmony_ci ixgbe_release_swfw_sync_X540(hw, rmask); 6248c2ecf20Sopenharmony_ci ixgbe_release_swfw_sync_semaphore(hw); 6258c2ecf20Sopenharmony_ci return -EBUSY; 6268c2ecf20Sopenharmony_ci } 6278c2ecf20Sopenharmony_ci ixgbe_release_swfw_sync_semaphore(hw); 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_ci return -EBUSY; 6308c2ecf20Sopenharmony_ci} 6318c2ecf20Sopenharmony_ci 6328c2ecf20Sopenharmony_ci/** 6338c2ecf20Sopenharmony_ci * ixgbe_release_swfw_sync_X540 - Release SWFW semaphore 6348c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 6358c2ecf20Sopenharmony_ci * @mask: Mask to specify which semaphore to release 6368c2ecf20Sopenharmony_ci * 6378c2ecf20Sopenharmony_ci * Releases the SWFW semaphore through the SW_FW_SYNC register 6388c2ecf20Sopenharmony_ci * for the specified function (CSR, PHY0, PHY1, EVM, Flash) 6398c2ecf20Sopenharmony_ci **/ 6408c2ecf20Sopenharmony_civoid ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask) 6418c2ecf20Sopenharmony_ci{ 6428c2ecf20Sopenharmony_ci u32 swmask = mask & (IXGBE_GSSR_NVM_PHY_MASK | IXGBE_GSSR_SW_MNG_SM); 6438c2ecf20Sopenharmony_ci u32 swfw_sync; 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_ci if (mask & IXGBE_GSSR_I2C_MASK) 6468c2ecf20Sopenharmony_ci swmask |= mask & IXGBE_GSSR_I2C_MASK; 6478c2ecf20Sopenharmony_ci ixgbe_get_swfw_sync_semaphore(hw); 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_ci swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw)); 6508c2ecf20Sopenharmony_ci swfw_sync &= ~swmask; 6518c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC(hw), swfw_sync); 6528c2ecf20Sopenharmony_ci 6538c2ecf20Sopenharmony_ci ixgbe_release_swfw_sync_semaphore(hw); 6548c2ecf20Sopenharmony_ci usleep_range(5000, 6000); 6558c2ecf20Sopenharmony_ci} 6568c2ecf20Sopenharmony_ci 6578c2ecf20Sopenharmony_ci/** 6588c2ecf20Sopenharmony_ci * ixgbe_get_swfw_sync_semaphore - Get hardware semaphore 6598c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 6608c2ecf20Sopenharmony_ci * 6618c2ecf20Sopenharmony_ci * Sets the hardware semaphores so SW/FW can gain control of shared resources 6628c2ecf20Sopenharmony_ci */ 6638c2ecf20Sopenharmony_cistatic s32 ixgbe_get_swfw_sync_semaphore(struct ixgbe_hw *hw) 6648c2ecf20Sopenharmony_ci{ 6658c2ecf20Sopenharmony_ci u32 timeout = 2000; 6668c2ecf20Sopenharmony_ci u32 i; 6678c2ecf20Sopenharmony_ci u32 swsm; 6688c2ecf20Sopenharmony_ci 6698c2ecf20Sopenharmony_ci /* Get SMBI software semaphore between device drivers first */ 6708c2ecf20Sopenharmony_ci for (i = 0; i < timeout; i++) { 6718c2ecf20Sopenharmony_ci /* If the SMBI bit is 0 when we read it, then the bit will be 6728c2ecf20Sopenharmony_ci * set and we have the semaphore 6738c2ecf20Sopenharmony_ci */ 6748c2ecf20Sopenharmony_ci swsm = IXGBE_READ_REG(hw, IXGBE_SWSM(hw)); 6758c2ecf20Sopenharmony_ci if (!(swsm & IXGBE_SWSM_SMBI)) 6768c2ecf20Sopenharmony_ci break; 6778c2ecf20Sopenharmony_ci usleep_range(50, 100); 6788c2ecf20Sopenharmony_ci } 6798c2ecf20Sopenharmony_ci 6808c2ecf20Sopenharmony_ci if (i == timeout) { 6818c2ecf20Sopenharmony_ci hw_dbg(hw, 6828c2ecf20Sopenharmony_ci "Software semaphore SMBI between device drivers not granted.\n"); 6838c2ecf20Sopenharmony_ci return -EIO; 6848c2ecf20Sopenharmony_ci } 6858c2ecf20Sopenharmony_ci 6868c2ecf20Sopenharmony_ci /* Now get the semaphore between SW/FW through the REGSMP bit */ 6878c2ecf20Sopenharmony_ci for (i = 0; i < timeout; i++) { 6888c2ecf20Sopenharmony_ci swsm = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw)); 6898c2ecf20Sopenharmony_ci if (!(swsm & IXGBE_SWFW_REGSMP)) 6908c2ecf20Sopenharmony_ci return 0; 6918c2ecf20Sopenharmony_ci 6928c2ecf20Sopenharmony_ci usleep_range(50, 100); 6938c2ecf20Sopenharmony_ci } 6948c2ecf20Sopenharmony_ci 6958c2ecf20Sopenharmony_ci /* Release semaphores and return error if SW NVM semaphore 6968c2ecf20Sopenharmony_ci * was not granted because we do not have access to the EEPROM 6978c2ecf20Sopenharmony_ci */ 6988c2ecf20Sopenharmony_ci hw_dbg(hw, "REGSMP Software NVM semaphore not granted\n"); 6998c2ecf20Sopenharmony_ci ixgbe_release_swfw_sync_semaphore(hw); 7008c2ecf20Sopenharmony_ci return -EIO; 7018c2ecf20Sopenharmony_ci} 7028c2ecf20Sopenharmony_ci 7038c2ecf20Sopenharmony_ci/** 7048c2ecf20Sopenharmony_ci * ixgbe_release_nvm_semaphore - Release hardware semaphore 7058c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 7068c2ecf20Sopenharmony_ci * 7078c2ecf20Sopenharmony_ci * This function clears hardware semaphore bits. 7088c2ecf20Sopenharmony_ci **/ 7098c2ecf20Sopenharmony_cistatic void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw) 7108c2ecf20Sopenharmony_ci{ 7118c2ecf20Sopenharmony_ci u32 swsm; 7128c2ecf20Sopenharmony_ci 7138c2ecf20Sopenharmony_ci /* Release both semaphores by writing 0 to the bits REGSMP and SMBI */ 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_ci swsm = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC(hw)); 7168c2ecf20Sopenharmony_ci swsm &= ~IXGBE_SWFW_REGSMP; 7178c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC(hw), swsm); 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_ci swsm = IXGBE_READ_REG(hw, IXGBE_SWSM(hw)); 7208c2ecf20Sopenharmony_ci swsm &= ~IXGBE_SWSM_SMBI; 7218c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_SWSM(hw), swsm); 7228c2ecf20Sopenharmony_ci 7238c2ecf20Sopenharmony_ci IXGBE_WRITE_FLUSH(hw); 7248c2ecf20Sopenharmony_ci} 7258c2ecf20Sopenharmony_ci 7268c2ecf20Sopenharmony_ci/** 7278c2ecf20Sopenharmony_ci * ixgbe_init_swfw_sync_X540 - Release hardware semaphore 7288c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 7298c2ecf20Sopenharmony_ci * 7308c2ecf20Sopenharmony_ci * This function reset hardware semaphore bits for a semaphore that may 7318c2ecf20Sopenharmony_ci * have be left locked due to a catastrophic failure. 7328c2ecf20Sopenharmony_ci **/ 7338c2ecf20Sopenharmony_civoid ixgbe_init_swfw_sync_X540(struct ixgbe_hw *hw) 7348c2ecf20Sopenharmony_ci{ 7358c2ecf20Sopenharmony_ci u32 rmask; 7368c2ecf20Sopenharmony_ci 7378c2ecf20Sopenharmony_ci /* First try to grab the semaphore but we don't need to bother 7388c2ecf20Sopenharmony_ci * looking to see whether we got the lock or not since we do 7398c2ecf20Sopenharmony_ci * the same thing regardless of whether we got the lock or not. 7408c2ecf20Sopenharmony_ci * We got the lock - we release it. 7418c2ecf20Sopenharmony_ci * We timeout trying to get the lock - we force its release. 7428c2ecf20Sopenharmony_ci */ 7438c2ecf20Sopenharmony_ci ixgbe_get_swfw_sync_semaphore(hw); 7448c2ecf20Sopenharmony_ci ixgbe_release_swfw_sync_semaphore(hw); 7458c2ecf20Sopenharmony_ci 7468c2ecf20Sopenharmony_ci /* Acquire and release all software resources. */ 7478c2ecf20Sopenharmony_ci rmask = IXGBE_GSSR_EEP_SM | IXGBE_GSSR_PHY0_SM | 7488c2ecf20Sopenharmony_ci IXGBE_GSSR_PHY1_SM | IXGBE_GSSR_MAC_CSR_SM | 7498c2ecf20Sopenharmony_ci IXGBE_GSSR_SW_MNG_SM | IXGBE_GSSR_I2C_MASK; 7508c2ecf20Sopenharmony_ci 7518c2ecf20Sopenharmony_ci ixgbe_acquire_swfw_sync_X540(hw, rmask); 7528c2ecf20Sopenharmony_ci ixgbe_release_swfw_sync_X540(hw, rmask); 7538c2ecf20Sopenharmony_ci} 7548c2ecf20Sopenharmony_ci 7558c2ecf20Sopenharmony_ci/** 7568c2ecf20Sopenharmony_ci * ixgbe_blink_led_start_X540 - Blink LED based on index. 7578c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 7588c2ecf20Sopenharmony_ci * @index: led number to blink 7598c2ecf20Sopenharmony_ci * 7608c2ecf20Sopenharmony_ci * Devices that implement the version 2 interface: 7618c2ecf20Sopenharmony_ci * X540 7628c2ecf20Sopenharmony_ci **/ 7638c2ecf20Sopenharmony_cis32 ixgbe_blink_led_start_X540(struct ixgbe_hw *hw, u32 index) 7648c2ecf20Sopenharmony_ci{ 7658c2ecf20Sopenharmony_ci u32 macc_reg; 7668c2ecf20Sopenharmony_ci u32 ledctl_reg; 7678c2ecf20Sopenharmony_ci ixgbe_link_speed speed; 7688c2ecf20Sopenharmony_ci bool link_up; 7698c2ecf20Sopenharmony_ci 7708c2ecf20Sopenharmony_ci if (index > 3) 7718c2ecf20Sopenharmony_ci return -EINVAL; 7728c2ecf20Sopenharmony_ci 7738c2ecf20Sopenharmony_ci /* Link should be up in order for the blink bit in the LED control 7748c2ecf20Sopenharmony_ci * register to work. Force link and speed in the MAC if link is down. 7758c2ecf20Sopenharmony_ci * This will be reversed when we stop the blinking. 7768c2ecf20Sopenharmony_ci */ 7778c2ecf20Sopenharmony_ci hw->mac.ops.check_link(hw, &speed, &link_up, false); 7788c2ecf20Sopenharmony_ci if (!link_up) { 7798c2ecf20Sopenharmony_ci macc_reg = IXGBE_READ_REG(hw, IXGBE_MACC); 7808c2ecf20Sopenharmony_ci macc_reg |= IXGBE_MACC_FLU | IXGBE_MACC_FSV_10G | IXGBE_MACC_FS; 7818c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_MACC, macc_reg); 7828c2ecf20Sopenharmony_ci } 7838c2ecf20Sopenharmony_ci /* Set the LED to LINK_UP + BLINK. */ 7848c2ecf20Sopenharmony_ci ledctl_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); 7858c2ecf20Sopenharmony_ci ledctl_reg &= ~IXGBE_LED_MODE_MASK(index); 7868c2ecf20Sopenharmony_ci ledctl_reg |= IXGBE_LED_BLINK(index); 7878c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, ledctl_reg); 7888c2ecf20Sopenharmony_ci IXGBE_WRITE_FLUSH(hw); 7898c2ecf20Sopenharmony_ci 7908c2ecf20Sopenharmony_ci return 0; 7918c2ecf20Sopenharmony_ci} 7928c2ecf20Sopenharmony_ci 7938c2ecf20Sopenharmony_ci/** 7948c2ecf20Sopenharmony_ci * ixgbe_blink_led_stop_X540 - Stop blinking LED based on index. 7958c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure 7968c2ecf20Sopenharmony_ci * @index: led number to stop blinking 7978c2ecf20Sopenharmony_ci * 7988c2ecf20Sopenharmony_ci * Devices that implement the version 2 interface: 7998c2ecf20Sopenharmony_ci * X540 8008c2ecf20Sopenharmony_ci **/ 8018c2ecf20Sopenharmony_cis32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index) 8028c2ecf20Sopenharmony_ci{ 8038c2ecf20Sopenharmony_ci u32 macc_reg; 8048c2ecf20Sopenharmony_ci u32 ledctl_reg; 8058c2ecf20Sopenharmony_ci 8068c2ecf20Sopenharmony_ci if (index > 3) 8078c2ecf20Sopenharmony_ci return -EINVAL; 8088c2ecf20Sopenharmony_ci 8098c2ecf20Sopenharmony_ci /* Restore the LED to its default value. */ 8108c2ecf20Sopenharmony_ci ledctl_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); 8118c2ecf20Sopenharmony_ci ledctl_reg &= ~IXGBE_LED_MODE_MASK(index); 8128c2ecf20Sopenharmony_ci ledctl_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index); 8138c2ecf20Sopenharmony_ci ledctl_reg &= ~IXGBE_LED_BLINK(index); 8148c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, ledctl_reg); 8158c2ecf20Sopenharmony_ci 8168c2ecf20Sopenharmony_ci /* Unforce link and speed in the MAC. */ 8178c2ecf20Sopenharmony_ci macc_reg = IXGBE_READ_REG(hw, IXGBE_MACC); 8188c2ecf20Sopenharmony_ci macc_reg &= ~(IXGBE_MACC_FLU | IXGBE_MACC_FSV_10G | IXGBE_MACC_FS); 8198c2ecf20Sopenharmony_ci IXGBE_WRITE_REG(hw, IXGBE_MACC, macc_reg); 8208c2ecf20Sopenharmony_ci IXGBE_WRITE_FLUSH(hw); 8218c2ecf20Sopenharmony_ci 8228c2ecf20Sopenharmony_ci return 0; 8238c2ecf20Sopenharmony_ci} 8248c2ecf20Sopenharmony_cistatic const struct ixgbe_mac_operations mac_ops_X540 = { 8258c2ecf20Sopenharmony_ci .init_hw = &ixgbe_init_hw_generic, 8268c2ecf20Sopenharmony_ci .reset_hw = &ixgbe_reset_hw_X540, 8278c2ecf20Sopenharmony_ci .start_hw = &ixgbe_start_hw_X540, 8288c2ecf20Sopenharmony_ci .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic, 8298c2ecf20Sopenharmony_ci .get_media_type = &ixgbe_get_media_type_X540, 8308c2ecf20Sopenharmony_ci .enable_rx_dma = &ixgbe_enable_rx_dma_generic, 8318c2ecf20Sopenharmony_ci .get_mac_addr = &ixgbe_get_mac_addr_generic, 8328c2ecf20Sopenharmony_ci .get_san_mac_addr = &ixgbe_get_san_mac_addr_generic, 8338c2ecf20Sopenharmony_ci .get_device_caps = &ixgbe_get_device_caps_generic, 8348c2ecf20Sopenharmony_ci .get_wwn_prefix = &ixgbe_get_wwn_prefix_generic, 8358c2ecf20Sopenharmony_ci .stop_adapter = &ixgbe_stop_adapter_generic, 8368c2ecf20Sopenharmony_ci .get_bus_info = &ixgbe_get_bus_info_generic, 8378c2ecf20Sopenharmony_ci .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie, 8388c2ecf20Sopenharmony_ci .read_analog_reg8 = NULL, 8398c2ecf20Sopenharmony_ci .write_analog_reg8 = NULL, 8408c2ecf20Sopenharmony_ci .setup_link = &ixgbe_setup_mac_link_X540, 8418c2ecf20Sopenharmony_ci .set_rxpba = &ixgbe_set_rxpba_generic, 8428c2ecf20Sopenharmony_ci .check_link = &ixgbe_check_mac_link_generic, 8438c2ecf20Sopenharmony_ci .get_link_capabilities = &ixgbe_get_copper_link_capabilities_generic, 8448c2ecf20Sopenharmony_ci .led_on = &ixgbe_led_on_generic, 8458c2ecf20Sopenharmony_ci .led_off = &ixgbe_led_off_generic, 8468c2ecf20Sopenharmony_ci .init_led_link_act = ixgbe_init_led_link_act_generic, 8478c2ecf20Sopenharmony_ci .blink_led_start = &ixgbe_blink_led_start_X540, 8488c2ecf20Sopenharmony_ci .blink_led_stop = &ixgbe_blink_led_stop_X540, 8498c2ecf20Sopenharmony_ci .set_rar = &ixgbe_set_rar_generic, 8508c2ecf20Sopenharmony_ci .clear_rar = &ixgbe_clear_rar_generic, 8518c2ecf20Sopenharmony_ci .set_vmdq = &ixgbe_set_vmdq_generic, 8528c2ecf20Sopenharmony_ci .set_vmdq_san_mac = &ixgbe_set_vmdq_san_mac_generic, 8538c2ecf20Sopenharmony_ci .clear_vmdq = &ixgbe_clear_vmdq_generic, 8548c2ecf20Sopenharmony_ci .init_rx_addrs = &ixgbe_init_rx_addrs_generic, 8558c2ecf20Sopenharmony_ci .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic, 8568c2ecf20Sopenharmony_ci .enable_mc = &ixgbe_enable_mc_generic, 8578c2ecf20Sopenharmony_ci .disable_mc = &ixgbe_disable_mc_generic, 8588c2ecf20Sopenharmony_ci .clear_vfta = &ixgbe_clear_vfta_generic, 8598c2ecf20Sopenharmony_ci .set_vfta = &ixgbe_set_vfta_generic, 8608c2ecf20Sopenharmony_ci .fc_enable = &ixgbe_fc_enable_generic, 8618c2ecf20Sopenharmony_ci .setup_fc = ixgbe_setup_fc_generic, 8628c2ecf20Sopenharmony_ci .fc_autoneg = ixgbe_fc_autoneg, 8638c2ecf20Sopenharmony_ci .set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic, 8648c2ecf20Sopenharmony_ci .init_uta_tables = &ixgbe_init_uta_tables_generic, 8658c2ecf20Sopenharmony_ci .setup_sfp = NULL, 8668c2ecf20Sopenharmony_ci .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing, 8678c2ecf20Sopenharmony_ci .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing, 8688c2ecf20Sopenharmony_ci .acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X540, 8698c2ecf20Sopenharmony_ci .release_swfw_sync = &ixgbe_release_swfw_sync_X540, 8708c2ecf20Sopenharmony_ci .init_swfw_sync = &ixgbe_init_swfw_sync_X540, 8718c2ecf20Sopenharmony_ci .disable_rx_buff = &ixgbe_disable_rx_buff_generic, 8728c2ecf20Sopenharmony_ci .enable_rx_buff = &ixgbe_enable_rx_buff_generic, 8738c2ecf20Sopenharmony_ci .get_thermal_sensor_data = NULL, 8748c2ecf20Sopenharmony_ci .init_thermal_sensor_thresh = NULL, 8758c2ecf20Sopenharmony_ci .prot_autoc_read = &prot_autoc_read_generic, 8768c2ecf20Sopenharmony_ci .prot_autoc_write = &prot_autoc_write_generic, 8778c2ecf20Sopenharmony_ci .enable_rx = &ixgbe_enable_rx_generic, 8788c2ecf20Sopenharmony_ci .disable_rx = &ixgbe_disable_rx_generic, 8798c2ecf20Sopenharmony_ci}; 8808c2ecf20Sopenharmony_ci 8818c2ecf20Sopenharmony_cistatic const struct ixgbe_eeprom_operations eeprom_ops_X540 = { 8828c2ecf20Sopenharmony_ci .init_params = &ixgbe_init_eeprom_params_X540, 8838c2ecf20Sopenharmony_ci .read = &ixgbe_read_eerd_X540, 8848c2ecf20Sopenharmony_ci .read_buffer = &ixgbe_read_eerd_buffer_X540, 8858c2ecf20Sopenharmony_ci .write = &ixgbe_write_eewr_X540, 8868c2ecf20Sopenharmony_ci .write_buffer = &ixgbe_write_eewr_buffer_X540, 8878c2ecf20Sopenharmony_ci .calc_checksum = &ixgbe_calc_eeprom_checksum_X540, 8888c2ecf20Sopenharmony_ci .validate_checksum = &ixgbe_validate_eeprom_checksum_X540, 8898c2ecf20Sopenharmony_ci .update_checksum = &ixgbe_update_eeprom_checksum_X540, 8908c2ecf20Sopenharmony_ci}; 8918c2ecf20Sopenharmony_ci 8928c2ecf20Sopenharmony_cistatic const struct ixgbe_phy_operations phy_ops_X540 = { 8938c2ecf20Sopenharmony_ci .identify = &ixgbe_identify_phy_generic, 8948c2ecf20Sopenharmony_ci .identify_sfp = &ixgbe_identify_sfp_module_generic, 8958c2ecf20Sopenharmony_ci .init = NULL, 8968c2ecf20Sopenharmony_ci .reset = NULL, 8978c2ecf20Sopenharmony_ci .read_reg = &ixgbe_read_phy_reg_generic, 8988c2ecf20Sopenharmony_ci .write_reg = &ixgbe_write_phy_reg_generic, 8998c2ecf20Sopenharmony_ci .setup_link = &ixgbe_setup_phy_link_generic, 9008c2ecf20Sopenharmony_ci .setup_link_speed = &ixgbe_setup_phy_link_speed_generic, 9018c2ecf20Sopenharmony_ci .read_i2c_byte = &ixgbe_read_i2c_byte_generic, 9028c2ecf20Sopenharmony_ci .write_i2c_byte = &ixgbe_write_i2c_byte_generic, 9038c2ecf20Sopenharmony_ci .read_i2c_sff8472 = &ixgbe_read_i2c_sff8472_generic, 9048c2ecf20Sopenharmony_ci .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic, 9058c2ecf20Sopenharmony_ci .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic, 9068c2ecf20Sopenharmony_ci .check_overtemp = &ixgbe_tn_check_overtemp, 9078c2ecf20Sopenharmony_ci .set_phy_power = &ixgbe_set_copper_phy_power, 9088c2ecf20Sopenharmony_ci}; 9098c2ecf20Sopenharmony_ci 9108c2ecf20Sopenharmony_cistatic const u32 ixgbe_mvals_X540[IXGBE_MVALS_IDX_LIMIT] = { 9118c2ecf20Sopenharmony_ci IXGBE_MVALS_INIT(X540) 9128c2ecf20Sopenharmony_ci}; 9138c2ecf20Sopenharmony_ci 9148c2ecf20Sopenharmony_ciconst struct ixgbe_info ixgbe_X540_info = { 9158c2ecf20Sopenharmony_ci .mac = ixgbe_mac_X540, 9168c2ecf20Sopenharmony_ci .get_invariants = &ixgbe_get_invariants_X540, 9178c2ecf20Sopenharmony_ci .mac_ops = &mac_ops_X540, 9188c2ecf20Sopenharmony_ci .eeprom_ops = &eeprom_ops_X540, 9198c2ecf20Sopenharmony_ci .phy_ops = &phy_ops_X540, 9208c2ecf20Sopenharmony_ci .mbx_ops = &mbx_ops_generic, 9218c2ecf20Sopenharmony_ci .mvals = ixgbe_mvals_X540, 9228c2ecf20Sopenharmony_ci}; 923