19c80d176SSepherosa Ziehau /******************************************************************************
29c80d176SSepherosa Ziehau
301a55482SSepherosa Ziehau Copyright (c) 2001-2019, Intel Corporation
49c80d176SSepherosa Ziehau All rights reserved.
59c80d176SSepherosa Ziehau
69c80d176SSepherosa Ziehau Redistribution and use in source and binary forms, with or without
79c80d176SSepherosa Ziehau modification, are permitted provided that the following conditions are met:
89c80d176SSepherosa Ziehau
99c80d176SSepherosa Ziehau 1. Redistributions of source code must retain the above copyright notice,
109c80d176SSepherosa Ziehau this list of conditions and the following disclaimer.
119c80d176SSepherosa Ziehau
129c80d176SSepherosa Ziehau 2. Redistributions in binary form must reproduce the above copyright
139c80d176SSepherosa Ziehau notice, this list of conditions and the following disclaimer in the
149c80d176SSepherosa Ziehau documentation and/or other materials provided with the distribution.
159c80d176SSepherosa Ziehau
169c80d176SSepherosa Ziehau 3. Neither the name of the Intel Corporation nor the names of its
179c80d176SSepherosa Ziehau contributors may be used to endorse or promote products derived from
189c80d176SSepherosa Ziehau this software without specific prior written permission.
199c80d176SSepherosa Ziehau
209c80d176SSepherosa Ziehau THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
219c80d176SSepherosa Ziehau AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
229c80d176SSepherosa Ziehau IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
239c80d176SSepherosa Ziehau ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
249c80d176SSepherosa Ziehau LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
259c80d176SSepherosa Ziehau CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
269c80d176SSepherosa Ziehau SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
279c80d176SSepherosa Ziehau INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
289c80d176SSepherosa Ziehau CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
299c80d176SSepherosa Ziehau ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
309c80d176SSepherosa Ziehau POSSIBILITY OF SUCH DAMAGE.
319c80d176SSepherosa Ziehau
329c80d176SSepherosa Ziehau ******************************************************************************/
3374dc3754SSepherosa Ziehau /*$FreeBSD$*/
349c80d176SSepherosa Ziehau
359c80d176SSepherosa Ziehau #include "e1000_api.h"
369c80d176SSepherosa Ziehau
379c80d176SSepherosa Ziehau /**
389c80d176SSepherosa Ziehau * e1000_init_mac_params - Initialize MAC function pointers
399c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
409c80d176SSepherosa Ziehau *
419c80d176SSepherosa Ziehau * This function initializes the function pointers for the MAC
429c80d176SSepherosa Ziehau * set of functions. Called by drivers or by e1000_setup_init_funcs.
439c80d176SSepherosa Ziehau **/
e1000_init_mac_params(struct e1000_hw * hw)449c80d176SSepherosa Ziehau s32 e1000_init_mac_params(struct e1000_hw *hw)
459c80d176SSepherosa Ziehau {
469c80d176SSepherosa Ziehau s32 ret_val = E1000_SUCCESS;
479c80d176SSepherosa Ziehau
489c80d176SSepherosa Ziehau if (hw->mac.ops.init_params) {
499c80d176SSepherosa Ziehau ret_val = hw->mac.ops.init_params(hw);
509c80d176SSepherosa Ziehau if (ret_val) {
519c80d176SSepherosa Ziehau DEBUGOUT("MAC Initialization Error\n");
529c80d176SSepherosa Ziehau goto out;
539c80d176SSepherosa Ziehau }
549c80d176SSepherosa Ziehau } else {
559c80d176SSepherosa Ziehau DEBUGOUT("mac.init_mac_params was NULL\n");
569c80d176SSepherosa Ziehau ret_val = -E1000_ERR_CONFIG;
579c80d176SSepherosa Ziehau }
589c80d176SSepherosa Ziehau
599c80d176SSepherosa Ziehau out:
609c80d176SSepherosa Ziehau return ret_val;
619c80d176SSepherosa Ziehau }
629c80d176SSepherosa Ziehau
639c80d176SSepherosa Ziehau /**
649c80d176SSepherosa Ziehau * e1000_init_nvm_params - Initialize NVM function pointers
659c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
669c80d176SSepherosa Ziehau *
679c80d176SSepherosa Ziehau * This function initializes the function pointers for the NVM
689c80d176SSepherosa Ziehau * set of functions. Called by drivers or by e1000_setup_init_funcs.
699c80d176SSepherosa Ziehau **/
e1000_init_nvm_params(struct e1000_hw * hw)709c80d176SSepherosa Ziehau s32 e1000_init_nvm_params(struct e1000_hw *hw)
719c80d176SSepherosa Ziehau {
729c80d176SSepherosa Ziehau s32 ret_val = E1000_SUCCESS;
739c80d176SSepherosa Ziehau
749c80d176SSepherosa Ziehau if (hw->nvm.ops.init_params) {
759c80d176SSepherosa Ziehau ret_val = hw->nvm.ops.init_params(hw);
769c80d176SSepherosa Ziehau if (ret_val) {
779c80d176SSepherosa Ziehau DEBUGOUT("NVM Initialization Error\n");
789c80d176SSepherosa Ziehau goto out;
799c80d176SSepherosa Ziehau }
809c80d176SSepherosa Ziehau } else {
819c80d176SSepherosa Ziehau DEBUGOUT("nvm.init_nvm_params was NULL\n");
829c80d176SSepherosa Ziehau ret_val = -E1000_ERR_CONFIG;
839c80d176SSepherosa Ziehau }
849c80d176SSepherosa Ziehau
859c80d176SSepherosa Ziehau out:
869c80d176SSepherosa Ziehau return ret_val;
879c80d176SSepherosa Ziehau }
889c80d176SSepherosa Ziehau
899c80d176SSepherosa Ziehau /**
909c80d176SSepherosa Ziehau * e1000_init_phy_params - Initialize PHY function pointers
919c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
929c80d176SSepherosa Ziehau *
939c80d176SSepherosa Ziehau * This function initializes the function pointers for the PHY
949c80d176SSepherosa Ziehau * set of functions. Called by drivers or by e1000_setup_init_funcs.
959c80d176SSepherosa Ziehau **/
e1000_init_phy_params(struct e1000_hw * hw)969c80d176SSepherosa Ziehau s32 e1000_init_phy_params(struct e1000_hw *hw)
979c80d176SSepherosa Ziehau {
989c80d176SSepherosa Ziehau s32 ret_val = E1000_SUCCESS;
999c80d176SSepherosa Ziehau
1009c80d176SSepherosa Ziehau if (hw->phy.ops.init_params) {
1019c80d176SSepherosa Ziehau ret_val = hw->phy.ops.init_params(hw);
1029c80d176SSepherosa Ziehau if (ret_val) {
1039c80d176SSepherosa Ziehau DEBUGOUT("PHY Initialization Error\n");
1049c80d176SSepherosa Ziehau goto out;
1059c80d176SSepherosa Ziehau }
1069c80d176SSepherosa Ziehau } else {
1079c80d176SSepherosa Ziehau DEBUGOUT("phy.init_phy_params was NULL\n");
1089c80d176SSepherosa Ziehau ret_val = -E1000_ERR_CONFIG;
1099c80d176SSepherosa Ziehau }
1109c80d176SSepherosa Ziehau
1119c80d176SSepherosa Ziehau out:
1129c80d176SSepherosa Ziehau return ret_val;
1139c80d176SSepherosa Ziehau }
1149c80d176SSepherosa Ziehau
1159c80d176SSepherosa Ziehau /**
11662583d18SSepherosa Ziehau * e1000_init_mbx_params - Initialize mailbox function pointers
11762583d18SSepherosa Ziehau * @hw: pointer to the HW structure
11862583d18SSepherosa Ziehau *
11962583d18SSepherosa Ziehau * This function initializes the function pointers for the PHY
12062583d18SSepherosa Ziehau * set of functions. Called by drivers or by e1000_setup_init_funcs.
12162583d18SSepherosa Ziehau **/
e1000_init_mbx_params(struct e1000_hw * hw)12262583d18SSepherosa Ziehau s32 e1000_init_mbx_params(struct e1000_hw *hw)
12362583d18SSepherosa Ziehau {
12462583d18SSepherosa Ziehau s32 ret_val = E1000_SUCCESS;
12562583d18SSepherosa Ziehau
12662583d18SSepherosa Ziehau if (hw->mbx.ops.init_params) {
12762583d18SSepherosa Ziehau ret_val = hw->mbx.ops.init_params(hw);
12862583d18SSepherosa Ziehau if (ret_val) {
12962583d18SSepherosa Ziehau DEBUGOUT("Mailbox Initialization Error\n");
13062583d18SSepherosa Ziehau goto out;
13162583d18SSepherosa Ziehau }
13262583d18SSepherosa Ziehau } else {
13362583d18SSepherosa Ziehau DEBUGOUT("mbx.init_mbx_params was NULL\n");
13462583d18SSepherosa Ziehau ret_val = -E1000_ERR_CONFIG;
13562583d18SSepherosa Ziehau }
13662583d18SSepherosa Ziehau
13762583d18SSepherosa Ziehau out:
13862583d18SSepherosa Ziehau return ret_val;
13962583d18SSepherosa Ziehau }
14062583d18SSepherosa Ziehau
14162583d18SSepherosa Ziehau /**
1429c80d176SSepherosa Ziehau * e1000_set_mac_type - Sets MAC type
1439c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
1449c80d176SSepherosa Ziehau *
1459c80d176SSepherosa Ziehau * This function sets the mac type of the adapter based on the
1469c80d176SSepherosa Ziehau * device ID stored in the hw structure.
1479c80d176SSepherosa Ziehau * MUST BE FIRST FUNCTION CALLED (explicitly or through
1489c80d176SSepherosa Ziehau * e1000_setup_init_funcs()).
1499c80d176SSepherosa Ziehau **/
e1000_set_mac_type(struct e1000_hw * hw)1509c80d176SSepherosa Ziehau s32 e1000_set_mac_type(struct e1000_hw *hw)
1519c80d176SSepherosa Ziehau {
1529c80d176SSepherosa Ziehau struct e1000_mac_info *mac = &hw->mac;
1539c80d176SSepherosa Ziehau s32 ret_val = E1000_SUCCESS;
1549c80d176SSepherosa Ziehau
1559c80d176SSepherosa Ziehau DEBUGFUNC("e1000_set_mac_type");
1569c80d176SSepherosa Ziehau
1579c80d176SSepherosa Ziehau switch (hw->device_id) {
1589c80d176SSepherosa Ziehau case E1000_DEV_ID_82542:
1599c80d176SSepherosa Ziehau mac->type = e1000_82542;
1609c80d176SSepherosa Ziehau break;
1619c80d176SSepherosa Ziehau case E1000_DEV_ID_82543GC_FIBER:
1629c80d176SSepherosa Ziehau case E1000_DEV_ID_82543GC_COPPER:
1639c80d176SSepherosa Ziehau mac->type = e1000_82543;
1649c80d176SSepherosa Ziehau break;
1659c80d176SSepherosa Ziehau case E1000_DEV_ID_82544EI_COPPER:
1669c80d176SSepherosa Ziehau case E1000_DEV_ID_82544EI_FIBER:
1679c80d176SSepherosa Ziehau case E1000_DEV_ID_82544GC_COPPER:
1689c80d176SSepherosa Ziehau case E1000_DEV_ID_82544GC_LOM:
1699c80d176SSepherosa Ziehau mac->type = e1000_82544;
1709c80d176SSepherosa Ziehau break;
1719c80d176SSepherosa Ziehau case E1000_DEV_ID_82540EM:
1729c80d176SSepherosa Ziehau case E1000_DEV_ID_82540EM_LOM:
1739c80d176SSepherosa Ziehau case E1000_DEV_ID_82540EP:
1749c80d176SSepherosa Ziehau case E1000_DEV_ID_82540EP_LOM:
1759c80d176SSepherosa Ziehau case E1000_DEV_ID_82540EP_LP:
1769c80d176SSepherosa Ziehau mac->type = e1000_82540;
1779c80d176SSepherosa Ziehau break;
1789c80d176SSepherosa Ziehau case E1000_DEV_ID_82545EM_COPPER:
1799c80d176SSepherosa Ziehau case E1000_DEV_ID_82545EM_FIBER:
1809c80d176SSepherosa Ziehau mac->type = e1000_82545;
1819c80d176SSepherosa Ziehau break;
1829c80d176SSepherosa Ziehau case E1000_DEV_ID_82545GM_COPPER:
1839c80d176SSepherosa Ziehau case E1000_DEV_ID_82545GM_FIBER:
1849c80d176SSepherosa Ziehau case E1000_DEV_ID_82545GM_SERDES:
1859c80d176SSepherosa Ziehau mac->type = e1000_82545_rev_3;
1869c80d176SSepherosa Ziehau break;
1879c80d176SSepherosa Ziehau case E1000_DEV_ID_82546EB_COPPER:
1889c80d176SSepherosa Ziehau case E1000_DEV_ID_82546EB_FIBER:
1899c80d176SSepherosa Ziehau case E1000_DEV_ID_82546EB_QUAD_COPPER:
1909c80d176SSepherosa Ziehau mac->type = e1000_82546;
1919c80d176SSepherosa Ziehau break;
1929c80d176SSepherosa Ziehau case E1000_DEV_ID_82546GB_COPPER:
1939c80d176SSepherosa Ziehau case E1000_DEV_ID_82546GB_FIBER:
1949c80d176SSepherosa Ziehau case E1000_DEV_ID_82546GB_SERDES:
1959c80d176SSepherosa Ziehau case E1000_DEV_ID_82546GB_PCIE:
1969c80d176SSepherosa Ziehau case E1000_DEV_ID_82546GB_QUAD_COPPER:
1979c80d176SSepherosa Ziehau case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
1989c80d176SSepherosa Ziehau mac->type = e1000_82546_rev_3;
1999c80d176SSepherosa Ziehau break;
2009c80d176SSepherosa Ziehau case E1000_DEV_ID_82541EI:
2019c80d176SSepherosa Ziehau case E1000_DEV_ID_82541EI_MOBILE:
2029c80d176SSepherosa Ziehau case E1000_DEV_ID_82541ER_LOM:
2039c80d176SSepherosa Ziehau mac->type = e1000_82541;
2049c80d176SSepherosa Ziehau break;
2059c80d176SSepherosa Ziehau case E1000_DEV_ID_82541ER:
2069c80d176SSepherosa Ziehau case E1000_DEV_ID_82541GI:
2079c80d176SSepherosa Ziehau case E1000_DEV_ID_82541GI_LF:
2089c80d176SSepherosa Ziehau case E1000_DEV_ID_82541GI_MOBILE:
2099c80d176SSepherosa Ziehau mac->type = e1000_82541_rev_2;
2109c80d176SSepherosa Ziehau break;
2119c80d176SSepherosa Ziehau case E1000_DEV_ID_82547EI:
2129c80d176SSepherosa Ziehau case E1000_DEV_ID_82547EI_MOBILE:
2139c80d176SSepherosa Ziehau mac->type = e1000_82547;
2149c80d176SSepherosa Ziehau break;
2159c80d176SSepherosa Ziehau case E1000_DEV_ID_82547GI:
2169c80d176SSepherosa Ziehau mac->type = e1000_82547_rev_2;
2179c80d176SSepherosa Ziehau break;
2189c80d176SSepherosa Ziehau case E1000_DEV_ID_82571EB_COPPER:
2199c80d176SSepherosa Ziehau case E1000_DEV_ID_82571EB_FIBER:
2209c80d176SSepherosa Ziehau case E1000_DEV_ID_82571EB_SERDES:
2219c80d176SSepherosa Ziehau case E1000_DEV_ID_82571EB_SERDES_DUAL:
2229c80d176SSepherosa Ziehau case E1000_DEV_ID_82571EB_SERDES_QUAD:
2239c80d176SSepherosa Ziehau case E1000_DEV_ID_82571EB_QUAD_COPPER:
2249c80d176SSepherosa Ziehau case E1000_DEV_ID_82571PT_QUAD_COPPER:
2259c80d176SSepherosa Ziehau case E1000_DEV_ID_82571EB_QUAD_FIBER:
2269c80d176SSepherosa Ziehau case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
2274be59a01SSepherosa Ziehau case E1000_DEV_ID_82571EB_QUAD_COPPER_BP:
2289c80d176SSepherosa Ziehau mac->type = e1000_82571;
2299c80d176SSepherosa Ziehau break;
2309c80d176SSepherosa Ziehau case E1000_DEV_ID_82572EI:
2319c80d176SSepherosa Ziehau case E1000_DEV_ID_82572EI_COPPER:
2329c80d176SSepherosa Ziehau case E1000_DEV_ID_82572EI_FIBER:
2339c80d176SSepherosa Ziehau case E1000_DEV_ID_82572EI_SERDES:
2349c80d176SSepherosa Ziehau mac->type = e1000_82572;
2359c80d176SSepherosa Ziehau break;
2369c80d176SSepherosa Ziehau case E1000_DEV_ID_82573E:
2379c80d176SSepherosa Ziehau case E1000_DEV_ID_82573E_IAMT:
2389c80d176SSepherosa Ziehau case E1000_DEV_ID_82573L:
2399c80d176SSepherosa Ziehau mac->type = e1000_82573;
2409c80d176SSepherosa Ziehau break;
2419c80d176SSepherosa Ziehau case E1000_DEV_ID_82574L:
2426a5a645eSSepherosa Ziehau case E1000_DEV_ID_82574LA:
2439c80d176SSepherosa Ziehau mac->type = e1000_82574;
2449c80d176SSepherosa Ziehau break;
2456a5a645eSSepherosa Ziehau case E1000_DEV_ID_82583V:
2466a5a645eSSepherosa Ziehau mac->type = e1000_82583;
2476a5a645eSSepherosa Ziehau break;
2489c80d176SSepherosa Ziehau case E1000_DEV_ID_80003ES2LAN_COPPER_DPT:
2499c80d176SSepherosa Ziehau case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
2509c80d176SSepherosa Ziehau case E1000_DEV_ID_80003ES2LAN_COPPER_SPT:
2519c80d176SSepherosa Ziehau case E1000_DEV_ID_80003ES2LAN_SERDES_SPT:
2529c80d176SSepherosa Ziehau mac->type = e1000_80003es2lan;
2539c80d176SSepherosa Ziehau break;
2549c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH8_IFE:
2559c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH8_IFE_GT:
2569c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH8_IFE_G:
2579c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH8_IGP_M:
2589c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH8_IGP_M_AMT:
2599c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH8_IGP_AMT:
2609c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH8_IGP_C:
2616a5a645eSSepherosa Ziehau case E1000_DEV_ID_ICH8_82567V_3:
2629c80d176SSepherosa Ziehau mac->type = e1000_ich8lan;
2639c80d176SSepherosa Ziehau break;
2649c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH9_IFE:
2659c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH9_IFE_GT:
2669c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH9_IFE_G:
2679c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH9_IGP_M:
2689c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH9_IGP_M_AMT:
2699c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH9_IGP_M_V:
2709c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH9_IGP_AMT:
2719c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH9_BM:
2729c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH9_IGP_C:
2739c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH10_R_BM_LM:
2749c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH10_R_BM_LF:
2759c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH10_R_BM_V:
2769c80d176SSepherosa Ziehau mac->type = e1000_ich9lan;
2779c80d176SSepherosa Ziehau break;
2789c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH10_D_BM_LM:
2799c80d176SSepherosa Ziehau case E1000_DEV_ID_ICH10_D_BM_LF:
2806a5a645eSSepherosa Ziehau case E1000_DEV_ID_ICH10_D_BM_V:
2819c80d176SSepherosa Ziehau mac->type = e1000_ich10lan;
2829c80d176SSepherosa Ziehau break;
2836a5a645eSSepherosa Ziehau case E1000_DEV_ID_PCH_D_HV_DM:
2846a5a645eSSepherosa Ziehau case E1000_DEV_ID_PCH_D_HV_DC:
2856a5a645eSSepherosa Ziehau case E1000_DEV_ID_PCH_M_HV_LM:
2866a5a645eSSepherosa Ziehau case E1000_DEV_ID_PCH_M_HV_LC:
2876a5a645eSSepherosa Ziehau mac->type = e1000_pchlan;
2889c80d176SSepherosa Ziehau break;
2896a5a645eSSepherosa Ziehau case E1000_DEV_ID_PCH2_LV_LM:
2906a5a645eSSepherosa Ziehau case E1000_DEV_ID_PCH2_LV_V:
2916a5a645eSSepherosa Ziehau mac->type = e1000_pch2lan;
2929c80d176SSepherosa Ziehau break;
293379ebbe7SSepherosa Ziehau case E1000_DEV_ID_PCH_LPT_I217_LM:
294379ebbe7SSepherosa Ziehau case E1000_DEV_ID_PCH_LPT_I217_V:
295379ebbe7SSepherosa Ziehau case E1000_DEV_ID_PCH_LPTLP_I218_LM:
296379ebbe7SSepherosa Ziehau case E1000_DEV_ID_PCH_LPTLP_I218_V:
2974765c386SMichael Neumann case E1000_DEV_ID_PCH_I218_LM2:
2984765c386SMichael Neumann case E1000_DEV_ID_PCH_I218_V2:
2994765c386SMichael Neumann case E1000_DEV_ID_PCH_I218_LM3:
3004765c386SMichael Neumann case E1000_DEV_ID_PCH_I218_V3:
301379ebbe7SSepherosa Ziehau mac->type = e1000_pch_lpt;
302379ebbe7SSepherosa Ziehau break;
303524ce499SSepherosa Ziehau case E1000_DEV_ID_PCH_SPT_I219_LM:
304524ce499SSepherosa Ziehau case E1000_DEV_ID_PCH_SPT_I219_V:
305524ce499SSepherosa Ziehau case E1000_DEV_ID_PCH_SPT_I219_LM2:
306524ce499SSepherosa Ziehau case E1000_DEV_ID_PCH_SPT_I219_V2:
30774dc3754SSepherosa Ziehau case E1000_DEV_ID_PCH_LBG_I219_LM3:
30893df0798SMatthew Dillon case E1000_DEV_ID_PCH_SPT_I219_LM4:
30993df0798SMatthew Dillon case E1000_DEV_ID_PCH_SPT_I219_V4:
31093df0798SMatthew Dillon case E1000_DEV_ID_PCH_SPT_I219_LM5:
31193df0798SMatthew Dillon case E1000_DEV_ID_PCH_SPT_I219_V5:
31201a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_CMP_I219_LM12:
31301a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_CMP_I219_V12:
314524ce499SSepherosa Ziehau mac->type = e1000_pch_spt;
315524ce499SSepherosa Ziehau break;
31665aebe9fSSepherosa Ziehau case E1000_DEV_ID_PCH_CNP_I219_LM6:
31765aebe9fSSepherosa Ziehau case E1000_DEV_ID_PCH_CNP_I219_V6:
31865aebe9fSSepherosa Ziehau case E1000_DEV_ID_PCH_CNP_I219_LM7:
31965aebe9fSSepherosa Ziehau case E1000_DEV_ID_PCH_CNP_I219_V7:
32001a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_ICP_I219_LM8:
32101a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_ICP_I219_V8:
32201a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_ICP_I219_LM9:
32301a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_ICP_I219_V9:
32401a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_CMP_I219_LM10:
32501a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_CMP_I219_V10:
32601a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_CMP_I219_LM11:
32701a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_CMP_I219_V11:
32801a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_TGP_I219_LM13:
32901a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_TGP_I219_V13:
33001a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_TGP_I219_LM14:
33101a55482SSepherosa Ziehau case E1000_DEV_ID_PCH_TGP_I219_V14:
332*dd2edc49SSepherosa Ziehau case E1000_DEV_ID_PCH_TGP_I219_LM15:
333*dd2edc49SSepherosa Ziehau case E1000_DEV_ID_PCH_TGP_I219_V15:
334*dd2edc49SSepherosa Ziehau case E1000_DEV_ID_PCH_ADP_I219_LM16:
335*dd2edc49SSepherosa Ziehau case E1000_DEV_ID_PCH_ADP_I219_V16:
336*dd2edc49SSepherosa Ziehau case E1000_DEV_ID_PCH_ADP_I219_LM17:
337*dd2edc49SSepherosa Ziehau case E1000_DEV_ID_PCH_ADP_I219_V17:
338*dd2edc49SSepherosa Ziehau case E1000_DEV_ID_PCH_MTP_I219_LM18:
339*dd2edc49SSepherosa Ziehau case E1000_DEV_ID_PCH_MTP_I219_V18:
340*dd2edc49SSepherosa Ziehau case E1000_DEV_ID_PCH_MTP_I219_LM19:
341*dd2edc49SSepherosa Ziehau case E1000_DEV_ID_PCH_MTP_I219_V19:
34265aebe9fSSepherosa Ziehau mac->type = e1000_pch_cnp;
34365aebe9fSSepherosa Ziehau break;
34462583d18SSepherosa Ziehau case E1000_DEV_ID_82575EB_COPPER:
34562583d18SSepherosa Ziehau case E1000_DEV_ID_82575EB_FIBER_SERDES:
34662583d18SSepherosa Ziehau case E1000_DEV_ID_82575GB_QUAD_COPPER:
34762583d18SSepherosa Ziehau mac->type = e1000_82575;
34862583d18SSepherosa Ziehau break;
34962583d18SSepherosa Ziehau case E1000_DEV_ID_82576:
35062583d18SSepherosa Ziehau case E1000_DEV_ID_82576_FIBER:
35162583d18SSepherosa Ziehau case E1000_DEV_ID_82576_SERDES:
35262583d18SSepherosa Ziehau case E1000_DEV_ID_82576_QUAD_COPPER:
35362583d18SSepherosa Ziehau case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
35462583d18SSepherosa Ziehau case E1000_DEV_ID_82576_NS:
35562583d18SSepherosa Ziehau case E1000_DEV_ID_82576_NS_SERDES:
35662583d18SSepherosa Ziehau case E1000_DEV_ID_82576_SERDES_QUAD:
35762583d18SSepherosa Ziehau mac->type = e1000_82576;
35862583d18SSepherosa Ziehau break;
35962583d18SSepherosa Ziehau case E1000_DEV_ID_82580_COPPER:
36062583d18SSepherosa Ziehau case E1000_DEV_ID_82580_FIBER:
36162583d18SSepherosa Ziehau case E1000_DEV_ID_82580_SERDES:
36262583d18SSepherosa Ziehau case E1000_DEV_ID_82580_SGMII:
36362583d18SSepherosa Ziehau case E1000_DEV_ID_82580_COPPER_DUAL:
36462583d18SSepherosa Ziehau case E1000_DEV_ID_82580_QUAD_FIBER:
36562583d18SSepherosa Ziehau case E1000_DEV_ID_DH89XXCC_SGMII:
36662583d18SSepherosa Ziehau case E1000_DEV_ID_DH89XXCC_SERDES:
36762583d18SSepherosa Ziehau case E1000_DEV_ID_DH89XXCC_BACKPLANE:
36862583d18SSepherosa Ziehau case E1000_DEV_ID_DH89XXCC_SFP:
36962583d18SSepherosa Ziehau mac->type = e1000_82580;
37062583d18SSepherosa Ziehau break;
37162583d18SSepherosa Ziehau case E1000_DEV_ID_I350_COPPER:
37262583d18SSepherosa Ziehau case E1000_DEV_ID_I350_FIBER:
37362583d18SSepherosa Ziehau case E1000_DEV_ID_I350_SERDES:
37462583d18SSepherosa Ziehau case E1000_DEV_ID_I350_SGMII:
37562583d18SSepherosa Ziehau case E1000_DEV_ID_I350_DA4:
37662583d18SSepherosa Ziehau mac->type = e1000_i350;
37762583d18SSepherosa Ziehau break;
378379ebbe7SSepherosa Ziehau case E1000_DEV_ID_I210_COPPER_FLASHLESS:
379379ebbe7SSepherosa Ziehau case E1000_DEV_ID_I210_SERDES_FLASHLESS:
3804be59a01SSepherosa Ziehau case E1000_DEV_ID_I210_COPPER:
3814be59a01SSepherosa Ziehau case E1000_DEV_ID_I210_COPPER_OEM1:
3824be59a01SSepherosa Ziehau case E1000_DEV_ID_I210_COPPER_IT:
3834be59a01SSepherosa Ziehau case E1000_DEV_ID_I210_FIBER:
3844be59a01SSepherosa Ziehau case E1000_DEV_ID_I210_SERDES:
3854be59a01SSepherosa Ziehau case E1000_DEV_ID_I210_SGMII:
3864be59a01SSepherosa Ziehau mac->type = e1000_i210;
3874be59a01SSepherosa Ziehau break;
3884be59a01SSepherosa Ziehau case E1000_DEV_ID_I211_COPPER:
3894be59a01SSepherosa Ziehau mac->type = e1000_i211;
3904be59a01SSepherosa Ziehau break;
39162583d18SSepherosa Ziehau case E1000_DEV_ID_82576_VF:
392379ebbe7SSepherosa Ziehau case E1000_DEV_ID_82576_VF_HV:
39362583d18SSepherosa Ziehau mac->type = e1000_vfadapt;
39462583d18SSepherosa Ziehau break;
39562583d18SSepherosa Ziehau case E1000_DEV_ID_I350_VF:
396379ebbe7SSepherosa Ziehau case E1000_DEV_ID_I350_VF_HV:
39762583d18SSepherosa Ziehau mac->type = e1000_vfadapt_i350;
39862583d18SSepherosa Ziehau break;
3994be59a01SSepherosa Ziehau
400379ebbe7SSepherosa Ziehau case E1000_DEV_ID_I354_BACKPLANE_1GBPS:
401379ebbe7SSepherosa Ziehau case E1000_DEV_ID_I354_SGMII:
402ba0123e0SSepherosa Ziehau case E1000_DEV_ID_I354_BACKPLANE_2_5GBPS:
403379ebbe7SSepherosa Ziehau mac->type = e1000_i354;
404379ebbe7SSepherosa Ziehau break;
4059c80d176SSepherosa Ziehau default:
4069c80d176SSepherosa Ziehau /* Should never have loaded on this device */
4079c80d176SSepherosa Ziehau ret_val = -E1000_ERR_MAC_INIT;
4089c80d176SSepherosa Ziehau break;
4099c80d176SSepherosa Ziehau }
4109c80d176SSepherosa Ziehau
4119c80d176SSepherosa Ziehau return ret_val;
4129c80d176SSepherosa Ziehau }
4139c80d176SSepherosa Ziehau
4149c80d176SSepherosa Ziehau /**
4159c80d176SSepherosa Ziehau * e1000_setup_init_funcs - Initializes function pointers
4169c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
4179c80d176SSepherosa Ziehau * @init_device: TRUE will initialize the rest of the function pointers
4189c80d176SSepherosa Ziehau * getting the device ready for use. FALSE will only set
4199c80d176SSepherosa Ziehau * MAC type and the function pointers for the other init
4209c80d176SSepherosa Ziehau * functions. Passing FALSE will not generate any hardware
4219c80d176SSepherosa Ziehau * reads or writes.
4229c80d176SSepherosa Ziehau *
4239c80d176SSepherosa Ziehau * This function must be called by a driver in order to use the rest
4249c80d176SSepherosa Ziehau * of the 'shared' code files. Called by drivers only.
4259c80d176SSepherosa Ziehau **/
e1000_setup_init_funcs(struct e1000_hw * hw,bool init_device)4269c80d176SSepherosa Ziehau s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
4279c80d176SSepherosa Ziehau {
4289c80d176SSepherosa Ziehau s32 ret_val;
4299c80d176SSepherosa Ziehau
4309c80d176SSepherosa Ziehau /* Can't do much good without knowing the MAC type. */
4319c80d176SSepherosa Ziehau ret_val = e1000_set_mac_type(hw);
4329c80d176SSepherosa Ziehau if (ret_val) {
4339c80d176SSepherosa Ziehau DEBUGOUT("ERROR: MAC type could not be set properly.\n");
4349c80d176SSepherosa Ziehau goto out;
4359c80d176SSepherosa Ziehau }
4369c80d176SSepherosa Ziehau
4379c80d176SSepherosa Ziehau if (!hw->hw_addr) {
4389c80d176SSepherosa Ziehau DEBUGOUT("ERROR: Registers not mapped\n");
4399c80d176SSepherosa Ziehau ret_val = -E1000_ERR_CONFIG;
4409c80d176SSepherosa Ziehau goto out;
4419c80d176SSepherosa Ziehau }
4429c80d176SSepherosa Ziehau
4439c80d176SSepherosa Ziehau /*
4449c80d176SSepherosa Ziehau * Init function pointers to generic implementations. We do this first
4459c80d176SSepherosa Ziehau * allowing a driver module to override it afterward.
4469c80d176SSepherosa Ziehau */
4479c80d176SSepherosa Ziehau e1000_init_mac_ops_generic(hw);
4489c80d176SSepherosa Ziehau e1000_init_phy_ops_generic(hw);
4499c80d176SSepherosa Ziehau e1000_init_nvm_ops_generic(hw);
45062583d18SSepherosa Ziehau e1000_init_mbx_ops_generic(hw);
4519c80d176SSepherosa Ziehau
4529c80d176SSepherosa Ziehau /*
4539c80d176SSepherosa Ziehau * Set up the init function pointers. These are functions within the
4549c80d176SSepherosa Ziehau * adapter family file that sets up function pointers for the rest of
4559c80d176SSepherosa Ziehau * the functions in that family.
4569c80d176SSepherosa Ziehau */
4579c80d176SSepherosa Ziehau switch (hw->mac.type) {
4589c80d176SSepherosa Ziehau case e1000_82542:
4599c80d176SSepherosa Ziehau e1000_init_function_pointers_82542(hw);
4609c80d176SSepherosa Ziehau break;
4619c80d176SSepherosa Ziehau case e1000_82543:
4629c80d176SSepherosa Ziehau case e1000_82544:
4639c80d176SSepherosa Ziehau e1000_init_function_pointers_82543(hw);
4649c80d176SSepherosa Ziehau break;
4659c80d176SSepherosa Ziehau case e1000_82540:
4669c80d176SSepherosa Ziehau case e1000_82545:
4679c80d176SSepherosa Ziehau case e1000_82545_rev_3:
4689c80d176SSepherosa Ziehau case e1000_82546:
4699c80d176SSepherosa Ziehau case e1000_82546_rev_3:
4709c80d176SSepherosa Ziehau e1000_init_function_pointers_82540(hw);
4719c80d176SSepherosa Ziehau break;
4729c80d176SSepherosa Ziehau case e1000_82541:
4739c80d176SSepherosa Ziehau case e1000_82541_rev_2:
4749c80d176SSepherosa Ziehau case e1000_82547:
4759c80d176SSepherosa Ziehau case e1000_82547_rev_2:
4769c80d176SSepherosa Ziehau e1000_init_function_pointers_82541(hw);
4779c80d176SSepherosa Ziehau break;
4789c80d176SSepherosa Ziehau case e1000_82571:
4799c80d176SSepherosa Ziehau case e1000_82572:
4809c80d176SSepherosa Ziehau case e1000_82573:
4819c80d176SSepherosa Ziehau case e1000_82574:
4826a5a645eSSepherosa Ziehau case e1000_82583:
4839c80d176SSepherosa Ziehau e1000_init_function_pointers_82571(hw);
4849c80d176SSepherosa Ziehau break;
4859c80d176SSepherosa Ziehau case e1000_80003es2lan:
4869c80d176SSepherosa Ziehau e1000_init_function_pointers_80003es2lan(hw);
4879c80d176SSepherosa Ziehau break;
4889c80d176SSepherosa Ziehau case e1000_ich8lan:
4899c80d176SSepherosa Ziehau case e1000_ich9lan:
4909c80d176SSepherosa Ziehau case e1000_ich10lan:
4916a5a645eSSepherosa Ziehau case e1000_pchlan:
4926a5a645eSSepherosa Ziehau case e1000_pch2lan:
493379ebbe7SSepherosa Ziehau case e1000_pch_lpt:
494524ce499SSepherosa Ziehau case e1000_pch_spt:
49565aebe9fSSepherosa Ziehau case e1000_pch_cnp:
49601a55482SSepherosa Ziehau /* fall-through */
4979c80d176SSepherosa Ziehau e1000_init_function_pointers_ich8lan(hw);
4989c80d176SSepherosa Ziehau break;
49962583d18SSepherosa Ziehau case e1000_82575:
50062583d18SSepherosa Ziehau case e1000_82576:
50162583d18SSepherosa Ziehau case e1000_82580:
50262583d18SSepherosa Ziehau case e1000_i350:
503379ebbe7SSepherosa Ziehau case e1000_i354:
50462583d18SSepherosa Ziehau e1000_init_function_pointers_82575(hw);
50562583d18SSepherosa Ziehau break;
5064be59a01SSepherosa Ziehau case e1000_i210:
5074be59a01SSepherosa Ziehau case e1000_i211:
5084be59a01SSepherosa Ziehau e1000_init_function_pointers_i210(hw);
5094be59a01SSepherosa Ziehau break;
51062583d18SSepherosa Ziehau case e1000_vfadapt:
51162583d18SSepherosa Ziehau e1000_init_function_pointers_vf(hw);
51262583d18SSepherosa Ziehau break;
51362583d18SSepherosa Ziehau case e1000_vfadapt_i350:
51462583d18SSepherosa Ziehau e1000_init_function_pointers_vf(hw);
51562583d18SSepherosa Ziehau break;
5169c80d176SSepherosa Ziehau default:
5179c80d176SSepherosa Ziehau DEBUGOUT("Hardware not supported\n");
5189c80d176SSepherosa Ziehau ret_val = -E1000_ERR_CONFIG;
5199c80d176SSepherosa Ziehau break;
5209c80d176SSepherosa Ziehau }
5219c80d176SSepherosa Ziehau
5229c80d176SSepherosa Ziehau /*
5239c80d176SSepherosa Ziehau * Initialize the rest of the function pointers. These require some
5249c80d176SSepherosa Ziehau * register reads/writes in some cases.
5259c80d176SSepherosa Ziehau */
5269c80d176SSepherosa Ziehau if (!(ret_val) && init_device) {
5279c80d176SSepherosa Ziehau ret_val = e1000_init_mac_params(hw);
5289c80d176SSepherosa Ziehau if (ret_val)
5299c80d176SSepherosa Ziehau goto out;
5309c80d176SSepherosa Ziehau
5319c80d176SSepherosa Ziehau ret_val = e1000_init_nvm_params(hw);
5329c80d176SSepherosa Ziehau if (ret_val)
5339c80d176SSepherosa Ziehau goto out;
5349c80d176SSepherosa Ziehau
5359c80d176SSepherosa Ziehau ret_val = e1000_init_phy_params(hw);
5369c80d176SSepherosa Ziehau if (ret_val)
5379c80d176SSepherosa Ziehau goto out;
53862583d18SSepherosa Ziehau
53962583d18SSepherosa Ziehau ret_val = e1000_init_mbx_params(hw);
54062583d18SSepherosa Ziehau if (ret_val)
54162583d18SSepherosa Ziehau goto out;
5429c80d176SSepherosa Ziehau }
5439c80d176SSepherosa Ziehau
5449c80d176SSepherosa Ziehau out:
5459c80d176SSepherosa Ziehau return ret_val;
5469c80d176SSepherosa Ziehau }
5479c80d176SSepherosa Ziehau
5489c80d176SSepherosa Ziehau /**
5499c80d176SSepherosa Ziehau * e1000_get_bus_info - Obtain bus information for adapter
5509c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
5519c80d176SSepherosa Ziehau *
5529c80d176SSepherosa Ziehau * This will obtain information about the HW bus for which the
5539c80d176SSepherosa Ziehau * adapter is attached and stores it in the hw structure. This is a
5549c80d176SSepherosa Ziehau * function pointer entry point called by drivers.
5559c80d176SSepherosa Ziehau **/
e1000_get_bus_info(struct e1000_hw * hw)5569c80d176SSepherosa Ziehau s32 e1000_get_bus_info(struct e1000_hw *hw)
5579c80d176SSepherosa Ziehau {
5589c80d176SSepherosa Ziehau if (hw->mac.ops.get_bus_info)
5599c80d176SSepherosa Ziehau return hw->mac.ops.get_bus_info(hw);
5609c80d176SSepherosa Ziehau
5619c80d176SSepherosa Ziehau return E1000_SUCCESS;
5629c80d176SSepherosa Ziehau }
5639c80d176SSepherosa Ziehau
5649c80d176SSepherosa Ziehau /**
5659c80d176SSepherosa Ziehau * e1000_clear_vfta - Clear VLAN filter table
5669c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
5679c80d176SSepherosa Ziehau *
5689c80d176SSepherosa Ziehau * This clears the VLAN filter table on the adapter. This is a function
5699c80d176SSepherosa Ziehau * pointer entry point called by drivers.
5709c80d176SSepherosa Ziehau **/
e1000_clear_vfta(struct e1000_hw * hw)5719c80d176SSepherosa Ziehau void e1000_clear_vfta(struct e1000_hw *hw)
5729c80d176SSepherosa Ziehau {
5739c80d176SSepherosa Ziehau if (hw->mac.ops.clear_vfta)
5749c80d176SSepherosa Ziehau hw->mac.ops.clear_vfta(hw);
5759c80d176SSepherosa Ziehau }
5769c80d176SSepherosa Ziehau
5779c80d176SSepherosa Ziehau /**
5789c80d176SSepherosa Ziehau * e1000_write_vfta - Write value to VLAN filter table
5799c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
5809c80d176SSepherosa Ziehau * @offset: the 32-bit offset in which to write the value to.
5819c80d176SSepherosa Ziehau * @value: the 32-bit value to write at location offset.
5829c80d176SSepherosa Ziehau *
5839c80d176SSepherosa Ziehau * This writes a 32-bit value to a 32-bit offset in the VLAN filter
5849c80d176SSepherosa Ziehau * table. This is a function pointer entry point called by drivers.
5859c80d176SSepherosa Ziehau **/
e1000_write_vfta(struct e1000_hw * hw,u32 offset,u32 value)5869c80d176SSepherosa Ziehau void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
5879c80d176SSepherosa Ziehau {
5889c80d176SSepherosa Ziehau if (hw->mac.ops.write_vfta)
5899c80d176SSepherosa Ziehau hw->mac.ops.write_vfta(hw, offset, value);
5909c80d176SSepherosa Ziehau }
5919c80d176SSepherosa Ziehau
5929c80d176SSepherosa Ziehau /**
5939c80d176SSepherosa Ziehau * e1000_update_mc_addr_list - Update Multicast addresses
5949c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
5959c80d176SSepherosa Ziehau * @mc_addr_list: array of multicast addresses to program
5969c80d176SSepherosa Ziehau * @mc_addr_count: number of multicast addresses to program
5979c80d176SSepherosa Ziehau *
5986a5a645eSSepherosa Ziehau * Updates the Multicast Table Array.
5999c80d176SSepherosa Ziehau * The caller must have a packed mc_addr_list of multicast addresses.
6009c80d176SSepherosa Ziehau **/
e1000_update_mc_addr_list(struct e1000_hw * hw,u8 * mc_addr_list,u32 mc_addr_count)6019c80d176SSepherosa Ziehau void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
6026a5a645eSSepherosa Ziehau u32 mc_addr_count)
6039c80d176SSepherosa Ziehau {
6049c80d176SSepherosa Ziehau if (hw->mac.ops.update_mc_addr_list)
6056a5a645eSSepherosa Ziehau hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
6066a5a645eSSepherosa Ziehau mc_addr_count);
6079c80d176SSepherosa Ziehau }
6089c80d176SSepherosa Ziehau
6099c80d176SSepherosa Ziehau /**
6109c80d176SSepherosa Ziehau * e1000_force_mac_fc - Force MAC flow control
6119c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
6129c80d176SSepherosa Ziehau *
6139c80d176SSepherosa Ziehau * Force the MAC's flow control settings. Currently no func pointer exists
6149c80d176SSepherosa Ziehau * and all implementations are handled in the generic version of this
6159c80d176SSepherosa Ziehau * function.
6169c80d176SSepherosa Ziehau **/
e1000_force_mac_fc(struct e1000_hw * hw)6179c80d176SSepherosa Ziehau s32 e1000_force_mac_fc(struct e1000_hw *hw)
6189c80d176SSepherosa Ziehau {
6199c80d176SSepherosa Ziehau return e1000_force_mac_fc_generic(hw);
6209c80d176SSepherosa Ziehau }
6219c80d176SSepherosa Ziehau
6229c80d176SSepherosa Ziehau /**
6239c80d176SSepherosa Ziehau * e1000_check_for_link - Check/Store link connection
6249c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
6259c80d176SSepherosa Ziehau *
6269c80d176SSepherosa Ziehau * This checks the link condition of the adapter and stores the
6279c80d176SSepherosa Ziehau * results in the hw->mac structure. This is a function pointer entry
6289c80d176SSepherosa Ziehau * point called by drivers.
6299c80d176SSepherosa Ziehau **/
e1000_check_for_link(struct e1000_hw * hw)6309c80d176SSepherosa Ziehau s32 e1000_check_for_link(struct e1000_hw *hw)
6319c80d176SSepherosa Ziehau {
6329c80d176SSepherosa Ziehau if (hw->mac.ops.check_for_link)
6339c80d176SSepherosa Ziehau return hw->mac.ops.check_for_link(hw);
6349c80d176SSepherosa Ziehau
6359c80d176SSepherosa Ziehau return -E1000_ERR_CONFIG;
6369c80d176SSepherosa Ziehau }
6379c80d176SSepherosa Ziehau
6389c80d176SSepherosa Ziehau /**
6399c80d176SSepherosa Ziehau * e1000_check_mng_mode - Check management mode
6409c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
6419c80d176SSepherosa Ziehau *
6429c80d176SSepherosa Ziehau * This checks if the adapter has manageability enabled.
6439c80d176SSepherosa Ziehau * This is a function pointer entry point called by drivers.
6449c80d176SSepherosa Ziehau **/
e1000_check_mng_mode(struct e1000_hw * hw)6459c80d176SSepherosa Ziehau bool e1000_check_mng_mode(struct e1000_hw *hw)
6469c80d176SSepherosa Ziehau {
6479c80d176SSepherosa Ziehau if (hw->mac.ops.check_mng_mode)
6489c80d176SSepherosa Ziehau return hw->mac.ops.check_mng_mode(hw);
6499c80d176SSepherosa Ziehau
6509c80d176SSepherosa Ziehau return FALSE;
6519c80d176SSepherosa Ziehau }
6529c80d176SSepherosa Ziehau
6539c80d176SSepherosa Ziehau /**
6549c80d176SSepherosa Ziehau * e1000_mng_write_dhcp_info - Writes DHCP info to host interface
6559c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
6569c80d176SSepherosa Ziehau * @buffer: pointer to the host interface
6579c80d176SSepherosa Ziehau * @length: size of the buffer
6589c80d176SSepherosa Ziehau *
6599c80d176SSepherosa Ziehau * Writes the DHCP information to the host interface.
6609c80d176SSepherosa Ziehau **/
e1000_mng_write_dhcp_info(struct e1000_hw * hw,u8 * buffer,u16 length)6619c80d176SSepherosa Ziehau s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
6629c80d176SSepherosa Ziehau {
6639c80d176SSepherosa Ziehau return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
6649c80d176SSepherosa Ziehau }
6659c80d176SSepherosa Ziehau
6669c80d176SSepherosa Ziehau /**
6679c80d176SSepherosa Ziehau * e1000_reset_hw - Reset hardware
6689c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
6699c80d176SSepherosa Ziehau *
6709c80d176SSepherosa Ziehau * This resets the hardware into a known state. This is a function pointer
6719c80d176SSepherosa Ziehau * entry point called by drivers.
6729c80d176SSepherosa Ziehau **/
e1000_reset_hw(struct e1000_hw * hw)6739c80d176SSepherosa Ziehau s32 e1000_reset_hw(struct e1000_hw *hw)
6749c80d176SSepherosa Ziehau {
6759c80d176SSepherosa Ziehau if (hw->mac.ops.reset_hw)
6769c80d176SSepherosa Ziehau return hw->mac.ops.reset_hw(hw);
6779c80d176SSepherosa Ziehau
6789c80d176SSepherosa Ziehau return -E1000_ERR_CONFIG;
6799c80d176SSepherosa Ziehau }
6809c80d176SSepherosa Ziehau
6819c80d176SSepherosa Ziehau /**
6829c80d176SSepherosa Ziehau * e1000_init_hw - Initialize hardware
6839c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
6849c80d176SSepherosa Ziehau *
6859c80d176SSepherosa Ziehau * This inits the hardware readying it for operation. This is a function
6869c80d176SSepherosa Ziehau * pointer entry point called by drivers.
6879c80d176SSepherosa Ziehau **/
e1000_init_hw(struct e1000_hw * hw)6889c80d176SSepherosa Ziehau s32 e1000_init_hw(struct e1000_hw *hw)
6899c80d176SSepherosa Ziehau {
6909c80d176SSepherosa Ziehau if (hw->mac.ops.init_hw)
6919c80d176SSepherosa Ziehau return hw->mac.ops.init_hw(hw);
6929c80d176SSepherosa Ziehau
6939c80d176SSepherosa Ziehau return -E1000_ERR_CONFIG;
6949c80d176SSepherosa Ziehau }
6959c80d176SSepherosa Ziehau
6969c80d176SSepherosa Ziehau /**
6979c80d176SSepherosa Ziehau * e1000_setup_link - Configures link and flow control
6989c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
6999c80d176SSepherosa Ziehau *
7009c80d176SSepherosa Ziehau * This configures link and flow control settings for the adapter. This
7019c80d176SSepherosa Ziehau * is a function pointer entry point called by drivers. While modules can
7029c80d176SSepherosa Ziehau * also call this, they probably call their own version of this function.
7039c80d176SSepherosa Ziehau **/
e1000_setup_link(struct e1000_hw * hw)7049c80d176SSepherosa Ziehau s32 e1000_setup_link(struct e1000_hw *hw)
7059c80d176SSepherosa Ziehau {
7069c80d176SSepherosa Ziehau if (hw->mac.ops.setup_link)
7079c80d176SSepherosa Ziehau return hw->mac.ops.setup_link(hw);
7089c80d176SSepherosa Ziehau
7099c80d176SSepherosa Ziehau return -E1000_ERR_CONFIG;
7109c80d176SSepherosa Ziehau }
7119c80d176SSepherosa Ziehau
7129c80d176SSepherosa Ziehau /**
7139c80d176SSepherosa Ziehau * e1000_get_speed_and_duplex - Returns current speed and duplex
7149c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
7159c80d176SSepherosa Ziehau * @speed: pointer to a 16-bit value to store the speed
7169c80d176SSepherosa Ziehau * @duplex: pointer to a 16-bit value to store the duplex.
7179c80d176SSepherosa Ziehau *
7189c80d176SSepherosa Ziehau * This returns the speed and duplex of the adapter in the two 'out'
7199c80d176SSepherosa Ziehau * variables passed in. This is a function pointer entry point called
7209c80d176SSepherosa Ziehau * by drivers.
7219c80d176SSepherosa Ziehau **/
e1000_get_speed_and_duplex(struct e1000_hw * hw,u16 * speed,u16 * duplex)7229c80d176SSepherosa Ziehau s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
7239c80d176SSepherosa Ziehau {
7249c80d176SSepherosa Ziehau if (hw->mac.ops.get_link_up_info)
7259c80d176SSepherosa Ziehau return hw->mac.ops.get_link_up_info(hw, speed, duplex);
7269c80d176SSepherosa Ziehau
7279c80d176SSepherosa Ziehau return -E1000_ERR_CONFIG;
7289c80d176SSepherosa Ziehau }
7299c80d176SSepherosa Ziehau
7309c80d176SSepherosa Ziehau /**
7319c80d176SSepherosa Ziehau * e1000_setup_led - Configures SW controllable LED
7329c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
7339c80d176SSepherosa Ziehau *
7349c80d176SSepherosa Ziehau * This prepares the SW controllable LED for use and saves the current state
7359c80d176SSepherosa Ziehau * of the LED so it can be later restored. This is a function pointer entry
7369c80d176SSepherosa Ziehau * point called by drivers.
7379c80d176SSepherosa Ziehau **/
e1000_setup_led(struct e1000_hw * hw)7389c80d176SSepherosa Ziehau s32 e1000_setup_led(struct e1000_hw *hw)
7399c80d176SSepherosa Ziehau {
7409c80d176SSepherosa Ziehau if (hw->mac.ops.setup_led)
7419c80d176SSepherosa Ziehau return hw->mac.ops.setup_led(hw);
7429c80d176SSepherosa Ziehau
7439c80d176SSepherosa Ziehau return E1000_SUCCESS;
7449c80d176SSepherosa Ziehau }
7459c80d176SSepherosa Ziehau
7469c80d176SSepherosa Ziehau /**
7479c80d176SSepherosa Ziehau * e1000_cleanup_led - Restores SW controllable LED
7489c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
7499c80d176SSepherosa Ziehau *
7509c80d176SSepherosa Ziehau * This restores the SW controllable LED to the value saved off by
7519c80d176SSepherosa Ziehau * e1000_setup_led. This is a function pointer entry point called by drivers.
7529c80d176SSepherosa Ziehau **/
e1000_cleanup_led(struct e1000_hw * hw)7539c80d176SSepherosa Ziehau s32 e1000_cleanup_led(struct e1000_hw *hw)
7549c80d176SSepherosa Ziehau {
7559c80d176SSepherosa Ziehau if (hw->mac.ops.cleanup_led)
7569c80d176SSepherosa Ziehau return hw->mac.ops.cleanup_led(hw);
7579c80d176SSepherosa Ziehau
7589c80d176SSepherosa Ziehau return E1000_SUCCESS;
7599c80d176SSepherosa Ziehau }
7609c80d176SSepherosa Ziehau
7619c80d176SSepherosa Ziehau /**
7629c80d176SSepherosa Ziehau * e1000_blink_led - Blink SW controllable LED
7639c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
7649c80d176SSepherosa Ziehau *
7659c80d176SSepherosa Ziehau * This starts the adapter LED blinking. Request the LED to be setup first
7669c80d176SSepherosa Ziehau * and cleaned up after. This is a function pointer entry point called by
7679c80d176SSepherosa Ziehau * drivers.
7689c80d176SSepherosa Ziehau **/
e1000_blink_led(struct e1000_hw * hw)7699c80d176SSepherosa Ziehau s32 e1000_blink_led(struct e1000_hw *hw)
7709c80d176SSepherosa Ziehau {
7719c80d176SSepherosa Ziehau if (hw->mac.ops.blink_led)
7729c80d176SSepherosa Ziehau return hw->mac.ops.blink_led(hw);
7739c80d176SSepherosa Ziehau
7749c80d176SSepherosa Ziehau return E1000_SUCCESS;
7759c80d176SSepherosa Ziehau }
7769c80d176SSepherosa Ziehau
7779c80d176SSepherosa Ziehau /**
7786a5a645eSSepherosa Ziehau * e1000_id_led_init - store LED configurations in SW
7796a5a645eSSepherosa Ziehau * @hw: pointer to the HW structure
7806a5a645eSSepherosa Ziehau *
7816a5a645eSSepherosa Ziehau * Initializes the LED config in SW. This is a function pointer entry point
7826a5a645eSSepherosa Ziehau * called by drivers.
7836a5a645eSSepherosa Ziehau **/
e1000_id_led_init(struct e1000_hw * hw)7846a5a645eSSepherosa Ziehau s32 e1000_id_led_init(struct e1000_hw *hw)
7856a5a645eSSepherosa Ziehau {
7866a5a645eSSepherosa Ziehau if (hw->mac.ops.id_led_init)
7876a5a645eSSepherosa Ziehau return hw->mac.ops.id_led_init(hw);
7886a5a645eSSepherosa Ziehau
7896a5a645eSSepherosa Ziehau return E1000_SUCCESS;
7906a5a645eSSepherosa Ziehau }
7916a5a645eSSepherosa Ziehau
7926a5a645eSSepherosa Ziehau /**
7939c80d176SSepherosa Ziehau * e1000_led_on - Turn on SW controllable LED
7949c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
7959c80d176SSepherosa Ziehau *
7969c80d176SSepherosa Ziehau * Turns the SW defined LED on. This is a function pointer entry point
7979c80d176SSepherosa Ziehau * called by drivers.
7989c80d176SSepherosa Ziehau **/
e1000_led_on(struct e1000_hw * hw)7999c80d176SSepherosa Ziehau s32 e1000_led_on(struct e1000_hw *hw)
8009c80d176SSepherosa Ziehau {
8019c80d176SSepherosa Ziehau if (hw->mac.ops.led_on)
8029c80d176SSepherosa Ziehau return hw->mac.ops.led_on(hw);
8039c80d176SSepherosa Ziehau
8049c80d176SSepherosa Ziehau return E1000_SUCCESS;
8059c80d176SSepherosa Ziehau }
8069c80d176SSepherosa Ziehau
8079c80d176SSepherosa Ziehau /**
8089c80d176SSepherosa Ziehau * e1000_led_off - Turn off SW controllable LED
8099c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
8109c80d176SSepherosa Ziehau *
8119c80d176SSepherosa Ziehau * Turns the SW defined LED off. This is a function pointer entry point
8129c80d176SSepherosa Ziehau * called by drivers.
8139c80d176SSepherosa Ziehau **/
e1000_led_off(struct e1000_hw * hw)8149c80d176SSepherosa Ziehau s32 e1000_led_off(struct e1000_hw *hw)
8159c80d176SSepherosa Ziehau {
8169c80d176SSepherosa Ziehau if (hw->mac.ops.led_off)
8179c80d176SSepherosa Ziehau return hw->mac.ops.led_off(hw);
8189c80d176SSepherosa Ziehau
8199c80d176SSepherosa Ziehau return E1000_SUCCESS;
8209c80d176SSepherosa Ziehau }
8219c80d176SSepherosa Ziehau
8229c80d176SSepherosa Ziehau /**
8239c80d176SSepherosa Ziehau * e1000_reset_adaptive - Reset adaptive IFS
8249c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
8259c80d176SSepherosa Ziehau *
8269c80d176SSepherosa Ziehau * Resets the adaptive IFS. Currently no func pointer exists and all
8279c80d176SSepherosa Ziehau * implementations are handled in the generic version of this function.
8289c80d176SSepherosa Ziehau **/
e1000_reset_adaptive(struct e1000_hw * hw)8299c80d176SSepherosa Ziehau void e1000_reset_adaptive(struct e1000_hw *hw)
8309c80d176SSepherosa Ziehau {
8319c80d176SSepherosa Ziehau e1000_reset_adaptive_generic(hw);
8329c80d176SSepherosa Ziehau }
8339c80d176SSepherosa Ziehau
8349c80d176SSepherosa Ziehau /**
8359c80d176SSepherosa Ziehau * e1000_update_adaptive - Update adaptive IFS
8369c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
8379c80d176SSepherosa Ziehau *
8389c80d176SSepherosa Ziehau * Updates adapter IFS. Currently no func pointer exists and all
8399c80d176SSepherosa Ziehau * implementations are handled in the generic version of this function.
8409c80d176SSepherosa Ziehau **/
e1000_update_adaptive(struct e1000_hw * hw)8419c80d176SSepherosa Ziehau void e1000_update_adaptive(struct e1000_hw *hw)
8429c80d176SSepherosa Ziehau {
8439c80d176SSepherosa Ziehau e1000_update_adaptive_generic(hw);
8449c80d176SSepherosa Ziehau }
8459c80d176SSepherosa Ziehau
8469c80d176SSepherosa Ziehau /**
8479c80d176SSepherosa Ziehau * e1000_disable_pcie_master - Disable PCI-Express master access
8489c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
8499c80d176SSepherosa Ziehau *
8509c80d176SSepherosa Ziehau * Disables PCI-Express master access and verifies there are no pending
8519c80d176SSepherosa Ziehau * requests. Currently no func pointer exists and all implementations are
8529c80d176SSepherosa Ziehau * handled in the generic version of this function.
8539c80d176SSepherosa Ziehau **/
e1000_disable_pcie_master(struct e1000_hw * hw)8549c80d176SSepherosa Ziehau s32 e1000_disable_pcie_master(struct e1000_hw *hw)
8559c80d176SSepherosa Ziehau {
8569c80d176SSepherosa Ziehau return e1000_disable_pcie_master_generic(hw);
8579c80d176SSepherosa Ziehau }
8589c80d176SSepherosa Ziehau
8599c80d176SSepherosa Ziehau /**
8609c80d176SSepherosa Ziehau * e1000_config_collision_dist - Configure collision distance
8619c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
8629c80d176SSepherosa Ziehau *
8639c80d176SSepherosa Ziehau * Configures the collision distance to the default value and is used
8649c80d176SSepherosa Ziehau * during link setup.
8659c80d176SSepherosa Ziehau **/
e1000_config_collision_dist(struct e1000_hw * hw)8669c80d176SSepherosa Ziehau void e1000_config_collision_dist(struct e1000_hw *hw)
8679c80d176SSepherosa Ziehau {
8689c80d176SSepherosa Ziehau if (hw->mac.ops.config_collision_dist)
8699c80d176SSepherosa Ziehau hw->mac.ops.config_collision_dist(hw);
8709c80d176SSepherosa Ziehau }
8719c80d176SSepherosa Ziehau
8729c80d176SSepherosa Ziehau /**
8739c80d176SSepherosa Ziehau * e1000_rar_set - Sets a receive address register
8749c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
8759c80d176SSepherosa Ziehau * @addr: address to set the RAR to
8769c80d176SSepherosa Ziehau * @index: the RAR to set
8779c80d176SSepherosa Ziehau *
8789c80d176SSepherosa Ziehau * Sets a Receive Address Register (RAR) to the specified address.
8799c80d176SSepherosa Ziehau **/
e1000_rar_set(struct e1000_hw * hw,u8 * addr,u32 index)8804765c386SMichael Neumann int e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
8819c80d176SSepherosa Ziehau {
8829c80d176SSepherosa Ziehau if (hw->mac.ops.rar_set)
8834765c386SMichael Neumann return hw->mac.ops.rar_set(hw, addr, index);
8844765c386SMichael Neumann
8854765c386SMichael Neumann return E1000_SUCCESS;
8869c80d176SSepherosa Ziehau }
8879c80d176SSepherosa Ziehau
8889c80d176SSepherosa Ziehau /**
8899c80d176SSepherosa Ziehau * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
8909c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
8919c80d176SSepherosa Ziehau *
8929c80d176SSepherosa Ziehau * Ensures that the MDI/MDIX SW state is valid.
8939c80d176SSepherosa Ziehau **/
e1000_validate_mdi_setting(struct e1000_hw * hw)8949c80d176SSepherosa Ziehau s32 e1000_validate_mdi_setting(struct e1000_hw *hw)
8959c80d176SSepherosa Ziehau {
8969c80d176SSepherosa Ziehau if (hw->mac.ops.validate_mdi_setting)
8979c80d176SSepherosa Ziehau return hw->mac.ops.validate_mdi_setting(hw);
8989c80d176SSepherosa Ziehau
8999c80d176SSepherosa Ziehau return E1000_SUCCESS;
9009c80d176SSepherosa Ziehau }
9019c80d176SSepherosa Ziehau
9029c80d176SSepherosa Ziehau /**
9039c80d176SSepherosa Ziehau * e1000_hash_mc_addr - Determines address location in multicast table
9049c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
9059c80d176SSepherosa Ziehau * @mc_addr: Multicast address to hash.
9069c80d176SSepherosa Ziehau *
9079c80d176SSepherosa Ziehau * This hashes an address to determine its location in the multicast
9089c80d176SSepherosa Ziehau * table. Currently no func pointer exists and all implementations
9099c80d176SSepherosa Ziehau * are handled in the generic version of this function.
9109c80d176SSepherosa Ziehau **/
e1000_hash_mc_addr(struct e1000_hw * hw,u8 * mc_addr)9119c80d176SSepherosa Ziehau u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
9129c80d176SSepherosa Ziehau {
9139c80d176SSepherosa Ziehau return e1000_hash_mc_addr_generic(hw, mc_addr);
9149c80d176SSepherosa Ziehau }
9159c80d176SSepherosa Ziehau
9169c80d176SSepherosa Ziehau /**
9179c80d176SSepherosa Ziehau * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
9189c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
9199c80d176SSepherosa Ziehau *
9209c80d176SSepherosa Ziehau * Enables packet filtering on transmit packets if manageability is enabled
9219c80d176SSepherosa Ziehau * and host interface is enabled.
9229c80d176SSepherosa Ziehau * Currently no func pointer exists and all implementations are handled in the
9239c80d176SSepherosa Ziehau * generic version of this function.
9249c80d176SSepherosa Ziehau **/
e1000_enable_tx_pkt_filtering(struct e1000_hw * hw)9259c80d176SSepherosa Ziehau bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
9269c80d176SSepherosa Ziehau {
9279c80d176SSepherosa Ziehau return e1000_enable_tx_pkt_filtering_generic(hw);
9289c80d176SSepherosa Ziehau }
9299c80d176SSepherosa Ziehau
9309c80d176SSepherosa Ziehau /**
9319c80d176SSepherosa Ziehau * e1000_mng_host_if_write - Writes to the manageability host interface
9329c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
9339c80d176SSepherosa Ziehau * @buffer: pointer to the host interface buffer
9349c80d176SSepherosa Ziehau * @length: size of the buffer
9359c80d176SSepherosa Ziehau * @offset: location in the buffer to write to
9369c80d176SSepherosa Ziehau * @sum: sum of the data (not checksum)
9379c80d176SSepherosa Ziehau *
9389c80d176SSepherosa Ziehau * This function writes the buffer content at the offset given on the host if.
9399c80d176SSepherosa Ziehau * It also does alignment considerations to do the writes in most efficient
9409c80d176SSepherosa Ziehau * way. Also fills up the sum of the buffer in *buffer parameter.
9419c80d176SSepherosa Ziehau **/
e1000_mng_host_if_write(struct e1000_hw * hw,u8 * buffer,u16 length,u16 offset,u8 * sum)9429c80d176SSepherosa Ziehau s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
9439c80d176SSepherosa Ziehau u16 offset, u8 *sum)
9449c80d176SSepherosa Ziehau {
945379ebbe7SSepherosa Ziehau return e1000_mng_host_if_write_generic(hw, buffer, length, offset, sum);
9469c80d176SSepherosa Ziehau }
9479c80d176SSepherosa Ziehau
9489c80d176SSepherosa Ziehau /**
9499c80d176SSepherosa Ziehau * e1000_mng_write_cmd_header - Writes manageability command header
9509c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
9519c80d176SSepherosa Ziehau * @hdr: pointer to the host interface command header
9529c80d176SSepherosa Ziehau *
9539c80d176SSepherosa Ziehau * Writes the command header after does the checksum calculation.
9549c80d176SSepherosa Ziehau **/
e1000_mng_write_cmd_header(struct e1000_hw * hw,struct e1000_host_mng_command_header * hdr)9559c80d176SSepherosa Ziehau s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
9569c80d176SSepherosa Ziehau struct e1000_host_mng_command_header *hdr)
9579c80d176SSepherosa Ziehau {
958379ebbe7SSepherosa Ziehau return e1000_mng_write_cmd_header_generic(hw, hdr);
9599c80d176SSepherosa Ziehau }
9609c80d176SSepherosa Ziehau
9619c80d176SSepherosa Ziehau /**
9629c80d176SSepherosa Ziehau * e1000_mng_enable_host_if - Checks host interface is enabled
9639c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
9649c80d176SSepherosa Ziehau *
9659c80d176SSepherosa Ziehau * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
9669c80d176SSepherosa Ziehau *
9679c80d176SSepherosa Ziehau * This function checks whether the HOST IF is enabled for command operation
9689c80d176SSepherosa Ziehau * and also checks whether the previous command is completed. It busy waits
9699c80d176SSepherosa Ziehau * in case of previous command is not completed.
9709c80d176SSepherosa Ziehau **/
e1000_mng_enable_host_if(struct e1000_hw * hw)9719c80d176SSepherosa Ziehau s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
9729c80d176SSepherosa Ziehau {
973379ebbe7SSepherosa Ziehau return e1000_mng_enable_host_if_generic(hw);
9749c80d176SSepherosa Ziehau }
9759c80d176SSepherosa Ziehau
9769c80d176SSepherosa Ziehau /**
977379ebbe7SSepherosa Ziehau * e1000_set_obff_timer - Set Optimized Buffer Flush/Fill timer
9789c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
979379ebbe7SSepherosa Ziehau * @itr: u32 indicating itr value
9809c80d176SSepherosa Ziehau *
981379ebbe7SSepherosa Ziehau * Set the OBFF timer based on the given interrupt rate.
9829c80d176SSepherosa Ziehau **/
e1000_set_obff_timer(struct e1000_hw * hw,u32 itr)983379ebbe7SSepherosa Ziehau s32 e1000_set_obff_timer(struct e1000_hw *hw, u32 itr)
9849c80d176SSepherosa Ziehau {
985379ebbe7SSepherosa Ziehau if (hw->mac.ops.set_obff_timer)
986379ebbe7SSepherosa Ziehau return hw->mac.ops.set_obff_timer(hw, itr);
9879c80d176SSepherosa Ziehau
9889c80d176SSepherosa Ziehau return E1000_SUCCESS;
9899c80d176SSepherosa Ziehau }
9909c80d176SSepherosa Ziehau
9919c80d176SSepherosa Ziehau /**
9929c80d176SSepherosa Ziehau * e1000_check_reset_block - Verifies PHY can be reset
9939c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
9949c80d176SSepherosa Ziehau *
9959c80d176SSepherosa Ziehau * Checks if the PHY is in a state that can be reset or if manageability
9969c80d176SSepherosa Ziehau * has it tied up. This is a function pointer entry point called by drivers.
9979c80d176SSepherosa Ziehau **/
e1000_check_reset_block(struct e1000_hw * hw)9989c80d176SSepherosa Ziehau s32 e1000_check_reset_block(struct e1000_hw *hw)
9999c80d176SSepherosa Ziehau {
10009c80d176SSepherosa Ziehau if (hw->phy.ops.check_reset_block)
10019c80d176SSepherosa Ziehau return hw->phy.ops.check_reset_block(hw);
10029c80d176SSepherosa Ziehau
10039c80d176SSepherosa Ziehau return E1000_SUCCESS;
10049c80d176SSepherosa Ziehau }
10059c80d176SSepherosa Ziehau
10069c80d176SSepherosa Ziehau /**
10079c80d176SSepherosa Ziehau * e1000_read_phy_reg - Reads PHY register
10089c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
10099c80d176SSepherosa Ziehau * @offset: the register to read
10109c80d176SSepherosa Ziehau * @data: the buffer to store the 16-bit read.
10119c80d176SSepherosa Ziehau *
10129c80d176SSepherosa Ziehau * Reads the PHY register and returns the value in data.
10139c80d176SSepherosa Ziehau * This is a function pointer entry point called by drivers.
10149c80d176SSepherosa Ziehau **/
e1000_read_phy_reg(struct e1000_hw * hw,u32 offset,u16 * data)10159c80d176SSepherosa Ziehau s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
10169c80d176SSepherosa Ziehau {
10179c80d176SSepherosa Ziehau if (hw->phy.ops.read_reg)
10189c80d176SSepherosa Ziehau return hw->phy.ops.read_reg(hw, offset, data);
10199c80d176SSepherosa Ziehau
10209c80d176SSepherosa Ziehau return E1000_SUCCESS;
10219c80d176SSepherosa Ziehau }
10229c80d176SSepherosa Ziehau
10239c80d176SSepherosa Ziehau /**
10249c80d176SSepherosa Ziehau * e1000_write_phy_reg - Writes PHY register
10259c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
10269c80d176SSepherosa Ziehau * @offset: the register to write
10279c80d176SSepherosa Ziehau * @data: the value to write.
10289c80d176SSepherosa Ziehau *
10299c80d176SSepherosa Ziehau * Writes the PHY register at offset with the value in data.
10309c80d176SSepherosa Ziehau * This is a function pointer entry point called by drivers.
10319c80d176SSepherosa Ziehau **/
e1000_write_phy_reg(struct e1000_hw * hw,u32 offset,u16 data)10329c80d176SSepherosa Ziehau s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
10339c80d176SSepherosa Ziehau {
10349c80d176SSepherosa Ziehau if (hw->phy.ops.write_reg)
10359c80d176SSepherosa Ziehau return hw->phy.ops.write_reg(hw, offset, data);
10369c80d176SSepherosa Ziehau
10379c80d176SSepherosa Ziehau return E1000_SUCCESS;
10389c80d176SSepherosa Ziehau }
10399c80d176SSepherosa Ziehau
10409c80d176SSepherosa Ziehau /**
10419c80d176SSepherosa Ziehau * e1000_release_phy - Generic release PHY
10429c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
10439c80d176SSepherosa Ziehau *
10449c80d176SSepherosa Ziehau * Return if silicon family does not require a semaphore when accessing the
10459c80d176SSepherosa Ziehau * PHY.
10469c80d176SSepherosa Ziehau **/
e1000_release_phy(struct e1000_hw * hw)10479c80d176SSepherosa Ziehau void e1000_release_phy(struct e1000_hw *hw)
10489c80d176SSepherosa Ziehau {
10499c80d176SSepherosa Ziehau if (hw->phy.ops.release)
10509c80d176SSepherosa Ziehau hw->phy.ops.release(hw);
10519c80d176SSepherosa Ziehau }
10529c80d176SSepherosa Ziehau
10539c80d176SSepherosa Ziehau /**
10549c80d176SSepherosa Ziehau * e1000_acquire_phy - Generic acquire PHY
10559c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
10569c80d176SSepherosa Ziehau *
10579c80d176SSepherosa Ziehau * Return success if silicon family does not require a semaphore when
10589c80d176SSepherosa Ziehau * accessing the PHY.
10599c80d176SSepherosa Ziehau **/
e1000_acquire_phy(struct e1000_hw * hw)10609c80d176SSepherosa Ziehau s32 e1000_acquire_phy(struct e1000_hw *hw)
10619c80d176SSepherosa Ziehau {
10629c80d176SSepherosa Ziehau if (hw->phy.ops.acquire)
10639c80d176SSepherosa Ziehau return hw->phy.ops.acquire(hw);
10649c80d176SSepherosa Ziehau
10659c80d176SSepherosa Ziehau return E1000_SUCCESS;
10669c80d176SSepherosa Ziehau }
10679c80d176SSepherosa Ziehau
10689c80d176SSepherosa Ziehau /**
10699c80d176SSepherosa Ziehau * e1000_cfg_on_link_up - Configure PHY upon link up
10709c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
10719c80d176SSepherosa Ziehau **/
e1000_cfg_on_link_up(struct e1000_hw * hw)10729c80d176SSepherosa Ziehau s32 e1000_cfg_on_link_up(struct e1000_hw *hw)
10739c80d176SSepherosa Ziehau {
10749c80d176SSepherosa Ziehau if (hw->phy.ops.cfg_on_link_up)
10759c80d176SSepherosa Ziehau return hw->phy.ops.cfg_on_link_up(hw);
10769c80d176SSepherosa Ziehau
10779c80d176SSepherosa Ziehau return E1000_SUCCESS;
10789c80d176SSepherosa Ziehau }
10799c80d176SSepherosa Ziehau
10809c80d176SSepherosa Ziehau /**
10819c80d176SSepherosa Ziehau * e1000_read_kmrn_reg - Reads register using Kumeran interface
10829c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
10839c80d176SSepherosa Ziehau * @offset: the register to read
10849c80d176SSepherosa Ziehau * @data: the location to store the 16-bit value read.
10859c80d176SSepherosa Ziehau *
10869c80d176SSepherosa Ziehau * Reads a register out of the Kumeran interface. Currently no func pointer
10879c80d176SSepherosa Ziehau * exists and all implementations are handled in the generic version of
10889c80d176SSepherosa Ziehau * this function.
10899c80d176SSepherosa Ziehau **/
e1000_read_kmrn_reg(struct e1000_hw * hw,u32 offset,u16 * data)10909c80d176SSepherosa Ziehau s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
10919c80d176SSepherosa Ziehau {
10929c80d176SSepherosa Ziehau return e1000_read_kmrn_reg_generic(hw, offset, data);
10939c80d176SSepherosa Ziehau }
10949c80d176SSepherosa Ziehau
10959c80d176SSepherosa Ziehau /**
10969c80d176SSepherosa Ziehau * e1000_write_kmrn_reg - Writes register using Kumeran interface
10979c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
10989c80d176SSepherosa Ziehau * @offset: the register to write
10999c80d176SSepherosa Ziehau * @data: the value to write.
11009c80d176SSepherosa Ziehau *
11019c80d176SSepherosa Ziehau * Writes a register to the Kumeran interface. Currently no func pointer
11029c80d176SSepherosa Ziehau * exists and all implementations are handled in the generic version of
11039c80d176SSepherosa Ziehau * this function.
11049c80d176SSepherosa Ziehau **/
e1000_write_kmrn_reg(struct e1000_hw * hw,u32 offset,u16 data)11059c80d176SSepherosa Ziehau s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
11069c80d176SSepherosa Ziehau {
11079c80d176SSepherosa Ziehau return e1000_write_kmrn_reg_generic(hw, offset, data);
11089c80d176SSepherosa Ziehau }
11099c80d176SSepherosa Ziehau
11109c80d176SSepherosa Ziehau /**
11119c80d176SSepherosa Ziehau * e1000_get_cable_length - Retrieves cable length estimation
11129c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
11139c80d176SSepherosa Ziehau *
11149c80d176SSepherosa Ziehau * This function estimates the cable length and stores them in
11159c80d176SSepherosa Ziehau * hw->phy.min_length and hw->phy.max_length. This is a function pointer
11169c80d176SSepherosa Ziehau * entry point called by drivers.
11179c80d176SSepherosa Ziehau **/
e1000_get_cable_length(struct e1000_hw * hw)11189c80d176SSepherosa Ziehau s32 e1000_get_cable_length(struct e1000_hw *hw)
11199c80d176SSepherosa Ziehau {
11209c80d176SSepherosa Ziehau if (hw->phy.ops.get_cable_length)
11219c80d176SSepherosa Ziehau return hw->phy.ops.get_cable_length(hw);
11229c80d176SSepherosa Ziehau
11239c80d176SSepherosa Ziehau return E1000_SUCCESS;
11249c80d176SSepherosa Ziehau }
11259c80d176SSepherosa Ziehau
11269c80d176SSepherosa Ziehau /**
11279c80d176SSepherosa Ziehau * e1000_get_phy_info - Retrieves PHY information from registers
11289c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
11299c80d176SSepherosa Ziehau *
11309c80d176SSepherosa Ziehau * This function gets some information from various PHY registers and
11319c80d176SSepherosa Ziehau * populates hw->phy values with it. This is a function pointer entry
11329c80d176SSepherosa Ziehau * point called by drivers.
11339c80d176SSepherosa Ziehau **/
e1000_get_phy_info(struct e1000_hw * hw)11349c80d176SSepherosa Ziehau s32 e1000_get_phy_info(struct e1000_hw *hw)
11359c80d176SSepherosa Ziehau {
11369c80d176SSepherosa Ziehau if (hw->phy.ops.get_info)
11379c80d176SSepherosa Ziehau return hw->phy.ops.get_info(hw);
11389c80d176SSepherosa Ziehau
11399c80d176SSepherosa Ziehau return E1000_SUCCESS;
11409c80d176SSepherosa Ziehau }
11419c80d176SSepherosa Ziehau
11429c80d176SSepherosa Ziehau /**
11439c80d176SSepherosa Ziehau * e1000_phy_hw_reset - Hard PHY reset
11449c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
11459c80d176SSepherosa Ziehau *
11469c80d176SSepherosa Ziehau * Performs a hard PHY reset. This is a function pointer entry point called
11479c80d176SSepherosa Ziehau * by drivers.
11489c80d176SSepherosa Ziehau **/
e1000_phy_hw_reset(struct e1000_hw * hw)11499c80d176SSepherosa Ziehau s32 e1000_phy_hw_reset(struct e1000_hw *hw)
11509c80d176SSepherosa Ziehau {
11519c80d176SSepherosa Ziehau if (hw->phy.ops.reset)
11529c80d176SSepherosa Ziehau return hw->phy.ops.reset(hw);
11539c80d176SSepherosa Ziehau
11549c80d176SSepherosa Ziehau return E1000_SUCCESS;
11559c80d176SSepherosa Ziehau }
11569c80d176SSepherosa Ziehau
11579c80d176SSepherosa Ziehau /**
11589c80d176SSepherosa Ziehau * e1000_phy_commit - Soft PHY reset
11599c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
11609c80d176SSepherosa Ziehau *
11619c80d176SSepherosa Ziehau * Performs a soft PHY reset on those that apply. This is a function pointer
11629c80d176SSepherosa Ziehau * entry point called by drivers.
11639c80d176SSepherosa Ziehau **/
e1000_phy_commit(struct e1000_hw * hw)11649c80d176SSepherosa Ziehau s32 e1000_phy_commit(struct e1000_hw *hw)
11659c80d176SSepherosa Ziehau {
11669c80d176SSepherosa Ziehau if (hw->phy.ops.commit)
11679c80d176SSepherosa Ziehau return hw->phy.ops.commit(hw);
11689c80d176SSepherosa Ziehau
11699c80d176SSepherosa Ziehau return E1000_SUCCESS;
11709c80d176SSepherosa Ziehau }
11719c80d176SSepherosa Ziehau
11729c80d176SSepherosa Ziehau /**
11739c80d176SSepherosa Ziehau * e1000_set_d0_lplu_state - Sets low power link up state for D0
11749c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
11759c80d176SSepherosa Ziehau * @active: boolean used to enable/disable lplu
11769c80d176SSepherosa Ziehau *
11779c80d176SSepherosa Ziehau * Success returns 0, Failure returns 1
11789c80d176SSepherosa Ziehau *
11799c80d176SSepherosa Ziehau * The low power link up (lplu) state is set to the power management level D0
11809c80d176SSepherosa Ziehau * and SmartSpeed is disabled when active is TRUE, else clear lplu for D0
11819c80d176SSepherosa Ziehau * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
11829c80d176SSepherosa Ziehau * is used during Dx states where the power conservation is most important.
11839c80d176SSepherosa Ziehau * During driver activity, SmartSpeed should be enabled so performance is
11849c80d176SSepherosa Ziehau * maintained. This is a function pointer entry point called by drivers.
11859c80d176SSepherosa Ziehau **/
e1000_set_d0_lplu_state(struct e1000_hw * hw,bool active)11869c80d176SSepherosa Ziehau s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
11879c80d176SSepherosa Ziehau {
11889c80d176SSepherosa Ziehau if (hw->phy.ops.set_d0_lplu_state)
11899c80d176SSepherosa Ziehau return hw->phy.ops.set_d0_lplu_state(hw, active);
11909c80d176SSepherosa Ziehau
11919c80d176SSepherosa Ziehau return E1000_SUCCESS;
11929c80d176SSepherosa Ziehau }
11939c80d176SSepherosa Ziehau
11949c80d176SSepherosa Ziehau /**
11959c80d176SSepherosa Ziehau * e1000_set_d3_lplu_state - Sets low power link up state for D3
11969c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
11979c80d176SSepherosa Ziehau * @active: boolean used to enable/disable lplu
11989c80d176SSepherosa Ziehau *
11999c80d176SSepherosa Ziehau * Success returns 0, Failure returns 1
12009c80d176SSepherosa Ziehau *
12019c80d176SSepherosa Ziehau * The low power link up (lplu) state is set to the power management level D3
12029c80d176SSepherosa Ziehau * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3
12039c80d176SSepherosa Ziehau * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
12049c80d176SSepherosa Ziehau * is used during Dx states where the power conservation is most important.
12059c80d176SSepherosa Ziehau * During driver activity, SmartSpeed should be enabled so performance is
12069c80d176SSepherosa Ziehau * maintained. This is a function pointer entry point called by drivers.
12079c80d176SSepherosa Ziehau **/
e1000_set_d3_lplu_state(struct e1000_hw * hw,bool active)12089c80d176SSepherosa Ziehau s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
12099c80d176SSepherosa Ziehau {
12109c80d176SSepherosa Ziehau if (hw->phy.ops.set_d3_lplu_state)
12119c80d176SSepherosa Ziehau return hw->phy.ops.set_d3_lplu_state(hw, active);
12129c80d176SSepherosa Ziehau
12139c80d176SSepherosa Ziehau return E1000_SUCCESS;
12149c80d176SSepherosa Ziehau }
12159c80d176SSepherosa Ziehau
12169c80d176SSepherosa Ziehau /**
12179c80d176SSepherosa Ziehau * e1000_read_mac_addr - Reads MAC address
12189c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
12199c80d176SSepherosa Ziehau *
12209c80d176SSepherosa Ziehau * Reads the MAC address out of the adapter and stores it in the HW structure.
12219c80d176SSepherosa Ziehau * Currently no func pointer exists and all implementations are handled in the
12229c80d176SSepherosa Ziehau * generic version of this function.
12239c80d176SSepherosa Ziehau **/
e1000_read_mac_addr(struct e1000_hw * hw)12249c80d176SSepherosa Ziehau s32 e1000_read_mac_addr(struct e1000_hw *hw)
12259c80d176SSepherosa Ziehau {
12269c80d176SSepherosa Ziehau if (hw->mac.ops.read_mac_addr)
12279c80d176SSepherosa Ziehau return hw->mac.ops.read_mac_addr(hw);
12289c80d176SSepherosa Ziehau
12299c80d176SSepherosa Ziehau return e1000_read_mac_addr_generic(hw);
12309c80d176SSepherosa Ziehau }
12319c80d176SSepherosa Ziehau
12329c80d176SSepherosa Ziehau /**
12336a5a645eSSepherosa Ziehau * e1000_read_pba_string - Read device part number string
12346a5a645eSSepherosa Ziehau * @hw: pointer to the HW structure
12356a5a645eSSepherosa Ziehau * @pba_num: pointer to device part number
12366a5a645eSSepherosa Ziehau * @pba_num_size: size of part number buffer
12376a5a645eSSepherosa Ziehau *
12386a5a645eSSepherosa Ziehau * Reads the product board assembly (PBA) number from the EEPROM and stores
12396a5a645eSSepherosa Ziehau * the value in pba_num.
12406a5a645eSSepherosa Ziehau * Currently no func pointer exists and all implementations are handled in the
12416a5a645eSSepherosa Ziehau * generic version of this function.
12426a5a645eSSepherosa Ziehau **/
e1000_read_pba_string(struct e1000_hw * hw,u8 * pba_num,u32 pba_num_size)12436a5a645eSSepherosa Ziehau s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size)
12446a5a645eSSepherosa Ziehau {
12456a5a645eSSepherosa Ziehau return e1000_read_pba_string_generic(hw, pba_num, pba_num_size);
12466a5a645eSSepherosa Ziehau }
12476a5a645eSSepherosa Ziehau
12486a5a645eSSepherosa Ziehau /**
12496a5a645eSSepherosa Ziehau * e1000_read_pba_length - Read device part number string length
12506a5a645eSSepherosa Ziehau * @hw: pointer to the HW structure
12516a5a645eSSepherosa Ziehau * @pba_num_size: size of part number buffer
12526a5a645eSSepherosa Ziehau *
12536a5a645eSSepherosa Ziehau * Reads the product board assembly (PBA) number length from the EEPROM and
12546a5a645eSSepherosa Ziehau * stores the value in pba_num.
12556a5a645eSSepherosa Ziehau * Currently no func pointer exists and all implementations are handled in the
12566a5a645eSSepherosa Ziehau * generic version of this function.
12576a5a645eSSepherosa Ziehau **/
e1000_read_pba_length(struct e1000_hw * hw,u32 * pba_num_size)12586a5a645eSSepherosa Ziehau s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size)
12596a5a645eSSepherosa Ziehau {
12606a5a645eSSepherosa Ziehau return e1000_read_pba_length_generic(hw, pba_num_size);
12616a5a645eSSepherosa Ziehau }
12626a5a645eSSepherosa Ziehau
12636a5a645eSSepherosa Ziehau /**
12649c80d176SSepherosa Ziehau * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
12659c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
12669c80d176SSepherosa Ziehau *
12679c80d176SSepherosa Ziehau * Validates the NVM checksum is correct. This is a function pointer entry
12689c80d176SSepherosa Ziehau * point called by drivers.
12699c80d176SSepherosa Ziehau **/
e1000_validate_nvm_checksum(struct e1000_hw * hw)12709c80d176SSepherosa Ziehau s32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
12719c80d176SSepherosa Ziehau {
12729c80d176SSepherosa Ziehau if (hw->nvm.ops.validate)
12739c80d176SSepherosa Ziehau return hw->nvm.ops.validate(hw);
12749c80d176SSepherosa Ziehau
12759c80d176SSepherosa Ziehau return -E1000_ERR_CONFIG;
12769c80d176SSepherosa Ziehau }
12779c80d176SSepherosa Ziehau
12789c80d176SSepherosa Ziehau /**
12799c80d176SSepherosa Ziehau * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
12809c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
12819c80d176SSepherosa Ziehau *
12829c80d176SSepherosa Ziehau * Updates the NVM checksum. Currently no func pointer exists and all
12839c80d176SSepherosa Ziehau * implementations are handled in the generic version of this function.
12849c80d176SSepherosa Ziehau **/
e1000_update_nvm_checksum(struct e1000_hw * hw)12859c80d176SSepherosa Ziehau s32 e1000_update_nvm_checksum(struct e1000_hw *hw)
12869c80d176SSepherosa Ziehau {
12879c80d176SSepherosa Ziehau if (hw->nvm.ops.update)
12889c80d176SSepherosa Ziehau return hw->nvm.ops.update(hw);
12899c80d176SSepherosa Ziehau
12909c80d176SSepherosa Ziehau return -E1000_ERR_CONFIG;
12919c80d176SSepherosa Ziehau }
12929c80d176SSepherosa Ziehau
12939c80d176SSepherosa Ziehau /**
12949c80d176SSepherosa Ziehau * e1000_reload_nvm - Reloads EEPROM
12959c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
12969c80d176SSepherosa Ziehau *
12979c80d176SSepherosa Ziehau * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
12989c80d176SSepherosa Ziehau * extended control register.
12999c80d176SSepherosa Ziehau **/
e1000_reload_nvm(struct e1000_hw * hw)13009c80d176SSepherosa Ziehau void e1000_reload_nvm(struct e1000_hw *hw)
13019c80d176SSepherosa Ziehau {
13029c80d176SSepherosa Ziehau if (hw->nvm.ops.reload)
13039c80d176SSepherosa Ziehau hw->nvm.ops.reload(hw);
13049c80d176SSepherosa Ziehau }
13059c80d176SSepherosa Ziehau
13069c80d176SSepherosa Ziehau /**
13079c80d176SSepherosa Ziehau * e1000_read_nvm - Reads NVM (EEPROM)
13089c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
13099c80d176SSepherosa Ziehau * @offset: the word offset to read
13109c80d176SSepherosa Ziehau * @words: number of 16-bit words to read
13119c80d176SSepherosa Ziehau * @data: pointer to the properly sized buffer for the data.
13129c80d176SSepherosa Ziehau *
13139c80d176SSepherosa Ziehau * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
13149c80d176SSepherosa Ziehau * pointer entry point called by drivers.
13159c80d176SSepherosa Ziehau **/
e1000_read_nvm(struct e1000_hw * hw,u16 offset,u16 words,u16 * data)13169c80d176SSepherosa Ziehau s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
13179c80d176SSepherosa Ziehau {
13189c80d176SSepherosa Ziehau if (hw->nvm.ops.read)
13199c80d176SSepherosa Ziehau return hw->nvm.ops.read(hw, offset, words, data);
13209c80d176SSepherosa Ziehau
13219c80d176SSepherosa Ziehau return -E1000_ERR_CONFIG;
13229c80d176SSepherosa Ziehau }
13239c80d176SSepherosa Ziehau
13249c80d176SSepherosa Ziehau /**
13259c80d176SSepherosa Ziehau * e1000_write_nvm - Writes to NVM (EEPROM)
13269c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
13279c80d176SSepherosa Ziehau * @offset: the word offset to read
13289c80d176SSepherosa Ziehau * @words: number of 16-bit words to write
13299c80d176SSepherosa Ziehau * @data: pointer to the properly sized buffer for the data.
13309c80d176SSepherosa Ziehau *
13319c80d176SSepherosa Ziehau * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
13329c80d176SSepherosa Ziehau * pointer entry point called by drivers.
13339c80d176SSepherosa Ziehau **/
e1000_write_nvm(struct e1000_hw * hw,u16 offset,u16 words,u16 * data)13349c80d176SSepherosa Ziehau s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
13359c80d176SSepherosa Ziehau {
13369c80d176SSepherosa Ziehau if (hw->nvm.ops.write)
13379c80d176SSepherosa Ziehau return hw->nvm.ops.write(hw, offset, words, data);
13389c80d176SSepherosa Ziehau
13399c80d176SSepherosa Ziehau return E1000_SUCCESS;
13409c80d176SSepherosa Ziehau }
13419c80d176SSepherosa Ziehau
13429c80d176SSepherosa Ziehau /**
134362583d18SSepherosa Ziehau * e1000_write_8bit_ctrl_reg - Writes 8bit Control register
134462583d18SSepherosa Ziehau * @hw: pointer to the HW structure
134562583d18SSepherosa Ziehau * @reg: 32bit register offset
134662583d18SSepherosa Ziehau * @offset: the register to write
134762583d18SSepherosa Ziehau * @data: the value to write.
134862583d18SSepherosa Ziehau *
134962583d18SSepherosa Ziehau * Writes the PHY register at offset with the value in data.
135062583d18SSepherosa Ziehau * This is a function pointer entry point called by drivers.
135162583d18SSepherosa Ziehau **/
e1000_write_8bit_ctrl_reg(struct e1000_hw * hw,u32 reg,u32 offset,u8 data)135262583d18SSepherosa Ziehau s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
135362583d18SSepherosa Ziehau u8 data)
135462583d18SSepherosa Ziehau {
135562583d18SSepherosa Ziehau return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
135662583d18SSepherosa Ziehau }
135762583d18SSepherosa Ziehau
135862583d18SSepherosa Ziehau /**
13599c80d176SSepherosa Ziehau * e1000_power_up_phy - Restores link in case of PHY power down
13609c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
13619c80d176SSepherosa Ziehau *
13629c80d176SSepherosa Ziehau * The phy may be powered down to save power, to turn off link when the
13639c80d176SSepherosa Ziehau * driver is unloaded, or wake on lan is not enabled (among others).
13649c80d176SSepherosa Ziehau **/
e1000_power_up_phy(struct e1000_hw * hw)13659c80d176SSepherosa Ziehau void e1000_power_up_phy(struct e1000_hw *hw)
13669c80d176SSepherosa Ziehau {
13679c80d176SSepherosa Ziehau if (hw->phy.ops.power_up)
13689c80d176SSepherosa Ziehau hw->phy.ops.power_up(hw);
13699c80d176SSepherosa Ziehau
13709c80d176SSepherosa Ziehau e1000_setup_link(hw);
13719c80d176SSepherosa Ziehau }
13729c80d176SSepherosa Ziehau
13739c80d176SSepherosa Ziehau /**
13749c80d176SSepherosa Ziehau * e1000_power_down_phy - Power down PHY
13759c80d176SSepherosa Ziehau * @hw: pointer to the HW structure
13769c80d176SSepherosa Ziehau *
13779c80d176SSepherosa Ziehau * The phy may be powered down to save power, to turn off link when the
13789c80d176SSepherosa Ziehau * driver is unloaded, or wake on lan is not enabled (among others).
13799c80d176SSepherosa Ziehau **/
e1000_power_down_phy(struct e1000_hw * hw)13809c80d176SSepherosa Ziehau void e1000_power_down_phy(struct e1000_hw *hw)
13819c80d176SSepherosa Ziehau {
13829c80d176SSepherosa Ziehau if (hw->phy.ops.power_down)
13839c80d176SSepherosa Ziehau hw->phy.ops.power_down(hw);
13849c80d176SSepherosa Ziehau }
13859c80d176SSepherosa Ziehau
138662583d18SSepherosa Ziehau /**
138762583d18SSepherosa Ziehau * e1000_power_up_fiber_serdes_link - Power up serdes link
138862583d18SSepherosa Ziehau * @hw: pointer to the HW structure
138962583d18SSepherosa Ziehau *
139062583d18SSepherosa Ziehau * Power on the optics and PCS.
139162583d18SSepherosa Ziehau **/
e1000_power_up_fiber_serdes_link(struct e1000_hw * hw)139262583d18SSepherosa Ziehau void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw)
139362583d18SSepherosa Ziehau {
139462583d18SSepherosa Ziehau if (hw->mac.ops.power_up_serdes)
139562583d18SSepherosa Ziehau hw->mac.ops.power_up_serdes(hw);
139662583d18SSepherosa Ziehau }
139762583d18SSepherosa Ziehau
139862583d18SSepherosa Ziehau /**
139962583d18SSepherosa Ziehau * e1000_shutdown_fiber_serdes_link - Remove link during power down
140062583d18SSepherosa Ziehau * @hw: pointer to the HW structure
140162583d18SSepherosa Ziehau *
140262583d18SSepherosa Ziehau * Shutdown the optics and PCS on driver unload.
140362583d18SSepherosa Ziehau **/
e1000_shutdown_fiber_serdes_link(struct e1000_hw * hw)140462583d18SSepherosa Ziehau void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)
140562583d18SSepherosa Ziehau {
140662583d18SSepherosa Ziehau if (hw->mac.ops.shutdown_serdes)
140762583d18SSepherosa Ziehau hw->mac.ops.shutdown_serdes(hw);
140862583d18SSepherosa Ziehau }
1409