18cfa0ad2SJack F Vogel /******************************************************************************
27282444bSPedro F. Giffuni SPDX-License-Identifier: BSD-3-Clause
38cfa0ad2SJack F Vogel
4702cac6cSKevin Bowling Copyright (c) 2001-2020, Intel Corporation
58cfa0ad2SJack F Vogel All rights reserved.
68cfa0ad2SJack F Vogel
78cfa0ad2SJack F Vogel Redistribution and use in source and binary forms, with or without
88cfa0ad2SJack F Vogel modification, are permitted provided that the following conditions are met:
98cfa0ad2SJack F Vogel
108cfa0ad2SJack F Vogel 1. Redistributions of source code must retain the above copyright notice,
118cfa0ad2SJack F Vogel this list of conditions and the following disclaimer.
128cfa0ad2SJack F Vogel
138cfa0ad2SJack F Vogel 2. Redistributions in binary form must reproduce the above copyright
148cfa0ad2SJack F Vogel notice, this list of conditions and the following disclaimer in the
158cfa0ad2SJack F Vogel documentation and/or other materials provided with the distribution.
168cfa0ad2SJack F Vogel
178cfa0ad2SJack F Vogel 3. Neither the name of the Intel Corporation nor the names of its
188cfa0ad2SJack F Vogel contributors may be used to endorse or promote products derived from
198cfa0ad2SJack F Vogel this software without specific prior written permission.
208cfa0ad2SJack F Vogel
218cfa0ad2SJack F Vogel THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
228cfa0ad2SJack F Vogel AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
238cfa0ad2SJack F Vogel IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
248cfa0ad2SJack F Vogel ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
258cfa0ad2SJack F Vogel LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
268cfa0ad2SJack F Vogel CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
278cfa0ad2SJack F Vogel SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
288cfa0ad2SJack F Vogel INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
298cfa0ad2SJack F Vogel CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
308cfa0ad2SJack F Vogel ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
318cfa0ad2SJack F Vogel POSSIBILITY OF SUCH DAMAGE.
328cfa0ad2SJack F Vogel
338cfa0ad2SJack F Vogel ******************************************************************************/
348cfa0ad2SJack F Vogel
358cfa0ad2SJack F Vogel #include "e1000_api.h"
368cfa0ad2SJack F Vogel
378cfa0ad2SJack F Vogel /**
388cfa0ad2SJack F Vogel * e1000_init_mac_params - Initialize MAC function pointers
398cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
408cfa0ad2SJack F Vogel *
418cfa0ad2SJack F Vogel * This function initializes the function pointers for the MAC
428cfa0ad2SJack F Vogel * set of functions. Called by drivers or by e1000_setup_init_funcs.
438cfa0ad2SJack F Vogel **/
e1000_init_mac_params(struct e1000_hw * hw)448cfa0ad2SJack F Vogel s32 e1000_init_mac_params(struct e1000_hw *hw)
458cfa0ad2SJack F Vogel {
468cfa0ad2SJack F Vogel s32 ret_val = E1000_SUCCESS;
478cfa0ad2SJack F Vogel
488cfa0ad2SJack F Vogel if (hw->mac.ops.init_params) {
498cfa0ad2SJack F Vogel ret_val = hw->mac.ops.init_params(hw);
508cfa0ad2SJack F Vogel if (ret_val) {
518cfa0ad2SJack F Vogel DEBUGOUT("MAC Initialization Error\n");
528cfa0ad2SJack F Vogel goto out;
538cfa0ad2SJack F Vogel }
548cfa0ad2SJack F Vogel } else {
558cfa0ad2SJack F Vogel DEBUGOUT("mac.init_mac_params was NULL\n");
568cfa0ad2SJack F Vogel ret_val = -E1000_ERR_CONFIG;
578cfa0ad2SJack F Vogel }
588cfa0ad2SJack F Vogel
598cfa0ad2SJack F Vogel out:
608cfa0ad2SJack F Vogel return ret_val;
618cfa0ad2SJack F Vogel }
628cfa0ad2SJack F Vogel
638cfa0ad2SJack F Vogel /**
648cfa0ad2SJack F Vogel * e1000_init_nvm_params - Initialize NVM function pointers
658cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
668cfa0ad2SJack F Vogel *
678cfa0ad2SJack F Vogel * This function initializes the function pointers for the NVM
688cfa0ad2SJack F Vogel * set of functions. Called by drivers or by e1000_setup_init_funcs.
698cfa0ad2SJack F Vogel **/
e1000_init_nvm_params(struct e1000_hw * hw)708cfa0ad2SJack F Vogel s32 e1000_init_nvm_params(struct e1000_hw *hw)
718cfa0ad2SJack F Vogel {
728cfa0ad2SJack F Vogel s32 ret_val = E1000_SUCCESS;
738cfa0ad2SJack F Vogel
748cfa0ad2SJack F Vogel if (hw->nvm.ops.init_params) {
758cfa0ad2SJack F Vogel ret_val = hw->nvm.ops.init_params(hw);
768cfa0ad2SJack F Vogel if (ret_val) {
778cfa0ad2SJack F Vogel DEBUGOUT("NVM Initialization Error\n");
788cfa0ad2SJack F Vogel goto out;
798cfa0ad2SJack F Vogel }
808cfa0ad2SJack F Vogel } else {
818cfa0ad2SJack F Vogel DEBUGOUT("nvm.init_nvm_params was NULL\n");
828cfa0ad2SJack F Vogel ret_val = -E1000_ERR_CONFIG;
838cfa0ad2SJack F Vogel }
848cfa0ad2SJack F Vogel
858cfa0ad2SJack F Vogel out:
868cfa0ad2SJack F Vogel return ret_val;
878cfa0ad2SJack F Vogel }
888cfa0ad2SJack F Vogel
898cfa0ad2SJack F Vogel /**
908cfa0ad2SJack F Vogel * e1000_init_phy_params - Initialize PHY function pointers
918cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
928cfa0ad2SJack F Vogel *
938cfa0ad2SJack F Vogel * This function initializes the function pointers for the PHY
948cfa0ad2SJack F Vogel * set of functions. Called by drivers or by e1000_setup_init_funcs.
958cfa0ad2SJack F Vogel **/
e1000_init_phy_params(struct e1000_hw * hw)968cfa0ad2SJack F Vogel s32 e1000_init_phy_params(struct e1000_hw *hw)
978cfa0ad2SJack F Vogel {
988cfa0ad2SJack F Vogel s32 ret_val = E1000_SUCCESS;
998cfa0ad2SJack F Vogel
1008cfa0ad2SJack F Vogel if (hw->phy.ops.init_params) {
1018cfa0ad2SJack F Vogel ret_val = hw->phy.ops.init_params(hw);
1028cfa0ad2SJack F Vogel if (ret_val) {
1038cfa0ad2SJack F Vogel DEBUGOUT("PHY Initialization Error\n");
1048cfa0ad2SJack F Vogel goto out;
1058cfa0ad2SJack F Vogel }
1068cfa0ad2SJack F Vogel } else {
1078cfa0ad2SJack F Vogel DEBUGOUT("phy.init_phy_params was NULL\n");
1088cfa0ad2SJack F Vogel ret_val = -E1000_ERR_CONFIG;
1098cfa0ad2SJack F Vogel }
1108cfa0ad2SJack F Vogel
1118cfa0ad2SJack F Vogel out:
1128cfa0ad2SJack F Vogel return ret_val;
1138cfa0ad2SJack F Vogel }
1148cfa0ad2SJack F Vogel
115b8270585SJack F Vogel /**
116b8270585SJack F Vogel * e1000_init_mbx_params - Initialize mailbox function pointers
117b8270585SJack F Vogel * @hw: pointer to the HW structure
118b8270585SJack F Vogel *
119b8270585SJack F Vogel * This function initializes the function pointers for the PHY
120b8270585SJack F Vogel * set of functions. Called by drivers or by e1000_setup_init_funcs.
121b8270585SJack F Vogel **/
e1000_init_mbx_params(struct e1000_hw * hw)122b8270585SJack F Vogel s32 e1000_init_mbx_params(struct e1000_hw *hw)
123b8270585SJack F Vogel {
124b8270585SJack F Vogel s32 ret_val = E1000_SUCCESS;
125b8270585SJack F Vogel
126b8270585SJack F Vogel if (hw->mbx.ops.init_params) {
127b8270585SJack F Vogel ret_val = hw->mbx.ops.init_params(hw);
128b8270585SJack F Vogel if (ret_val) {
129b8270585SJack F Vogel DEBUGOUT("Mailbox Initialization Error\n");
130b8270585SJack F Vogel goto out;
131b8270585SJack F Vogel }
132b8270585SJack F Vogel } else {
133b8270585SJack F Vogel DEBUGOUT("mbx.init_mbx_params was NULL\n");
134b8270585SJack F Vogel ret_val = -E1000_ERR_CONFIG;
135b8270585SJack F Vogel }
136b8270585SJack F Vogel
137b8270585SJack F Vogel out:
138b8270585SJack F Vogel return ret_val;
139b8270585SJack F Vogel }
140d035aa2dSJack F Vogel
1418cfa0ad2SJack F Vogel /**
1428cfa0ad2SJack F Vogel * e1000_set_mac_type - Sets MAC type
1438cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
1448cfa0ad2SJack F Vogel *
1458cfa0ad2SJack F Vogel * This function sets the mac type of the adapter based on the
1468cfa0ad2SJack F Vogel * device ID stored in the hw structure.
1478cfa0ad2SJack F Vogel * MUST BE FIRST FUNCTION CALLED (explicitly or through
1488cfa0ad2SJack F Vogel * e1000_setup_init_funcs()).
1498cfa0ad2SJack F Vogel **/
e1000_set_mac_type(struct e1000_hw * hw)1508cfa0ad2SJack F Vogel s32 e1000_set_mac_type(struct e1000_hw *hw)
1518cfa0ad2SJack F Vogel {
1528cfa0ad2SJack F Vogel struct e1000_mac_info *mac = &hw->mac;
1538cfa0ad2SJack F Vogel s32 ret_val = E1000_SUCCESS;
1548cfa0ad2SJack F Vogel
1558cfa0ad2SJack F Vogel DEBUGFUNC("e1000_set_mac_type");
1568cfa0ad2SJack F Vogel
1578cfa0ad2SJack F Vogel switch (hw->device_id) {
1588cfa0ad2SJack F Vogel case E1000_DEV_ID_82542:
1598cfa0ad2SJack F Vogel mac->type = e1000_82542;
1608cfa0ad2SJack F Vogel break;
1618cfa0ad2SJack F Vogel case E1000_DEV_ID_82543GC_FIBER:
1628cfa0ad2SJack F Vogel case E1000_DEV_ID_82543GC_COPPER:
1638cfa0ad2SJack F Vogel mac->type = e1000_82543;
1648cfa0ad2SJack F Vogel break;
1658cfa0ad2SJack F Vogel case E1000_DEV_ID_82544EI_COPPER:
1668cfa0ad2SJack F Vogel case E1000_DEV_ID_82544EI_FIBER:
1678cfa0ad2SJack F Vogel case E1000_DEV_ID_82544GC_COPPER:
1688cfa0ad2SJack F Vogel case E1000_DEV_ID_82544GC_LOM:
1698cfa0ad2SJack F Vogel mac->type = e1000_82544;
1708cfa0ad2SJack F Vogel break;
1718cfa0ad2SJack F Vogel case E1000_DEV_ID_82540EM:
1728cfa0ad2SJack F Vogel case E1000_DEV_ID_82540EM_LOM:
1738cfa0ad2SJack F Vogel case E1000_DEV_ID_82540EP:
1748cfa0ad2SJack F Vogel case E1000_DEV_ID_82540EP_LOM:
1758cfa0ad2SJack F Vogel case E1000_DEV_ID_82540EP_LP:
1768cfa0ad2SJack F Vogel mac->type = e1000_82540;
1778cfa0ad2SJack F Vogel break;
1788cfa0ad2SJack F Vogel case E1000_DEV_ID_82545EM_COPPER:
1798cfa0ad2SJack F Vogel case E1000_DEV_ID_82545EM_FIBER:
1808cfa0ad2SJack F Vogel mac->type = e1000_82545;
1818cfa0ad2SJack F Vogel break;
1828cfa0ad2SJack F Vogel case E1000_DEV_ID_82545GM_COPPER:
1838cfa0ad2SJack F Vogel case E1000_DEV_ID_82545GM_FIBER:
1848cfa0ad2SJack F Vogel case E1000_DEV_ID_82545GM_SERDES:
1858cfa0ad2SJack F Vogel mac->type = e1000_82545_rev_3;
1868cfa0ad2SJack F Vogel break;
1878cfa0ad2SJack F Vogel case E1000_DEV_ID_82546EB_COPPER:
1888cfa0ad2SJack F Vogel case E1000_DEV_ID_82546EB_FIBER:
1898cfa0ad2SJack F Vogel case E1000_DEV_ID_82546EB_QUAD_COPPER:
1908cfa0ad2SJack F Vogel mac->type = e1000_82546;
1918cfa0ad2SJack F Vogel break;
1928cfa0ad2SJack F Vogel case E1000_DEV_ID_82546GB_COPPER:
1938cfa0ad2SJack F Vogel case E1000_DEV_ID_82546GB_FIBER:
1948cfa0ad2SJack F Vogel case E1000_DEV_ID_82546GB_SERDES:
1958cfa0ad2SJack F Vogel case E1000_DEV_ID_82546GB_PCIE:
1968cfa0ad2SJack F Vogel case E1000_DEV_ID_82546GB_QUAD_COPPER:
1978cfa0ad2SJack F Vogel case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
1988cfa0ad2SJack F Vogel mac->type = e1000_82546_rev_3;
1998cfa0ad2SJack F Vogel break;
2008cfa0ad2SJack F Vogel case E1000_DEV_ID_82541EI:
2018cfa0ad2SJack F Vogel case E1000_DEV_ID_82541EI_MOBILE:
2028cfa0ad2SJack F Vogel case E1000_DEV_ID_82541ER_LOM:
2038cfa0ad2SJack F Vogel mac->type = e1000_82541;
2048cfa0ad2SJack F Vogel break;
2058cfa0ad2SJack F Vogel case E1000_DEV_ID_82541ER:
2068cfa0ad2SJack F Vogel case E1000_DEV_ID_82541GI:
2078cfa0ad2SJack F Vogel case E1000_DEV_ID_82541GI_LF:
2088cfa0ad2SJack F Vogel case E1000_DEV_ID_82541GI_MOBILE:
2098cfa0ad2SJack F Vogel mac->type = e1000_82541_rev_2;
2108cfa0ad2SJack F Vogel break;
2118cfa0ad2SJack F Vogel case E1000_DEV_ID_82547EI:
2128cfa0ad2SJack F Vogel case E1000_DEV_ID_82547EI_MOBILE:
2138cfa0ad2SJack F Vogel mac->type = e1000_82547;
2148cfa0ad2SJack F Vogel break;
2158cfa0ad2SJack F Vogel case E1000_DEV_ID_82547GI:
2168cfa0ad2SJack F Vogel mac->type = e1000_82547_rev_2;
2178cfa0ad2SJack F Vogel break;
2188cfa0ad2SJack F Vogel case E1000_DEV_ID_82571EB_COPPER:
2198cfa0ad2SJack F Vogel case E1000_DEV_ID_82571EB_FIBER:
2208cfa0ad2SJack F Vogel case E1000_DEV_ID_82571EB_SERDES:
2218cfa0ad2SJack F Vogel case E1000_DEV_ID_82571EB_SERDES_DUAL:
2228cfa0ad2SJack F Vogel case E1000_DEV_ID_82571EB_SERDES_QUAD:
2238cfa0ad2SJack F Vogel case E1000_DEV_ID_82571EB_QUAD_COPPER:
2248cfa0ad2SJack F Vogel case E1000_DEV_ID_82571PT_QUAD_COPPER:
2258cfa0ad2SJack F Vogel case E1000_DEV_ID_82571EB_QUAD_FIBER:
2268cfa0ad2SJack F Vogel case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
2278cfa0ad2SJack F Vogel mac->type = e1000_82571;
2288cfa0ad2SJack F Vogel break;
2298cfa0ad2SJack F Vogel case E1000_DEV_ID_82572EI:
2308cfa0ad2SJack F Vogel case E1000_DEV_ID_82572EI_COPPER:
2318cfa0ad2SJack F Vogel case E1000_DEV_ID_82572EI_FIBER:
2328cfa0ad2SJack F Vogel case E1000_DEV_ID_82572EI_SERDES:
2338cfa0ad2SJack F Vogel mac->type = e1000_82572;
2348cfa0ad2SJack F Vogel break;
2358cfa0ad2SJack F Vogel case E1000_DEV_ID_82573E:
2368cfa0ad2SJack F Vogel case E1000_DEV_ID_82573E_IAMT:
2378cfa0ad2SJack F Vogel case E1000_DEV_ID_82573L:
2388cfa0ad2SJack F Vogel mac->type = e1000_82573;
2398cfa0ad2SJack F Vogel break;
2408cfa0ad2SJack F Vogel case E1000_DEV_ID_82574L:
2419d81738fSJack F Vogel case E1000_DEV_ID_82574LA:
2428cfa0ad2SJack F Vogel mac->type = e1000_82574;
2438cfa0ad2SJack F Vogel break;
2449d81738fSJack F Vogel case E1000_DEV_ID_82583V:
2459d81738fSJack F Vogel mac->type = e1000_82583;
2469d81738fSJack F Vogel break;
2478cfa0ad2SJack F Vogel case E1000_DEV_ID_80003ES2LAN_COPPER_DPT:
2488cfa0ad2SJack F Vogel case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
2498cfa0ad2SJack F Vogel case E1000_DEV_ID_80003ES2LAN_COPPER_SPT:
2508cfa0ad2SJack F Vogel case E1000_DEV_ID_80003ES2LAN_SERDES_SPT:
2518cfa0ad2SJack F Vogel mac->type = e1000_80003es2lan;
2528cfa0ad2SJack F Vogel break;
2538cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH8_IFE:
2548cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH8_IFE_GT:
2558cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH8_IFE_G:
2568cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH8_IGP_M:
2578cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH8_IGP_M_AMT:
2588cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH8_IGP_AMT:
2598cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH8_IGP_C:
2604edd8523SJack F Vogel case E1000_DEV_ID_ICH8_82567V_3:
2618cfa0ad2SJack F Vogel mac->type = e1000_ich8lan;
2628cfa0ad2SJack F Vogel break;
2638cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH9_IFE:
2648cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH9_IFE_GT:
2658cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH9_IFE_G:
2668cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH9_IGP_M:
2678cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH9_IGP_M_AMT:
2688cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH9_IGP_M_V:
2698cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH9_IGP_AMT:
2708cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH9_BM:
2718cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH9_IGP_C:
2728cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH10_R_BM_LM:
2738cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH10_R_BM_LF:
2748cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH10_R_BM_V:
2758cfa0ad2SJack F Vogel mac->type = e1000_ich9lan;
2768cfa0ad2SJack F Vogel break;
2778cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH10_D_BM_LM:
2788cfa0ad2SJack F Vogel case E1000_DEV_ID_ICH10_D_BM_LF:
2797d9119bdSJack F Vogel case E1000_DEV_ID_ICH10_D_BM_V:
2808cfa0ad2SJack F Vogel mac->type = e1000_ich10lan;
2818cfa0ad2SJack F Vogel break;
2829d81738fSJack F Vogel case E1000_DEV_ID_PCH_D_HV_DM:
2839d81738fSJack F Vogel case E1000_DEV_ID_PCH_D_HV_DC:
2849d81738fSJack F Vogel case E1000_DEV_ID_PCH_M_HV_LM:
2859d81738fSJack F Vogel case E1000_DEV_ID_PCH_M_HV_LC:
2869d81738fSJack F Vogel mac->type = e1000_pchlan;
2879d81738fSJack F Vogel break;
2887d9119bdSJack F Vogel case E1000_DEV_ID_PCH2_LV_LM:
2897d9119bdSJack F Vogel case E1000_DEV_ID_PCH2_LV_V:
2907d9119bdSJack F Vogel mac->type = e1000_pch2lan;
2917d9119bdSJack F Vogel break;
2926ab6bfe3SJack F Vogel case E1000_DEV_ID_PCH_LPT_I217_LM:
2936ab6bfe3SJack F Vogel case E1000_DEV_ID_PCH_LPT_I217_V:
2946ab6bfe3SJack F Vogel case E1000_DEV_ID_PCH_LPTLP_I218_LM:
2956ab6bfe3SJack F Vogel case E1000_DEV_ID_PCH_LPTLP_I218_V:
2968cc64f1eSJack F Vogel case E1000_DEV_ID_PCH_I218_LM2:
2978cc64f1eSJack F Vogel case E1000_DEV_ID_PCH_I218_V2:
2988cc64f1eSJack F Vogel case E1000_DEV_ID_PCH_I218_LM3:
2998cc64f1eSJack F Vogel case E1000_DEV_ID_PCH_I218_V3:
3006ab6bfe3SJack F Vogel mac->type = e1000_pch_lpt;
3016ab6bfe3SJack F Vogel break;
302c80429ceSEric Joyner case E1000_DEV_ID_PCH_SPT_I219_LM:
303c80429ceSEric Joyner case E1000_DEV_ID_PCH_SPT_I219_V:
304c80429ceSEric Joyner case E1000_DEV_ID_PCH_SPT_I219_LM2:
305c80429ceSEric Joyner case E1000_DEV_ID_PCH_SPT_I219_V2:
306c80429ceSEric Joyner case E1000_DEV_ID_PCH_LBG_I219_LM3:
307e760e292SSean Bruno case E1000_DEV_ID_PCH_SPT_I219_LM4:
308e760e292SSean Bruno case E1000_DEV_ID_PCH_SPT_I219_V4:
309e760e292SSean Bruno case E1000_DEV_ID_PCH_SPT_I219_LM5:
310e760e292SSean Bruno case E1000_DEV_ID_PCH_SPT_I219_V5:
31151569bd7SEric Joyner case E1000_DEV_ID_PCH_CMP_I219_LM12:
31251569bd7SEric Joyner case E1000_DEV_ID_PCH_CMP_I219_V12:
313c80429ceSEric Joyner mac->type = e1000_pch_spt;
314c80429ceSEric Joyner break;
3156fe4c0a0SSean Bruno case E1000_DEV_ID_PCH_CNP_I219_LM6:
3166fe4c0a0SSean Bruno case E1000_DEV_ID_PCH_CNP_I219_V6:
3176fe4c0a0SSean Bruno case E1000_DEV_ID_PCH_CNP_I219_LM7:
3186fe4c0a0SSean Bruno case E1000_DEV_ID_PCH_CNP_I219_V7:
3196fe4c0a0SSean Bruno case E1000_DEV_ID_PCH_ICP_I219_LM8:
3206fe4c0a0SSean Bruno case E1000_DEV_ID_PCH_ICP_I219_V8:
3216fe4c0a0SSean Bruno case E1000_DEV_ID_PCH_ICP_I219_LM9:
3226fe4c0a0SSean Bruno case E1000_DEV_ID_PCH_ICP_I219_V9:
32351569bd7SEric Joyner case E1000_DEV_ID_PCH_CMP_I219_LM10:
32451569bd7SEric Joyner case E1000_DEV_ID_PCH_CMP_I219_V10:
32551569bd7SEric Joyner case E1000_DEV_ID_PCH_CMP_I219_LM11:
32651569bd7SEric Joyner case E1000_DEV_ID_PCH_CMP_I219_V11:
3276fe4c0a0SSean Bruno mac->type = e1000_pch_cnp;
3286fe4c0a0SSean Bruno break;
32959690eabSKevin Bowling case E1000_DEV_ID_PCH_TGP_I219_LM13:
33059690eabSKevin Bowling case E1000_DEV_ID_PCH_TGP_I219_V13:
33159690eabSKevin Bowling case E1000_DEV_ID_PCH_TGP_I219_LM14:
33259690eabSKevin Bowling case E1000_DEV_ID_PCH_TGP_I219_V14:
33359690eabSKevin Bowling case E1000_DEV_ID_PCH_TGP_I219_LM15:
33459690eabSKevin Bowling case E1000_DEV_ID_PCH_TGP_I219_V15:
335c0548bfcSPiotr Kubaj mac->type = e1000_pch_tgp;
336c0548bfcSPiotr Kubaj break;
337d0cdec7aSPiotr Kubaj case E1000_DEV_ID_PCH_ADL_I219_LM16:
338d0cdec7aSPiotr Kubaj case E1000_DEV_ID_PCH_ADL_I219_V16:
33959690eabSKevin Bowling case E1000_DEV_ID_PCH_ADL_I219_LM17:
34059690eabSKevin Bowling case E1000_DEV_ID_PCH_ADL_I219_V17:
341*77b70ad7SKevin Bowling case E1000_DEV_ID_PCH_ADL_I219_LM19:
342*77b70ad7SKevin Bowling case E1000_DEV_ID_PCH_ADL_I219_V19:
343c0548bfcSPiotr Kubaj case E1000_DEV_ID_PCH_RPL_I219_LM22:
344c0548bfcSPiotr Kubaj case E1000_DEV_ID_PCH_RPL_I219_V22:
345d0cdec7aSPiotr Kubaj case E1000_DEV_ID_PCH_RPL_I219_LM23:
346d0cdec7aSPiotr Kubaj case E1000_DEV_ID_PCH_RPL_I219_V23:
34759690eabSKevin Bowling mac->type = e1000_pch_adp;
34859690eabSKevin Bowling break;
34959690eabSKevin Bowling case E1000_DEV_ID_PCH_MTP_I219_LM18:
35059690eabSKevin Bowling case E1000_DEV_ID_PCH_MTP_I219_V18:
351c0548bfcSPiotr Kubaj case E1000_DEV_ID_PCH_LNL_I219_LM20:
352c0548bfcSPiotr Kubaj case E1000_DEV_ID_PCH_LNL_I219_V20:
353c0548bfcSPiotr Kubaj case E1000_DEV_ID_PCH_LNL_I219_LM21:
354c0548bfcSPiotr Kubaj case E1000_DEV_ID_PCH_LNL_I219_V21:
35559690eabSKevin Bowling mac->type = e1000_pch_mtp;
35659690eabSKevin Bowling break;
357905ae588SKevin Bowling case E1000_DEV_ID_PCH_ARL_I219_LM24:
358905ae588SKevin Bowling case E1000_DEV_ID_PCH_ARL_I219_V24:
359905ae588SKevin Bowling case E1000_DEV_ID_PCH_PTP_I219_LM25:
360905ae588SKevin Bowling case E1000_DEV_ID_PCH_PTP_I219_V25:
361905ae588SKevin Bowling case E1000_DEV_ID_PCH_PTP_I219_LM26:
362905ae588SKevin Bowling case E1000_DEV_ID_PCH_PTP_I219_V26:
363905ae588SKevin Bowling case E1000_DEV_ID_PCH_PTP_I219_LM27:
364905ae588SKevin Bowling case E1000_DEV_ID_PCH_PTP_I219_V27:
365905ae588SKevin Bowling mac->type = e1000_pch_ptp;
366905ae588SKevin Bowling break;
3678cfa0ad2SJack F Vogel case E1000_DEV_ID_82575EB_COPPER:
3688cfa0ad2SJack F Vogel case E1000_DEV_ID_82575EB_FIBER_SERDES:
3698cfa0ad2SJack F Vogel case E1000_DEV_ID_82575GB_QUAD_COPPER:
3708cfa0ad2SJack F Vogel mac->type = e1000_82575;
3718cfa0ad2SJack F Vogel break;
3728cfa0ad2SJack F Vogel case E1000_DEV_ID_82576:
3738cfa0ad2SJack F Vogel case E1000_DEV_ID_82576_FIBER:
3748cfa0ad2SJack F Vogel case E1000_DEV_ID_82576_SERDES:
3758cfa0ad2SJack F Vogel case E1000_DEV_ID_82576_QUAD_COPPER:
3767d9119bdSJack F Vogel case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
377d035aa2dSJack F Vogel case E1000_DEV_ID_82576_NS:
3784edd8523SJack F Vogel case E1000_DEV_ID_82576_NS_SERDES:
3799d81738fSJack F Vogel case E1000_DEV_ID_82576_SERDES_QUAD:
3808cfa0ad2SJack F Vogel mac->type = e1000_82576;
3818cfa0ad2SJack F Vogel break;
3824edd8523SJack F Vogel case E1000_DEV_ID_82580_COPPER:
3834edd8523SJack F Vogel case E1000_DEV_ID_82580_FIBER:
3844edd8523SJack F Vogel case E1000_DEV_ID_82580_SERDES:
3854edd8523SJack F Vogel case E1000_DEV_ID_82580_SGMII:
3864edd8523SJack F Vogel case E1000_DEV_ID_82580_COPPER_DUAL:
3877d9119bdSJack F Vogel case E1000_DEV_ID_82580_QUAD_FIBER:
388ffdb071aSJack F Vogel case E1000_DEV_ID_DH89XXCC_SGMII:
389ffdb071aSJack F Vogel case E1000_DEV_ID_DH89XXCC_SERDES:
390f0ecc46dSJack F Vogel case E1000_DEV_ID_DH89XXCC_BACKPLANE:
391f0ecc46dSJack F Vogel case E1000_DEV_ID_DH89XXCC_SFP:
3924edd8523SJack F Vogel mac->type = e1000_82580;
3934edd8523SJack F Vogel break;
394f0ecc46dSJack F Vogel case E1000_DEV_ID_I350_COPPER:
395f0ecc46dSJack F Vogel case E1000_DEV_ID_I350_FIBER:
396f0ecc46dSJack F Vogel case E1000_DEV_ID_I350_SERDES:
397f0ecc46dSJack F Vogel case E1000_DEV_ID_I350_SGMII:
3984dab5c37SJack F Vogel case E1000_DEV_ID_I350_DA4:
399f0ecc46dSJack F Vogel mac->type = e1000_i350;
400f0ecc46dSJack F Vogel break;
4017609433eSJack F Vogel case E1000_DEV_ID_I210_COPPER_FLASHLESS:
4027609433eSJack F Vogel case E1000_DEV_ID_I210_SERDES_FLASHLESS:
40382a9d0c2SGuinan Sun case E1000_DEV_ID_I210_SGMII_FLASHLESS:
404ab5d0362SJack F Vogel case E1000_DEV_ID_I210_COPPER:
405ab5d0362SJack F Vogel case E1000_DEV_ID_I210_COPPER_OEM1:
406ab5d0362SJack F Vogel case E1000_DEV_ID_I210_COPPER_IT:
407ab5d0362SJack F Vogel case E1000_DEV_ID_I210_FIBER:
408ab5d0362SJack F Vogel case E1000_DEV_ID_I210_SERDES:
409ab5d0362SJack F Vogel case E1000_DEV_ID_I210_SGMII:
410ab5d0362SJack F Vogel mac->type = e1000_i210;
411ab5d0362SJack F Vogel break;
412ab5d0362SJack F Vogel case E1000_DEV_ID_I211_COPPER:
413ab5d0362SJack F Vogel mac->type = e1000_i211;
414ab5d0362SJack F Vogel break;
415b8270585SJack F Vogel case E1000_DEV_ID_82576_VF:
4166ab6bfe3SJack F Vogel case E1000_DEV_ID_82576_VF_HV:
417b8270585SJack F Vogel mac->type = e1000_vfadapt;
418b8270585SJack F Vogel break;
419f0ecc46dSJack F Vogel case E1000_DEV_ID_I350_VF:
4206ab6bfe3SJack F Vogel case E1000_DEV_ID_I350_VF_HV:
421f0ecc46dSJack F Vogel mac->type = e1000_vfadapt_i350;
422f0ecc46dSJack F Vogel break;
4236ab6bfe3SJack F Vogel
4247609433eSJack F Vogel case E1000_DEV_ID_I354_BACKPLANE_1GBPS:
4257609433eSJack F Vogel case E1000_DEV_ID_I354_SGMII:
4267609433eSJack F Vogel case E1000_DEV_ID_I354_BACKPLANE_2_5GBPS:
4277609433eSJack F Vogel mac->type = e1000_i354;
4287609433eSJack F Vogel break;
4298cfa0ad2SJack F Vogel default:
4308cfa0ad2SJack F Vogel /* Should never have loaded on this device */
4318cfa0ad2SJack F Vogel ret_val = -E1000_ERR_MAC_INIT;
4328cfa0ad2SJack F Vogel break;
4338cfa0ad2SJack F Vogel }
4348cfa0ad2SJack F Vogel
4358cfa0ad2SJack F Vogel return ret_val;
4368cfa0ad2SJack F Vogel }
4378cfa0ad2SJack F Vogel
4388cfa0ad2SJack F Vogel /**
4398cfa0ad2SJack F Vogel * e1000_setup_init_funcs - Initializes function pointers
4408cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
4411bbdc25fSKevin Bowling * @init_device: true will initialize the rest of the function pointers
4421bbdc25fSKevin Bowling * getting the device ready for use. false will only set
4438cfa0ad2SJack F Vogel * MAC type and the function pointers for the other init
4441bbdc25fSKevin Bowling * functions. Passing false will not generate any hardware
4458cfa0ad2SJack F Vogel * reads or writes.
4468cfa0ad2SJack F Vogel *
4478cfa0ad2SJack F Vogel * This function must be called by a driver in order to use the rest
4488cfa0ad2SJack F Vogel * of the 'shared' code files. Called by drivers only.
4498cfa0ad2SJack F Vogel **/
e1000_setup_init_funcs(struct e1000_hw * hw,bool init_device)4508cfa0ad2SJack F Vogel s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
4518cfa0ad2SJack F Vogel {
4528cfa0ad2SJack F Vogel s32 ret_val;
4538cfa0ad2SJack F Vogel
4548cfa0ad2SJack F Vogel /* Can't do much good without knowing the MAC type. */
4558cfa0ad2SJack F Vogel ret_val = e1000_set_mac_type(hw);
4568cfa0ad2SJack F Vogel if (ret_val) {
4578cfa0ad2SJack F Vogel DEBUGOUT("ERROR: MAC type could not be set properly.\n");
4588cfa0ad2SJack F Vogel goto out;
4598cfa0ad2SJack F Vogel }
4608cfa0ad2SJack F Vogel
4618cfa0ad2SJack F Vogel if (!hw->hw_addr) {
4628cfa0ad2SJack F Vogel DEBUGOUT("ERROR: Registers not mapped\n");
4638cfa0ad2SJack F Vogel ret_val = -E1000_ERR_CONFIG;
4648cfa0ad2SJack F Vogel goto out;
4658cfa0ad2SJack F Vogel }
4668cfa0ad2SJack F Vogel
4678cfa0ad2SJack F Vogel /*
4688cfa0ad2SJack F Vogel * Init function pointers to generic implementations. We do this first
4698cfa0ad2SJack F Vogel * allowing a driver module to override it afterward.
4708cfa0ad2SJack F Vogel */
4718cfa0ad2SJack F Vogel e1000_init_mac_ops_generic(hw);
4728cfa0ad2SJack F Vogel e1000_init_phy_ops_generic(hw);
4738cfa0ad2SJack F Vogel e1000_init_nvm_ops_generic(hw);
474b8270585SJack F Vogel e1000_init_mbx_ops_generic(hw);
4758cfa0ad2SJack F Vogel
4768cfa0ad2SJack F Vogel /*
4778cfa0ad2SJack F Vogel * Set up the init function pointers. These are functions within the
4788cfa0ad2SJack F Vogel * adapter family file that sets up function pointers for the rest of
4798cfa0ad2SJack F Vogel * the functions in that family.
4808cfa0ad2SJack F Vogel */
4818cfa0ad2SJack F Vogel switch (hw->mac.type) {
4828cfa0ad2SJack F Vogel case e1000_82542:
4838cfa0ad2SJack F Vogel e1000_init_function_pointers_82542(hw);
4848cfa0ad2SJack F Vogel break;
4858cfa0ad2SJack F Vogel case e1000_82543:
4868cfa0ad2SJack F Vogel case e1000_82544:
4878cfa0ad2SJack F Vogel e1000_init_function_pointers_82543(hw);
4888cfa0ad2SJack F Vogel break;
4898cfa0ad2SJack F Vogel case e1000_82540:
4908cfa0ad2SJack F Vogel case e1000_82545:
4918cfa0ad2SJack F Vogel case e1000_82545_rev_3:
4928cfa0ad2SJack F Vogel case e1000_82546:
4938cfa0ad2SJack F Vogel case e1000_82546_rev_3:
4948cfa0ad2SJack F Vogel e1000_init_function_pointers_82540(hw);
4958cfa0ad2SJack F Vogel break;
4968cfa0ad2SJack F Vogel case e1000_82541:
4978cfa0ad2SJack F Vogel case e1000_82541_rev_2:
4988cfa0ad2SJack F Vogel case e1000_82547:
4998cfa0ad2SJack F Vogel case e1000_82547_rev_2:
5008cfa0ad2SJack F Vogel e1000_init_function_pointers_82541(hw);
5018cfa0ad2SJack F Vogel break;
5028cfa0ad2SJack F Vogel case e1000_82571:
5038cfa0ad2SJack F Vogel case e1000_82572:
5048cfa0ad2SJack F Vogel case e1000_82573:
5058cfa0ad2SJack F Vogel case e1000_82574:
5069d81738fSJack F Vogel case e1000_82583:
5078cfa0ad2SJack F Vogel e1000_init_function_pointers_82571(hw);
5088cfa0ad2SJack F Vogel break;
5098cfa0ad2SJack F Vogel case e1000_80003es2lan:
5108cfa0ad2SJack F Vogel e1000_init_function_pointers_80003es2lan(hw);
5118cfa0ad2SJack F Vogel break;
5128cfa0ad2SJack F Vogel case e1000_ich8lan:
5138cfa0ad2SJack F Vogel case e1000_ich9lan:
5148cfa0ad2SJack F Vogel case e1000_ich10lan:
5159d81738fSJack F Vogel case e1000_pchlan:
5167d9119bdSJack F Vogel case e1000_pch2lan:
5176ab6bfe3SJack F Vogel case e1000_pch_lpt:
518c80429ceSEric Joyner case e1000_pch_spt:
5196fe4c0a0SSean Bruno case e1000_pch_cnp:
52059690eabSKevin Bowling case e1000_pch_tgp:
52159690eabSKevin Bowling case e1000_pch_adp:
52259690eabSKevin Bowling case e1000_pch_mtp:
523905ae588SKevin Bowling case e1000_pch_ptp:
5248cfa0ad2SJack F Vogel e1000_init_function_pointers_ich8lan(hw);
5258cfa0ad2SJack F Vogel break;
5268cfa0ad2SJack F Vogel case e1000_82575:
5278cfa0ad2SJack F Vogel case e1000_82576:
5284edd8523SJack F Vogel case e1000_82580:
529f0ecc46dSJack F Vogel case e1000_i350:
5307609433eSJack F Vogel case e1000_i354:
5318cfa0ad2SJack F Vogel e1000_init_function_pointers_82575(hw);
5328cfa0ad2SJack F Vogel break;
533ab5d0362SJack F Vogel case e1000_i210:
534ab5d0362SJack F Vogel case e1000_i211:
535ab5d0362SJack F Vogel e1000_init_function_pointers_i210(hw);
536ab5d0362SJack F Vogel break;
537b8270585SJack F Vogel case e1000_vfadapt:
538b8270585SJack F Vogel e1000_init_function_pointers_vf(hw);
539b8270585SJack F Vogel break;
540f0ecc46dSJack F Vogel case e1000_vfadapt_i350:
541f0ecc46dSJack F Vogel e1000_init_function_pointers_vf(hw);
542f0ecc46dSJack F Vogel break;
5438cfa0ad2SJack F Vogel default:
5448cfa0ad2SJack F Vogel DEBUGOUT("Hardware not supported\n");
5458cfa0ad2SJack F Vogel ret_val = -E1000_ERR_CONFIG;
5468cfa0ad2SJack F Vogel break;
5478cfa0ad2SJack F Vogel }
5488cfa0ad2SJack F Vogel
5498cfa0ad2SJack F Vogel /*
5508cfa0ad2SJack F Vogel * Initialize the rest of the function pointers. These require some
5518cfa0ad2SJack F Vogel * register reads/writes in some cases.
5528cfa0ad2SJack F Vogel */
5538cfa0ad2SJack F Vogel if (!(ret_val) && init_device) {
5548cfa0ad2SJack F Vogel ret_val = e1000_init_mac_params(hw);
5558cfa0ad2SJack F Vogel if (ret_val)
5568cfa0ad2SJack F Vogel goto out;
5578cfa0ad2SJack F Vogel
5588cfa0ad2SJack F Vogel ret_val = e1000_init_nvm_params(hw);
5598cfa0ad2SJack F Vogel if (ret_val)
5608cfa0ad2SJack F Vogel goto out;
5618cfa0ad2SJack F Vogel
5628cfa0ad2SJack F Vogel ret_val = e1000_init_phy_params(hw);
5638cfa0ad2SJack F Vogel if (ret_val)
5648cfa0ad2SJack F Vogel goto out;
565b8270585SJack F Vogel
566b8270585SJack F Vogel ret_val = e1000_init_mbx_params(hw);
567b8270585SJack F Vogel if (ret_val)
568b8270585SJack F Vogel goto out;
5698cfa0ad2SJack F Vogel }
5708cfa0ad2SJack F Vogel
5718cfa0ad2SJack F Vogel out:
5728cfa0ad2SJack F Vogel return ret_val;
5738cfa0ad2SJack F Vogel }
5748cfa0ad2SJack F Vogel
5758cfa0ad2SJack F Vogel /**
5768cfa0ad2SJack F Vogel * e1000_get_bus_info - Obtain bus information for adapter
5778cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
5788cfa0ad2SJack F Vogel *
5798cfa0ad2SJack F Vogel * This will obtain information about the HW bus for which the
5808cfa0ad2SJack F Vogel * adapter is attached and stores it in the hw structure. This is a
5818cfa0ad2SJack F Vogel * function pointer entry point called by drivers.
5828cfa0ad2SJack F Vogel **/
e1000_get_bus_info(struct e1000_hw * hw)5838cfa0ad2SJack F Vogel s32 e1000_get_bus_info(struct e1000_hw *hw)
5848cfa0ad2SJack F Vogel {
5858cfa0ad2SJack F Vogel if (hw->mac.ops.get_bus_info)
5868cfa0ad2SJack F Vogel return hw->mac.ops.get_bus_info(hw);
5878cfa0ad2SJack F Vogel
5888cfa0ad2SJack F Vogel return E1000_SUCCESS;
5898cfa0ad2SJack F Vogel }
5908cfa0ad2SJack F Vogel
5918cfa0ad2SJack F Vogel /**
5928cfa0ad2SJack F Vogel * e1000_clear_vfta - Clear VLAN filter table
5938cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
5948cfa0ad2SJack F Vogel *
5958cfa0ad2SJack F Vogel * This clears the VLAN filter table on the adapter. This is a function
5968cfa0ad2SJack F Vogel * pointer entry point called by drivers.
5978cfa0ad2SJack F Vogel **/
e1000_clear_vfta(struct e1000_hw * hw)5988cfa0ad2SJack F Vogel void e1000_clear_vfta(struct e1000_hw *hw)
5998cfa0ad2SJack F Vogel {
6008cfa0ad2SJack F Vogel if (hw->mac.ops.clear_vfta)
6018cfa0ad2SJack F Vogel hw->mac.ops.clear_vfta(hw);
6028cfa0ad2SJack F Vogel }
6038cfa0ad2SJack F Vogel
6048cfa0ad2SJack F Vogel /**
6058cfa0ad2SJack F Vogel * e1000_write_vfta - Write value to VLAN filter table
6068cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
6078cfa0ad2SJack F Vogel * @offset: the 32-bit offset in which to write the value to.
6088cfa0ad2SJack F Vogel * @value: the 32-bit value to write at location offset.
6098cfa0ad2SJack F Vogel *
6108cfa0ad2SJack F Vogel * This writes a 32-bit value to a 32-bit offset in the VLAN filter
6118cfa0ad2SJack F Vogel * table. This is a function pointer entry point called by drivers.
6128cfa0ad2SJack F Vogel **/
e1000_write_vfta(struct e1000_hw * hw,u32 offset,u32 value)6138cfa0ad2SJack F Vogel void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
6148cfa0ad2SJack F Vogel {
6158cfa0ad2SJack F Vogel if (hw->mac.ops.write_vfta)
6168cfa0ad2SJack F Vogel hw->mac.ops.write_vfta(hw, offset, value);
6178cfa0ad2SJack F Vogel }
6188cfa0ad2SJack F Vogel
6198cfa0ad2SJack F Vogel /**
6208cfa0ad2SJack F Vogel * e1000_update_mc_addr_list - Update Multicast addresses
6218cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
6228cfa0ad2SJack F Vogel * @mc_addr_list: array of multicast addresses to program
6238cfa0ad2SJack F Vogel * @mc_addr_count: number of multicast addresses to program
6248cfa0ad2SJack F Vogel *
625d035aa2dSJack F Vogel * Updates the Multicast Table Array.
6268cfa0ad2SJack F Vogel * The caller must have a packed mc_addr_list of multicast addresses.
6278cfa0ad2SJack F Vogel **/
e1000_update_mc_addr_list(struct e1000_hw * hw,u8 * mc_addr_list,u32 mc_addr_count)6288cfa0ad2SJack F Vogel void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
629d035aa2dSJack F Vogel u32 mc_addr_count)
6308cfa0ad2SJack F Vogel {
6318cfa0ad2SJack F Vogel if (hw->mac.ops.update_mc_addr_list)
632d035aa2dSJack F Vogel hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
633d035aa2dSJack F Vogel mc_addr_count);
6348cfa0ad2SJack F Vogel }
6358cfa0ad2SJack F Vogel
6368cfa0ad2SJack F Vogel /**
6378cfa0ad2SJack F Vogel * e1000_force_mac_fc - Force MAC flow control
6388cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
6398cfa0ad2SJack F Vogel *
6408cfa0ad2SJack F Vogel * Force the MAC's flow control settings. Currently no func pointer exists
6418cfa0ad2SJack F Vogel * and all implementations are handled in the generic version of this
6428cfa0ad2SJack F Vogel * function.
6438cfa0ad2SJack F Vogel **/
e1000_force_mac_fc(struct e1000_hw * hw)6448cfa0ad2SJack F Vogel s32 e1000_force_mac_fc(struct e1000_hw *hw)
6458cfa0ad2SJack F Vogel {
6468cfa0ad2SJack F Vogel return e1000_force_mac_fc_generic(hw);
6478cfa0ad2SJack F Vogel }
6488cfa0ad2SJack F Vogel
6498cfa0ad2SJack F Vogel /**
6508cfa0ad2SJack F Vogel * e1000_check_for_link - Check/Store link connection
6518cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
6528cfa0ad2SJack F Vogel *
6538cfa0ad2SJack F Vogel * This checks the link condition of the adapter and stores the
6548cfa0ad2SJack F Vogel * results in the hw->mac structure. This is a function pointer entry
6558cfa0ad2SJack F Vogel * point called by drivers.
6568cfa0ad2SJack F Vogel **/
e1000_check_for_link(struct e1000_hw * hw)6578cfa0ad2SJack F Vogel s32 e1000_check_for_link(struct e1000_hw *hw)
6588cfa0ad2SJack F Vogel {
6598cfa0ad2SJack F Vogel if (hw->mac.ops.check_for_link)
6608cfa0ad2SJack F Vogel return hw->mac.ops.check_for_link(hw);
6618cfa0ad2SJack F Vogel
6628cfa0ad2SJack F Vogel return -E1000_ERR_CONFIG;
6638cfa0ad2SJack F Vogel }
6648cfa0ad2SJack F Vogel
6658cfa0ad2SJack F Vogel /**
6668cfa0ad2SJack F Vogel * e1000_check_mng_mode - Check management mode
6678cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
6688cfa0ad2SJack F Vogel *
6698cfa0ad2SJack F Vogel * This checks if the adapter has manageability enabled.
6708cfa0ad2SJack F Vogel * This is a function pointer entry point called by drivers.
6718cfa0ad2SJack F Vogel **/
e1000_check_mng_mode(struct e1000_hw * hw)6728cfa0ad2SJack F Vogel bool e1000_check_mng_mode(struct e1000_hw *hw)
6738cfa0ad2SJack F Vogel {
6748cfa0ad2SJack F Vogel if (hw->mac.ops.check_mng_mode)
6758cfa0ad2SJack F Vogel return hw->mac.ops.check_mng_mode(hw);
6768cfa0ad2SJack F Vogel
6771bbdc25fSKevin Bowling return false;
6788cfa0ad2SJack F Vogel }
6798cfa0ad2SJack F Vogel
6808cfa0ad2SJack F Vogel /**
6818cfa0ad2SJack F Vogel * e1000_mng_write_dhcp_info - Writes DHCP info to host interface
6828cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
6838cfa0ad2SJack F Vogel * @buffer: pointer to the host interface
6848cfa0ad2SJack F Vogel * @length: size of the buffer
6858cfa0ad2SJack F Vogel *
6868cfa0ad2SJack F Vogel * Writes the DHCP information to the host interface.
6878cfa0ad2SJack F Vogel **/
e1000_mng_write_dhcp_info(struct e1000_hw * hw,u8 * buffer,u16 length)6888cfa0ad2SJack F Vogel s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
6898cfa0ad2SJack F Vogel {
6908cfa0ad2SJack F Vogel return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
6918cfa0ad2SJack F Vogel }
6928cfa0ad2SJack F Vogel
6938cfa0ad2SJack F Vogel /**
6948cfa0ad2SJack F Vogel * e1000_reset_hw - Reset hardware
6958cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
6968cfa0ad2SJack F Vogel *
6978cfa0ad2SJack F Vogel * This resets the hardware into a known state. This is a function pointer
6988cfa0ad2SJack F Vogel * entry point called by drivers.
6998cfa0ad2SJack F Vogel **/
e1000_reset_hw(struct e1000_hw * hw)7008cfa0ad2SJack F Vogel s32 e1000_reset_hw(struct e1000_hw *hw)
7018cfa0ad2SJack F Vogel {
7028cfa0ad2SJack F Vogel if (hw->mac.ops.reset_hw)
7038cfa0ad2SJack F Vogel return hw->mac.ops.reset_hw(hw);
7048cfa0ad2SJack F Vogel
7058cfa0ad2SJack F Vogel return -E1000_ERR_CONFIG;
7068cfa0ad2SJack F Vogel }
7078cfa0ad2SJack F Vogel
7088cfa0ad2SJack F Vogel /**
7098cfa0ad2SJack F Vogel * e1000_init_hw - Initialize hardware
7108cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
7118cfa0ad2SJack F Vogel *
7128cfa0ad2SJack F Vogel * This inits the hardware readying it for operation. This is a function
7138cfa0ad2SJack F Vogel * pointer entry point called by drivers.
7148cfa0ad2SJack F Vogel **/
e1000_init_hw(struct e1000_hw * hw)7158cfa0ad2SJack F Vogel s32 e1000_init_hw(struct e1000_hw *hw)
7168cfa0ad2SJack F Vogel {
7178cfa0ad2SJack F Vogel if (hw->mac.ops.init_hw)
7188cfa0ad2SJack F Vogel return hw->mac.ops.init_hw(hw);
7198cfa0ad2SJack F Vogel
7208cfa0ad2SJack F Vogel return -E1000_ERR_CONFIG;
7218cfa0ad2SJack F Vogel }
7228cfa0ad2SJack F Vogel
7238cfa0ad2SJack F Vogel /**
7248cfa0ad2SJack F Vogel * e1000_setup_link - Configures link and flow control
7258cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
7268cfa0ad2SJack F Vogel *
7278cfa0ad2SJack F Vogel * This configures link and flow control settings for the adapter. This
7288cfa0ad2SJack F Vogel * is a function pointer entry point called by drivers. While modules can
7298cfa0ad2SJack F Vogel * also call this, they probably call their own version of this function.
7308cfa0ad2SJack F Vogel **/
e1000_setup_link(struct e1000_hw * hw)7318cfa0ad2SJack F Vogel s32 e1000_setup_link(struct e1000_hw *hw)
7328cfa0ad2SJack F Vogel {
7338cfa0ad2SJack F Vogel if (hw->mac.ops.setup_link)
7348cfa0ad2SJack F Vogel return hw->mac.ops.setup_link(hw);
7358cfa0ad2SJack F Vogel
7368cfa0ad2SJack F Vogel return -E1000_ERR_CONFIG;
7378cfa0ad2SJack F Vogel }
7388cfa0ad2SJack F Vogel
7398cfa0ad2SJack F Vogel /**
7408cfa0ad2SJack F Vogel * e1000_get_speed_and_duplex - Returns current speed and duplex
7418cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
7428cfa0ad2SJack F Vogel * @speed: pointer to a 16-bit value to store the speed
7438cfa0ad2SJack F Vogel * @duplex: pointer to a 16-bit value to store the duplex.
7448cfa0ad2SJack F Vogel *
7458cfa0ad2SJack F Vogel * This returns the speed and duplex of the adapter in the two 'out'
7468cfa0ad2SJack F Vogel * variables passed in. This is a function pointer entry point called
7478cfa0ad2SJack F Vogel * by drivers.
7488cfa0ad2SJack F Vogel **/
e1000_get_speed_and_duplex(struct e1000_hw * hw,u16 * speed,u16 * duplex)7498cfa0ad2SJack F Vogel s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
7508cfa0ad2SJack F Vogel {
7518cfa0ad2SJack F Vogel if (hw->mac.ops.get_link_up_info)
7528cfa0ad2SJack F Vogel return hw->mac.ops.get_link_up_info(hw, speed, duplex);
7538cfa0ad2SJack F Vogel
7548cfa0ad2SJack F Vogel return -E1000_ERR_CONFIG;
7558cfa0ad2SJack F Vogel }
7568cfa0ad2SJack F Vogel
7578cfa0ad2SJack F Vogel /**
7588cfa0ad2SJack F Vogel * e1000_setup_led - Configures SW controllable LED
7598cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
7608cfa0ad2SJack F Vogel *
7618cfa0ad2SJack F Vogel * This prepares the SW controllable LED for use and saves the current state
7628cfa0ad2SJack F Vogel * of the LED so it can be later restored. This is a function pointer entry
7638cfa0ad2SJack F Vogel * point called by drivers.
7648cfa0ad2SJack F Vogel **/
e1000_setup_led(struct e1000_hw * hw)7658cfa0ad2SJack F Vogel s32 e1000_setup_led(struct e1000_hw *hw)
7668cfa0ad2SJack F Vogel {
7678cfa0ad2SJack F Vogel if (hw->mac.ops.setup_led)
7688cfa0ad2SJack F Vogel return hw->mac.ops.setup_led(hw);
7698cfa0ad2SJack F Vogel
7708cfa0ad2SJack F Vogel return E1000_SUCCESS;
7718cfa0ad2SJack F Vogel }
7728cfa0ad2SJack F Vogel
7738cfa0ad2SJack F Vogel /**
7748cfa0ad2SJack F Vogel * e1000_cleanup_led - Restores SW controllable LED
7758cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
7768cfa0ad2SJack F Vogel *
7778cfa0ad2SJack F Vogel * This restores the SW controllable LED to the value saved off by
7788cfa0ad2SJack F Vogel * e1000_setup_led. This is a function pointer entry point called by drivers.
7798cfa0ad2SJack F Vogel **/
e1000_cleanup_led(struct e1000_hw * hw)7808cfa0ad2SJack F Vogel s32 e1000_cleanup_led(struct e1000_hw *hw)
7818cfa0ad2SJack F Vogel {
7828cfa0ad2SJack F Vogel if (hw->mac.ops.cleanup_led)
7838cfa0ad2SJack F Vogel return hw->mac.ops.cleanup_led(hw);
7848cfa0ad2SJack F Vogel
7858cfa0ad2SJack F Vogel return E1000_SUCCESS;
7868cfa0ad2SJack F Vogel }
7878cfa0ad2SJack F Vogel
7888cfa0ad2SJack F Vogel /**
7898cfa0ad2SJack F Vogel * e1000_blink_led - Blink SW controllable LED
7908cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
7918cfa0ad2SJack F Vogel *
7928cfa0ad2SJack F Vogel * This starts the adapter LED blinking. Request the LED to be setup first
7938cfa0ad2SJack F Vogel * and cleaned up after. This is a function pointer entry point called by
7948cfa0ad2SJack F Vogel * drivers.
7958cfa0ad2SJack F Vogel **/
e1000_blink_led(struct e1000_hw * hw)7968cfa0ad2SJack F Vogel s32 e1000_blink_led(struct e1000_hw *hw)
7978cfa0ad2SJack F Vogel {
7988cfa0ad2SJack F Vogel if (hw->mac.ops.blink_led)
7998cfa0ad2SJack F Vogel return hw->mac.ops.blink_led(hw);
8008cfa0ad2SJack F Vogel
8018cfa0ad2SJack F Vogel return E1000_SUCCESS;
8028cfa0ad2SJack F Vogel }
8038cfa0ad2SJack F Vogel
8048cfa0ad2SJack F Vogel /**
805d035aa2dSJack F Vogel * e1000_id_led_init - store LED configurations in SW
806d035aa2dSJack F Vogel * @hw: pointer to the HW structure
807d035aa2dSJack F Vogel *
808d035aa2dSJack F Vogel * Initializes the LED config in SW. This is a function pointer entry point
809d035aa2dSJack F Vogel * called by drivers.
810d035aa2dSJack F Vogel **/
e1000_id_led_init(struct e1000_hw * hw)811d035aa2dSJack F Vogel s32 e1000_id_led_init(struct e1000_hw *hw)
812d035aa2dSJack F Vogel {
813d035aa2dSJack F Vogel if (hw->mac.ops.id_led_init)
814d035aa2dSJack F Vogel return hw->mac.ops.id_led_init(hw);
815d035aa2dSJack F Vogel
816d035aa2dSJack F Vogel return E1000_SUCCESS;
817d035aa2dSJack F Vogel }
818d035aa2dSJack F Vogel
819d035aa2dSJack F Vogel /**
8208cfa0ad2SJack F Vogel * e1000_led_on - Turn on SW controllable LED
8218cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
8228cfa0ad2SJack F Vogel *
8238cfa0ad2SJack F Vogel * Turns the SW defined LED on. This is a function pointer entry point
8248cfa0ad2SJack F Vogel * called by drivers.
8258cfa0ad2SJack F Vogel **/
e1000_led_on(struct e1000_hw * hw)8268cfa0ad2SJack F Vogel s32 e1000_led_on(struct e1000_hw *hw)
8278cfa0ad2SJack F Vogel {
8288cfa0ad2SJack F Vogel if (hw->mac.ops.led_on)
8298cfa0ad2SJack F Vogel return hw->mac.ops.led_on(hw);
8308cfa0ad2SJack F Vogel
8318cfa0ad2SJack F Vogel return E1000_SUCCESS;
8328cfa0ad2SJack F Vogel }
8338cfa0ad2SJack F Vogel
8348cfa0ad2SJack F Vogel /**
8358cfa0ad2SJack F Vogel * e1000_led_off - Turn off SW controllable LED
8368cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
8378cfa0ad2SJack F Vogel *
8388cfa0ad2SJack F Vogel * Turns the SW defined LED off. This is a function pointer entry point
8398cfa0ad2SJack F Vogel * called by drivers.
8408cfa0ad2SJack F Vogel **/
e1000_led_off(struct e1000_hw * hw)8418cfa0ad2SJack F Vogel s32 e1000_led_off(struct e1000_hw *hw)
8428cfa0ad2SJack F Vogel {
8438cfa0ad2SJack F Vogel if (hw->mac.ops.led_off)
8448cfa0ad2SJack F Vogel return hw->mac.ops.led_off(hw);
8458cfa0ad2SJack F Vogel
8468cfa0ad2SJack F Vogel return E1000_SUCCESS;
8478cfa0ad2SJack F Vogel }
8488cfa0ad2SJack F Vogel
8498cfa0ad2SJack F Vogel /**
8508cfa0ad2SJack F Vogel * e1000_reset_adaptive - Reset adaptive IFS
8518cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
8528cfa0ad2SJack F Vogel *
8538cfa0ad2SJack F Vogel * Resets the adaptive IFS. Currently no func pointer exists and all
8548cfa0ad2SJack F Vogel * implementations are handled in the generic version of this function.
8558cfa0ad2SJack F Vogel **/
e1000_reset_adaptive(struct e1000_hw * hw)8568cfa0ad2SJack F Vogel void e1000_reset_adaptive(struct e1000_hw *hw)
8578cfa0ad2SJack F Vogel {
8588cfa0ad2SJack F Vogel e1000_reset_adaptive_generic(hw);
8598cfa0ad2SJack F Vogel }
8608cfa0ad2SJack F Vogel
8618cfa0ad2SJack F Vogel /**
8628cfa0ad2SJack F Vogel * e1000_update_adaptive - Update adaptive IFS
8638cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
8648cfa0ad2SJack F Vogel *
8658cfa0ad2SJack F Vogel * Updates adapter IFS. Currently no func pointer exists and all
8668cfa0ad2SJack F Vogel * implementations are handled in the generic version of this function.
8678cfa0ad2SJack F Vogel **/
e1000_update_adaptive(struct e1000_hw * hw)8688cfa0ad2SJack F Vogel void e1000_update_adaptive(struct e1000_hw *hw)
8698cfa0ad2SJack F Vogel {
8708cfa0ad2SJack F Vogel e1000_update_adaptive_generic(hw);
8718cfa0ad2SJack F Vogel }
8728cfa0ad2SJack F Vogel
8738cfa0ad2SJack F Vogel /**
8748cfa0ad2SJack F Vogel * e1000_disable_pcie_master - Disable PCI-Express master access
8758cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
8768cfa0ad2SJack F Vogel *
8778cfa0ad2SJack F Vogel * Disables PCI-Express master access and verifies there are no pending
8788cfa0ad2SJack F Vogel * requests. Currently no func pointer exists and all implementations are
8798cfa0ad2SJack F Vogel * handled in the generic version of this function.
8808cfa0ad2SJack F Vogel **/
e1000_disable_pcie_master(struct e1000_hw * hw)8818cfa0ad2SJack F Vogel s32 e1000_disable_pcie_master(struct e1000_hw *hw)
8828cfa0ad2SJack F Vogel {
8838cfa0ad2SJack F Vogel return e1000_disable_pcie_master_generic(hw);
8848cfa0ad2SJack F Vogel }
8858cfa0ad2SJack F Vogel
8868cfa0ad2SJack F Vogel /**
8878cfa0ad2SJack F Vogel * e1000_config_collision_dist - Configure collision distance
8888cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
8898cfa0ad2SJack F Vogel *
8908cfa0ad2SJack F Vogel * Configures the collision distance to the default value and is used
8918cfa0ad2SJack F Vogel * during link setup.
8928cfa0ad2SJack F Vogel **/
e1000_config_collision_dist(struct e1000_hw * hw)8938cfa0ad2SJack F Vogel void e1000_config_collision_dist(struct e1000_hw *hw)
8948cfa0ad2SJack F Vogel {
8958cfa0ad2SJack F Vogel if (hw->mac.ops.config_collision_dist)
8968cfa0ad2SJack F Vogel hw->mac.ops.config_collision_dist(hw);
8978cfa0ad2SJack F Vogel }
8988cfa0ad2SJack F Vogel
8998cfa0ad2SJack F Vogel /**
9008cfa0ad2SJack F Vogel * e1000_rar_set - Sets a receive address register
9018cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
9028cfa0ad2SJack F Vogel * @addr: address to set the RAR to
9038cfa0ad2SJack F Vogel * @index: the RAR to set
9048cfa0ad2SJack F Vogel *
9058cfa0ad2SJack F Vogel * Sets a Receive Address Register (RAR) to the specified address.
9068cfa0ad2SJack F Vogel **/
e1000_rar_set(struct e1000_hw * hw,u8 * addr,u32 index)9078cc64f1eSJack F Vogel int e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
9088cfa0ad2SJack F Vogel {
9098cfa0ad2SJack F Vogel if (hw->mac.ops.rar_set)
9108cc64f1eSJack F Vogel return hw->mac.ops.rar_set(hw, addr, index);
9118cc64f1eSJack F Vogel
9128cc64f1eSJack F Vogel return E1000_SUCCESS;
9138cfa0ad2SJack F Vogel }
9148cfa0ad2SJack F Vogel
9158cfa0ad2SJack F Vogel /**
9168cfa0ad2SJack F Vogel * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
9178cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
9188cfa0ad2SJack F Vogel *
9198cfa0ad2SJack F Vogel * Ensures that the MDI/MDIX SW state is valid.
9208cfa0ad2SJack F Vogel **/
e1000_validate_mdi_setting(struct e1000_hw * hw)9218cfa0ad2SJack F Vogel s32 e1000_validate_mdi_setting(struct e1000_hw *hw)
9228cfa0ad2SJack F Vogel {
9238cfa0ad2SJack F Vogel if (hw->mac.ops.validate_mdi_setting)
9248cfa0ad2SJack F Vogel return hw->mac.ops.validate_mdi_setting(hw);
9258cfa0ad2SJack F Vogel
9268cfa0ad2SJack F Vogel return E1000_SUCCESS;
9278cfa0ad2SJack F Vogel }
9288cfa0ad2SJack F Vogel
9298cfa0ad2SJack F Vogel /**
9308cfa0ad2SJack F Vogel * e1000_hash_mc_addr - Determines address location in multicast table
9318cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
9328cfa0ad2SJack F Vogel * @mc_addr: Multicast address to hash.
9338cfa0ad2SJack F Vogel *
9348cfa0ad2SJack F Vogel * This hashes an address to determine its location in the multicast
9358cfa0ad2SJack F Vogel * table. Currently no func pointer exists and all implementations
9368cfa0ad2SJack F Vogel * are handled in the generic version of this function.
9378cfa0ad2SJack F Vogel **/
e1000_hash_mc_addr(struct e1000_hw * hw,u8 * mc_addr)9388cfa0ad2SJack F Vogel u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
9398cfa0ad2SJack F Vogel {
9408cfa0ad2SJack F Vogel return e1000_hash_mc_addr_generic(hw, mc_addr);
9418cfa0ad2SJack F Vogel }
9428cfa0ad2SJack F Vogel
9438cfa0ad2SJack F Vogel /**
9448cfa0ad2SJack F Vogel * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
9458cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
9468cfa0ad2SJack F Vogel *
9478cfa0ad2SJack F Vogel * Enables packet filtering on transmit packets if manageability is enabled
9488cfa0ad2SJack F Vogel * and host interface is enabled.
9498cfa0ad2SJack F Vogel * Currently no func pointer exists and all implementations are handled in the
9508cfa0ad2SJack F Vogel * generic version of this function.
9518cfa0ad2SJack F Vogel **/
e1000_enable_tx_pkt_filtering(struct e1000_hw * hw)9528cfa0ad2SJack F Vogel bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
9538cfa0ad2SJack F Vogel {
9548cfa0ad2SJack F Vogel return e1000_enable_tx_pkt_filtering_generic(hw);
9558cfa0ad2SJack F Vogel }
9568cfa0ad2SJack F Vogel
9578cfa0ad2SJack F Vogel /**
9588cfa0ad2SJack F Vogel * e1000_mng_host_if_write - Writes to the manageability host interface
9598cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
9608cfa0ad2SJack F Vogel * @buffer: pointer to the host interface buffer
9618cfa0ad2SJack F Vogel * @length: size of the buffer
9628cfa0ad2SJack F Vogel * @offset: location in the buffer to write to
9638cfa0ad2SJack F Vogel * @sum: sum of the data (not checksum)
9648cfa0ad2SJack F Vogel *
9658cfa0ad2SJack F Vogel * This function writes the buffer content at the offset given on the host if.
9668cfa0ad2SJack F Vogel * It also does alignment considerations to do the writes in most efficient
9678cfa0ad2SJack F Vogel * way. Also fills up the sum of the buffer in *buffer parameter.
9688cfa0ad2SJack F Vogel **/
e1000_mng_host_if_write(struct e1000_hw * hw,u8 * buffer,u16 length,u16 offset,u8 * sum)9698cfa0ad2SJack F Vogel s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
9708cfa0ad2SJack F Vogel u16 offset, u8 *sum)
9718cfa0ad2SJack F Vogel {
9726ab6bfe3SJack F Vogel return e1000_mng_host_if_write_generic(hw, buffer, length, offset, sum);
9738cfa0ad2SJack F Vogel }
9748cfa0ad2SJack F Vogel
9758cfa0ad2SJack F Vogel /**
9768cfa0ad2SJack F Vogel * e1000_mng_write_cmd_header - Writes manageability command header
9778cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
9788cfa0ad2SJack F Vogel * @hdr: pointer to the host interface command header
9798cfa0ad2SJack F Vogel *
9808cfa0ad2SJack F Vogel * Writes the command header after does the checksum calculation.
9818cfa0ad2SJack F Vogel **/
e1000_mng_write_cmd_header(struct e1000_hw * hw,struct e1000_host_mng_command_header * hdr)9828cfa0ad2SJack F Vogel s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
9838cfa0ad2SJack F Vogel struct e1000_host_mng_command_header *hdr)
9848cfa0ad2SJack F Vogel {
9856ab6bfe3SJack F Vogel return e1000_mng_write_cmd_header_generic(hw, hdr);
9868cfa0ad2SJack F Vogel }
9878cfa0ad2SJack F Vogel
9888cfa0ad2SJack F Vogel /**
9898cfa0ad2SJack F Vogel * e1000_mng_enable_host_if - Checks host interface is enabled
9908cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
9918cfa0ad2SJack F Vogel *
9928cfa0ad2SJack F Vogel * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
9938cfa0ad2SJack F Vogel *
9948cfa0ad2SJack F Vogel * This function checks whether the HOST IF is enabled for command operation
9958cfa0ad2SJack F Vogel * and also checks whether the previous command is completed. It busy waits
9968cfa0ad2SJack F Vogel * in case of previous command is not completed.
9978cfa0ad2SJack F Vogel **/
e1000_mng_enable_host_if(struct e1000_hw * hw)9988cfa0ad2SJack F Vogel s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
9998cfa0ad2SJack F Vogel {
10006ab6bfe3SJack F Vogel return e1000_mng_enable_host_if_generic(hw);
10018cfa0ad2SJack F Vogel }
10028cfa0ad2SJack F Vogel
10038cfa0ad2SJack F Vogel /**
1004e373323fSSean Bruno * e1000_set_obff_timer - Set Optimized Buffer Flush/Fill timer
1005e373323fSSean Bruno * @hw: pointer to the HW structure
1006e373323fSSean Bruno * @itr: u32 indicating itr value
1007e373323fSSean Bruno *
1008e373323fSSean Bruno * Set the OBFF timer based on the given interrupt rate.
1009e373323fSSean Bruno **/
e1000_set_obff_timer(struct e1000_hw * hw,u32 itr)1010e373323fSSean Bruno s32 e1000_set_obff_timer(struct e1000_hw *hw, u32 itr)
1011e373323fSSean Bruno {
1012e373323fSSean Bruno if (hw->mac.ops.set_obff_timer)
1013e373323fSSean Bruno return hw->mac.ops.set_obff_timer(hw, itr);
1014e373323fSSean Bruno
1015e373323fSSean Bruno return E1000_SUCCESS;
1016e373323fSSean Bruno }
1017e373323fSSean Bruno
1018e373323fSSean Bruno /**
10198cfa0ad2SJack F Vogel * e1000_check_reset_block - Verifies PHY can be reset
10208cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
10218cfa0ad2SJack F Vogel *
10228cfa0ad2SJack F Vogel * Checks if the PHY is in a state that can be reset or if manageability
10238cfa0ad2SJack F Vogel * has it tied up. This is a function pointer entry point called by drivers.
10248cfa0ad2SJack F Vogel **/
e1000_check_reset_block(struct e1000_hw * hw)10258cfa0ad2SJack F Vogel s32 e1000_check_reset_block(struct e1000_hw *hw)
10268cfa0ad2SJack F Vogel {
10278cfa0ad2SJack F Vogel if (hw->phy.ops.check_reset_block)
10288cfa0ad2SJack F Vogel return hw->phy.ops.check_reset_block(hw);
10298cfa0ad2SJack F Vogel
10308cfa0ad2SJack F Vogel return E1000_SUCCESS;
10318cfa0ad2SJack F Vogel }
10328cfa0ad2SJack F Vogel
10338cfa0ad2SJack F Vogel /**
10348cfa0ad2SJack F Vogel * e1000_read_phy_reg - Reads PHY register
10358cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
10368cfa0ad2SJack F Vogel * @offset: the register to read
10378cfa0ad2SJack F Vogel * @data: the buffer to store the 16-bit read.
10388cfa0ad2SJack F Vogel *
10398cfa0ad2SJack F Vogel * Reads the PHY register and returns the value in data.
10408cfa0ad2SJack F Vogel * This is a function pointer entry point called by drivers.
10418cfa0ad2SJack F Vogel **/
e1000_read_phy_reg(struct e1000_hw * hw,u32 offset,u16 * data)10428cfa0ad2SJack F Vogel s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
10438cfa0ad2SJack F Vogel {
10448cfa0ad2SJack F Vogel if (hw->phy.ops.read_reg)
10458cfa0ad2SJack F Vogel return hw->phy.ops.read_reg(hw, offset, data);
10468cfa0ad2SJack F Vogel
10478cfa0ad2SJack F Vogel return E1000_SUCCESS;
10488cfa0ad2SJack F Vogel }
10498cfa0ad2SJack F Vogel
10508cfa0ad2SJack F Vogel /**
10518cfa0ad2SJack F Vogel * e1000_write_phy_reg - Writes PHY register
10528cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
10538cfa0ad2SJack F Vogel * @offset: the register to write
10548cfa0ad2SJack F Vogel * @data: the value to write.
10558cfa0ad2SJack F Vogel *
10568cfa0ad2SJack F Vogel * Writes the PHY register at offset with the value in data.
10578cfa0ad2SJack F Vogel * This is a function pointer entry point called by drivers.
10588cfa0ad2SJack F Vogel **/
e1000_write_phy_reg(struct e1000_hw * hw,u32 offset,u16 data)10598cfa0ad2SJack F Vogel s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
10608cfa0ad2SJack F Vogel {
10618cfa0ad2SJack F Vogel if (hw->phy.ops.write_reg)
10628cfa0ad2SJack F Vogel return hw->phy.ops.write_reg(hw, offset, data);
10638cfa0ad2SJack F Vogel
10648cfa0ad2SJack F Vogel return E1000_SUCCESS;
10658cfa0ad2SJack F Vogel }
10668cfa0ad2SJack F Vogel
10678cfa0ad2SJack F Vogel /**
10688cfa0ad2SJack F Vogel * e1000_release_phy - Generic release PHY
10698cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
10708cfa0ad2SJack F Vogel *
10718cfa0ad2SJack F Vogel * Return if silicon family does not require a semaphore when accessing the
10728cfa0ad2SJack F Vogel * PHY.
10738cfa0ad2SJack F Vogel **/
e1000_release_phy(struct e1000_hw * hw)10748cfa0ad2SJack F Vogel void e1000_release_phy(struct e1000_hw *hw)
10758cfa0ad2SJack F Vogel {
10768cfa0ad2SJack F Vogel if (hw->phy.ops.release)
10778cfa0ad2SJack F Vogel hw->phy.ops.release(hw);
10788cfa0ad2SJack F Vogel }
10798cfa0ad2SJack F Vogel
10808cfa0ad2SJack F Vogel /**
10818cfa0ad2SJack F Vogel * e1000_acquire_phy - Generic acquire PHY
10828cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
10838cfa0ad2SJack F Vogel *
10848cfa0ad2SJack F Vogel * Return success if silicon family does not require a semaphore when
10858cfa0ad2SJack F Vogel * accessing the PHY.
10868cfa0ad2SJack F Vogel **/
e1000_acquire_phy(struct e1000_hw * hw)10878cfa0ad2SJack F Vogel s32 e1000_acquire_phy(struct e1000_hw *hw)
10888cfa0ad2SJack F Vogel {
10898cfa0ad2SJack F Vogel if (hw->phy.ops.acquire)
10908cfa0ad2SJack F Vogel return hw->phy.ops.acquire(hw);
10918cfa0ad2SJack F Vogel
10928cfa0ad2SJack F Vogel return E1000_SUCCESS;
10938cfa0ad2SJack F Vogel }
10948cfa0ad2SJack F Vogel
10958cfa0ad2SJack F Vogel /**
1096daf9197cSJack F Vogel * e1000_cfg_on_link_up - Configure PHY upon link up
1097daf9197cSJack F Vogel * @hw: pointer to the HW structure
1098daf9197cSJack F Vogel **/
e1000_cfg_on_link_up(struct e1000_hw * hw)1099daf9197cSJack F Vogel s32 e1000_cfg_on_link_up(struct e1000_hw *hw)
1100daf9197cSJack F Vogel {
1101daf9197cSJack F Vogel if (hw->phy.ops.cfg_on_link_up)
1102daf9197cSJack F Vogel return hw->phy.ops.cfg_on_link_up(hw);
1103daf9197cSJack F Vogel
1104daf9197cSJack F Vogel return E1000_SUCCESS;
1105daf9197cSJack F Vogel }
1106daf9197cSJack F Vogel
1107daf9197cSJack F Vogel /**
11088cfa0ad2SJack F Vogel * e1000_read_kmrn_reg - Reads register using Kumeran interface
11098cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
11108cfa0ad2SJack F Vogel * @offset: the register to read
11118cfa0ad2SJack F Vogel * @data: the location to store the 16-bit value read.
11128cfa0ad2SJack F Vogel *
11138cfa0ad2SJack F Vogel * Reads a register out of the Kumeran interface. Currently no func pointer
11148cfa0ad2SJack F Vogel * exists and all implementations are handled in the generic version of
11158cfa0ad2SJack F Vogel * this function.
11168cfa0ad2SJack F Vogel **/
e1000_read_kmrn_reg(struct e1000_hw * hw,u32 offset,u16 * data)11178cfa0ad2SJack F Vogel s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
11188cfa0ad2SJack F Vogel {
11198cfa0ad2SJack F Vogel return e1000_read_kmrn_reg_generic(hw, offset, data);
11208cfa0ad2SJack F Vogel }
11218cfa0ad2SJack F Vogel
11228cfa0ad2SJack F Vogel /**
11238cfa0ad2SJack F Vogel * e1000_write_kmrn_reg - Writes register using Kumeran interface
11248cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
11258cfa0ad2SJack F Vogel * @offset: the register to write
11268cfa0ad2SJack F Vogel * @data: the value to write.
11278cfa0ad2SJack F Vogel *
11288cfa0ad2SJack F Vogel * Writes a register to the Kumeran interface. Currently no func pointer
11298cfa0ad2SJack F Vogel * exists and all implementations are handled in the generic version of
11308cfa0ad2SJack F Vogel * this function.
11318cfa0ad2SJack F Vogel **/
e1000_write_kmrn_reg(struct e1000_hw * hw,u32 offset,u16 data)11328cfa0ad2SJack F Vogel s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
11338cfa0ad2SJack F Vogel {
11348cfa0ad2SJack F Vogel return e1000_write_kmrn_reg_generic(hw, offset, data);
11358cfa0ad2SJack F Vogel }
11368cfa0ad2SJack F Vogel
11378cfa0ad2SJack F Vogel /**
11388cfa0ad2SJack F Vogel * e1000_get_cable_length - Retrieves cable length estimation
11398cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
11408cfa0ad2SJack F Vogel *
11418cfa0ad2SJack F Vogel * This function estimates the cable length and stores them in
11428cfa0ad2SJack F Vogel * hw->phy.min_length and hw->phy.max_length. This is a function pointer
11438cfa0ad2SJack F Vogel * entry point called by drivers.
11448cfa0ad2SJack F Vogel **/
e1000_get_cable_length(struct e1000_hw * hw)11458cfa0ad2SJack F Vogel s32 e1000_get_cable_length(struct e1000_hw *hw)
11468cfa0ad2SJack F Vogel {
11478cfa0ad2SJack F Vogel if (hw->phy.ops.get_cable_length)
11488cfa0ad2SJack F Vogel return hw->phy.ops.get_cable_length(hw);
11498cfa0ad2SJack F Vogel
11508cfa0ad2SJack F Vogel return E1000_SUCCESS;
11518cfa0ad2SJack F Vogel }
11528cfa0ad2SJack F Vogel
11538cfa0ad2SJack F Vogel /**
11548cfa0ad2SJack F Vogel * e1000_get_phy_info - Retrieves PHY information from registers
11558cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
11568cfa0ad2SJack F Vogel *
11578cfa0ad2SJack F Vogel * This function gets some information from various PHY registers and
11588cfa0ad2SJack F Vogel * populates hw->phy values with it. This is a function pointer entry
11598cfa0ad2SJack F Vogel * point called by drivers.
11608cfa0ad2SJack F Vogel **/
e1000_get_phy_info(struct e1000_hw * hw)11618cfa0ad2SJack F Vogel s32 e1000_get_phy_info(struct e1000_hw *hw)
11628cfa0ad2SJack F Vogel {
11638cfa0ad2SJack F Vogel if (hw->phy.ops.get_info)
11648cfa0ad2SJack F Vogel return hw->phy.ops.get_info(hw);
11658cfa0ad2SJack F Vogel
11668cfa0ad2SJack F Vogel return E1000_SUCCESS;
11678cfa0ad2SJack F Vogel }
11688cfa0ad2SJack F Vogel
11698cfa0ad2SJack F Vogel /**
11708cfa0ad2SJack F Vogel * e1000_phy_hw_reset - Hard PHY reset
11718cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
11728cfa0ad2SJack F Vogel *
11738cfa0ad2SJack F Vogel * Performs a hard PHY reset. This is a function pointer entry point called
11748cfa0ad2SJack F Vogel * by drivers.
11758cfa0ad2SJack F Vogel **/
e1000_phy_hw_reset(struct e1000_hw * hw)11768cfa0ad2SJack F Vogel s32 e1000_phy_hw_reset(struct e1000_hw *hw)
11778cfa0ad2SJack F Vogel {
11788cfa0ad2SJack F Vogel if (hw->phy.ops.reset)
11798cfa0ad2SJack F Vogel return hw->phy.ops.reset(hw);
11808cfa0ad2SJack F Vogel
11818cfa0ad2SJack F Vogel return E1000_SUCCESS;
11828cfa0ad2SJack F Vogel }
11838cfa0ad2SJack F Vogel
11848cfa0ad2SJack F Vogel /**
11858cfa0ad2SJack F Vogel * e1000_phy_commit - Soft PHY reset
11868cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
11878cfa0ad2SJack F Vogel *
11888cfa0ad2SJack F Vogel * Performs a soft PHY reset on those that apply. This is a function pointer
11898cfa0ad2SJack F Vogel * entry point called by drivers.
11908cfa0ad2SJack F Vogel **/
e1000_phy_commit(struct e1000_hw * hw)11918cfa0ad2SJack F Vogel s32 e1000_phy_commit(struct e1000_hw *hw)
11928cfa0ad2SJack F Vogel {
11938cfa0ad2SJack F Vogel if (hw->phy.ops.commit)
11948cfa0ad2SJack F Vogel return hw->phy.ops.commit(hw);
11958cfa0ad2SJack F Vogel
11968cfa0ad2SJack F Vogel return E1000_SUCCESS;
11978cfa0ad2SJack F Vogel }
11988cfa0ad2SJack F Vogel
11998cfa0ad2SJack F Vogel /**
12008cfa0ad2SJack F Vogel * e1000_set_d0_lplu_state - Sets low power link up state for D0
12018cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
12028cfa0ad2SJack F Vogel * @active: boolean used to enable/disable lplu
12038cfa0ad2SJack F Vogel *
12048cfa0ad2SJack F Vogel * Success returns 0, Failure returns 1
12058cfa0ad2SJack F Vogel *
12068cfa0ad2SJack F Vogel * The low power link up (lplu) state is set to the power management level D0
12071bbdc25fSKevin Bowling * and SmartSpeed is disabled when active is true, else clear lplu for D0
12088cfa0ad2SJack F Vogel * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
12098cfa0ad2SJack F Vogel * is used during Dx states where the power conservation is most important.
12108cfa0ad2SJack F Vogel * During driver activity, SmartSpeed should be enabled so performance is
12118cfa0ad2SJack F Vogel * maintained. This is a function pointer entry point called by drivers.
12128cfa0ad2SJack F Vogel **/
e1000_set_d0_lplu_state(struct e1000_hw * hw,bool active)12138cfa0ad2SJack F Vogel s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
12148cfa0ad2SJack F Vogel {
12158cfa0ad2SJack F Vogel if (hw->phy.ops.set_d0_lplu_state)
12168cfa0ad2SJack F Vogel return hw->phy.ops.set_d0_lplu_state(hw, active);
12178cfa0ad2SJack F Vogel
12188cfa0ad2SJack F Vogel return E1000_SUCCESS;
12198cfa0ad2SJack F Vogel }
12208cfa0ad2SJack F Vogel
12218cfa0ad2SJack F Vogel /**
12228cfa0ad2SJack F Vogel * e1000_set_d3_lplu_state - Sets low power link up state for D3
12238cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
12248cfa0ad2SJack F Vogel * @active: boolean used to enable/disable lplu
12258cfa0ad2SJack F Vogel *
12268cfa0ad2SJack F Vogel * Success returns 0, Failure returns 1
12278cfa0ad2SJack F Vogel *
12288cfa0ad2SJack F Vogel * The low power link up (lplu) state is set to the power management level D3
12291bbdc25fSKevin Bowling * and SmartSpeed is disabled when active is true, else clear lplu for D3
12308cfa0ad2SJack F Vogel * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
12318cfa0ad2SJack F Vogel * is used during Dx states where the power conservation is most important.
12328cfa0ad2SJack F Vogel * During driver activity, SmartSpeed should be enabled so performance is
12338cfa0ad2SJack F Vogel * maintained. This is a function pointer entry point called by drivers.
12348cfa0ad2SJack F Vogel **/
e1000_set_d3_lplu_state(struct e1000_hw * hw,bool active)12358cfa0ad2SJack F Vogel s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
12368cfa0ad2SJack F Vogel {
12378cfa0ad2SJack F Vogel if (hw->phy.ops.set_d3_lplu_state)
12388cfa0ad2SJack F Vogel return hw->phy.ops.set_d3_lplu_state(hw, active);
12398cfa0ad2SJack F Vogel
12408cfa0ad2SJack F Vogel return E1000_SUCCESS;
12418cfa0ad2SJack F Vogel }
12428cfa0ad2SJack F Vogel
12438cfa0ad2SJack F Vogel /**
12448cfa0ad2SJack F Vogel * e1000_read_mac_addr - Reads MAC address
12458cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
12468cfa0ad2SJack F Vogel *
12478cfa0ad2SJack F Vogel * Reads the MAC address out of the adapter and stores it in the HW structure.
12488cfa0ad2SJack F Vogel * Currently no func pointer exists and all implementations are handled in the
12498cfa0ad2SJack F Vogel * generic version of this function.
12508cfa0ad2SJack F Vogel **/
e1000_read_mac_addr(struct e1000_hw * hw)12518cfa0ad2SJack F Vogel s32 e1000_read_mac_addr(struct e1000_hw *hw)
12528cfa0ad2SJack F Vogel {
12538cfa0ad2SJack F Vogel if (hw->mac.ops.read_mac_addr)
12548cfa0ad2SJack F Vogel return hw->mac.ops.read_mac_addr(hw);
12558cfa0ad2SJack F Vogel
12568cfa0ad2SJack F Vogel return e1000_read_mac_addr_generic(hw);
12578cfa0ad2SJack F Vogel }
12588cfa0ad2SJack F Vogel
12598cfa0ad2SJack F Vogel /**
12607d9119bdSJack F Vogel * e1000_read_pba_string - Read device part number string
12617d9119bdSJack F Vogel * @hw: pointer to the HW structure
12627d9119bdSJack F Vogel * @pba_num: pointer to device part number
12637d9119bdSJack F Vogel * @pba_num_size: size of part number buffer
12647d9119bdSJack F Vogel *
12657d9119bdSJack F Vogel * Reads the product board assembly (PBA) number from the EEPROM and stores
12667d9119bdSJack F Vogel * the value in pba_num.
12677d9119bdSJack F Vogel * Currently no func pointer exists and all implementations are handled in the
12687d9119bdSJack F Vogel * generic version of this function.
12697d9119bdSJack F Vogel **/
e1000_read_pba_string(struct e1000_hw * hw,u8 * pba_num,u32 pba_num_size)12707d9119bdSJack F Vogel s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size)
12717d9119bdSJack F Vogel {
12727d9119bdSJack F Vogel return e1000_read_pba_string_generic(hw, pba_num, pba_num_size);
12737d9119bdSJack F Vogel }
12747d9119bdSJack F Vogel
12757d9119bdSJack F Vogel /**
12767d9119bdSJack F Vogel * e1000_read_pba_length - Read device part number string length
12777d9119bdSJack F Vogel * @hw: pointer to the HW structure
12787d9119bdSJack F Vogel * @pba_num_size: size of part number buffer
12797d9119bdSJack F Vogel *
12807d9119bdSJack F Vogel * Reads the product board assembly (PBA) number length from the EEPROM and
12817d9119bdSJack F Vogel * stores the value in pba_num.
12827d9119bdSJack F Vogel * Currently no func pointer exists and all implementations are handled in the
12837d9119bdSJack F Vogel * generic version of this function.
12847d9119bdSJack F Vogel **/
e1000_read_pba_length(struct e1000_hw * hw,u32 * pba_num_size)12857d9119bdSJack F Vogel s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size)
12867d9119bdSJack F Vogel {
12877d9119bdSJack F Vogel return e1000_read_pba_length_generic(hw, pba_num_size);
12887d9119bdSJack F Vogel }
12897d9119bdSJack F Vogel
12907d9119bdSJack F Vogel /**
1291984d1616SKevin Bowling * e1000_read_pba_num - Read device part number
1292984d1616SKevin Bowling * @hw: pointer to the HW structure
1293984d1616SKevin Bowling * @pba_num: pointer to device part number
1294984d1616SKevin Bowling *
1295984d1616SKevin Bowling * Reads the product board assembly (PBA) number from the EEPROM and stores
1296984d1616SKevin Bowling * the value in pba_num.
1297984d1616SKevin Bowling * Currently no func pointer exists and all implementations are handled in the
1298984d1616SKevin Bowling * generic version of this function.
1299984d1616SKevin Bowling **/
e1000_read_pba_num(struct e1000_hw * hw,u32 * pba_num)1300984d1616SKevin Bowling s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
1301984d1616SKevin Bowling {
1302984d1616SKevin Bowling return e1000_read_pba_num_generic(hw, pba_num);
1303984d1616SKevin Bowling }
1304984d1616SKevin Bowling
1305984d1616SKevin Bowling /**
13068cfa0ad2SJack F Vogel * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
13078cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
13088cfa0ad2SJack F Vogel *
13098cfa0ad2SJack F Vogel * Validates the NVM checksum is correct. This is a function pointer entry
13108cfa0ad2SJack F Vogel * point called by drivers.
13118cfa0ad2SJack F Vogel **/
e1000_validate_nvm_checksum(struct e1000_hw * hw)13128cfa0ad2SJack F Vogel s32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
13138cfa0ad2SJack F Vogel {
13148cfa0ad2SJack F Vogel if (hw->nvm.ops.validate)
13158cfa0ad2SJack F Vogel return hw->nvm.ops.validate(hw);
13168cfa0ad2SJack F Vogel
13178cfa0ad2SJack F Vogel return -E1000_ERR_CONFIG;
13188cfa0ad2SJack F Vogel }
13198cfa0ad2SJack F Vogel
13208cfa0ad2SJack F Vogel /**
13218cfa0ad2SJack F Vogel * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
13228cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
13238cfa0ad2SJack F Vogel *
13248cfa0ad2SJack F Vogel * Updates the NVM checksum. Currently no func pointer exists and all
13258cfa0ad2SJack F Vogel * implementations are handled in the generic version of this function.
13268cfa0ad2SJack F Vogel **/
e1000_update_nvm_checksum(struct e1000_hw * hw)13278cfa0ad2SJack F Vogel s32 e1000_update_nvm_checksum(struct e1000_hw *hw)
13288cfa0ad2SJack F Vogel {
13298cfa0ad2SJack F Vogel if (hw->nvm.ops.update)
13308cfa0ad2SJack F Vogel return hw->nvm.ops.update(hw);
13318cfa0ad2SJack F Vogel
13328cfa0ad2SJack F Vogel return -E1000_ERR_CONFIG;
13338cfa0ad2SJack F Vogel }
13348cfa0ad2SJack F Vogel
13358cfa0ad2SJack F Vogel /**
13368cfa0ad2SJack F Vogel * e1000_reload_nvm - Reloads EEPROM
13378cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
13388cfa0ad2SJack F Vogel *
13398cfa0ad2SJack F Vogel * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
13408cfa0ad2SJack F Vogel * extended control register.
13418cfa0ad2SJack F Vogel **/
e1000_reload_nvm(struct e1000_hw * hw)13428cfa0ad2SJack F Vogel void e1000_reload_nvm(struct e1000_hw *hw)
13438cfa0ad2SJack F Vogel {
13448cfa0ad2SJack F Vogel if (hw->nvm.ops.reload)
13458cfa0ad2SJack F Vogel hw->nvm.ops.reload(hw);
13468cfa0ad2SJack F Vogel }
13478cfa0ad2SJack F Vogel
13488cfa0ad2SJack F Vogel /**
13498cfa0ad2SJack F Vogel * e1000_read_nvm - Reads NVM (EEPROM)
13508cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
13518cfa0ad2SJack F Vogel * @offset: the word offset to read
13528cfa0ad2SJack F Vogel * @words: number of 16-bit words to read
13538cfa0ad2SJack F Vogel * @data: pointer to the properly sized buffer for the data.
13548cfa0ad2SJack F Vogel *
13558cfa0ad2SJack F Vogel * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
13568cfa0ad2SJack F Vogel * pointer entry point called by drivers.
13578cfa0ad2SJack F Vogel **/
e1000_read_nvm(struct e1000_hw * hw,u16 offset,u16 words,u16 * data)13588cfa0ad2SJack F Vogel s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
13598cfa0ad2SJack F Vogel {
13608cfa0ad2SJack F Vogel if (hw->nvm.ops.read)
13618cfa0ad2SJack F Vogel return hw->nvm.ops.read(hw, offset, words, data);
13628cfa0ad2SJack F Vogel
13638cfa0ad2SJack F Vogel return -E1000_ERR_CONFIG;
13648cfa0ad2SJack F Vogel }
13658cfa0ad2SJack F Vogel
13668cfa0ad2SJack F Vogel /**
13678cfa0ad2SJack F Vogel * e1000_write_nvm - Writes to NVM (EEPROM)
13688cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
13698cfa0ad2SJack F Vogel * @offset: the word offset to read
13708cfa0ad2SJack F Vogel * @words: number of 16-bit words to write
13718cfa0ad2SJack F Vogel * @data: pointer to the properly sized buffer for the data.
13728cfa0ad2SJack F Vogel *
13738cfa0ad2SJack F Vogel * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
13748cfa0ad2SJack F Vogel * pointer entry point called by drivers.
13758cfa0ad2SJack F Vogel **/
e1000_write_nvm(struct e1000_hw * hw,u16 offset,u16 words,u16 * data)13768cfa0ad2SJack F Vogel s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
13778cfa0ad2SJack F Vogel {
13788cfa0ad2SJack F Vogel if (hw->nvm.ops.write)
13798cfa0ad2SJack F Vogel return hw->nvm.ops.write(hw, offset, words, data);
13808cfa0ad2SJack F Vogel
13818cfa0ad2SJack F Vogel return E1000_SUCCESS;
13828cfa0ad2SJack F Vogel }
13838cfa0ad2SJack F Vogel
13848cfa0ad2SJack F Vogel /**
13858cfa0ad2SJack F Vogel * e1000_write_8bit_ctrl_reg - Writes 8bit Control register
13868cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
13878cfa0ad2SJack F Vogel * @reg: 32bit register offset
13888cfa0ad2SJack F Vogel * @offset: the register to write
13898cfa0ad2SJack F Vogel * @data: the value to write.
13908cfa0ad2SJack F Vogel *
13918cfa0ad2SJack F Vogel * Writes the PHY register at offset with the value in data.
13928cfa0ad2SJack F Vogel * This is a function pointer entry point called by drivers.
13938cfa0ad2SJack F Vogel **/
e1000_write_8bit_ctrl_reg(struct e1000_hw * hw,u32 reg,u32 offset,u8 data)13948cfa0ad2SJack F Vogel s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
13958cfa0ad2SJack F Vogel u8 data)
13968cfa0ad2SJack F Vogel {
13978cfa0ad2SJack F Vogel return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
13988cfa0ad2SJack F Vogel }
13998cfa0ad2SJack F Vogel
14008cfa0ad2SJack F Vogel /**
14018cfa0ad2SJack F Vogel * e1000_power_up_phy - Restores link in case of PHY power down
14028cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
14038cfa0ad2SJack F Vogel *
14048cfa0ad2SJack F Vogel * The phy may be powered down to save power, to turn off link when the
14058cfa0ad2SJack F Vogel * driver is unloaded, or wake on lan is not enabled (among others).
14068cfa0ad2SJack F Vogel **/
e1000_power_up_phy(struct e1000_hw * hw)14078cfa0ad2SJack F Vogel void e1000_power_up_phy(struct e1000_hw *hw)
14088cfa0ad2SJack F Vogel {
14098cfa0ad2SJack F Vogel if (hw->phy.ops.power_up)
14108cfa0ad2SJack F Vogel hw->phy.ops.power_up(hw);
14118cfa0ad2SJack F Vogel
14128cfa0ad2SJack F Vogel e1000_setup_link(hw);
14138cfa0ad2SJack F Vogel }
14148cfa0ad2SJack F Vogel
14158cfa0ad2SJack F Vogel /**
14168cfa0ad2SJack F Vogel * e1000_power_down_phy - Power down PHY
14178cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
14188cfa0ad2SJack F Vogel *
14198cfa0ad2SJack F Vogel * The phy may be powered down to save power, to turn off link when the
14208cfa0ad2SJack F Vogel * driver is unloaded, or wake on lan is not enabled (among others).
14218cfa0ad2SJack F Vogel **/
e1000_power_down_phy(struct e1000_hw * hw)14228cfa0ad2SJack F Vogel void e1000_power_down_phy(struct e1000_hw *hw)
14238cfa0ad2SJack F Vogel {
14248cfa0ad2SJack F Vogel if (hw->phy.ops.power_down)
14258cfa0ad2SJack F Vogel hw->phy.ops.power_down(hw);
14268cfa0ad2SJack F Vogel }
14278cfa0ad2SJack F Vogel
14288cfa0ad2SJack F Vogel /**
1429a69ed8dfSJack F Vogel * e1000_power_up_fiber_serdes_link - Power up serdes link
1430a69ed8dfSJack F Vogel * @hw: pointer to the HW structure
1431a69ed8dfSJack F Vogel *
1432a69ed8dfSJack F Vogel * Power on the optics and PCS.
1433a69ed8dfSJack F Vogel **/
e1000_power_up_fiber_serdes_link(struct e1000_hw * hw)1434a69ed8dfSJack F Vogel void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw)
1435a69ed8dfSJack F Vogel {
1436a69ed8dfSJack F Vogel if (hw->mac.ops.power_up_serdes)
1437a69ed8dfSJack F Vogel hw->mac.ops.power_up_serdes(hw);
1438a69ed8dfSJack F Vogel }
1439a69ed8dfSJack F Vogel
1440a69ed8dfSJack F Vogel /**
14418cfa0ad2SJack F Vogel * e1000_shutdown_fiber_serdes_link - Remove link during power down
14428cfa0ad2SJack F Vogel * @hw: pointer to the HW structure
14438cfa0ad2SJack F Vogel *
14448cfa0ad2SJack F Vogel * Shutdown the optics and PCS on driver unload.
14458cfa0ad2SJack F Vogel **/
e1000_shutdown_fiber_serdes_link(struct e1000_hw * hw)14468cfa0ad2SJack F Vogel void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)
14478cfa0ad2SJack F Vogel {
14488cfa0ad2SJack F Vogel if (hw->mac.ops.shutdown_serdes)
14498cfa0ad2SJack F Vogel hw->mac.ops.shutdown_serdes(hw);
14508cfa0ad2SJack F Vogel }
14518cfa0ad2SJack F Vogel
1452