175eba5b6SRobert Mustacchi /******************************************************************************
275eba5b6SRobert Mustacchi
3*7c5988f9SRobert Mustacchi Copyright (c) 2001-2015, Intel Corporation
475eba5b6SRobert Mustacchi All rights reserved.
575eba5b6SRobert Mustacchi
675eba5b6SRobert Mustacchi Redistribution and use in source and binary forms, with or without
775eba5b6SRobert Mustacchi modification, are permitted provided that the following conditions are met:
875eba5b6SRobert Mustacchi
975eba5b6SRobert Mustacchi 1. Redistributions of source code must retain the above copyright notice,
1075eba5b6SRobert Mustacchi this list of conditions and the following disclaimer.
1175eba5b6SRobert Mustacchi
1275eba5b6SRobert Mustacchi 2. Redistributions in binary form must reproduce the above copyright
1375eba5b6SRobert Mustacchi notice, this list of conditions and the following disclaimer in the
1475eba5b6SRobert Mustacchi documentation and/or other materials provided with the distribution.
1575eba5b6SRobert Mustacchi
1675eba5b6SRobert Mustacchi 3. Neither the name of the Intel Corporation nor the names of its
1775eba5b6SRobert Mustacchi contributors may be used to endorse or promote products derived from
1875eba5b6SRobert Mustacchi this software without specific prior written permission.
1975eba5b6SRobert Mustacchi
2075eba5b6SRobert Mustacchi THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2175eba5b6SRobert Mustacchi AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2275eba5b6SRobert Mustacchi IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2375eba5b6SRobert Mustacchi ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2475eba5b6SRobert Mustacchi LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2575eba5b6SRobert Mustacchi CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2675eba5b6SRobert Mustacchi SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2775eba5b6SRobert Mustacchi INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2875eba5b6SRobert Mustacchi CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2975eba5b6SRobert Mustacchi ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3075eba5b6SRobert Mustacchi POSSIBILITY OF SUCH DAMAGE.
3175eba5b6SRobert Mustacchi
3275eba5b6SRobert Mustacchi ******************************************************************************/
3375eba5b6SRobert Mustacchi /*$FreeBSD$*/
3475eba5b6SRobert Mustacchi
3575eba5b6SRobert Mustacchi #include "e1000_api.h"
3675eba5b6SRobert Mustacchi
3775eba5b6SRobert Mustacchi /**
3875eba5b6SRobert Mustacchi * e1000_init_mac_params - Initialize MAC function pointers
3975eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
4075eba5b6SRobert Mustacchi *
4175eba5b6SRobert Mustacchi * This function initializes the function pointers for the MAC
4275eba5b6SRobert Mustacchi * set of functions. Called by drivers or by e1000_setup_init_funcs.
4375eba5b6SRobert Mustacchi **/
e1000_init_mac_params(struct e1000_hw * hw)4475eba5b6SRobert Mustacchi s32 e1000_init_mac_params(struct e1000_hw *hw)
4575eba5b6SRobert Mustacchi {
4675eba5b6SRobert Mustacchi s32 ret_val = E1000_SUCCESS;
4775eba5b6SRobert Mustacchi
4875eba5b6SRobert Mustacchi if (hw->mac.ops.init_params) {
4975eba5b6SRobert Mustacchi ret_val = hw->mac.ops.init_params(hw);
5075eba5b6SRobert Mustacchi if (ret_val) {
5175eba5b6SRobert Mustacchi DEBUGOUT("MAC Initialization Error\n");
5275eba5b6SRobert Mustacchi goto out;
5375eba5b6SRobert Mustacchi }
5475eba5b6SRobert Mustacchi } else {
5575eba5b6SRobert Mustacchi DEBUGOUT("mac.init_mac_params was NULL\n");
5675eba5b6SRobert Mustacchi ret_val = -E1000_ERR_CONFIG;
5775eba5b6SRobert Mustacchi }
5875eba5b6SRobert Mustacchi
5975eba5b6SRobert Mustacchi out:
6075eba5b6SRobert Mustacchi return ret_val;
6175eba5b6SRobert Mustacchi }
6275eba5b6SRobert Mustacchi
6375eba5b6SRobert Mustacchi /**
6475eba5b6SRobert Mustacchi * e1000_init_nvm_params - Initialize NVM function pointers
6575eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
6675eba5b6SRobert Mustacchi *
6775eba5b6SRobert Mustacchi * This function initializes the function pointers for the NVM
6875eba5b6SRobert Mustacchi * set of functions. Called by drivers or by e1000_setup_init_funcs.
6975eba5b6SRobert Mustacchi **/
e1000_init_nvm_params(struct e1000_hw * hw)7075eba5b6SRobert Mustacchi s32 e1000_init_nvm_params(struct e1000_hw *hw)
7175eba5b6SRobert Mustacchi {
7275eba5b6SRobert Mustacchi s32 ret_val = E1000_SUCCESS;
7375eba5b6SRobert Mustacchi
7475eba5b6SRobert Mustacchi if (hw->nvm.ops.init_params) {
7575eba5b6SRobert Mustacchi ret_val = hw->nvm.ops.init_params(hw);
7675eba5b6SRobert Mustacchi if (ret_val) {
7775eba5b6SRobert Mustacchi DEBUGOUT("NVM Initialization Error\n");
7875eba5b6SRobert Mustacchi goto out;
7975eba5b6SRobert Mustacchi }
8075eba5b6SRobert Mustacchi } else {
8175eba5b6SRobert Mustacchi DEBUGOUT("nvm.init_nvm_params was NULL\n");
8275eba5b6SRobert Mustacchi ret_val = -E1000_ERR_CONFIG;
8375eba5b6SRobert Mustacchi }
8475eba5b6SRobert Mustacchi
8575eba5b6SRobert Mustacchi out:
8675eba5b6SRobert Mustacchi return ret_val;
8775eba5b6SRobert Mustacchi }
8875eba5b6SRobert Mustacchi
8975eba5b6SRobert Mustacchi /**
9075eba5b6SRobert Mustacchi * e1000_init_phy_params - Initialize PHY function pointers
9175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
9275eba5b6SRobert Mustacchi *
9375eba5b6SRobert Mustacchi * This function initializes the function pointers for the PHY
9475eba5b6SRobert Mustacchi * set of functions. Called by drivers or by e1000_setup_init_funcs.
9575eba5b6SRobert Mustacchi **/
e1000_init_phy_params(struct e1000_hw * hw)9675eba5b6SRobert Mustacchi s32 e1000_init_phy_params(struct e1000_hw *hw)
9775eba5b6SRobert Mustacchi {
9875eba5b6SRobert Mustacchi s32 ret_val = E1000_SUCCESS;
9975eba5b6SRobert Mustacchi
10075eba5b6SRobert Mustacchi if (hw->phy.ops.init_params) {
10175eba5b6SRobert Mustacchi ret_val = hw->phy.ops.init_params(hw);
10275eba5b6SRobert Mustacchi if (ret_val) {
10375eba5b6SRobert Mustacchi DEBUGOUT("PHY Initialization Error\n");
10475eba5b6SRobert Mustacchi goto out;
10575eba5b6SRobert Mustacchi }
10675eba5b6SRobert Mustacchi } else {
10775eba5b6SRobert Mustacchi DEBUGOUT("phy.init_phy_params was NULL\n");
10875eba5b6SRobert Mustacchi ret_val = -E1000_ERR_CONFIG;
10975eba5b6SRobert Mustacchi }
11075eba5b6SRobert Mustacchi
11175eba5b6SRobert Mustacchi out:
11275eba5b6SRobert Mustacchi return ret_val;
11375eba5b6SRobert Mustacchi }
11475eba5b6SRobert Mustacchi
11575eba5b6SRobert Mustacchi /**
11675eba5b6SRobert Mustacchi * e1000_init_mbx_params - Initialize mailbox function pointers
11775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
11875eba5b6SRobert Mustacchi *
11975eba5b6SRobert Mustacchi * This function initializes the function pointers for the PHY
12075eba5b6SRobert Mustacchi * set of functions. Called by drivers or by e1000_setup_init_funcs.
12175eba5b6SRobert Mustacchi **/
e1000_init_mbx_params(struct e1000_hw * hw)12275eba5b6SRobert Mustacchi s32 e1000_init_mbx_params(struct e1000_hw *hw)
12375eba5b6SRobert Mustacchi {
12475eba5b6SRobert Mustacchi s32 ret_val = E1000_SUCCESS;
12575eba5b6SRobert Mustacchi
12675eba5b6SRobert Mustacchi if (hw->mbx.ops.init_params) {
12775eba5b6SRobert Mustacchi ret_val = hw->mbx.ops.init_params(hw);
12875eba5b6SRobert Mustacchi if (ret_val) {
12975eba5b6SRobert Mustacchi DEBUGOUT("Mailbox Initialization Error\n");
13075eba5b6SRobert Mustacchi goto out;
13175eba5b6SRobert Mustacchi }
13275eba5b6SRobert Mustacchi } else {
13375eba5b6SRobert Mustacchi DEBUGOUT("mbx.init_mbx_params was NULL\n");
13475eba5b6SRobert Mustacchi ret_val = -E1000_ERR_CONFIG;
13575eba5b6SRobert Mustacchi }
13675eba5b6SRobert Mustacchi
13775eba5b6SRobert Mustacchi out:
13875eba5b6SRobert Mustacchi return ret_val;
13975eba5b6SRobert Mustacchi }
14075eba5b6SRobert Mustacchi
14175eba5b6SRobert Mustacchi /**
14275eba5b6SRobert Mustacchi * e1000_set_mac_type - Sets MAC type
14375eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
14475eba5b6SRobert Mustacchi *
14575eba5b6SRobert Mustacchi * This function sets the mac type of the adapter based on the
14675eba5b6SRobert Mustacchi * device ID stored in the hw structure.
14775eba5b6SRobert Mustacchi * MUST BE FIRST FUNCTION CALLED (explicitly or through
14875eba5b6SRobert Mustacchi * e1000_setup_init_funcs()).
14975eba5b6SRobert Mustacchi **/
e1000_set_mac_type(struct e1000_hw * hw)15075eba5b6SRobert Mustacchi s32 e1000_set_mac_type(struct e1000_hw *hw)
15175eba5b6SRobert Mustacchi {
15275eba5b6SRobert Mustacchi struct e1000_mac_info *mac = &hw->mac;
15375eba5b6SRobert Mustacchi s32 ret_val = E1000_SUCCESS;
15475eba5b6SRobert Mustacchi
15575eba5b6SRobert Mustacchi DEBUGFUNC("e1000_set_mac_type");
15675eba5b6SRobert Mustacchi
15775eba5b6SRobert Mustacchi switch (hw->device_id) {
15875eba5b6SRobert Mustacchi case E1000_DEV_ID_82542:
15975eba5b6SRobert Mustacchi mac->type = e1000_82542;
16075eba5b6SRobert Mustacchi break;
16175eba5b6SRobert Mustacchi case E1000_DEV_ID_82543GC_FIBER:
16275eba5b6SRobert Mustacchi case E1000_DEV_ID_82543GC_COPPER:
16375eba5b6SRobert Mustacchi mac->type = e1000_82543;
16475eba5b6SRobert Mustacchi break;
16575eba5b6SRobert Mustacchi case E1000_DEV_ID_82544EI_COPPER:
16675eba5b6SRobert Mustacchi case E1000_DEV_ID_82544EI_FIBER:
16775eba5b6SRobert Mustacchi case E1000_DEV_ID_82544GC_COPPER:
16875eba5b6SRobert Mustacchi case E1000_DEV_ID_82544GC_LOM:
16975eba5b6SRobert Mustacchi mac->type = e1000_82544;
17075eba5b6SRobert Mustacchi break;
17175eba5b6SRobert Mustacchi case E1000_DEV_ID_82540EM:
17275eba5b6SRobert Mustacchi case E1000_DEV_ID_82540EM_LOM:
17375eba5b6SRobert Mustacchi case E1000_DEV_ID_82540EP:
17475eba5b6SRobert Mustacchi case E1000_DEV_ID_82540EP_LOM:
17575eba5b6SRobert Mustacchi case E1000_DEV_ID_82540EP_LP:
17675eba5b6SRobert Mustacchi mac->type = e1000_82540;
17775eba5b6SRobert Mustacchi break;
17875eba5b6SRobert Mustacchi case E1000_DEV_ID_82545EM_COPPER:
17975eba5b6SRobert Mustacchi case E1000_DEV_ID_82545EM_FIBER:
18075eba5b6SRobert Mustacchi mac->type = e1000_82545;
18175eba5b6SRobert Mustacchi break;
18275eba5b6SRobert Mustacchi case E1000_DEV_ID_82545GM_COPPER:
18375eba5b6SRobert Mustacchi case E1000_DEV_ID_82545GM_FIBER:
18475eba5b6SRobert Mustacchi case E1000_DEV_ID_82545GM_SERDES:
18575eba5b6SRobert Mustacchi mac->type = e1000_82545_rev_3;
18675eba5b6SRobert Mustacchi break;
18775eba5b6SRobert Mustacchi case E1000_DEV_ID_82546EB_COPPER:
18875eba5b6SRobert Mustacchi case E1000_DEV_ID_82546EB_FIBER:
18975eba5b6SRobert Mustacchi case E1000_DEV_ID_82546EB_QUAD_COPPER:
19075eba5b6SRobert Mustacchi mac->type = e1000_82546;
19175eba5b6SRobert Mustacchi break;
19275eba5b6SRobert Mustacchi case E1000_DEV_ID_82546GB_COPPER:
19375eba5b6SRobert Mustacchi case E1000_DEV_ID_82546GB_FIBER:
19475eba5b6SRobert Mustacchi case E1000_DEV_ID_82546GB_SERDES:
19575eba5b6SRobert Mustacchi case E1000_DEV_ID_82546GB_PCIE:
19675eba5b6SRobert Mustacchi case E1000_DEV_ID_82546GB_QUAD_COPPER:
19775eba5b6SRobert Mustacchi case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
19875eba5b6SRobert Mustacchi mac->type = e1000_82546_rev_3;
19975eba5b6SRobert Mustacchi break;
20075eba5b6SRobert Mustacchi case E1000_DEV_ID_82541EI:
20175eba5b6SRobert Mustacchi case E1000_DEV_ID_82541EI_MOBILE:
20275eba5b6SRobert Mustacchi case E1000_DEV_ID_82541ER_LOM:
20375eba5b6SRobert Mustacchi mac->type = e1000_82541;
20475eba5b6SRobert Mustacchi break;
20575eba5b6SRobert Mustacchi case E1000_DEV_ID_82541ER:
20675eba5b6SRobert Mustacchi case E1000_DEV_ID_82541GI:
20775eba5b6SRobert Mustacchi case E1000_DEV_ID_82541GI_LF:
20875eba5b6SRobert Mustacchi case E1000_DEV_ID_82541GI_MOBILE:
20975eba5b6SRobert Mustacchi mac->type = e1000_82541_rev_2;
21075eba5b6SRobert Mustacchi break;
21175eba5b6SRobert Mustacchi case E1000_DEV_ID_82547EI:
21275eba5b6SRobert Mustacchi case E1000_DEV_ID_82547EI_MOBILE:
21375eba5b6SRobert Mustacchi mac->type = e1000_82547;
21475eba5b6SRobert Mustacchi break;
21575eba5b6SRobert Mustacchi case E1000_DEV_ID_82547GI:
21675eba5b6SRobert Mustacchi mac->type = e1000_82547_rev_2;
21775eba5b6SRobert Mustacchi break;
21875eba5b6SRobert Mustacchi case E1000_DEV_ID_82571EB_COPPER:
21975eba5b6SRobert Mustacchi case E1000_DEV_ID_82571EB_FIBER:
22075eba5b6SRobert Mustacchi case E1000_DEV_ID_82571EB_SERDES:
22175eba5b6SRobert Mustacchi case E1000_DEV_ID_82571EB_SERDES_DUAL:
22275eba5b6SRobert Mustacchi case E1000_DEV_ID_82571EB_SERDES_QUAD:
22375eba5b6SRobert Mustacchi case E1000_DEV_ID_82571EB_QUAD_COPPER:
22475eba5b6SRobert Mustacchi case E1000_DEV_ID_82571PT_QUAD_COPPER:
22575eba5b6SRobert Mustacchi case E1000_DEV_ID_82571EB_QUAD_FIBER:
22675eba5b6SRobert Mustacchi case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
22775eba5b6SRobert Mustacchi mac->type = e1000_82571;
22875eba5b6SRobert Mustacchi break;
22975eba5b6SRobert Mustacchi case E1000_DEV_ID_82572EI:
23075eba5b6SRobert Mustacchi case E1000_DEV_ID_82572EI_COPPER:
23175eba5b6SRobert Mustacchi case E1000_DEV_ID_82572EI_FIBER:
23275eba5b6SRobert Mustacchi case E1000_DEV_ID_82572EI_SERDES:
23375eba5b6SRobert Mustacchi mac->type = e1000_82572;
23475eba5b6SRobert Mustacchi break;
23575eba5b6SRobert Mustacchi case E1000_DEV_ID_82573E:
23675eba5b6SRobert Mustacchi case E1000_DEV_ID_82573E_IAMT:
23775eba5b6SRobert Mustacchi case E1000_DEV_ID_82573L:
23875eba5b6SRobert Mustacchi mac->type = e1000_82573;
23975eba5b6SRobert Mustacchi break;
24075eba5b6SRobert Mustacchi case E1000_DEV_ID_82574L:
24175eba5b6SRobert Mustacchi case E1000_DEV_ID_82574LA:
24275eba5b6SRobert Mustacchi mac->type = e1000_82574;
24375eba5b6SRobert Mustacchi break;
24475eba5b6SRobert Mustacchi case E1000_DEV_ID_82583V:
24575eba5b6SRobert Mustacchi mac->type = e1000_82583;
24675eba5b6SRobert Mustacchi break;
24775eba5b6SRobert Mustacchi case E1000_DEV_ID_80003ES2LAN_COPPER_DPT:
24875eba5b6SRobert Mustacchi case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
24975eba5b6SRobert Mustacchi case E1000_DEV_ID_80003ES2LAN_COPPER_SPT:
25075eba5b6SRobert Mustacchi case E1000_DEV_ID_80003ES2LAN_SERDES_SPT:
25175eba5b6SRobert Mustacchi mac->type = e1000_80003es2lan;
25275eba5b6SRobert Mustacchi break;
25375eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH8_IFE:
25475eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH8_IFE_GT:
25575eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH8_IFE_G:
25675eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH8_IGP_M:
25775eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH8_IGP_M_AMT:
25875eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH8_IGP_AMT:
25975eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH8_IGP_C:
26075eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH8_82567V_3:
26175eba5b6SRobert Mustacchi mac->type = e1000_ich8lan;
26275eba5b6SRobert Mustacchi break;
26375eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH9_IFE:
26475eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH9_IFE_GT:
26575eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH9_IFE_G:
26675eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH9_IGP_M:
26775eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH9_IGP_M_AMT:
26875eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH9_IGP_M_V:
26975eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH9_IGP_AMT:
27075eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH9_BM:
27175eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH9_IGP_C:
27275eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH10_R_BM_LM:
27375eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH10_R_BM_LF:
27475eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH10_R_BM_V:
27575eba5b6SRobert Mustacchi mac->type = e1000_ich9lan;
27675eba5b6SRobert Mustacchi break;
27775eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH10_D_BM_LM:
27875eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH10_D_BM_LF:
27975eba5b6SRobert Mustacchi case E1000_DEV_ID_ICH10_D_BM_V:
28075eba5b6SRobert Mustacchi mac->type = e1000_ich10lan;
28175eba5b6SRobert Mustacchi break;
28275eba5b6SRobert Mustacchi case E1000_DEV_ID_PCH_D_HV_DM:
28375eba5b6SRobert Mustacchi case E1000_DEV_ID_PCH_D_HV_DC:
28475eba5b6SRobert Mustacchi case E1000_DEV_ID_PCH_M_HV_LM:
28575eba5b6SRobert Mustacchi case E1000_DEV_ID_PCH_M_HV_LC:
28675eba5b6SRobert Mustacchi mac->type = e1000_pchlan;
28775eba5b6SRobert Mustacchi break;
28875eba5b6SRobert Mustacchi case E1000_DEV_ID_PCH2_LV_LM:
28975eba5b6SRobert Mustacchi case E1000_DEV_ID_PCH2_LV_V:
29075eba5b6SRobert Mustacchi mac->type = e1000_pch2lan;
29175eba5b6SRobert Mustacchi break;
29275eba5b6SRobert Mustacchi case E1000_DEV_ID_PCH_LPT_I217_LM:
29375eba5b6SRobert Mustacchi case E1000_DEV_ID_PCH_LPT_I217_V:
29475eba5b6SRobert Mustacchi case E1000_DEV_ID_PCH_LPTLP_I218_LM:
29575eba5b6SRobert Mustacchi case E1000_DEV_ID_PCH_LPTLP_I218_V:
296c124a83eSRobert Mustacchi case E1000_DEV_ID_PCH_I218_LM2:
297c124a83eSRobert Mustacchi case E1000_DEV_ID_PCH_I218_V2:
298c124a83eSRobert Mustacchi case E1000_DEV_ID_PCH_I218_LM3:
299c124a83eSRobert Mustacchi case E1000_DEV_ID_PCH_I218_V3:
30075eba5b6SRobert Mustacchi mac->type = e1000_pch_lpt;
30175eba5b6SRobert Mustacchi break;
302*7c5988f9SRobert Mustacchi case E1000_DEV_ID_PCH_SPT_I219_LM:
303*7c5988f9SRobert Mustacchi case E1000_DEV_ID_PCH_SPT_I219_V:
304*7c5988f9SRobert Mustacchi case E1000_DEV_ID_PCH_SPT_I219_LM2:
305*7c5988f9SRobert Mustacchi case E1000_DEV_ID_PCH_SPT_I219_V2:
306*7c5988f9SRobert Mustacchi case E1000_DEV_ID_PCH_LBG_I219_LM3:
307*7c5988f9SRobert Mustacchi mac->type = e1000_pch_spt;
308*7c5988f9SRobert Mustacchi break;
30975eba5b6SRobert Mustacchi case E1000_DEV_ID_82575EB_COPPER:
31075eba5b6SRobert Mustacchi case E1000_DEV_ID_82575EB_FIBER_SERDES:
31175eba5b6SRobert Mustacchi case E1000_DEV_ID_82575GB_QUAD_COPPER:
31275eba5b6SRobert Mustacchi mac->type = e1000_82575;
31375eba5b6SRobert Mustacchi break;
31475eba5b6SRobert Mustacchi case E1000_DEV_ID_82576:
31575eba5b6SRobert Mustacchi case E1000_DEV_ID_82576_FIBER:
31675eba5b6SRobert Mustacchi case E1000_DEV_ID_82576_SERDES:
31775eba5b6SRobert Mustacchi case E1000_DEV_ID_82576_QUAD_COPPER:
31875eba5b6SRobert Mustacchi case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
31975eba5b6SRobert Mustacchi case E1000_DEV_ID_82576_NS:
32075eba5b6SRobert Mustacchi case E1000_DEV_ID_82576_NS_SERDES:
32175eba5b6SRobert Mustacchi case E1000_DEV_ID_82576_SERDES_QUAD:
32275eba5b6SRobert Mustacchi mac->type = e1000_82576;
32375eba5b6SRobert Mustacchi break;
32475eba5b6SRobert Mustacchi case E1000_DEV_ID_82580_COPPER:
32575eba5b6SRobert Mustacchi case E1000_DEV_ID_82580_FIBER:
32675eba5b6SRobert Mustacchi case E1000_DEV_ID_82580_SERDES:
32775eba5b6SRobert Mustacchi case E1000_DEV_ID_82580_SGMII:
32875eba5b6SRobert Mustacchi case E1000_DEV_ID_82580_COPPER_DUAL:
32975eba5b6SRobert Mustacchi case E1000_DEV_ID_82580_QUAD_FIBER:
33075eba5b6SRobert Mustacchi case E1000_DEV_ID_DH89XXCC_SGMII:
33175eba5b6SRobert Mustacchi case E1000_DEV_ID_DH89XXCC_SERDES:
33275eba5b6SRobert Mustacchi case E1000_DEV_ID_DH89XXCC_BACKPLANE:
33375eba5b6SRobert Mustacchi case E1000_DEV_ID_DH89XXCC_SFP:
33475eba5b6SRobert Mustacchi mac->type = e1000_82580;
33575eba5b6SRobert Mustacchi break;
33675eba5b6SRobert Mustacchi case E1000_DEV_ID_I350_COPPER:
33775eba5b6SRobert Mustacchi case E1000_DEV_ID_I350_FIBER:
33875eba5b6SRobert Mustacchi case E1000_DEV_ID_I350_SERDES:
33975eba5b6SRobert Mustacchi case E1000_DEV_ID_I350_SGMII:
34075eba5b6SRobert Mustacchi case E1000_DEV_ID_I350_DA4:
34175eba5b6SRobert Mustacchi mac->type = e1000_i350;
34275eba5b6SRobert Mustacchi break;
343c124a83eSRobert Mustacchi case E1000_DEV_ID_I210_COPPER_FLASHLESS:
344c124a83eSRobert Mustacchi case E1000_DEV_ID_I210_SERDES_FLASHLESS:
34575eba5b6SRobert Mustacchi case E1000_DEV_ID_I210_COPPER:
34675eba5b6SRobert Mustacchi case E1000_DEV_ID_I210_COPPER_OEM1:
34775eba5b6SRobert Mustacchi case E1000_DEV_ID_I210_COPPER_IT:
34875eba5b6SRobert Mustacchi case E1000_DEV_ID_I210_FIBER:
34975eba5b6SRobert Mustacchi case E1000_DEV_ID_I210_SERDES:
35075eba5b6SRobert Mustacchi case E1000_DEV_ID_I210_SGMII:
35175eba5b6SRobert Mustacchi mac->type = e1000_i210;
35275eba5b6SRobert Mustacchi break;
35375eba5b6SRobert Mustacchi case E1000_DEV_ID_I211_COPPER:
35475eba5b6SRobert Mustacchi mac->type = e1000_i211;
35575eba5b6SRobert Mustacchi break;
35675eba5b6SRobert Mustacchi case E1000_DEV_ID_82576_VF:
35775eba5b6SRobert Mustacchi case E1000_DEV_ID_82576_VF_HV:
35875eba5b6SRobert Mustacchi mac->type = e1000_vfadapt;
35975eba5b6SRobert Mustacchi break;
36075eba5b6SRobert Mustacchi case E1000_DEV_ID_I350_VF:
36175eba5b6SRobert Mustacchi case E1000_DEV_ID_I350_VF_HV:
36275eba5b6SRobert Mustacchi mac->type = e1000_vfadapt_i350;
36375eba5b6SRobert Mustacchi break;
364c124a83eSRobert Mustacchi
36513485e69SGarrett D'Amore case E1000_DEV_ID_I354_BACKPLANE_1GBPS:
36613485e69SGarrett D'Amore case E1000_DEV_ID_I354_SGMII:
36713485e69SGarrett D'Amore case E1000_DEV_ID_I354_BACKPLANE_2_5GBPS:
36813485e69SGarrett D'Amore mac->type = e1000_i354;
36913485e69SGarrett D'Amore break;
37075eba5b6SRobert Mustacchi default:
37175eba5b6SRobert Mustacchi /* Should never have loaded on this device */
37275eba5b6SRobert Mustacchi ret_val = -E1000_ERR_MAC_INIT;
37375eba5b6SRobert Mustacchi break;
37475eba5b6SRobert Mustacchi }
37575eba5b6SRobert Mustacchi
37675eba5b6SRobert Mustacchi return ret_val;
37775eba5b6SRobert Mustacchi }
37875eba5b6SRobert Mustacchi
37975eba5b6SRobert Mustacchi /**
38075eba5b6SRobert Mustacchi * e1000_setup_init_funcs - Initializes function pointers
38175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
38275eba5b6SRobert Mustacchi * @init_device: TRUE will initialize the rest of the function pointers
38375eba5b6SRobert Mustacchi * getting the device ready for use. FALSE will only set
38475eba5b6SRobert Mustacchi * MAC type and the function pointers for the other init
38575eba5b6SRobert Mustacchi * functions. Passing FALSE will not generate any hardware
38675eba5b6SRobert Mustacchi * reads or writes.
38775eba5b6SRobert Mustacchi *
38875eba5b6SRobert Mustacchi * This function must be called by a driver in order to use the rest
38975eba5b6SRobert Mustacchi * of the 'shared' code files. Called by drivers only.
39075eba5b6SRobert Mustacchi **/
e1000_setup_init_funcs(struct e1000_hw * hw,bool init_device)39175eba5b6SRobert Mustacchi s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
39275eba5b6SRobert Mustacchi {
39375eba5b6SRobert Mustacchi s32 ret_val;
39475eba5b6SRobert Mustacchi
39575eba5b6SRobert Mustacchi /* Can't do much good without knowing the MAC type. */
39675eba5b6SRobert Mustacchi ret_val = e1000_set_mac_type(hw);
39775eba5b6SRobert Mustacchi if (ret_val) {
39875eba5b6SRobert Mustacchi DEBUGOUT("ERROR: MAC type could not be set properly.\n");
39975eba5b6SRobert Mustacchi goto out;
40075eba5b6SRobert Mustacchi }
40175eba5b6SRobert Mustacchi
40275eba5b6SRobert Mustacchi if (!hw->hw_addr) {
40375eba5b6SRobert Mustacchi DEBUGOUT("ERROR: Registers not mapped\n");
40475eba5b6SRobert Mustacchi ret_val = -E1000_ERR_CONFIG;
40575eba5b6SRobert Mustacchi goto out;
40675eba5b6SRobert Mustacchi }
40775eba5b6SRobert Mustacchi
40875eba5b6SRobert Mustacchi /*
40975eba5b6SRobert Mustacchi * Init function pointers to generic implementations. We do this first
41075eba5b6SRobert Mustacchi * allowing a driver module to override it afterward.
41175eba5b6SRobert Mustacchi */
41275eba5b6SRobert Mustacchi e1000_init_mac_ops_generic(hw);
41375eba5b6SRobert Mustacchi e1000_init_phy_ops_generic(hw);
41475eba5b6SRobert Mustacchi e1000_init_nvm_ops_generic(hw);
41575eba5b6SRobert Mustacchi e1000_init_mbx_ops_generic(hw);
41675eba5b6SRobert Mustacchi
41775eba5b6SRobert Mustacchi /*
41875eba5b6SRobert Mustacchi * Set up the init function pointers. These are functions within the
41975eba5b6SRobert Mustacchi * adapter family file that sets up function pointers for the rest of
42075eba5b6SRobert Mustacchi * the functions in that family.
42175eba5b6SRobert Mustacchi */
42275eba5b6SRobert Mustacchi switch (hw->mac.type) {
42375eba5b6SRobert Mustacchi case e1000_82542:
42475eba5b6SRobert Mustacchi e1000_init_function_pointers_82542(hw);
42575eba5b6SRobert Mustacchi break;
42675eba5b6SRobert Mustacchi case e1000_82543:
42775eba5b6SRobert Mustacchi case e1000_82544:
42875eba5b6SRobert Mustacchi e1000_init_function_pointers_82543(hw);
42975eba5b6SRobert Mustacchi break;
43075eba5b6SRobert Mustacchi case e1000_82540:
43175eba5b6SRobert Mustacchi case e1000_82545:
43275eba5b6SRobert Mustacchi case e1000_82545_rev_3:
43375eba5b6SRobert Mustacchi case e1000_82546:
43475eba5b6SRobert Mustacchi case e1000_82546_rev_3:
43575eba5b6SRobert Mustacchi e1000_init_function_pointers_82540(hw);
43675eba5b6SRobert Mustacchi break;
43775eba5b6SRobert Mustacchi case e1000_82541:
43875eba5b6SRobert Mustacchi case e1000_82541_rev_2:
43975eba5b6SRobert Mustacchi case e1000_82547:
44075eba5b6SRobert Mustacchi case e1000_82547_rev_2:
44175eba5b6SRobert Mustacchi e1000_init_function_pointers_82541(hw);
44275eba5b6SRobert Mustacchi break;
44375eba5b6SRobert Mustacchi case e1000_82571:
44475eba5b6SRobert Mustacchi case e1000_82572:
44575eba5b6SRobert Mustacchi case e1000_82573:
44675eba5b6SRobert Mustacchi case e1000_82574:
44775eba5b6SRobert Mustacchi case e1000_82583:
44875eba5b6SRobert Mustacchi e1000_init_function_pointers_82571(hw);
44975eba5b6SRobert Mustacchi break;
45075eba5b6SRobert Mustacchi case e1000_80003es2lan:
45175eba5b6SRobert Mustacchi e1000_init_function_pointers_80003es2lan(hw);
45275eba5b6SRobert Mustacchi break;
45375eba5b6SRobert Mustacchi case e1000_ich8lan:
45475eba5b6SRobert Mustacchi case e1000_ich9lan:
45575eba5b6SRobert Mustacchi case e1000_ich10lan:
45675eba5b6SRobert Mustacchi case e1000_pchlan:
45775eba5b6SRobert Mustacchi case e1000_pch2lan:
45875eba5b6SRobert Mustacchi case e1000_pch_lpt:
459*7c5988f9SRobert Mustacchi case e1000_pch_spt:
46075eba5b6SRobert Mustacchi e1000_init_function_pointers_ich8lan(hw);
46175eba5b6SRobert Mustacchi break;
46275eba5b6SRobert Mustacchi case e1000_82575:
46375eba5b6SRobert Mustacchi case e1000_82576:
46475eba5b6SRobert Mustacchi case e1000_82580:
46575eba5b6SRobert Mustacchi case e1000_i350:
46613485e69SGarrett D'Amore case e1000_i354:
46775eba5b6SRobert Mustacchi e1000_init_function_pointers_82575(hw);
46875eba5b6SRobert Mustacchi break;
46975eba5b6SRobert Mustacchi case e1000_i210:
47075eba5b6SRobert Mustacchi case e1000_i211:
47175eba5b6SRobert Mustacchi e1000_init_function_pointers_i210(hw);
47275eba5b6SRobert Mustacchi break;
47375eba5b6SRobert Mustacchi case e1000_vfadapt:
47475eba5b6SRobert Mustacchi e1000_init_function_pointers_vf(hw);
47575eba5b6SRobert Mustacchi break;
47675eba5b6SRobert Mustacchi case e1000_vfadapt_i350:
47775eba5b6SRobert Mustacchi e1000_init_function_pointers_vf(hw);
47875eba5b6SRobert Mustacchi break;
47975eba5b6SRobert Mustacchi default:
48075eba5b6SRobert Mustacchi DEBUGOUT("Hardware not supported\n");
48175eba5b6SRobert Mustacchi ret_val = -E1000_ERR_CONFIG;
48275eba5b6SRobert Mustacchi break;
48375eba5b6SRobert Mustacchi }
48475eba5b6SRobert Mustacchi
48575eba5b6SRobert Mustacchi /*
48675eba5b6SRobert Mustacchi * Initialize the rest of the function pointers. These require some
48775eba5b6SRobert Mustacchi * register reads/writes in some cases.
48875eba5b6SRobert Mustacchi */
48975eba5b6SRobert Mustacchi if (!(ret_val) && init_device) {
49075eba5b6SRobert Mustacchi ret_val = e1000_init_mac_params(hw);
49175eba5b6SRobert Mustacchi if (ret_val)
49275eba5b6SRobert Mustacchi goto out;
49375eba5b6SRobert Mustacchi
49475eba5b6SRobert Mustacchi ret_val = e1000_init_nvm_params(hw);
49575eba5b6SRobert Mustacchi if (ret_val)
49675eba5b6SRobert Mustacchi goto out;
49775eba5b6SRobert Mustacchi
49875eba5b6SRobert Mustacchi ret_val = e1000_init_phy_params(hw);
49975eba5b6SRobert Mustacchi if (ret_val)
50075eba5b6SRobert Mustacchi goto out;
50175eba5b6SRobert Mustacchi
50275eba5b6SRobert Mustacchi ret_val = e1000_init_mbx_params(hw);
50375eba5b6SRobert Mustacchi if (ret_val)
50475eba5b6SRobert Mustacchi goto out;
50575eba5b6SRobert Mustacchi }
50675eba5b6SRobert Mustacchi
50775eba5b6SRobert Mustacchi out:
50875eba5b6SRobert Mustacchi return ret_val;
50975eba5b6SRobert Mustacchi }
51075eba5b6SRobert Mustacchi
51175eba5b6SRobert Mustacchi /**
51275eba5b6SRobert Mustacchi * e1000_get_bus_info - Obtain bus information for adapter
51375eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
51475eba5b6SRobert Mustacchi *
51575eba5b6SRobert Mustacchi * This will obtain information about the HW bus for which the
51675eba5b6SRobert Mustacchi * adapter is attached and stores it in the hw structure. This is a
51775eba5b6SRobert Mustacchi * function pointer entry point called by drivers.
51875eba5b6SRobert Mustacchi **/
e1000_get_bus_info(struct e1000_hw * hw)51975eba5b6SRobert Mustacchi s32 e1000_get_bus_info(struct e1000_hw *hw)
52075eba5b6SRobert Mustacchi {
52175eba5b6SRobert Mustacchi if (hw->mac.ops.get_bus_info)
52275eba5b6SRobert Mustacchi return hw->mac.ops.get_bus_info(hw);
52375eba5b6SRobert Mustacchi
52475eba5b6SRobert Mustacchi return E1000_SUCCESS;
52575eba5b6SRobert Mustacchi }
52675eba5b6SRobert Mustacchi
52775eba5b6SRobert Mustacchi /**
52875eba5b6SRobert Mustacchi * e1000_clear_vfta - Clear VLAN filter table
52975eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
53075eba5b6SRobert Mustacchi *
53175eba5b6SRobert Mustacchi * This clears the VLAN filter table on the adapter. This is a function
53275eba5b6SRobert Mustacchi * pointer entry point called by drivers.
53375eba5b6SRobert Mustacchi **/
e1000_clear_vfta(struct e1000_hw * hw)53475eba5b6SRobert Mustacchi void e1000_clear_vfta(struct e1000_hw *hw)
53575eba5b6SRobert Mustacchi {
53675eba5b6SRobert Mustacchi if (hw->mac.ops.clear_vfta)
53775eba5b6SRobert Mustacchi hw->mac.ops.clear_vfta(hw);
53875eba5b6SRobert Mustacchi }
53975eba5b6SRobert Mustacchi
54075eba5b6SRobert Mustacchi /**
54175eba5b6SRobert Mustacchi * e1000_write_vfta - Write value to VLAN filter table
54275eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
54375eba5b6SRobert Mustacchi * @offset: the 32-bit offset in which to write the value to.
54475eba5b6SRobert Mustacchi * @value: the 32-bit value to write at location offset.
54575eba5b6SRobert Mustacchi *
54675eba5b6SRobert Mustacchi * This writes a 32-bit value to a 32-bit offset in the VLAN filter
54775eba5b6SRobert Mustacchi * table. This is a function pointer entry point called by drivers.
54875eba5b6SRobert Mustacchi **/
e1000_write_vfta(struct e1000_hw * hw,u32 offset,u32 value)54975eba5b6SRobert Mustacchi void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
55075eba5b6SRobert Mustacchi {
55175eba5b6SRobert Mustacchi if (hw->mac.ops.write_vfta)
55275eba5b6SRobert Mustacchi hw->mac.ops.write_vfta(hw, offset, value);
55375eba5b6SRobert Mustacchi }
55475eba5b6SRobert Mustacchi
55575eba5b6SRobert Mustacchi /**
55675eba5b6SRobert Mustacchi * e1000_update_mc_addr_list - Update Multicast addresses
55775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
55875eba5b6SRobert Mustacchi * @mc_addr_list: array of multicast addresses to program
55975eba5b6SRobert Mustacchi * @mc_addr_count: number of multicast addresses to program
56075eba5b6SRobert Mustacchi *
56175eba5b6SRobert Mustacchi * Updates the Multicast Table Array.
56275eba5b6SRobert Mustacchi * The caller must have a packed mc_addr_list of multicast addresses.
56375eba5b6SRobert Mustacchi **/
e1000_update_mc_addr_list(struct e1000_hw * hw,u8 * mc_addr_list,u32 mc_addr_count)56475eba5b6SRobert Mustacchi void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
56575eba5b6SRobert Mustacchi u32 mc_addr_count)
56675eba5b6SRobert Mustacchi {
56775eba5b6SRobert Mustacchi if (hw->mac.ops.update_mc_addr_list)
56875eba5b6SRobert Mustacchi hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
56975eba5b6SRobert Mustacchi mc_addr_count);
57075eba5b6SRobert Mustacchi }
57175eba5b6SRobert Mustacchi
57275eba5b6SRobert Mustacchi /**
57375eba5b6SRobert Mustacchi * e1000_force_mac_fc - Force MAC flow control
57475eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
57575eba5b6SRobert Mustacchi *
57675eba5b6SRobert Mustacchi * Force the MAC's flow control settings. Currently no func pointer exists
57775eba5b6SRobert Mustacchi * and all implementations are handled in the generic version of this
57875eba5b6SRobert Mustacchi * function.
57975eba5b6SRobert Mustacchi **/
e1000_force_mac_fc(struct e1000_hw * hw)58075eba5b6SRobert Mustacchi s32 e1000_force_mac_fc(struct e1000_hw *hw)
58175eba5b6SRobert Mustacchi {
58275eba5b6SRobert Mustacchi return e1000_force_mac_fc_generic(hw);
58375eba5b6SRobert Mustacchi }
58475eba5b6SRobert Mustacchi
58575eba5b6SRobert Mustacchi /**
58675eba5b6SRobert Mustacchi * e1000_check_for_link - Check/Store link connection
58775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
58875eba5b6SRobert Mustacchi *
58975eba5b6SRobert Mustacchi * This checks the link condition of the adapter and stores the
59075eba5b6SRobert Mustacchi * results in the hw->mac structure. This is a function pointer entry
59175eba5b6SRobert Mustacchi * point called by drivers.
59275eba5b6SRobert Mustacchi **/
e1000_check_for_link(struct e1000_hw * hw)59375eba5b6SRobert Mustacchi s32 e1000_check_for_link(struct e1000_hw *hw)
59475eba5b6SRobert Mustacchi {
59575eba5b6SRobert Mustacchi if (hw->mac.ops.check_for_link)
59675eba5b6SRobert Mustacchi return hw->mac.ops.check_for_link(hw);
59775eba5b6SRobert Mustacchi
59875eba5b6SRobert Mustacchi return -E1000_ERR_CONFIG;
59975eba5b6SRobert Mustacchi }
60075eba5b6SRobert Mustacchi
60175eba5b6SRobert Mustacchi /**
60275eba5b6SRobert Mustacchi * e1000_check_mng_mode - Check management mode
60375eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
60475eba5b6SRobert Mustacchi *
60575eba5b6SRobert Mustacchi * This checks if the adapter has manageability enabled.
60675eba5b6SRobert Mustacchi * This is a function pointer entry point called by drivers.
60775eba5b6SRobert Mustacchi **/
e1000_check_mng_mode(struct e1000_hw * hw)60875eba5b6SRobert Mustacchi bool e1000_check_mng_mode(struct e1000_hw *hw)
60975eba5b6SRobert Mustacchi {
61075eba5b6SRobert Mustacchi if (hw->mac.ops.check_mng_mode)
61175eba5b6SRobert Mustacchi return hw->mac.ops.check_mng_mode(hw);
61275eba5b6SRobert Mustacchi
61375eba5b6SRobert Mustacchi return FALSE;
61475eba5b6SRobert Mustacchi }
61575eba5b6SRobert Mustacchi
61675eba5b6SRobert Mustacchi /**
61775eba5b6SRobert Mustacchi * e1000_mng_write_dhcp_info - Writes DHCP info to host interface
61875eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
61975eba5b6SRobert Mustacchi * @buffer: pointer to the host interface
62075eba5b6SRobert Mustacchi * @length: size of the buffer
62175eba5b6SRobert Mustacchi *
62275eba5b6SRobert Mustacchi * Writes the DHCP information to the host interface.
62375eba5b6SRobert Mustacchi **/
e1000_mng_write_dhcp_info(struct e1000_hw * hw,u8 * buffer,u16 length)62475eba5b6SRobert Mustacchi s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
62575eba5b6SRobert Mustacchi {
62675eba5b6SRobert Mustacchi return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
62775eba5b6SRobert Mustacchi }
62875eba5b6SRobert Mustacchi
62975eba5b6SRobert Mustacchi /**
63075eba5b6SRobert Mustacchi * e1000_reset_hw - Reset hardware
63175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
63275eba5b6SRobert Mustacchi *
63375eba5b6SRobert Mustacchi * This resets the hardware into a known state. This is a function pointer
63475eba5b6SRobert Mustacchi * entry point called by drivers.
63575eba5b6SRobert Mustacchi **/
e1000_reset_hw(struct e1000_hw * hw)63675eba5b6SRobert Mustacchi s32 e1000_reset_hw(struct e1000_hw *hw)
63775eba5b6SRobert Mustacchi {
63875eba5b6SRobert Mustacchi if (hw->mac.ops.reset_hw)
63975eba5b6SRobert Mustacchi return hw->mac.ops.reset_hw(hw);
64075eba5b6SRobert Mustacchi
64175eba5b6SRobert Mustacchi return -E1000_ERR_CONFIG;
64275eba5b6SRobert Mustacchi }
64375eba5b6SRobert Mustacchi
64475eba5b6SRobert Mustacchi /**
64575eba5b6SRobert Mustacchi * e1000_init_hw - Initialize hardware
64675eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
64775eba5b6SRobert Mustacchi *
64875eba5b6SRobert Mustacchi * This inits the hardware readying it for operation. This is a function
64975eba5b6SRobert Mustacchi * pointer entry point called by drivers.
65075eba5b6SRobert Mustacchi **/
e1000_init_hw(struct e1000_hw * hw)65175eba5b6SRobert Mustacchi s32 e1000_init_hw(struct e1000_hw *hw)
65275eba5b6SRobert Mustacchi {
65375eba5b6SRobert Mustacchi if (hw->mac.ops.init_hw)
65475eba5b6SRobert Mustacchi return hw->mac.ops.init_hw(hw);
65575eba5b6SRobert Mustacchi
65675eba5b6SRobert Mustacchi return -E1000_ERR_CONFIG;
65775eba5b6SRobert Mustacchi }
65875eba5b6SRobert Mustacchi
65975eba5b6SRobert Mustacchi /**
66075eba5b6SRobert Mustacchi * e1000_setup_link - Configures link and flow control
66175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
66275eba5b6SRobert Mustacchi *
66375eba5b6SRobert Mustacchi * This configures link and flow control settings for the adapter. This
66475eba5b6SRobert Mustacchi * is a function pointer entry point called by drivers. While modules can
66575eba5b6SRobert Mustacchi * also call this, they probably call their own version of this function.
66675eba5b6SRobert Mustacchi **/
e1000_setup_link(struct e1000_hw * hw)66775eba5b6SRobert Mustacchi s32 e1000_setup_link(struct e1000_hw *hw)
66875eba5b6SRobert Mustacchi {
66975eba5b6SRobert Mustacchi if (hw->mac.ops.setup_link)
67075eba5b6SRobert Mustacchi return hw->mac.ops.setup_link(hw);
67175eba5b6SRobert Mustacchi
67275eba5b6SRobert Mustacchi return -E1000_ERR_CONFIG;
67375eba5b6SRobert Mustacchi }
67475eba5b6SRobert Mustacchi
67575eba5b6SRobert Mustacchi /**
67675eba5b6SRobert Mustacchi * e1000_get_speed_and_duplex - Returns current speed and duplex
67775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
67875eba5b6SRobert Mustacchi * @speed: pointer to a 16-bit value to store the speed
67975eba5b6SRobert Mustacchi * @duplex: pointer to a 16-bit value to store the duplex.
68075eba5b6SRobert Mustacchi *
68175eba5b6SRobert Mustacchi * This returns the speed and duplex of the adapter in the two 'out'
68275eba5b6SRobert Mustacchi * variables passed in. This is a function pointer entry point called
68375eba5b6SRobert Mustacchi * by drivers.
68475eba5b6SRobert Mustacchi **/
e1000_get_speed_and_duplex(struct e1000_hw * hw,u16 * speed,u16 * duplex)68575eba5b6SRobert Mustacchi s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
68675eba5b6SRobert Mustacchi {
68775eba5b6SRobert Mustacchi if (hw->mac.ops.get_link_up_info)
68875eba5b6SRobert Mustacchi return hw->mac.ops.get_link_up_info(hw, speed, duplex);
68975eba5b6SRobert Mustacchi
69075eba5b6SRobert Mustacchi return -E1000_ERR_CONFIG;
69175eba5b6SRobert Mustacchi }
69275eba5b6SRobert Mustacchi
69375eba5b6SRobert Mustacchi /**
69475eba5b6SRobert Mustacchi * e1000_setup_led - Configures SW controllable LED
69575eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
69675eba5b6SRobert Mustacchi *
69775eba5b6SRobert Mustacchi * This prepares the SW controllable LED for use and saves the current state
69875eba5b6SRobert Mustacchi * of the LED so it can be later restored. This is a function pointer entry
69975eba5b6SRobert Mustacchi * point called by drivers.
70075eba5b6SRobert Mustacchi **/
e1000_setup_led(struct e1000_hw * hw)70175eba5b6SRobert Mustacchi s32 e1000_setup_led(struct e1000_hw *hw)
70275eba5b6SRobert Mustacchi {
70375eba5b6SRobert Mustacchi if (hw->mac.ops.setup_led)
70475eba5b6SRobert Mustacchi return hw->mac.ops.setup_led(hw);
70575eba5b6SRobert Mustacchi
70675eba5b6SRobert Mustacchi return E1000_SUCCESS;
70775eba5b6SRobert Mustacchi }
70875eba5b6SRobert Mustacchi
70975eba5b6SRobert Mustacchi /**
71075eba5b6SRobert Mustacchi * e1000_cleanup_led - Restores SW controllable LED
71175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
71275eba5b6SRobert Mustacchi *
71375eba5b6SRobert Mustacchi * This restores the SW controllable LED to the value saved off by
71475eba5b6SRobert Mustacchi * e1000_setup_led. This is a function pointer entry point called by drivers.
71575eba5b6SRobert Mustacchi **/
e1000_cleanup_led(struct e1000_hw * hw)71675eba5b6SRobert Mustacchi s32 e1000_cleanup_led(struct e1000_hw *hw)
71775eba5b6SRobert Mustacchi {
71875eba5b6SRobert Mustacchi if (hw->mac.ops.cleanup_led)
71975eba5b6SRobert Mustacchi return hw->mac.ops.cleanup_led(hw);
72075eba5b6SRobert Mustacchi
72175eba5b6SRobert Mustacchi return E1000_SUCCESS;
72275eba5b6SRobert Mustacchi }
72375eba5b6SRobert Mustacchi
72475eba5b6SRobert Mustacchi /**
72575eba5b6SRobert Mustacchi * e1000_blink_led - Blink SW controllable LED
72675eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
72775eba5b6SRobert Mustacchi *
72875eba5b6SRobert Mustacchi * This starts the adapter LED blinking. Request the LED to be setup first
72975eba5b6SRobert Mustacchi * and cleaned up after. This is a function pointer entry point called by
73075eba5b6SRobert Mustacchi * drivers.
73175eba5b6SRobert Mustacchi **/
e1000_blink_led(struct e1000_hw * hw)73275eba5b6SRobert Mustacchi s32 e1000_blink_led(struct e1000_hw *hw)
73375eba5b6SRobert Mustacchi {
73475eba5b6SRobert Mustacchi if (hw->mac.ops.blink_led)
73575eba5b6SRobert Mustacchi return hw->mac.ops.blink_led(hw);
73675eba5b6SRobert Mustacchi
73775eba5b6SRobert Mustacchi return E1000_SUCCESS;
73875eba5b6SRobert Mustacchi }
73975eba5b6SRobert Mustacchi
74075eba5b6SRobert Mustacchi /**
74175eba5b6SRobert Mustacchi * e1000_id_led_init - store LED configurations in SW
74275eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
74375eba5b6SRobert Mustacchi *
74475eba5b6SRobert Mustacchi * Initializes the LED config in SW. This is a function pointer entry point
74575eba5b6SRobert Mustacchi * called by drivers.
74675eba5b6SRobert Mustacchi **/
e1000_id_led_init(struct e1000_hw * hw)74775eba5b6SRobert Mustacchi s32 e1000_id_led_init(struct e1000_hw *hw)
74875eba5b6SRobert Mustacchi {
74975eba5b6SRobert Mustacchi if (hw->mac.ops.id_led_init)
75075eba5b6SRobert Mustacchi return hw->mac.ops.id_led_init(hw);
75175eba5b6SRobert Mustacchi
75275eba5b6SRobert Mustacchi return E1000_SUCCESS;
75375eba5b6SRobert Mustacchi }
75475eba5b6SRobert Mustacchi
75575eba5b6SRobert Mustacchi /**
75675eba5b6SRobert Mustacchi * e1000_led_on - Turn on SW controllable LED
75775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
75875eba5b6SRobert Mustacchi *
75975eba5b6SRobert Mustacchi * Turns the SW defined LED on. This is a function pointer entry point
76075eba5b6SRobert Mustacchi * called by drivers.
76175eba5b6SRobert Mustacchi **/
e1000_led_on(struct e1000_hw * hw)76275eba5b6SRobert Mustacchi s32 e1000_led_on(struct e1000_hw *hw)
76375eba5b6SRobert Mustacchi {
76475eba5b6SRobert Mustacchi if (hw->mac.ops.led_on)
76575eba5b6SRobert Mustacchi return hw->mac.ops.led_on(hw);
76675eba5b6SRobert Mustacchi
76775eba5b6SRobert Mustacchi return E1000_SUCCESS;
76875eba5b6SRobert Mustacchi }
76975eba5b6SRobert Mustacchi
77075eba5b6SRobert Mustacchi /**
77175eba5b6SRobert Mustacchi * e1000_led_off - Turn off SW controllable LED
77275eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
77375eba5b6SRobert Mustacchi *
77475eba5b6SRobert Mustacchi * Turns the SW defined LED off. This is a function pointer entry point
77575eba5b6SRobert Mustacchi * called by drivers.
77675eba5b6SRobert Mustacchi **/
e1000_led_off(struct e1000_hw * hw)77775eba5b6SRobert Mustacchi s32 e1000_led_off(struct e1000_hw *hw)
77875eba5b6SRobert Mustacchi {
77975eba5b6SRobert Mustacchi if (hw->mac.ops.led_off)
78075eba5b6SRobert Mustacchi return hw->mac.ops.led_off(hw);
78175eba5b6SRobert Mustacchi
78275eba5b6SRobert Mustacchi return E1000_SUCCESS;
78375eba5b6SRobert Mustacchi }
78475eba5b6SRobert Mustacchi
78575eba5b6SRobert Mustacchi /**
78675eba5b6SRobert Mustacchi * e1000_reset_adaptive - Reset adaptive IFS
78775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
78875eba5b6SRobert Mustacchi *
78975eba5b6SRobert Mustacchi * Resets the adaptive IFS. Currently no func pointer exists and all
79075eba5b6SRobert Mustacchi * implementations are handled in the generic version of this function.
79175eba5b6SRobert Mustacchi **/
e1000_reset_adaptive(struct e1000_hw * hw)79275eba5b6SRobert Mustacchi void e1000_reset_adaptive(struct e1000_hw *hw)
79375eba5b6SRobert Mustacchi {
79475eba5b6SRobert Mustacchi e1000_reset_adaptive_generic(hw);
79575eba5b6SRobert Mustacchi }
79675eba5b6SRobert Mustacchi
79775eba5b6SRobert Mustacchi /**
79875eba5b6SRobert Mustacchi * e1000_update_adaptive - Update adaptive IFS
79975eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
80075eba5b6SRobert Mustacchi *
80175eba5b6SRobert Mustacchi * Updates adapter IFS. Currently no func pointer exists and all
80275eba5b6SRobert Mustacchi * implementations are handled in the generic version of this function.
80375eba5b6SRobert Mustacchi **/
e1000_update_adaptive(struct e1000_hw * hw)80475eba5b6SRobert Mustacchi void e1000_update_adaptive(struct e1000_hw *hw)
80575eba5b6SRobert Mustacchi {
80675eba5b6SRobert Mustacchi e1000_update_adaptive_generic(hw);
80775eba5b6SRobert Mustacchi }
80875eba5b6SRobert Mustacchi
80975eba5b6SRobert Mustacchi /**
81075eba5b6SRobert Mustacchi * e1000_disable_pcie_master - Disable PCI-Express master access
81175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
81275eba5b6SRobert Mustacchi *
81375eba5b6SRobert Mustacchi * Disables PCI-Express master access and verifies there are no pending
81475eba5b6SRobert Mustacchi * requests. Currently no func pointer exists and all implementations are
81575eba5b6SRobert Mustacchi * handled in the generic version of this function.
81675eba5b6SRobert Mustacchi **/
e1000_disable_pcie_master(struct e1000_hw * hw)81775eba5b6SRobert Mustacchi s32 e1000_disable_pcie_master(struct e1000_hw *hw)
81875eba5b6SRobert Mustacchi {
81975eba5b6SRobert Mustacchi return e1000_disable_pcie_master_generic(hw);
82075eba5b6SRobert Mustacchi }
82175eba5b6SRobert Mustacchi
82275eba5b6SRobert Mustacchi /**
82375eba5b6SRobert Mustacchi * e1000_config_collision_dist - Configure collision distance
82475eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
82575eba5b6SRobert Mustacchi *
82675eba5b6SRobert Mustacchi * Configures the collision distance to the default value and is used
82775eba5b6SRobert Mustacchi * during link setup.
82875eba5b6SRobert Mustacchi **/
e1000_config_collision_dist(struct e1000_hw * hw)82975eba5b6SRobert Mustacchi void e1000_config_collision_dist(struct e1000_hw *hw)
83075eba5b6SRobert Mustacchi {
83175eba5b6SRobert Mustacchi if (hw->mac.ops.config_collision_dist)
83275eba5b6SRobert Mustacchi hw->mac.ops.config_collision_dist(hw);
83375eba5b6SRobert Mustacchi }
83475eba5b6SRobert Mustacchi
83575eba5b6SRobert Mustacchi /**
83675eba5b6SRobert Mustacchi * e1000_rar_set - Sets a receive address register
83775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
83875eba5b6SRobert Mustacchi * @addr: address to set the RAR to
83975eba5b6SRobert Mustacchi * @index: the RAR to set
84075eba5b6SRobert Mustacchi *
84175eba5b6SRobert Mustacchi * Sets a Receive Address Register (RAR) to the specified address.
84275eba5b6SRobert Mustacchi **/
e1000_rar_set(struct e1000_hw * hw,u8 * addr,u32 index)843c124a83eSRobert Mustacchi int e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
84475eba5b6SRobert Mustacchi {
84575eba5b6SRobert Mustacchi if (hw->mac.ops.rar_set)
846c124a83eSRobert Mustacchi return hw->mac.ops.rar_set(hw, addr, index);
847c124a83eSRobert Mustacchi
848c124a83eSRobert Mustacchi return E1000_SUCCESS;
84975eba5b6SRobert Mustacchi }
85075eba5b6SRobert Mustacchi
85175eba5b6SRobert Mustacchi /**
85275eba5b6SRobert Mustacchi * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
85375eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
85475eba5b6SRobert Mustacchi *
85575eba5b6SRobert Mustacchi * Ensures that the MDI/MDIX SW state is valid.
85675eba5b6SRobert Mustacchi **/
e1000_validate_mdi_setting(struct e1000_hw * hw)85775eba5b6SRobert Mustacchi s32 e1000_validate_mdi_setting(struct e1000_hw *hw)
85875eba5b6SRobert Mustacchi {
85975eba5b6SRobert Mustacchi if (hw->mac.ops.validate_mdi_setting)
86075eba5b6SRobert Mustacchi return hw->mac.ops.validate_mdi_setting(hw);
86175eba5b6SRobert Mustacchi
86275eba5b6SRobert Mustacchi return E1000_SUCCESS;
86375eba5b6SRobert Mustacchi }
86475eba5b6SRobert Mustacchi
86575eba5b6SRobert Mustacchi /**
86675eba5b6SRobert Mustacchi * e1000_hash_mc_addr - Determines address location in multicast table
86775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
86875eba5b6SRobert Mustacchi * @mc_addr: Multicast address to hash.
86975eba5b6SRobert Mustacchi *
87075eba5b6SRobert Mustacchi * This hashes an address to determine its location in the multicast
87175eba5b6SRobert Mustacchi * table. Currently no func pointer exists and all implementations
87275eba5b6SRobert Mustacchi * are handled in the generic version of this function.
87375eba5b6SRobert Mustacchi **/
e1000_hash_mc_addr(struct e1000_hw * hw,u8 * mc_addr)87475eba5b6SRobert Mustacchi u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
87575eba5b6SRobert Mustacchi {
87675eba5b6SRobert Mustacchi return e1000_hash_mc_addr_generic(hw, mc_addr);
87775eba5b6SRobert Mustacchi }
87875eba5b6SRobert Mustacchi
87975eba5b6SRobert Mustacchi /**
88075eba5b6SRobert Mustacchi * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
88175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
88275eba5b6SRobert Mustacchi *
88375eba5b6SRobert Mustacchi * Enables packet filtering on transmit packets if manageability is enabled
88475eba5b6SRobert Mustacchi * and host interface is enabled.
88575eba5b6SRobert Mustacchi * Currently no func pointer exists and all implementations are handled in the
88675eba5b6SRobert Mustacchi * generic version of this function.
88775eba5b6SRobert Mustacchi **/
e1000_enable_tx_pkt_filtering(struct e1000_hw * hw)88875eba5b6SRobert Mustacchi bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
88975eba5b6SRobert Mustacchi {
89075eba5b6SRobert Mustacchi return e1000_enable_tx_pkt_filtering_generic(hw);
89175eba5b6SRobert Mustacchi }
89275eba5b6SRobert Mustacchi
89375eba5b6SRobert Mustacchi /**
89475eba5b6SRobert Mustacchi * e1000_mng_host_if_write - Writes to the manageability host interface
89575eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
89675eba5b6SRobert Mustacchi * @buffer: pointer to the host interface buffer
89775eba5b6SRobert Mustacchi * @length: size of the buffer
89875eba5b6SRobert Mustacchi * @offset: location in the buffer to write to
89975eba5b6SRobert Mustacchi * @sum: sum of the data (not checksum)
90075eba5b6SRobert Mustacchi *
90175eba5b6SRobert Mustacchi * This function writes the buffer content at the offset given on the host if.
90275eba5b6SRobert Mustacchi * It also does alignment considerations to do the writes in most efficient
90375eba5b6SRobert Mustacchi * way. Also fills up the sum of the buffer in *buffer parameter.
90475eba5b6SRobert Mustacchi **/
e1000_mng_host_if_write(struct e1000_hw * hw,u8 * buffer,u16 length,u16 offset,u8 * sum)90575eba5b6SRobert Mustacchi s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
90675eba5b6SRobert Mustacchi u16 offset, u8 *sum)
90775eba5b6SRobert Mustacchi {
90875eba5b6SRobert Mustacchi return e1000_mng_host_if_write_generic(hw, buffer, length, offset, sum);
90975eba5b6SRobert Mustacchi }
91075eba5b6SRobert Mustacchi
91175eba5b6SRobert Mustacchi /**
91275eba5b6SRobert Mustacchi * e1000_mng_write_cmd_header - Writes manageability command header
91375eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
91475eba5b6SRobert Mustacchi * @hdr: pointer to the host interface command header
91575eba5b6SRobert Mustacchi *
91675eba5b6SRobert Mustacchi * Writes the command header after does the checksum calculation.
91775eba5b6SRobert Mustacchi **/
e1000_mng_write_cmd_header(struct e1000_hw * hw,struct e1000_host_mng_command_header * hdr)91875eba5b6SRobert Mustacchi s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
91975eba5b6SRobert Mustacchi struct e1000_host_mng_command_header *hdr)
92075eba5b6SRobert Mustacchi {
92175eba5b6SRobert Mustacchi return e1000_mng_write_cmd_header_generic(hw, hdr);
92275eba5b6SRobert Mustacchi }
92375eba5b6SRobert Mustacchi
92475eba5b6SRobert Mustacchi /**
92575eba5b6SRobert Mustacchi * e1000_mng_enable_host_if - Checks host interface is enabled
92675eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
92775eba5b6SRobert Mustacchi *
92875eba5b6SRobert Mustacchi * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
92975eba5b6SRobert Mustacchi *
93075eba5b6SRobert Mustacchi * This function checks whether the HOST IF is enabled for command operation
93175eba5b6SRobert Mustacchi * and also checks whether the previous command is completed. It busy waits
93275eba5b6SRobert Mustacchi * in case of previous command is not completed.
93375eba5b6SRobert Mustacchi **/
e1000_mng_enable_host_if(struct e1000_hw * hw)93475eba5b6SRobert Mustacchi s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
93575eba5b6SRobert Mustacchi {
93675eba5b6SRobert Mustacchi return e1000_mng_enable_host_if_generic(hw);
93775eba5b6SRobert Mustacchi }
93875eba5b6SRobert Mustacchi
93975eba5b6SRobert Mustacchi /**
94075eba5b6SRobert Mustacchi * e1000_set_obff_timer - Set Optimized Buffer Flush/Fill timer
94175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
94275eba5b6SRobert Mustacchi * @itr: u32 indicating itr value
94375eba5b6SRobert Mustacchi *
94475eba5b6SRobert Mustacchi * Set the OBFF timer based on the given interrupt rate.
94575eba5b6SRobert Mustacchi **/
e1000_set_obff_timer(struct e1000_hw * hw,u32 itr)94675eba5b6SRobert Mustacchi s32 e1000_set_obff_timer(struct e1000_hw *hw, u32 itr)
94775eba5b6SRobert Mustacchi {
94875eba5b6SRobert Mustacchi if (hw->mac.ops.set_obff_timer)
94975eba5b6SRobert Mustacchi return hw->mac.ops.set_obff_timer(hw, itr);
95075eba5b6SRobert Mustacchi
95175eba5b6SRobert Mustacchi return E1000_SUCCESS;
95275eba5b6SRobert Mustacchi }
95375eba5b6SRobert Mustacchi
95475eba5b6SRobert Mustacchi /**
95575eba5b6SRobert Mustacchi * e1000_check_reset_block - Verifies PHY can be reset
95675eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
95775eba5b6SRobert Mustacchi *
95875eba5b6SRobert Mustacchi * Checks if the PHY is in a state that can be reset or if manageability
95975eba5b6SRobert Mustacchi * has it tied up. This is a function pointer entry point called by drivers.
96075eba5b6SRobert Mustacchi **/
e1000_check_reset_block(struct e1000_hw * hw)96175eba5b6SRobert Mustacchi s32 e1000_check_reset_block(struct e1000_hw *hw)
96275eba5b6SRobert Mustacchi {
96375eba5b6SRobert Mustacchi if (hw->phy.ops.check_reset_block)
96475eba5b6SRobert Mustacchi return hw->phy.ops.check_reset_block(hw);
96575eba5b6SRobert Mustacchi
96675eba5b6SRobert Mustacchi return E1000_SUCCESS;
96775eba5b6SRobert Mustacchi }
96875eba5b6SRobert Mustacchi
96975eba5b6SRobert Mustacchi /**
97075eba5b6SRobert Mustacchi * e1000_read_phy_reg - Reads PHY register
97175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
97275eba5b6SRobert Mustacchi * @offset: the register to read
97375eba5b6SRobert Mustacchi * @data: the buffer to store the 16-bit read.
97475eba5b6SRobert Mustacchi *
97575eba5b6SRobert Mustacchi * Reads the PHY register and returns the value in data.
97675eba5b6SRobert Mustacchi * This is a function pointer entry point called by drivers.
97775eba5b6SRobert Mustacchi **/
e1000_read_phy_reg(struct e1000_hw * hw,u32 offset,u16 * data)97875eba5b6SRobert Mustacchi s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
97975eba5b6SRobert Mustacchi {
98075eba5b6SRobert Mustacchi if (hw->phy.ops.read_reg)
98175eba5b6SRobert Mustacchi return hw->phy.ops.read_reg(hw, offset, data);
98275eba5b6SRobert Mustacchi
98375eba5b6SRobert Mustacchi return E1000_SUCCESS;
98475eba5b6SRobert Mustacchi }
98575eba5b6SRobert Mustacchi
98675eba5b6SRobert Mustacchi /**
98775eba5b6SRobert Mustacchi * e1000_write_phy_reg - Writes PHY register
98875eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
98975eba5b6SRobert Mustacchi * @offset: the register to write
99075eba5b6SRobert Mustacchi * @data: the value to write.
99175eba5b6SRobert Mustacchi *
99275eba5b6SRobert Mustacchi * Writes the PHY register at offset with the value in data.
99375eba5b6SRobert Mustacchi * This is a function pointer entry point called by drivers.
99475eba5b6SRobert Mustacchi **/
e1000_write_phy_reg(struct e1000_hw * hw,u32 offset,u16 data)99575eba5b6SRobert Mustacchi s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
99675eba5b6SRobert Mustacchi {
99775eba5b6SRobert Mustacchi if (hw->phy.ops.write_reg)
99875eba5b6SRobert Mustacchi return hw->phy.ops.write_reg(hw, offset, data);
99975eba5b6SRobert Mustacchi
100075eba5b6SRobert Mustacchi return E1000_SUCCESS;
100175eba5b6SRobert Mustacchi }
100275eba5b6SRobert Mustacchi
100375eba5b6SRobert Mustacchi /**
100475eba5b6SRobert Mustacchi * e1000_release_phy - Generic release PHY
100575eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
100675eba5b6SRobert Mustacchi *
100775eba5b6SRobert Mustacchi * Return if silicon family does not require a semaphore when accessing the
100875eba5b6SRobert Mustacchi * PHY.
100975eba5b6SRobert Mustacchi **/
e1000_release_phy(struct e1000_hw * hw)101075eba5b6SRobert Mustacchi void e1000_release_phy(struct e1000_hw *hw)
101175eba5b6SRobert Mustacchi {
101275eba5b6SRobert Mustacchi if (hw->phy.ops.release)
101375eba5b6SRobert Mustacchi hw->phy.ops.release(hw);
101475eba5b6SRobert Mustacchi }
101575eba5b6SRobert Mustacchi
101675eba5b6SRobert Mustacchi /**
101775eba5b6SRobert Mustacchi * e1000_acquire_phy - Generic acquire PHY
101875eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
101975eba5b6SRobert Mustacchi *
102075eba5b6SRobert Mustacchi * Return success if silicon family does not require a semaphore when
102175eba5b6SRobert Mustacchi * accessing the PHY.
102275eba5b6SRobert Mustacchi **/
e1000_acquire_phy(struct e1000_hw * hw)102375eba5b6SRobert Mustacchi s32 e1000_acquire_phy(struct e1000_hw *hw)
102475eba5b6SRobert Mustacchi {
102575eba5b6SRobert Mustacchi if (hw->phy.ops.acquire)
102675eba5b6SRobert Mustacchi return hw->phy.ops.acquire(hw);
102775eba5b6SRobert Mustacchi
102875eba5b6SRobert Mustacchi return E1000_SUCCESS;
102975eba5b6SRobert Mustacchi }
103075eba5b6SRobert Mustacchi
103175eba5b6SRobert Mustacchi /**
103275eba5b6SRobert Mustacchi * e1000_cfg_on_link_up - Configure PHY upon link up
103375eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
103475eba5b6SRobert Mustacchi **/
e1000_cfg_on_link_up(struct e1000_hw * hw)103575eba5b6SRobert Mustacchi s32 e1000_cfg_on_link_up(struct e1000_hw *hw)
103675eba5b6SRobert Mustacchi {
103775eba5b6SRobert Mustacchi if (hw->phy.ops.cfg_on_link_up)
103875eba5b6SRobert Mustacchi return hw->phy.ops.cfg_on_link_up(hw);
103975eba5b6SRobert Mustacchi
104075eba5b6SRobert Mustacchi return E1000_SUCCESS;
104175eba5b6SRobert Mustacchi }
104275eba5b6SRobert Mustacchi
104375eba5b6SRobert Mustacchi /**
104475eba5b6SRobert Mustacchi * e1000_read_kmrn_reg - Reads register using Kumeran interface
104575eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
104675eba5b6SRobert Mustacchi * @offset: the register to read
104775eba5b6SRobert Mustacchi * @data: the location to store the 16-bit value read.
104875eba5b6SRobert Mustacchi *
104975eba5b6SRobert Mustacchi * Reads a register out of the Kumeran interface. Currently no func pointer
105075eba5b6SRobert Mustacchi * exists and all implementations are handled in the generic version of
105175eba5b6SRobert Mustacchi * this function.
105275eba5b6SRobert Mustacchi **/
e1000_read_kmrn_reg(struct e1000_hw * hw,u32 offset,u16 * data)105375eba5b6SRobert Mustacchi s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
105475eba5b6SRobert Mustacchi {
105575eba5b6SRobert Mustacchi return e1000_read_kmrn_reg_generic(hw, offset, data);
105675eba5b6SRobert Mustacchi }
105775eba5b6SRobert Mustacchi
105875eba5b6SRobert Mustacchi /**
105975eba5b6SRobert Mustacchi * e1000_write_kmrn_reg - Writes register using Kumeran interface
106075eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
106175eba5b6SRobert Mustacchi * @offset: the register to write
106275eba5b6SRobert Mustacchi * @data: the value to write.
106375eba5b6SRobert Mustacchi *
106475eba5b6SRobert Mustacchi * Writes a register to the Kumeran interface. Currently no func pointer
106575eba5b6SRobert Mustacchi * exists and all implementations are handled in the generic version of
106675eba5b6SRobert Mustacchi * this function.
106775eba5b6SRobert Mustacchi **/
e1000_write_kmrn_reg(struct e1000_hw * hw,u32 offset,u16 data)106875eba5b6SRobert Mustacchi s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
106975eba5b6SRobert Mustacchi {
107075eba5b6SRobert Mustacchi return e1000_write_kmrn_reg_generic(hw, offset, data);
107175eba5b6SRobert Mustacchi }
107275eba5b6SRobert Mustacchi
107375eba5b6SRobert Mustacchi /**
107475eba5b6SRobert Mustacchi * e1000_get_cable_length - Retrieves cable length estimation
107575eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
107675eba5b6SRobert Mustacchi *
107775eba5b6SRobert Mustacchi * This function estimates the cable length and stores them in
107875eba5b6SRobert Mustacchi * hw->phy.min_length and hw->phy.max_length. This is a function pointer
107975eba5b6SRobert Mustacchi * entry point called by drivers.
108075eba5b6SRobert Mustacchi **/
e1000_get_cable_length(struct e1000_hw * hw)108175eba5b6SRobert Mustacchi s32 e1000_get_cable_length(struct e1000_hw *hw)
108275eba5b6SRobert Mustacchi {
108375eba5b6SRobert Mustacchi if (hw->phy.ops.get_cable_length)
108475eba5b6SRobert Mustacchi return hw->phy.ops.get_cable_length(hw);
108575eba5b6SRobert Mustacchi
108675eba5b6SRobert Mustacchi return E1000_SUCCESS;
108775eba5b6SRobert Mustacchi }
108875eba5b6SRobert Mustacchi
108975eba5b6SRobert Mustacchi /**
109075eba5b6SRobert Mustacchi * e1000_get_phy_info - Retrieves PHY information from registers
109175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
109275eba5b6SRobert Mustacchi *
109375eba5b6SRobert Mustacchi * This function gets some information from various PHY registers and
109475eba5b6SRobert Mustacchi * populates hw->phy values with it. This is a function pointer entry
109575eba5b6SRobert Mustacchi * point called by drivers.
109675eba5b6SRobert Mustacchi **/
e1000_get_phy_info(struct e1000_hw * hw)109775eba5b6SRobert Mustacchi s32 e1000_get_phy_info(struct e1000_hw *hw)
109875eba5b6SRobert Mustacchi {
109975eba5b6SRobert Mustacchi if (hw->phy.ops.get_info)
110075eba5b6SRobert Mustacchi return hw->phy.ops.get_info(hw);
110175eba5b6SRobert Mustacchi
110275eba5b6SRobert Mustacchi return E1000_SUCCESS;
110375eba5b6SRobert Mustacchi }
110475eba5b6SRobert Mustacchi
110575eba5b6SRobert Mustacchi /**
110675eba5b6SRobert Mustacchi * e1000_phy_hw_reset - Hard PHY reset
110775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
110875eba5b6SRobert Mustacchi *
110975eba5b6SRobert Mustacchi * Performs a hard PHY reset. This is a function pointer entry point called
111075eba5b6SRobert Mustacchi * by drivers.
111175eba5b6SRobert Mustacchi **/
e1000_phy_hw_reset(struct e1000_hw * hw)111275eba5b6SRobert Mustacchi s32 e1000_phy_hw_reset(struct e1000_hw *hw)
111375eba5b6SRobert Mustacchi {
111475eba5b6SRobert Mustacchi if (hw->phy.ops.reset)
111575eba5b6SRobert Mustacchi return hw->phy.ops.reset(hw);
111675eba5b6SRobert Mustacchi
111775eba5b6SRobert Mustacchi return E1000_SUCCESS;
111875eba5b6SRobert Mustacchi }
111975eba5b6SRobert Mustacchi
112075eba5b6SRobert Mustacchi /**
112175eba5b6SRobert Mustacchi * e1000_phy_commit - Soft PHY reset
112275eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
112375eba5b6SRobert Mustacchi *
112475eba5b6SRobert Mustacchi * Performs a soft PHY reset on those that apply. This is a function pointer
112575eba5b6SRobert Mustacchi * entry point called by drivers.
112675eba5b6SRobert Mustacchi **/
e1000_phy_commit(struct e1000_hw * hw)112775eba5b6SRobert Mustacchi s32 e1000_phy_commit(struct e1000_hw *hw)
112875eba5b6SRobert Mustacchi {
112975eba5b6SRobert Mustacchi if (hw->phy.ops.commit)
113075eba5b6SRobert Mustacchi return hw->phy.ops.commit(hw);
113175eba5b6SRobert Mustacchi
113275eba5b6SRobert Mustacchi return E1000_SUCCESS;
113375eba5b6SRobert Mustacchi }
113475eba5b6SRobert Mustacchi
113575eba5b6SRobert Mustacchi /**
113675eba5b6SRobert Mustacchi * e1000_set_d0_lplu_state - Sets low power link up state for D0
113775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
113875eba5b6SRobert Mustacchi * @active: boolean used to enable/disable lplu
113975eba5b6SRobert Mustacchi *
114075eba5b6SRobert Mustacchi * Success returns 0, Failure returns 1
114175eba5b6SRobert Mustacchi *
114275eba5b6SRobert Mustacchi * The low power link up (lplu) state is set to the power management level D0
114375eba5b6SRobert Mustacchi * and SmartSpeed is disabled when active is TRUE, else clear lplu for D0
114475eba5b6SRobert Mustacchi * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
114575eba5b6SRobert Mustacchi * is used during Dx states where the power conservation is most important.
114675eba5b6SRobert Mustacchi * During driver activity, SmartSpeed should be enabled so performance is
114775eba5b6SRobert Mustacchi * maintained. This is a function pointer entry point called by drivers.
114875eba5b6SRobert Mustacchi **/
e1000_set_d0_lplu_state(struct e1000_hw * hw,bool active)114975eba5b6SRobert Mustacchi s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
115075eba5b6SRobert Mustacchi {
115175eba5b6SRobert Mustacchi if (hw->phy.ops.set_d0_lplu_state)
115275eba5b6SRobert Mustacchi return hw->phy.ops.set_d0_lplu_state(hw, active);
115375eba5b6SRobert Mustacchi
115475eba5b6SRobert Mustacchi return E1000_SUCCESS;
115575eba5b6SRobert Mustacchi }
115675eba5b6SRobert Mustacchi
115775eba5b6SRobert Mustacchi /**
115875eba5b6SRobert Mustacchi * e1000_set_d3_lplu_state - Sets low power link up state for D3
115975eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
116075eba5b6SRobert Mustacchi * @active: boolean used to enable/disable lplu
116175eba5b6SRobert Mustacchi *
116275eba5b6SRobert Mustacchi * Success returns 0, Failure returns 1
116375eba5b6SRobert Mustacchi *
116475eba5b6SRobert Mustacchi * The low power link up (lplu) state is set to the power management level D3
116575eba5b6SRobert Mustacchi * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3
116675eba5b6SRobert Mustacchi * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
116775eba5b6SRobert Mustacchi * is used during Dx states where the power conservation is most important.
116875eba5b6SRobert Mustacchi * During driver activity, SmartSpeed should be enabled so performance is
116975eba5b6SRobert Mustacchi * maintained. This is a function pointer entry point called by drivers.
117075eba5b6SRobert Mustacchi **/
e1000_set_d3_lplu_state(struct e1000_hw * hw,bool active)117175eba5b6SRobert Mustacchi s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
117275eba5b6SRobert Mustacchi {
117375eba5b6SRobert Mustacchi if (hw->phy.ops.set_d3_lplu_state)
117475eba5b6SRobert Mustacchi return hw->phy.ops.set_d3_lplu_state(hw, active);
117575eba5b6SRobert Mustacchi
117675eba5b6SRobert Mustacchi return E1000_SUCCESS;
117775eba5b6SRobert Mustacchi }
117875eba5b6SRobert Mustacchi
117975eba5b6SRobert Mustacchi /**
118075eba5b6SRobert Mustacchi * e1000_read_mac_addr - Reads MAC address
118175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
118275eba5b6SRobert Mustacchi *
118375eba5b6SRobert Mustacchi * Reads the MAC address out of the adapter and stores it in the HW structure.
118475eba5b6SRobert Mustacchi * Currently no func pointer exists and all implementations are handled in the
118575eba5b6SRobert Mustacchi * generic version of this function.
118675eba5b6SRobert Mustacchi **/
e1000_read_mac_addr(struct e1000_hw * hw)118775eba5b6SRobert Mustacchi s32 e1000_read_mac_addr(struct e1000_hw *hw)
118875eba5b6SRobert Mustacchi {
118975eba5b6SRobert Mustacchi if (hw->mac.ops.read_mac_addr)
119075eba5b6SRobert Mustacchi return hw->mac.ops.read_mac_addr(hw);
119175eba5b6SRobert Mustacchi
119275eba5b6SRobert Mustacchi return e1000_read_mac_addr_generic(hw);
119375eba5b6SRobert Mustacchi }
119475eba5b6SRobert Mustacchi
119575eba5b6SRobert Mustacchi /**
119675eba5b6SRobert Mustacchi * e1000_read_pba_string - Read device part number string
119775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
119875eba5b6SRobert Mustacchi * @pba_num: pointer to device part number
119975eba5b6SRobert Mustacchi * @pba_num_size: size of part number buffer
120075eba5b6SRobert Mustacchi *
120175eba5b6SRobert Mustacchi * Reads the product board assembly (PBA) number from the EEPROM and stores
120275eba5b6SRobert Mustacchi * the value in pba_num.
120375eba5b6SRobert Mustacchi * Currently no func pointer exists and all implementations are handled in the
120475eba5b6SRobert Mustacchi * generic version of this function.
120575eba5b6SRobert Mustacchi **/
e1000_read_pba_string(struct e1000_hw * hw,u8 * pba_num,u32 pba_num_size)120675eba5b6SRobert Mustacchi s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size)
120775eba5b6SRobert Mustacchi {
120875eba5b6SRobert Mustacchi return e1000_read_pba_string_generic(hw, pba_num, pba_num_size);
120975eba5b6SRobert Mustacchi }
121075eba5b6SRobert Mustacchi
121175eba5b6SRobert Mustacchi /**
121275eba5b6SRobert Mustacchi * e1000_read_pba_length - Read device part number string length
121375eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
121475eba5b6SRobert Mustacchi * @pba_num_size: size of part number buffer
121575eba5b6SRobert Mustacchi *
121675eba5b6SRobert Mustacchi * Reads the product board assembly (PBA) number length from the EEPROM and
121775eba5b6SRobert Mustacchi * stores the value in pba_num.
121875eba5b6SRobert Mustacchi * Currently no func pointer exists and all implementations are handled in the
121975eba5b6SRobert Mustacchi * generic version of this function.
122075eba5b6SRobert Mustacchi **/
e1000_read_pba_length(struct e1000_hw * hw,u32 * pba_num_size)122175eba5b6SRobert Mustacchi s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size)
122275eba5b6SRobert Mustacchi {
122375eba5b6SRobert Mustacchi return e1000_read_pba_length_generic(hw, pba_num_size);
122475eba5b6SRobert Mustacchi }
122575eba5b6SRobert Mustacchi
122675eba5b6SRobert Mustacchi /**
122775eba5b6SRobert Mustacchi * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
122875eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
122975eba5b6SRobert Mustacchi *
123075eba5b6SRobert Mustacchi * Validates the NVM checksum is correct. This is a function pointer entry
123175eba5b6SRobert Mustacchi * point called by drivers.
123275eba5b6SRobert Mustacchi **/
e1000_validate_nvm_checksum(struct e1000_hw * hw)123375eba5b6SRobert Mustacchi s32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
123475eba5b6SRobert Mustacchi {
123575eba5b6SRobert Mustacchi if (hw->nvm.ops.validate)
123675eba5b6SRobert Mustacchi return hw->nvm.ops.validate(hw);
123775eba5b6SRobert Mustacchi
123875eba5b6SRobert Mustacchi return -E1000_ERR_CONFIG;
123975eba5b6SRobert Mustacchi }
124075eba5b6SRobert Mustacchi
124175eba5b6SRobert Mustacchi /**
124275eba5b6SRobert Mustacchi * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
124375eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
124475eba5b6SRobert Mustacchi *
124575eba5b6SRobert Mustacchi * Updates the NVM checksum. Currently no func pointer exists and all
124675eba5b6SRobert Mustacchi * implementations are handled in the generic version of this function.
124775eba5b6SRobert Mustacchi **/
e1000_update_nvm_checksum(struct e1000_hw * hw)124875eba5b6SRobert Mustacchi s32 e1000_update_nvm_checksum(struct e1000_hw *hw)
124975eba5b6SRobert Mustacchi {
125075eba5b6SRobert Mustacchi if (hw->nvm.ops.update)
125175eba5b6SRobert Mustacchi return hw->nvm.ops.update(hw);
125275eba5b6SRobert Mustacchi
125375eba5b6SRobert Mustacchi return -E1000_ERR_CONFIG;
125475eba5b6SRobert Mustacchi }
125575eba5b6SRobert Mustacchi
125675eba5b6SRobert Mustacchi /**
125775eba5b6SRobert Mustacchi * e1000_reload_nvm - Reloads EEPROM
125875eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
125975eba5b6SRobert Mustacchi *
126075eba5b6SRobert Mustacchi * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
126175eba5b6SRobert Mustacchi * extended control register.
126275eba5b6SRobert Mustacchi **/
e1000_reload_nvm(struct e1000_hw * hw)126375eba5b6SRobert Mustacchi void e1000_reload_nvm(struct e1000_hw *hw)
126475eba5b6SRobert Mustacchi {
126575eba5b6SRobert Mustacchi if (hw->nvm.ops.reload)
126675eba5b6SRobert Mustacchi hw->nvm.ops.reload(hw);
126775eba5b6SRobert Mustacchi }
126875eba5b6SRobert Mustacchi
126975eba5b6SRobert Mustacchi /**
127075eba5b6SRobert Mustacchi * e1000_read_nvm - Reads NVM (EEPROM)
127175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
127275eba5b6SRobert Mustacchi * @offset: the word offset to read
127375eba5b6SRobert Mustacchi * @words: number of 16-bit words to read
127475eba5b6SRobert Mustacchi * @data: pointer to the properly sized buffer for the data.
127575eba5b6SRobert Mustacchi *
127675eba5b6SRobert Mustacchi * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
127775eba5b6SRobert Mustacchi * pointer entry point called by drivers.
127875eba5b6SRobert Mustacchi **/
e1000_read_nvm(struct e1000_hw * hw,u16 offset,u16 words,u16 * data)127975eba5b6SRobert Mustacchi s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
128075eba5b6SRobert Mustacchi {
128175eba5b6SRobert Mustacchi if (hw->nvm.ops.read)
128275eba5b6SRobert Mustacchi return hw->nvm.ops.read(hw, offset, words, data);
128375eba5b6SRobert Mustacchi
128475eba5b6SRobert Mustacchi return -E1000_ERR_CONFIG;
128575eba5b6SRobert Mustacchi }
128675eba5b6SRobert Mustacchi
128775eba5b6SRobert Mustacchi /**
128875eba5b6SRobert Mustacchi * e1000_write_nvm - Writes to NVM (EEPROM)
128975eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
129075eba5b6SRobert Mustacchi * @offset: the word offset to read
129175eba5b6SRobert Mustacchi * @words: number of 16-bit words to write
129275eba5b6SRobert Mustacchi * @data: pointer to the properly sized buffer for the data.
129375eba5b6SRobert Mustacchi *
129475eba5b6SRobert Mustacchi * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
129575eba5b6SRobert Mustacchi * pointer entry point called by drivers.
129675eba5b6SRobert Mustacchi **/
e1000_write_nvm(struct e1000_hw * hw,u16 offset,u16 words,u16 * data)129775eba5b6SRobert Mustacchi s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
129875eba5b6SRobert Mustacchi {
129975eba5b6SRobert Mustacchi if (hw->nvm.ops.write)
130075eba5b6SRobert Mustacchi return hw->nvm.ops.write(hw, offset, words, data);
130175eba5b6SRobert Mustacchi
130275eba5b6SRobert Mustacchi return E1000_SUCCESS;
130375eba5b6SRobert Mustacchi }
130475eba5b6SRobert Mustacchi
130575eba5b6SRobert Mustacchi /**
130675eba5b6SRobert Mustacchi * e1000_write_8bit_ctrl_reg - Writes 8bit Control register
130775eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
130875eba5b6SRobert Mustacchi * @reg: 32bit register offset
130975eba5b6SRobert Mustacchi * @offset: the register to write
131075eba5b6SRobert Mustacchi * @data: the value to write.
131175eba5b6SRobert Mustacchi *
131275eba5b6SRobert Mustacchi * Writes the PHY register at offset with the value in data.
131375eba5b6SRobert Mustacchi * This is a function pointer entry point called by drivers.
131475eba5b6SRobert Mustacchi **/
e1000_write_8bit_ctrl_reg(struct e1000_hw * hw,u32 reg,u32 offset,u8 data)131575eba5b6SRobert Mustacchi s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
131675eba5b6SRobert Mustacchi u8 data)
131775eba5b6SRobert Mustacchi {
131875eba5b6SRobert Mustacchi return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
131975eba5b6SRobert Mustacchi }
132075eba5b6SRobert Mustacchi
132175eba5b6SRobert Mustacchi /**
132275eba5b6SRobert Mustacchi * e1000_power_up_phy - Restores link in case of PHY power down
132375eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
132475eba5b6SRobert Mustacchi *
132575eba5b6SRobert Mustacchi * The phy may be powered down to save power, to turn off link when the
132675eba5b6SRobert Mustacchi * driver is unloaded, or wake on lan is not enabled (among others).
132775eba5b6SRobert Mustacchi **/
e1000_power_up_phy(struct e1000_hw * hw)132875eba5b6SRobert Mustacchi void e1000_power_up_phy(struct e1000_hw *hw)
132975eba5b6SRobert Mustacchi {
133075eba5b6SRobert Mustacchi if (hw->phy.ops.power_up)
133175eba5b6SRobert Mustacchi hw->phy.ops.power_up(hw);
133275eba5b6SRobert Mustacchi
133375eba5b6SRobert Mustacchi e1000_setup_link(hw);
133475eba5b6SRobert Mustacchi }
133575eba5b6SRobert Mustacchi
133675eba5b6SRobert Mustacchi /**
133775eba5b6SRobert Mustacchi * e1000_power_down_phy - Power down PHY
133875eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
133975eba5b6SRobert Mustacchi *
134075eba5b6SRobert Mustacchi * The phy may be powered down to save power, to turn off link when the
134175eba5b6SRobert Mustacchi * driver is unloaded, or wake on lan is not enabled (among others).
134275eba5b6SRobert Mustacchi **/
e1000_power_down_phy(struct e1000_hw * hw)134375eba5b6SRobert Mustacchi void e1000_power_down_phy(struct e1000_hw *hw)
134475eba5b6SRobert Mustacchi {
134575eba5b6SRobert Mustacchi if (hw->phy.ops.power_down)
134675eba5b6SRobert Mustacchi hw->phy.ops.power_down(hw);
134775eba5b6SRobert Mustacchi }
134875eba5b6SRobert Mustacchi
134975eba5b6SRobert Mustacchi /**
135075eba5b6SRobert Mustacchi * e1000_power_up_fiber_serdes_link - Power up serdes link
135175eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
135275eba5b6SRobert Mustacchi *
135375eba5b6SRobert Mustacchi * Power on the optics and PCS.
135475eba5b6SRobert Mustacchi **/
e1000_power_up_fiber_serdes_link(struct e1000_hw * hw)135575eba5b6SRobert Mustacchi void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw)
135675eba5b6SRobert Mustacchi {
135775eba5b6SRobert Mustacchi if (hw->mac.ops.power_up_serdes)
135875eba5b6SRobert Mustacchi hw->mac.ops.power_up_serdes(hw);
135975eba5b6SRobert Mustacchi }
136075eba5b6SRobert Mustacchi
136175eba5b6SRobert Mustacchi /**
136275eba5b6SRobert Mustacchi * e1000_shutdown_fiber_serdes_link - Remove link during power down
136375eba5b6SRobert Mustacchi * @hw: pointer to the HW structure
136475eba5b6SRobert Mustacchi *
136575eba5b6SRobert Mustacchi * Shutdown the optics and PCS on driver unload.
136675eba5b6SRobert Mustacchi **/
e1000_shutdown_fiber_serdes_link(struct e1000_hw * hw)136775eba5b6SRobert Mustacchi void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)
136875eba5b6SRobert Mustacchi {
136975eba5b6SRobert Mustacchi if (hw->mac.ops.shutdown_serdes)
137075eba5b6SRobert Mustacchi hw->mac.ops.shutdown_serdes(hw);
137175eba5b6SRobert Mustacchi }
137275eba5b6SRobert Mustacchi
1373