Deleted Added
full compact
e1000_82540.c (169248) e1000_82540.c (169589)
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
34
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/em/e1000_82540.c 169248 2007-05-04 13:30:44Z rwatson $");
36
35
37
38/* e1000_82540
39 * e1000_82545
40 * e1000_82546
41 * e1000_82545_rev_3
42 * e1000_82546_rev_3
43 */
44
45#include "e1000_api.h"

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

55STATIC s32 e1000_reset_hw_82540(struct e1000_hw *hw);
56static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw);
57static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw);
58STATIC s32 e1000_setup_copper_link_82540(struct e1000_hw *hw);
59STATIC s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw);
60
61/**
62 * e1000_init_phy_params_82540 - Init PHY func ptrs.
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"

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

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);
58
59/**
60 * e1000_init_phy_params_82540 - Init PHY func ptrs.
63 * @hw - pointer to the HW structure
61 * @hw: pointer to the HW structure
64 *
65 * This is a function pointer entry point called by the api module.
66 **/
67STATIC s32
68e1000_init_phy_params_82540(struct e1000_hw *hw)
69{
70 struct e1000_phy_info *phy = &hw->phy;
71 struct e1000_functions *func = &hw->func;

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

108 }
109
110out:
111 return ret_val;
112}
113
114/**
115 * e1000_init_nvm_params_82540 - Init NVM func ptrs.
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)
67{
68 struct e1000_phy_info *phy = &hw->phy;
69 struct e1000_functions *func = &hw->func;

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

106 }
107
108out:
109 return ret_val;
110}
111
112/**
113 * e1000_init_nvm_params_82540 - Init NVM func ptrs.
116 * @hw - pointer to the HW structure
114 * @hw: pointer to the HW structure
117 *
118 * This is a function pointer entry point called by the api module.
119 **/
120STATIC s32
121e1000_init_nvm_params_82540(struct e1000_hw *hw)
122{
123 struct e1000_nvm_info *nvm = &hw->nvm;
124 struct e1000_functions *func = &hw->func;

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

153 func->validate_nvm = e1000_validate_nvm_checksum_generic;
154 func->write_nvm = e1000_write_nvm_microwire;
155
156 return E1000_SUCCESS;
157}
158
159/**
160 * e1000_init_mac_params_82540 - Init MAC func ptrs.
115 *
116 * This is a function pointer entry point called by the api module.
117 **/
118STATIC s32
119e1000_init_nvm_params_82540(struct e1000_hw *hw)
120{
121 struct e1000_nvm_info *nvm = &hw->nvm;
122 struct e1000_functions *func = &hw->func;

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

151 func->validate_nvm = e1000_validate_nvm_checksum_generic;
152 func->write_nvm = e1000_write_nvm_microwire;
153
154 return E1000_SUCCESS;
155}
156
157/**
158 * e1000_init_mac_params_82540 - Init MAC func ptrs.
161 * @hw - pointer to the HW structure
159 * @hw: pointer to the HW structure
162 *
163 * This is a function pointer entry point called by the api module.
164 **/
165STATIC s32
166e1000_init_mac_params_82540(struct e1000_hw *hw)
167{
168 struct e1000_mac_info *mac = &hw->mac;
169 struct e1000_functions *func = &hw->func;

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

248 func->clear_hw_cntrs = e1000_clear_hw_cntrs_82540;
249
250out:
251 return ret_val;
252}
253
254/**
255 * e1000_init_function_pointers_82540 - Init func ptrs.
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)
165{
166 struct e1000_mac_info *mac = &hw->mac;
167 struct e1000_functions *func = &hw->func;

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

246 func->clear_hw_cntrs = e1000_clear_hw_cntrs_82540;
247
248out:
249 return ret_val;
250}
251
252/**
253 * e1000_init_function_pointers_82540 - Init func ptrs.
256 * @hw - pointer to the HW structure
254 * @hw: pointer to the HW structure
257 *
258 * The only function explicitly called by the api module to initialize
259 * all function pointers and parameters.
260 **/
261void
262e1000_init_function_pointers_82540(struct e1000_hw *hw)
263{
264 DEBUGFUNC("e1000_init_function_pointers_82540");
265
266 hw->func.init_mac_params = e1000_init_mac_params_82540;
267 hw->func.init_nvm_params = e1000_init_nvm_params_82540;
268 hw->func.init_phy_params = e1000_init_phy_params_82540;
269}
270
271/**
272 * e1000_reset_hw_82540 - Reset hardware
255 *
256 * The only function explicitly called by the api module to initialize
257 * all function pointers and parameters.
258 **/
259void
260e1000_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
273 * @hw - pointer to the HW structure
271 * @hw: pointer to the HW structure
274 *
275 * This resets the hardware into a known state. This is a
276 * function pointer entry point called by the api module.
277 **/
278STATIC s32
279e1000_reset_hw_82540(struct e1000_hw *hw)
280{
281 u32 ctrl, icr, manc;

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

323 E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
324 icr = E1000_READ_REG(hw, E1000_ICR);
325
326 return ret_val;
327}
328
329/**
330 * e1000_init_hw_82540 - Initialize hardware
272 *
273 * This resets the hardware into a known state. This is a
274 * function pointer entry point called by the api module.
275 **/
276STATIC s32
277e1000_reset_hw_82540(struct e1000_hw *hw)
278{
279 u32 ctrl, icr, manc;

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

321 E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
322 icr = E1000_READ_REG(hw, E1000_ICR);
323
324 return ret_val;
325}
326
327/**
328 * e1000_init_hw_82540 - Initialize hardware
331 * @hw - pointer to the HW structure
329 * @hw: pointer to the HW structure
332 *
333 * This inits the hardware readying it for operation. This is a
334 * function pointer entry point called by the api module.
335 **/
336STATIC s32
337e1000_init_hw_82540(struct e1000_hw *hw)
338{
339 struct e1000_mac_info *mac = &hw->mac;

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

402 }
403
404out:
405 return ret_val;
406}
407
408/**
409 * e1000_setup_copper_link_82540 - Configure copper link settings
330 *
331 * This inits the hardware readying it for operation. This is a
332 * function pointer entry point called by the api module.
333 **/
334STATIC s32
335e1000_init_hw_82540(struct e1000_hw *hw)
336{
337 struct e1000_mac_info *mac = &hw->mac;

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

400 }
401
402out:
403 return ret_val;
404}
405
406/**
407 * e1000_setup_copper_link_82540 - Configure copper link settings
410 * @hw - pointer to the HW structure
408 * @hw: pointer to the HW structure
411 *
412 * Calls the appropriate function to configure the link for auto-neg or forced
413 * speed and duplex. Then we check for link, once link is established calls
414 * to configure collision distance and flow control are called. If link is
415 * not established, we return -E1000_ERR_PHY (-2). This is a function
416 * pointer entry point called by the api module.
417 **/
418STATIC s32

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

