Deleted Added
full compact
e1000_82540.c (169589) e1000_82540.c (173788)
1/*******************************************************************************
2
3 Copyright (c) 2001-2007, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8

--- 16 unchanged lines hidden (view full) ---

25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
31
32*******************************************************************************/
1/*******************************************************************************
2
3 Copyright (c) 2001-2007, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8

--- 16 unchanged lines hidden (view full) ---

25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
31
32*******************************************************************************/
33/*$FreeBSD: head/sys/dev/em/e1000_82540.c 169589 2007-05-16 00:14:23Z jfv $*/
33/* $FreeBSD: head/sys/dev/em/e1000_82540.c 173788 2007-11-20 21:41:22Z jfv $ */
34
34
35
36/* e1000_82540
37 * e1000_82545
38 * e1000_82546
39 * e1000_82545_rev_3
40 * e1000_82546_rev_3
41 */
42
43#include "e1000_api.h"

--- 6 unchanged lines hidden (view full) ---

50static s32 e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw);
51STATIC void e1000_clear_hw_cntrs_82540(struct e1000_hw *hw);
52STATIC s32 e1000_init_hw_82540(struct e1000_hw *hw);
53STATIC s32 e1000_reset_hw_82540(struct e1000_hw *hw);
54static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw);
55static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw);
56STATIC s32 e1000_setup_copper_link_82540(struct e1000_hw *hw);
57STATIC s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw);
35/* e1000_82540
36 * e1000_82545
37 * e1000_82546
38 * e1000_82545_rev_3
39 * e1000_82546_rev_3
40 */
41
42#include "e1000_api.h"

--- 6 unchanged lines hidden (view full) ---

