1a551c94aSIdo Barnea/*******************************************************************************
2a551c94aSIdo Barnea
3a551c94aSIdo BarneaCopyright (c) 2001-2015, Intel Corporation
4a551c94aSIdo BarneaAll rights reserved.
5a551c94aSIdo Barnea
6a551c94aSIdo BarneaRedistribution and use in source and binary forms, with or without
7a551c94aSIdo Barneamodification, are permitted provided that the following conditions are met:
8a551c94aSIdo Barnea
9a551c94aSIdo Barnea 1. Redistributions of source code must retain the above copyright notice,
10a551c94aSIdo Barnea    this list of conditions and the following disclaimer.
11a551c94aSIdo Barnea
12a551c94aSIdo Barnea 2. Redistributions in binary form must reproduce the above copyright
13a551c94aSIdo Barnea    notice, this list of conditions and the following disclaimer in the
14a551c94aSIdo Barnea    documentation and/or other materials provided with the distribution.
15a551c94aSIdo Barnea
16a551c94aSIdo Barnea 3. Neither the name of the Intel Corporation nor the names of its
17a551c94aSIdo Barnea    contributors may be used to endorse or promote products derived from
18a551c94aSIdo Barnea    this software without specific prior written permission.
19a551c94aSIdo Barnea
31a551c94aSIdo Barnea
32a551c94aSIdo Barnea***************************************************************************/
33a551c94aSIdo Barnea
34a551c94aSIdo Barnea#include "e1000_api.h"
35a551c94aSIdo Barnea
36a551c94aSIdo Barnea/**
37a551c94aSIdo Barnea *  e1000_init_mac_params - Initialize MAC function pointers
38a551c94aSIdo Barnea *  @hw: pointer to the HW structure
39a551c94aSIdo Barnea *
40a551c94aSIdo Barnea *  This function initializes the function pointers for the MAC
41a551c94aSIdo Barnea *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
42a551c94aSIdo Barnea **/
43a551c94aSIdo Barneas32 e1000_init_mac_params(struct e1000_hw *hw)
44a551c94aSIdo Barnea{
45a551c94aSIdo Barnea	s32 ret_val = E1000_SUCCESS;
46a551c94aSIdo Barnea
47a551c94aSIdo Barnea	if (hw->mac.ops.init_params) {
48a551c94aSIdo Barnea		ret_val = hw->mac.ops.init_params(hw);
49a551c94aSIdo Barnea		if (ret_val) {
50a551c94aSIdo Barnea			DEBUGOUT("MAC Initialization Error\n");
51a551c94aSIdo Barnea			goto out;
52a551c94aSIdo Barnea		}
53a551c94aSIdo Barnea	} else {
54a551c94aSIdo Barnea		DEBUGOUT("mac.init_mac_params was NULL\n");
55a551c94aSIdo Barnea		ret_val = -E1000_ERR_CONFIG;
56a551c94aSIdo Barnea	}
57a551c94aSIdo Barnea
58a551c94aSIdo Barneaout:
59a551c94aSIdo Barnea	return ret_val;
60a551c94aSIdo Barnea}
61a551c94aSIdo Barnea
62a551c94aSIdo Barnea/**
63a551c94aSIdo Barnea *  e1000_init_nvm_params - Initialize NVM function pointers
64a551c94aSIdo Barnea *  @hw: pointer to the HW structure
65a551c94aSIdo Barnea *
66a551c94aSIdo Barnea *  This function initializes the function pointers for the NVM
67a551c94aSIdo Barnea *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
68a551c94aSIdo Barnea **/
69a551c94aSIdo Barneas32 e1000_init_nvm_params(struct e1000_hw *hw)
70a551c94aSIdo Barnea{
71a551c94aSIdo Barnea	s32 ret_val = E1000_SUCCESS;
72a551c94aSIdo Barnea
73a551c94aSIdo Barnea	if (hw->nvm.ops.init_params) {
74a551c94aSIdo Barnea		ret_val = hw->nvm.ops.init_params(hw);
75a551c94aSIdo Barnea		if (ret_val) {
76a551c94aSIdo Barnea			DEBUGOUT("NVM Initialization Error\n");
77a551c94aSIdo Barnea			goto out;
78a551c94aSIdo Barnea		}
79a551c94aSIdo Barnea	} else {
80a551c94aSIdo Barnea		DEBUGOUT("nvm.init_nvm_params was NULL\n");
81a551c94aSIdo Barnea		ret_val = -E1000_ERR_CONFIG;
82a551c94aSIdo Barnea	}
83a551c94aSIdo Barnea
84a551c94aSIdo Barneaout:
85a551c94aSIdo Barnea	return ret_val;
86a551c94aSIdo Barnea}
87a551c94aSIdo Barnea
88a551c94aSIdo Barnea/**
89a551c94aSIdo Barnea *  e1000_init_phy_params - Initialize PHY function pointers
90a551c94aSIdo Barnea *  @hw: pointer to the HW structure
91a551c94aSIdo Barnea *
92a551c94aSIdo Barnea *  This function initializes the function pointers for the PHY
93a551c94aSIdo Barnea *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
94a551c94aSIdo Barnea **/
95a551c94aSIdo Barneas32 e1000_init_phy_params(struct e1000_hw *hw)
96a551c94aSIdo Barnea{
97a551c94aSIdo Barnea	s32 ret_val = E1000_SUCCESS;
98a551c94aSIdo Barnea
99a551c94aSIdo Barnea	if (hw->phy.ops.init_params) {
100a551c94aSIdo Barnea		ret_val = hw->phy.ops.init_params(hw);
101a551c94aSIdo Barnea		if (ret_val) {
102a551c94aSIdo Barnea			DEBUGOUT("PHY Initialization Error\n");
103a551c94aSIdo Barnea			goto out;
104a551c94aSIdo Barnea		}
105a551c94aSIdo Barnea	} else {
106a551c94aSIdo Barnea		DEBUGOUT("phy.init_phy_params was NULL\n");
107a551c94aSIdo Barnea		ret_val =  -E1000_ERR_CONFIG;
108a551c94aSIdo Barnea	}
109a551c94aSIdo Barnea
110a551c94aSIdo Barneaout:
111a551c94aSIdo Barnea	return ret_val;
112a551c94aSIdo Barnea}
113a551c94aSIdo Barnea
114a551c94aSIdo Barnea/**
115a551c94aSIdo Barnea *  e1000_init_mbx_params - Initialize mailbox function pointers
116a551c94aSIdo Barnea *  @hw: pointer to the HW structure
117a551c94aSIdo Barnea *
118a551c94aSIdo Barnea *  This function initializes the function pointers for the PHY
119a551c94aSIdo Barnea *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
120a551c94aSIdo Barnea **/
121a551c94aSIdo Barneas32 e1000_init_mbx_params(struct e1000_hw *hw)
122a551c94aSIdo Barnea{
123a551c94aSIdo Barnea	s32 ret_val = E1000_SUCCESS;
124a551c94aSIdo Barnea
125a551c94aSIdo Barnea	if (hw->mbx.ops.init_params) {
126a551c94aSIdo Barnea		ret_val = hw->mbx.ops.init_params(hw);
127a551c94aSIdo Barnea		if (ret_val) {
128a551c94aSIdo Barnea			DEBUGOUT("Mailbox Initialization Error\n");
129a551c94aSIdo Barnea			goto out;
130a551c94aSIdo Barnea		}
131a551c94aSIdo Barnea	} else {
132a551c94aSIdo Barnea		DEBUGOUT("mbx.init_mbx_params was NULL\n");
133a551c94aSIdo Barnea		ret_val =  -E1000_ERR_CONFIG;
134a551c94aSIdo Barnea	}
135a551c94aSIdo Barnea
136a551c94aSIdo Barneaout:
137a551c94aSIdo Barnea	return ret_val;
138a551c94aSIdo Barnea}
139a551c94aSIdo Barnea
140a551c94aSIdo Barnea/**
141a551c94aSIdo Barnea *  e1000_set_mac_type - Sets MAC type
142a551c94aSIdo Barnea *  @hw: pointer to the HW structure
143a551c94aSIdo Barnea *
144a551c94aSIdo Barnea *  This function sets the mac type of the adapter based on the
145a551c94aSIdo Barnea *  device ID stored in the hw structure.
146a551c94aSIdo Barnea *  MUST BE FIRST FUNCTION CALLED (explicitly or through
147a551c94aSIdo Barnea *  e1000_setup_init_funcs()).
148a551c94aSIdo Barnea **/
149a551c94aSIdo Barneas32 e1000_set_mac_type(struct e1000_hw *hw)
150a551c94aSIdo Barnea{
151a551c94aSIdo Barnea	struct e1000_mac_info *mac = &hw->mac;
152a551c94aSIdo Barnea	s32 ret_val = E1000_SUCCESS;
153a551c94aSIdo Barnea
154a551c94aSIdo Barnea	DEBUGFUNC("e1000_set_mac_type");
155a551c94aSIdo Barnea
156a551c94aSIdo Barnea	switch (hw->device_id) {
157a551c94aSIdo Barnea	case E1000_DEV_ID_82542:
158a551c94aSIdo Barnea		mac->type = e1000_82542;
159a551c94aSIdo Barnea		break;
160a551c94aSIdo Barnea	case E1000_DEV_ID_82543GC_FIBER:
161a551c94aSIdo Barnea	case E1000_DEV_ID_82543GC_COPPER:
162a551c94aSIdo Barnea		mac->type = e1000_82543;
163a551c94aSIdo Barnea		break;
164a551c94aSIdo Barnea	case E1000_DEV_ID_82544EI_COPPER:
165a551c94aSIdo Barnea	case E1000_DEV_ID_82544EI_FIBER:
166a551c94aSIdo Barnea	case E1000_DEV_ID_82544GC_COPPER:
167a551c94aSIdo Barnea	case E1000_DEV_ID_82544GC_LOM:
168a551c94aSIdo Barnea		mac->type = e1000_82544;
169a551c94aSIdo Barnea		break;
170a551c94aSIdo Barnea	case E1000_DEV_ID_82540EM:
171a551c94aSIdo Barnea	case E1000_DEV_ID_82540EM_LOM:
172a551c94aSIdo Barnea	case E1000_DEV_ID_82540EP:
173a551c94aSIdo Barnea	case E1000_DEV_ID_82540EP_LOM:
174a551c94aSIdo Barnea	case E1000_DEV_ID_82540EP_LP:
175a551c94aSIdo Barnea		mac->type = e1000_82540;
176a551c94aSIdo Barnea		break;
177a551c94aSIdo Barnea	case E1000_DEV_ID_82545EM_COPPER:
178a551c94aSIdo Barnea	case E1000_DEV_ID_82545EM_FIBER:
179a551c94aSIdo Barnea		mac->type = e1000_82545;
180a551c94aSIdo Barnea		break;
181a551c94aSIdo Barnea	case E1000_DEV_ID_82545GM_COPPER:
182a551c94aSIdo Barnea	case E1000_DEV_ID_82545GM_FIBER:
183a551c94aSIdo Barnea	case E1000_DEV_ID_82545GM_SERDES:
184a551c94aSIdo Barnea		mac->type = e1000_82545_rev_3;
185a551c94aSIdo Barnea		break;
186a551c94aSIdo Barnea	case E1000_DEV_ID_82546EB_COPPER:
187a551c94aSIdo Barnea	case E1000_DEV_ID_82546EB_FIBER:
188a551c94aSIdo Barnea	case E1000_DEV_ID_82546EB_QUAD_COPPER:
189a551c94aSIdo Barnea		mac->type = e1000_82546;
190a551c94aSIdo Barnea		break;
191a551c94aSIdo Barnea	case E1000_DEV_ID_82546GB_COPPER:
192a551c94aSIdo Barnea	case E1000_DEV_ID_82546GB_FIBER:
193a551c94aSIdo Barnea	case E1000_DEV_ID_82546GB_SERDES:
194a551c94aSIdo Barnea	case E1000_DEV_ID_82546GB_PCIE:
195a551c94aSIdo Barnea	case E1000_DEV_ID_82546GB_QUAD_COPPER:
196a551c94aSIdo Barnea	case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
197a551c94aSIdo Barnea		mac->type = e1000_82546_rev_3;
198a551c94aSIdo Barnea		break;
199a551c94aSIdo Barnea	case E1000_DEV_ID_82541EI:
200a551c94aSIdo Barnea	case E1000_DEV_ID_82541EI_MOBILE:
201a551c94aSIdo Barnea	case E1000_DEV_ID_82541ER_LOM:
202a551c94aSIdo Barnea		mac->type = e1000_82541;
203a551c94aSIdo Barnea		break;
204a551c94aSIdo Barnea	case E1000_DEV_ID_82541ER:
205a551c94aSIdo Barnea	case E1000_DEV_ID_82541GI:
206a551c94aSIdo Barnea	case E1000_DEV_ID_82541GI_LF:
207a551c94aSIdo Barnea	case E1000_DEV_ID_82541GI_MOBILE:
208a551c94aSIdo Barnea		mac->type = e1000_82541_rev_2;
209a551c94aSIdo Barnea		break;
210a551c94aSIdo Barnea	case E1000_DEV_ID_82547EI:
211a551c94aSIdo Barnea	case E1000_DEV_ID_82547EI_MOBILE:
212a551c94aSIdo Barnea		mac->type = e1000_82547;
213a551c94aSIdo Barnea		break;
214a551c94aSIdo Barnea	case E1000_DEV_ID_82547GI:
215a551c94aSIdo Barnea		mac->type = e1000_82547_rev_2;
216a551c94aSIdo Barnea		break;
217a551c94aSIdo Barnea	case E1000_DEV_ID_82571EB_COPPER:
218a551c94aSIdo Barnea	case E1000_DEV_ID_82571EB_FIBER:
219a551c94aSIdo Barnea	case E1000_DEV_ID_82571EB_SERDES:
220a551c94aSIdo Barnea	case E1000_DEV_ID_82571EB_SERDES_DUAL:
221a551c94aSIdo Barnea	case E1000_DEV_ID_82571EB_SERDES_QUAD:
222a551c94aSIdo Barnea	case E1000_DEV_ID_82571EB_QUAD_COPPER:
223a551c94aSIdo Barnea	case E1000_DEV_ID_82571PT_QUAD_COPPER:
224a551c94aSIdo Barnea	case E1000_DEV_ID_82571EB_QUAD_FIBER:
225a551c94aSIdo Barnea	case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
226a551c94aSIdo Barnea		mac->type = e1000_82571;
227a551c94aSIdo Barnea		break;
228a551c94aSIdo Barnea	case E1000_DEV_ID_82572EI:
229a551c94aSIdo Barnea	case E1000_DEV_ID_82572EI_COPPER:
230a551c94aSIdo Barnea	case E1000_DEV_ID_82572EI_FIBER:
231a551c94aSIdo Barnea	case E1000_DEV_ID_82572EI_SERDES:
232a551c94aSIdo Barnea		mac->type = e1000_82572;
233a551c94aSIdo Barnea		break;
234a551c94aSIdo Barnea	case E1000_DEV_ID_82573E:
235a551c94aSIdo Barnea	case E1000_DEV_ID_82573E_IAMT:
236a551c94aSIdo Barnea	case E1000_DEV_ID_82573L:
237a551c94aSIdo Barnea		mac->type = e1000_82573;
238a551c94aSIdo Barnea		break;
239a551c94aSIdo Barnea	case E1000_DEV_ID_82574L:
240a551c94aSIdo Barnea	case E1000_DEV_ID_82574LA:
241a551c94aSIdo Barnea		mac->type = e1000_82574;
242a551c94aSIdo Barnea		break;
243a551c94aSIdo Barnea	case E1000_DEV_ID_82583V:
244a551c94aSIdo Barnea		mac->type = e1000_82583;
245a551c94aSIdo Barnea		break;
246a551c94aSIdo Barnea	case E1000_DEV_ID_80003ES2LAN_COPPER_DPT:
247a551c94aSIdo Barnea	case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
248a551c94aSIdo Barnea	case E1000_DEV_ID_80003ES2LAN_COPPER_SPT:
249a551c94aSIdo Barnea	case E1000_DEV_ID_80003ES2LAN_SERDES_SPT:
250a551c94aSIdo Barnea		mac->type = e1000_80003es2lan;
251a551c94aSIdo Barnea		break;
252a551c94aSIdo Barnea	case E1000_DEV_ID_ICH8_IFE:
253a551c94aSIdo Barnea	case E1000_DEV_ID_ICH8_IFE_GT:
254a551c94aSIdo Barnea	case E1000_DEV_ID_ICH8_IFE_G:
255a551c94aSIdo Barnea	case E1000_DEV_ID_ICH8_IGP_M:
256a551c94aSIdo Barnea	case E1000_DEV_ID_ICH8_IGP_M_AMT:
257a551c94aSIdo Barnea	case E1000_DEV_ID_ICH8_IGP_AMT:
258a551c94aSIdo Barnea	case E1000_DEV_ID_ICH8_IGP_C:
259a551c94aSIdo Barnea	case E1000_DEV_ID_ICH8_82567V_3:
260a551c94aSIdo Barnea		mac->type = e1000_ich8lan;
261a551c94aSIdo Barnea		break;
262a551c94aSIdo Barnea	case E1000_DEV_ID_ICH9_IFE:
263a551c94aSIdo Barnea	case E1000_DEV_ID_ICH9_IFE_GT:
264a551c94aSIdo Barnea	case E1000_DEV_ID_ICH9_IFE_G:
265a551c94aSIdo Barnea	case E1000_DEV_ID_ICH9_IGP_M:
266a551c94aSIdo Barnea	case E1000_DEV_ID_ICH9_IGP_M_AMT:
267a551c94aSIdo Barnea	case E1000_DEV_ID_ICH9_IGP_M_V:
268a551c94aSIdo Barnea	case E1000_DEV_ID_ICH9_IGP_AMT:
269a551c94aSIdo Barnea	case E1000_DEV_ID_ICH9_BM:
270a551c94aSIdo Barnea	case E1000_DEV_ID_ICH9_IGP_C:
271a551c94aSIdo Barnea	case E1000_DEV_ID_ICH10_R_BM_LM:
272a551c94aSIdo Barnea	case E1000_DEV_ID_ICH10_R_BM_LF:
273a551c94aSIdo Barnea	case E1000_DEV_ID_ICH10_R_BM_V:
274a551c94aSIdo Barnea		mac->type = e1000_ich9lan;
275a551c94aSIdo Barnea		break;
276a551c94aSIdo Barnea	case E1000_DEV_ID_ICH10_D_BM_LM:
277a551c94aSIdo Barnea	case E1000_DEV_ID_ICH10_D_BM_LF:
278a551c94aSIdo Barnea	case E1000_DEV_ID_ICH10_D_BM_V:
279a551c94aSIdo Barnea		mac->type = e1000_ich10lan;
280a551c94aSIdo Barnea		break;
281a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_D_HV_DM:
282a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_D_HV_DC:
283a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_M_HV_LM:
284a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_M_HV_LC:
285a551c94aSIdo Barnea		mac->type = e1000_pchlan;
286a551c94aSIdo Barnea		break;
287a551c94aSIdo Barnea	case E1000_DEV_ID_PCH2_LV_LM:
288a551c94aSIdo Barnea	case E1000_DEV_ID_PCH2_LV_V:
289a551c94aSIdo Barnea		mac->type = e1000_pch2lan;
290a551c94aSIdo Barnea		break;
291a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_LPT_I217_LM:
292a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_LPT_I217_V:
293a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_LPTLP_I218_LM:
294a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_LPTLP_I218_V:
295a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_I218_LM2:
296a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_I218_V2:
297a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_I218_LM3:
298a551c94aSIdo Barnea	case E1000_DEV_ID_PCH_I218_V3:
299a551c94aSIdo Barnea		mac->type = e1000_pch_lpt;
300a551c94aSIdo Barnea		break;
3019ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_SPT_I219_LM:
3029ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_SPT_I219_V:
3039ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_SPT_I219_LM2:
3049ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_SPT_I219_V2:
3059ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_LBG_I219_LM3:
3069ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_SPT_I219_LM4:
3079ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_SPT_I219_V4:
3089ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_SPT_I219_LM5:
3099ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_SPT_I219_V5:
3109ca4a157SIdo Barnea		mac->type = e1000_pch_spt;
3119ca4a157SIdo Barnea		break;
3129ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_CNP_I219_LM6:
3139ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_CNP_I219_V6:
3149ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_CNP_I219_LM7:
3159ca4a157SIdo Barnea	case E1000_DEV_ID_PCH_CNP_I219_V7:
3169ca4a157SIdo Barnea		mac->type = e1000_pch_cnp;
3179ca4a157SIdo Barnea		break;
318a551c94aSIdo Barnea	case E1000_DEV_ID_82575EB_COPPER:
319a551c94aSIdo Barnea	case E1000_DEV_ID_82575EB_FIBER_SERDES:
320a551c94aSIdo Barnea	case E1000_DEV_ID_82575GB_QUAD_COPPER:
321a551c94aSIdo Barnea		mac->type = e1000_82575;
322a551c94aSIdo Barnea		break;
323a551c94aSIdo Barnea	case E1000_DEV_ID_82576:
324a551c94aSIdo Barnea	case E1000_DEV_ID_82576_FIBER:
325a551c94aSIdo Barnea	case E1000_DEV_ID_82576_SERDES:
326a551c94aSIdo Barnea	case E1000_DEV_ID_82576_QUAD_COPPER:
327a551c94aSIdo Barnea	case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
328a551c94aSIdo Barnea	case E1000_DEV_ID_82576_NS:
329a551c94aSIdo Barnea	case E1000_DEV_ID_82576_NS_SERDES:
330a551c94aSIdo Barnea	case E1000_DEV_ID_82576_SERDES_QUAD:
331a551c94aSIdo Barnea		mac->type = e1000_82576;
332a551c94aSIdo Barnea		break;
333a551c94aSIdo Barnea	case E1000_DEV_ID_82580_COPPER:
334a551c94aSIdo Barnea	case E1000_DEV_ID_82580_FIBER:
335a551c94aSIdo Barnea	case E1000_DEV_ID_82580_SERDES:
336a551c94aSIdo Barnea	case E1000_DEV_ID_82580_SGMII:
337a551c94aSIdo Barnea	case E1000_DEV_ID_82580_COPPER_DUAL:
338a551c94aSIdo Barnea	case E1000_DEV_ID_82580_QUAD_FIBER:
339a551c94aSIdo Barnea	case E1000_DEV_ID_DH89XXCC_SGMII:
340a551c94aSIdo Barnea	case E1000_DEV_ID_DH89XXCC_SERDES:
341a551c94aSIdo Barnea	case E1000_DEV_ID_DH89XXCC_BACKPLANE:
342a551c94aSIdo Barnea	case E1000_DEV_ID_DH89XXCC_SFP:
343a551c94aSIdo Barnea		mac->type = e1000_82580;
344a551c94aSIdo Barnea		break;
345a551c94aSIdo Barnea	case E1000_DEV_ID_I350_COPPER:
346a551c94aSIdo Barnea	case E1000_DEV_ID_I350_FIBER:
347a551c94aSIdo Barnea	case E1000_DEV_ID_I350_SERDES:
348a551c94aSIdo Barnea	case E1000_DEV_ID_I350_SGMII:
349a551c94aSIdo Barnea	case E1000_DEV_ID_I350_DA4:
350a551c94aSIdo Barnea		mac->type = e1000_i350;
351a551c94aSIdo Barnea		break;
352a551c94aSIdo Barnea	case E1000_DEV_ID_I210_COPPER_FLASHLESS:
353a551c94aSIdo Barnea	case E1000_DEV_ID_I210_SERDES_FLASHLESS:
354a551c94aSIdo Barnea	case E1000_DEV_ID_I210_COPPER:
355a551c94aSIdo Barnea	case E1000_DEV_ID_I210_COPPER_OEM1:
356a551c94aSIdo Barnea	case E1000_DEV_ID_I210_COPPER_IT:
357a551c94aSIdo Barnea	case E1000_DEV_ID_I210_FIBER:
358a551c94aSIdo Barnea	case E1000_DEV_ID_I210_SERDES:
359a551c94aSIdo Barnea	case E1000_DEV_ID_I210_SGMII:
360a551c94aSIdo Barnea		mac->type = e1000_i210;
361a551c94aSIdo Barnea		break;
362a551c94aSIdo Barnea	case E1000_DEV_ID_I211_COPPER:
363a551c94aSIdo Barnea		mac->type = e1000_i211;
364a551c94aSIdo Barnea		break;
365a551c94aSIdo Barnea	case E1000_DEV_ID_82576_VF:
366a551c94aSIdo Barnea	case E1000_DEV_ID_82576_VF_HV:
367a551c94aSIdo Barnea		mac->type = e1000_vfadapt;
368a551c94aSIdo Barnea		break;
369a551c94aSIdo Barnea	case E1000_DEV_ID_I350_VF:
370a551c94aSIdo Barnea	case E1000_DEV_ID_I350_VF_HV:
371a551c94aSIdo Barnea		mac->type = e1000_vfadapt_i350;
372a551c94aSIdo Barnea		break;
373a551c94aSIdo Barnea
374a551c94aSIdo Barnea	case E1000_DEV_ID_I354_BACKPLANE_1GBPS:
375a551c94aSIdo Barnea	case E1000_DEV_ID_I354_SGMII:
376a551c94aSIdo Barnea	case E1000_DEV_ID_I354_BACKPLANE_2_5GBPS:
377a551c94aSIdo Barnea		mac->type = e1000_i354;
378a551c94aSIdo Barnea		break;
379a551c94aSIdo Barnea	default:
380a551c94aSIdo Barnea		/* Should never have loaded on this device */
381a551c94aSIdo Barnea		ret_val = -E1000_ERR_MAC_INIT;
382a551c94aSIdo Barnea		break;
383a551c94aSIdo Barnea	}
384a551c94aSIdo Barnea
385a551c94aSIdo Barnea	return ret_val;
386a551c94aSIdo Barnea}
387a551c94aSIdo Barnea
388a551c94aSIdo Barnea/**
389a551c94aSIdo Barnea *  e1000_setup_init_funcs - Initializes function pointers
390a551c94aSIdo Barnea *  @hw: pointer to the HW structure
391a551c94aSIdo Barnea *  @init_device: true will initialize the rest of the function pointers
392a551c94aSIdo Barnea *		  getting the device ready for use.  false will only set
393a551c94aSIdo Barnea *		  MAC type and the function pointers for the other init
394a551c94aSIdo Barnea *		  functions.  Passing false will not generate any hardware
395a551c94aSIdo Barnea *		  reads or writes.
396a551c94aSIdo Barnea *
397a551c94aSIdo Barnea *  This function must be called by a driver in order to use the rest
398a551c94aSIdo Barnea *  of the 'shared' code files. Called by drivers only.
399a551c94aSIdo Barnea **/
400a551c94aSIdo Barneas32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
401a551c94aSIdo Barnea{
402a551c94aSIdo Barnea	s32 ret_val;
403a551c94aSIdo Barnea
404a551c94aSIdo Barnea	/* Can't do much good without knowing the MAC type. */
405a551c94aSIdo Barnea	ret_val = e1000_set_mac_type(hw);
406a551c94aSIdo Barnea	if (ret_val) {
407a551c94aSIdo Barnea		DEBUGOUT("ERROR: MAC type could not be set properly.\n");
408a551c94aSIdo Barnea		goto out;
409a551c94aSIdo Barnea	}
410a551c94aSIdo Barnea
411a551c94aSIdo Barnea	if (!hw->hw_addr) {
412a551c94aSIdo Barnea		DEBUGOUT("ERROR: Registers not mapped\n");
413a551c94aSIdo Barnea		ret_val = -E1000_ERR_CONFIG;
414a551c94aSIdo Barnea		goto out;
415a551c94aSIdo Barnea	}
416a551c94aSIdo Barnea
417a551c94aSIdo Barnea	/*
418a551c94aSIdo Barnea	 * Init function pointers to generic implementations. We do this first
419a551c94aSIdo Barnea	 * allowing a driver module to override it afterward.
420a551c94aSIdo Barnea	 */
421a551c94aSIdo Barnea	e1000_init_mac_ops_generic(hw);
422a551c94aSIdo Barnea	e1000_init_phy_ops_generic(hw);
423a551c94aSIdo Barnea	e1000_init_nvm_ops_generic(hw);
424a551c94aSIdo Barnea	e1000_init_mbx_ops_generic(hw);
425a551c94aSIdo Barnea
426a551c94aSIdo Barnea	/*
427a551c94aSIdo Barnea	 * Set up the init function pointers. These are functions within the
428a551c94aSIdo Barnea	 * adapter family file that sets up function pointers for the rest of
429a551c94aSIdo Barnea	 * the functions in that family.
430a551c94aSIdo Barnea	 */
431a551c94aSIdo Barnea	switch (hw->mac.type) {
432a551c94aSIdo Barnea	case e1000_82542:
433a551c94aSIdo Barnea		e1000_init_function_pointers_82542(hw);
434a551c94aSIdo Barnea		break;
435a551c94aSIdo Barnea	case e1000_82543:
436a551c94aSIdo Barnea	case e1000_82544:
437a551c94aSIdo Barnea		e1000_init_function_pointers_82543(hw);
438a551c94aSIdo Barnea		break;
439a551c94aSIdo Barnea	case e1000_82540:
440a551c94aSIdo Barnea	case e1000_82545:
441a551c94aSIdo Barnea	case e1000_82545_rev_3:
442a551c94aSIdo Barnea	case e1000_82546:
443a551c94aSIdo Barnea	case e1000_82546_rev_3:
444a551c94aSIdo Barnea		e1000_init_function_pointers_82540(hw);
445a551c94aSIdo Barnea		break;
446a551c94aSIdo Barnea	case e1000_82541:
447a551c94aSIdo Barnea	case e1000_82541_rev_2:
448a551c94aSIdo Barnea	case e1000_82547:
449a551c94aSIdo Barnea	case e1000_82547_rev_2:
450a551c94aSIdo Barnea		e1000_init_function_pointers_82541(hw);
451a551c94aSIdo Barnea		break;
452a551c94aSIdo Barnea	case e1000_82571:
453a551c94aSIdo Barnea	case e1000_82572:
454a551c94aSIdo Barnea	case e1000_82573:
455a551c94aSIdo Barnea	case e1000_82574:
456a551c94aSIdo Barnea	case e1000_82583:
457a551c94aSIdo Barnea		e1000_init_function_pointers_82571(hw);
458a551c94aSIdo Barnea		break;
459a551c94aSIdo Barnea	case e1000_80003es2lan:
460a551c94aSIdo Barnea		e1000_init_function_pointers_80003es2lan(hw);
461a551c94aSIdo Barnea		break;
462a551c94aSIdo Barnea	case e1000_ich8lan:
463a551c94aSIdo Barnea	case e1000_ich9lan:
464a551c94aSIdo Barnea	case e1000_ich10lan:
465a551c94aSIdo Barnea	case e1000_pchlan:
466a551c94aSIdo Barnea	case e1000_pch2lan:
467a551c94aSIdo Barnea	case e1000_pch_lpt:
4689ca4a157SIdo Barnea	case e1000_pch_spt:
4699ca4a157SIdo Barnea	case e1000_pch_cnp:
470a551c94aSIdo Barnea		e1000_init_function_pointers_ich8lan(hw);
471a551c94aSIdo Barnea		break;
472a551c94aSIdo Barnea	case e1000_82575:
473a551c94aSIdo Barnea	case e1000_82576:
474a551c94aSIdo Barnea	case e1000_82580:
475a551c94aSIdo Barnea	case e1000_i350:
476a551c94aSIdo Barnea	case e1000_i354:
477a551c94aSIdo Barnea		e1000_init_function_pointers_82575(hw);
478a551c94aSIdo Barnea		break;
479a551c94aSIdo Barnea	case e1000_i210:
480a551c94aSIdo Barnea	case e1000_i211:
481a551c94aSIdo Barnea		e1000_init_function_pointers_i210(hw);
482a551c94aSIdo Barnea		break;
483a551c94aSIdo Barnea	case e1000_vfadapt:
484a551c94aSIdo Barnea		e1000_init_function_pointers_vf(hw);
485a551c94aSIdo Barnea		break;
486a551c94aSIdo Barnea	case e1000_vfadapt_i350:
487a551c94aSIdo Barnea		e1000_init_function_pointers_vf(hw);
488a551c94aSIdo Barnea		break;
489a551c94aSIdo Barnea	default:
490a551c94aSIdo Barnea		DEBUGOUT("Hardware not supported\n");
491a551c94aSIdo Barnea		ret_val = -E1000_ERR_CONFIG;
492a551c94aSIdo Barnea		break;
493a551c94aSIdo Barnea	}
494a551c94aSIdo Barnea
495a551c94aSIdo Barnea	/*
496a551c94aSIdo Barnea	 * Initialize the rest of the function pointers. These require some
497a551c94aSIdo Barnea	 * register reads/writes in some cases.
498a551c94aSIdo Barnea	 */
499a551c94aSIdo Barnea	if (!(ret_val) && init_device) {
500a551c94aSIdo Barnea		ret_val = e1000_init_mac_params(hw);
501a551c94aSIdo Barnea		if (ret_val)
502a551c94aSIdo Barnea			goto out;
503a551c94aSIdo Barnea
504a551c94aSIdo Barnea		ret_val = e1000_init_nvm_params(hw);
505a551c94aSIdo Barnea		if (ret_val)
506a551c94aSIdo Barnea			goto out;
507a551c94aSIdo Barnea
508a551c94aSIdo Barnea		ret_val = e1000_init_phy_params(hw);
509a551c94aSIdo Barnea		if (ret_val)
510a551c94aSIdo Barnea			goto out;
511a551c94aSIdo Barnea
512a551c94aSIdo Barnea		ret_val = e1000_init_mbx_params(hw);
513a551c94aSIdo Barnea		if (ret_val)
514a551c94aSIdo Barnea			goto out;
515a551c94aSIdo Barnea	}
516a551c94aSIdo Barnea
517a551c94aSIdo Barneaout:
518a551c94aSIdo Barnea	return ret_val;
519a551c94aSIdo Barnea}
520a551c94aSIdo Barnea
521a551c94aSIdo Barnea/**
522a551c94aSIdo Barnea *  e1000_get_bus_info - Obtain bus information for adapter
523a551c94aSIdo Barnea *  @hw: pointer to the HW structure
524a551c94aSIdo Barnea *
525a551c94aSIdo Barnea *  This will obtain information about the HW bus for which the
526a551c94aSIdo Barnea *  adapter is attached and stores it in the hw structure. This is a
527a551c94aSIdo Barnea *  function pointer entry point called by drivers.
528a551c94aSIdo Barnea **/
529a551c94aSIdo Barneas32 e1000_get_bus_info(struct e1000_hw *hw)
530a551c94aSIdo Barnea{
531a551c94aSIdo Barnea	if (hw->mac.ops.get_bus_info)
532a551c94aSIdo Barnea		return hw->mac.ops.get_bus_info(hw);
533a551c94aSIdo Barnea
534a551c94aSIdo Barnea	return E1000_SUCCESS;
535a551c94aSIdo Barnea}
536a551c94aSIdo Barnea
537a551c94aSIdo Barnea/**
538a551c94aSIdo Barnea *  e1000_clear_vfta - Clear VLAN filter table
539a551c94aSIdo Barnea *  @hw: pointer to the HW structure
540a551c94aSIdo Barnea *
541a551c94aSIdo Barnea *  This clears the VLAN filter table on the adapter. This is a function
542a551c94aSIdo Barnea *  pointer entry point called by drivers.
543a551c94aSIdo Barnea **/
544a551c94aSIdo Barneavoid e1000_clear_vfta(struct e1000_hw *hw)
545a551c94aSIdo Barnea{
546a551c94aSIdo Barnea	if (hw->mac.ops.clear_vfta)
547a551c94aSIdo Barnea		hw->mac.ops.clear_vfta(hw);
548a551c94aSIdo Barnea}
549a551c94aSIdo Barnea
550a551c94aSIdo Barnea/**
551a551c94aSIdo Barnea *  e1000_write_vfta - Write value to VLAN filter table
552a551c94aSIdo Barnea *  @hw: pointer to the HW structure
553a551c94aSIdo Barnea *  @offset: the 32-bit offset in which to write the value to.
554a551c94aSIdo Barnea *  @value: the 32-bit value to write at location offset.
555a551c94aSIdo Barnea *
556a551c94aSIdo Barnea *  This writes a 32-bit value to a 32-bit offset in the VLAN filter
557a551c94aSIdo Barnea *  table. This is a function pointer entry point called by drivers.
558a551c94aSIdo Barnea **/
559a551c94aSIdo Barneavoid e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
560a551c94aSIdo Barnea{
561a551c94aSIdo Barnea	if (hw->mac.ops.write_vfta)
562a551c94aSIdo Barnea		hw->mac.ops.write_vfta(hw, offset, value);
563a551c94aSIdo Barnea}
564a551c94aSIdo Barnea
565a551c94aSIdo Barnea/**
566a551c94aSIdo Barnea *  e1000_update_mc_addr_list - Update Multicast addresses
567a551c94aSIdo Barnea *  @hw: pointer to the HW structure
568a551c94aSIdo Barnea *  @mc_addr_list: array of multicast addresses to program
569a551c94aSIdo Barnea *  @mc_addr_count: number of multicast addresses to program
570a551c94aSIdo Barnea *
571a551c94aSIdo Barnea *  Updates the Multicast Table Array.
572a551c94aSIdo Barnea *  The caller must have a packed mc_addr_list of multicast addresses.
573a551c94aSIdo Barnea **/
574a551c94aSIdo Barneavoid e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
575a551c94aSIdo Barnea			       u32 mc_addr_count)
576a551c94aSIdo Barnea{
577a551c94aSIdo Barnea	if (hw->mac.ops.update_mc_addr_list)
578a551c94aSIdo Barnea		hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
579a551c94aSIdo Barnea						mc_addr_count);
580a551c94aSIdo Barnea}
581a551c94aSIdo Barnea
582a551c94aSIdo Barnea/**
583a551c94aSIdo Barnea *  e1000_force_mac_fc - Force MAC flow control
584a551c94aSIdo Barnea *  @hw: pointer to the HW structure
585a551c94aSIdo Barnea *
586a551c94aSIdo Barnea *  Force the MAC's flow control settings. Currently no func pointer exists
587a551c94aSIdo Barnea *  and all implementations are handled in the generic version of this
588a551c94aSIdo Barnea *  function.
589a551c94aSIdo Barnea **/
590a551c94aSIdo Barneas32 e1000_force_mac_fc(struct e1000_hw *hw)
591a551c94aSIdo Barnea{
592a551c94aSIdo Barnea	return e1000_force_mac_fc_generic(hw);
593a551c94aSIdo Barnea}
594a551c94aSIdo Barnea
595a551c94aSIdo Barnea/**
596a551c94aSIdo Barnea *  e1000_check_for_link - Check/Store link connection
597a551c94aSIdo Barnea *  @hw: pointer to the HW structure
598a551c94aSIdo Barnea *
599a551c94aSIdo Barnea *  This checks the link condition of the adapter and stores the
600a551c94aSIdo Barnea *  results in the hw->mac structure. This is a function pointer entry
601a551c94aSIdo Barnea *  point called by drivers.
602a551c94aSIdo Barnea **/
603a551c94aSIdo Barneas32 e1000_check_for_link(struct e1000_hw *hw)
604a551c94aSIdo Barnea{
605a551c94aSIdo Barnea	if (hw->mac.ops.check_for_link)
606a551c94aSIdo Barnea		return hw->mac.ops.check_for_link(hw);
607a551c94aSIdo Barnea
608a551c94aSIdo Barnea	return -E1000_ERR_CONFIG;
609a551c94aSIdo Barnea}
610a551c94aSIdo Barnea
611a551c94aSIdo Barnea/**
612a551c94aSIdo Barnea *  e1000_check_mng_mode - Check management mode
613a551c94aSIdo Barnea *  @hw: pointer to the HW structure
614a551c94aSIdo Barnea *
615a551c94aSIdo Barnea *  This checks if the adapter has manageability enabled.
616a551c94aSIdo Barnea *  This is a function pointer entry point called by drivers.
617a551c94aSIdo Barnea **/
618a551c94aSIdo Barneabool e1000_check_mng_mode(struct e1000_hw *hw)
619a551c94aSIdo Barnea{
620a551c94aSIdo Barnea	if (hw->mac.ops.check_mng_mode)
621a551c94aSIdo Barnea		return hw->mac.ops.check_mng_mode(hw);
622a551c94aSIdo Barnea
623a551c94aSIdo Barnea	return false;
624a551c94aSIdo Barnea}
625a551c94aSIdo Barnea
626a551c94aSIdo Barnea/**
627a551c94aSIdo Barnea *  e1000_mng_write_dhcp_info - Writes DHCP info to host interface
628a551c94aSIdo Barnea *  @hw: pointer to the HW structure
629a551c94aSIdo Barnea *  @buffer: pointer to the host interface
630a551c94aSIdo Barnea *  @length: size of the buffer
631a551c94aSIdo Barnea *
632a551c94aSIdo Barnea *  Writes the DHCP information to the host interface.
633a551c94aSIdo Barnea **/
634a551c94aSIdo Barneas32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
635a551c94aSIdo Barnea{
636a551c94aSIdo Barnea	return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
637a551c94aSIdo Barnea}
638a551c94aSIdo Barnea
639a551c94aSIdo Barnea/**
640a551c94aSIdo Barnea *  e1000_reset_hw - Reset hardware
641a551c94aSIdo Barnea *  @hw: pointer to the HW structure
642a551c94aSIdo Barnea *
643a551c94aSIdo Barnea *  This resets the hardware into a known state. This is a function pointer
644a551c94aSIdo Barnea *  entry point called by drivers.
645a551c94aSIdo Barnea **/
646a551c94aSIdo Barneas32 e1000_reset_hw(struct e1000_hw *hw)
647a551c94aSIdo Barnea{
648a551c94aSIdo Barnea	if (hw->mac.ops.reset_hw)
649a551c94aSIdo Barnea		return hw->mac.ops.reset_hw(hw);
650a551c94aSIdo Barnea
651a551c94aSIdo Barnea	return -E1000_ERR_CONFIG;
652a551c94aSIdo Barnea}
653a551c94aSIdo Barnea
654a551c94aSIdo Barnea/**
655a551c94aSIdo Barnea *  e1000_init_hw - Initialize hardware
656a551c94aSIdo Barnea *  @hw: pointer to the HW structure
657a551c94aSIdo Barnea *
658a551c94aSIdo Barnea *  This inits the hardware readying it for operation. This is a function
659a551c94aSIdo Barnea *  pointer entry point called by drivers.
660a551c94aSIdo Barnea **/
661a551c94aSIdo Barneas32 e1000_init_hw(struct e1000_hw *hw)
662a551c94aSIdo Barnea{
663a551c94aSIdo Barnea	if (hw->mac.ops.init_hw)
664a551c94aSIdo Barnea		return hw->mac.ops.init_hw(hw);
665a551c94aSIdo Barnea
666a551c94aSIdo Barnea	return -E1000_ERR_CONFIG;
667a551c94aSIdo Barnea}
668a551c94aSIdo Barnea
669a551c94aSIdo Barnea/**
670a551c94aSIdo Barnea *  e1000_setup_link - Configures link and flow control
671a551c94aSIdo Barnea *  @hw: pointer to the HW structure
672a551c94aSIdo Barnea *
673a551c94aSIdo Barnea *  This configures link and flow control settings for the adapter. This
674a551c94aSIdo Barnea *  is a function pointer entry point called by drivers. While modules can
675a551c94aSIdo Barnea *  also call this, they probably call their own version of this function.
676a551c94aSIdo Barnea **/
677a551c94aSIdo Barneas32 e1000_setup_link(struct e1000_hw *hw)
678a551c94aSIdo Barnea{
679a551c94aSIdo Barnea	if (hw->mac.ops.setup_link)
680a551c94aSIdo Barnea		return hw->mac.ops.setup_link(hw);
681a551c94aSIdo Barnea
682a551c94aSIdo Barnea	return -E1000_ERR_CONFIG;
683a551c94aSIdo Barnea}
684a551c94aSIdo Barnea
685a551c94aSIdo Barnea/**
686a551c94aSIdo Barnea *  e1000_get_speed_and_duplex - Returns current speed and duplex
687a551c94aSIdo Barnea *  @hw: pointer to the HW structure
688a551c94aSIdo Barnea *  @speed: pointer to a 16-bit value to store the speed
689a551c94aSIdo Barnea *  @duplex: pointer to a 16-bit value to store the duplex.
690a551c94aSIdo Barnea *
691a551c94aSIdo Barnea *  This returns the speed and duplex of the adapter in the two 'out'
692a551c94aSIdo Barnea *  variables passed in. This is a function pointer entry point called
693a551c94aSIdo Barnea *  by drivers.
694a551c94aSIdo Barnea **/
695a551c94aSIdo Barneas32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
696a551c94aSIdo Barnea{
697a551c94aSIdo Barnea	if (hw->mac.ops.get_link_up_info)
698a551c94aSIdo Barnea		return hw->mac.ops.get_link_up_info(hw, speed, duplex);
699a551c94aSIdo Barnea
700a551c94aSIdo Barnea	return -E1000_ERR_CONFIG;
701a551c94aSIdo Barnea}
702a551c94aSIdo Barnea
703a551c94aSIdo Barnea/**
704a551c94aSIdo Barnea *  e1000_setup_led - Configures SW controllable LED
705a551c94aSIdo Barnea *  @hw: pointer to the HW structure
706a551c94aSIdo Barnea *
707a551c94aSIdo Barnea *  This prepares the SW controllable LED for use and saves the current state
708a551c94aSIdo Barnea *  of the LED so it can be later restored. This is a function pointer entry
709a551c94aSIdo Barnea *  point called by drivers.
710a551c94aSIdo Barnea **/
711a551c94aSIdo Barneas32 e1000_setup_led(struct e1000_hw *hw)
712a551c94aSIdo Barnea{
713a551c94aSIdo Barnea	if (hw->mac.ops.setup_led)
714a551c94aSIdo Barnea		return hw->mac.ops.setup_led(hw);
715a551c94aSIdo Barnea
716a551c94aSIdo Barnea	return E1000_SUCCESS;
717a551c94aSIdo Barnea}
718a551c94aSIdo Barnea
719a551c94aSIdo Barnea/**
720a551c94aSIdo Barnea *  e1000_cleanup_led - Restores SW controllable LED
721a551c94aSIdo Barnea *  @hw: pointer to the HW structure
722a551c94aSIdo Barnea *
723a551c94aSIdo Barnea *  This restores the SW controllable LED to the value saved off by
724a551c94aSIdo Barnea *  e1000_setup_led. This is a function pointer entry point called by drivers.
725a551c94aSIdo Barnea **/
726a551c94aSIdo Barneas32 e1000_cleanup_led(struct e1000_hw *hw)
727a551c94aSIdo Barnea{
728a551c94aSIdo Barnea	if (hw->mac.ops.cleanup_led)
729a551c94aSIdo Barnea		return hw->mac.ops.cleanup_led(hw);
730a551c94aSIdo Barnea
731a551c94aSIdo Barnea	return E1000_SUCCESS;
732a551c94aSIdo Barnea}
733a551c94aSIdo Barnea
734a551c94aSIdo Barnea/**
735a551c94aSIdo Barnea *  e1000_blink_led - Blink SW controllable LED
736a551c94aSIdo Barnea *  @hw: pointer to the HW structure
737a551c94aSIdo Barnea *
738a551c94aSIdo Barnea *  This starts the adapter LED blinking. Request the LED to be setup first
739a551c94aSIdo Barnea *  and cleaned up after. This is a function pointer entry point called by
740a551c94aSIdo Barnea *  drivers.
741a551c94aSIdo Barnea **/
742a551c94aSIdo Barneas32 e1000_blink_led(struct e1000_hw *hw)
743a551c94aSIdo Barnea{
744a551c94aSIdo Barnea	if (hw->mac.ops.blink_led)
745a551c94aSIdo Barnea		return hw->mac.ops.blink_led(hw);
746a551c94aSIdo Barnea
747a551c94aSIdo Barnea	return E1000_SUCCESS;
748a551c94aSIdo Barnea}
749a551c94aSIdo Barnea
750a551c94aSIdo Barnea/**
751a551c94aSIdo Barnea *  e1000_id_led_init - store LED configurations in SW
752a551c94aSIdo Barnea *  @hw: pointer to the HW structure
753a551c94aSIdo Barnea *
754a551c94aSIdo Barnea *  Initializes the LED config in SW. This is a function pointer entry point
755a551c94aSIdo Barnea *  called by drivers.
756a551c94aSIdo Barnea **/
757a551c94aSIdo Barneas32 e1000_id_led_init(struct e1000_hw *hw)
758a551c94aSIdo Barnea{
759a551c94aSIdo Barnea	if (hw->mac.ops.id_led_init)
760a551c94aSIdo Barnea		return hw->mac.ops.id_led_init(hw);
761a551c94aSIdo Barnea
762a551c94aSIdo Barnea	return E1000_SUCCESS;
763a551c94aSIdo Barnea}
764a551c94aSIdo Barnea
765a551c94aSIdo Barnea/**
766a551c94aSIdo Barnea *  e1000_led_on - Turn on SW controllable LED
767a551c94aSIdo Barnea *  @hw: pointer to the HW structure
768a551c94aSIdo Barnea *
769a551c94aSIdo Barnea *  Turns the SW defined LED on. This is a function pointer entry point
770a551c94aSIdo Barnea *  called by drivers.
771a551c94aSIdo Barnea **/
772a551c94aSIdo Barneas32 e1000_led_on(struct e1000_hw *hw)
773a551c94aSIdo Barnea{
774a551c94aSIdo Barnea	if (hw->mac.ops.led_on)
775a551c94aSIdo Barnea		return hw->mac.ops.led_on(hw);
776a551c94aSIdo Barnea
777a551c94aSIdo Barnea	return E1000_SUCCESS;
778a551c94aSIdo Barnea}
779a551c94aSIdo Barnea
780a551c94aSIdo Barnea/**
781a551c94aSIdo Barnea *  e1000_led_off - Turn off SW controllable LED
782a551c94aSIdo Barnea *  @hw: pointer to the HW structure
783a551c94aSIdo Barnea *
784a551c94aSIdo Barnea *  Turns the SW defined LED off. This is a function pointer entry point
785a551c94aSIdo Barnea *  called by drivers.
786a551c94aSIdo Barnea **/
787a551c94aSIdo Barneas32 e1000_led_off(struct e1000_hw *hw)
788a551c94aSIdo Barnea{
789a551c94aSIdo Barnea	if (hw->mac.ops.led_off)
790a551c94aSIdo Barnea		return hw->mac.ops.led_off(hw);
791a551c94aSIdo Barnea
792a551c94aSIdo Barnea	return E1000_SUCCESS;
793a551c94aSIdo Barnea}
794a551c94aSIdo Barnea
795a551c94aSIdo Barnea/**
796a551c94aSIdo Barnea *  e1000_reset_adaptive - Reset adaptive IFS
797a551c94aSIdo Barnea *  @hw: pointer to the HW structure
798a551c94aSIdo Barnea *
799a551c94aSIdo Barnea *  Resets the adaptive IFS. Currently no func pointer exists and all
800a551c94aSIdo Barnea *  implementations are handled in the generic version of this function.
801a551c94aSIdo Barnea **/
802a551c94aSIdo Barneavoid e1000_reset_adaptive(struct e1000_hw *hw)
803a551c94aSIdo Barnea{
804a551c94aSIdo Barnea	e1000_reset_adaptive_generic(hw);
805a551c94aSIdo Barnea}
806a551c94aSIdo Barnea
807a551c94aSIdo Barnea/**
808a551c94aSIdo Barnea *  e1000_update_adaptive - Update adaptive IFS
809a551c94aSIdo Barnea *  @hw: pointer to the HW structure
810a551c94aSIdo Barnea *
811a551c94aSIdo Barnea *  Updates adapter IFS. Currently no func pointer exists and all
812a551c94aSIdo Barnea *  implementations are handled in the generic version of this function.
813a551c94aSIdo Barnea **/
814a551c94aSIdo Barneavoid e1000_update_adaptive(struct e1000_hw *hw)
815a551c94aSIdo Barnea{
816a551c94aSIdo Barnea	e1000_update_adaptive_generic(hw);
817a551c94aSIdo Barnea}
818a551c94aSIdo Barnea
819a551c94aSIdo Barnea/**
820a551c94aSIdo Barnea *  e1000_disable_pcie_master - Disable PCI-Express master access
821a551c94aSIdo Barnea *  @hw: pointer to the HW structure
822a551c94aSIdo Barnea *
823a551c94aSIdo Barnea *  Disables PCI-Express master access and verifies there are no pending
824a551c94aSIdo Barnea *  requests. Currently no func pointer exists and all implementations are
825a551c94aSIdo Barnea *  handled in the generic version of this function.
826a551c94aSIdo Barnea **/
827a551c94aSIdo Barneas32 e1000_disable_pcie_master(struct e1000_hw *hw)
828a551c94aSIdo Barnea{
829a551c94aSIdo Barnea	return e1000_disable_pcie_master_generic(hw);
830a551c94aSIdo Barnea}
831a551c94aSIdo Barnea
832a551c94aSIdo Barnea/**
833a551c94aSIdo Barnea *  e1000_config_collision_dist - Configure collision distance
834a551c94aSIdo Barnea *  @hw: pointer to the HW structure
835a551c94aSIdo Barnea *
836a551c94aSIdo Barnea *  Configures the collision distance to the default value and is used
837a551c94aSIdo Barnea *  during link setup.
838a551c94aSIdo Barnea **/
839a551c94aSIdo Barneavoid e1000_config_collision_dist(struct e1000_hw *hw)
840a551c94aSIdo Barnea{
841a551c94aSIdo Barnea	if (hw->mac.ops.config_collision_dist)
842a551c94aSIdo Barnea		hw->mac.ops.config_collision_dist(hw);
843a551c94aSIdo Barnea}
844a551c94aSIdo Barnea
845a551c94aSIdo Barnea/**
846a551c94aSIdo Barnea *  e1000_rar_set - Sets a receive address register
847a551c94aSIdo Barnea *  @hw: pointer to the HW structure
848a551c94aSIdo Barnea *  @addr: address to set the RAR to
849a551c94aSIdo Barnea *  @index: the RAR to set
850a551c94aSIdo Barnea *
851a551c94aSIdo Barnea *  Sets a Receive Address Register (RAR) to the specified address.
852a551c94aSIdo Barnea **/
853a551c94aSIdo Barneaint e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
854a551c94aSIdo Barnea{
855a551c94aSIdo Barnea	if (hw->mac.ops.rar_set)
856a551c94aSIdo Barnea		return hw->mac.ops.rar_set(hw, addr, index);
857a551c94aSIdo Barnea
858a551c94aSIdo Barnea	return E1000_SUCCESS;
859a551c94aSIdo Barnea}
860a551c94aSIdo Barnea
861a551c94aSIdo Barnea/**
862a551c94aSIdo Barnea *  e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
863a551c94aSIdo Barnea *  @hw: pointer to the HW structure
864a551c94aSIdo Barnea *
865a551c94aSIdo Barnea *  Ensures that the MDI/MDIX SW state is valid.
866a551c94aSIdo Barnea **/
867a551c94aSIdo Barneas32 e1000_validate_mdi_setting(struct e1000_hw *hw)
868a551c94aSIdo Barnea{
869a551c94aSIdo Barnea	if (hw->mac.ops.validate_mdi_setting)
870a551c94aSIdo Barnea		return hw->mac.ops.validate_mdi_setting(hw);
871a551c94aSIdo Barnea
872a551c94aSIdo Barnea	return E1000_SUCCESS;
873a551c94aSIdo Barnea}
874a551c94aSIdo Barnea
875a551c94aSIdo Barnea/**
876a551c94aSIdo Barnea *  e1000_hash_mc_addr - Determines address location in multicast table
877a551c94aSIdo Barnea *  @hw: pointer to the HW structure
878a551c94aSIdo Barnea *  @mc_addr: Multicast address to hash.
879a551c94aSIdo Barnea *
880a551c94aSIdo Barnea *  This hashes an address to determine its location in the multicast
881a551c94aSIdo Barnea *  table. Currently no func pointer exists and all implementations
882a551c94aSIdo Barnea *  are handled in the generic version of this function.
883a551c94aSIdo Barnea **/
884a551c94aSIdo Barneau32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
885a551c94aSIdo Barnea{
886a551c94aSIdo Barnea	return e1000_hash_mc_addr_generic(hw, mc_addr);
887a551c94aSIdo Barnea}
888a551c94aSIdo Barnea
889a551c94aSIdo Barnea/**
890a551c94aSIdo Barnea *  e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
891a551c94aSIdo Barnea *  @hw: pointer to the HW structure
892a551c94aSIdo Barnea *
893a551c94aSIdo Barnea *  Enables packet filtering on transmit packets if manageability is enabled
894a551c94aSIdo Barnea *  and host interface is enabled.
895a551c94aSIdo Barnea *  Currently no func pointer exists and all implementations are handled in the
896a551c94aSIdo Barnea *  generic version of this function.
897a551c94aSIdo Barnea **/
898a551c94aSIdo Barneabool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
899a551c94aSIdo Barnea{
900a551c94aSIdo Barnea	return e1000_enable_tx_pkt_filtering_generic(hw);
901a551c94aSIdo Barnea}
902a551c94aSIdo Barnea
903a551c94aSIdo Barnea/**
904a551c94aSIdo Barnea *  e1000_mng_host_if_write - Writes to the manageability host interface
905a551c94aSIdo Barnea *  @hw: pointer to the HW structure
906a551c94aSIdo Barnea *  @buffer: pointer to the host interface buffer
907a551c94aSIdo Barnea *  @length: size of the buffer
908a551c94aSIdo Barnea *  @offset: location in the buffer to write to
909a551c94aSIdo Barnea *  @sum: sum of the data (not checksum)
910a551c94aSIdo Barnea *
911a551c94aSIdo Barnea *  This function writes the buffer content at the offset given on the host if.
912a551c94aSIdo Barnea *  It also does alignment considerations to do the writes in most efficient
913a551c94aSIdo Barnea *  way.  Also fills up the sum of the buffer in *buffer parameter.
914a551c94aSIdo Barnea **/
915a551c94aSIdo Barneas32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
916a551c94aSIdo Barnea			    u16 offset, u8 *sum)
917a551c94aSIdo Barnea{
918a551c94aSIdo Barnea	return e1000_mng_host_if_write_generic(hw, buffer, length, offset, sum);
919a551c94aSIdo Barnea}
920a551c94aSIdo Barnea
921a551c94aSIdo Barnea/**
922a551c94aSIdo Barnea *  e1000_mng_write_cmd_header - Writes manageability command header
923a551c94aSIdo Barnea *  @hw: pointer to the HW structure
924a551c94aSIdo Barnea *  @hdr: pointer to the host interface command header
925a551c94aSIdo Barnea *
926a551c94aSIdo Barnea *  Writes the command header after does the checksum calculation.
927a551c94aSIdo Barnea **/
928a551c94aSIdo Barneas32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
929a551c94aSIdo Barnea			       struct e1000_host_mng_command_header *hdr)
930a551c94aSIdo Barnea{
931a551c94aSIdo Barnea	return e1000_mng_write_cmd_header_generic(hw, hdr);
932a551c94aSIdo Barnea}
933a551c94aSIdo Barnea
934a551c94aSIdo Barnea/**
935a551c94aSIdo Barnea *  e1000_mng_enable_host_if - Checks host interface is enabled
936a551c94aSIdo Barnea *  @hw: pointer to the HW structure
937a551c94aSIdo Barnea *
938a551c94aSIdo Barnea *  Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
939a551c94aSIdo Barnea *
940a551c94aSIdo Barnea *  This function checks whether the HOST IF is enabled for command operation
941a551c94aSIdo Barnea *  and also checks whether the previous command is completed.  It busy waits
942a551c94aSIdo Barnea *  in case of previous command is not completed.
943a551c94aSIdo Barnea **/
944a551c94aSIdo Barneas32 e1000_mng_enable_host_if(struct e1000_hw *hw)
945a551c94aSIdo Barnea{
946a551c94aSIdo Barnea	return e1000_mng_enable_host_if_generic(hw);
947a551c94aSIdo Barnea}
948a551c94aSIdo Barnea
949a551c94aSIdo Barnea/**
950a551c94aSIdo Barnea *  e1000_check_reset_block - Verifies PHY can be reset
951a551c94aSIdo Barnea *  @hw: pointer to the HW structure
952a551c94aSIdo Barnea *
953a551c94aSIdo Barnea *  Checks if the PHY is in a state that can be reset or if manageability
954a551c94aSIdo Barnea *  has it tied up. This is a function pointer entry point called by drivers.
955a551c94aSIdo Barnea **/
956a551c94aSIdo Barneas32 e1000_check_reset_block(struct e1000_hw *hw)
957a551c94aSIdo Barnea{
958a551c94aSIdo Barnea	if (hw->phy.ops.check_reset_block)
959a551c94aSIdo Barnea		return hw->phy.ops.check_reset_block(hw);
960a551c94aSIdo Barnea
961a551c94aSIdo Barnea	return E1000_SUCCESS;
962a551c94aSIdo Barnea}
963a551c94aSIdo Barnea
964a551c94aSIdo Barnea/**
965a551c94aSIdo Barnea *  e1000_read_phy_reg - Reads PHY register
966a551c94aSIdo Barnea *  @hw: pointer to the HW structure
967a551c94aSIdo Barnea *  @offset: the register to read
968a551c94aSIdo Barnea *  @data: the buffer to store the 16-bit read.
969a551c94aSIdo Barnea *
970a551c94aSIdo Barnea *  Reads the PHY register and returns the value in data.
971a551c94aSIdo Barnea *  This is a function pointer entry point called by drivers.
972a551c94aSIdo Barnea **/
973a551c94aSIdo Barneas32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
974a551c94aSIdo Barnea{
975a551c94aSIdo Barnea	if (hw->phy.ops.read_reg)
976a551c94aSIdo Barnea		return hw->phy.ops.read_reg(hw, offset, data);
977a551c94aSIdo Barnea
978a551c94aSIdo Barnea	return E1000_SUCCESS;
979a551c94aSIdo Barnea}
980a551c94aSIdo Barnea
981a551c94aSIdo Barnea/**
982a551c94aSIdo Barnea *  e1000_write_phy_reg - Writes PHY register
983a551c94aSIdo Barnea *  @hw: pointer to the HW structure
984a551c94aSIdo Barnea *  @offset: the register to write
985a551c94aSIdo Barnea *  @data: the value to write.
986a551c94aSIdo Barnea *
987a551c94aSIdo Barnea *  Writes the PHY register at offset with the value in data.
988a551c94aSIdo Barnea *  This is a function pointer entry point called by drivers.
989a551c94aSIdo Barnea **/
990a551c94aSIdo Barneas32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
991a551c94aSIdo Barnea{
992a551c94aSIdo Barnea	if (hw->phy.ops.write_reg)
993a551c94aSIdo Barnea		return hw->phy.ops.write_reg(hw, offset, data);
994a551c94aSIdo Barnea
995a551c94aSIdo Barnea	return E1000_SUCCESS;
996a551c94aSIdo Barnea}
997a551c94aSIdo Barnea
998a551c94aSIdo Barnea/**
999a551c94aSIdo Barnea *  e1000_release_phy - Generic release PHY
1000a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1001a551c94aSIdo Barnea *
1002a551c94aSIdo Barnea *  Return if silicon family does not require a semaphore when accessing the
1003a551c94aSIdo Barnea *  PHY.
1004a551c94aSIdo Barnea **/
1005a551c94aSIdo Barneavoid e1000_release_phy(struct e1000_hw *hw)
1006a551c94aSIdo Barnea{
1007a551c94aSIdo Barnea	if (hw->phy.ops.release)
1008a551c94aSIdo Barnea		hw->phy.ops.release(hw);
1009a551c94aSIdo Barnea}
1010a551c94aSIdo Barnea
1011a551c94aSIdo Barnea/**
1012a551c94aSIdo Barnea *  e1000_acquire_phy - Generic acquire PHY
1013a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1014a551c94aSIdo Barnea *
1015a551c94aSIdo Barnea *  Return success if silicon family does not require a semaphore when
1016a551c94aSIdo Barnea *  accessing the PHY.
1017a551c94aSIdo Barnea **/
1018a551c94aSIdo Barneas32 e1000_acquire_phy(struct e1000_hw *hw)
1019a551c94aSIdo Barnea{
1020a551c94aSIdo Barnea	if (hw->phy.ops.acquire)
1021a551c94aSIdo Barnea		return hw->phy.ops.acquire(hw);
1022a551c94aSIdo Barnea
1023a551c94aSIdo Barnea	return E1000_SUCCESS;
1024a551c94aSIdo Barnea}
1025a551c94aSIdo Barnea
1026a551c94aSIdo Barnea/**
1027a551c94aSIdo Barnea *  e1000_cfg_on_link_up - Configure PHY upon link up
1028a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1029a551c94aSIdo Barnea **/
1030a551c94aSIdo Barneas32 e1000_cfg_on_link_up(struct e1000_hw *hw)
1031a551c94aSIdo Barnea{
1032a551c94aSIdo Barnea	if (hw->phy.ops.cfg_on_link_up)
1033a551c94aSIdo Barnea		return hw->phy.ops.cfg_on_link_up(hw);
1034a551c94aSIdo Barnea
1035a551c94aSIdo Barnea	return E1000_SUCCESS;
1036a551c94aSIdo Barnea}
1037a551c94aSIdo Barnea
1038a551c94aSIdo Barnea/**
1039a551c94aSIdo Barnea *  e1000_read_kmrn_reg - Reads register using Kumeran interface
1040a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1041a551c94aSIdo Barnea *  @offset: the register to read
1042a551c94aSIdo Barnea *  @data: the location to store the 16-bit value read.
1043a551c94aSIdo Barnea *
1044a551c94aSIdo Barnea *  Reads a register out of the Kumeran interface. Currently no func pointer
1045a551c94aSIdo Barnea *  exists and all implementations are handled in the generic version of
1046a551c94aSIdo Barnea *  this function.
1047a551c94aSIdo Barnea **/
1048a551c94aSIdo Barneas32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
1049a551c94aSIdo Barnea{
1050a551c94aSIdo Barnea	return e1000_read_kmrn_reg_generic(hw, offset, data);
1051a551c94aSIdo Barnea}
1052a551c94aSIdo Barnea
1053a551c94aSIdo Barnea/**
1054a551c94aSIdo Barnea *  e1000_write_kmrn_reg - Writes register using Kumeran interface
1055a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1056a551c94aSIdo Barnea *  @offset: the register to write
1057a551c94aSIdo Barnea *  @data: the value to write.
1058a551c94aSIdo Barnea *
1059a551c94aSIdo Barnea *  Writes a register to the Kumeran interface. Currently no func pointer
1060a551c94aSIdo Barnea *  exists and all implementations are handled in the generic version of
1061a551c94aSIdo Barnea *  this function.
1062a551c94aSIdo Barnea **/
1063a551c94aSIdo Barneas32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
1064a551c94aSIdo Barnea{
1065a551c94aSIdo Barnea	return e1000_write_kmrn_reg_generic(hw, offset, data);
1066a551c94aSIdo Barnea}
1067a551c94aSIdo Barnea
1068a551c94aSIdo Barnea/**
1069a551c94aSIdo Barnea *  e1000_get_cable_length - Retrieves cable length estimation
1070a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1071a551c94aSIdo Barnea *
1072a551c94aSIdo Barnea *  This function estimates the cable length and stores them in
1073a551c94aSIdo Barnea *  hw->phy.min_length and hw->phy.max_length. This is a function pointer
1074a551c94aSIdo Barnea *  entry point called by drivers.
1075a551c94aSIdo Barnea **/
1076a551c94aSIdo Barneas32 e1000_get_cable_length(struct e1000_hw *hw)
1077a551c94aSIdo Barnea{
1078a551c94aSIdo Barnea	if (hw->phy.ops.get_cable_length)
1079a551c94aSIdo Barnea		return hw->phy.ops.get_cable_length(hw);
1080a551c94aSIdo Barnea
1081a551c94aSIdo Barnea	return E1000_SUCCESS;
1082a551c94aSIdo Barnea}
1083a551c94aSIdo Barnea
1084a551c94aSIdo Barnea/**
1085a551c94aSIdo Barnea *  e1000_get_phy_info - Retrieves PHY information from registers
1086a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1087a551c94aSIdo Barnea *
1088a551c94aSIdo Barnea *  This function gets some information from various PHY registers and
1089a551c94aSIdo Barnea *  populates hw->phy values with it. This is a function pointer entry
1090a551c94aSIdo Barnea *  point called by drivers.
1091a551c94aSIdo Barnea **/
1092a551c94aSIdo Barneas32 e1000_get_phy_info(struct e1000_hw *hw)
1093a551c94aSIdo Barnea{
1094a551c94aSIdo Barnea	if (hw->phy.ops.get_info)
1095a551c94aSIdo Barnea		return hw->phy.ops.get_info(hw);
1096a551c94aSIdo Barnea
1097a551c94aSIdo Barnea	return E1000_SUCCESS;
1098a551c94aSIdo Barnea}
1099a551c94aSIdo Barnea
1100a551c94aSIdo Barnea/**
1101a551c94aSIdo Barnea *  e1000_phy_hw_reset - Hard PHY reset
1102a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1103a551c94aSIdo Barnea *
1104a551c94aSIdo Barnea *  Performs a hard PHY reset. This is a function pointer entry point called
1105a551c94aSIdo Barnea *  by drivers.
1106a551c94aSIdo Barnea **/
1107a551c94aSIdo Barneas32 e1000_phy_hw_reset(struct e1000_hw *hw)
1108a551c94aSIdo Barnea{
1109a551c94aSIdo Barnea	if (hw->phy.ops.reset)
1110a551c94aSIdo Barnea		return hw->phy.ops.reset(hw);
1111a551c94aSIdo Barnea
1112a551c94aSIdo Barnea	return E1000_SUCCESS;
1113a551c94aSIdo Barnea}
1114a551c94aSIdo Barnea
1115a551c94aSIdo Barnea/**
1116a551c94aSIdo Barnea *  e1000_phy_commit - Soft PHY reset
1117a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1118a551c94aSIdo Barnea *
1119a551c94aSIdo Barnea *  Performs a soft PHY reset on those that apply. This is a function pointer
1120a551c94aSIdo Barnea *  entry point called by drivers.
1121a551c94aSIdo Barnea **/
1122a551c94aSIdo Barneas32 e1000_phy_commit(struct e1000_hw *hw)
1123a551c94aSIdo Barnea{
1124a551c94aSIdo Barnea	if (hw->phy.ops.commit)
1125a551c94aSIdo Barnea		return hw->phy.ops.commit(hw);
1126a551c94aSIdo Barnea
1127a551c94aSIdo Barnea	return E1000_SUCCESS;
1128a551c94aSIdo Barnea}
1129a551c94aSIdo Barnea
1130a551c94aSIdo Barnea/**
1131a551c94aSIdo Barnea *  e1000_set_d0_lplu_state - Sets low power link up state for D0
1132a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1133a551c94aSIdo Barnea *  @active: boolean used to enable/disable lplu
1134a551c94aSIdo Barnea *
1135a551c94aSIdo Barnea *  Success returns 0, Failure returns 1
1136a551c94aSIdo Barnea *
1137a551c94aSIdo Barnea *  The low power link up (lplu) state is set to the power management level D0
1138a551c94aSIdo Barnea *  and SmartSpeed is disabled when active is true, else clear lplu for D0
1139a551c94aSIdo Barnea *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
1140a551c94aSIdo Barnea *  is used during Dx states where the power conservation is most important.
1141a551c94aSIdo Barnea *  During driver activity, SmartSpeed should be enabled so performance is
1142a551c94aSIdo Barnea *  maintained.  This is a function pointer entry point called by drivers.
1143a551c94aSIdo Barnea **/
1144a551c94aSIdo Barneas32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
1145a551c94aSIdo Barnea{
1146a551c94aSIdo Barnea	if (hw->phy.ops.set_d0_lplu_state)
1147a551c94aSIdo Barnea		return hw->phy.ops.set_d0_lplu_state(hw, active);
1148a551c94aSIdo Barnea
1149a551c94aSIdo Barnea	return E1000_SUCCESS;
1150a551c94aSIdo Barnea}
1151a551c94aSIdo Barnea
1152a551c94aSIdo Barnea/**
1153a551c94aSIdo Barnea *  e1000_set_d3_lplu_state - Sets low power link up state for D3
1154a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1155a551c94aSIdo Barnea *  @active: boolean used to enable/disable lplu
1156a551c94aSIdo Barnea *
1157a551c94aSIdo Barnea *  Success returns 0, Failure returns 1
1158a551c94aSIdo Barnea *
1159a551c94aSIdo Barnea *  The low power link up (lplu) state is set to the power management level D3
1160a551c94aSIdo Barnea *  and SmartSpeed is disabled when active is true, else clear lplu for D3
1161a551c94aSIdo Barnea *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
1162a551c94aSIdo Barnea *  is used during Dx states where the power conservation is most important.
1163a551c94aSIdo Barnea *  During driver activity, SmartSpeed should be enabled so performance is
1164a551c94aSIdo Barnea *  maintained.  This is a function pointer entry point called by drivers.
1165a551c94aSIdo Barnea **/
1166a551c94aSIdo Barneas32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
1167a551c94aSIdo Barnea{
1168a551c94aSIdo Barnea	if (hw->phy.ops.set_d3_lplu_state)
1169a551c94aSIdo Barnea		return hw->phy.ops.set_d3_lplu_state(hw, active);
1170a551c94aSIdo Barnea
1171a551c94aSIdo Barnea	return E1000_SUCCESS;
1172a551c94aSIdo Barnea}
1173a551c94aSIdo Barnea
1174a551c94aSIdo Barnea/**
1175a551c94aSIdo Barnea *  e1000_read_mac_addr - Reads MAC address
1176a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1177a551c94aSIdo Barnea *
1178a551c94aSIdo Barnea *  Reads the MAC address out of the adapter and stores it in the HW structure.
1179a551c94aSIdo Barnea *  Currently no func pointer exists and all implementations are handled in the
1180a551c94aSIdo Barnea *  generic version of this function.
1181a551c94aSIdo Barnea **/
1182a551c94aSIdo Barneas32 e1000_read_mac_addr(struct e1000_hw *hw)
1183a551c94aSIdo Barnea{
1184a551c94aSIdo Barnea	if (hw->mac.ops.read_mac_addr)
1185a551c94aSIdo Barnea		return hw->mac.ops.read_mac_addr(hw);
1186a551c94aSIdo Barnea
1187a551c94aSIdo Barnea	return e1000_read_mac_addr_generic(hw);
1188a551c94aSIdo Barnea}
1189a551c94aSIdo Barnea
1190a551c94aSIdo Barnea/**
1191a551c94aSIdo Barnea *  e1000_read_pba_string - Read device part number string
1192a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1193a551c94aSIdo Barnea *  @pba_num: pointer to device part number
1194a551c94aSIdo Barnea *  @pba_num_size: size of part number buffer
1195a551c94aSIdo Barnea *
1196a551c94aSIdo Barnea *  Reads the product board assembly (PBA) number from the EEPROM and stores
1197a551c94aSIdo Barnea *  the value in pba_num.
1198a551c94aSIdo Barnea *  Currently no func pointer exists and all implementations are handled in the
1199a551c94aSIdo Barnea *  generic version of this function.
1200a551c94aSIdo Barnea **/
1201a551c94aSIdo Barneas32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size)
1202a551c94aSIdo Barnea{
1203a551c94aSIdo Barnea	return e1000_read_pba_string_generic(hw, pba_num, pba_num_size);
1204a551c94aSIdo Barnea}
1205a551c94aSIdo Barnea
1206a551c94aSIdo Barnea/**
1207a551c94aSIdo Barnea *  e1000_read_pba_length - Read device part number string length
1208a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1209a551c94aSIdo Barnea *  @pba_num_size: size of part number buffer
1210a551c94aSIdo Barnea *
1211a551c94aSIdo Barnea *  Reads the product board assembly (PBA) number length from the EEPROM and
1212a551c94aSIdo Barnea *  stores the value in pba_num.
1213a551c94aSIdo Barnea *  Currently no func pointer exists and all implementations are handled in the
1214a551c94aSIdo Barnea *  generic version of this function.
1215a551c94aSIdo Barnea **/
1216a551c94aSIdo Barneas32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size)
1217a551c94aSIdo Barnea{
1218a551c94aSIdo Barnea	return e1000_read_pba_length_generic(hw, pba_num_size);
1219a551c94aSIdo Barnea}
1220a551c94aSIdo Barnea
1221a551c94aSIdo Barnea/**
1222a551c94aSIdo Barnea *  e1000_read_pba_num - Read device part number
1223a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1224a551c94aSIdo Barnea *  @pba_num: pointer to device part number
1225a551c94aSIdo Barnea *
1226a551c94aSIdo Barnea *  Reads the product board assembly (PBA) number from the EEPROM and stores
1227a551c94aSIdo Barnea *  the value in pba_num.
1228a551c94aSIdo Barnea *  Currently no func pointer exists and all implementations are handled in the
1229a551c94aSIdo Barnea *  generic version of this function.
1230a551c94aSIdo Barnea **/
1231a551c94aSIdo Barneas32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
1232a551c94aSIdo Barnea{
1233a551c94aSIdo Barnea	return e1000_read_pba_num_generic(hw, pba_num);
1234a551c94aSIdo Barnea}
1235a551c94aSIdo Barnea
1236a551c94aSIdo Barnea/**
1237a551c94aSIdo Barnea *  e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
1238a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1239a551c94aSIdo Barnea *
1240a551c94aSIdo Barnea *  Validates the NVM checksum is correct. This is a function pointer entry
1241a551c94aSIdo Barnea *  point called by drivers.
1242a551c94aSIdo Barnea **/
1243a551c94aSIdo Barneas32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
1244a551c94aSIdo Barnea{
1245a551c94aSIdo Barnea	if (hw->nvm.ops.validate)
1246a551c94aSIdo Barnea		return hw->nvm.ops.validate(hw);
1247a551c94aSIdo Barnea
1248a551c94aSIdo Barnea	return -E1000_ERR_CONFIG;
1249a551c94aSIdo Barnea}
1250a551c94aSIdo Barnea
1251a551c94aSIdo Barnea/**
1252a551c94aSIdo Barnea *  e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
1253a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1254a551c94aSIdo Barnea *
1255a551c94aSIdo Barnea *  Updates the NVM checksum. Currently no func pointer exists and all
1256a551c94aSIdo Barnea *  implementations are handled in the generic version of this function.
1257a551c94aSIdo Barnea **/
1258a551c94aSIdo Barneas32 e1000_update_nvm_checksum(struct e1000_hw *hw)
1259a551c94aSIdo Barnea{
1260a551c94aSIdo Barnea	if (hw->nvm.ops.update)
1261a551c94aSIdo Barnea		return hw->nvm.ops.update(hw);
1262a551c94aSIdo Barnea
1263a551c94aSIdo Barnea	return -E1000_ERR_CONFIG;
1264a551c94aSIdo Barnea}
1265a551c94aSIdo Barnea
1266a551c94aSIdo Barnea/**
1267a551c94aSIdo Barnea *  e1000_reload_nvm - Reloads EEPROM
1268a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1269a551c94aSIdo Barnea *
1270a551c94aSIdo Barnea *  Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
1271a551c94aSIdo Barnea *  extended control register.
1272a551c94aSIdo Barnea **/
1273a551c94aSIdo Barneavoid e1000_reload_nvm(struct e1000_hw *hw)
1274a551c94aSIdo Barnea{
1275a551c94aSIdo Barnea	if (hw->nvm.ops.reload)
1276a551c94aSIdo Barnea		hw->nvm.ops.reload(hw);
1277a551c94aSIdo Barnea}
1278a551c94aSIdo Barnea
1279a551c94aSIdo Barnea/**
1280a551c94aSIdo Barnea *  e1000_read_nvm - Reads NVM (EEPROM)
1281a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1282a551c94aSIdo Barnea *  @offset: the word offset to read
1283a551c94aSIdo Barnea *  @words: number of 16-bit words to read
1284a551c94aSIdo Barnea *  @data: pointer to the properly sized buffer for the data.
1285a551c94aSIdo Barnea *
1286a551c94aSIdo Barnea *  Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
1287a551c94aSIdo Barnea *  pointer entry point called by drivers.
1288a551c94aSIdo Barnea **/
1289a551c94aSIdo Barneas32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1290a551c94aSIdo Barnea{
1291a551c94aSIdo Barnea	if (hw->nvm.ops.read)
1292a551c94aSIdo Barnea		return hw->nvm.ops.read(hw, offset, words, data);
1293a551c94aSIdo Barnea
1294a551c94aSIdo Barnea	return -E1000_ERR_CONFIG;
1295a551c94aSIdo Barnea}
1296a551c94aSIdo Barnea
1297a551c94aSIdo Barnea/**
1298a551c94aSIdo Barnea *  e1000_write_nvm - Writes to NVM (EEPROM)
1299a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1300a551c94aSIdo Barnea *  @offset: the word offset to read
1301a551c94aSIdo Barnea *  @words: number of 16-bit words to write
1302a551c94aSIdo Barnea *  @data: pointer to the properly sized buffer for the data.
1303a551c94aSIdo Barnea *
1304a551c94aSIdo Barnea *  Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
1305a551c94aSIdo Barnea *  pointer entry point called by drivers.
1306a551c94aSIdo Barnea **/
1307a551c94aSIdo Barneas32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1308a551c94aSIdo Barnea{
1309a551c94aSIdo Barnea	if (hw->nvm.ops.write)
1310a551c94aSIdo Barnea		return hw->nvm.ops.write(hw, offset, words, data);
1311a551c94aSIdo Barnea
1312a551c94aSIdo Barnea	return E1000_SUCCESS;
1313a551c94aSIdo Barnea}
1314a551c94aSIdo Barnea
1315a551c94aSIdo Barnea/**
1316a551c94aSIdo Barnea *  e1000_write_8bit_ctrl_reg - Writes 8bit Control register
1317a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1318a551c94aSIdo Barnea *  @reg: 32bit register offset
1319a551c94aSIdo Barnea *  @offset: the register to write
1320a551c94aSIdo Barnea *  @data: the value to write.
1321a551c94aSIdo Barnea *
1322a551c94aSIdo Barnea *  Writes the PHY register at offset with the value in data.
1323a551c94aSIdo Barnea *  This is a function pointer entry point called by drivers.
1324a551c94aSIdo Barnea **/
1325a551c94aSIdo Barneas32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
1326a551c94aSIdo Barnea			      u8 data)
1327a551c94aSIdo Barnea{
1328a551c94aSIdo Barnea	return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
1329a551c94aSIdo Barnea}
1330a551c94aSIdo Barnea
1331a551c94aSIdo Barnea/**
1332a551c94aSIdo Barnea * e1000_power_up_phy - Restores link in case of PHY power down
1333a551c94aSIdo Barnea * @hw: pointer to the HW structure
1334a551c94aSIdo Barnea *
1335a551c94aSIdo Barnea * The phy may be powered down to save power, to turn off link when the
1336a551c94aSIdo Barnea * driver is unloaded, or wake on lan is not enabled (among others).
1337a551c94aSIdo Barnea **/
1338a551c94aSIdo Barneavoid e1000_power_up_phy(struct e1000_hw *hw)
1339a551c94aSIdo Barnea{
1340a551c94aSIdo Barnea	if (hw->phy.ops.power_up)
1341a551c94aSIdo Barnea		hw->phy.ops.power_up(hw);
1342a551c94aSIdo Barnea
1343a551c94aSIdo Barnea	e1000_setup_link(hw);
1344a551c94aSIdo Barnea}
1345a551c94aSIdo Barnea
1346a551c94aSIdo Barnea/**
1347a551c94aSIdo Barnea * e1000_power_down_phy - Power down PHY
1348a551c94aSIdo Barnea * @hw: pointer to the HW structure
1349a551c94aSIdo Barnea *
1350a551c94aSIdo Barnea * The phy may be powered down to save power, to turn off link when the
1351a551c94aSIdo Barnea * driver is unloaded, or wake on lan is not enabled (among others).
1352a551c94aSIdo Barnea **/
1353a551c94aSIdo Barneavoid e1000_power_down_phy(struct e1000_hw *hw)
1354a551c94aSIdo Barnea{
1355a551c94aSIdo Barnea	if (hw->phy.ops.power_down)
1356a551c94aSIdo Barnea		hw->phy.ops.power_down(hw);
1357a551c94aSIdo Barnea}
1358a551c94aSIdo Barnea
1359a551c94aSIdo Barnea/**
1360a551c94aSIdo Barnea *  e1000_power_up_fiber_serdes_link - Power up serdes link
1361a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1362a551c94aSIdo Barnea *
1363a551c94aSIdo Barnea *  Power on the optics and PCS.
1364a551c94aSIdo Barnea **/
1365a551c94aSIdo Barneavoid e1000_power_up_fiber_serdes_link(struct e1000_hw *hw)
1366a551c94aSIdo Barnea{
1367a551c94aSIdo Barnea	if (hw->mac.ops.power_up_serdes)
1368a551c94aSIdo Barnea		hw->mac.ops.power_up_serdes(hw);
1369a551c94aSIdo Barnea}
1370a551c94aSIdo Barnea
1371a551c94aSIdo Barnea/**
1372a551c94aSIdo Barnea *  e1000_shutdown_fiber_serdes_link - Remove link during power down
1373a551c94aSIdo Barnea *  @hw: pointer to the HW structure
1374a551c94aSIdo Barnea *
1375a551c94aSIdo Barnea *  Shutdown the optics and PCS on driver unload.
1376a551c94aSIdo Barnea **/
1377a551c94aSIdo Barneavoid e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)
1378a551c94aSIdo Barnea{
1379a551c94aSIdo Barnea	if (hw->mac.ops.shutdown_serdes)
1380a551c94aSIdo Barnea		hw->mac.ops.shutdown_serdes(hw);
1381a551c94aSIdo Barnea}
1382a551c94aSIdo Barnea