451 ret_val = e1000_setup_copper_link_generic(hw);
452
453out:
454 return ret_val;
455}
456
457/**
458 * e1000_setup_fiber_serdes_link_82540 - Setup link for fiber/serdes
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 **/
416STATIC s32

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

449 ret_val = e1000_setup_copper_link_generic(hw);
450
451out:
452 return ret_val;
453}
454
455/**
456 * e1000_setup_fiber_serdes_link_82540 - Setup link for fiber/serdes
459 * @hw - pointer to the HW structure
457 * @hw: pointer to the HW structure
460 *
461 * Set the output amplitude to the value in the EEPROM and adjust the VCO
462 * speed to improve Bit Error Rate (BER) performance. Configures collision
463 * distance and flow control for fiber and serdes links. Upon successful
464 * setup, poll for link. This is a function pointer entry point called by
465 * the api module.
466 **/
467STATIC s32

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

494 ret_val = e1000_setup_fiber_serdes_link_generic(hw);
495
496out:
497 return ret_val;
498}
499
500/**
501 * e1000_adjust_serdes_amplitude_82540 - Adjust amplitude based on EEPROM
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

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

492 ret_val = e1000_setup_fiber_serdes_link_generic(hw);
493
494out:
495 return ret_val;
496}
497
498/**
499 * e1000_adjust_serdes_amplitude_82540 - Adjust amplitude based on EEPROM
502 * @hw - pointer to the HW structure
500 * @hw: pointer to the HW structure
503 *
504 * Adjust the SERDES ouput amplitude based on the EEPROM settings.
505 **/
506static s32
507e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw)
508{
509 s32 ret_val = E1000_SUCCESS;
510 u16 nvm_data;

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

527 }
528
529out:
530 return ret_val;
531}
532
533/**
534 * e1000_set_vco_speed_82540 - Set VCO speed for better performance
501 *
502 * Adjust the SERDES ouput amplitude based on the EEPROM settings.
503 **/
504static s32
505e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw)
506{
507 s32 ret_val = E1000_SUCCESS;
508 u16 nvm_data;

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

525 }
526
527out:
528 return ret_val;
529}
530
531/**
532 * e1000_set_vco_speed_82540 - Set VCO speed for better performance
535 * @hw - pointer to the HW structure
533 * @hw: pointer to the HW structure
536 *
537 * Set the VCO speed to improve Bit Error Rate (BER) performance.
538 **/
539static s32
540e1000_set_vco_speed_82540(struct e1000_hw *hw)
541{
542 s32 ret_val = E1000_SUCCESS;
543 u16 default_page = 0;

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

585 default_page);
586
587out:
588 return ret_val;
589}
590
591/**
592 * e1000_set_phy_mode_82540 - Set PHY to class A mode
534 *
535 * Set the VCO speed to improve Bit Error Rate (BER) performance.
536 **/
537static s32
538e1000_set_vco_speed_82540(struct e1000_hw *hw)
539{
540 s32 ret_val = E1000_SUCCESS;
541 u16 default_page = 0;

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

583 default_page);
584
585out:
586 return ret_val;
587}
588
589/**
590 * e1000_set_phy_mode_82540 - Set PHY to class A mode
593 * @hw - pointer to the HW structure
591 * @hw: pointer to the HW structure
594 *
595 * Sets the PHY to class A mode and assumes the following operations will
596 * follow to enable the new class mode:
597 * 1. Do a PHY soft reset.
598 * 2. Restart auto-negotiation or force link.
599 **/
600static s32
601e1000_set_phy_mode_82540(struct e1000_hw *hw)

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

634 }
635
636out:
637 return ret_val;
638}
639
640/**
641 * e1000_clear_hw_cntrs_82540 - Clear device specific hardware counters
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 **/
598static s32
599e1000_set_phy_mode_82540(struct e1000_hw *hw)

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

632 }
633
634out:
635 return ret_val;
636}
637
638/**
639 * e1000_clear_hw_cntrs_82540 - Clear device specific hardware counters
642 * @hw - pointer to the HW structure
640 * @hw: pointer to the HW structure
643 *
644 * Clears the hardware counters by reading the counter registers.
645 **/
646STATIC void
647e1000_clear_hw_cntrs_82540(struct e1000_hw *hw)
648{
649 volatile u32 temp;
650

--- 29 unchanged lines hidden ---
641 *
642 * Clears the hardware counters by reading the counter registers.
643 **/
644STATIC void
645e1000_clear_hw_cntrs_82540(struct e1000_hw *hw)
646{
647 volatile u32 temp;
648

--- 29 unchanged lines hidden ---