49static s32 e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw);
50STATIC void e1000_clear_hw_cntrs_82540(struct e1000_hw *hw);
51STATIC s32 e1000_init_hw_82540(struct e1000_hw *hw);
52STATIC s32 e1000_reset_hw_82540(struct e1000_hw *hw);
53static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw);
54static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw);
55STATIC s32 e1000_setup_copper_link_82540(struct e1000_hw *hw);
56STATIC s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw);
57STATIC void e1000_power_down_phy_copper_82540(struct e1000_hw *hw);
58
59/**
60 * e1000_init_phy_params_82540 - Init PHY func ptrs.
61 * @hw: pointer to the HW structure
62 *
63 * This is a function pointer entry point called by the api module.
64 **/
58
59/**
60 * e1000_init_phy_params_82540 - Init PHY func ptrs.
61 * @hw: pointer to the HW structure
62 *
63 * This is a function pointer entry point called by the api module.
64 **/
65STATIC s32
66e1000_init_phy_params_82540(struct e1000_hw *hw)
65STATIC s32 e1000_init_phy_params_82540(struct e1000_hw *hw)
67{
68 struct e1000_phy_info *phy = &hw->phy;
69 struct e1000_functions *func = &hw->func;
70 s32 ret_val = E1000_SUCCESS;
71
72 phy->addr = 1;
73 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
74 phy->reset_delay_us = 10000;

--- 4 unchanged lines hidden (view full) ---

79 func->commit_phy = e1000_phy_sw_reset_generic;
80 func->force_speed_duplex = e1000_phy_force_speed_duplex_m88;
81 func->get_cable_length = e1000_get_cable_length_m88;
82 func->get_cfg_done = e1000_get_cfg_done_generic;
83 func->read_phy_reg = e1000_read_phy_reg_m88;
84 func->reset_phy = e1000_phy_hw_reset_generic;
85 func->write_phy_reg = e1000_write_phy_reg_m88;
86 func->get_phy_info = e1000_get_phy_info_m88;
66{
67 struct e1000_phy_info *phy = &hw->phy;
68 struct e1000_functions *func = &hw->func;
69 s32 ret_val = E1000_SUCCESS;
70
71 phy->addr = 1;
72 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
73 phy->reset_delay_us = 10000;

--- 4 unchanged lines hidden (view full) ---

78 func->commit_phy = e1000_phy_sw_reset_generic;
79 func->force_speed_duplex = e1000_phy_force_speed_duplex_m88;
80 func->get_cable_length = e1000_get_cable_length_m88;
81 func->get_cfg_done = e1000_get_cfg_done_generic;
82 func->read_phy_reg = e1000_read_phy_reg_m88;
83 func->reset_phy = e1000_phy_hw_reset_generic;
84 func->write_phy_reg = e1000_write_phy_reg_m88;
85 func->get_phy_info = e1000_get_phy_info_m88;
86 func->power_up_phy = e1000_power_up_phy_copper;
87 func->power_down_phy = e1000_power_down_phy_copper_82540;
87
88 ret_val = e1000_get_phy_id(hw);
89 if (ret_val)
90 goto out;
91
92 /* Verify phy id */
93 switch (hw->mac.type) {
94 case e1000_82540:

--- 15 unchanged lines hidden (view full) ---

110}
111
112/**
113 * e1000_init_nvm_params_82540 - Init NVM func ptrs.
114 * @hw: pointer to the HW structure
115 *
116 * This is a function pointer entry point called by the api module.
117 **/
88
89 ret_val = e1000_get_phy_id(hw);
90 if (ret_val)
91 goto out;
92
93 /* Verify phy id */
94 switch (hw->mac.type) {
95 case e1000_82540:

--- 15 unchanged lines hidden (view full) ---

111}
112
113/**
114 * e1000_init_nvm_params_82540 - Init NVM func ptrs.
115 * @hw: pointer to the HW structure
116 *
117 * This is a function pointer entry point called by the api module.
118 **/
118STATIC s32
119e1000_init_nvm_params_82540(struct e1000_hw *hw)
119STATIC s32 e1000_init_nvm_params_82540(struct e1000_hw *hw)
120{
121 struct e1000_nvm_info *nvm = &hw->nvm;
122 struct e1000_functions *func = &hw->func;
123 u32 eecd = E1000_READ_REG(hw, E1000_EECD);
124
125 DEBUGFUNC("e1000_init_nvm_params_82540");
126
127 nvm->type = e1000_nvm_eeprom_microwire;

--- 27 unchanged lines hidden (view full) ---

155}
156
157/**
158 * e1000_init_mac_params_82540 - Init MAC func ptrs.
159 * @hw: pointer to the HW structure
160 *
161 * This is a function pointer entry point called by the api module.
162 **/
120{
121 struct e1000_nvm_info *nvm = &hw->nvm;
122 struct e1000_functions *func = &hw->func;
123 u32 eecd = E1000_READ_REG(hw, E1000_EECD);
124
125 DEBUGFUNC("e1000_init_nvm_params_82540");
126
127 nvm->type = e1000_nvm_eeprom_microwire;

--- 27 unchanged lines hidden (view full) ---

155}
156
157/**
158 * e1000_init_mac_params_82540 - Init MAC func ptrs.
159 * @hw: pointer to the HW structure
160 *
161 * This is a function pointer entry point called by the api module.
162 **/
163STATIC s32
164e1000_init_mac_params_82540(struct e1000_hw *hw)
163STATIC s32 e1000_init_mac_params_82540(struct e1000_hw *hw)
165{
166 struct e1000_mac_info *mac = &hw->mac;
167 struct e1000_functions *func = &hw->func;
168 s32 ret_val = E1000_SUCCESS;
169
170 DEBUGFUNC("e1000_init_mac_params_82540");
171
172 /* Set media type */
173 switch (hw->device_id) {
174 case E1000_DEV_ID_82545EM_FIBER:
175 case E1000_DEV_ID_82545GM_FIBER:
176 case E1000_DEV_ID_82546EB_FIBER:
177 case E1000_DEV_ID_82546GB_FIBER:
164{
165 struct e1000_mac_info *mac = &hw->mac;
166 struct e1000_functions *func = &hw->func;
167 s32 ret_val = E1000_SUCCESS;
168
169 DEBUGFUNC("e1000_init_mac_params_82540");
170
171 /* Set media type */
172 switch (hw->device_id) {
173 case E1000_DEV_ID_82545EM_FIBER:
174 case E1000_DEV_ID_82545GM_FIBER:
175 case E1000_DEV_ID_82546EB_FIBER:
176 case E1000_DEV_ID_82546GB_FIBER:
178 hw->media_type = e1000_media_type_fiber;
177 hw->phy.media_type = e1000_media_type_fiber;
179 break;
180 case E1000_DEV_ID_82545GM_SERDES:
181 case E1000_DEV_ID_82546GB_SERDES:
178 break;
179 case E1000_DEV_ID_82545GM_SERDES:
180 case E1000_DEV_ID_82546GB_SERDES:
182 hw->media_type = e1000_media_type_internal_serdes;
181 hw->phy.media_type = e1000_media_type_internal_serdes;
183 break;
184 default:
182 break;
183 default:
185 hw->media_type = e1000_media_type_copper;
184 hw->phy.media_type = e1000_media_type_copper;
186 break;
187 }
188
189 /* Set mta register count */
190 mac->mta_reg_count = 128;
191 /* Set rar entry count */
192 mac->rar_entry_count = E1000_RAR_ENTRIES;
193

--- 4 unchanged lines hidden (view full) ---

198 /* reset */
199 func->reset_hw = e1000_reset_hw_82540;
200 /* hw initialization */
201 func->init_hw = e1000_init_hw_82540;
202 /* link setup */
203 func->setup_link = e1000_setup_link_generic;
204 /* physical interface setup */
205 func->setup_physical_interface =
185 break;
186 }
187
188 /* Set mta register count */
189 mac->mta_reg_count = 128;
190 /* Set rar entry count */
191 mac->rar_entry_count = E1000_RAR_ENTRIES;
192

--- 4 unchanged lines hidden (view full) ---

197 /* reset */
198 func->reset_hw = e1000_reset_hw_82540;
199 /* hw initialization */
200 func->init_hw = e1000_init_hw_82540;
201 /* link setup */
202 func->setup_link = e1000_setup_link_generic;
203 /* physical interface setup */
204 func->setup_physical_interface =
206 (hw->media_type == e1000_media_type_copper)
205 (hw->phy.media_type == e1000_media_type_copper)
207 ? e1000_setup_copper_link_82540
208 : e1000_setup_fiber_serdes_link_82540;
209 /* check for link */
206 ? e1000_setup_copper_link_82540
207 : e1000_setup_fiber_serdes_link_82540;
208 /* check for link */
210 switch (hw->media_type) {
209 switch (hw->phy.media_type) {
211 case e1000_media_type_copper:
212 func->check_for_link = e1000_check_for_copper_link_generic;
213 break;
214 case e1000_media_type_fiber:
215 func->check_for_link = e1000_check_for_fiber_link_generic;
216 break;
217 case e1000_media_type_internal_serdes:
218 func->check_for_link = e1000_check_for_serdes_link_generic;
219 break;
220 default:
221 ret_val = -E1000_ERR_CONFIG;
222 goto out;
223 break;
224 }
225 /* link info */
226 func->get_link_up_info =
210 case e1000_media_type_copper:
211 func->check_for_link = e1000_check_for_copper_link_generic;
212 break;
213 case e1000_media_type_fiber:
214 func->check_for_link = e1000_check_for_fiber_link_generic;
215 break;
216 case e1000_media_type_internal_serdes:
217 func->check_for_link = e1000_check_for_serdes_link_generic;
218 break;
219 default:
220 ret_val = -E1000_ERR_CONFIG;
221 goto out;
222 break;
223 }
224 /* link info */
225 func->get_link_up_info =
227 (hw->media_type == e1000_media_type_copper)
226 (hw->phy.media_type == e1000_media_type_copper)
228 ? e1000_get_speed_and_duplex_copper_generic
229 : e1000_get_speed_and_duplex_fiber_serdes_generic;
230 /* multicast address update */
227 ? e1000_get_speed_and_duplex_copper_generic
228 : e1000_get_speed_and_duplex_fiber_serdes_generic;
229 /* multicast address update */
231 func->mc_addr_list_update = e1000_mc_addr_list_update_generic;
230 func->update_mc_addr_list = e1000_update_mc_addr_list_generic;
232 /* writing VFTA */
233 func->write_vfta = e1000_write_vfta_generic;
234 /* clearing VFTA */
235 func->clear_vfta = e1000_clear_vfta_generic;
236 /* setting MTA */
237 func->mta_set = e1000_mta_set_generic;
238 /* setup LED */
239 func->setup_led = e1000_setup_led_generic;

--- 11 unchanged lines hidden (view full) ---

251
252/**
253 * e1000_init_function_pointers_82540 - Init func ptrs.
254 * @hw: pointer to the HW structure
255 *
256 * The only function explicitly called by the api module to initialize
257 * all function pointers and parameters.
258 **/
231 /* writing VFTA */
232 func->write_vfta = e1000_write_vfta_generic;
233 /* clearing VFTA */
234 func->clear_vfta = e1000_clear_vfta_generic;
235 /* setting MTA */
236 func->mta_set = e1000_mta_set_generic;
237 /* setup LED */
238 func->setup_led = e1000_setup_led_generic;

--- 11 unchanged lines hidden (view full) ---

250
251/**
252 * e1000_init_function_pointers_82540 - Init func ptrs.
253 * @hw: pointer to the HW structure
254 *
255 * The only function explicitly called by the api module to initialize
256 * all function pointers and parameters.
257 **/
259void
260e1000_init_function_pointers_82540(struct e1000_hw *hw)
258void e1000_init_function_pointers_82540(struct e1000_hw *hw)
261{
262 DEBUGFUNC("e1000_init_function_pointers_82540");
263
264 hw->func.init_mac_params = e1000_init_mac_params_82540;
265 hw->func.init_nvm_params = e1000_init_nvm_params_82540;
266 hw->func.init_phy_params = e1000_init_phy_params_82540;
267}
268
269/**
270 * e1000_reset_hw_82540 - Reset hardware
271 * @hw: pointer to the HW structure
272 *
273 * This resets the hardware into a known state. This is a
274 * function pointer entry point called by the api module.
275 **/
259{
260 DEBUGFUNC("e1000_init_function_pointers_82540");
261
262 hw->func.init_mac_params = e1000_init_mac_params_82540;
263 hw->func.init_nvm_params = e1000_init_nvm_params_82540;
264 hw->func.init_phy_params = e1000_init_phy_params_82540;
265}
266
267/**
268 * e1000_reset_hw_82540 - Reset hardware
269 * @hw: pointer to the HW structure
270 *
271 * This resets the hardware into a known state. This is a
272 * function pointer entry point called by the api module.
273 **/
276STATIC s32
277e1000_reset_hw_82540(struct e1000_hw *hw)
274STATIC s32 e1000_reset_hw_82540(struct e1000_hw *hw)
278{
279 u32 ctrl, icr, manc;
280 s32 ret_val = E1000_SUCCESS;
281
282 DEBUGFUNC("e1000_reset_hw_82540");
283
284 DEBUGOUT("Masking off all interrupts\n");
285 E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF);
286
287 E1000_WRITE_REG(hw, E1000_RCTL, 0);
288 E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP);
289 E1000_WRITE_FLUSH(hw);
290
275{
276 u32 ctrl, icr, manc;
277 s32 ret_val = E1000_SUCCESS;
278
279 DEBUGFUNC("e1000_reset_hw_82540");
280
281 DEBUGOUT("Masking off all interrupts\n");
282 E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF);
283
284 E1000_WRITE_REG(hw, E1000_RCTL, 0);
285 E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP);
286 E1000_WRITE_FLUSH(hw);
287
291 /* Delay to allow any outstanding PCI transactions to complete
288 /*
289 * Delay to allow any outstanding PCI transactions to complete
292 * before resetting the device.
293 */
294 msec_delay(10);
295
296 ctrl = E1000_READ_REG(hw, E1000_CTRL);
297
298 DEBUGOUT("Issuing a global reset to 82540/82545/82546 MAC\n");
299 switch (hw->mac.type) {
300 case e1000_82545_rev_3:
301 case e1000_82546_rev_3:
302 E1000_WRITE_REG(hw, E1000_CTRL_DUP, ctrl | E1000_CTRL_RST);
303 break;
304 default:
290 * before resetting the device.
291 */
292 msec_delay(10);
293
294 ctrl = E1000_READ_REG(hw, E1000_CTRL);
295
296 DEBUGOUT("Issuing a global reset to 82540/82545/82546 MAC\n");
297 switch (hw->mac.type) {
298 case e1000_82545_rev_3:
299 case e1000_82546_rev_3:
300 E1000_WRITE_REG(hw, E1000_CTRL_DUP, ctrl | E1000_CTRL_RST);
301 break;
302 default:
305 /* These controllers can't ack the 64-bit write when
303 /*
304 * These controllers can't ack the 64-bit write when
306 * issuing the reset, so we use IO-mapping as a
307 * workaround to issue the reset.
308 */
309 E1000_WRITE_REG_IO(hw, E1000_CTRL, ctrl | E1000_CTRL_RST);
310 break;
311 }
312
313 /* Wait for EEPROM reload */

--- 12 unchanged lines hidden (view full) ---

326
327/**
328 * e1000_init_hw_82540 - Initialize hardware
329 * @hw: pointer to the HW structure
330 *
331 * This inits the hardware readying it for operation. This is a
332 * function pointer entry point called by the api module.
333 **/
305 * issuing the reset, so we use IO-mapping as a
306 * workaround to issue the reset.
307 */
308 E1000_WRITE_REG_IO(hw, E1000_CTRL, ctrl | E1000_CTRL_RST);
309 break;
310 }
311
312 /* Wait for EEPROM reload */

--- 12 unchanged lines hidden (view full) ---

325
326/**
327 * e1000_init_hw_82540 - Initialize hardware
328 * @hw: pointer to the HW structure
329 *
330 * This inits the hardware readying it for operation. This is a
331 * function pointer entry point called by the api module.
332 **/
334STATIC s32
335e1000_init_hw_82540(struct e1000_hw *hw)
333STATIC s32 e1000_init_hw_82540(struct e1000_hw *hw)
336{
337 struct e1000_mac_info *mac = &hw->mac;
338 u32 txdctl, ctrl_ext;
339 s32 ret_val = E1000_SUCCESS;
340 u16 i;
341
342 DEBUGFUNC("e1000_init_hw_82540");
343
344 /* Initialize identification LED */
345 ret_val = e1000_id_led_init_generic(hw);
346 if (ret_val) {
347 DEBUGOUT("Error initializing identification LED\n");
334{
335 struct e1000_mac_info *mac = &hw->mac;
336 u32 txdctl, ctrl_ext;
337 s32 ret_val = E1000_SUCCESS;
338 u16 i;
339
340 DEBUGFUNC("e1000_init_hw_82540");
341
342 /* Initialize identification LED */
343 ret_val = e1000_id_led_init_generic(hw);
344 if (ret_val) {
345 DEBUGOUT("Error initializing identification LED\n");
348 goto out;
346 /* This is not fatal and we should not stop init due to this */
349 }
350
351 /* Disabling VLAN filtering */
352 DEBUGOUT("Initializing the IEEE VLAN\n");
347 }
348
349 /* Disabling VLAN filtering */
350 DEBUGOUT("Initializing the IEEE VLAN\n");
353 if (mac->type < e1000_82545_rev_3) {
351 if (mac->type < e1000_82545_rev_3)
354 E1000_WRITE_REG(hw, E1000_VET, 0);
352 E1000_WRITE_REG(hw, E1000_VET, 0);
355 }
353
356 e1000_clear_vfta(hw);
357
358 /* Setup the receive address. */
359 e1000_init_rx_addrs_generic(hw, mac->rar_entry_count);
360
361 /* Zero out the Multicast HASH table */
362 DEBUGOUT("Zeroing the MTA\n");
363 for (i = 0; i < mac->mta_reg_count; i++) {
364 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
354 e1000_clear_vfta(hw);
355
356 /* Setup the receive address. */
357 e1000_init_rx_addrs_generic(hw, mac->rar_entry_count);
358
359 /* Zero out the Multicast HASH table */
360 DEBUGOUT("Zeroing the MTA\n");
361 for (i = 0; i < mac->mta_reg_count; i++) {
362 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
365 /* Avoid back to back register writes by adding the register
363 /*
364 * Avoid back to back register writes by adding the register
366 * read (flush). This is to protect against some strange
367 * bridge configurations that may issue Memory Write Block
368 * (MWB) to our register space. The *_rev_3 hardware at
369 * least doesn't respond correctly to every other dword in an
370 * MWB to our register space.
371 */
372 E1000_WRITE_FLUSH(hw);
373 }
374
375 if (mac->type < e1000_82545_rev_3)
376 e1000_pcix_mmrbc_workaround_generic(hw);
377
378 /* Setup link and flow control */
379 ret_val = e1000_setup_link(hw);
380
365 * read (flush). This is to protect against some strange
366 * bridge configurations that may issue Memory Write Block
367 * (MWB) to our register space. The *_rev_3 hardware at
368 * least doesn't respond correctly to every other dword in an
369 * MWB to our register space.
370 */
371 E1000_WRITE_FLUSH(hw);
372 }
373
374 if (mac->type < e1000_82545_rev_3)
375 e1000_pcix_mmrbc_workaround_generic(hw);
376
377 /* Setup link and flow control */
378 ret_val = e1000_setup_link(hw);
379
381 txdctl = E1000_READ_REG(hw, E1000_TXDCTL);
380 txdctl = E1000_READ_REG(hw, E1000_TXDCTL(0));
382 txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) |
383 E1000_TXDCTL_FULL_TX_DESC_WB;
381 txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) |
382 E1000_TXDCTL_FULL_TX_DESC_WB;
384 E1000_WRITE_REG(hw, E1000_TXDCTL, txdctl);
383 E1000_WRITE_REG(hw, E1000_TXDCTL(0), txdctl);
385
384
386 /* Clear all of the statistics registers (clear on read). It is
385 /*
386 * Clear all of the statistics registers (clear on read). It is
387 * important that we do this after we have tried to establish link
388 * because the symbol error count will increment wildly if there
389 * is no link.
390 */
391 e1000_clear_hw_cntrs_82540(hw);
392
393 if ((hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER) ||
394 (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3)) {
395 ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT);
387 * important that we do this after we have tried to establish link
388 * because the symbol error count will increment wildly if there
389 * is no link.
390 */
391 e1000_clear_hw_cntrs_82540(hw);
392
393 if ((hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER) ||
394 (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3)) {
395 ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT);
396 /* Relaxed ordering must be disabled to avoid a parity
397 * error crash in a PCI slot. */
396 /*
397 * Relaxed ordering must be disabled to avoid a parity
398 * error crash in a PCI slot.
399 */
398 ctrl_ext |= E1000_CTRL_EXT_RO_DIS;
399 E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext);
400 }
401
400 ctrl_ext |= E1000_CTRL_EXT_RO_DIS;
401 E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext);
402 }
403
402out:
403 return ret_val;
404}
405
406/**
407 * e1000_setup_copper_link_82540 - Configure copper link settings
408 * @hw: pointer to the HW structure
409 *
410 * Calls the appropriate function to configure the link for auto-neg or forced
411 * speed and duplex. Then we check for link, once link is established calls
412 * to configure collision distance and flow control are called. If link is
413 * not established, we return -E1000_ERR_PHY (-2). This is a function
414 * pointer entry point called by the api module.
415 **/
404 return ret_val;
405}
406
407/**
408 * e1000_setup_copper_link_82540 - Configure copper link settings
409 * @hw: pointer to the HW structure
410 *
411 * Calls the appropriate function to configure the link for auto-neg or forced
412 * speed and duplex. Then we check for link, once link is established calls
413 * to configure collision distance and flow control are called. If link is
414 * not established, we return -E1000_ERR_PHY (-2). This is a function
415 * pointer entry point called by the api module.
416 **/
416STATIC s32
417e1000_setup_copper_link_82540(struct e1000_hw *hw)
417STATIC s32 e1000_setup_copper_link_82540(struct e1000_hw *hw)
418{
419 u32 ctrl;
420 s32 ret_val = E1000_SUCCESS;
421 u16 data;
422
423 DEBUGFUNC("e1000_setup_copper_link_82540");
424
425 ctrl = E1000_READ_REG(hw, E1000_CTRL);

--- 31 unchanged lines hidden (view full) ---

457 * @hw: pointer to the HW structure
458 *
459 * Set the output amplitude to the value in the EEPROM and adjust the VCO
460 * speed to improve Bit Error Rate (BER) performance. Configures collision
461 * distance and flow control for fiber and serdes links. Upon successful
462 * setup, poll for link. This is a function pointer entry point called by
463 * the api module.
464 **/
418{
419 u32 ctrl;
420 s32 ret_val = E1000_SUCCESS;
421 u16 data;
422
423 DEBUGFUNC("e1000_setup_copper_link_82540");
424
425 ctrl = E1000_READ_REG(hw, E1000_CTRL);

--- 31 unchanged lines hidden (view full) ---

457 * @hw: pointer to the HW structure
458 *
459 * Set the output amplitude to the value in the EEPROM and adjust the VCO
460 * speed to improve Bit Error Rate (BER) performance. Configures collision
461 * distance and flow control for fiber and serdes links. Upon successful
462 * setup, poll for link. This is a function pointer entry point called by
463 * the api module.
464 **/
465STATIC s32
466e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw)
465STATIC s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw)
467{
468 struct e1000_mac_info *mac = &hw->mac;
469 s32 ret_val = E1000_SUCCESS;
470
471 DEBUGFUNC("e1000_setup_fiber_serdes_link_82540");
472
473 switch (mac->type) {
474 case e1000_82545_rev_3:
475 case e1000_82546_rev_3:
466{
467 struct e1000_mac_info *mac = &hw->mac;
468 s32 ret_val = E1000_SUCCESS;
469
470 DEBUGFUNC("e1000_setup_fiber_serdes_link_82540");
471
472 switch (mac->type) {
473 case e1000_82545_rev_3:
474 case e1000_82546_rev_3:
476 if (hw->media_type == e1000_media_type_internal_serdes) {
477 /* If we're on serdes media, adjust the output
475 if (hw->phy.media_type == e1000_media_type_internal_serdes) {
476 /*
477 * If we're on serdes media, adjust the output
478 * amplitude to value set in the EEPROM.
479 */
480 ret_val = e1000_adjust_serdes_amplitude_82540(hw);
481 if (ret_val)
482 goto out;
483 }
484 /* Adjust VCO speed to improve BER performance */
485 ret_val = e1000_set_vco_speed_82540(hw);

--- 10 unchanged lines hidden (view full) ---

496}
497
498/**
499 * e1000_adjust_serdes_amplitude_82540 - Adjust amplitude based on EEPROM
500 * @hw: pointer to the HW structure
501 *
502 * Adjust the SERDES ouput amplitude based on the EEPROM settings.
503 **/
478 * amplitude to value set in the EEPROM.
479 */
480 ret_val = e1000_adjust_serdes_amplitude_82540(hw);
481 if (ret_val)
482 goto out;
483 }
484 /* Adjust VCO speed to improve BER performance */
485 ret_val = e1000_set_vco_speed_82540(hw);

--- 10 unchanged lines hidden (view full) ---

496}
497
498/**
499 * e1000_adjust_serdes_amplitude_82540 - Adjust amplitude based on EEPROM
500 * @hw: pointer to the HW structure
501 *
502 * Adjust the SERDES ouput amplitude based on the EEPROM settings.
503 **/
504static s32
505e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw)
504static s32 e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw)
506{
507 s32 ret_val = E1000_SUCCESS;
508 u16 nvm_data;
509
510 DEBUGFUNC("e1000_adjust_serdes_amplitude_82540");
511
512 ret_val = e1000_read_nvm(hw, NVM_SERDES_AMPLITUDE, 1, &nvm_data);
505{
506 s32 ret_val = E1000_SUCCESS;
507 u16 nvm_data;
508
509 DEBUGFUNC("e1000_adjust_serdes_amplitude_82540");
510
511 ret_val = e1000_read_nvm(hw, NVM_SERDES_AMPLITUDE, 1, &nvm_data);
513 if (ret_val) {
512 if (ret_val)
514 goto out;
513 goto out;
515 }
516
517 if (nvm_data != NVM_RESERVED_WORD) {
518 /* Adjust serdes output amplitude only. */
519 nvm_data &= NVM_SERDES_AMPLITUDE_MASK;
520 ret_val = e1000_write_phy_reg(hw,
521 M88E1000_PHY_EXT_CTRL,
522 nvm_data);
523 if (ret_val)

--- 5 unchanged lines hidden (view full) ---

529}
530
531/**
532 * e1000_set_vco_speed_82540 - Set VCO speed for better performance
533 * @hw: pointer to the HW structure
534 *
535 * Set the VCO speed to improve Bit Error Rate (BER) performance.
536 **/
514
515 if (nvm_data != NVM_RESERVED_WORD) {
516 /* Adjust serdes output amplitude only. */
517 nvm_data &= NVM_SERDES_AMPLITUDE_MASK;
518 ret_val = e1000_write_phy_reg(hw,
519 M88E1000_PHY_EXT_CTRL,
520 nvm_data);
521 if (ret_val)

--- 5 unchanged lines hidden (view full) ---

527}
528
529/**
530 * e1000_set_vco_speed_82540 - Set VCO speed for better performance
531 * @hw: pointer to the HW structure
532 *
533 * Set the VCO speed to improve Bit Error Rate (BER) performance.
534 **/
537static s32
538e1000_set_vco_speed_82540(struct e1000_hw *hw)
535static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw)
539{
540 s32 ret_val = E1000_SUCCESS;
541 u16 default_page = 0;
542 u16 phy_data;
543
544 DEBUGFUNC("e1000_set_vco_speed_82540");
545
546 /* Set PHY register 30, page 5, bit 8 to 0 */

--- 43 unchanged lines hidden (view full) ---

590 * e1000_set_phy_mode_82540 - Set PHY to class A mode
591 * @hw: pointer to the HW structure
592 *
593 * Sets the PHY to class A mode and assumes the following operations will
594 * follow to enable the new class mode:
595 * 1. Do a PHY soft reset.
596 * 2. Restart auto-negotiation or force link.
597 **/
536{
537 s32 ret_val = E1000_SUCCESS;
538 u16 default_page = 0;
539 u16 phy_data;
540
541 DEBUGFUNC("e1000_set_vco_speed_82540");
542
543 /* Set PHY register 30, page 5, bit 8 to 0 */

--- 43 unchanged lines hidden (view full) ---

587 * e1000_set_phy_mode_82540 - Set PHY to class A mode
588 * @hw: pointer to the HW structure
589 *
590 * Sets the PHY to class A mode and assumes the following operations will
591 * follow to enable the new class mode:
592 * 1. Do a PHY soft reset.
593 * 2. Restart auto-negotiation or force link.
594 **/
598static s32
599e1000_set_phy_mode_82540(struct e1000_hw *hw)
595static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw)
600{
601 struct e1000_phy_info *phy = &hw->phy;
602 s32 ret_val = E1000_SUCCESS;
603 u16 nvm_data;
604
605 DEBUGFUNC("e1000_set_phy_mode_82540");
606
607 if (hw->mac.type != e1000_82545_rev_3)

--- 23 unchanged lines hidden (view full) ---

631 phy->reset_disable = FALSE;
632 }
633
634out:
635 return ret_val;
636}
637
638/**
596{
597 struct e1000_phy_info *phy = &hw->phy;
598 s32 ret_val = E1000_SUCCESS;
599 u16 nvm_data;
600
601 DEBUGFUNC("e1000_set_phy_mode_82540");
602
603 if (hw->mac.type != e1000_82545_rev_3)

--- 23 unchanged lines hidden (view full) ---

627 phy->reset_disable = FALSE;
628 }
629
630out:
631 return ret_val;
632}
633
634/**
635 * e1000_power_down_phy_copper_82540 - Remove link in case of PHY power down
636 * @hw: pointer to the HW structure
637 *
638 * In the case of a PHY power down to save power, or to turn off link during a
639 * driver unload, or wake on lan is not enabled, remove the link.
640 **/
641STATIC void e1000_power_down_phy_copper_82540(struct e1000_hw *hw)
642{
643 /* If the management interface is not enabled, then power down */
644 if (!(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_SMBUS_EN))
645 e1000_power_down_phy_copper(hw);
646
647 return;
648}
649
650/**
639 * e1000_clear_hw_cntrs_82540 - Clear device specific hardware counters
640 * @hw: pointer to the HW structure
641 *
642 * Clears the hardware counters by reading the counter registers.
643 **/
651 * e1000_clear_hw_cntrs_82540 - Clear device specific hardware counters
652 * @hw: pointer to the HW structure
653 *
654 * Clears the hardware counters by reading the counter registers.
655 **/
644STATIC void
645e1000_clear_hw_cntrs_82540(struct e1000_hw *hw)
656STATIC void e1000_clear_hw_cntrs_82540(struct e1000_hw *hw)
646{
647 volatile u32 temp;
648
649 DEBUGFUNC("e1000_clear_hw_cntrs_82540");
650
651 e1000_clear_hw_cntrs_base_generic(hw);
652
653 temp = E1000_READ_REG(hw, E1000_PRC64);

--- 24 unchanged lines hidden ---
657{
658 volatile u32 temp;
659
660 DEBUGFUNC("e1000_clear_hw_cntrs_82540");
661
662 e1000_clear_hw_cntrs_base_generic(hw);
663
664 temp = E1000_READ_REG(hw, E1000_PRC64);

--- 24 unchanged lines hidden ---