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
118c2ecf20Sopenharmony_ci#define IXGBE_82598_MAX_TX_QUEUES 32
128c2ecf20Sopenharmony_ci#define IXGBE_82598_MAX_RX_QUEUES 64
138c2ecf20Sopenharmony_ci#define IXGBE_82598_RAR_ENTRIES   16
148c2ecf20Sopenharmony_ci#define IXGBE_82598_MC_TBL_SIZE  128
158c2ecf20Sopenharmony_ci#define IXGBE_82598_VFT_TBL_SIZE 128
168c2ecf20Sopenharmony_ci#define IXGBE_82598_RX_PB_SIZE	 512
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistatic s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
198c2ecf20Sopenharmony_ci					 ixgbe_link_speed speed,
208c2ecf20Sopenharmony_ci					 bool autoneg_wait_to_complete);
218c2ecf20Sopenharmony_cistatic s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
228c2ecf20Sopenharmony_ci				       u8 *eeprom_data);
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/**
258c2ecf20Sopenharmony_ci *  ixgbe_set_pcie_completion_timeout - set pci-e completion timeout
268c2ecf20Sopenharmony_ci *  @hw: pointer to the HW structure
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci *  The defaults for 82598 should be in the range of 50us to 50ms,
298c2ecf20Sopenharmony_ci *  however the hardware default for these parts is 500us to 1ms which is less
308c2ecf20Sopenharmony_ci *  than the 10ms recommended by the pci-e spec.  To address this we need to
318c2ecf20Sopenharmony_ci *  increase the value to either 10ms to 250ms for capability version 1 config,
328c2ecf20Sopenharmony_ci *  or 16ms to 55ms for version 2.
338c2ecf20Sopenharmony_ci **/
348c2ecf20Sopenharmony_cistatic void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	u32 gcr = IXGBE_READ_REG(hw, IXGBE_GCR);
378c2ecf20Sopenharmony_ci	u16 pcie_devctl2;
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci	if (ixgbe_removed(hw->hw_addr))
408c2ecf20Sopenharmony_ci		return;
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	/* only take action if timeout value is defaulted to 0 */
438c2ecf20Sopenharmony_ci	if (gcr & IXGBE_GCR_CMPL_TMOUT_MASK)
448c2ecf20Sopenharmony_ci		goto out;
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci	/*
478c2ecf20Sopenharmony_ci	 * if capababilities version is type 1 we can write the
488c2ecf20Sopenharmony_ci	 * timeout of 10ms to 250ms through the GCR register
498c2ecf20Sopenharmony_ci	 */
508c2ecf20Sopenharmony_ci	if (!(gcr & IXGBE_GCR_CAP_VER2)) {
518c2ecf20Sopenharmony_ci		gcr |= IXGBE_GCR_CMPL_TMOUT_10ms;
528c2ecf20Sopenharmony_ci		goto out;
538c2ecf20Sopenharmony_ci	}
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	/*
568c2ecf20Sopenharmony_ci	 * for version 2 capabilities we need to write the config space
578c2ecf20Sopenharmony_ci	 * directly in order to set the completion timeout value for
588c2ecf20Sopenharmony_ci	 * 16ms to 55ms
598c2ecf20Sopenharmony_ci	 */
608c2ecf20Sopenharmony_ci	pcie_devctl2 = ixgbe_read_pci_cfg_word(hw, IXGBE_PCI_DEVICE_CONTROL2);
618c2ecf20Sopenharmony_ci	pcie_devctl2 |= IXGBE_PCI_DEVICE_CONTROL2_16ms;
628c2ecf20Sopenharmony_ci	ixgbe_write_pci_cfg_word(hw, IXGBE_PCI_DEVICE_CONTROL2, pcie_devctl2);
638c2ecf20Sopenharmony_ciout:
648c2ecf20Sopenharmony_ci	/* disable completion timeout resend */
658c2ecf20Sopenharmony_ci	gcr &= ~IXGBE_GCR_CMPL_TMOUT_RESEND;
668c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_GCR, gcr);
678c2ecf20Sopenharmony_ci}
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_cistatic s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw)
708c2ecf20Sopenharmony_ci{
718c2ecf20Sopenharmony_ci	struct ixgbe_mac_info *mac = &hw->mac;
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci	/* Call PHY identify routine to get the phy type */
748c2ecf20Sopenharmony_ci	ixgbe_identify_phy_generic(hw);
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci	mac->mcft_size = IXGBE_82598_MC_TBL_SIZE;
778c2ecf20Sopenharmony_ci	mac->vft_size = IXGBE_82598_VFT_TBL_SIZE;
788c2ecf20Sopenharmony_ci	mac->num_rar_entries = IXGBE_82598_RAR_ENTRIES;
798c2ecf20Sopenharmony_ci	mac->rx_pb_size = IXGBE_82598_RX_PB_SIZE;
808c2ecf20Sopenharmony_ci	mac->max_rx_queues = IXGBE_82598_MAX_RX_QUEUES;
818c2ecf20Sopenharmony_ci	mac->max_tx_queues = IXGBE_82598_MAX_TX_QUEUES;
828c2ecf20Sopenharmony_ci	mac->max_msix_vectors = ixgbe_get_pcie_msix_count_generic(hw);
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci	return 0;
858c2ecf20Sopenharmony_ci}
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/**
888c2ecf20Sopenharmony_ci *  ixgbe_init_phy_ops_82598 - PHY/SFP specific init
898c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
908c2ecf20Sopenharmony_ci *
918c2ecf20Sopenharmony_ci *  Initialize any function pointers that were not able to be
928c2ecf20Sopenharmony_ci *  set during get_invariants because the PHY/SFP type was
938c2ecf20Sopenharmony_ci *  not known.  Perform the SFP init if necessary.
948c2ecf20Sopenharmony_ci *
958c2ecf20Sopenharmony_ci **/
968c2ecf20Sopenharmony_cistatic s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
978c2ecf20Sopenharmony_ci{
988c2ecf20Sopenharmony_ci	struct ixgbe_mac_info *mac = &hw->mac;
998c2ecf20Sopenharmony_ci	struct ixgbe_phy_info *phy = &hw->phy;
1008c2ecf20Sopenharmony_ci	s32 ret_val;
1018c2ecf20Sopenharmony_ci	u16 list_offset, data_offset;
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci	/* Identify the PHY */
1048c2ecf20Sopenharmony_ci	phy->ops.identify(hw);
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci	/* Overwrite the link function pointers if copper PHY */
1078c2ecf20Sopenharmony_ci	if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
1088c2ecf20Sopenharmony_ci		mac->ops.setup_link = &ixgbe_setup_copper_link_82598;
1098c2ecf20Sopenharmony_ci		mac->ops.get_link_capabilities =
1108c2ecf20Sopenharmony_ci			&ixgbe_get_copper_link_capabilities_generic;
1118c2ecf20Sopenharmony_ci	}
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci	switch (hw->phy.type) {
1148c2ecf20Sopenharmony_ci	case ixgbe_phy_tn:
1158c2ecf20Sopenharmony_ci		phy->ops.setup_link = &ixgbe_setup_phy_link_tnx;
1168c2ecf20Sopenharmony_ci		phy->ops.check_link = &ixgbe_check_phy_link_tnx;
1178c2ecf20Sopenharmony_ci		break;
1188c2ecf20Sopenharmony_ci	case ixgbe_phy_nl:
1198c2ecf20Sopenharmony_ci		phy->ops.reset = &ixgbe_reset_phy_nl;
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci		/* Call SFP+ identify routine to get the SFP+ module type */
1228c2ecf20Sopenharmony_ci		ret_val = phy->ops.identify_sfp(hw);
1238c2ecf20Sopenharmony_ci		if (ret_val)
1248c2ecf20Sopenharmony_ci			return ret_val;
1258c2ecf20Sopenharmony_ci		if (hw->phy.sfp_type == ixgbe_sfp_type_unknown)
1268c2ecf20Sopenharmony_ci			return -EOPNOTSUPP;
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci		/* Check to see if SFP+ module is supported */
1298c2ecf20Sopenharmony_ci		ret_val = ixgbe_get_sfp_init_sequence_offsets(hw,
1308c2ecf20Sopenharmony_ci							    &list_offset,
1318c2ecf20Sopenharmony_ci							    &data_offset);
1328c2ecf20Sopenharmony_ci		if (ret_val)
1338c2ecf20Sopenharmony_ci			return -EOPNOTSUPP;
1348c2ecf20Sopenharmony_ci		break;
1358c2ecf20Sopenharmony_ci	default:
1368c2ecf20Sopenharmony_ci		break;
1378c2ecf20Sopenharmony_ci	}
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci	return 0;
1408c2ecf20Sopenharmony_ci}
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/**
1438c2ecf20Sopenharmony_ci *  ixgbe_start_hw_82598 - Prepare hardware for Tx/Rx
1448c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
1458c2ecf20Sopenharmony_ci *
1468c2ecf20Sopenharmony_ci *  Starts the hardware using the generic start_hw function.
1478c2ecf20Sopenharmony_ci *  Disables relaxed ordering for archs other than SPARC
1488c2ecf20Sopenharmony_ci *  Then set pcie completion timeout
1498c2ecf20Sopenharmony_ci *
1508c2ecf20Sopenharmony_ci **/
1518c2ecf20Sopenharmony_cistatic s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw)
1528c2ecf20Sopenharmony_ci{
1538c2ecf20Sopenharmony_ci	s32 ret_val;
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci	ret_val = ixgbe_start_hw_generic(hw);
1568c2ecf20Sopenharmony_ci	if (ret_val)
1578c2ecf20Sopenharmony_ci		return ret_val;
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci	/* set the completion timeout for interface */
1608c2ecf20Sopenharmony_ci	ixgbe_set_pcie_completion_timeout(hw);
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci	return 0;
1638c2ecf20Sopenharmony_ci}
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/**
1668c2ecf20Sopenharmony_ci *  ixgbe_get_link_capabilities_82598 - Determines link capabilities
1678c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
1688c2ecf20Sopenharmony_ci *  @speed: pointer to link speed
1698c2ecf20Sopenharmony_ci *  @autoneg: boolean auto-negotiation value
1708c2ecf20Sopenharmony_ci *
1718c2ecf20Sopenharmony_ci *  Determines the link capabilities by reading the AUTOC register.
1728c2ecf20Sopenharmony_ci **/
1738c2ecf20Sopenharmony_cistatic s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,
1748c2ecf20Sopenharmony_ci					     ixgbe_link_speed *speed,
1758c2ecf20Sopenharmony_ci					     bool *autoneg)
1768c2ecf20Sopenharmony_ci{
1778c2ecf20Sopenharmony_ci	u32 autoc = 0;
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci	/*
1808c2ecf20Sopenharmony_ci	 * Determine link capabilities based on the stored value of AUTOC,
1818c2ecf20Sopenharmony_ci	 * which represents EEPROM defaults.  If AUTOC value has not been
1828c2ecf20Sopenharmony_ci	 * stored, use the current register value.
1838c2ecf20Sopenharmony_ci	 */
1848c2ecf20Sopenharmony_ci	if (hw->mac.orig_link_settings_stored)
1858c2ecf20Sopenharmony_ci		autoc = hw->mac.orig_autoc;
1868c2ecf20Sopenharmony_ci	else
1878c2ecf20Sopenharmony_ci		autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci	switch (autoc & IXGBE_AUTOC_LMS_MASK) {
1908c2ecf20Sopenharmony_ci	case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
1918c2ecf20Sopenharmony_ci		*speed = IXGBE_LINK_SPEED_1GB_FULL;
1928c2ecf20Sopenharmony_ci		*autoneg = false;
1938c2ecf20Sopenharmony_ci		break;
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci	case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
1968c2ecf20Sopenharmony_ci		*speed = IXGBE_LINK_SPEED_10GB_FULL;
1978c2ecf20Sopenharmony_ci		*autoneg = false;
1988c2ecf20Sopenharmony_ci		break;
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci	case IXGBE_AUTOC_LMS_1G_AN:
2018c2ecf20Sopenharmony_ci		*speed = IXGBE_LINK_SPEED_1GB_FULL;
2028c2ecf20Sopenharmony_ci		*autoneg = true;
2038c2ecf20Sopenharmony_ci		break;
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci	case IXGBE_AUTOC_LMS_KX4_AN:
2068c2ecf20Sopenharmony_ci	case IXGBE_AUTOC_LMS_KX4_AN_1G_AN:
2078c2ecf20Sopenharmony_ci		*speed = IXGBE_LINK_SPEED_UNKNOWN;
2088c2ecf20Sopenharmony_ci		if (autoc & IXGBE_AUTOC_KX4_SUPP)
2098c2ecf20Sopenharmony_ci			*speed |= IXGBE_LINK_SPEED_10GB_FULL;
2108c2ecf20Sopenharmony_ci		if (autoc & IXGBE_AUTOC_KX_SUPP)
2118c2ecf20Sopenharmony_ci			*speed |= IXGBE_LINK_SPEED_1GB_FULL;
2128c2ecf20Sopenharmony_ci		*autoneg = true;
2138c2ecf20Sopenharmony_ci		break;
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci	default:
2168c2ecf20Sopenharmony_ci		return -EIO;
2178c2ecf20Sopenharmony_ci	}
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci	return 0;
2208c2ecf20Sopenharmony_ci}
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci/**
2238c2ecf20Sopenharmony_ci *  ixgbe_get_media_type_82598 - Determines media type
2248c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
2258c2ecf20Sopenharmony_ci *
2268c2ecf20Sopenharmony_ci *  Returns the media type (fiber, copper, backplane)
2278c2ecf20Sopenharmony_ci **/
2288c2ecf20Sopenharmony_cistatic enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
2298c2ecf20Sopenharmony_ci{
2308c2ecf20Sopenharmony_ci	/* Detect if there is a copper PHY attached. */
2318c2ecf20Sopenharmony_ci	switch (hw->phy.type) {
2328c2ecf20Sopenharmony_ci	case ixgbe_phy_cu_unknown:
2338c2ecf20Sopenharmony_ci	case ixgbe_phy_tn:
2348c2ecf20Sopenharmony_ci		return ixgbe_media_type_copper;
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	default:
2378c2ecf20Sopenharmony_ci		break;
2388c2ecf20Sopenharmony_ci	}
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci	/* Media type for I82598 is based on device ID */
2418c2ecf20Sopenharmony_ci	switch (hw->device_id) {
2428c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598:
2438c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598_BX:
2448c2ecf20Sopenharmony_ci		/* Default device ID is mezzanine card KX/KX4 */
2458c2ecf20Sopenharmony_ci		return ixgbe_media_type_backplane;
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598AF_DUAL_PORT:
2488c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
2498c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
2508c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
2518c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598EB_XF_LR:
2528c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598EB_SFP_LOM:
2538c2ecf20Sopenharmony_ci		return ixgbe_media_type_fiber;
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598EB_CX4:
2568c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
2578c2ecf20Sopenharmony_ci		return ixgbe_media_type_cx4;
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598AT:
2608c2ecf20Sopenharmony_ci	case IXGBE_DEV_ID_82598AT2:
2618c2ecf20Sopenharmony_ci		return ixgbe_media_type_copper;
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci	default:
2648c2ecf20Sopenharmony_ci		return ixgbe_media_type_unknown;
2658c2ecf20Sopenharmony_ci	}
2668c2ecf20Sopenharmony_ci}
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci/**
2698c2ecf20Sopenharmony_ci *  ixgbe_fc_enable_82598 - Enable flow control
2708c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
2718c2ecf20Sopenharmony_ci *
2728c2ecf20Sopenharmony_ci *  Enable flow control according to the current settings.
2738c2ecf20Sopenharmony_ci **/
2748c2ecf20Sopenharmony_cistatic s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)
2758c2ecf20Sopenharmony_ci{
2768c2ecf20Sopenharmony_ci	u32 fctrl_reg;
2778c2ecf20Sopenharmony_ci	u32 rmcs_reg;
2788c2ecf20Sopenharmony_ci	u32 reg;
2798c2ecf20Sopenharmony_ci	u32 fcrtl, fcrth;
2808c2ecf20Sopenharmony_ci	u32 link_speed = 0;
2818c2ecf20Sopenharmony_ci	int i;
2828c2ecf20Sopenharmony_ci	bool link_up;
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci	/* Validate the water mark configuration */
2858c2ecf20Sopenharmony_ci	if (!hw->fc.pause_time)
2868c2ecf20Sopenharmony_ci		return -EINVAL;
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci	/* Low water mark of zero causes XOFF floods */
2898c2ecf20Sopenharmony_ci	for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
2908c2ecf20Sopenharmony_ci		if ((hw->fc.current_mode & ixgbe_fc_tx_pause) &&
2918c2ecf20Sopenharmony_ci		    hw->fc.high_water[i]) {
2928c2ecf20Sopenharmony_ci			if (!hw->fc.low_water[i] ||
2938c2ecf20Sopenharmony_ci			    hw->fc.low_water[i] >= hw->fc.high_water[i]) {
2948c2ecf20Sopenharmony_ci				hw_dbg(hw, "Invalid water mark configuration\n");
2958c2ecf20Sopenharmony_ci				return -EINVAL;
2968c2ecf20Sopenharmony_ci			}
2978c2ecf20Sopenharmony_ci		}
2988c2ecf20Sopenharmony_ci	}
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci	/*
3018c2ecf20Sopenharmony_ci	 * On 82598 having Rx FC on causes resets while doing 1G
3028c2ecf20Sopenharmony_ci	 * so if it's on turn it off once we know link_speed. For
3038c2ecf20Sopenharmony_ci	 * more details see 82598 Specification update.
3048c2ecf20Sopenharmony_ci	 */
3058c2ecf20Sopenharmony_ci	hw->mac.ops.check_link(hw, &link_speed, &link_up, false);
3068c2ecf20Sopenharmony_ci	if (link_up && link_speed == IXGBE_LINK_SPEED_1GB_FULL) {
3078c2ecf20Sopenharmony_ci		switch (hw->fc.requested_mode) {
3088c2ecf20Sopenharmony_ci		case ixgbe_fc_full:
3098c2ecf20Sopenharmony_ci			hw->fc.requested_mode = ixgbe_fc_tx_pause;
3108c2ecf20Sopenharmony_ci			break;
3118c2ecf20Sopenharmony_ci		case ixgbe_fc_rx_pause:
3128c2ecf20Sopenharmony_ci			hw->fc.requested_mode = ixgbe_fc_none;
3138c2ecf20Sopenharmony_ci			break;
3148c2ecf20Sopenharmony_ci		default:
3158c2ecf20Sopenharmony_ci			/* no change */
3168c2ecf20Sopenharmony_ci			break;
3178c2ecf20Sopenharmony_ci		}
3188c2ecf20Sopenharmony_ci	}
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci	/* Negotiate the fc mode to use */
3218c2ecf20Sopenharmony_ci	hw->mac.ops.fc_autoneg(hw);
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci	/* Disable any previous flow control settings */
3248c2ecf20Sopenharmony_ci	fctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);
3258c2ecf20Sopenharmony_ci	fctrl_reg &= ~(IXGBE_FCTRL_RFCE | IXGBE_FCTRL_RPFCE);
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci	rmcs_reg = IXGBE_READ_REG(hw, IXGBE_RMCS);
3288c2ecf20Sopenharmony_ci	rmcs_reg &= ~(IXGBE_RMCS_TFCE_PRIORITY | IXGBE_RMCS_TFCE_802_3X);
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci	/*
3318c2ecf20Sopenharmony_ci	 * The possible values of fc.current_mode are:
3328c2ecf20Sopenharmony_ci	 * 0: Flow control is completely disabled
3338c2ecf20Sopenharmony_ci	 * 1: Rx flow control is enabled (we can receive pause frames,
3348c2ecf20Sopenharmony_ci	 *    but not send pause frames).
3358c2ecf20Sopenharmony_ci	 * 2: Tx flow control is enabled (we can send pause frames but
3368c2ecf20Sopenharmony_ci	 *     we do not support receiving pause frames).
3378c2ecf20Sopenharmony_ci	 * 3: Both Rx and Tx flow control (symmetric) are enabled.
3388c2ecf20Sopenharmony_ci	 * other: Invalid.
3398c2ecf20Sopenharmony_ci	 */
3408c2ecf20Sopenharmony_ci	switch (hw->fc.current_mode) {
3418c2ecf20Sopenharmony_ci	case ixgbe_fc_none:
3428c2ecf20Sopenharmony_ci		/*
3438c2ecf20Sopenharmony_ci		 * Flow control is disabled by software override or autoneg.
3448c2ecf20Sopenharmony_ci		 * The code below will actually disable it in the HW.
3458c2ecf20Sopenharmony_ci		 */
3468c2ecf20Sopenharmony_ci		break;
3478c2ecf20Sopenharmony_ci	case ixgbe_fc_rx_pause:
3488c2ecf20Sopenharmony_ci		/*
3498c2ecf20Sopenharmony_ci		 * Rx Flow control is enabled and Tx Flow control is
3508c2ecf20Sopenharmony_ci		 * disabled by software override. Since there really
3518c2ecf20Sopenharmony_ci		 * isn't a way to advertise that we are capable of RX
3528c2ecf20Sopenharmony_ci		 * Pause ONLY, we will advertise that we support both
3538c2ecf20Sopenharmony_ci		 * symmetric and asymmetric Rx PAUSE.  Later, we will
3548c2ecf20Sopenharmony_ci		 * disable the adapter's ability to send PAUSE frames.
3558c2ecf20Sopenharmony_ci		 */
3568c2ecf20Sopenharmony_ci		fctrl_reg |= IXGBE_FCTRL_RFCE;
3578c2ecf20Sopenharmony_ci		break;
3588c2ecf20Sopenharmony_ci	case ixgbe_fc_tx_pause:
3598c2ecf20Sopenharmony_ci		/*
3608c2ecf20Sopenharmony_ci		 * Tx Flow control is enabled, and Rx Flow control is
3618c2ecf20Sopenharmony_ci		 * disabled by software override.
3628c2ecf20Sopenharmony_ci		 */
3638c2ecf20Sopenharmony_ci		rmcs_reg |= IXGBE_RMCS_TFCE_802_3X;
3648c2ecf20Sopenharmony_ci		break;
3658c2ecf20Sopenharmony_ci	case ixgbe_fc_full:
3668c2ecf20Sopenharmony_ci		/* Flow control (both Rx and Tx) is enabled by SW override. */
3678c2ecf20Sopenharmony_ci		fctrl_reg |= IXGBE_FCTRL_RFCE;
3688c2ecf20Sopenharmony_ci		rmcs_reg |= IXGBE_RMCS_TFCE_802_3X;
3698c2ecf20Sopenharmony_ci		break;
3708c2ecf20Sopenharmony_ci	default:
3718c2ecf20Sopenharmony_ci		hw_dbg(hw, "Flow control param set incorrectly\n");
3728c2ecf20Sopenharmony_ci		return -EIO;
3738c2ecf20Sopenharmony_ci	}
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci	/* Set 802.3x based flow control settings. */
3768c2ecf20Sopenharmony_ci	fctrl_reg |= IXGBE_FCTRL_DPF;
3778c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl_reg);
3788c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_RMCS, rmcs_reg);
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci	/* Set up and enable Rx high/low water mark thresholds, enable XON. */
3818c2ecf20Sopenharmony_ci	for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
3828c2ecf20Sopenharmony_ci		if ((hw->fc.current_mode & ixgbe_fc_tx_pause) &&
3838c2ecf20Sopenharmony_ci		    hw->fc.high_water[i]) {
3848c2ecf20Sopenharmony_ci			fcrtl = (hw->fc.low_water[i] << 10) | IXGBE_FCRTL_XONE;
3858c2ecf20Sopenharmony_ci			fcrth = (hw->fc.high_water[i] << 10) | IXGBE_FCRTH_FCEN;
3868c2ecf20Sopenharmony_ci			IXGBE_WRITE_REG(hw, IXGBE_FCRTL(i), fcrtl);
3878c2ecf20Sopenharmony_ci			IXGBE_WRITE_REG(hw, IXGBE_FCRTH(i), fcrth);
3888c2ecf20Sopenharmony_ci		} else {
3898c2ecf20Sopenharmony_ci			IXGBE_WRITE_REG(hw, IXGBE_FCRTL(i), 0);
3908c2ecf20Sopenharmony_ci			IXGBE_WRITE_REG(hw, IXGBE_FCRTH(i), 0);
3918c2ecf20Sopenharmony_ci		}
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci	}
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci	/* Configure pause time (2 TCs per register) */
3968c2ecf20Sopenharmony_ci	reg = hw->fc.pause_time * 0x00010001;
3978c2ecf20Sopenharmony_ci	for (i = 0; i < (MAX_TRAFFIC_CLASS / 2); i++)
3988c2ecf20Sopenharmony_ci		IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg);
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_ci	/* Configure flow control refresh threshold value */
4018c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_FCRTV, hw->fc.pause_time / 2);
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci	return 0;
4048c2ecf20Sopenharmony_ci}
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci/**
4078c2ecf20Sopenharmony_ci *  ixgbe_start_mac_link_82598 - Configures MAC link settings
4088c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
4098c2ecf20Sopenharmony_ci *  @autoneg_wait_to_complete: true when waiting for completion is needed
4108c2ecf20Sopenharmony_ci *
4118c2ecf20Sopenharmony_ci *  Configures link settings based on values in the ixgbe_hw struct.
4128c2ecf20Sopenharmony_ci *  Restarts the link.  Performs autonegotiation if needed.
4138c2ecf20Sopenharmony_ci **/
4148c2ecf20Sopenharmony_cistatic s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw,
4158c2ecf20Sopenharmony_ci				      bool autoneg_wait_to_complete)
4168c2ecf20Sopenharmony_ci{
4178c2ecf20Sopenharmony_ci	u32 autoc_reg;
4188c2ecf20Sopenharmony_ci	u32 links_reg;
4198c2ecf20Sopenharmony_ci	u32 i;
4208c2ecf20Sopenharmony_ci	s32 status = 0;
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ci	/* Restart link */
4238c2ecf20Sopenharmony_ci	autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
4248c2ecf20Sopenharmony_ci	autoc_reg |= IXGBE_AUTOC_AN_RESTART;
4258c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci	/* Only poll for autoneg to complete if specified to do so */
4288c2ecf20Sopenharmony_ci	if (autoneg_wait_to_complete) {
4298c2ecf20Sopenharmony_ci		if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
4308c2ecf20Sopenharmony_ci		     IXGBE_AUTOC_LMS_KX4_AN ||
4318c2ecf20Sopenharmony_ci		    (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
4328c2ecf20Sopenharmony_ci		     IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
4338c2ecf20Sopenharmony_ci			links_reg = 0; /* Just in case Autoneg time = 0 */
4348c2ecf20Sopenharmony_ci			for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
4358c2ecf20Sopenharmony_ci				links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
4368c2ecf20Sopenharmony_ci				if (links_reg & IXGBE_LINKS_KX_AN_COMP)
4378c2ecf20Sopenharmony_ci					break;
4388c2ecf20Sopenharmony_ci				msleep(100);
4398c2ecf20Sopenharmony_ci			}
4408c2ecf20Sopenharmony_ci			if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) {
4418c2ecf20Sopenharmony_ci				status = -EIO;
4428c2ecf20Sopenharmony_ci				hw_dbg(hw, "Autonegotiation did not complete.\n");
4438c2ecf20Sopenharmony_ci			}
4448c2ecf20Sopenharmony_ci		}
4458c2ecf20Sopenharmony_ci	}
4468c2ecf20Sopenharmony_ci
4478c2ecf20Sopenharmony_ci	/* Add delay to filter out noises during initial link setup */
4488c2ecf20Sopenharmony_ci	msleep(50);
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ci	return status;
4518c2ecf20Sopenharmony_ci}
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci/**
4548c2ecf20Sopenharmony_ci *  ixgbe_validate_link_ready - Function looks for phy link
4558c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
4568c2ecf20Sopenharmony_ci *
4578c2ecf20Sopenharmony_ci *  Function indicates success when phy link is available. If phy is not ready
4588c2ecf20Sopenharmony_ci *  within 5 seconds of MAC indicating link, the function returns error.
4598c2ecf20Sopenharmony_ci **/
4608c2ecf20Sopenharmony_cistatic s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw)
4618c2ecf20Sopenharmony_ci{
4628c2ecf20Sopenharmony_ci	u32 timeout;
4638c2ecf20Sopenharmony_ci	u16 an_reg;
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci	if (hw->device_id != IXGBE_DEV_ID_82598AT2)
4668c2ecf20Sopenharmony_ci		return 0;
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ci	for (timeout = 0;
4698c2ecf20Sopenharmony_ci	     timeout < IXGBE_VALIDATE_LINK_READY_TIMEOUT; timeout++) {
4708c2ecf20Sopenharmony_ci		hw->phy.ops.read_reg(hw, MDIO_STAT1, MDIO_MMD_AN, &an_reg);
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci		if ((an_reg & MDIO_AN_STAT1_COMPLETE) &&
4738c2ecf20Sopenharmony_ci		    (an_reg & MDIO_STAT1_LSTATUS))
4748c2ecf20Sopenharmony_ci			break;
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_ci		msleep(100);
4778c2ecf20Sopenharmony_ci	}
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci	if (timeout == IXGBE_VALIDATE_LINK_READY_TIMEOUT) {
4808c2ecf20Sopenharmony_ci		hw_dbg(hw, "Link was indicated but link is down\n");
4818c2ecf20Sopenharmony_ci		return -EIO;
4828c2ecf20Sopenharmony_ci	}
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci	return 0;
4858c2ecf20Sopenharmony_ci}
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_ci/**
4888c2ecf20Sopenharmony_ci *  ixgbe_check_mac_link_82598 - Get link/speed status
4898c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
4908c2ecf20Sopenharmony_ci *  @speed: pointer to link speed
4918c2ecf20Sopenharmony_ci *  @link_up: true is link is up, false otherwise
4928c2ecf20Sopenharmony_ci *  @link_up_wait_to_complete: bool used to wait for link up or not
4938c2ecf20Sopenharmony_ci *
4948c2ecf20Sopenharmony_ci *  Reads the links register to determine if link is up and the current speed
4958c2ecf20Sopenharmony_ci **/
4968c2ecf20Sopenharmony_cistatic s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
4978c2ecf20Sopenharmony_ci				      ixgbe_link_speed *speed, bool *link_up,
4988c2ecf20Sopenharmony_ci				      bool link_up_wait_to_complete)
4998c2ecf20Sopenharmony_ci{
5008c2ecf20Sopenharmony_ci	u32 links_reg;
5018c2ecf20Sopenharmony_ci	u32 i;
5028c2ecf20Sopenharmony_ci	u16 link_reg, adapt_comp_reg;
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci	/*
5058c2ecf20Sopenharmony_ci	 * SERDES PHY requires us to read link status from register 0xC79F.
5068c2ecf20Sopenharmony_ci	 * Bit 0 set indicates link is up/ready; clear indicates link down.
5078c2ecf20Sopenharmony_ci	 * 0xC00C is read to check that the XAUI lanes are active.  Bit 0
5088c2ecf20Sopenharmony_ci	 * clear indicates active; set indicates inactive.
5098c2ecf20Sopenharmony_ci	 */
5108c2ecf20Sopenharmony_ci	if (hw->phy.type == ixgbe_phy_nl) {
5118c2ecf20Sopenharmony_ci		hw->phy.ops.read_reg(hw, 0xC79F, MDIO_MMD_PMAPMD, &link_reg);
5128c2ecf20Sopenharmony_ci		hw->phy.ops.read_reg(hw, 0xC79F, MDIO_MMD_PMAPMD, &link_reg);
5138c2ecf20Sopenharmony_ci		hw->phy.ops.read_reg(hw, 0xC00C, MDIO_MMD_PMAPMD,
5148c2ecf20Sopenharmony_ci				     &adapt_comp_reg);
5158c2ecf20Sopenharmony_ci		if (link_up_wait_to_complete) {
5168c2ecf20Sopenharmony_ci			for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
5178c2ecf20Sopenharmony_ci				if ((link_reg & 1) &&
5188c2ecf20Sopenharmony_ci				    ((adapt_comp_reg & 1) == 0)) {
5198c2ecf20Sopenharmony_ci					*link_up = true;
5208c2ecf20Sopenharmony_ci					break;
5218c2ecf20Sopenharmony_ci				} else {
5228c2ecf20Sopenharmony_ci					*link_up = false;
5238c2ecf20Sopenharmony_ci				}
5248c2ecf20Sopenharmony_ci				msleep(100);
5258c2ecf20Sopenharmony_ci				hw->phy.ops.read_reg(hw, 0xC79F,
5268c2ecf20Sopenharmony_ci						     MDIO_MMD_PMAPMD,
5278c2ecf20Sopenharmony_ci						     &link_reg);
5288c2ecf20Sopenharmony_ci				hw->phy.ops.read_reg(hw, 0xC00C,
5298c2ecf20Sopenharmony_ci						     MDIO_MMD_PMAPMD,
5308c2ecf20Sopenharmony_ci						     &adapt_comp_reg);
5318c2ecf20Sopenharmony_ci			}
5328c2ecf20Sopenharmony_ci		} else {
5338c2ecf20Sopenharmony_ci			if ((link_reg & 1) && ((adapt_comp_reg & 1) == 0))
5348c2ecf20Sopenharmony_ci				*link_up = true;
5358c2ecf20Sopenharmony_ci			else
5368c2ecf20Sopenharmony_ci				*link_up = false;
5378c2ecf20Sopenharmony_ci		}
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci		if (!*link_up)
5408c2ecf20Sopenharmony_ci			return 0;
5418c2ecf20Sopenharmony_ci	}
5428c2ecf20Sopenharmony_ci
5438c2ecf20Sopenharmony_ci	links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
5448c2ecf20Sopenharmony_ci	if (link_up_wait_to_complete) {
5458c2ecf20Sopenharmony_ci		for (i = 0; i < IXGBE_LINK_UP_TIME; i++) {
5468c2ecf20Sopenharmony_ci			if (links_reg & IXGBE_LINKS_UP) {
5478c2ecf20Sopenharmony_ci				*link_up = true;
5488c2ecf20Sopenharmony_ci				break;
5498c2ecf20Sopenharmony_ci			} else {
5508c2ecf20Sopenharmony_ci				*link_up = false;
5518c2ecf20Sopenharmony_ci			}
5528c2ecf20Sopenharmony_ci			msleep(100);
5538c2ecf20Sopenharmony_ci			links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
5548c2ecf20Sopenharmony_ci		}
5558c2ecf20Sopenharmony_ci	} else {
5568c2ecf20Sopenharmony_ci		if (links_reg & IXGBE_LINKS_UP)
5578c2ecf20Sopenharmony_ci			*link_up = true;
5588c2ecf20Sopenharmony_ci		else
5598c2ecf20Sopenharmony_ci			*link_up = false;
5608c2ecf20Sopenharmony_ci	}
5618c2ecf20Sopenharmony_ci
5628c2ecf20Sopenharmony_ci	if (links_reg & IXGBE_LINKS_SPEED)
5638c2ecf20Sopenharmony_ci		*speed = IXGBE_LINK_SPEED_10GB_FULL;
5648c2ecf20Sopenharmony_ci	else
5658c2ecf20Sopenharmony_ci		*speed = IXGBE_LINK_SPEED_1GB_FULL;
5668c2ecf20Sopenharmony_ci
5678c2ecf20Sopenharmony_ci	if ((hw->device_id == IXGBE_DEV_ID_82598AT2) && *link_up &&
5688c2ecf20Sopenharmony_ci	    (ixgbe_validate_link_ready(hw) != 0))
5698c2ecf20Sopenharmony_ci		*link_up = false;
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_ci	return 0;
5728c2ecf20Sopenharmony_ci}
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ci/**
5758c2ecf20Sopenharmony_ci *  ixgbe_setup_mac_link_82598 - Set MAC link speed
5768c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
5778c2ecf20Sopenharmony_ci *  @speed: new link speed
5788c2ecf20Sopenharmony_ci *  @autoneg_wait_to_complete: true when waiting for completion is needed
5798c2ecf20Sopenharmony_ci *
5808c2ecf20Sopenharmony_ci *  Set the link speed in the AUTOC register and restarts link.
5818c2ecf20Sopenharmony_ci **/
5828c2ecf20Sopenharmony_cistatic s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
5838c2ecf20Sopenharmony_ci				      ixgbe_link_speed speed,
5848c2ecf20Sopenharmony_ci				      bool autoneg_wait_to_complete)
5858c2ecf20Sopenharmony_ci{
5868c2ecf20Sopenharmony_ci	bool		 autoneg	   = false;
5878c2ecf20Sopenharmony_ci	ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
5888c2ecf20Sopenharmony_ci	u32              curr_autoc        = IXGBE_READ_REG(hw, IXGBE_AUTOC);
5898c2ecf20Sopenharmony_ci	u32              autoc             = curr_autoc;
5908c2ecf20Sopenharmony_ci	u32              link_mode         = autoc & IXGBE_AUTOC_LMS_MASK;
5918c2ecf20Sopenharmony_ci
5928c2ecf20Sopenharmony_ci	/* Check to see if speed passed in is supported. */
5938c2ecf20Sopenharmony_ci	ixgbe_get_link_capabilities_82598(hw, &link_capabilities, &autoneg);
5948c2ecf20Sopenharmony_ci	speed &= link_capabilities;
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_ci	if (speed == IXGBE_LINK_SPEED_UNKNOWN)
5978c2ecf20Sopenharmony_ci		return -EINVAL;
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci	/* Set KX4/KX support according to speed requested */
6008c2ecf20Sopenharmony_ci	else if (link_mode == IXGBE_AUTOC_LMS_KX4_AN ||
6018c2ecf20Sopenharmony_ci		 link_mode == IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
6028c2ecf20Sopenharmony_ci		autoc &= ~IXGBE_AUTOC_KX4_KX_SUPP_MASK;
6038c2ecf20Sopenharmony_ci		if (speed & IXGBE_LINK_SPEED_10GB_FULL)
6048c2ecf20Sopenharmony_ci			autoc |= IXGBE_AUTOC_KX4_SUPP;
6058c2ecf20Sopenharmony_ci		if (speed & IXGBE_LINK_SPEED_1GB_FULL)
6068c2ecf20Sopenharmony_ci			autoc |= IXGBE_AUTOC_KX_SUPP;
6078c2ecf20Sopenharmony_ci		if (autoc != curr_autoc)
6088c2ecf20Sopenharmony_ci			IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc);
6098c2ecf20Sopenharmony_ci	}
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci	/* Setup and restart the link based on the new values in
6128c2ecf20Sopenharmony_ci	 * ixgbe_hw This will write the AUTOC register based on the new
6138c2ecf20Sopenharmony_ci	 * stored values
6148c2ecf20Sopenharmony_ci	 */
6158c2ecf20Sopenharmony_ci	return ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete);
6168c2ecf20Sopenharmony_ci}
6178c2ecf20Sopenharmony_ci
6188c2ecf20Sopenharmony_ci
6198c2ecf20Sopenharmony_ci/**
6208c2ecf20Sopenharmony_ci *  ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field
6218c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
6228c2ecf20Sopenharmony_ci *  @speed: new link speed
6238c2ecf20Sopenharmony_ci *  @autoneg_wait_to_complete: true if waiting is needed to complete
6248c2ecf20Sopenharmony_ci *
6258c2ecf20Sopenharmony_ci *  Sets the link speed in the AUTOC register in the MAC and restarts link.
6268c2ecf20Sopenharmony_ci **/
6278c2ecf20Sopenharmony_cistatic s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
6288c2ecf20Sopenharmony_ci					       ixgbe_link_speed speed,
6298c2ecf20Sopenharmony_ci					       bool autoneg_wait_to_complete)
6308c2ecf20Sopenharmony_ci{
6318c2ecf20Sopenharmony_ci	s32 status;
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_ci	/* Setup the PHY according to input speed */
6348c2ecf20Sopenharmony_ci	status = hw->phy.ops.setup_link_speed(hw, speed,
6358c2ecf20Sopenharmony_ci					      autoneg_wait_to_complete);
6368c2ecf20Sopenharmony_ci	/* Set up MAC */
6378c2ecf20Sopenharmony_ci	ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete);
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci	return status;
6408c2ecf20Sopenharmony_ci}
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_ci/**
6438c2ecf20Sopenharmony_ci *  ixgbe_reset_hw_82598 - Performs hardware reset
6448c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
6458c2ecf20Sopenharmony_ci *
6468c2ecf20Sopenharmony_ci *  Resets the hardware by resetting the transmit and receive units, masks and
6478c2ecf20Sopenharmony_ci *  clears all interrupts, performing a PHY reset, and performing a link (MAC)
6488c2ecf20Sopenharmony_ci *  reset.
6498c2ecf20Sopenharmony_ci **/
6508c2ecf20Sopenharmony_cistatic s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
6518c2ecf20Sopenharmony_ci{
6528c2ecf20Sopenharmony_ci	s32 status;
6538c2ecf20Sopenharmony_ci	s32 phy_status = 0;
6548c2ecf20Sopenharmony_ci	u32 ctrl;
6558c2ecf20Sopenharmony_ci	u32 gheccr;
6568c2ecf20Sopenharmony_ci	u32 i;
6578c2ecf20Sopenharmony_ci	u32 autoc;
6588c2ecf20Sopenharmony_ci	u8  analog_val;
6598c2ecf20Sopenharmony_ci
6608c2ecf20Sopenharmony_ci	/* Call adapter stop to disable tx/rx and clear interrupts */
6618c2ecf20Sopenharmony_ci	status = hw->mac.ops.stop_adapter(hw);
6628c2ecf20Sopenharmony_ci	if (status)
6638c2ecf20Sopenharmony_ci		return status;
6648c2ecf20Sopenharmony_ci
6658c2ecf20Sopenharmony_ci	/*
6668c2ecf20Sopenharmony_ci	 * Power up the Atlas Tx lanes if they are currently powered down.
6678c2ecf20Sopenharmony_ci	 * Atlas Tx lanes are powered down for MAC loopback tests, but
6688c2ecf20Sopenharmony_ci	 * they are not automatically restored on reset.
6698c2ecf20Sopenharmony_ci	 */
6708c2ecf20Sopenharmony_ci	hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, &analog_val);
6718c2ecf20Sopenharmony_ci	if (analog_val & IXGBE_ATLAS_PDN_TX_REG_EN) {
6728c2ecf20Sopenharmony_ci		/* Enable Tx Atlas so packets can be transmitted again */
6738c2ecf20Sopenharmony_ci		hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK,
6748c2ecf20Sopenharmony_ci					     &analog_val);
6758c2ecf20Sopenharmony_ci		analog_val &= ~IXGBE_ATLAS_PDN_TX_REG_EN;
6768c2ecf20Sopenharmony_ci		hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK,
6778c2ecf20Sopenharmony_ci					      analog_val);
6788c2ecf20Sopenharmony_ci
6798c2ecf20Sopenharmony_ci		hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_10G,
6808c2ecf20Sopenharmony_ci					     &analog_val);
6818c2ecf20Sopenharmony_ci		analog_val &= ~IXGBE_ATLAS_PDN_TX_10G_QL_ALL;
6828c2ecf20Sopenharmony_ci		hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_10G,
6838c2ecf20Sopenharmony_ci					      analog_val);
6848c2ecf20Sopenharmony_ci
6858c2ecf20Sopenharmony_ci		hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_1G,
6868c2ecf20Sopenharmony_ci					     &analog_val);
6878c2ecf20Sopenharmony_ci		analog_val &= ~IXGBE_ATLAS_PDN_TX_1G_QL_ALL;
6888c2ecf20Sopenharmony_ci		hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_1G,
6898c2ecf20Sopenharmony_ci					      analog_val);
6908c2ecf20Sopenharmony_ci
6918c2ecf20Sopenharmony_ci		hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_AN,
6928c2ecf20Sopenharmony_ci					     &analog_val);
6938c2ecf20Sopenharmony_ci		analog_val &= ~IXGBE_ATLAS_PDN_TX_AN_QL_ALL;
6948c2ecf20Sopenharmony_ci		hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_AN,
6958c2ecf20Sopenharmony_ci					      analog_val);
6968c2ecf20Sopenharmony_ci	}
6978c2ecf20Sopenharmony_ci
6988c2ecf20Sopenharmony_ci	/* Reset PHY */
6998c2ecf20Sopenharmony_ci	if (hw->phy.reset_disable == false) {
7008c2ecf20Sopenharmony_ci		/* PHY ops must be identified and initialized prior to reset */
7018c2ecf20Sopenharmony_ci
7028c2ecf20Sopenharmony_ci		/* Init PHY and function pointers, perform SFP setup */
7038c2ecf20Sopenharmony_ci		phy_status = hw->phy.ops.init(hw);
7048c2ecf20Sopenharmony_ci		if (phy_status == -EOPNOTSUPP)
7058c2ecf20Sopenharmony_ci			return phy_status;
7068c2ecf20Sopenharmony_ci		if (phy_status == -ENOENT)
7078c2ecf20Sopenharmony_ci			goto mac_reset_top;
7088c2ecf20Sopenharmony_ci
7098c2ecf20Sopenharmony_ci		hw->phy.ops.reset(hw);
7108c2ecf20Sopenharmony_ci	}
7118c2ecf20Sopenharmony_ci
7128c2ecf20Sopenharmony_cimac_reset_top:
7138c2ecf20Sopenharmony_ci	/*
7148c2ecf20Sopenharmony_ci	 * Issue global reset to the MAC.  This needs to be a SW reset.
7158c2ecf20Sopenharmony_ci	 * If link reset is used, it might reset the MAC when mng is using it
7168c2ecf20Sopenharmony_ci	 */
7178c2ecf20Sopenharmony_ci	ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL) | IXGBE_CTRL_RST;
7188c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
7198c2ecf20Sopenharmony_ci	IXGBE_WRITE_FLUSH(hw);
7208c2ecf20Sopenharmony_ci	usleep_range(1000, 1200);
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci	/* Poll for reset bit to self-clear indicating reset is complete */
7238c2ecf20Sopenharmony_ci	for (i = 0; i < 10; i++) {
7248c2ecf20Sopenharmony_ci		ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
7258c2ecf20Sopenharmony_ci		if (!(ctrl & IXGBE_CTRL_RST))
7268c2ecf20Sopenharmony_ci			break;
7278c2ecf20Sopenharmony_ci		udelay(1);
7288c2ecf20Sopenharmony_ci	}
7298c2ecf20Sopenharmony_ci	if (ctrl & IXGBE_CTRL_RST) {
7308c2ecf20Sopenharmony_ci		status = -EIO;
7318c2ecf20Sopenharmony_ci		hw_dbg(hw, "Reset polling failed to complete.\n");
7328c2ecf20Sopenharmony_ci	}
7338c2ecf20Sopenharmony_ci
7348c2ecf20Sopenharmony_ci	msleep(50);
7358c2ecf20Sopenharmony_ci
7368c2ecf20Sopenharmony_ci	/*
7378c2ecf20Sopenharmony_ci	 * Double resets are required for recovery from certain error
7388c2ecf20Sopenharmony_ci	 * conditions.  Between resets, it is necessary to stall to allow time
7398c2ecf20Sopenharmony_ci	 * for any pending HW events to complete.
7408c2ecf20Sopenharmony_ci	 */
7418c2ecf20Sopenharmony_ci	if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) {
7428c2ecf20Sopenharmony_ci		hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED;
7438c2ecf20Sopenharmony_ci		goto mac_reset_top;
7448c2ecf20Sopenharmony_ci	}
7458c2ecf20Sopenharmony_ci
7468c2ecf20Sopenharmony_ci	gheccr = IXGBE_READ_REG(hw, IXGBE_GHECCR);
7478c2ecf20Sopenharmony_ci	gheccr &= ~(BIT(21) | BIT(18) | BIT(9) | BIT(6));
7488c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_GHECCR, gheccr);
7498c2ecf20Sopenharmony_ci
7508c2ecf20Sopenharmony_ci	/*
7518c2ecf20Sopenharmony_ci	 * Store the original AUTOC value if it has not been
7528c2ecf20Sopenharmony_ci	 * stored off yet.  Otherwise restore the stored original
7538c2ecf20Sopenharmony_ci	 * AUTOC value since the reset operation sets back to deaults.
7548c2ecf20Sopenharmony_ci	 */
7558c2ecf20Sopenharmony_ci	autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
7568c2ecf20Sopenharmony_ci	if (hw->mac.orig_link_settings_stored == false) {
7578c2ecf20Sopenharmony_ci		hw->mac.orig_autoc = autoc;
7588c2ecf20Sopenharmony_ci		hw->mac.orig_link_settings_stored = true;
7598c2ecf20Sopenharmony_ci	} else if (autoc != hw->mac.orig_autoc) {
7608c2ecf20Sopenharmony_ci		IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc);
7618c2ecf20Sopenharmony_ci	}
7628c2ecf20Sopenharmony_ci
7638c2ecf20Sopenharmony_ci	/* Store the permanent mac address */
7648c2ecf20Sopenharmony_ci	hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
7658c2ecf20Sopenharmony_ci
7668c2ecf20Sopenharmony_ci	/*
7678c2ecf20Sopenharmony_ci	 * Store MAC address from RAR0, clear receive address registers, and
7688c2ecf20Sopenharmony_ci	 * clear the multicast table
7698c2ecf20Sopenharmony_ci	 */
7708c2ecf20Sopenharmony_ci	hw->mac.ops.init_rx_addrs(hw);
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_ci	if (phy_status)
7738c2ecf20Sopenharmony_ci		status = phy_status;
7748c2ecf20Sopenharmony_ci
7758c2ecf20Sopenharmony_ci	return status;
7768c2ecf20Sopenharmony_ci}
7778c2ecf20Sopenharmony_ci
7788c2ecf20Sopenharmony_ci/**
7798c2ecf20Sopenharmony_ci *  ixgbe_set_vmdq_82598 - Associate a VMDq set index with a rx address
7808c2ecf20Sopenharmony_ci *  @hw: pointer to hardware struct
7818c2ecf20Sopenharmony_ci *  @rar: receive address register index to associate with a VMDq index
7828c2ecf20Sopenharmony_ci *  @vmdq: VMDq set index
7838c2ecf20Sopenharmony_ci **/
7848c2ecf20Sopenharmony_cistatic s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
7858c2ecf20Sopenharmony_ci{
7868c2ecf20Sopenharmony_ci	u32 rar_high;
7878c2ecf20Sopenharmony_ci	u32 rar_entries = hw->mac.num_rar_entries;
7888c2ecf20Sopenharmony_ci
7898c2ecf20Sopenharmony_ci	/* Make sure we are using a valid rar index range */
7908c2ecf20Sopenharmony_ci	if (rar >= rar_entries) {
7918c2ecf20Sopenharmony_ci		hw_dbg(hw, "RAR index %d is out of range.\n", rar);
7928c2ecf20Sopenharmony_ci		return -EINVAL;
7938c2ecf20Sopenharmony_ci	}
7948c2ecf20Sopenharmony_ci
7958c2ecf20Sopenharmony_ci	rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar));
7968c2ecf20Sopenharmony_ci	rar_high &= ~IXGBE_RAH_VIND_MASK;
7978c2ecf20Sopenharmony_ci	rar_high |= ((vmdq << IXGBE_RAH_VIND_SHIFT) & IXGBE_RAH_VIND_MASK);
7988c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high);
7998c2ecf20Sopenharmony_ci	return 0;
8008c2ecf20Sopenharmony_ci}
8018c2ecf20Sopenharmony_ci
8028c2ecf20Sopenharmony_ci/**
8038c2ecf20Sopenharmony_ci *  ixgbe_clear_vmdq_82598 - Disassociate a VMDq set index from an rx address
8048c2ecf20Sopenharmony_ci *  @hw: pointer to hardware struct
8058c2ecf20Sopenharmony_ci *  @rar: receive address register index to associate with a VMDq index
8068c2ecf20Sopenharmony_ci *  @vmdq: VMDq clear index (not used in 82598, but elsewhere)
8078c2ecf20Sopenharmony_ci **/
8088c2ecf20Sopenharmony_cistatic s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
8098c2ecf20Sopenharmony_ci{
8108c2ecf20Sopenharmony_ci	u32 rar_high;
8118c2ecf20Sopenharmony_ci	u32 rar_entries = hw->mac.num_rar_entries;
8128c2ecf20Sopenharmony_ci
8138c2ecf20Sopenharmony_ci
8148c2ecf20Sopenharmony_ci	/* Make sure we are using a valid rar index range */
8158c2ecf20Sopenharmony_ci	if (rar >= rar_entries) {
8168c2ecf20Sopenharmony_ci		hw_dbg(hw, "RAR index %d is out of range.\n", rar);
8178c2ecf20Sopenharmony_ci		return -EINVAL;
8188c2ecf20Sopenharmony_ci	}
8198c2ecf20Sopenharmony_ci
8208c2ecf20Sopenharmony_ci	rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar));
8218c2ecf20Sopenharmony_ci	if (rar_high & IXGBE_RAH_VIND_MASK) {
8228c2ecf20Sopenharmony_ci		rar_high &= ~IXGBE_RAH_VIND_MASK;
8238c2ecf20Sopenharmony_ci		IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high);
8248c2ecf20Sopenharmony_ci	}
8258c2ecf20Sopenharmony_ci
8268c2ecf20Sopenharmony_ci	return 0;
8278c2ecf20Sopenharmony_ci}
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_ci/**
8308c2ecf20Sopenharmony_ci *  ixgbe_set_vfta_82598 - Set VLAN filter table
8318c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
8328c2ecf20Sopenharmony_ci *  @vlan: VLAN id to write to VLAN filter
8338c2ecf20Sopenharmony_ci *  @vind: VMDq output index that maps queue to VLAN id in VFTA
8348c2ecf20Sopenharmony_ci *  @vlan_on: boolean flag to turn on/off VLAN in VFTA
8358c2ecf20Sopenharmony_ci *  @vlvf_bypass: boolean flag - unused
8368c2ecf20Sopenharmony_ci *
8378c2ecf20Sopenharmony_ci *  Turn on/off specified VLAN in the VLAN filter table.
8388c2ecf20Sopenharmony_ci **/
8398c2ecf20Sopenharmony_cistatic s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind,
8408c2ecf20Sopenharmony_ci				bool vlan_on, bool vlvf_bypass)
8418c2ecf20Sopenharmony_ci{
8428c2ecf20Sopenharmony_ci	u32 regindex;
8438c2ecf20Sopenharmony_ci	u32 bitindex;
8448c2ecf20Sopenharmony_ci	u32 bits;
8458c2ecf20Sopenharmony_ci	u32 vftabyte;
8468c2ecf20Sopenharmony_ci
8478c2ecf20Sopenharmony_ci	if (vlan > 4095)
8488c2ecf20Sopenharmony_ci		return -EINVAL;
8498c2ecf20Sopenharmony_ci
8508c2ecf20Sopenharmony_ci	/* Determine 32-bit word position in array */
8518c2ecf20Sopenharmony_ci	regindex = (vlan >> 5) & 0x7F;   /* upper seven bits */
8528c2ecf20Sopenharmony_ci
8538c2ecf20Sopenharmony_ci	/* Determine the location of the (VMD) queue index */
8548c2ecf20Sopenharmony_ci	vftabyte =  ((vlan >> 3) & 0x03); /* bits (4:3) indicating byte array */
8558c2ecf20Sopenharmony_ci	bitindex = (vlan & 0x7) << 2;    /* lower 3 bits indicate nibble */
8568c2ecf20Sopenharmony_ci
8578c2ecf20Sopenharmony_ci	/* Set the nibble for VMD queue index */
8588c2ecf20Sopenharmony_ci	bits = IXGBE_READ_REG(hw, IXGBE_VFTAVIND(vftabyte, regindex));
8598c2ecf20Sopenharmony_ci	bits &= (~(0x0F << bitindex));
8608c2ecf20Sopenharmony_ci	bits |= (vind << bitindex);
8618c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_VFTAVIND(vftabyte, regindex), bits);
8628c2ecf20Sopenharmony_ci
8638c2ecf20Sopenharmony_ci	/* Determine the location of the bit for this VLAN id */
8648c2ecf20Sopenharmony_ci	bitindex = vlan & 0x1F;   /* lower five bits */
8658c2ecf20Sopenharmony_ci
8668c2ecf20Sopenharmony_ci	bits = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex));
8678c2ecf20Sopenharmony_ci	if (vlan_on)
8688c2ecf20Sopenharmony_ci		/* Turn on this VLAN id */
8698c2ecf20Sopenharmony_ci		bits |= BIT(bitindex);
8708c2ecf20Sopenharmony_ci	else
8718c2ecf20Sopenharmony_ci		/* Turn off this VLAN id */
8728c2ecf20Sopenharmony_ci		bits &= ~BIT(bitindex);
8738c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), bits);
8748c2ecf20Sopenharmony_ci
8758c2ecf20Sopenharmony_ci	return 0;
8768c2ecf20Sopenharmony_ci}
8778c2ecf20Sopenharmony_ci
8788c2ecf20Sopenharmony_ci/**
8798c2ecf20Sopenharmony_ci *  ixgbe_clear_vfta_82598 - Clear VLAN filter table
8808c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
8818c2ecf20Sopenharmony_ci *
8828c2ecf20Sopenharmony_ci *  Clears the VLAN filer table, and the VMDq index associated with the filter
8838c2ecf20Sopenharmony_ci **/
8848c2ecf20Sopenharmony_cistatic s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw)
8858c2ecf20Sopenharmony_ci{
8868c2ecf20Sopenharmony_ci	u32 offset;
8878c2ecf20Sopenharmony_ci	u32 vlanbyte;
8888c2ecf20Sopenharmony_ci
8898c2ecf20Sopenharmony_ci	for (offset = 0; offset < hw->mac.vft_size; offset++)
8908c2ecf20Sopenharmony_ci		IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0);
8918c2ecf20Sopenharmony_ci
8928c2ecf20Sopenharmony_ci	for (vlanbyte = 0; vlanbyte < 4; vlanbyte++)
8938c2ecf20Sopenharmony_ci		for (offset = 0; offset < hw->mac.vft_size; offset++)
8948c2ecf20Sopenharmony_ci			IXGBE_WRITE_REG(hw, IXGBE_VFTAVIND(vlanbyte, offset),
8958c2ecf20Sopenharmony_ci					0);
8968c2ecf20Sopenharmony_ci
8978c2ecf20Sopenharmony_ci	return 0;
8988c2ecf20Sopenharmony_ci}
8998c2ecf20Sopenharmony_ci
9008c2ecf20Sopenharmony_ci/**
9018c2ecf20Sopenharmony_ci *  ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register
9028c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
9038c2ecf20Sopenharmony_ci *  @reg: analog register to read
9048c2ecf20Sopenharmony_ci *  @val: read value
9058c2ecf20Sopenharmony_ci *
9068c2ecf20Sopenharmony_ci *  Performs read operation to Atlas analog register specified.
9078c2ecf20Sopenharmony_ci **/
9088c2ecf20Sopenharmony_cistatic s32 ixgbe_read_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 *val)
9098c2ecf20Sopenharmony_ci{
9108c2ecf20Sopenharmony_ci	u32  atlas_ctl;
9118c2ecf20Sopenharmony_ci
9128c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_ATLASCTL,
9138c2ecf20Sopenharmony_ci			IXGBE_ATLASCTL_WRITE_CMD | (reg << 8));
9148c2ecf20Sopenharmony_ci	IXGBE_WRITE_FLUSH(hw);
9158c2ecf20Sopenharmony_ci	udelay(10);
9168c2ecf20Sopenharmony_ci	atlas_ctl = IXGBE_READ_REG(hw, IXGBE_ATLASCTL);
9178c2ecf20Sopenharmony_ci	*val = (u8)atlas_ctl;
9188c2ecf20Sopenharmony_ci
9198c2ecf20Sopenharmony_ci	return 0;
9208c2ecf20Sopenharmony_ci}
9218c2ecf20Sopenharmony_ci
9228c2ecf20Sopenharmony_ci/**
9238c2ecf20Sopenharmony_ci *  ixgbe_write_analog_reg8_82598 - Writes 8 bit Atlas analog register
9248c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
9258c2ecf20Sopenharmony_ci *  @reg: atlas register to write
9268c2ecf20Sopenharmony_ci *  @val: value to write
9278c2ecf20Sopenharmony_ci *
9288c2ecf20Sopenharmony_ci *  Performs write operation to Atlas analog register specified.
9298c2ecf20Sopenharmony_ci **/
9308c2ecf20Sopenharmony_cistatic s32 ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val)
9318c2ecf20Sopenharmony_ci{
9328c2ecf20Sopenharmony_ci	u32  atlas_ctl;
9338c2ecf20Sopenharmony_ci
9348c2ecf20Sopenharmony_ci	atlas_ctl = (reg << 8) | val;
9358c2ecf20Sopenharmony_ci	IXGBE_WRITE_REG(hw, IXGBE_ATLASCTL, atlas_ctl);
9368c2ecf20Sopenharmony_ci	IXGBE_WRITE_FLUSH(hw);
9378c2ecf20Sopenharmony_ci	udelay(10);
9388c2ecf20Sopenharmony_ci
9398c2ecf20Sopenharmony_ci	return 0;
9408c2ecf20Sopenharmony_ci}
9418c2ecf20Sopenharmony_ci
9428c2ecf20Sopenharmony_ci/**
9438c2ecf20Sopenharmony_ci *  ixgbe_read_i2c_phy_82598 - Reads 8 bit word over I2C interface.
9448c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
9458c2ecf20Sopenharmony_ci *  @dev_addr: address to read from
9468c2ecf20Sopenharmony_ci *  @byte_offset: byte offset to read from dev_addr
9478c2ecf20Sopenharmony_ci *  @eeprom_data: value read
9488c2ecf20Sopenharmony_ci *
9498c2ecf20Sopenharmony_ci *  Performs 8 byte read operation to SFP module's data over I2C interface.
9508c2ecf20Sopenharmony_ci **/
9518c2ecf20Sopenharmony_cistatic s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr,
9528c2ecf20Sopenharmony_ci				    u8 byte_offset, u8 *eeprom_data)
9538c2ecf20Sopenharmony_ci{
9548c2ecf20Sopenharmony_ci	s32 status = 0;
9558c2ecf20Sopenharmony_ci	u16 sfp_addr = 0;
9568c2ecf20Sopenharmony_ci	u16 sfp_data = 0;
9578c2ecf20Sopenharmony_ci	u16 sfp_stat = 0;
9588c2ecf20Sopenharmony_ci	u16 gssr;
9598c2ecf20Sopenharmony_ci	u32 i;
9608c2ecf20Sopenharmony_ci
9618c2ecf20Sopenharmony_ci	if (IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)
9628c2ecf20Sopenharmony_ci		gssr = IXGBE_GSSR_PHY1_SM;
9638c2ecf20Sopenharmony_ci	else
9648c2ecf20Sopenharmony_ci		gssr = IXGBE_GSSR_PHY0_SM;
9658c2ecf20Sopenharmony_ci
9668c2ecf20Sopenharmony_ci	if (hw->mac.ops.acquire_swfw_sync(hw, gssr) != 0)
9678c2ecf20Sopenharmony_ci		return -EBUSY;
9688c2ecf20Sopenharmony_ci
9698c2ecf20Sopenharmony_ci	if (hw->phy.type == ixgbe_phy_nl) {
9708c2ecf20Sopenharmony_ci		/*
9718c2ecf20Sopenharmony_ci		 * phy SDA/SCL registers are at addresses 0xC30A to
9728c2ecf20Sopenharmony_ci		 * 0xC30D.  These registers are used to talk to the SFP+
9738c2ecf20Sopenharmony_ci		 * module's EEPROM through the SDA/SCL (I2C) interface.
9748c2ecf20Sopenharmony_ci		 */
9758c2ecf20Sopenharmony_ci		sfp_addr = (dev_addr << 8) + byte_offset;
9768c2ecf20Sopenharmony_ci		sfp_addr = (sfp_addr | IXGBE_I2C_EEPROM_READ_MASK);
9778c2ecf20Sopenharmony_ci		hw->phy.ops.write_reg_mdi(hw,
9788c2ecf20Sopenharmony_ci					  IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR,
9798c2ecf20Sopenharmony_ci					  MDIO_MMD_PMAPMD,
9808c2ecf20Sopenharmony_ci					  sfp_addr);
9818c2ecf20Sopenharmony_ci
9828c2ecf20Sopenharmony_ci		/* Poll status */
9838c2ecf20Sopenharmony_ci		for (i = 0; i < 100; i++) {
9848c2ecf20Sopenharmony_ci			hw->phy.ops.read_reg_mdi(hw,
9858c2ecf20Sopenharmony_ci						IXGBE_MDIO_PMA_PMD_SDA_SCL_STAT,
9868c2ecf20Sopenharmony_ci						MDIO_MMD_PMAPMD,
9878c2ecf20Sopenharmony_ci						&sfp_stat);
9888c2ecf20Sopenharmony_ci			sfp_stat = sfp_stat & IXGBE_I2C_EEPROM_STATUS_MASK;
9898c2ecf20Sopenharmony_ci			if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS)
9908c2ecf20Sopenharmony_ci				break;
9918c2ecf20Sopenharmony_ci			usleep_range(10000, 20000);
9928c2ecf20Sopenharmony_ci		}
9938c2ecf20Sopenharmony_ci
9948c2ecf20Sopenharmony_ci		if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_PASS) {
9958c2ecf20Sopenharmony_ci			hw_dbg(hw, "EEPROM read did not pass.\n");
9968c2ecf20Sopenharmony_ci			status = -ENOENT;
9978c2ecf20Sopenharmony_ci			goto out;
9988c2ecf20Sopenharmony_ci		}
9998c2ecf20Sopenharmony_ci
10008c2ecf20Sopenharmony_ci		/* Read data */
10018c2ecf20Sopenharmony_ci		hw->phy.ops.read_reg_mdi(hw, IXGBE_MDIO_PMA_PMD_SDA_SCL_DATA,
10028c2ecf20Sopenharmony_ci					MDIO_MMD_PMAPMD, &sfp_data);
10038c2ecf20Sopenharmony_ci
10048c2ecf20Sopenharmony_ci		*eeprom_data = (u8)(sfp_data >> 8);
10058c2ecf20Sopenharmony_ci	} else {
10068c2ecf20Sopenharmony_ci		status = -EIO;
10078c2ecf20Sopenharmony_ci	}
10088c2ecf20Sopenharmony_ci
10098c2ecf20Sopenharmony_ciout:
10108c2ecf20Sopenharmony_ci	hw->mac.ops.release_swfw_sync(hw, gssr);
10118c2ecf20Sopenharmony_ci	return status;
10128c2ecf20Sopenharmony_ci}
10138c2ecf20Sopenharmony_ci
10148c2ecf20Sopenharmony_ci/**
10158c2ecf20Sopenharmony_ci *  ixgbe_read_i2c_eeprom_82598 - Reads 8 bit word over I2C interface.
10168c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
10178c2ecf20Sopenharmony_ci *  @byte_offset: EEPROM byte offset to read
10188c2ecf20Sopenharmony_ci *  @eeprom_data: value read
10198c2ecf20Sopenharmony_ci *
10208c2ecf20Sopenharmony_ci *  Performs 8 byte read operation to SFP module's EEPROM over I2C interface.
10218c2ecf20Sopenharmony_ci **/
10228c2ecf20Sopenharmony_cistatic s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
10238c2ecf20Sopenharmony_ci				       u8 *eeprom_data)
10248c2ecf20Sopenharmony_ci{
10258c2ecf20Sopenharmony_ci	return ixgbe_read_i2c_phy_82598(hw, IXGBE_I2C_EEPROM_DEV_ADDR,
10268c2ecf20Sopenharmony_ci					byte_offset, eeprom_data);
10278c2ecf20Sopenharmony_ci}
10288c2ecf20Sopenharmony_ci
10298c2ecf20Sopenharmony_ci/**
10308c2ecf20Sopenharmony_ci *  ixgbe_read_i2c_sff8472_82598 - Reads 8 bit word over I2C interface.
10318c2ecf20Sopenharmony_ci *  @hw: pointer to hardware structure
10328c2ecf20Sopenharmony_ci *  @byte_offset: byte offset at address 0xA2
10338c2ecf20Sopenharmony_ci *  @sff8472_data: value read
10348c2ecf20Sopenharmony_ci *
10358c2ecf20Sopenharmony_ci *  Performs 8 byte read operation to SFP module's SFF-8472 data over I2C
10368c2ecf20Sopenharmony_ci **/
10378c2ecf20Sopenharmony_cistatic s32 ixgbe_read_i2c_sff8472_82598(struct ixgbe_hw *hw, u8 byte_offset,
10388c2ecf20Sopenharmony_ci				       u8 *sff8472_data)
10398c2ecf20Sopenharmony_ci{
10408c2ecf20Sopenharmony_ci	return ixgbe_read_i2c_phy_82598(hw, IXGBE_I2C_EEPROM_DEV_ADDR2,
10418c2ecf20Sopenharmony_ci					byte_offset, sff8472_data);
10428c2ecf20Sopenharmony_ci}
10438c2ecf20Sopenharmony_ci
10448c2ecf20Sopenharmony_ci/**
10458c2ecf20Sopenharmony_ci *  ixgbe_set_lan_id_multi_port_pcie_82598 - Set LAN id for PCIe multiple
10468c2ecf20Sopenharmony_ci *  port devices.
10478c2ecf20Sopenharmony_ci *  @hw: pointer to the HW structure
10488c2ecf20Sopenharmony_ci *
10498c2ecf20Sopenharmony_ci *  Calls common function and corrects issue with some single port devices
10508c2ecf20Sopenharmony_ci *  that enable LAN1 but not LAN0.
10518c2ecf20Sopenharmony_ci **/
10528c2ecf20Sopenharmony_cistatic void ixgbe_set_lan_id_multi_port_pcie_82598(struct ixgbe_hw *hw)
10538c2ecf20Sopenharmony_ci{
10548c2ecf20Sopenharmony_ci	struct ixgbe_bus_info *bus = &hw->bus;
10558c2ecf20Sopenharmony_ci	u16 pci_gen = 0;
10568c2ecf20Sopenharmony_ci	u16 pci_ctrl2 = 0;
10578c2ecf20Sopenharmony_ci
10588c2ecf20Sopenharmony_ci	ixgbe_set_lan_id_multi_port_pcie(hw);
10598c2ecf20Sopenharmony_ci
10608c2ecf20Sopenharmony_ci	/* check if LAN0 is disabled */
10618c2ecf20Sopenharmony_ci	hw->eeprom.ops.read(hw, IXGBE_PCIE_GENERAL_PTR, &pci_gen);
10628c2ecf20Sopenharmony_ci	if ((pci_gen != 0) && (pci_gen != 0xFFFF)) {
10638c2ecf20Sopenharmony_ci
10648c2ecf20Sopenharmony_ci		hw->eeprom.ops.read(hw, pci_gen + IXGBE_PCIE_CTRL2, &pci_ctrl2);
10658c2ecf20Sopenharmony_ci
10668c2ecf20Sopenharmony_ci		/* if LAN0 is completely disabled force function to 0 */
10678c2ecf20Sopenharmony_ci		if ((pci_ctrl2 & IXGBE_PCIE_CTRL2_LAN_DISABLE) &&
10688c2ecf20Sopenharmony_ci		    !(pci_ctrl2 & IXGBE_PCIE_CTRL2_DISABLE_SELECT) &&
10698c2ecf20Sopenharmony_ci		    !(pci_ctrl2 & IXGBE_PCIE_CTRL2_DUMMY_ENABLE)) {
10708c2ecf20Sopenharmony_ci
10718c2ecf20Sopenharmony_ci			bus->func = 0;
10728c2ecf20Sopenharmony_ci		}
10738c2ecf20Sopenharmony_ci	}
10748c2ecf20Sopenharmony_ci}
10758c2ecf20Sopenharmony_ci
10768c2ecf20Sopenharmony_ci/**
10778c2ecf20Sopenharmony_ci * ixgbe_set_rxpba_82598 - Initialize RX packet buffer
10788c2ecf20Sopenharmony_ci * @hw: pointer to hardware structure
10798c2ecf20Sopenharmony_ci * @num_pb: number of packet buffers to allocate
10808c2ecf20Sopenharmony_ci * @headroom: reserve n KB of headroom
10818c2ecf20Sopenharmony_ci * @strategy: packet buffer allocation strategy
10828c2ecf20Sopenharmony_ci **/
10838c2ecf20Sopenharmony_cistatic void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb,
10848c2ecf20Sopenharmony_ci				  u32 headroom, int strategy)
10858c2ecf20Sopenharmony_ci{
10868c2ecf20Sopenharmony_ci	u32 rxpktsize = IXGBE_RXPBSIZE_64KB;
10878c2ecf20Sopenharmony_ci	u8  i = 0;
10888c2ecf20Sopenharmony_ci
10898c2ecf20Sopenharmony_ci	if (!num_pb)
10908c2ecf20Sopenharmony_ci		return;
10918c2ecf20Sopenharmony_ci
10928c2ecf20Sopenharmony_ci	/* Setup Rx packet buffer sizes */
10938c2ecf20Sopenharmony_ci	switch (strategy) {
10948c2ecf20Sopenharmony_ci	case PBA_STRATEGY_WEIGHTED:
10958c2ecf20Sopenharmony_ci		/* Setup the first four at 80KB */
10968c2ecf20Sopenharmony_ci		rxpktsize = IXGBE_RXPBSIZE_80KB;
10978c2ecf20Sopenharmony_ci		for (; i < 4; i++)
10988c2ecf20Sopenharmony_ci			IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize);
10998c2ecf20Sopenharmony_ci		/* Setup the last four at 48KB...don't re-init i */
11008c2ecf20Sopenharmony_ci		rxpktsize = IXGBE_RXPBSIZE_48KB;
11018c2ecf20Sopenharmony_ci		fallthrough;
11028c2ecf20Sopenharmony_ci	case PBA_STRATEGY_EQUAL:
11038c2ecf20Sopenharmony_ci	default:
11048c2ecf20Sopenharmony_ci		/* Divide the remaining Rx packet buffer evenly among the TCs */
11058c2ecf20Sopenharmony_ci		for (; i < IXGBE_MAX_PACKET_BUFFERS; i++)
11068c2ecf20Sopenharmony_ci			IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize);
11078c2ecf20Sopenharmony_ci		break;
11088c2ecf20Sopenharmony_ci	}
11098c2ecf20Sopenharmony_ci
11108c2ecf20Sopenharmony_ci	/* Setup Tx packet buffer sizes */
11118c2ecf20Sopenharmony_ci	for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++)
11128c2ecf20Sopenharmony_ci		IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), IXGBE_TXPBSIZE_40KB);
11138c2ecf20Sopenharmony_ci}
11148c2ecf20Sopenharmony_ci
11158c2ecf20Sopenharmony_cistatic const struct ixgbe_mac_operations mac_ops_82598 = {
11168c2ecf20Sopenharmony_ci	.init_hw		= &ixgbe_init_hw_generic,
11178c2ecf20Sopenharmony_ci	.reset_hw		= &ixgbe_reset_hw_82598,
11188c2ecf20Sopenharmony_ci	.start_hw		= &ixgbe_start_hw_82598,
11198c2ecf20Sopenharmony_ci	.clear_hw_cntrs		= &ixgbe_clear_hw_cntrs_generic,
11208c2ecf20Sopenharmony_ci	.get_media_type		= &ixgbe_get_media_type_82598,
11218c2ecf20Sopenharmony_ci	.enable_rx_dma          = &ixgbe_enable_rx_dma_generic,
11228c2ecf20Sopenharmony_ci	.get_mac_addr		= &ixgbe_get_mac_addr_generic,
11238c2ecf20Sopenharmony_ci	.stop_adapter		= &ixgbe_stop_adapter_generic,
11248c2ecf20Sopenharmony_ci	.get_bus_info           = &ixgbe_get_bus_info_generic,
11258c2ecf20Sopenharmony_ci	.set_lan_id             = &ixgbe_set_lan_id_multi_port_pcie_82598,
11268c2ecf20Sopenharmony_ci	.read_analog_reg8	= &ixgbe_read_analog_reg8_82598,
11278c2ecf20Sopenharmony_ci	.write_analog_reg8	= &ixgbe_write_analog_reg8_82598,
11288c2ecf20Sopenharmony_ci	.setup_link		= &ixgbe_setup_mac_link_82598,
11298c2ecf20Sopenharmony_ci	.set_rxpba		= &ixgbe_set_rxpba_82598,
11308c2ecf20Sopenharmony_ci	.check_link		= &ixgbe_check_mac_link_82598,
11318c2ecf20Sopenharmony_ci	.get_link_capabilities	= &ixgbe_get_link_capabilities_82598,
11328c2ecf20Sopenharmony_ci	.led_on			= &ixgbe_led_on_generic,
11338c2ecf20Sopenharmony_ci	.led_off		= &ixgbe_led_off_generic,
11348c2ecf20Sopenharmony_ci	.init_led_link_act	= ixgbe_init_led_link_act_generic,
11358c2ecf20Sopenharmony_ci	.blink_led_start	= &ixgbe_blink_led_start_generic,
11368c2ecf20Sopenharmony_ci	.blink_led_stop		= &ixgbe_blink_led_stop_generic,
11378c2ecf20Sopenharmony_ci	.set_rar		= &ixgbe_set_rar_generic,
11388c2ecf20Sopenharmony_ci	.clear_rar		= &ixgbe_clear_rar_generic,
11398c2ecf20Sopenharmony_ci	.set_vmdq		= &ixgbe_set_vmdq_82598,
11408c2ecf20Sopenharmony_ci	.clear_vmdq		= &ixgbe_clear_vmdq_82598,
11418c2ecf20Sopenharmony_ci	.init_rx_addrs		= &ixgbe_init_rx_addrs_generic,
11428c2ecf20Sopenharmony_ci	.update_mc_addr_list	= &ixgbe_update_mc_addr_list_generic,
11438c2ecf20Sopenharmony_ci	.enable_mc		= &ixgbe_enable_mc_generic,
11448c2ecf20Sopenharmony_ci	.disable_mc		= &ixgbe_disable_mc_generic,
11458c2ecf20Sopenharmony_ci	.clear_vfta		= &ixgbe_clear_vfta_82598,
11468c2ecf20Sopenharmony_ci	.set_vfta		= &ixgbe_set_vfta_82598,
11478c2ecf20Sopenharmony_ci	.fc_enable		= &ixgbe_fc_enable_82598,
11488c2ecf20Sopenharmony_ci	.setup_fc		= ixgbe_setup_fc_generic,
11498c2ecf20Sopenharmony_ci	.fc_autoneg		= ixgbe_fc_autoneg,
11508c2ecf20Sopenharmony_ci	.set_fw_drv_ver         = NULL,
11518c2ecf20Sopenharmony_ci	.acquire_swfw_sync      = &ixgbe_acquire_swfw_sync,
11528c2ecf20Sopenharmony_ci	.release_swfw_sync      = &ixgbe_release_swfw_sync,
11538c2ecf20Sopenharmony_ci	.init_swfw_sync		= NULL,
11548c2ecf20Sopenharmony_ci	.get_thermal_sensor_data = NULL,
11558c2ecf20Sopenharmony_ci	.init_thermal_sensor_thresh = NULL,
11568c2ecf20Sopenharmony_ci	.prot_autoc_read	= &prot_autoc_read_generic,
11578c2ecf20Sopenharmony_ci	.prot_autoc_write	= &prot_autoc_write_generic,
11588c2ecf20Sopenharmony_ci	.enable_rx		= &ixgbe_enable_rx_generic,
11598c2ecf20Sopenharmony_ci	.disable_rx		= &ixgbe_disable_rx_generic,
11608c2ecf20Sopenharmony_ci};
11618c2ecf20Sopenharmony_ci
11628c2ecf20Sopenharmony_cistatic const struct ixgbe_eeprom_operations eeprom_ops_82598 = {
11638c2ecf20Sopenharmony_ci	.init_params		= &ixgbe_init_eeprom_params_generic,
11648c2ecf20Sopenharmony_ci	.read			= &ixgbe_read_eerd_generic,
11658c2ecf20Sopenharmony_ci	.write			= &ixgbe_write_eeprom_generic,
11668c2ecf20Sopenharmony_ci	.write_buffer		= &ixgbe_write_eeprom_buffer_bit_bang_generic,
11678c2ecf20Sopenharmony_ci	.read_buffer		= &ixgbe_read_eerd_buffer_generic,
11688c2ecf20Sopenharmony_ci	.calc_checksum          = &ixgbe_calc_eeprom_checksum_generic,
11698c2ecf20Sopenharmony_ci	.validate_checksum	= &ixgbe_validate_eeprom_checksum_generic,
11708c2ecf20Sopenharmony_ci	.update_checksum	= &ixgbe_update_eeprom_checksum_generic,
11718c2ecf20Sopenharmony_ci};
11728c2ecf20Sopenharmony_ci
11738c2ecf20Sopenharmony_cistatic const struct ixgbe_phy_operations phy_ops_82598 = {
11748c2ecf20Sopenharmony_ci	.identify		= &ixgbe_identify_phy_generic,
11758c2ecf20Sopenharmony_ci	.identify_sfp		= &ixgbe_identify_module_generic,
11768c2ecf20Sopenharmony_ci	.init			= &ixgbe_init_phy_ops_82598,
11778c2ecf20Sopenharmony_ci	.reset			= &ixgbe_reset_phy_generic,
11788c2ecf20Sopenharmony_ci	.read_reg		= &ixgbe_read_phy_reg_generic,
11798c2ecf20Sopenharmony_ci	.write_reg		= &ixgbe_write_phy_reg_generic,
11808c2ecf20Sopenharmony_ci	.read_reg_mdi		= &ixgbe_read_phy_reg_mdi,
11818c2ecf20Sopenharmony_ci	.write_reg_mdi		= &ixgbe_write_phy_reg_mdi,
11828c2ecf20Sopenharmony_ci	.setup_link		= &ixgbe_setup_phy_link_generic,
11838c2ecf20Sopenharmony_ci	.setup_link_speed	= &ixgbe_setup_phy_link_speed_generic,
11848c2ecf20Sopenharmony_ci	.read_i2c_sff8472	= &ixgbe_read_i2c_sff8472_82598,
11858c2ecf20Sopenharmony_ci	.read_i2c_eeprom	= &ixgbe_read_i2c_eeprom_82598,
11868c2ecf20Sopenharmony_ci	.check_overtemp		= &ixgbe_tn_check_overtemp,
11878c2ecf20Sopenharmony_ci};
11888c2ecf20Sopenharmony_ci
11898c2ecf20Sopenharmony_ciconst struct ixgbe_info ixgbe_82598_info = {
11908c2ecf20Sopenharmony_ci	.mac			= ixgbe_mac_82598EB,
11918c2ecf20Sopenharmony_ci	.get_invariants		= &ixgbe_get_invariants_82598,
11928c2ecf20Sopenharmony_ci	.mac_ops		= &mac_ops_82598,
11938c2ecf20Sopenharmony_ci	.eeprom_ops		= &eeprom_ops_82598,
11948c2ecf20Sopenharmony_ci	.phy_ops		= &phy_ops_82598,
11958c2ecf20Sopenharmony_ci	.mvals			= ixgbe_mvals_8259X,
11968c2ecf20Sopenharmony_ci};
1197