author | Florian Pose <fp@igh-essen.com> |
Tue, 10 Jan 2012 10:10:58 +0100 | |
branch | redundancy |
changeset 2339 | ecaff0d1d165 |
parent 673 | 21c266c3f463 |
permissions | -rw-r--r-- |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/******************************************************************************* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
This program is free software; you can redistribute it and/or modify it |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
under the terms of the GNU General Public License as published by the Free |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
Software Foundation; either version 2 of the License, or (at your option) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
any later version. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
This program is distributed in the hope that it will be useful, but WITHOUT |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
more details. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
You should have received a copy of the GNU General Public License along with |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
this program; if not, write to the Free Software Foundation, Inc., 59 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
The full GNU General Public License is included in this distribution in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
file called LICENSE. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
Contact Information: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
Linux NICS <linux.nics@intel.com> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
*******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
/* e1000_hw.c |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* Shared functions for accessing and configuring the MAC |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
#include "e1000_hw.h" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
static int32_t e1000_set_phy_type(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
static void e1000_phy_init_script(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
static int32_t e1000_setup_copper_link(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
static int32_t e1000_setup_fiber_serdes_link(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
static int32_t e1000_adjust_serdes_amplitude(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
static int32_t e1000_phy_force_speed_duplex(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
static int32_t e1000_config_mac_to_phy(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
static void e1000_raise_mdi_clk(struct e1000_hw *hw, uint32_t *ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
static void e1000_lower_mdi_clk(struct e1000_hw *hw, uint32_t *ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, uint32_t data, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
uint16_t count); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
static uint16_t e1000_shift_in_mdi_bits(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
static int32_t e1000_phy_reset_dsp(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
static int32_t e1000_write_eeprom_spi(struct e1000_hw *hw, uint16_t offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
uint16_t words, uint16_t *data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
static int32_t e1000_write_eeprom_microwire(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
uint16_t offset, uint16_t words, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
uint16_t *data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
static int32_t e1000_spi_eeprom_ready(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
static void e1000_raise_ee_clk(struct e1000_hw *hw, uint32_t *eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
static void e1000_lower_ee_clk(struct e1000_hw *hw, uint32_t *eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
static void e1000_shift_out_ee_bits(struct e1000_hw *hw, uint16_t data, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
uint16_t count); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
static int32_t e1000_write_phy_reg_ex(struct e1000_hw *hw, uint32_t reg_addr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
uint16_t phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
static int32_t e1000_read_phy_reg_ex(struct e1000_hw *hw,uint32_t reg_addr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
uint16_t *phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
static uint16_t e1000_shift_in_ee_bits(struct e1000_hw *hw, uint16_t count); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
static int32_t e1000_acquire_eeprom(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
static void e1000_release_eeprom(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
static void e1000_standby_eeprom(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
static int32_t e1000_set_vco_speed(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
static int32_t e1000_polarity_reversal_workaround(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
static int32_t e1000_set_phy_mode(struct e1000_hw *hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
static int32_t e1000_host_if_read_cookie(struct e1000_hw *hw, uint8_t *buffer); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
static uint8_t e1000_calculate_mng_checksum(char *buffer, uint32_t length); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
/* IGP cable length table */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
static const |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
{ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
5, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 25, 25, 25, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
25, 25, 25, 25, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
40, 50, 50, 50, 50, 50, 50, 50, 60, 60, 60, 60, 60, 60, 60, 60, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
60, 70, 70, 70, 70, 70, 70, 80, 80, 80, 80, 80, 80, 90, 90, 90, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
90, 90, 90, 90, 90, 90, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
100, 100, 100, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
110, 110, 110, 110, 110, 110, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120}; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
static const |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
uint16_t e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
{ 8, 13, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
22, 24, 27, 30, 32, 35, 37, 40, 42, 44, 47, 49, 51, 54, 56, 58, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
32, 35, 38, 41, 44, 47, 50, 53, 55, 58, 61, 63, 66, 69, 71, 74, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
43, 47, 51, 54, 58, 61, 64, 67, 71, 74, 77, 80, 82, 85, 88, 90, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
57, 62, 66, 70, 74, 77, 81, 85, 88, 91, 94, 97, 100, 103, 106, 108, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
73, 78, 82, 87, 91, 95, 98, 102, 105, 109, 112, 114, 117, 119, 122, 124, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
91, 96, 101, 105, 109, 113, 116, 119, 122, 125, 127, 128, 128, 128, 128, 128, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
108, 113, 117, 121, 124, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
* Set the phy type member in the hw struct. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
e1000_set_phy_type(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
DEBUGFUNC("e1000_set_phy_type"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
if(hw->mac_type == e1000_undefined) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
return -E1000_ERR_PHY_TYPE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
switch(hw->phy_id) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
case M88E1000_E_PHY_ID: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
case M88E1000_I_PHY_ID: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
case M88E1011_I_PHY_ID: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
case M88E1111_I_PHY_ID: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
hw->phy_type = e1000_phy_m88; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
case IGP01E1000_I_PHY_ID: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
if(hw->mac_type == e1000_82541 || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
hw->mac_type == e1000_82541_rev_2 || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
hw->mac_type == e1000_82547 || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
hw->mac_type == e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
hw->phy_type = e1000_phy_igp; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
/* Fall Through */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
/* Should never have loaded on this device */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
hw->phy_type = e1000_phy_undefined; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
return -E1000_ERR_PHY_TYPE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
* IGP phy init script - initializes the GbE PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
e1000_phy_init_script(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
uint32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
uint16_t phy_saved_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
DEBUGFUNC("e1000_phy_init_script"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
if(hw->phy_init_script) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
msec_delay(20); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
/* Save off the current value of register 0x2F5B to be restored at |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
* the end of this routine. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
/* Disabled the PHY transmitter */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
msec_delay(20); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
e1000_write_phy_reg(hw,0x0000,0x0140); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
msec_delay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
case e1000_82541: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
case e1000_82547: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
e1000_write_phy_reg(hw, 0x1F95, 0x0001); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
e1000_write_phy_reg(hw, 0x1F71, 0xBD21); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
e1000_write_phy_reg(hw, 0x1F79, 0x0018); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
e1000_write_phy_reg(hw, 0x1F30, 0x1600); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
e1000_write_phy_reg(hw, 0x1F31, 0x0014); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
e1000_write_phy_reg(hw, 0x1F32, 0x161C); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
e1000_write_phy_reg(hw, 0x1F94, 0x0003); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
e1000_write_phy_reg(hw, 0x1F96, 0x003F); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
e1000_write_phy_reg(hw, 0x2010, 0x0008); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
case e1000_82541_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
case e1000_82547_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
e1000_write_phy_reg(hw, 0x1F73, 0x0099); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
e1000_write_phy_reg(hw, 0x0000, 0x3300); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
msec_delay(20); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
/* Now enable the transmitter */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
if(hw->mac_type == e1000_82547) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
uint16_t fused, fine, coarse; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
/* Move to analog registers page */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
e1000_read_phy_reg(hw, IGP01E1000_ANALOG_SPARE_FUSE_STATUS, &fused); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
if(!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
e1000_read_phy_reg(hw, IGP01E1000_ANALOG_FUSE_STATUS, &fused); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
fine = fused & IGP01E1000_ANALOG_FUSE_FINE_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
coarse = fused & IGP01E1000_ANALOG_FUSE_COARSE_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
if(coarse > IGP01E1000_ANALOG_FUSE_COARSE_THRESH) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
coarse -= IGP01E1000_ANALOG_FUSE_COARSE_10; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
fine -= IGP01E1000_ANALOG_FUSE_FINE_1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
} else if(coarse == IGP01E1000_ANALOG_FUSE_COARSE_THRESH) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
fine -= IGP01E1000_ANALOG_FUSE_FINE_10; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
fused = (fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
(fine & IGP01E1000_ANALOG_FUSE_FINE_MASK) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
(coarse & IGP01E1000_ANALOG_FUSE_COARSE_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_CONTROL, fused); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_BYPASS, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
* Set the mac type member in the hw struct. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
e1000_set_mac_type(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
DEBUGFUNC("e1000_set_mac_type"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
switch (hw->device_id) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
case E1000_DEV_ID_82542: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
switch (hw->revision_id) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
case E1000_82542_2_0_REV_ID: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
hw->mac_type = e1000_82542_rev2_0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
case E1000_82542_2_1_REV_ID: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
hw->mac_type = e1000_82542_rev2_1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
/* Invalid 82542 revision ID */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
return -E1000_ERR_MAC_TYPE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
case E1000_DEV_ID_82543GC_FIBER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
case E1000_DEV_ID_82543GC_COPPER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
hw->mac_type = e1000_82543; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
case E1000_DEV_ID_82544EI_COPPER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
case E1000_DEV_ID_82544EI_FIBER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
case E1000_DEV_ID_82544GC_COPPER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
case E1000_DEV_ID_82544GC_LOM: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
hw->mac_type = e1000_82544; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
case E1000_DEV_ID_82540EM: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
case E1000_DEV_ID_82540EM_LOM: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
case E1000_DEV_ID_82540EP: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
case E1000_DEV_ID_82540EP_LOM: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
case E1000_DEV_ID_82540EP_LP: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
hw->mac_type = e1000_82540; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
case E1000_DEV_ID_82545EM_COPPER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
case E1000_DEV_ID_82545EM_FIBER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
hw->mac_type = e1000_82545; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
case E1000_DEV_ID_82545GM_COPPER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
case E1000_DEV_ID_82545GM_FIBER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
case E1000_DEV_ID_82545GM_SERDES: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
hw->mac_type = e1000_82545_rev_3; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
case E1000_DEV_ID_82546EB_COPPER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
case E1000_DEV_ID_82546EB_FIBER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
case E1000_DEV_ID_82546EB_QUAD_COPPER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
hw->mac_type = e1000_82546; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
case E1000_DEV_ID_82546GB_COPPER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
case E1000_DEV_ID_82546GB_FIBER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
case E1000_DEV_ID_82546GB_SERDES: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
case E1000_DEV_ID_82546GB_PCIE: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
case E1000_DEV_ID_82546GB_QUAD_COPPER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
hw->mac_type = e1000_82546_rev_3; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
case E1000_DEV_ID_82541EI: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
case E1000_DEV_ID_82541EI_MOBILE: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
hw->mac_type = e1000_82541; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
case E1000_DEV_ID_82541ER: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
case E1000_DEV_ID_82541GI: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
case E1000_DEV_ID_82541GI_LF: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
case E1000_DEV_ID_82541GI_MOBILE: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
hw->mac_type = e1000_82541_rev_2; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
case E1000_DEV_ID_82547EI: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
hw->mac_type = e1000_82547; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
case E1000_DEV_ID_82547GI: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
hw->mac_type = e1000_82547_rev_2; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
case E1000_DEV_ID_82573E: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
case E1000_DEV_ID_82573E_IAMT: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
hw->mac_type = e1000_82573; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
/* Should never have loaded on this device */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
return -E1000_ERR_MAC_TYPE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
hw->eeprom_semaphore_present = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
/* fall through */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
case e1000_82541: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
case e1000_82547: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
case e1000_82541_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
case e1000_82547_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
hw->asf_firmware_present = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
* Set media type and TBI compatibility. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
* **************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
e1000_set_media_type(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
uint32_t status; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
DEBUGFUNC("e1000_set_media_type"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
if(hw->mac_type != e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
/* tbi_compatibility is only valid on 82543 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
hw->tbi_compatibility_en = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
switch (hw->device_id) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
case E1000_DEV_ID_82545GM_SERDES: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
case E1000_DEV_ID_82546GB_SERDES: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
hw->media_type = e1000_media_type_internal_serdes; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
switch (hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
case e1000_82542_rev2_0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
case e1000_82542_rev2_1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
hw->media_type = e1000_media_type_fiber; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
/* The STATUS_TBIMODE bit is reserved or reused for the this |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
* device. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
hw->media_type = e1000_media_type_copper; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
status = E1000_READ_REG(hw, STATUS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
if (status & E1000_STATUS_TBIMODE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
hw->media_type = e1000_media_type_fiber; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
/* tbi_compatibility not valid on fiber */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
hw->tbi_compatibility_en = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
hw->media_type = e1000_media_type_copper; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
* Reset the transmit and receive units; mask and clear all interrupts. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
e1000_reset_hw(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
uint32_t ctrl_ext; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
uint32_t icr; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
uint32_t manc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
uint32_t led_ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
uint32_t timeout; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
uint32_t extcnf_ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
DEBUGFUNC("e1000_reset_hw"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
/* For 82542 (rev 2.0), disable MWI before issuing a device reset */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
if(hw->mac_type == e1000_82542_rev2_0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
e1000_pci_clear_mwi(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
if(hw->bus_type == e1000_bus_type_pci_express) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
/* Prevent the PCI-E bus from sticking if there is no TLP connection |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
* on the last TLP read/write transaction when MAC is reset. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
if(e1000_disable_pciex_master(hw) != E1000_SUCCESS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
DEBUGOUT("PCI-E Master disable polling has failed.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
/* Clear interrupt mask to stop board from generating interrupts */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
DEBUGOUT("Masking off all interrupts\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
E1000_WRITE_REG(hw, IMC, 0xffffffff); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
/* Disable the Transmit and Receive units. Then delay to allow |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
* any pending transactions to complete before we hit the MAC with |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
* the global reset. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
E1000_WRITE_REG(hw, RCTL, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
E1000_WRITE_REG(hw, TCTL, E1000_TCTL_PSP); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
/* The tbi_compatibility_on Flag must be cleared when Rctl is cleared. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
hw->tbi_compatibility_on = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
/* Delay to allow any outstanding PCI transactions to complete before |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
* resetting the device |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
msec_delay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
/* Must reset the PHY before resetting the MAC */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
msec_delay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
/* Must acquire the MDIO ownership before MAC reset. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
* Ownership defaults to firmware after a reset. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
if(hw->mac_type == e1000_82573) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
timeout = 10; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
448 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
do { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
if(extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
msec_delay(2); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
timeout--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
} while(timeout); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
/* Issue a global reset to the MAC. This will reset the chip's |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
* transmit, receive, DMA, and link units. It will not effect |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
* the current PCI configuration. The global reset bit is self- |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
* clearing, and should clear within a microsecond. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
DEBUGOUT("Issuing a global reset to MAC\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
case e1000_82544: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
case e1000_82540: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
case e1000_82545: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
case e1000_82546: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
case e1000_82541: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
case e1000_82541_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
/* These controllers can't ack the 64-bit write when issuing the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
* reset, so use IO-mapping as a workaround to issue the reset */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
case e1000_82545_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
case e1000_82546_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
/* Reset is performed on a shadow of the control register */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
E1000_WRITE_REG(hw, CTRL_DUP, (ctrl | E1000_CTRL_RST)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
/* After MAC reset, force reload of EEPROM to restore power-on settings to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
* device. Later controllers reload the EEPROM automatically, so just wait |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
* for reload to complete. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
case e1000_82542_rev2_0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
case e1000_82542_rev2_1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
case e1000_82543: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
case e1000_82544: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
/* Wait for reset to complete */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
udelay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
ctrl_ext |= E1000_CTRL_EXT_EE_RST; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
/* Wait for EEPROM reload */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
msec_delay(2); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
case e1000_82541: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
case e1000_82541_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
case e1000_82547: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
case e1000_82547_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
/* Wait for EEPROM reload */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
msec_delay(20); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
udelay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
ctrl_ext |= E1000_CTRL_EXT_EE_RST; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
/* fall through */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
ret_val = e1000_get_auto_rd_done(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
/* We don't want to continue accessing MAC registers. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
/* Wait for EEPROM reload (it happens automatically) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
msec_delay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
/* Disable HW ARPs on ASF enabled adapters */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
if(hw->mac_type >= e1000_82540 && hw->mac_type <= e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
539 |
manc = E1000_READ_REG(hw, MANC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
manc &= ~(E1000_MANC_ARP_EN); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
E1000_WRITE_REG(hw, MANC, manc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
e1000_phy_init_script(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
/* Configure activity LED after PHY reset */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
led_ctrl = E1000_READ_REG(hw, LEDCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
led_ctrl &= IGP_ACTIVITY_LED_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
E1000_WRITE_REG(hw, LEDCTL, led_ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
/* Clear interrupt mask to stop board from generating interrupts */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
DEBUGOUT("Masking off all interrupts\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
E1000_WRITE_REG(hw, IMC, 0xffffffff); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
/* Clear any pending interrupt events. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
icr = E1000_READ_REG(hw, ICR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
/* If MWI was previously enabled, reenable it. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
if(hw->mac_type == e1000_82542_rev2_0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
e1000_pci_set_mwi(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
* Performs basic configuration of the adapter. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
* Assumes that the controller has previously been reset and is in a |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
* post-reset uninitialized state. Initializes the receive address registers, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
* multicast table, and VLAN filter table. Calls routines to setup link |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
* configuration and flow control settings. Clears all on-chip counters. Leaves |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
* the transmit and receive units disabled and uninitialized. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
e1000_init_hw(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
uint32_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
uint16_t pcix_cmd_word; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
uint16_t pcix_stat_hi_word; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
uint16_t cmd_mmrbc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
uint16_t stat_mmrbc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
uint32_t mta_size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
DEBUGFUNC("e1000_init_hw"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
/* Initialize Identification LED */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
ret_val = e1000_id_led_init(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
DEBUGOUT("Error Initializing Identification LED\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
/* Set the media type and TBI compatibility */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
e1000_set_media_type(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
/* Disabling VLAN filtering. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
DEBUGOUT("Initializing the IEEE VLAN\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
if (hw->mac_type < e1000_82545_rev_3) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
E1000_WRITE_REG(hw, VET, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
e1000_clear_vfta(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
/* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
if(hw->mac_type == e1000_82542_rev2_0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
e1000_pci_clear_mwi(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
E1000_WRITE_REG(hw, RCTL, E1000_RCTL_RST); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
617 |
msec_delay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
/* Setup the receive address. This involves initializing all of the Receive |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
* Address Registers (RARs 0 - 15). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
e1000_init_rx_addrs(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
/* For 82542 (rev 2.0), take the receiver out of reset and enable MWI */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
if(hw->mac_type == e1000_82542_rev2_0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
E1000_WRITE_REG(hw, RCTL, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
msec_delay(1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
if(hw->pci_cmd_word & CMD_MEM_WRT_INVALIDATE) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
e1000_pci_set_mwi(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
/* Zero out the Multicast HASH table */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
DEBUGOUT("Zeroing the MTA\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
mta_size = E1000_MC_TBL_SIZE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
for(i = 0; i < mta_size; i++) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
/* Set the PCI priority bit correctly in the CTRL register. This |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
641 |
* determines if the adapter gives priority to receives, or if it |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
* gives equal priority to transmits and receives. Valid only on |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
* 82542 and 82543 silicon. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
if(hw->dma_fairness && hw->mac_type <= e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PRIOR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
650 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
651 |
case e1000_82545_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
case e1000_82546_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
/* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
if(hw->bus_type == e1000_bus_type_pcix) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
e1000_read_pci_cfg(hw, PCIX_COMMAND_REGISTER, &pcix_cmd_word); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
e1000_read_pci_cfg(hw, PCIX_STATUS_REGISTER_HI, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
659 |
&pcix_stat_hi_word); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
cmd_mmrbc = (pcix_cmd_word & PCIX_COMMAND_MMRBC_MASK) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
PCIX_COMMAND_MMRBC_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
PCIX_STATUS_HI_MMRBC_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
if(stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
if(cmd_mmrbc > stat_mmrbc) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
e1000_write_pci_cfg(hw, PCIX_COMMAND_REGISTER, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
&pcix_cmd_word); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
/* Call a subroutine to configure the link and setup flow control. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
ret_val = e1000_setup_link(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
/* Set the transmit descriptor write-back policy */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
if(hw->mac_type > e1000_82544) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
ctrl = E1000_READ_REG(hw, TXDCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
switch (hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
ctrl |= E1000_TXDCTL_COUNT_DESC; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
E1000_WRITE_REG(hw, TXDCTL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
if (hw->mac_type == e1000_82573) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
e1000_enable_tx_pkt_filtering(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
/* Clear all of the statistics registers (clear on read). It is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
* important that we do this after we have tried to establish link |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
* because the symbol error count will increment wildly if there |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
* is no link. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
703 |
e1000_clear_hw_cntrs(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
* Adjust SERDES output amplitude based on EEPROM setting. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
* hw - Struct containing variables accessed by shared code. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
e1000_adjust_serdes_amplitude(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
uint16_t eeprom_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
717 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
DEBUGFUNC("e1000_adjust_serdes_amplitude"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
if(hw->media_type != e1000_media_type_internal_serdes) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
case e1000_82545_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
case e1000_82546_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
ret_val = e1000_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1, &eeprom_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
if (ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
if(eeprom_data != EEPROM_RESERVED_WORD) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
/* Adjust SERDES output amplitude only. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
* Configures flow control and link settings. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
* Determines which flow control settings to use. Calls the apropriate media- |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
* specific link configuration function. Configures the flow control settings. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
* Assuming the adapter has a valid link partner, a valid link should be |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
* established. Assumes the hardware has previously been reset and the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
* transmitter and receiver are not enabled. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
e1000_setup_link(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
uint32_t ctrl_ext; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
uint16_t eeprom_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
DEBUGFUNC("e1000_setup_link"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
/* Read and store word 0x0F of the EEPROM. This word contains bits |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
* that determine the hardware's default PAUSE (flow control) mode, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
* a bit that determines whether the HW defaults to enabling or |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
* disabling auto-negotiation, and the direction of the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
* SW defined pins. If there is no SW over-ride of the flow |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
* control setting, then the variable hw->fc will |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
* be initialized based on a value in the EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
if(e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
DEBUGOUT("EEPROM Read Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
if(hw->fc == e1000_fc_default) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
if((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == 0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
hw->fc = e1000_fc_none; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
else if((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
EEPROM_WORD0F_ASM_DIR) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
hw->fc = e1000_fc_tx_pause; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
hw->fc = e1000_fc_full; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
/* We want to save off the original Flow Control configuration just |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
* in case we get disconnected and then reconnected into a different |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
* hub or switch with different Flow Control capabilities. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
if(hw->mac_type == e1000_82542_rev2_0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
hw->fc &= (~e1000_fc_tx_pause); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
if((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
hw->fc &= (~e1000_fc_rx_pause); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
hw->original_fc = hw->fc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
805 |
/* Take the 4 bits from EEPROM word 0x0F that determine the initial |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
* polarity value for the SW controlled pins, and setup the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
807 |
* Extended Device Control reg with that info. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
* This is needed because one of the SW controlled pins is used for |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
* signal detection. So this should be done before e1000_setup_pcs_link() |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
* or e1000_phy_setup() is called. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
if(hw->mac_type == e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) << |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
814 |
SWDPIO__EXT_SHIFT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
/* Call the necessary subroutine to configure the link. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
ret_val = (hw->media_type == e1000_media_type_copper) ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
e1000_setup_copper_link(hw) : |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
e1000_setup_fiber_serdes_link(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
823 |
/* Initialize the flow control address, type, and PAUSE timer |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
* registers to their default values. This is done even if flow |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
* control is disabled, because it does not hurt anything to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
* initialize these registers. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
DEBUGOUT("Initializing the Flow Control address, type and timer regs\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
/* Set the flow control receive threshold registers. Normally, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
* these registers will be set to a default threshold that may be |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
* adjusted later by the driver's runtime code. However, if the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
* ability to transmit pause frames in not enabled, then these |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
* registers will be set to 0. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
if(!(hw->fc & e1000_fc_tx_pause)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
E1000_WRITE_REG(hw, FCRTL, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
E1000_WRITE_REG(hw, FCRTH, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
/* We need to set up the Receive Threshold high and low water marks |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
* as well as (optionally) enabling the transmission of XON frames. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
if(hw->fc_send_xon) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
E1000_WRITE_REG(hw, FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
E1000_WRITE_REG(hw, FCRTL, hw->fc_low_water); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
* Sets up link for a fiber based or serdes based adapter |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
* Manipulates Physical Coding Sublayer functions in order to configure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
* link. Assumes the hardware has been previously reset and the transmitter |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
* and receiver are not enabled. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
e1000_setup_fiber_serdes_link(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
uint32_t status; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
uint32_t txcw = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
uint32_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
uint32_t signal = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
DEBUGFUNC("e1000_setup_fiber_serdes_link"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
/* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
* set when the optics detect a signal. On older adapters, it will be |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
* cleared when there is a signal. This applies to fiber media only. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
* If we're on serdes media, adjust the output amplitude to value set in |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
* the EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
if(hw->media_type == e1000_media_type_fiber) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
ret_val = e1000_adjust_serdes_amplitude(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
/* Take the link out of reset */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
ctrl &= ~(E1000_CTRL_LRST); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
/* Adjust VCO speed to improve BER performance */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
ret_val = e1000_set_vco_speed(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
e1000_config_collision_dist(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
/* Check for a software override of the flow control settings, and setup |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
* the device accordingly. If auto-negotiation is enabled, then software |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
* will have to set the "PAUSE" bits to the correct value in the Tranmsit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
* Config Word Register (TXCW) and re-start auto-negotiation. However, if |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
909 |
* auto-negotiation is disabled, then software will have to manually |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
910 |
* configure the two flow control enable bits in the CTRL register. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
* The possible values of the "fc" parameter are: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
* 0: Flow control is completely disabled |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
* 1: Rx flow control is enabled (we can receive pause frames, but |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
* not send pause frames). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
* 2: Tx flow control is enabled (we can send pause frames but we do |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
* not support receiving pause frames). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
918 |
* 3: Both Rx and TX flow control (symmetric) are enabled. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
switch (hw->fc) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
case e1000_fc_none: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
/* Flow control is completely disabled by a software over-ride. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
case e1000_fc_rx_pause: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
/* RX Flow control is enabled and TX Flow control is disabled by a |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
927 |
* software over-ride. Since there really isn't a way to advertise |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
* that we are capable of RX Pause ONLY, we will advertise that we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
* support both symmetric and asymmetric RX PAUSE. Later, we will |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
* disable the adapter's ability to send PAUSE frames. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
case e1000_fc_tx_pause: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
/* TX Flow control is enabled, and RX Flow control is disabled, by a |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
* software over-ride. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_ASM_DIR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
case e1000_fc_full: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
/* Flow control (both RX and TX) is enabled by a software over-ride. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
DEBUGOUT("Flow control param set incorrectly\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
return -E1000_ERR_CONFIG; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
949 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
950 |
/* Since auto-negotiation is enabled, take the link out of reset (the link |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
* will be in reset, because we previously reset the chip). This will |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
* restart auto-negotiation. If auto-neogtiation is successful then the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
* link-up status bit will be set and the flow control enable bits (RFCE |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
* and TFCE) will be set according to their negotiated value. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
DEBUGOUT("Auto-negotiation enabled\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
E1000_WRITE_REG(hw, TXCW, txcw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
hw->txcw = txcw; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
msec_delay(1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
/* If we have a signal (the cable is plugged in) then poll for a "Link-Up" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
* indication in the Device Status Register. Time-out if a link isn't |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
* seen in 500 milliseconds seconds (Auto-negotiation should complete in |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
* less than 500 milliseconds even if the other end is doing it in SW). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
* For internal serdes, we just assume a signal is present, then poll. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
if(hw->media_type == e1000_media_type_internal_serdes || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
(E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
DEBUGOUT("Looking for Link\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
for(i = 0; i < (LINK_UP_TIMEOUT / 10); i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
msec_delay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
status = E1000_READ_REG(hw, STATUS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
if(status & E1000_STATUS_LU) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
if(i == (LINK_UP_TIMEOUT / 10)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
DEBUGOUT("Never got a valid link from auto-neg!!!\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
hw->autoneg_failed = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
/* AutoNeg failed to achieve a link, so we'll call |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
* e1000_check_for_link. This routine will force the link up if |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
* we detect a signal. This will allow us to communicate with |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
* non-autonegotiating link partners. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
ret_val = e1000_check_for_link(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
DEBUGOUT("Error while checking for link\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
hw->autoneg_failed = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
hw->autoneg_failed = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
DEBUGOUT("Valid Link Found\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
DEBUGOUT("No Signal Detected\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
* Make sure we have a valid PHY and change PHY mode before link setup. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
e1000_copper_link_preconfig(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
DEBUGFUNC("e1000_copper_link_preconfig"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
/* With 82543, we need to force speed and duplex on the MAC equal to what |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
* the PHY speed and duplex configuration is. In addition, we need to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
* perform a hardware reset on the PHY to take it out of reset. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
if(hw->mac_type > e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
ctrl |= E1000_CTRL_SLU; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | E1000_CTRL_SLU); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
ret_val = e1000_phy_hw_reset(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1030 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1031 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
/* Make sure we have a valid PHY */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
ret_val = e1000_detect_gig_phy(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
DEBUGOUT("Error, did not detect valid phy.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
DEBUGOUT1("Phy ID = %x \n", hw->phy_id); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
/* Set PHY to class A mode (if necessary) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
ret_val = e1000_set_phy_mode(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
if((hw->mac_type == e1000_82545_rev_3) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
(hw->mac_type == e1000_82546_rev_3)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
phy_data |= 0x00000008; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
if(hw->mac_type <= e1000_82543 || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
hw->phy_reset_disable = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
/******************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
* Copper link setup for e1000_phy_igp series. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1066 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
*********************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
e1000_copper_link_igp_setup(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1071 |
uint32_t led_ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
DEBUGFUNC("e1000_copper_link_igp_setup"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
if (hw->phy_reset_disable) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
ret_val = e1000_phy_reset(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
if (ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
DEBUGOUT("Error Resetting the PHY\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
/* Wait 10ms for MAC to configure PHY from eeprom settings */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
msec_delay(15); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
/* Configure activity LED after PHY reset */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
led_ctrl = E1000_READ_REG(hw, LEDCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
led_ctrl &= IGP_ACTIVITY_LED_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
E1000_WRITE_REG(hw, LEDCTL, led_ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
/* disable lplu d3 during driver init */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
ret_val = e1000_set_d3_lplu_state(hw, FALSE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
if (ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
DEBUGOUT("Error Disabling LPLU D3\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
/* disable lplu d0 during driver init */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
ret_val = e1000_set_d0_lplu_state(hw, FALSE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
if (ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
DEBUGOUT("Error Disabling LPLU D0\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
/* Configure mdi-mdix settings */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
if (ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1114 |
hw->dsp_config_state = e1000_dsp_config_disabled; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
/* Force MDI for earlier revs of the IGP PHY */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
phy_data &= ~(IGP01E1000_PSCR_AUTO_MDIX | IGP01E1000_PSCR_FORCE_MDI_MDIX); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
hw->mdix = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
hw->dsp_config_state = e1000_dsp_config_enabled; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
switch (hw->mdix) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
case 1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
case 2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
phy_data |= IGP01E1000_PSCR_FORCE_MDI_MDIX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
case 0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
phy_data |= IGP01E1000_PSCR_AUTO_MDIX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1135 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
/* set auto-master slave resolution settings */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
if(hw->autoneg) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
e1000_ms_type phy_ms_setting = hw->master_slave; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
if(hw->ffe_config_state == e1000_ffe_config_active) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
hw->ffe_config_state = e1000_ffe_config_enabled; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
if(hw->dsp_config_state == e1000_dsp_config_activated) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
hw->dsp_config_state = e1000_dsp_config_enabled; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1150 |
/* when autonegotiation advertisment is only 1000Mbps then we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
* should disable SmartSpeed and enable Auto MasterSlave |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
* resolution as hardware default. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
if(hw->autoneg_advertised == ADVERTISE_1000_FULL) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
/* Disable SmartSpeed */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1155 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
ret_val = e1000_write_phy_reg(hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
IGP01E1000_PHY_PORT_CONFIG, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
/* Set auto Master/Slave resolution process */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
phy_data &= ~CR_1000T_MS_ENABLE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1177 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
/* load defaults for future use */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
hw->original_master_slave = (phy_data & CR_1000T_MS_ENABLE) ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
((phy_data & CR_1000T_MS_VALUE) ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
e1000_ms_force_master : |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
e1000_ms_force_slave) : |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
e1000_ms_auto; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
switch (phy_ms_setting) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
case e1000_ms_force_master: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
phy_data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
case e1000_ms_force_slave: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
phy_data |= CR_1000T_MS_ENABLE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
phy_data &= ~(CR_1000T_MS_VALUE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
case e1000_ms_auto: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
phy_data &= ~CR_1000T_MS_ENABLE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
/******************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
* Copper link setup for e1000_phy_m88 series. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
*********************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
e1000_copper_link_mgp_setup(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
DEBUGFUNC("e1000_copper_link_mgp_setup"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
if(hw->phy_reset_disable) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
/* Enable CRS on TX. This must be set for half-duplex operation. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
/* Options: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
* MDI/MDI-X = 0 (default) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
* 0 - Auto for all speeds |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
* 1 - MDI mode |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
* 2 - MDI-X mode |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
* 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
switch (hw->mdix) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
case 1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
phy_data |= M88E1000_PSCR_MDI_MANUAL_MODE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
case 2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
phy_data |= M88E1000_PSCR_MDIX_MANUAL_MODE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
case 3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
phy_data |= M88E1000_PSCR_AUTO_X_1000T; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
case 0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
phy_data |= M88E1000_PSCR_AUTO_X_MODE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1253 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
/* Options: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
* disable_polarity_correction = 0 (default) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
* Automatic Correction for Reversed Cable Polarity |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
* 0 - Disabled |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
* 1 - Enabled |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
if(hw->disable_polarity_correction == 1) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
/* Force TX_CLK in the Extended PHY Specific Control Register |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
* to 25MHz clock. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
phy_data |= M88E1000_EPSCR_TX_CLK_25; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1277 |
if (hw->phy_revision < M88E1011_I_REV_4) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
/* Configure Master and Slave downshift values */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
ret_val = e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
/* SW Reset the PHY so all changes take effect */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
ret_val = e1000_phy_reset(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
DEBUGOUT("Error Resetting the PHY\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1298 |
/******************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
* Setup auto-negotiation and flow control advertisements, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
* and then perform auto-negotiation. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
*********************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1305 |
e1000_copper_link_autoneg(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
DEBUGFUNC("e1000_copper_link_autoneg"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1311 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
/* Perform some bounds checking on the hw->autoneg_advertised |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
* parameter. If this variable is zero, then set it to the default. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
/* If autoneg_advertised is zero, we assume it was not defaulted |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
* by the calling code so we set to advertise full capability. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1319 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1320 |
if(hw->autoneg_advertised == 0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1324 |
ret_val = e1000_phy_setup_autoneg(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
DEBUGOUT("Error Setting up Auto-Negotiation\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
DEBUGOUT("Restarting Auto-Neg\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
/* Restart auto-negotiation by setting the Auto Neg Enable bit and |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
* the Auto Neg Restart bit in the PHY control register. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1333 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1336 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
/* Does the user want to wait for Auto-Neg to complete here, or |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
* check at a later time (for example, callback routine). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1346 |
if(hw->wait_autoneg_complete) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
ret_val = e1000_wait_autoneg(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1348 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
DEBUGOUT("Error while waiting for autoneg to complete\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
hw->get_link_status = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1357 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
* Config the MAC and the PHY after link is up. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1362 |
* 1) Set up the MAC to the current PHY speed/duplex |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
* if we are on 82543. If we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
* are on newer silicon, we only need to configure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
* collision distance in the Transmit Control Register. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
* 2) Set up flow control on the MAC to that established with |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1367 |
* the link partner. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
* 3) Config DSP to improve Gigabit link quality for some PHY revisions. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
e1000_copper_link_postconfig(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1374 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
DEBUGFUNC("e1000_copper_link_postconfig"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
if(hw->mac_type >= e1000_82544) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
e1000_config_collision_dist(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
ret_val = e1000_config_mac_to_phy(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
DEBUGOUT("Error configuring MAC to PHY settings\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
ret_val = e1000_config_fc_after_link_up(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
DEBUGOUT("Error Configuring Flow Control\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
/* Config DSP to improve Giga link quality */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
if(hw->phy_type == e1000_phy_igp) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
ret_val = e1000_config_dsp_after_link_change(hw, TRUE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
DEBUGOUT("Error Configuring DSP after link up\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
* Detects which PHY is present and setup the speed and duplex |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
e1000_setup_copper_link(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
uint16_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
DEBUGFUNC("e1000_setup_copper_link"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
/* Check if it is a valid PHY and set PHY mode if necessary. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
ret_val = e1000_copper_link_preconfig(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1424 |
if (hw->phy_type == e1000_phy_igp || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
hw->phy_type == e1000_phy_igp_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
ret_val = e1000_copper_link_igp_setup(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
} else if (hw->phy_type == e1000_phy_m88) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
ret_val = e1000_copper_link_mgp_setup(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1432 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1433 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1434 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
if(hw->autoneg) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
/* Setup autoneg and flow control advertisement |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
* and perform autonegotiation */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
ret_val = e1000_copper_link_autoneg(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
/* PHY will be set to 10H, 10F, 100H,or 100F |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1443 |
* depending on value from forced_speed_duplex. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
DEBUGOUT("Forcing speed and duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
ret_val = e1000_phy_force_speed_duplex(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
DEBUGOUT("Error Forcing Speed and Duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1452 |
/* Check link status. Wait up to 100 microseconds for link to become |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
* valid. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
for(i = 0; i < 10; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1461 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
if(phy_data & MII_SR_LINK_STATUS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
/* Config the MAC and PHY after link is up */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
ret_val = e1000_copper_link_postconfig(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1466 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1467 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
DEBUGOUT("Valid link established!!!\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
udelay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
DEBUGOUT("Unable to establish link!!!\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
* Configures PHY autoneg and flow control advertisement settings |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
e1000_phy_setup_autoneg(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
uint16_t mii_autoneg_adv_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1489 |
uint16_t mii_1000t_ctrl_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
DEBUGFUNC("e1000_phy_setup_autoneg"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
/* Read the MII Auto-Neg Advertisement Register (Address 4). */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1496 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
/* Read the MII 1000Base-T Control Register (Address 9). */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1502 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
/* Need to parse both autoneg_advertised and fc and set up |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
* the appropriate PHY registers. First we will parse for |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
* autoneg_advertised software override. Since we can advertise |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
* a plethora of combinations, we need to check each bit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
* individually. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
/* First we clear all the 10/100 mb speed bits in the Auto-Neg |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
* Advertisement Register (Address 4) and the 1000 mb speed bits in |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
* the 1000Base-T Control Register (Address 9). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
mii_autoneg_adv_reg &= ~REG4_SPEED_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
/* Do we want to advertise 10 Mb Half Duplex? */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
if(hw->autoneg_advertised & ADVERTISE_10_HALF) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1521 |
DEBUGOUT("Advertise 10mb Half duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
/* Do we want to advertise 10 Mb Full Duplex? */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
if(hw->autoneg_advertised & ADVERTISE_10_FULL) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
DEBUGOUT("Advertise 10mb Full duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
/* Do we want to advertise 100 Mb Half Duplex? */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
if(hw->autoneg_advertised & ADVERTISE_100_HALF) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
DEBUGOUT("Advertise 100mb Half duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
/* Do we want to advertise 100 Mb Full Duplex? */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1538 |
if(hw->autoneg_advertised & ADVERTISE_100_FULL) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
DEBUGOUT("Advertise 100mb Full duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1542 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
/* We do not allow the Phy to advertise 1000 Mb Half Duplex */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
if(hw->autoneg_advertised & ADVERTISE_1000_HALF) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
DEBUGOUT("Advertise 1000mb Half duplex requested, request denied!\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
/* Do we want to advertise 1000 Mb Full Duplex? */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
if(hw->autoneg_advertised & ADVERTISE_1000_FULL) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
DEBUGOUT("Advertise 1000mb Full duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1553 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
/* Check for a software override of the flow control settings, and |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
* setup the PHY advertisement registers accordingly. If |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
* auto-negotiation is enabled, then software will have to set the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
* "PAUSE" bits to the correct value in the Auto-Negotiation |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
* Advertisement Register (PHY_AUTONEG_ADV) and re-start auto-negotiation. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
* The possible values of the "fc" parameter are: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
* 0: Flow control is completely disabled |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
* 1: Rx flow control is enabled (we can receive pause frames |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
* but not send pause frames). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
* 2: Tx flow control is enabled (we can send pause frames |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
* but we do not support receiving pause frames). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
* 3: Both Rx and TX flow control (symmetric) are enabled. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
* other: No software override. The flow control configuration |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1568 |
* in the EEPROM is used. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1569 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
switch (hw->fc) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
case e1000_fc_none: /* 0 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
/* Flow control (RX & TX) is completely disabled by a |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
* software over-ride. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
case e1000_fc_rx_pause: /* 1 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
/* RX Flow control is enabled, and TX Flow control is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
* disabled, by a software over-ride. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1580 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
/* Since there really isn't a way to advertise that we are |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
* capable of RX Pause ONLY, we will advertise that we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
* support both symmetric and asymmetric RX PAUSE. Later |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
* (in e1000_config_fc_after_link_up) we will disable the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
*hw's ability to send PAUSE frames. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
case e1000_fc_tx_pause: /* 2 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
/* TX Flow control is enabled, and RX Flow control is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
* disabled, by a software over-ride. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1594 |
mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
case e1000_fc_full: /* 3 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
/* Flow control (both RX and TX) is enabled by a software |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
* over-ride. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
DEBUGOUT("Flow control param set incorrectly\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
return -E1000_ERR_CONFIG; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1613 |
ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1615 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
* Force PHY speed and duplex settings to hw->forced_speed_duplex |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
e1000_phy_force_speed_duplex(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
uint16_t mii_ctrl_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
uint16_t mii_status_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
uint16_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
DEBUGFUNC("e1000_phy_force_speed_duplex"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
/* Turn off Flow control if we are forcing speed and duplex. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
hw->fc = e1000_fc_none; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
DEBUGOUT1("hw->fc = %d\n", hw->fc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
/* Read the Device Control Register. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
/* Set the bits to Force Speed and Duplex in the Device Ctrl Reg. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
ctrl &= ~(DEVICE_SPEED_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
/* Clear the Auto Speed Detect Enable bit. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
ctrl &= ~E1000_CTRL_ASDE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
/* Read the MII Control Register. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
/* We need to disable autoneg in order to force link and duplex. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
mii_ctrl_reg &= ~MII_CR_AUTO_NEG_EN; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
/* Are we forcing Full or Half Duplex? */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
if(hw->forced_speed_duplex == e1000_100_full || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
hw->forced_speed_duplex == e1000_10_full) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
/* We want to force full duplex so we SET the full duplex bits in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
* Device and MII Control Registers. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
ctrl |= E1000_CTRL_FD; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
mii_ctrl_reg |= MII_CR_FULL_DUPLEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
DEBUGOUT("Full Duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
/* We want to force half duplex so we CLEAR the full duplex bits in |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
* the Device and MII Control Registers. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
ctrl &= ~E1000_CTRL_FD; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
mii_ctrl_reg &= ~MII_CR_FULL_DUPLEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
DEBUGOUT("Half Duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
/* Are we forcing 100Mbps??? */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
if(hw->forced_speed_duplex == e1000_100_full || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
hw->forced_speed_duplex == e1000_100_half) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
/* Set the 100Mb bit and turn off the 1000Mb and 10Mb bits. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
ctrl |= E1000_CTRL_SPD_100; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
mii_ctrl_reg |= MII_CR_SPEED_100; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
mii_ctrl_reg &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
DEBUGOUT("Forcing 100mb "); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1688 |
/* Set the 10Mb bit and turn off the 1000Mb and 100Mb bits. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
mii_ctrl_reg |= MII_CR_SPEED_10; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
mii_ctrl_reg &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
DEBUGOUT("Forcing 10mb "); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
e1000_config_collision_dist(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
/* Write the configured values back to the Device Control Reg. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
if (hw->phy_type == e1000_phy_m88) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
/* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
* forced whenever speed are duplex are forced. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
DEBUGOUT1("M88E1000 PSCR: %x \n", phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1715 |
/* Need to reset the PHY or these changes will be ignored */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
mii_ctrl_reg |= MII_CR_RESET; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
/* Clear Auto-Crossover to force MDI manually. IGP requires MDI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
* forced whenever speed or duplex are forced. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1726 |
phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
/* Write back the modified PHY MII control register. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
ret_val = e1000_write_phy_reg(hw, PHY_CTRL, mii_ctrl_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
udelay(1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
/* The wait_autoneg_complete flag may be a little misleading here. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
* Since we are forcing speed and duplex, Auto-Neg is not enabled. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
* But we do want to delay for a period while forcing only so we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
* don't generate false No Link messages. So we will wait here |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
* only if the user has set wait_autoneg_complete to 1, which is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
* the default. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
if(hw->wait_autoneg_complete) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
/* We will wait for autoneg to complete. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
DEBUGOUT("Waiting for forced speed/duplex link.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
mii_status_reg = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
/* We will wait for autoneg to complete or 4.5 seconds to expire. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
for(i = PHY_FORCE_TIME; i > 0; i--) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
/* Read the MII Status Register and wait for Auto-Neg Complete bit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
* to be set. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1761 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
if(mii_status_reg & MII_SR_LINK_STATUS) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
msec_delay(100); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
if((i == 0) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
(hw->phy_type == e1000_phy_m88)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
/* We didn't get link. Reset the DSP and wait again for link. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
ret_val = e1000_phy_reset_dsp(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
DEBUGOUT("Error Resetting PHY DSP\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
/* This loop will early-out if the link condition has been met. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1778 |
for(i = PHY_FORCE_TIME; i > 0; i--) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
if(mii_status_reg & MII_SR_LINK_STATUS) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
msec_delay(100); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
/* Read the MII Status Register and wait for Auto-Neg Complete bit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
* to be set. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
if (hw->phy_type == e1000_phy_m88) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
/* Because we reset the PHY above, we need to re-force TX_CLK in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
* Extended PHY Specific Control Register to 25MHz clock. This value |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
* defaults back to a 2.5MHz clock when the PHY is reset. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
phy_data |= M88E1000_EPSCR_TX_CLK_25; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
ret_val = e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
/* In addition, because of the s/w reset above, we need to enable CRS on |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
* TX. This must be set for both full and half duplex operation. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
if((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
(!hw->autoneg) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
(hw->forced_speed_duplex == e1000_10_full || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
hw->forced_speed_duplex == e1000_10_half)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
ret_val = e1000_polarity_reversal_workaround(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1825 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1832 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
* Sets the collision distance in the Transmit Control register |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
* Link should have been established previously. Reads the speed and duplex |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
* information from the Device Status register. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
e1000_config_collision_dist(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
uint32_t tctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
DEBUGFUNC("e1000_config_collision_dist"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
tctl = E1000_READ_REG(hw, TCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
tctl &= ~E1000_TCTL_COLD; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
tctl |= E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
E1000_WRITE_REG(hw, TCTL, tctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
* Sets MAC speed and duplex settings to reflect the those in the PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
* mii_reg - data to write to the MII control register |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
* The contents of the PHY register containing the needed information need to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
* be passed in. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
e1000_config_mac_to_phy(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1868 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1869 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
DEBUGFUNC("e1000_config_mac_to_phy"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
/* 82544 or newer MAC, Auto Speed Detection takes care of |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
* MAC speed/duplex configuration.*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
if (hw->mac_type >= e1000_82544) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
/* Read the Device Control Register and set the bits to Force Speed |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
* and Duplex. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
ctrl &= ~(E1000_CTRL_SPD_SEL | E1000_CTRL_ILOS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
/* Set up duplex in the Device Control and Transmit Control |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
* registers depending on negotiated values. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
if(phy_data & M88E1000_PSSR_DPLX) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
ctrl |= E1000_CTRL_FD; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1895 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
ctrl &= ~E1000_CTRL_FD; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1898 |
e1000_config_collision_dist(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
/* Set up speed in the Device Control register depending on |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
* negotiated values. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
ctrl |= E1000_CTRL_SPD_1000; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
else if((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_100MBS) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
ctrl |= E1000_CTRL_SPD_100; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
/* Write the configured values back to the Device Control Reg. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1913 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
* Forces the MAC's flow control settings. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
* Sets the TFCE and RFCE bits in the device control register to reflect |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1919 |
* the adapter settings. TFCE and RFCE need to be explicitly set by |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
* software when a Copper PHY is used because autonegotiation is managed |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
* by the PHY rather than the MAC. Software must also configure these |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
* bits when link is forced on a fiber connection. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
e1000_force_mac_fc(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
DEBUGFUNC("e1000_force_mac_fc"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
/* Get the current configuration of the Device Control Register */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
/* Because we didn't get link via the internal auto-negotiation |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
* mechanism (we either forced link or we got link via PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
* auto-neg), we have to manually enable/disable transmit an |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
* receive flow control. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
* The "Case" statement below enables/disable flow control |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
* according to the "hw->fc" parameter. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
* The possible values of the "fc" parameter are: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
* 0: Flow control is completely disabled |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
* 1: Rx flow control is enabled (we can receive pause |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
* frames but not send pause frames). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
* 2: Tx flow control is enabled (we can send pause frames |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
* frames but we do not receive pause frames). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
* 3: Both Rx and TX flow control (symmetric) is enabled. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
* other: No other values should be possible at this point. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
switch (hw->fc) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
case e1000_fc_none: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
case e1000_fc_rx_pause: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
ctrl &= (~E1000_CTRL_TFCE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
ctrl |= E1000_CTRL_RFCE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
case e1000_fc_tx_pause: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
ctrl &= (~E1000_CTRL_RFCE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
ctrl |= E1000_CTRL_TFCE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
case e1000_fc_full: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
DEBUGOUT("Flow control param set incorrectly\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
return -E1000_ERR_CONFIG; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
/* Disable TX Flow Control for 82542 (rev 2.0) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
if(hw->mac_type == e1000_82542_rev2_0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
ctrl &= (~E1000_CTRL_TFCE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1979 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
* Configures flow control settings after link is established |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
* Should be called immediately after a valid link has been established. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
* Forces MAC flow control settings if link was forced. When in MII/GMII mode |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
* and autonegotiation is enabled, the MAC flow control settings will be set |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
* based on the flow control negotiated by the PHY. In TBI mode, the TFCE |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
* and RFCE bits will be automaticaly set to the negotiated flow control mode. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1991 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
e1000_config_fc_after_link_up(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
uint16_t mii_status_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
uint16_t mii_nway_adv_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
uint16_t mii_nway_lp_ability_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
uint16_t speed; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
uint16_t duplex; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
DEBUGFUNC("e1000_config_fc_after_link_up"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
/* Check for the case where we have fiber media and auto-neg failed |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
* so we had to force link. In this case, we need to force the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
* configuration of the MAC to match the "fc" parameter. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
if(((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
((hw->media_type == e1000_media_type_internal_serdes) && (hw->autoneg_failed)) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
((hw->media_type == e1000_media_type_copper) && (!hw->autoneg))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
ret_val = e1000_force_mac_fc(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
DEBUGOUT("Error forcing flow control settings\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2016 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
/* Check for the case where we have copper media and auto-neg is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
* enabled. In this case, we need to check and see if Auto-Neg |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
* has completed, and if so, how the PHY and link partner has |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
* flow control configured. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
if((hw->media_type == e1000_media_type_copper) && hw->autoneg) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
/* Read the MII Status Register and check to see if AutoNeg |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
* has completed. We read this twice because this reg has |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
* some "sticky" (latched) bits. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
if(mii_status_reg & MII_SR_AUTONEG_COMPLETE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
/* The AutoNeg process has completed, so we now need to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
* read both the Auto Negotiation Advertisement Register |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
* (Address 4) and the Auto_Negotiation Base Page Ability |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
* Register (Address 5) to determine how flow control was |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
* negotiated. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
&mii_nway_adv_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
&mii_nway_lp_ability_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
/* Two bits in the Auto Negotiation Advertisement Register |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
* (Address 4) and two bits in the Auto Negotiation Base |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
* Page Ability Register (Address 5) determine flow control |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
* for both the PHY and the link partner. The following |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
* table, taken out of the IEEE 802.3ab/D6.0 dated March 25, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
* 1999, describes these PAUSE resolution bits and how flow |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
* control is determined based upon these settings. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2057 |
* NOTE: DC = Don't Care |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2058 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2059 |
* LOCAL DEVICE | LINK PARTNER |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2060 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | NIC Resolution |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2061 |
*-------|---------|-------|---------|-------------------- |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2062 |
* 0 | 0 | DC | DC | e1000_fc_none |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2063 |
* 0 | 1 | 0 | DC | e1000_fc_none |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2064 |
* 0 | 1 | 1 | 0 | e1000_fc_none |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2065 |
* 0 | 1 | 1 | 1 | e1000_fc_tx_pause |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2066 |
* 1 | 0 | 0 | DC | e1000_fc_none |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2067 |
* 1 | DC | 1 | DC | e1000_fc_full |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2068 |
* 1 | 1 | 0 | 0 | e1000_fc_none |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2069 |
* 1 | 1 | 0 | 1 | e1000_fc_rx_pause |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2070 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2071 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2072 |
/* Are both PAUSE bits set to 1? If so, this implies |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2073 |
* Symmetric Flow Control is enabled at both ends. The |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2074 |
* ASM_DIR bits are irrelevant per the spec. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2075 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2076 |
* For Symmetric Flow Control: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2077 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2078 |
* LOCAL DEVICE | LINK PARTNER |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2079 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2080 |
*-------|---------|-------|---------|-------------------- |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2081 |
* 1 | DC | 1 | DC | e1000_fc_full |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2082 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2083 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2084 |
if((mii_nway_adv_reg & NWAY_AR_PAUSE) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2085 |
(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2086 |
/* Now we need to check if the user selected RX ONLY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2087 |
* of pause frames. In this case, we had to advertise |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2088 |
* FULL flow control because we could not advertise RX |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2089 |
* ONLY. Hence, we must now check to see if we need to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2090 |
* turn OFF the TRANSMISSION of PAUSE frames. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2091 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2092 |
if(hw->original_fc == e1000_fc_full) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2093 |
hw->fc = e1000_fc_full; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2094 |
DEBUGOUT("Flow Control = FULL.\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2095 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2096 |
hw->fc = e1000_fc_rx_pause; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2097 |
DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2098 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2099 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2100 |
/* For receiving PAUSE frames ONLY. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2101 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2102 |
* LOCAL DEVICE | LINK PARTNER |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2103 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2104 |
*-------|---------|-------|---------|-------------------- |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2105 |
* 0 | 1 | 1 | 1 | e1000_fc_tx_pause |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2106 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2107 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2108 |
else if(!(mii_nway_adv_reg & NWAY_AR_PAUSE) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2109 |
(mii_nway_adv_reg & NWAY_AR_ASM_DIR) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2110 |
(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2111 |
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2112 |
hw->fc = e1000_fc_tx_pause; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2113 |
DEBUGOUT("Flow Control = TX PAUSE frames only.\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2114 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2115 |
/* For transmitting PAUSE frames ONLY. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2116 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2117 |
* LOCAL DEVICE | LINK PARTNER |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2118 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2119 |
*-------|---------|-------|---------|-------------------- |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2120 |
* 1 | 1 | 0 | 1 | e1000_fc_rx_pause |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2121 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2122 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2123 |
else if((mii_nway_adv_reg & NWAY_AR_PAUSE) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2124 |
(mii_nway_adv_reg & NWAY_AR_ASM_DIR) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2125 |
!(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2126 |
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2127 |
hw->fc = e1000_fc_rx_pause; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2128 |
DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2129 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2130 |
/* Per the IEEE spec, at this point flow control should be |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2131 |
* disabled. However, we want to consider that we could |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2132 |
* be connected to a legacy switch that doesn't advertise |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2133 |
* desired flow control, but can be forced on the link |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2134 |
* partner. So if we advertised no flow control, that is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2135 |
* what we will resolve to. If we advertised some kind of |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2136 |
* receive capability (Rx Pause Only or Full Flow Control) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2137 |
* and the link partner advertised none, we will configure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2138 |
* ourselves to enable Rx Flow Control only. We can do |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2139 |
* this safely for two reasons: If the link partner really |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2140 |
* didn't want flow control enabled, and we enable Rx, no |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2141 |
* harm done since we won't be receiving any PAUSE frames |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2142 |
* anyway. If the intent on the link partner was to have |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2143 |
* flow control enabled, then by us enabling RX only, we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2144 |
* can at least receive pause frames and process them. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2145 |
* This is a good idea because in most cases, since we are |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2146 |
* predominantly a server NIC, more times than not we will |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2147 |
* be asked to delay transmission of packets than asking |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2148 |
* our link partner to pause transmission of frames. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2149 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2150 |
else if((hw->original_fc == e1000_fc_none || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2151 |
hw->original_fc == e1000_fc_tx_pause) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2152 |
hw->fc_strict_ieee) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2153 |
hw->fc = e1000_fc_none; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2154 |
DEBUGOUT("Flow Control = NONE.\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2155 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2156 |
hw->fc = e1000_fc_rx_pause; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2157 |
DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2158 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2159 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2160 |
/* Now we need to do one last check... If we auto- |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2161 |
* negotiated to HALF DUPLEX, flow control should not be |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2162 |
* enabled per IEEE 802.3 spec. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2163 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2164 |
ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2165 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2166 |
DEBUGOUT("Error getting link speed and duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2167 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2168 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2169 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2170 |
if(duplex == HALF_DUPLEX) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2171 |
hw->fc = e1000_fc_none; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2172 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2173 |
/* Now we call a subroutine to actually force the MAC |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2174 |
* controller to use the correct flow control settings. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2175 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2176 |
ret_val = e1000_force_mac_fc(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2177 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2178 |
DEBUGOUT("Error forcing flow control settings\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2179 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2180 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2181 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2182 |
DEBUGOUT("Copper PHY and Auto Neg has not completed.\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2183 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2184 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2185 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2186 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2187 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2188 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2189 |
* Checks to see if the link status of the hardware has changed. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2190 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2191 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2192 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2193 |
* Called by any function that needs to check the link status of the adapter. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2194 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2195 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2196 |
e1000_check_for_link(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2197 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2198 |
uint32_t rxcw = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2199 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2200 |
uint32_t status; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2201 |
uint32_t rctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2202 |
uint32_t icr; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2203 |
uint32_t signal = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2204 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2205 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2206 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2207 |
DEBUGFUNC("e1000_check_for_link"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2208 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2209 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2210 |
status = E1000_READ_REG(hw, STATUS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2211 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2212 |
/* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2213 |
* set when the optics detect a signal. On older adapters, it will be |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2214 |
* cleared when there is a signal. This applies to fiber media only. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2215 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2216 |
if((hw->media_type == e1000_media_type_fiber) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2217 |
(hw->media_type == e1000_media_type_internal_serdes)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2218 |
rxcw = E1000_READ_REG(hw, RXCW); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2219 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2220 |
if(hw->media_type == e1000_media_type_fiber) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2221 |
signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2222 |
if(status & E1000_STATUS_LU) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2223 |
hw->get_link_status = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2224 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2225 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2226 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2227 |
/* If we have a copper PHY then we only want to go out to the PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2228 |
* registers to see if Auto-Neg has completed and/or if our link |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2229 |
* status has changed. The get_link_status flag will be set if we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2230 |
* receive a Link Status Change interrupt or we have Rx Sequence |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2231 |
* Errors. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2232 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2233 |
if((hw->media_type == e1000_media_type_copper) && hw->get_link_status) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2234 |
/* First we want to see if the MII Status Register reports |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2235 |
* link. If so, then we want to get the current speed/duplex |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2236 |
* of the PHY. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2237 |
* Read the register twice since the link bit is sticky. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2238 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2239 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2240 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2241 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2242 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2243 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2244 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2245 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2246 |
if(phy_data & MII_SR_LINK_STATUS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2247 |
hw->get_link_status = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2248 |
/* Check if there was DownShift, must be checked immediately after |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2249 |
* link-up */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2250 |
e1000_check_downshift(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2251 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2252 |
/* If we are on 82544 or 82543 silicon and speed/duplex |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2253 |
* are forced to 10H or 10F, then we will implement the polarity |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2254 |
* reversal workaround. We disable interrupts first, and upon |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2255 |
* returning, place the devices interrupt state to its previous |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2256 |
* value except for the link status change interrupt which will |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2257 |
* happen due to the execution of this workaround. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2258 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2259 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2260 |
if((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2261 |
(!hw->autoneg) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2262 |
(hw->forced_speed_duplex == e1000_10_full || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2263 |
hw->forced_speed_duplex == e1000_10_half)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2264 |
E1000_WRITE_REG(hw, IMC, 0xffffffff); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2265 |
ret_val = e1000_polarity_reversal_workaround(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2266 |
icr = E1000_READ_REG(hw, ICR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2267 |
E1000_WRITE_REG(hw, ICS, (icr & ~E1000_ICS_LSC)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2268 |
E1000_WRITE_REG(hw, IMS, IMS_ENABLE_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2269 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2270 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2271 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2272 |
/* No link detected */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2273 |
e1000_config_dsp_after_link_change(hw, FALSE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2274 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2275 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2276 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2277 |
/* If we are forcing speed/duplex, then we simply return since |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2278 |
* we have already determined whether we have link or not. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2279 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2280 |
if(!hw->autoneg) return -E1000_ERR_CONFIG; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2281 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2282 |
/* optimize the dsp settings for the igp phy */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2283 |
e1000_config_dsp_after_link_change(hw, TRUE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2284 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2285 |
/* We have a M88E1000 PHY and Auto-Neg is enabled. If we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2286 |
* have Si on board that is 82544 or newer, Auto |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2287 |
* Speed Detection takes care of MAC speed/duplex |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2288 |
* configuration. So we only need to configure Collision |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2289 |
* Distance in the MAC. Otherwise, we need to force |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2290 |
* speed/duplex on the MAC to the current PHY speed/duplex |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2291 |
* settings. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2292 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2293 |
if(hw->mac_type >= e1000_82544) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2294 |
e1000_config_collision_dist(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2295 |
else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2296 |
ret_val = e1000_config_mac_to_phy(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2297 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2298 |
DEBUGOUT("Error configuring MAC to PHY settings\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2299 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2300 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2301 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2302 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2303 |
/* Configure Flow Control now that Auto-Neg has completed. First, we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2304 |
* need to restore the desired flow control settings because we may |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2305 |
* have had to re-autoneg with a different link partner. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2306 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2307 |
ret_val = e1000_config_fc_after_link_up(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2308 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2309 |
DEBUGOUT("Error configuring flow control\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2310 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2311 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2312 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2313 |
/* At this point we know that we are on copper and we have |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2314 |
* auto-negotiated link. These are conditions for checking the link |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2315 |
* partner capability register. We use the link speed to determine if |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2316 |
* TBI compatibility needs to be turned on or off. If the link is not |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2317 |
* at gigabit speed, then TBI compatibility is not needed. If we are |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2318 |
* at gigabit speed, we turn on TBI compatibility. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2319 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2320 |
if(hw->tbi_compatibility_en) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2321 |
uint16_t speed, duplex; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2322 |
e1000_get_speed_and_duplex(hw, &speed, &duplex); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2323 |
if(speed != SPEED_1000) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2324 |
/* If link speed is not set to gigabit speed, we do not need |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2325 |
* to enable TBI compatibility. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2326 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2327 |
if(hw->tbi_compatibility_on) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2328 |
/* If we previously were in the mode, turn it off. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2329 |
rctl = E1000_READ_REG(hw, RCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2330 |
rctl &= ~E1000_RCTL_SBP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2331 |
E1000_WRITE_REG(hw, RCTL, rctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2332 |
hw->tbi_compatibility_on = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2333 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2334 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2335 |
/* If TBI compatibility is was previously off, turn it on. For |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2336 |
* compatibility with a TBI link partner, we will store bad |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2337 |
* packets. Some frames have an additional byte on the end and |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2338 |
* will look like CRC errors to to the hardware. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2339 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2340 |
if(!hw->tbi_compatibility_on) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2341 |
hw->tbi_compatibility_on = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2342 |
rctl = E1000_READ_REG(hw, RCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2343 |
rctl |= E1000_RCTL_SBP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2344 |
E1000_WRITE_REG(hw, RCTL, rctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2345 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2346 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2347 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2348 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2349 |
/* If we don't have link (auto-negotiation failed or link partner cannot |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2350 |
* auto-negotiate), the cable is plugged in (we have signal), and our |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2351 |
* link partner is not trying to auto-negotiate with us (we are receiving |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2352 |
* idles or data), we need to force link up. We also need to give |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2353 |
* auto-negotiation time to complete, in case the cable was just plugged |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2354 |
* in. The autoneg_failed flag does this. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2355 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2356 |
else if((((hw->media_type == e1000_media_type_fiber) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2357 |
((ctrl & E1000_CTRL_SWDPIN1) == signal)) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2358 |
(hw->media_type == e1000_media_type_internal_serdes)) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2359 |
(!(status & E1000_STATUS_LU)) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2360 |
(!(rxcw & E1000_RXCW_C))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2361 |
if(hw->autoneg_failed == 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2362 |
hw->autoneg_failed = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2363 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2364 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2365 |
DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2366 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2367 |
/* Disable auto-negotiation in the TXCW register */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2368 |
E1000_WRITE_REG(hw, TXCW, (hw->txcw & ~E1000_TXCW_ANE)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2369 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2370 |
/* Force link-up and also force full-duplex. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2371 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2372 |
ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2373 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2374 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2375 |
/* Configure Flow Control after forcing link up. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2376 |
ret_val = e1000_config_fc_after_link_up(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2377 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2378 |
DEBUGOUT("Error configuring flow control\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2379 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2380 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2381 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2382 |
/* If we are forcing link and we are receiving /C/ ordered sets, re-enable |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2383 |
* auto-negotiation in the TXCW register and disable forced link in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2384 |
* Device Control register in an attempt to auto-negotiate with our link |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2385 |
* partner. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2386 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2387 |
else if(((hw->media_type == e1000_media_type_fiber) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2388 |
(hw->media_type == e1000_media_type_internal_serdes)) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2389 |
(ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2390 |
DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2391 |
E1000_WRITE_REG(hw, TXCW, hw->txcw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2392 |
E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2393 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2394 |
hw->serdes_link_down = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2395 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2396 |
/* If we force link for non-auto-negotiation switch, check link status |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2397 |
* based on MAC synchronization for internal serdes media type. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2398 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2399 |
else if((hw->media_type == e1000_media_type_internal_serdes) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2400 |
!(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2401 |
/* SYNCH bit and IV bit are sticky. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2402 |
udelay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2403 |
if(E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2404 |
if(!(rxcw & E1000_RXCW_IV)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2405 |
hw->serdes_link_down = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2406 |
DEBUGOUT("SERDES: Link is up.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2407 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2408 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2409 |
hw->serdes_link_down = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2410 |
DEBUGOUT("SERDES: Link is down.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2411 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2412 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2413 |
if((hw->media_type == e1000_media_type_internal_serdes) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2414 |
(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2415 |
hw->serdes_link_down = !(E1000_STATUS_LU & E1000_READ_REG(hw, STATUS)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2416 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2417 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2418 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2419 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2420 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2421 |
* Detects the current speed and duplex settings of the hardware. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2422 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2423 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2424 |
* speed - Speed of the connection |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2425 |
* duplex - Duplex setting of the connection |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2426 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2427 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2428 |
e1000_get_speed_and_duplex(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2429 |
uint16_t *speed, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2430 |
uint16_t *duplex) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2431 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2432 |
uint32_t status; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2433 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2434 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2435 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2436 |
DEBUGFUNC("e1000_get_speed_and_duplex"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2437 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2438 |
if(hw->mac_type >= e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2439 |
status = E1000_READ_REG(hw, STATUS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2440 |
if(status & E1000_STATUS_SPEED_1000) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2441 |
*speed = SPEED_1000; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2442 |
DEBUGOUT("1000 Mbs, "); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2443 |
} else if(status & E1000_STATUS_SPEED_100) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2444 |
*speed = SPEED_100; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2445 |
DEBUGOUT("100 Mbs, "); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2446 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2447 |
*speed = SPEED_10; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2448 |
DEBUGOUT("10 Mbs, "); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2449 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2450 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2451 |
if(status & E1000_STATUS_FD) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2452 |
*duplex = FULL_DUPLEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2453 |
DEBUGOUT("Full Duplex\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2454 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2455 |
*duplex = HALF_DUPLEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2456 |
DEBUGOUT(" Half Duplex\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2457 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2458 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2459 |
DEBUGOUT("1000 Mbs, Full Duplex\r\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2460 |
*speed = SPEED_1000; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2461 |
*duplex = FULL_DUPLEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2462 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2463 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2464 |
/* IGP01 PHY may advertise full duplex operation after speed downgrade even |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2465 |
* if it is operating at half duplex. Here we set the duplex settings to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2466 |
* match the duplex in the link partner's capabilities. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2467 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2468 |
if(hw->phy_type == e1000_phy_igp && hw->speed_downgraded) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2469 |
ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2470 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2471 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2472 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2473 |
if(!(phy_data & NWAY_ER_LP_NWAY_CAPS)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2474 |
*duplex = HALF_DUPLEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2475 |
else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2476 |
ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2477 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2478 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2479 |
if((*speed == SPEED_100 && !(phy_data & NWAY_LPAR_100TX_FD_CAPS)) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2480 |
(*speed == SPEED_10 && !(phy_data & NWAY_LPAR_10T_FD_CAPS))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2481 |
*duplex = HALF_DUPLEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2482 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2483 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2484 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2485 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2486 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2487 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2488 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2489 |
* Blocks until autoneg completes or times out (~4.5 seconds) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2490 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2491 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2492 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2493 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2494 |
e1000_wait_autoneg(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2495 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2496 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2497 |
uint16_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2498 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2499 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2500 |
DEBUGFUNC("e1000_wait_autoneg"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2501 |
DEBUGOUT("Waiting for Auto-Neg to complete.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2502 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2503 |
/* We will wait for autoneg to complete or 4.5 seconds to expire. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2504 |
for(i = PHY_AUTO_NEG_TIME; i > 0; i--) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2505 |
/* Read the MII Status Register and wait for Auto-Neg |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2506 |
* Complete bit to be set. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2507 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2508 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2509 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2510 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2511 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2512 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2513 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2514 |
if(phy_data & MII_SR_AUTONEG_COMPLETE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2515 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2516 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2517 |
msec_delay(100); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2518 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2519 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2520 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2521 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2522 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2523 |
* Raises the Management Data Clock |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2524 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2525 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2526 |
* ctrl - Device control register's current value |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2527 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2528 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2529 |
e1000_raise_mdi_clk(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2530 |
uint32_t *ctrl) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2531 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2532 |
/* Raise the clock input to the Management Data Clock (by setting the MDC |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2533 |
* bit), and then delay 10 microseconds. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2534 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2535 |
E1000_WRITE_REG(hw, CTRL, (*ctrl | E1000_CTRL_MDC)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2536 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2537 |
udelay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2538 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2539 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2540 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2541 |
* Lowers the Management Data Clock |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2542 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2543 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2544 |
* ctrl - Device control register's current value |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2545 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2546 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2547 |
e1000_lower_mdi_clk(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2548 |
uint32_t *ctrl) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2549 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2550 |
/* Lower the clock input to the Management Data Clock (by clearing the MDC |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2551 |
* bit), and then delay 10 microseconds. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2552 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2553 |
E1000_WRITE_REG(hw, CTRL, (*ctrl & ~E1000_CTRL_MDC)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2554 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2555 |
udelay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2556 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2557 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2558 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2559 |
* Shifts data bits out to the PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2560 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2561 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2562 |
* data - Data to send out to the PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2563 |
* count - Number of bits to shift out |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2564 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2565 |
* Bits are shifted out in MSB to LSB order. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2566 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2567 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2568 |
e1000_shift_out_mdi_bits(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2569 |
uint32_t data, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2570 |
uint16_t count) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2571 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2572 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2573 |
uint32_t mask; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2574 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2575 |
/* We need to shift "count" number of bits out to the PHY. So, the value |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2576 |
* in the "data" parameter will be shifted out to the PHY one bit at a |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2577 |
* time. In order to do this, "data" must be broken down into bits. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2578 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2579 |
mask = 0x01; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2580 |
mask <<= (count - 1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2581 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2582 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2583 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2584 |
/* Set MDIO_DIR and MDC_DIR direction bits to be used as output pins. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2585 |
ctrl |= (E1000_CTRL_MDIO_DIR | E1000_CTRL_MDC_DIR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2586 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2587 |
while(mask) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2588 |
/* A "1" is shifted out to the PHY by setting the MDIO bit to "1" and |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2589 |
* then raising and lowering the Management Data Clock. A "0" is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2590 |
* shifted out to the PHY by setting the MDIO bit to "0" and then |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2591 |
* raising and lowering the clock. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2592 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2593 |
if(data & mask) ctrl |= E1000_CTRL_MDIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2594 |
else ctrl &= ~E1000_CTRL_MDIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2595 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2596 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2597 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2598 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2599 |
udelay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2600 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2601 |
e1000_raise_mdi_clk(hw, &ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2602 |
e1000_lower_mdi_clk(hw, &ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2603 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2604 |
mask = mask >> 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2605 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2606 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2607 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2608 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2609 |
* Shifts data bits in from the PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2610 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2611 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2612 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2613 |
* Bits are shifted in in MSB to LSB order. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2614 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2615 |
static uint16_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2616 |
e1000_shift_in_mdi_bits(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2617 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2618 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2619 |
uint16_t data = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2620 |
uint8_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2621 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2622 |
/* In order to read a register from the PHY, we need to shift in a total |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2623 |
* of 18 bits from the PHY. The first two bit (turnaround) times are used |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2624 |
* to avoid contention on the MDIO pin when a read operation is performed. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2625 |
* These two bits are ignored by us and thrown away. Bits are "shifted in" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2626 |
* by raising the input to the Management Data Clock (setting the MDC bit), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2627 |
* and then reading the value of the MDIO bit. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2628 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2629 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2630 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2631 |
/* Clear MDIO_DIR (SWDPIO1) to indicate this bit is to be used as input. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2632 |
ctrl &= ~E1000_CTRL_MDIO_DIR; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2633 |
ctrl &= ~E1000_CTRL_MDIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2634 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2635 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2636 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2637 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2638 |
/* Raise and Lower the clock before reading in the data. This accounts for |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2639 |
* the turnaround bits. The first clock occurred when we clocked out the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2640 |
* last bit of the Register Address. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2641 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2642 |
e1000_raise_mdi_clk(hw, &ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2643 |
e1000_lower_mdi_clk(hw, &ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2644 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2645 |
for(data = 0, i = 0; i < 16; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2646 |
data = data << 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2647 |
e1000_raise_mdi_clk(hw, &ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2648 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2649 |
/* Check to see if we shifted in a "1". */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2650 |
if(ctrl & E1000_CTRL_MDIO) data |= 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2651 |
e1000_lower_mdi_clk(hw, &ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2652 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2653 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2654 |
e1000_raise_mdi_clk(hw, &ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2655 |
e1000_lower_mdi_clk(hw, &ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2656 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2657 |
return data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2658 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2659 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2660 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2661 |
* Reads the value from a PHY register, if the value is on a specific non zero |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2662 |
* page, sets the page first. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2663 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2664 |
* reg_addr - address of the PHY register to read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2665 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2666 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2667 |
e1000_read_phy_reg(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2668 |
uint32_t reg_addr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2669 |
uint16_t *phy_data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2670 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2671 |
uint32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2672 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2673 |
DEBUGFUNC("e1000_read_phy_reg"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2674 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2675 |
if((hw->phy_type == e1000_phy_igp || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2676 |
hw->phy_type == e1000_phy_igp_2) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2677 |
(reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2678 |
ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2679 |
(uint16_t)reg_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2680 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2681 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2682 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2683 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2684 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2685 |
ret_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2686 |
phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2687 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2688 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2689 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2690 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2691 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2692 |
e1000_read_phy_reg_ex(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2693 |
uint32_t reg_addr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2694 |
uint16_t *phy_data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2695 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2696 |
uint32_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2697 |
uint32_t mdic = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2698 |
const uint32_t phy_addr = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2699 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2700 |
DEBUGFUNC("e1000_read_phy_reg_ex"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2701 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2702 |
if(reg_addr > MAX_PHY_REG_ADDRESS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2703 |
DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2704 |
return -E1000_ERR_PARAM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2705 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2706 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2707 |
if(hw->mac_type > e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2708 |
/* Set up Op-code, Phy Address, and register address in the MDI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2709 |
* Control register. The MAC will take care of interfacing with the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2710 |
* PHY to retrieve the desired data. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2711 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2712 |
mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2713 |
(phy_addr << E1000_MDIC_PHY_SHIFT) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2714 |
(E1000_MDIC_OP_READ)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2715 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2716 |
E1000_WRITE_REG(hw, MDIC, mdic); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2717 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2718 |
/* Poll the ready bit to see if the MDI read completed */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2719 |
for(i = 0; i < 64; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2720 |
udelay(50); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2721 |
mdic = E1000_READ_REG(hw, MDIC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2722 |
if(mdic & E1000_MDIC_READY) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2723 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2724 |
if(!(mdic & E1000_MDIC_READY)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2725 |
DEBUGOUT("MDI Read did not complete\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2726 |
return -E1000_ERR_PHY; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2727 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2728 |
if(mdic & E1000_MDIC_ERROR) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2729 |
DEBUGOUT("MDI Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2730 |
return -E1000_ERR_PHY; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2731 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2732 |
*phy_data = (uint16_t) mdic; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2733 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2734 |
/* We must first send a preamble through the MDIO pin to signal the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2735 |
* beginning of an MII instruction. This is done by sending 32 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2736 |
* consecutive "1" bits. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2737 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2738 |
e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2739 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2740 |
/* Now combine the next few fields that are required for a read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2741 |
* operation. We use this method instead of calling the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2742 |
* e1000_shift_out_mdi_bits routine five different times. The format of |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2743 |
* a MII read instruction consists of a shift out of 14 bits and is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2744 |
* defined as follows: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2745 |
* <Preamble><SOF><Op Code><Phy Addr><Reg Addr> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2746 |
* followed by a shift in of 18 bits. This first two bits shifted in |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2747 |
* are TurnAround bits used to avoid contention on the MDIO pin when a |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2748 |
* READ operation is performed. These two bits are thrown away |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2749 |
* followed by a shift in of 16 bits which contains the desired data. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2750 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2751 |
mdic = ((reg_addr) | (phy_addr << 5) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2752 |
(PHY_OP_READ << 10) | (PHY_SOF << 12)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2753 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2754 |
e1000_shift_out_mdi_bits(hw, mdic, 14); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2755 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2756 |
/* Now that we've shifted out the read command to the MII, we need to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2757 |
* "shift in" the 16-bit value (18 total bits) of the requested PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2758 |
* register address. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2759 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2760 |
*phy_data = e1000_shift_in_mdi_bits(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2761 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2762 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2763 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2764 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2765 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2766 |
* Writes a value to a PHY register |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2767 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2768 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2769 |
* reg_addr - address of the PHY register to write |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2770 |
* data - data to write to the PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2771 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2772 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2773 |
e1000_write_phy_reg(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2774 |
uint32_t reg_addr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2775 |
uint16_t phy_data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2776 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2777 |
uint32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2778 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2779 |
DEBUGFUNC("e1000_write_phy_reg"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2780 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2781 |
if((hw->phy_type == e1000_phy_igp || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2782 |
hw->phy_type == e1000_phy_igp_2) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2783 |
(reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2784 |
ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2785 |
(uint16_t)reg_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2786 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2787 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2788 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2789 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2790 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2791 |
ret_val = e1000_write_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2792 |
phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2793 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2794 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2795 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2796 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2797 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2798 |
e1000_write_phy_reg_ex(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2799 |
uint32_t reg_addr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2800 |
uint16_t phy_data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2801 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2802 |
uint32_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2803 |
uint32_t mdic = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2804 |
const uint32_t phy_addr = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2805 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2806 |
DEBUGFUNC("e1000_write_phy_reg_ex"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2807 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2808 |
if(reg_addr > MAX_PHY_REG_ADDRESS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2809 |
DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2810 |
return -E1000_ERR_PARAM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2811 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2812 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2813 |
if(hw->mac_type > e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2814 |
/* Set up Op-code, Phy Address, register address, and data intended |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2815 |
* for the PHY register in the MDI Control register. The MAC will take |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2816 |
* care of interfacing with the PHY to send the desired data. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2817 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2818 |
mdic = (((uint32_t) phy_data) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2819 |
(reg_addr << E1000_MDIC_REG_SHIFT) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2820 |
(phy_addr << E1000_MDIC_PHY_SHIFT) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2821 |
(E1000_MDIC_OP_WRITE)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2822 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2823 |
E1000_WRITE_REG(hw, MDIC, mdic); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2824 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2825 |
/* Poll the ready bit to see if the MDI read completed */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2826 |
for(i = 0; i < 640; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2827 |
udelay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2828 |
mdic = E1000_READ_REG(hw, MDIC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2829 |
if(mdic & E1000_MDIC_READY) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2830 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2831 |
if(!(mdic & E1000_MDIC_READY)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2832 |
DEBUGOUT("MDI Write did not complete\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2833 |
return -E1000_ERR_PHY; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2834 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2835 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2836 |
/* We'll need to use the SW defined pins to shift the write command |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2837 |
* out to the PHY. We first send a preamble to the PHY to signal the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2838 |
* beginning of the MII instruction. This is done by sending 32 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2839 |
* consecutive "1" bits. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2840 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2841 |
e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2842 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2843 |
/* Now combine the remaining required fields that will indicate a |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2844 |
* write operation. We use this method instead of calling the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2845 |
* e1000_shift_out_mdi_bits routine for each field in the command. The |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2846 |
* format of a MII write instruction is as follows: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2847 |
* <Preamble><SOF><Op Code><Phy Addr><Reg Addr><Turnaround><Data>. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2848 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2849 |
mdic = ((PHY_TURNAROUND) | (reg_addr << 2) | (phy_addr << 7) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2850 |
(PHY_OP_WRITE << 12) | (PHY_SOF << 14)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2851 |
mdic <<= 16; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2852 |
mdic |= (uint32_t) phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2853 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2854 |
e1000_shift_out_mdi_bits(hw, mdic, 32); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2855 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2856 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2857 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2858 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2859 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2860 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2861 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2862 |
* Returns the PHY to the power-on reset state |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2863 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2864 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2865 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2866 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2867 |
e1000_phy_hw_reset(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2868 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2869 |
uint32_t ctrl, ctrl_ext; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2870 |
uint32_t led_ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2871 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2872 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2873 |
DEBUGFUNC("e1000_phy_hw_reset"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2874 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2875 |
/* In the case of the phy reset being blocked, it's not an error, we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2876 |
* simply return success without performing the reset. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2877 |
ret_val = e1000_check_phy_reset_block(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2878 |
if (ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2879 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2880 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2881 |
DEBUGOUT("Resetting Phy...\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2882 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2883 |
if(hw->mac_type > e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2884 |
/* Read the device control register and assert the E1000_CTRL_PHY_RST |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2885 |
* bit. Then, take it out of reset. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2886 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2887 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2888 |
E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PHY_RST); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2889 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2890 |
msec_delay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2891 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2892 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2893 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2894 |
/* Read the Extended Device Control Register, assert the PHY_RESET_DIR |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2895 |
* bit to put the PHY into reset. Then, take it out of reset. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2896 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2897 |
ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2898 |
ctrl_ext |= E1000_CTRL_EXT_SDP4_DIR; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2899 |
ctrl_ext &= ~E1000_CTRL_EXT_SDP4_DATA; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2900 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2901 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2902 |
msec_delay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2903 |
ctrl_ext |= E1000_CTRL_EXT_SDP4_DATA; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2904 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2905 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2906 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2907 |
udelay(150); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2908 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2909 |
if((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2910 |
/* Configure activity LED after PHY reset */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2911 |
led_ctrl = E1000_READ_REG(hw, LEDCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2912 |
led_ctrl &= IGP_ACTIVITY_LED_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2913 |
led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2914 |
E1000_WRITE_REG(hw, LEDCTL, led_ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2915 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2916 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2917 |
/* Wait for FW to finish PHY configuration. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2918 |
ret_val = e1000_get_phy_cfg_done(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2919 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2920 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2921 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2922 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2923 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2924 |
* Resets the PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2925 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2926 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2927 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2928 |
* Sets bit 15 of the MII Control regiser |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2929 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2930 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2931 |
e1000_phy_reset(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2932 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2933 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2934 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2935 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2936 |
DEBUGFUNC("e1000_phy_reset"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2937 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2938 |
/* In the case of the phy reset being blocked, it's not an error, we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2939 |
* simply return success without performing the reset. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2940 |
ret_val = e1000_check_phy_reset_block(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2941 |
if (ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2942 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2943 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2944 |
switch (hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2945 |
case e1000_82541_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2946 |
ret_val = e1000_phy_hw_reset(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2947 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2948 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2949 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2950 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2951 |
ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2952 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2953 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2954 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2955 |
phy_data |= MII_CR_RESET; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2956 |
ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2957 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2958 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2959 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2960 |
udelay(1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2961 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2962 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2963 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2964 |
if(hw->phy_type == e1000_phy_igp || hw->phy_type == e1000_phy_igp_2) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2965 |
e1000_phy_init_script(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2966 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2967 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2968 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2969 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2970 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2971 |
* Probes the expected PHY address for known PHY IDs |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2972 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2973 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2974 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2975 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2976 |
e1000_detect_gig_phy(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2977 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2978 |
int32_t phy_init_status, ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2979 |
uint16_t phy_id_high, phy_id_low; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2980 |
boolean_t match = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2981 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2982 |
DEBUGFUNC("e1000_detect_gig_phy"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2983 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2984 |
/* Read the PHY ID Registers to identify which PHY is onboard. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2985 |
ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2986 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2987 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2988 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2989 |
hw->phy_id = (uint32_t) (phy_id_high << 16); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2990 |
udelay(20); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2991 |
ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2992 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2993 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2994 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2995 |
hw->phy_id |= (uint32_t) (phy_id_low & PHY_REVISION_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2996 |
hw->phy_revision = (uint32_t) phy_id_low & ~PHY_REVISION_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2997 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2998 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2999 |
case e1000_82543: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3000 |
if(hw->phy_id == M88E1000_E_PHY_ID) match = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3001 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3002 |
case e1000_82544: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3003 |
if(hw->phy_id == M88E1000_I_PHY_ID) match = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3004 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3005 |
case e1000_82540: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3006 |
case e1000_82545: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3007 |
case e1000_82545_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3008 |
case e1000_82546: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3009 |
case e1000_82546_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3010 |
if(hw->phy_id == M88E1011_I_PHY_ID) match = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3011 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3012 |
case e1000_82541: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3013 |
case e1000_82541_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3014 |
case e1000_82547: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3015 |
case e1000_82547_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3016 |
if(hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3017 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3018 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3019 |
if(hw->phy_id == M88E1111_I_PHY_ID) match = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3020 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3021 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3022 |
DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3023 |
return -E1000_ERR_CONFIG; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3024 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3025 |
phy_init_status = e1000_set_phy_type(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3026 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3027 |
if ((match) && (phy_init_status == E1000_SUCCESS)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3028 |
DEBUGOUT1("PHY ID 0x%X detected\n", hw->phy_id); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3029 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3030 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3031 |
DEBUGOUT1("Invalid PHY ID 0x%X\n", hw->phy_id); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3032 |
return -E1000_ERR_PHY; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3033 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3034 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3035 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3036 |
* Resets the PHY's DSP |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3037 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3038 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3039 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3040 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3041 |
e1000_phy_reset_dsp(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3042 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3043 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3044 |
DEBUGFUNC("e1000_phy_reset_dsp"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3045 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3046 |
do { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3047 |
ret_val = e1000_write_phy_reg(hw, 29, 0x001d); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3048 |
if(ret_val) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3049 |
ret_val = e1000_write_phy_reg(hw, 30, 0x00c1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3050 |
if(ret_val) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3051 |
ret_val = e1000_write_phy_reg(hw, 30, 0x0000); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3052 |
if(ret_val) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3053 |
ret_val = E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3054 |
} while(0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3055 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3056 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3057 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3058 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3059 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3060 |
* Get PHY information from various PHY registers for igp PHY only. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3061 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3062 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3063 |
* phy_info - PHY information structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3064 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3065 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3066 |
e1000_phy_igp_get_info(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3067 |
struct e1000_phy_info *phy_info) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3068 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3069 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3070 |
uint16_t phy_data, polarity, min_length, max_length, average; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3071 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3072 |
DEBUGFUNC("e1000_phy_igp_get_info"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3073 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3074 |
/* The downshift status is checked only once, after link is established, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3075 |
* and it stored in the hw->speed_downgraded parameter. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3076 |
phy_info->downshift = (e1000_downshift)hw->speed_downgraded; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3077 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3078 |
/* IGP01E1000 does not need to support it. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3079 |
phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_normal; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3080 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3081 |
/* IGP01E1000 always correct polarity reversal */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3082 |
phy_info->polarity_correction = e1000_polarity_reversal_enabled; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3083 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3084 |
/* Check polarity status */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3085 |
ret_val = e1000_check_polarity(hw, &polarity); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3086 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3087 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3088 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3089 |
phy_info->cable_polarity = polarity; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3090 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3091 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3092 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3093 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3094 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3095 |
phy_info->mdix_mode = (phy_data & IGP01E1000_PSSR_MDIX) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3096 |
IGP01E1000_PSSR_MDIX_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3097 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3098 |
if((phy_data & IGP01E1000_PSSR_SPEED_MASK) == |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3099 |
IGP01E1000_PSSR_SPEED_1000MBPS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3100 |
/* Local/Remote Receiver Information are only valid at 1000 Mbps */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3101 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3102 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3103 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3104 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3105 |
phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3106 |
SR_1000T_LOCAL_RX_STATUS_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3107 |
phy_info->remote_rx = (phy_data & SR_1000T_REMOTE_RX_STATUS) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3108 |
SR_1000T_REMOTE_RX_STATUS_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3109 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3110 |
/* Get cable length */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3111 |
ret_val = e1000_get_cable_length(hw, &min_length, &max_length); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3112 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3113 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3114 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3115 |
/* Translate to old method */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3116 |
average = (max_length + min_length) / 2; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3117 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3118 |
if(average <= e1000_igp_cable_length_50) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3119 |
phy_info->cable_length = e1000_cable_length_50; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3120 |
else if(average <= e1000_igp_cable_length_80) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3121 |
phy_info->cable_length = e1000_cable_length_50_80; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3122 |
else if(average <= e1000_igp_cable_length_110) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3123 |
phy_info->cable_length = e1000_cable_length_80_110; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3124 |
else if(average <= e1000_igp_cable_length_140) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3125 |
phy_info->cable_length = e1000_cable_length_110_140; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3126 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3127 |
phy_info->cable_length = e1000_cable_length_140; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3128 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3129 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3130 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3131 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3132 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3133 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3134 |
* Get PHY information from various PHY registers fot m88 PHY only. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3135 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3136 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3137 |
* phy_info - PHY information structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3138 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3139 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3140 |
e1000_phy_m88_get_info(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3141 |
struct e1000_phy_info *phy_info) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3142 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3143 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3144 |
uint16_t phy_data, polarity; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3145 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3146 |
DEBUGFUNC("e1000_phy_m88_get_info"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3147 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3148 |
/* The downshift status is checked only once, after link is established, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3149 |
* and it stored in the hw->speed_downgraded parameter. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3150 |
phy_info->downshift = (e1000_downshift)hw->speed_downgraded; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3151 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3152 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3153 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3154 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3155 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3156 |
phy_info->extended_10bt_distance = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3157 |
(phy_data & M88E1000_PSCR_10BT_EXT_DIST_ENABLE) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3158 |
M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3159 |
phy_info->polarity_correction = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3160 |
(phy_data & M88E1000_PSCR_POLARITY_REVERSAL) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3161 |
M88E1000_PSCR_POLARITY_REVERSAL_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3162 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3163 |
/* Check polarity status */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3164 |
ret_val = e1000_check_polarity(hw, &polarity); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3165 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3166 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3167 |
phy_info->cable_polarity = polarity; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3168 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3169 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3170 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3171 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3172 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3173 |
phy_info->mdix_mode = (phy_data & M88E1000_PSSR_MDIX) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3174 |
M88E1000_PSSR_MDIX_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3175 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3176 |
if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3177 |
/* Cable Length Estimation and Local/Remote Receiver Information |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3178 |
* are only valid at 1000 Mbps. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3179 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3180 |
phy_info->cable_length = ((phy_data & M88E1000_PSSR_CABLE_LENGTH) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3181 |
M88E1000_PSSR_CABLE_LENGTH_SHIFT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3182 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3183 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3184 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3185 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3186 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3187 |
phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3188 |
SR_1000T_LOCAL_RX_STATUS_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3189 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3190 |
phy_info->remote_rx = (phy_data & SR_1000T_REMOTE_RX_STATUS) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3191 |
SR_1000T_REMOTE_RX_STATUS_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3192 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3193 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3194 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3195 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3196 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3197 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3198 |
* Get PHY information from various PHY registers |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3199 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3200 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3201 |
* phy_info - PHY information structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3202 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3203 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3204 |
e1000_phy_get_info(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3205 |
struct e1000_phy_info *phy_info) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3206 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3207 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3208 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3209 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3210 |
DEBUGFUNC("e1000_phy_get_info"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3211 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3212 |
phy_info->cable_length = e1000_cable_length_undefined; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3213 |
phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_undefined; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3214 |
phy_info->cable_polarity = e1000_rev_polarity_undefined; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3215 |
phy_info->downshift = e1000_downshift_undefined; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3216 |
phy_info->polarity_correction = e1000_polarity_reversal_undefined; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3217 |
phy_info->mdix_mode = e1000_auto_x_mode_undefined; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3218 |
phy_info->local_rx = e1000_1000t_rx_status_undefined; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3219 |
phy_info->remote_rx = e1000_1000t_rx_status_undefined; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3220 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3221 |
if(hw->media_type != e1000_media_type_copper) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3222 |
DEBUGOUT("PHY info is only valid for copper media\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3223 |
return -E1000_ERR_CONFIG; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3224 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3225 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3226 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3227 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3228 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3229 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3230 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3231 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3232 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3233 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3234 |
if((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3235 |
DEBUGOUT("PHY info is only valid if link is up\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3236 |
return -E1000_ERR_CONFIG; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3237 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3238 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3239 |
if(hw->phy_type == e1000_phy_igp || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3240 |
hw->phy_type == e1000_phy_igp_2) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3241 |
return e1000_phy_igp_get_info(hw, phy_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3242 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3243 |
return e1000_phy_m88_get_info(hw, phy_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3244 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3245 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3246 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3247 |
e1000_validate_mdi_setting(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3248 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3249 |
DEBUGFUNC("e1000_validate_mdi_settings"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3250 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3251 |
if(!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3252 |
DEBUGOUT("Invalid MDI setting detected\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3253 |
hw->mdix = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3254 |
return -E1000_ERR_CONFIG; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3255 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3256 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3257 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3258 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3259 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3260 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3261 |
* Sets up eeprom variables in the hw struct. Must be called after mac_type |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3262 |
* is configured. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3263 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3264 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3265 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3266 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3267 |
e1000_init_eeprom_params(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3268 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3269 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3270 |
uint32_t eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3271 |
int32_t ret_val = E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3272 |
uint16_t eeprom_size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3273 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3274 |
DEBUGFUNC("e1000_init_eeprom_params"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3275 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3276 |
switch (hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3277 |
case e1000_82542_rev2_0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3278 |
case e1000_82542_rev2_1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3279 |
case e1000_82543: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3280 |
case e1000_82544: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3281 |
eeprom->type = e1000_eeprom_microwire; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3282 |
eeprom->word_size = 64; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3283 |
eeprom->opcode_bits = 3; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3284 |
eeprom->address_bits = 6; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3285 |
eeprom->delay_usec = 50; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3286 |
eeprom->use_eerd = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3287 |
eeprom->use_eewr = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3288 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3289 |
case e1000_82540: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3290 |
case e1000_82545: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3291 |
case e1000_82545_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3292 |
case e1000_82546: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3293 |
case e1000_82546_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3294 |
eeprom->type = e1000_eeprom_microwire; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3295 |
eeprom->opcode_bits = 3; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3296 |
eeprom->delay_usec = 50; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3297 |
if(eecd & E1000_EECD_SIZE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3298 |
eeprom->word_size = 256; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3299 |
eeprom->address_bits = 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3300 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3301 |
eeprom->word_size = 64; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3302 |
eeprom->address_bits = 6; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3303 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3304 |
eeprom->use_eerd = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3305 |
eeprom->use_eewr = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3306 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3307 |
case e1000_82541: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3308 |
case e1000_82541_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3309 |
case e1000_82547: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3310 |
case e1000_82547_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3311 |
if (eecd & E1000_EECD_TYPE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3312 |
eeprom->type = e1000_eeprom_spi; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3313 |
eeprom->opcode_bits = 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3314 |
eeprom->delay_usec = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3315 |
if (eecd & E1000_EECD_ADDR_BITS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3316 |
eeprom->page_size = 32; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3317 |
eeprom->address_bits = 16; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3318 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3319 |
eeprom->page_size = 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3320 |
eeprom->address_bits = 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3321 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3322 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3323 |
eeprom->type = e1000_eeprom_microwire; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3324 |
eeprom->opcode_bits = 3; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3325 |
eeprom->delay_usec = 50; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3326 |
if (eecd & E1000_EECD_ADDR_BITS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3327 |
eeprom->word_size = 256; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3328 |
eeprom->address_bits = 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3329 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3330 |
eeprom->word_size = 64; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3331 |
eeprom->address_bits = 6; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3332 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3333 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3334 |
eeprom->use_eerd = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3335 |
eeprom->use_eewr = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3336 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3337 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3338 |
eeprom->type = e1000_eeprom_spi; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3339 |
eeprom->opcode_bits = 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3340 |
eeprom->delay_usec = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3341 |
if (eecd & E1000_EECD_ADDR_BITS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3342 |
eeprom->page_size = 32; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3343 |
eeprom->address_bits = 16; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3344 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3345 |
eeprom->page_size = 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3346 |
eeprom->address_bits = 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3347 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3348 |
eeprom->use_eerd = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3349 |
eeprom->use_eewr = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3350 |
if(e1000_is_onboard_nvm_eeprom(hw) == FALSE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3351 |
eeprom->type = e1000_eeprom_flash; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3352 |
eeprom->word_size = 2048; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3353 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3354 |
/* Ensure that the Autonomous FLASH update bit is cleared due to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3355 |
* Flash update issue on parts which use a FLASH for NVM. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3356 |
eecd &= ~E1000_EECD_AUPDEN; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3357 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3358 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3359 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3360 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3361 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3362 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3363 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3364 |
if (eeprom->type == e1000_eeprom_spi) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3365 |
/* eeprom_size will be an enum [0..8] that maps to eeprom sizes 128B to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3366 |
* 32KB (incremented by powers of 2). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3367 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3368 |
if(hw->mac_type <= e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3369 |
/* Set to default value for initial eeprom read. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3370 |
eeprom->word_size = 64; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3371 |
ret_val = e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3372 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3373 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3374 |
eeprom_size = (eeprom_size & EEPROM_SIZE_MASK) >> EEPROM_SIZE_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3375 |
/* 256B eeprom size was not supported in earlier hardware, so we |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3376 |
* bump eeprom_size up one to ensure that "1" (which maps to 256B) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3377 |
* is never the result used in the shifting logic below. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3378 |
if(eeprom_size) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3379 |
eeprom_size++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3380 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3381 |
eeprom_size = (uint16_t)((eecd & E1000_EECD_SIZE_EX_MASK) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3382 |
E1000_EECD_SIZE_EX_SHIFT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3383 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3384 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3385 |
eeprom->word_size = 1 << (eeprom_size + EEPROM_WORD_SIZE_SHIFT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3386 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3387 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3388 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3389 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3390 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3391 |
* Raises the EEPROM's clock input. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3392 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3393 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3394 |
* eecd - EECD's current value |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3395 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3396 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3397 |
e1000_raise_ee_clk(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3398 |
uint32_t *eecd) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3399 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3400 |
/* Raise the clock input to the EEPROM (by setting the SK bit), and then |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3401 |
* wait <delay> microseconds. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3402 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3403 |
*eecd = *eecd | E1000_EECD_SK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3404 |
E1000_WRITE_REG(hw, EECD, *eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3405 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3406 |
udelay(hw->eeprom.delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3407 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3408 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3409 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3410 |
* Lowers the EEPROM's clock input. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3411 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3412 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3413 |
* eecd - EECD's current value |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3414 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3415 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3416 |
e1000_lower_ee_clk(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3417 |
uint32_t *eecd) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3418 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3419 |
/* Lower the clock input to the EEPROM (by clearing the SK bit), and then |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3420 |
* wait 50 microseconds. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3421 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3422 |
*eecd = *eecd & ~E1000_EECD_SK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3423 |
E1000_WRITE_REG(hw, EECD, *eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3424 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3425 |
udelay(hw->eeprom.delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3426 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3427 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3428 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3429 |
* Shift data bits out to the EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3430 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3431 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3432 |
* data - data to send to the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3433 |
* count - number of bits to shift out |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3434 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3435 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3436 |
e1000_shift_out_ee_bits(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3437 |
uint16_t data, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3438 |
uint16_t count) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3439 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3440 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3441 |
uint32_t eecd; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3442 |
uint32_t mask; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3443 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3444 |
/* We need to shift "count" bits out to the EEPROM. So, value in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3445 |
* "data" parameter will be shifted out to the EEPROM one bit at a time. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3446 |
* In order to do this, "data" must be broken down into bits. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3447 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3448 |
mask = 0x01 << (count - 1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3449 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3450 |
if (eeprom->type == e1000_eeprom_microwire) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3451 |
eecd &= ~E1000_EECD_DO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3452 |
} else if (eeprom->type == e1000_eeprom_spi) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3453 |
eecd |= E1000_EECD_DO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3454 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3455 |
do { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3456 |
/* A "1" is shifted out to the EEPROM by setting bit "DI" to a "1", |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3457 |
* and then raising and then lowering the clock (the SK bit controls |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3458 |
* the clock input to the EEPROM). A "0" is shifted out to the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3459 |
* by setting "DI" to "0" and then raising and then lowering the clock. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3460 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3461 |
eecd &= ~E1000_EECD_DI; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3462 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3463 |
if(data & mask) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3464 |
eecd |= E1000_EECD_DI; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3465 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3466 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3467 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3468 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3469 |
udelay(eeprom->delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3470 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3471 |
e1000_raise_ee_clk(hw, &eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3472 |
e1000_lower_ee_clk(hw, &eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3473 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3474 |
mask = mask >> 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3475 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3476 |
} while(mask); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3477 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3478 |
/* We leave the "DI" bit set to "0" when we leave this routine. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3479 |
eecd &= ~E1000_EECD_DI; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3480 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3481 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3482 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3483 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3484 |
* Shift data bits in from the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3485 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3486 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3487 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3488 |
static uint16_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3489 |
e1000_shift_in_ee_bits(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3490 |
uint16_t count) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3491 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3492 |
uint32_t eecd; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3493 |
uint32_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3494 |
uint16_t data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3495 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3496 |
/* In order to read a register from the EEPROM, we need to shift 'count' |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3497 |
* bits in from the EEPROM. Bits are "shifted in" by raising the clock |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3498 |
* input to the EEPROM (setting the SK bit), and then reading the value of |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3499 |
* the "DO" bit. During this "shifting in" process the "DI" bit should |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3500 |
* always be clear. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3501 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3502 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3503 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3504 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3505 |
eecd &= ~(E1000_EECD_DO | E1000_EECD_DI); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3506 |
data = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3507 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3508 |
for(i = 0; i < count; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3509 |
data = data << 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3510 |
e1000_raise_ee_clk(hw, &eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3511 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3512 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3513 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3514 |
eecd &= ~(E1000_EECD_DI); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3515 |
if(eecd & E1000_EECD_DO) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3516 |
data |= 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3517 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3518 |
e1000_lower_ee_clk(hw, &eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3519 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3520 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3521 |
return data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3522 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3523 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3524 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3525 |
* Prepares EEPROM for access |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3526 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3527 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3528 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3529 |
* Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3530 |
* function should be called before issuing a command to the EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3531 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3532 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3533 |
e1000_acquire_eeprom(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3534 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3535 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3536 |
uint32_t eecd, i=0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3537 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3538 |
DEBUGFUNC("e1000_acquire_eeprom"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3539 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3540 |
if(e1000_get_hw_eeprom_semaphore(hw)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3541 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3542 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3543 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3544 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3545 |
if (hw->mac_type != e1000_82573) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3546 |
/* Request EEPROM Access */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3547 |
if(hw->mac_type > e1000_82544) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3548 |
eecd |= E1000_EECD_REQ; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3549 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3550 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3551 |
while((!(eecd & E1000_EECD_GNT)) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3552 |
(i < E1000_EEPROM_GRANT_ATTEMPTS)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3553 |
i++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3554 |
udelay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3555 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3556 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3557 |
if(!(eecd & E1000_EECD_GNT)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3558 |
eecd &= ~E1000_EECD_REQ; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3559 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3560 |
DEBUGOUT("Could not acquire EEPROM grant\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3561 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3562 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3563 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3564 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3565 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3566 |
/* Setup EEPROM for Read/Write */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3567 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3568 |
if (eeprom->type == e1000_eeprom_microwire) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3569 |
/* Clear SK and DI */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3570 |
eecd &= ~(E1000_EECD_DI | E1000_EECD_SK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3571 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3572 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3573 |
/* Set CS */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3574 |
eecd |= E1000_EECD_CS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3575 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3576 |
} else if (eeprom->type == e1000_eeprom_spi) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3577 |
/* Clear SK and CS */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3578 |
eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3579 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3580 |
udelay(1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3581 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3582 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3583 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3584 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3585 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3586 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3587 |
* Returns EEPROM to a "standby" state |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3588 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3589 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3590 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3591 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3592 |
e1000_standby_eeprom(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3593 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3594 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3595 |
uint32_t eecd; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3596 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3597 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3598 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3599 |
if(eeprom->type == e1000_eeprom_microwire) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3600 |
eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3601 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3602 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3603 |
udelay(eeprom->delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3604 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3605 |
/* Clock high */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3606 |
eecd |= E1000_EECD_SK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3607 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3608 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3609 |
udelay(eeprom->delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3610 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3611 |
/* Select EEPROM */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3612 |
eecd |= E1000_EECD_CS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3613 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3614 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3615 |
udelay(eeprom->delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3616 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3617 |
/* Clock low */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3618 |
eecd &= ~E1000_EECD_SK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3619 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3620 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3621 |
udelay(eeprom->delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3622 |
} else if(eeprom->type == e1000_eeprom_spi) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3623 |
/* Toggle CS to flush commands */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3624 |
eecd |= E1000_EECD_CS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3625 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3626 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3627 |
udelay(eeprom->delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3628 |
eecd &= ~E1000_EECD_CS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3629 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3630 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3631 |
udelay(eeprom->delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3632 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3633 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3634 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3635 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3636 |
* Terminates a command by inverting the EEPROM's chip select pin |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3637 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3638 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3639 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3640 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3641 |
e1000_release_eeprom(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3642 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3643 |
uint32_t eecd; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3644 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3645 |
DEBUGFUNC("e1000_release_eeprom"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3646 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3647 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3648 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3649 |
if (hw->eeprom.type == e1000_eeprom_spi) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3650 |
eecd |= E1000_EECD_CS; /* Pull CS high */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3651 |
eecd &= ~E1000_EECD_SK; /* Lower SCK */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3652 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3653 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3654 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3655 |
udelay(hw->eeprom.delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3656 |
} else if(hw->eeprom.type == e1000_eeprom_microwire) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3657 |
/* cleanup eeprom */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3658 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3659 |
/* CS on Microwire is active-high */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3660 |
eecd &= ~(E1000_EECD_CS | E1000_EECD_DI); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3661 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3662 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3663 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3664 |
/* Rising edge of clock */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3665 |
eecd |= E1000_EECD_SK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3666 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3667 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3668 |
udelay(hw->eeprom.delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3669 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3670 |
/* Falling edge of clock */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3671 |
eecd &= ~E1000_EECD_SK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3672 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3673 |
E1000_WRITE_FLUSH(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3674 |
udelay(hw->eeprom.delay_usec); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3675 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3676 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3677 |
/* Stop requesting EEPROM access */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3678 |
if(hw->mac_type > e1000_82544) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3679 |
eecd &= ~E1000_EECD_REQ; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3680 |
E1000_WRITE_REG(hw, EECD, eecd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3681 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3682 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3683 |
e1000_put_hw_eeprom_semaphore(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3684 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3685 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3686 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3687 |
* Reads a 16 bit word from the EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3688 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3689 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3690 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3691 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3692 |
e1000_spi_eeprom_ready(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3693 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3694 |
uint16_t retry_count = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3695 |
uint8_t spi_stat_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3696 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3697 |
DEBUGFUNC("e1000_spi_eeprom_ready"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3698 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3699 |
/* Read "Status Register" repeatedly until the LSB is cleared. The |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3700 |
* EEPROM will signal that the command has been completed by clearing |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3701 |
* bit 0 of the internal status register. If it's not cleared within |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3702 |
* 5 milliseconds, then error out. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3703 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3704 |
retry_count = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3705 |
do { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3706 |
e1000_shift_out_ee_bits(hw, EEPROM_RDSR_OPCODE_SPI, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3707 |
hw->eeprom.opcode_bits); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3708 |
spi_stat_reg = (uint8_t)e1000_shift_in_ee_bits(hw, 8); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3709 |
if (!(spi_stat_reg & EEPROM_STATUS_RDY_SPI)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3710 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3711 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3712 |
udelay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3713 |
retry_count += 5; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3714 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3715 |
e1000_standby_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3716 |
} while(retry_count < EEPROM_MAX_RETRY_SPI); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3717 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3718 |
/* ATMEL SPI write time could vary from 0-20mSec on 3.3V devices (and |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3719 |
* only 0-5mSec on 5V devices) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3720 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3721 |
if(retry_count >= EEPROM_MAX_RETRY_SPI) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3722 |
DEBUGOUT("SPI EEPROM Status error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3723 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3724 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3725 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3726 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3727 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3728 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3729 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3730 |
* Reads a 16 bit word from the EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3731 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3732 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3733 |
* offset - offset of word in the EEPROM to read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3734 |
* data - word read from the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3735 |
* words - number of words to read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3736 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3737 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3738 |
e1000_read_eeprom(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3739 |
uint16_t offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3740 |
uint16_t words, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3741 |
uint16_t *data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3742 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3743 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3744 |
uint32_t i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3745 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3746 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3747 |
DEBUGFUNC("e1000_read_eeprom"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3748 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3749 |
/* A check for invalid values: offset too large, too many words, and not |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3750 |
* enough words. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3751 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3752 |
if((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3753 |
(words == 0)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3754 |
DEBUGOUT("\"words\" parameter out of bounds\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3755 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3756 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3757 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3758 |
/* FLASH reads without acquiring the semaphore are safe in 82573-based |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3759 |
* controllers. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3760 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3761 |
if ((e1000_is_onboard_nvm_eeprom(hw) == TRUE) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3762 |
(hw->mac_type != e1000_82573)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3763 |
/* Prepare the EEPROM for reading */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3764 |
if(e1000_acquire_eeprom(hw) != E1000_SUCCESS) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3765 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3766 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3767 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3768 |
if(eeprom->use_eerd == TRUE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3769 |
ret_val = e1000_read_eeprom_eerd(hw, offset, words, data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3770 |
if ((e1000_is_onboard_nvm_eeprom(hw) == TRUE) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3771 |
(hw->mac_type != e1000_82573)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3772 |
e1000_release_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3773 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3774 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3775 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3776 |
if(eeprom->type == e1000_eeprom_spi) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3777 |
uint16_t word_in; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3778 |
uint8_t read_opcode = EEPROM_READ_OPCODE_SPI; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3779 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3780 |
if(e1000_spi_eeprom_ready(hw)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3781 |
e1000_release_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3782 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3783 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3784 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3785 |
e1000_standby_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3786 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3787 |
/* Some SPI eeproms use the 8th address bit embedded in the opcode */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3788 |
if((eeprom->address_bits == 8) && (offset >= 128)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3789 |
read_opcode |= EEPROM_A8_OPCODE_SPI; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3790 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3791 |
/* Send the READ command (opcode + addr) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3792 |
e1000_shift_out_ee_bits(hw, read_opcode, eeprom->opcode_bits); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3793 |
e1000_shift_out_ee_bits(hw, (uint16_t)(offset*2), eeprom->address_bits); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3794 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3795 |
/* Read the data. The address of the eeprom internally increments with |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3796 |
* each byte (spi) being read, saving on the overhead of eeprom setup |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3797 |
* and tear-down. The address counter will roll over if reading beyond |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3798 |
* the size of the eeprom, thus allowing the entire memory to be read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3799 |
* starting from any offset. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3800 |
for (i = 0; i < words; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3801 |
word_in = e1000_shift_in_ee_bits(hw, 16); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3802 |
data[i] = (word_in >> 8) | (word_in << 8); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3803 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3804 |
} else if(eeprom->type == e1000_eeprom_microwire) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3805 |
for (i = 0; i < words; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3806 |
/* Send the READ command (opcode + addr) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3807 |
e1000_shift_out_ee_bits(hw, EEPROM_READ_OPCODE_MICROWIRE, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3808 |
eeprom->opcode_bits); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3809 |
e1000_shift_out_ee_bits(hw, (uint16_t)(offset + i), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3810 |
eeprom->address_bits); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3811 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3812 |
/* Read the data. For microwire, each word requires the overhead |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3813 |
* of eeprom setup and tear-down. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3814 |
data[i] = e1000_shift_in_ee_bits(hw, 16); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3815 |
e1000_standby_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3816 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3817 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3818 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3819 |
/* End this read operation */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3820 |
e1000_release_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3821 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3822 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3823 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3824 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3825 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3826 |
* Reads a 16 bit word from the EEPROM using the EERD register. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3827 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3828 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3829 |
* offset - offset of word in the EEPROM to read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3830 |
* data - word read from the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3831 |
* words - number of words to read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3832 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3833 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3834 |
e1000_read_eeprom_eerd(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3835 |
uint16_t offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3836 |
uint16_t words, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3837 |
uint16_t *data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3838 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3839 |
uint32_t i, eerd = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3840 |
int32_t error = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3841 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3842 |
for (i = 0; i < words; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3843 |
eerd = ((offset+i) << E1000_EEPROM_RW_ADDR_SHIFT) + |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3844 |
E1000_EEPROM_RW_REG_START; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3845 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3846 |
E1000_WRITE_REG(hw, EERD, eerd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3847 |
error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_READ); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3848 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3849 |
if(error) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3850 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3851 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3852 |
data[i] = (E1000_READ_REG(hw, EERD) >> E1000_EEPROM_RW_REG_DATA); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3853 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3854 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3855 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3856 |
return error; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3857 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3858 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3859 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3860 |
* Writes a 16 bit word from the EEPROM using the EEWR register. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3861 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3862 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3863 |
* offset - offset of word in the EEPROM to read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3864 |
* data - word read from the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3865 |
* words - number of words to read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3866 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3867 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3868 |
e1000_write_eeprom_eewr(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3869 |
uint16_t offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3870 |
uint16_t words, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3871 |
uint16_t *data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3872 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3873 |
uint32_t register_value = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3874 |
uint32_t i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3875 |
int32_t error = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3876 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3877 |
for (i = 0; i < words; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3878 |
register_value = (data[i] << E1000_EEPROM_RW_REG_DATA) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3879 |
((offset+i) << E1000_EEPROM_RW_ADDR_SHIFT) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3880 |
E1000_EEPROM_RW_REG_START; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3881 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3882 |
error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3883 |
if(error) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3884 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3885 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3886 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3887 |
E1000_WRITE_REG(hw, EEWR, register_value); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3888 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3889 |
error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3890 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3891 |
if(error) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3892 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3893 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3894 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3895 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3896 |
return error; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3897 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3898 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3899 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3900 |
* Polls the status bit (bit 1) of the EERD to determine when the read is done. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3901 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3902 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3903 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3904 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3905 |
e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3906 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3907 |
uint32_t attempts = 100000; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3908 |
uint32_t i, reg = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3909 |
int32_t done = E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3910 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3911 |
for(i = 0; i < attempts; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3912 |
if(eerd == E1000_EEPROM_POLL_READ) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3913 |
reg = E1000_READ_REG(hw, EERD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3914 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3915 |
reg = E1000_READ_REG(hw, EEWR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3916 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3917 |
if(reg & E1000_EEPROM_RW_REG_DONE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3918 |
done = E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3919 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3920 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3921 |
udelay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3922 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3923 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3924 |
return done; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3925 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3926 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3927 |
/*************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3928 |
* Description: Determines if the onboard NVM is FLASH or EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3929 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3930 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3931 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3932 |
boolean_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3933 |
e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3934 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3935 |
uint32_t eecd = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3936 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3937 |
if(hw->mac_type == e1000_82573) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3938 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3939 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3940 |
/* Isolate bits 15 & 16 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3941 |
eecd = ((eecd >> 15) & 0x03); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3942 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3943 |
/* If both bits are set, device is Flash type */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3944 |
if(eecd == 0x03) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3945 |
return FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3946 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3947 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3948 |
return TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3949 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3950 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3951 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3952 |
* Verifies that the EEPROM has a valid checksum |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3953 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3954 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3955 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3956 |
* Reads the first 64 16 bit words of the EEPROM and sums the values read. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3957 |
* If the the sum of the 64 16 bit words is 0xBABA, the EEPROM's checksum is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3958 |
* valid. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3959 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3960 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3961 |
e1000_validate_eeprom_checksum(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3962 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3963 |
uint16_t checksum = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3964 |
uint16_t i, eeprom_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3965 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3966 |
DEBUGFUNC("e1000_validate_eeprom_checksum"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3967 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3968 |
if ((hw->mac_type == e1000_82573) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3969 |
(e1000_is_onboard_nvm_eeprom(hw) == FALSE)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3970 |
/* Check bit 4 of word 10h. If it is 0, firmware is done updating |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3971 |
* 10h-12h. Checksum may need to be fixed. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3972 |
e1000_read_eeprom(hw, 0x10, 1, &eeprom_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3973 |
if ((eeprom_data & 0x10) == 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3974 |
/* Read 0x23 and check bit 15. This bit is a 1 when the checksum |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3975 |
* has already been fixed. If the checksum is still wrong and this |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3976 |
* bit is a 1, we need to return bad checksum. Otherwise, we need |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3977 |
* to set this bit to a 1 and update the checksum. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3978 |
e1000_read_eeprom(hw, 0x23, 1, &eeprom_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3979 |
if ((eeprom_data & 0x8000) == 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3980 |
eeprom_data |= 0x8000; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3981 |
e1000_write_eeprom(hw, 0x23, 1, &eeprom_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3982 |
e1000_update_eeprom_checksum(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3983 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3984 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3985 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3986 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3987 |
for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3988 |
if(e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3989 |
DEBUGOUT("EEPROM Read Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3990 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3991 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3992 |
checksum += eeprom_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3993 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3994 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3995 |
if(checksum == (uint16_t) EEPROM_SUM) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3996 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3997 |
else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3998 |
DEBUGOUT("EEPROM Checksum Invalid\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3999 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4000 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4001 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4002 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4003 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4004 |
* Calculates the EEPROM checksum and writes it to the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4005 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4006 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4007 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4008 |
* Sums the first 63 16 bit words of the EEPROM. Subtracts the sum from 0xBABA. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4009 |
* Writes the difference to word offset 63 of the EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4010 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4011 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4012 |
e1000_update_eeprom_checksum(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4013 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4014 |
uint16_t checksum = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4015 |
uint16_t i, eeprom_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4016 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4017 |
DEBUGFUNC("e1000_update_eeprom_checksum"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4018 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4019 |
for(i = 0; i < EEPROM_CHECKSUM_REG; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4020 |
if(e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4021 |
DEBUGOUT("EEPROM Read Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4022 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4023 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4024 |
checksum += eeprom_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4025 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4026 |
checksum = (uint16_t) EEPROM_SUM - checksum; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4027 |
if(e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4028 |
DEBUGOUT("EEPROM Write Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4029 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4030 |
} else if (hw->eeprom.type == e1000_eeprom_flash) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4031 |
e1000_commit_shadow_ram(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4032 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4033 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4034 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4035 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4036 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4037 |
* Parent function for writing words to the different EEPROM types. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4038 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4039 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4040 |
* offset - offset within the EEPROM to be written to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4041 |
* words - number of words to write |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4042 |
* data - 16 bit word to be written to the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4043 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4044 |
* If e1000_update_eeprom_checksum is not called after this function, the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4045 |
* EEPROM will most likely contain an invalid checksum. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4046 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4047 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4048 |
e1000_write_eeprom(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4049 |
uint16_t offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4050 |
uint16_t words, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4051 |
uint16_t *data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4052 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4053 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4054 |
int32_t status = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4055 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4056 |
DEBUGFUNC("e1000_write_eeprom"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4057 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4058 |
/* A check for invalid values: offset too large, too many words, and not |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4059 |
* enough words. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4060 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4061 |
if((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4062 |
(words == 0)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4063 |
DEBUGOUT("\"words\" parameter out of bounds\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4064 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4065 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4066 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4067 |
/* 82573 reads only through eerd */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4068 |
if(eeprom->use_eewr == TRUE) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4069 |
return e1000_write_eeprom_eewr(hw, offset, words, data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4070 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4071 |
/* Prepare the EEPROM for writing */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4072 |
if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4073 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4074 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4075 |
if(eeprom->type == e1000_eeprom_microwire) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4076 |
status = e1000_write_eeprom_microwire(hw, offset, words, data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4077 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4078 |
status = e1000_write_eeprom_spi(hw, offset, words, data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4079 |
msec_delay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4080 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4081 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4082 |
/* Done with writing */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4083 |
e1000_release_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4084 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4085 |
return status; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4086 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4087 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4088 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4089 |
* Writes a 16 bit word to a given offset in an SPI EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4090 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4091 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4092 |
* offset - offset within the EEPROM to be written to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4093 |
* words - number of words to write |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4094 |
* data - pointer to array of 8 bit words to be written to the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4095 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4096 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4097 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4098 |
e1000_write_eeprom_spi(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4099 |
uint16_t offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4100 |
uint16_t words, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4101 |
uint16_t *data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4102 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4103 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4104 |
uint16_t widx = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4105 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4106 |
DEBUGFUNC("e1000_write_eeprom_spi"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4107 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4108 |
while (widx < words) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4109 |
uint8_t write_opcode = EEPROM_WRITE_OPCODE_SPI; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4110 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4111 |
if(e1000_spi_eeprom_ready(hw)) return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4112 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4113 |
e1000_standby_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4114 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4115 |
/* Send the WRITE ENABLE command (8 bit opcode ) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4116 |
e1000_shift_out_ee_bits(hw, EEPROM_WREN_OPCODE_SPI, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4117 |
eeprom->opcode_bits); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4118 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4119 |
e1000_standby_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4120 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4121 |
/* Some SPI eeproms use the 8th address bit embedded in the opcode */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4122 |
if((eeprom->address_bits == 8) && (offset >= 128)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4123 |
write_opcode |= EEPROM_A8_OPCODE_SPI; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4124 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4125 |
/* Send the Write command (8-bit opcode + addr) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4126 |
e1000_shift_out_ee_bits(hw, write_opcode, eeprom->opcode_bits); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4127 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4128 |
e1000_shift_out_ee_bits(hw, (uint16_t)((offset + widx)*2), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4129 |
eeprom->address_bits); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4130 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4131 |
/* Send the data */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4132 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4133 |
/* Loop to allow for up to whole page write (32 bytes) of eeprom */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4134 |
while (widx < words) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4135 |
uint16_t word_out = data[widx]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4136 |
word_out = (word_out >> 8) | (word_out << 8); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4137 |
e1000_shift_out_ee_bits(hw, word_out, 16); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4138 |
widx++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4139 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4140 |
/* Some larger eeprom sizes are capable of a 32-byte PAGE WRITE |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4141 |
* operation, while the smaller eeproms are capable of an 8-byte |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4142 |
* PAGE WRITE operation. Break the inner loop to pass new address |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4143 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4144 |
if((((offset + widx)*2) % eeprom->page_size) == 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4145 |
e1000_standby_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4146 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4147 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4148 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4149 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4150 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4151 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4152 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4153 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4154 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4155 |
* Writes a 16 bit word to a given offset in a Microwire EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4156 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4157 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4158 |
* offset - offset within the EEPROM to be written to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4159 |
* words - number of words to write |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4160 |
* data - pointer to array of 16 bit words to be written to the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4161 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4162 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4163 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4164 |
e1000_write_eeprom_microwire(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4165 |
uint16_t offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4166 |
uint16_t words, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4167 |
uint16_t *data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4168 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4169 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4170 |
uint32_t eecd; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4171 |
uint16_t words_written = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4172 |
uint16_t i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4173 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4174 |
DEBUGFUNC("e1000_write_eeprom_microwire"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4175 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4176 |
/* Send the write enable command to the EEPROM (3-bit opcode plus |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4177 |
* 6/8-bit dummy address beginning with 11). It's less work to include |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4178 |
* the 11 of the dummy address as part of the opcode than it is to shift |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4179 |
* it over the correct number of bits for the address. This puts the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4180 |
* EEPROM into write/erase mode. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4181 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4182 |
e1000_shift_out_ee_bits(hw, EEPROM_EWEN_OPCODE_MICROWIRE, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4183 |
(uint16_t)(eeprom->opcode_bits + 2)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4184 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4185 |
e1000_shift_out_ee_bits(hw, 0, (uint16_t)(eeprom->address_bits - 2)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4186 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4187 |
/* Prepare the EEPROM */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4188 |
e1000_standby_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4189 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4190 |
while (words_written < words) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4191 |
/* Send the Write command (3-bit opcode + addr) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4192 |
e1000_shift_out_ee_bits(hw, EEPROM_WRITE_OPCODE_MICROWIRE, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4193 |
eeprom->opcode_bits); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4194 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4195 |
e1000_shift_out_ee_bits(hw, (uint16_t)(offset + words_written), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4196 |
eeprom->address_bits); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4197 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4198 |
/* Send the data */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4199 |
e1000_shift_out_ee_bits(hw, data[words_written], 16); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4200 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4201 |
/* Toggle the CS line. This in effect tells the EEPROM to execute |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4202 |
* the previous command. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4203 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4204 |
e1000_standby_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4205 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4206 |
/* Read DO repeatedly until it is high (equal to '1'). The EEPROM will |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4207 |
* signal that the command has been completed by raising the DO signal. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4208 |
* If DO does not go high in 10 milliseconds, then error out. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4209 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4210 |
for(i = 0; i < 200; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4211 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4212 |
if(eecd & E1000_EECD_DO) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4213 |
udelay(50); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4214 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4215 |
if(i == 200) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4216 |
DEBUGOUT("EEPROM Write did not complete\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4217 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4218 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4219 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4220 |
/* Recover from write */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4221 |
e1000_standby_eeprom(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4222 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4223 |
words_written++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4224 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4225 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4226 |
/* Send the write disable command to the EEPROM (3-bit opcode plus |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4227 |
* 6/8-bit dummy address beginning with 10). It's less work to include |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4228 |
* the 10 of the dummy address as part of the opcode than it is to shift |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4229 |
* it over the correct number of bits for the address. This takes the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4230 |
* EEPROM out of write/erase mode. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4231 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4232 |
e1000_shift_out_ee_bits(hw, EEPROM_EWDS_OPCODE_MICROWIRE, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4233 |
(uint16_t)(eeprom->opcode_bits + 2)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4234 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4235 |
e1000_shift_out_ee_bits(hw, 0, (uint16_t)(eeprom->address_bits - 2)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4236 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4237 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4238 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4239 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4240 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4241 |
* Flushes the cached eeprom to NVM. This is done by saving the modified values |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4242 |
* in the eeprom cache and the non modified values in the currently active bank |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4243 |
* to the new bank. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4244 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4245 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4246 |
* offset - offset of word in the EEPROM to read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4247 |
* data - word read from the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4248 |
* words - number of words to read |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4249 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4250 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4251 |
e1000_commit_shadow_ram(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4252 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4253 |
uint32_t attempts = 100000; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4254 |
uint32_t eecd = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4255 |
uint32_t flop = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4256 |
uint32_t i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4257 |
int32_t error = E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4258 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4259 |
/* The flop register will be used to determine if flash type is STM */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4260 |
flop = E1000_READ_REG(hw, FLOP); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4261 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4262 |
if (hw->mac_type == e1000_82573) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4263 |
for (i=0; i < attempts; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4264 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4265 |
if ((eecd & E1000_EECD_FLUPD) == 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4266 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4267 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4268 |
udelay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4269 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4270 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4271 |
if (i == attempts) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4272 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4273 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4274 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4275 |
/* If STM opcode located in bits 15:8 of flop, reset firmware */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4276 |
if ((flop & 0xFF00) == E1000_STM_OPCODE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4277 |
E1000_WRITE_REG(hw, HICR, E1000_HICR_FW_RESET); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4278 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4279 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4280 |
/* Perform the flash update */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4281 |
E1000_WRITE_REG(hw, EECD, eecd | E1000_EECD_FLUPD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4282 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4283 |
for (i=0; i < attempts; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4284 |
eecd = E1000_READ_REG(hw, EECD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4285 |
if ((eecd & E1000_EECD_FLUPD) == 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4286 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4287 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4288 |
udelay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4289 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4290 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4291 |
if (i == attempts) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4292 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4293 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4294 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4295 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4296 |
return error; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4297 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4298 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4299 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4300 |
* Reads the adapter's part number from the EEPROM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4301 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4302 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4303 |
* part_num - Adapter's part number |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4304 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4305 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4306 |
e1000_read_part_num(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4307 |
uint32_t *part_num) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4308 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4309 |
uint16_t offset = EEPROM_PBA_BYTE_1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4310 |
uint16_t eeprom_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4311 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4312 |
DEBUGFUNC("e1000_read_part_num"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4313 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4314 |
/* Get word 0 from EEPROM */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4315 |
if(e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4316 |
DEBUGOUT("EEPROM Read Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4317 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4318 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4319 |
/* Save word 0 in upper half of part_num */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4320 |
*part_num = (uint32_t) (eeprom_data << 16); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4321 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4322 |
/* Get word 1 from EEPROM */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4323 |
if(e1000_read_eeprom(hw, ++offset, 1, &eeprom_data) < 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4324 |
DEBUGOUT("EEPROM Read Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4325 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4326 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4327 |
/* Save word 1 in lower half of part_num */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4328 |
*part_num |= eeprom_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4329 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4330 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4331 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4332 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4333 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4334 |
* Reads the adapter's MAC address from the EEPROM and inverts the LSB for the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4335 |
* second function of dual function devices |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4336 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4337 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4338 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4339 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4340 |
e1000_read_mac_addr(struct e1000_hw * hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4341 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4342 |
uint16_t offset; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4343 |
uint16_t eeprom_data, i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4344 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4345 |
DEBUGFUNC("e1000_read_mac_addr"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4346 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4347 |
for(i = 0; i < NODE_ADDRESS_SIZE; i += 2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4348 |
offset = i >> 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4349 |
if(e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4350 |
DEBUGOUT("EEPROM Read Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4351 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4352 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4353 |
hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4354 |
hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4355 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4356 |
if(((hw->mac_type == e1000_82546) || (hw->mac_type == e1000_82546_rev_3)) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4357 |
(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4358 |
hw->perm_mac_addr[5] ^= 0x01; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4359 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4360 |
for(i = 0; i < NODE_ADDRESS_SIZE; i++) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4361 |
hw->mac_addr[i] = hw->perm_mac_addr[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4362 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4363 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4364 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4365 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4366 |
* Initializes receive address filters. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4367 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4368 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4369 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4370 |
* Places the MAC address in receive address register 0 and clears the rest |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4371 |
* of the receive addresss registers. Clears the multicast table. Assumes |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4372 |
* the receiver is in reset when the routine is called. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4373 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4374 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4375 |
e1000_init_rx_addrs(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4376 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4377 |
uint32_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4378 |
uint32_t rar_num; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4379 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4380 |
DEBUGFUNC("e1000_init_rx_addrs"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4381 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4382 |
/* Setup the receive address. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4383 |
DEBUGOUT("Programming MAC Address into RAR[0]\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4384 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4385 |
e1000_rar_set(hw, hw->mac_addr, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4386 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4387 |
rar_num = E1000_RAR_ENTRIES; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4388 |
/* Zero out the other 15 receive addresses. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4389 |
DEBUGOUT("Clearing RAR[1-15]\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4390 |
for(i = 1; i < rar_num; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4391 |
E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4392 |
E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4393 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4394 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4395 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4396 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4397 |
* Updates the MAC's list of multicast addresses. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4398 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4399 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4400 |
* mc_addr_list - the list of new multicast addresses |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4401 |
* mc_addr_count - number of addresses |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4402 |
* pad - number of bytes between addresses in the list |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4403 |
* rar_used_count - offset where to start adding mc addresses into the RAR's |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4404 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4405 |
* The given list replaces any existing list. Clears the last 15 receive |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4406 |
* address registers and the multicast table. Uses receive address registers |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4407 |
* for the first 15 multicast addresses, and hashes the rest into the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4408 |
* multicast table. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4409 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4410 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4411 |
e1000_mc_addr_list_update(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4412 |
uint8_t *mc_addr_list, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4413 |
uint32_t mc_addr_count, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4414 |
uint32_t pad, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4415 |
uint32_t rar_used_count) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4416 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4417 |
uint32_t hash_value; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4418 |
uint32_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4419 |
uint32_t num_rar_entry; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4420 |
uint32_t num_mta_entry; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4421 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4422 |
DEBUGFUNC("e1000_mc_addr_list_update"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4423 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4424 |
/* Set the new number of MC addresses that we are being requested to use. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4425 |
hw->num_mc_addrs = mc_addr_count; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4426 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4427 |
/* Clear RAR[1-15] */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4428 |
DEBUGOUT(" Clearing RAR[1-15]\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4429 |
num_rar_entry = E1000_RAR_ENTRIES; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4430 |
for(i = rar_used_count; i < num_rar_entry; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4431 |
E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4432 |
E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4433 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4434 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4435 |
/* Clear the MTA */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4436 |
DEBUGOUT(" Clearing MTA\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4437 |
num_mta_entry = E1000_NUM_MTA_REGISTERS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4438 |
for(i = 0; i < num_mta_entry; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4439 |
E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4440 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4441 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4442 |
/* Add the new addresses */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4443 |
for(i = 0; i < mc_addr_count; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4444 |
DEBUGOUT(" Adding the multicast addresses:\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4445 |
DEBUGOUT7(" MC Addr #%d =%.2X %.2X %.2X %.2X %.2X %.2X\n", i, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4446 |
mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad)], |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4447 |
mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad) + 1], |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4448 |
mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad) + 2], |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4449 |
mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad) + 3], |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4450 |
mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad) + 4], |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4451 |
mc_addr_list[i * (ETH_LENGTH_OF_ADDRESS + pad) + 5]); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4452 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4453 |
hash_value = e1000_hash_mc_addr(hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4454 |
mc_addr_list + |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4455 |
(i * (ETH_LENGTH_OF_ADDRESS + pad))); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4456 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4457 |
DEBUGOUT1(" Hash value = 0x%03X\n", hash_value); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4458 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4459 |
/* Place this multicast address in the RAR if there is room, * |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4460 |
* else put it in the MTA |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4461 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4462 |
if (rar_used_count < num_rar_entry) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4463 |
e1000_rar_set(hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4464 |
mc_addr_list + (i * (ETH_LENGTH_OF_ADDRESS + pad)), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4465 |
rar_used_count); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4466 |
rar_used_count++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4467 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4468 |
e1000_mta_set(hw, hash_value); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4469 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4470 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4471 |
DEBUGOUT("MC Update Complete\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4472 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4473 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4474 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4475 |
* Hashes an address to determine its location in the multicast table |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4476 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4477 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4478 |
* mc_addr - the multicast address to hash |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4479 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4480 |
uint32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4481 |
e1000_hash_mc_addr(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4482 |
uint8_t *mc_addr) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4483 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4484 |
uint32_t hash_value = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4485 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4486 |
/* The portion of the address that is used for the hash table is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4487 |
* determined by the mc_filter_type setting. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4488 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4489 |
switch (hw->mc_filter_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4490 |
/* [0] [1] [2] [3] [4] [5] |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4491 |
* 01 AA 00 12 34 56 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4492 |
* LSB MSB |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4493 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4494 |
case 0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4495 |
/* [47:36] i.e. 0x563 for above example address */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4496 |
hash_value = ((mc_addr[4] >> 4) | (((uint16_t) mc_addr[5]) << 4)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4497 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4498 |
case 1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4499 |
/* [46:35] i.e. 0xAC6 for above example address */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4500 |
hash_value = ((mc_addr[4] >> 3) | (((uint16_t) mc_addr[5]) << 5)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4501 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4502 |
case 2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4503 |
/* [45:34] i.e. 0x5D8 for above example address */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4504 |
hash_value = ((mc_addr[4] >> 2) | (((uint16_t) mc_addr[5]) << 6)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4505 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4506 |
case 3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4507 |
/* [43:32] i.e. 0x634 for above example address */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4508 |
hash_value = ((mc_addr[4]) | (((uint16_t) mc_addr[5]) << 8)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4509 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4510 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4511 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4512 |
hash_value &= 0xFFF; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4513 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4514 |
return hash_value; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4515 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4516 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4517 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4518 |
* Sets the bit in the multicast table corresponding to the hash value. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4519 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4520 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4521 |
* hash_value - Multicast address hash value |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4522 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4523 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4524 |
e1000_mta_set(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4525 |
uint32_t hash_value) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4526 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4527 |
uint32_t hash_bit, hash_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4528 |
uint32_t mta; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4529 |
uint32_t temp; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4530 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4531 |
/* The MTA is a register array of 128 32-bit registers. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4532 |
* It is treated like an array of 4096 bits. We want to set |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4533 |
* bit BitArray[hash_value]. So we figure out what register |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4534 |
* the bit is in, read it, OR in the new bit, then write |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4535 |
* back the new value. The register is determined by the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4536 |
* upper 7 bits of the hash value and the bit within that |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4537 |
* register are determined by the lower 5 bits of the value. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4538 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4539 |
hash_reg = (hash_value >> 5) & 0x7F; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4540 |
hash_bit = hash_value & 0x1F; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4541 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4542 |
mta = E1000_READ_REG_ARRAY(hw, MTA, hash_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4543 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4544 |
mta |= (1 << hash_bit); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4545 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4546 |
/* If we are on an 82544 and we are trying to write an odd offset |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4547 |
* in the MTA, save off the previous entry before writing and |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4548 |
* restore the old value after writing. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4549 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4550 |
if((hw->mac_type == e1000_82544) && ((hash_reg & 0x1) == 1)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4551 |
temp = E1000_READ_REG_ARRAY(hw, MTA, (hash_reg - 1)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4552 |
E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4553 |
E1000_WRITE_REG_ARRAY(hw, MTA, (hash_reg - 1), temp); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4554 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4555 |
E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4556 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4557 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4558 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4559 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4560 |
* Puts an ethernet address into a receive address register. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4561 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4562 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4563 |
* addr - Address to put into receive address register |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4564 |
* index - Receive address register to write |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4565 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4566 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4567 |
e1000_rar_set(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4568 |
uint8_t *addr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4569 |
uint32_t index) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4570 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4571 |
uint32_t rar_low, rar_high; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4572 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4573 |
/* HW expects these in little endian so we reverse the byte order |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4574 |
* from network order (big endian) to little endian |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4575 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4576 |
rar_low = ((uint32_t) addr[0] | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4577 |
((uint32_t) addr[1] << 8) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4578 |
((uint32_t) addr[2] << 16) | ((uint32_t) addr[3] << 24)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4579 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4580 |
rar_high = ((uint32_t) addr[4] | ((uint32_t) addr[5] << 8) | E1000_RAH_AV); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4581 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4582 |
E1000_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4583 |
E1000_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4584 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4585 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4586 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4587 |
* Writes a value to the specified offset in the VLAN filter table. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4588 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4589 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4590 |
* offset - Offset in VLAN filer table to write |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4591 |
* value - Value to write into VLAN filter table |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4592 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4593 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4594 |
e1000_write_vfta(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4595 |
uint32_t offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4596 |
uint32_t value) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4597 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4598 |
uint32_t temp; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4599 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4600 |
if((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4601 |
temp = E1000_READ_REG_ARRAY(hw, VFTA, (offset - 1)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4602 |
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4603 |
E1000_WRITE_REG_ARRAY(hw, VFTA, (offset - 1), temp); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4604 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4605 |
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4606 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4607 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4608 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4609 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4610 |
* Clears the VLAN filer table |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4611 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4612 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4613 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4614 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4615 |
e1000_clear_vfta(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4616 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4617 |
uint32_t offset; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4618 |
uint32_t vfta_value = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4619 |
uint32_t vfta_offset = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4620 |
uint32_t vfta_bit_in_reg = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4621 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4622 |
if (hw->mac_type == e1000_82573) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4623 |
if (hw->mng_cookie.vlan_id != 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4624 |
/* The VFTA is a 4096b bit-field, each identifying a single VLAN |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4625 |
* ID. The following operations determine which 32b entry |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4626 |
* (i.e. offset) into the array we want to set the VLAN ID |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4627 |
* (i.e. bit) of the manageability unit. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4628 |
vfta_offset = (hw->mng_cookie.vlan_id >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4629 |
E1000_VFTA_ENTRY_SHIFT) & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4630 |
E1000_VFTA_ENTRY_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4631 |
vfta_bit_in_reg = 1 << (hw->mng_cookie.vlan_id & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4632 |
E1000_VFTA_ENTRY_BIT_SHIFT_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4633 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4634 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4635 |
for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4636 |
/* If the offset we want to clear is the same offset of the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4637 |
* manageability VLAN ID, then clear all bits except that of the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4638 |
* manageability unit */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4639 |
vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4640 |
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4641 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4642 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4643 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4644 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4645 |
e1000_id_led_init(struct e1000_hw * hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4646 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4647 |
uint32_t ledctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4648 |
const uint32_t ledctl_mask = 0x000000FF; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4649 |
const uint32_t ledctl_on = E1000_LEDCTL_MODE_LED_ON; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4650 |
const uint32_t ledctl_off = E1000_LEDCTL_MODE_LED_OFF; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4651 |
uint16_t eeprom_data, i, temp; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4652 |
const uint16_t led_mask = 0x0F; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4653 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4654 |
DEBUGFUNC("e1000_id_led_init"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4655 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4656 |
if(hw->mac_type < e1000_82540) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4657 |
/* Nothing to do */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4658 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4659 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4660 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4661 |
ledctl = E1000_READ_REG(hw, LEDCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4662 |
hw->ledctl_default = ledctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4663 |
hw->ledctl_mode1 = hw->ledctl_default; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4664 |
hw->ledctl_mode2 = hw->ledctl_default; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4665 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4666 |
if(e1000_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4667 |
DEBUGOUT("EEPROM Read Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4668 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4669 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4670 |
if((eeprom_data== ID_LED_RESERVED_0000) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4671 |
(eeprom_data == ID_LED_RESERVED_FFFF)) eeprom_data = ID_LED_DEFAULT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4672 |
for(i = 0; i < 4; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4673 |
temp = (eeprom_data >> (i << 2)) & led_mask; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4674 |
switch(temp) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4675 |
case ID_LED_ON1_DEF2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4676 |
case ID_LED_ON1_ON2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4677 |
case ID_LED_ON1_OFF2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4678 |
hw->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4679 |
hw->ledctl_mode1 |= ledctl_on << (i << 3); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4680 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4681 |
case ID_LED_OFF1_DEF2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4682 |
case ID_LED_OFF1_ON2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4683 |
case ID_LED_OFF1_OFF2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4684 |
hw->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4685 |
hw->ledctl_mode1 |= ledctl_off << (i << 3); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4686 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4687 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4688 |
/* Do nothing */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4689 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4690 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4691 |
switch(temp) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4692 |
case ID_LED_DEF1_ON2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4693 |
case ID_LED_ON1_ON2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4694 |
case ID_LED_OFF1_ON2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4695 |
hw->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4696 |
hw->ledctl_mode2 |= ledctl_on << (i << 3); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4697 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4698 |
case ID_LED_DEF1_OFF2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4699 |
case ID_LED_ON1_OFF2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4700 |
case ID_LED_OFF1_OFF2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4701 |
hw->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4702 |
hw->ledctl_mode2 |= ledctl_off << (i << 3); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4703 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4704 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4705 |
/* Do nothing */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4706 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4707 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4708 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4709 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4710 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4711 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4712 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4713 |
* Prepares SW controlable LED for use and saves the current state of the LED. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4714 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4715 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4716 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4717 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4718 |
e1000_setup_led(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4719 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4720 |
uint32_t ledctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4721 |
int32_t ret_val = E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4722 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4723 |
DEBUGFUNC("e1000_setup_led"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4724 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4725 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4726 |
case e1000_82542_rev2_0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4727 |
case e1000_82542_rev2_1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4728 |
case e1000_82543: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4729 |
case e1000_82544: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4730 |
/* No setup necessary */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4731 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4732 |
case e1000_82541: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4733 |
case e1000_82547: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4734 |
case e1000_82541_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4735 |
case e1000_82547_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4736 |
/* Turn off PHY Smart Power Down (if enabled) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4737 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4738 |
&hw->phy_spd_default); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4739 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4740 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4741 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4742 |
(uint16_t)(hw->phy_spd_default & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4743 |
~IGP01E1000_GMII_SPD)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4744 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4745 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4746 |
/* Fall Through */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4747 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4748 |
if(hw->media_type == e1000_media_type_fiber) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4749 |
ledctl = E1000_READ_REG(hw, LEDCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4750 |
/* Save current LEDCTL settings */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4751 |
hw->ledctl_default = ledctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4752 |
/* Turn off LED0 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4753 |
ledctl &= ~(E1000_LEDCTL_LED0_IVRT | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4754 |
E1000_LEDCTL_LED0_BLINK | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4755 |
E1000_LEDCTL_LED0_MODE_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4756 |
ledctl |= (E1000_LEDCTL_MODE_LED_OFF << |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4757 |
E1000_LEDCTL_LED0_MODE_SHIFT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4758 |
E1000_WRITE_REG(hw, LEDCTL, ledctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4759 |
} else if(hw->media_type == e1000_media_type_copper) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4760 |
E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4761 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4762 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4763 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4764 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4765 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4766 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4767 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4768 |
* Restores the saved state of the SW controlable LED. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4769 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4770 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4771 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4772 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4773 |
e1000_cleanup_led(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4774 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4775 |
int32_t ret_val = E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4776 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4777 |
DEBUGFUNC("e1000_cleanup_led"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4778 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4779 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4780 |
case e1000_82542_rev2_0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4781 |
case e1000_82542_rev2_1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4782 |
case e1000_82543: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4783 |
case e1000_82544: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4784 |
/* No cleanup necessary */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4785 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4786 |
case e1000_82541: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4787 |
case e1000_82547: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4788 |
case e1000_82541_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4789 |
case e1000_82547_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4790 |
/* Turn on PHY Smart Power Down (if previously enabled) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4791 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4792 |
hw->phy_spd_default); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4793 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4794 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4795 |
/* Fall Through */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4796 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4797 |
/* Restore LEDCTL settings */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4798 |
E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_default); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4799 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4800 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4801 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4802 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4803 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4804 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4805 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4806 |
* Turns on the software controllable LED |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4807 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4808 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4809 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4810 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4811 |
e1000_led_on(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4812 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4813 |
uint32_t ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4814 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4815 |
DEBUGFUNC("e1000_led_on"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4816 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4817 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4818 |
case e1000_82542_rev2_0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4819 |
case e1000_82542_rev2_1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4820 |
case e1000_82543: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4821 |
/* Set SW Defineable Pin 0 to turn on the LED */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4822 |
ctrl |= E1000_CTRL_SWDPIN0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4823 |
ctrl |= E1000_CTRL_SWDPIO0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4824 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4825 |
case e1000_82544: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4826 |
if(hw->media_type == e1000_media_type_fiber) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4827 |
/* Set SW Defineable Pin 0 to turn on the LED */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4828 |
ctrl |= E1000_CTRL_SWDPIN0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4829 |
ctrl |= E1000_CTRL_SWDPIO0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4830 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4831 |
/* Clear SW Defineable Pin 0 to turn on the LED */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4832 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4833 |
ctrl |= E1000_CTRL_SWDPIO0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4834 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4835 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4836 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4837 |
if(hw->media_type == e1000_media_type_fiber) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4838 |
/* Clear SW Defineable Pin 0 to turn on the LED */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4839 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4840 |
ctrl |= E1000_CTRL_SWDPIO0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4841 |
} else if(hw->media_type == e1000_media_type_copper) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4842 |
E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode2); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4843 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4844 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4845 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4846 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4847 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4848 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4849 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4850 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4851 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4852 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4853 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4854 |
* Turns off the software controllable LED |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4855 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4856 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4857 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4858 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4859 |
e1000_led_off(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4860 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4861 |
uint32_t ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4862 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4863 |
DEBUGFUNC("e1000_led_off"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4864 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4865 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4866 |
case e1000_82542_rev2_0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4867 |
case e1000_82542_rev2_1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4868 |
case e1000_82543: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4869 |
/* Clear SW Defineable Pin 0 to turn off the LED */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4870 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4871 |
ctrl |= E1000_CTRL_SWDPIO0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4872 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4873 |
case e1000_82544: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4874 |
if(hw->media_type == e1000_media_type_fiber) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4875 |
/* Clear SW Defineable Pin 0 to turn off the LED */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4876 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4877 |
ctrl |= E1000_CTRL_SWDPIO0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4878 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4879 |
/* Set SW Defineable Pin 0 to turn off the LED */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4880 |
ctrl |= E1000_CTRL_SWDPIN0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4881 |
ctrl |= E1000_CTRL_SWDPIO0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4882 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4883 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4884 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4885 |
if(hw->media_type == e1000_media_type_fiber) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4886 |
/* Set SW Defineable Pin 0 to turn off the LED */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4887 |
ctrl |= E1000_CTRL_SWDPIN0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4888 |
ctrl |= E1000_CTRL_SWDPIO0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4889 |
} else if(hw->media_type == e1000_media_type_copper) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4890 |
E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4891 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4892 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4893 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4894 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4895 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4896 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4897 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4898 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4899 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4900 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4901 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4902 |
* Clears all hardware statistics counters. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4903 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4904 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4905 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4906 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4907 |
e1000_clear_hw_cntrs(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4908 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4909 |
volatile uint32_t temp; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4910 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4911 |
temp = E1000_READ_REG(hw, CRCERRS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4912 |
temp = E1000_READ_REG(hw, SYMERRS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4913 |
temp = E1000_READ_REG(hw, MPC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4914 |
temp = E1000_READ_REG(hw, SCC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4915 |
temp = E1000_READ_REG(hw, ECOL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4916 |
temp = E1000_READ_REG(hw, MCC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4917 |
temp = E1000_READ_REG(hw, LATECOL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4918 |
temp = E1000_READ_REG(hw, COLC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4919 |
temp = E1000_READ_REG(hw, DC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4920 |
temp = E1000_READ_REG(hw, SEC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4921 |
temp = E1000_READ_REG(hw, RLEC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4922 |
temp = E1000_READ_REG(hw, XONRXC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4923 |
temp = E1000_READ_REG(hw, XONTXC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4924 |
temp = E1000_READ_REG(hw, XOFFRXC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4925 |
temp = E1000_READ_REG(hw, XOFFTXC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4926 |
temp = E1000_READ_REG(hw, FCRUC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4927 |
temp = E1000_READ_REG(hw, PRC64); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4928 |
temp = E1000_READ_REG(hw, PRC127); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4929 |
temp = E1000_READ_REG(hw, PRC255); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4930 |
temp = E1000_READ_REG(hw, PRC511); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4931 |
temp = E1000_READ_REG(hw, PRC1023); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4932 |
temp = E1000_READ_REG(hw, PRC1522); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4933 |
temp = E1000_READ_REG(hw, GPRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4934 |
temp = E1000_READ_REG(hw, BPRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4935 |
temp = E1000_READ_REG(hw, MPRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4936 |
temp = E1000_READ_REG(hw, GPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4937 |
temp = E1000_READ_REG(hw, GORCL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4938 |
temp = E1000_READ_REG(hw, GORCH); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4939 |
temp = E1000_READ_REG(hw, GOTCL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4940 |
temp = E1000_READ_REG(hw, GOTCH); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4941 |
temp = E1000_READ_REG(hw, RNBC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4942 |
temp = E1000_READ_REG(hw, RUC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4943 |
temp = E1000_READ_REG(hw, RFC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4944 |
temp = E1000_READ_REG(hw, ROC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4945 |
temp = E1000_READ_REG(hw, RJC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4946 |
temp = E1000_READ_REG(hw, TORL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4947 |
temp = E1000_READ_REG(hw, TORH); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4948 |
temp = E1000_READ_REG(hw, TOTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4949 |
temp = E1000_READ_REG(hw, TOTH); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4950 |
temp = E1000_READ_REG(hw, TPR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4951 |
temp = E1000_READ_REG(hw, TPT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4952 |
temp = E1000_READ_REG(hw, PTC64); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4953 |
temp = E1000_READ_REG(hw, PTC127); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4954 |
temp = E1000_READ_REG(hw, PTC255); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4955 |
temp = E1000_READ_REG(hw, PTC511); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4956 |
temp = E1000_READ_REG(hw, PTC1023); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4957 |
temp = E1000_READ_REG(hw, PTC1522); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4958 |
temp = E1000_READ_REG(hw, MPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4959 |
temp = E1000_READ_REG(hw, BPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4960 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4961 |
if(hw->mac_type < e1000_82543) return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4962 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4963 |
temp = E1000_READ_REG(hw, ALGNERRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4964 |
temp = E1000_READ_REG(hw, RXERRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4965 |
temp = E1000_READ_REG(hw, TNCRS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4966 |
temp = E1000_READ_REG(hw, CEXTERR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4967 |
temp = E1000_READ_REG(hw, TSCTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4968 |
temp = E1000_READ_REG(hw, TSCTFC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4969 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4970 |
if(hw->mac_type <= e1000_82544) return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4971 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4972 |
temp = E1000_READ_REG(hw, MGTPRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4973 |
temp = E1000_READ_REG(hw, MGTPDC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4974 |
temp = E1000_READ_REG(hw, MGTPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4975 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4976 |
if(hw->mac_type <= e1000_82547_rev_2) return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4977 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4978 |
temp = E1000_READ_REG(hw, IAC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4979 |
temp = E1000_READ_REG(hw, ICRXOC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4980 |
temp = E1000_READ_REG(hw, ICRXPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4981 |
temp = E1000_READ_REG(hw, ICRXATC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4982 |
temp = E1000_READ_REG(hw, ICTXPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4983 |
temp = E1000_READ_REG(hw, ICTXATC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4984 |
temp = E1000_READ_REG(hw, ICTXQEC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4985 |
temp = E1000_READ_REG(hw, ICTXQMTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4986 |
temp = E1000_READ_REG(hw, ICRXDMTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4987 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4988 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4989 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4990 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4991 |
* Resets Adaptive IFS to its default state. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4992 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4993 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4994 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4995 |
* Call this after e1000_init_hw. You may override the IFS defaults by setting |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4996 |
* hw->ifs_params_forced to TRUE. However, you must initialize hw-> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4997 |
* current_ifs_val, ifs_min_val, ifs_max_val, ifs_step_size, and ifs_ratio |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4998 |
* before calling this function. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4999 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5000 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5001 |
e1000_reset_adaptive(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5002 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5003 |
DEBUGFUNC("e1000_reset_adaptive"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5004 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5005 |
if(hw->adaptive_ifs) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5006 |
if(!hw->ifs_params_forced) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5007 |
hw->current_ifs_val = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5008 |
hw->ifs_min_val = IFS_MIN; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5009 |
hw->ifs_max_val = IFS_MAX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5010 |
hw->ifs_step_size = IFS_STEP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5011 |
hw->ifs_ratio = IFS_RATIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5012 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5013 |
hw->in_ifs_mode = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5014 |
E1000_WRITE_REG(hw, AIT, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5015 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5016 |
DEBUGOUT("Not in Adaptive IFS mode!\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5017 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5018 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5019 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5020 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5021 |
* Called during the callback/watchdog routine to update IFS value based on |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5022 |
* the ratio of transmits to collisions. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5023 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5024 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5025 |
* tx_packets - Number of transmits since last callback |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5026 |
* total_collisions - Number of collisions since last callback |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5027 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5028 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5029 |
e1000_update_adaptive(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5030 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5031 |
DEBUGFUNC("e1000_update_adaptive"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5032 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5033 |
if(hw->adaptive_ifs) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5034 |
if((hw->collision_delta * hw->ifs_ratio) > hw->tx_packet_delta) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5035 |
if(hw->tx_packet_delta > MIN_NUM_XMITS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5036 |
hw->in_ifs_mode = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5037 |
if(hw->current_ifs_val < hw->ifs_max_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5038 |
if(hw->current_ifs_val == 0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5039 |
hw->current_ifs_val = hw->ifs_min_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5040 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5041 |
hw->current_ifs_val += hw->ifs_step_size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5042 |
E1000_WRITE_REG(hw, AIT, hw->current_ifs_val); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5043 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5044 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5045 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5046 |
if(hw->in_ifs_mode && (hw->tx_packet_delta <= MIN_NUM_XMITS)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5047 |
hw->current_ifs_val = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5048 |
hw->in_ifs_mode = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5049 |
E1000_WRITE_REG(hw, AIT, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5050 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5051 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5052 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5053 |
DEBUGOUT("Not in Adaptive IFS mode!\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5054 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5055 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5056 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5057 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5058 |
* Adjusts the statistic counters when a frame is accepted by TBI_ACCEPT |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5059 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5060 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5061 |
* frame_len - The length of the frame in question |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5062 |
* mac_addr - The Ethernet destination address of the frame in question |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5063 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5064 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5065 |
e1000_tbi_adjust_stats(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5066 |
struct e1000_hw_stats *stats, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5067 |
uint32_t frame_len, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5068 |
uint8_t *mac_addr) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5069 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5070 |
uint64_t carry_bit; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5071 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5072 |
/* First adjust the frame length. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5073 |
frame_len--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5074 |
/* We need to adjust the statistics counters, since the hardware |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5075 |
* counters overcount this packet as a CRC error and undercount |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5076 |
* the packet as a good packet |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5077 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5078 |
/* This packet should not be counted as a CRC error. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5079 |
stats->crcerrs--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5080 |
/* This packet does count as a Good Packet Received. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5081 |
stats->gprc++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5082 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5083 |
/* Adjust the Good Octets received counters */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5084 |
carry_bit = 0x80000000 & stats->gorcl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5085 |
stats->gorcl += frame_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5086 |
/* If the high bit of Gorcl (the low 32 bits of the Good Octets |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5087 |
* Received Count) was one before the addition, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5088 |
* AND it is zero after, then we lost the carry out, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5089 |
* need to add one to Gorch (Good Octets Received Count High). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5090 |
* This could be simplified if all environments supported |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5091 |
* 64-bit integers. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5092 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5093 |
if(carry_bit && ((stats->gorcl & 0x80000000) == 0)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5094 |
stats->gorch++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5095 |
/* Is this a broadcast or multicast? Check broadcast first, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5096 |
* since the test for a multicast frame will test positive on |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5097 |
* a broadcast frame. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5098 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5099 |
if((mac_addr[0] == (uint8_t) 0xff) && (mac_addr[1] == (uint8_t) 0xff)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5100 |
/* Broadcast packet */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5101 |
stats->bprc++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5102 |
else if(*mac_addr & 0x01) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5103 |
/* Multicast packet */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5104 |
stats->mprc++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5105 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5106 |
if(frame_len == hw->max_frame_size) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5107 |
/* In this case, the hardware has overcounted the number of |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5108 |
* oversize frames. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5109 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5110 |
if(stats->roc > 0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5111 |
stats->roc--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5112 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5113 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5114 |
/* Adjust the bin counters when the extra byte put the frame in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5115 |
* wrong bin. Remember that the frame_len was adjusted above. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5116 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5117 |
if(frame_len == 64) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5118 |
stats->prc64++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5119 |
stats->prc127--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5120 |
} else if(frame_len == 127) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5121 |
stats->prc127++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5122 |
stats->prc255--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5123 |
} else if(frame_len == 255) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5124 |
stats->prc255++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5125 |
stats->prc511--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5126 |
} else if(frame_len == 511) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5127 |
stats->prc511++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5128 |
stats->prc1023--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5129 |
} else if(frame_len == 1023) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5130 |
stats->prc1023++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5131 |
stats->prc1522--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5132 |
} else if(frame_len == 1522) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5133 |
stats->prc1522++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5134 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5135 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5136 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5137 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5138 |
* Gets the current PCI bus type, speed, and width of the hardware |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5139 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5140 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5141 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5142 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5143 |
e1000_get_bus_info(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5144 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5145 |
uint32_t status; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5146 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5147 |
switch (hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5148 |
case e1000_82542_rev2_0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5149 |
case e1000_82542_rev2_1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5150 |
hw->bus_type = e1000_bus_type_unknown; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5151 |
hw->bus_speed = e1000_bus_speed_unknown; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5152 |
hw->bus_width = e1000_bus_width_unknown; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5153 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5154 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5155 |
hw->bus_type = e1000_bus_type_pci_express; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5156 |
hw->bus_speed = e1000_bus_speed_2500; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5157 |
hw->bus_width = e1000_bus_width_pciex_4; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5158 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5159 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5160 |
status = E1000_READ_REG(hw, STATUS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5161 |
hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5162 |
e1000_bus_type_pcix : e1000_bus_type_pci; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5163 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5164 |
if(hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5165 |
hw->bus_speed = (hw->bus_type == e1000_bus_type_pci) ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5166 |
e1000_bus_speed_66 : e1000_bus_speed_120; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5167 |
} else if(hw->bus_type == e1000_bus_type_pci) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5168 |
hw->bus_speed = (status & E1000_STATUS_PCI66) ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5169 |
e1000_bus_speed_66 : e1000_bus_speed_33; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5170 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5171 |
switch (status & E1000_STATUS_PCIX_SPEED) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5172 |
case E1000_STATUS_PCIX_SPEED_66: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5173 |
hw->bus_speed = e1000_bus_speed_66; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5174 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5175 |
case E1000_STATUS_PCIX_SPEED_100: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5176 |
hw->bus_speed = e1000_bus_speed_100; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5177 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5178 |
case E1000_STATUS_PCIX_SPEED_133: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5179 |
hw->bus_speed = e1000_bus_speed_133; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5180 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5181 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5182 |
hw->bus_speed = e1000_bus_speed_reserved; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5183 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5184 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5185 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5186 |
hw->bus_width = (status & E1000_STATUS_BUS64) ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5187 |
e1000_bus_width_64 : e1000_bus_width_32; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5188 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5189 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5190 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5191 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5192 |
* Reads a value from one of the devices registers using port I/O (as opposed |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5193 |
* memory mapped I/O). Only 82544 and newer devices support port I/O. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5194 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5195 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5196 |
* offset - offset to read from |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5197 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5198 |
uint32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5199 |
e1000_read_reg_io(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5200 |
uint32_t offset) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5201 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5202 |
unsigned long io_addr = hw->io_base; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5203 |
unsigned long io_data = hw->io_base + 4; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5204 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5205 |
e1000_io_write(hw, io_addr, offset); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5206 |
return e1000_io_read(hw, io_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5207 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5208 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5209 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5210 |
* Writes a value to one of the devices registers using port I/O (as opposed to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5211 |
* memory mapped I/O). Only 82544 and newer devices support port I/O. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5212 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5213 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5214 |
* offset - offset to write to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5215 |
* value - value to write |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5216 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5217 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5218 |
e1000_write_reg_io(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5219 |
uint32_t offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5220 |
uint32_t value) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5221 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5222 |
unsigned long io_addr = hw->io_base; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5223 |
unsigned long io_data = hw->io_base + 4; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5224 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5225 |
e1000_io_write(hw, io_addr, offset); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5226 |
e1000_io_write(hw, io_data, value); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5227 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5228 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5229 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5230 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5231 |
* Estimates the cable length. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5232 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5233 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5234 |
* min_length - The estimated minimum length |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5235 |
* max_length - The estimated maximum length |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5236 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5237 |
* returns: - E1000_ERR_XXX |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5238 |
* E1000_SUCCESS |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5239 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5240 |
* This function always returns a ranged length (minimum & maximum). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5241 |
* So for M88 phy's, this function interprets the one value returned from the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5242 |
* register to the minimum and maximum range. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5243 |
* For IGP phy's, the function calculates the range by the AGC registers. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5244 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5245 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5246 |
e1000_get_cable_length(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5247 |
uint16_t *min_length, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5248 |
uint16_t *max_length) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5249 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5250 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5251 |
uint16_t agc_value = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5252 |
uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5253 |
uint16_t i, phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5254 |
uint16_t cable_length; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5255 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5256 |
DEBUGFUNC("e1000_get_cable_length"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5257 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5258 |
*min_length = *max_length = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5259 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5260 |
/* Use old method for Phy older than IGP */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5261 |
if(hw->phy_type == e1000_phy_m88) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5262 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5263 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5264 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5265 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5266 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5267 |
cable_length = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5268 |
M88E1000_PSSR_CABLE_LENGTH_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5269 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5270 |
/* Convert the enum value to ranged values */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5271 |
switch (cable_length) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5272 |
case e1000_cable_length_50: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5273 |
*min_length = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5274 |
*max_length = e1000_igp_cable_length_50; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5275 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5276 |
case e1000_cable_length_50_80: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5277 |
*min_length = e1000_igp_cable_length_50; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5278 |
*max_length = e1000_igp_cable_length_80; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5279 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5280 |
case e1000_cable_length_80_110: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5281 |
*min_length = e1000_igp_cable_length_80; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5282 |
*max_length = e1000_igp_cable_length_110; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5283 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5284 |
case e1000_cable_length_110_140: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5285 |
*min_length = e1000_igp_cable_length_110; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5286 |
*max_length = e1000_igp_cable_length_140; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5287 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5288 |
case e1000_cable_length_140: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5289 |
*min_length = e1000_igp_cable_length_140; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5290 |
*max_length = e1000_igp_cable_length_170; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5291 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5292 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5293 |
return -E1000_ERR_PHY; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5294 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5295 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5296 |
} else if(hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5297 |
uint16_t agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5298 |
{IGP01E1000_PHY_AGC_A, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5299 |
IGP01E1000_PHY_AGC_B, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5300 |
IGP01E1000_PHY_AGC_C, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5301 |
IGP01E1000_PHY_AGC_D}; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5302 |
/* Read the AGC registers for all channels */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5303 |
for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5304 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5305 |
ret_val = e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5306 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5307 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5308 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5309 |
cur_agc = phy_data >> IGP01E1000_AGC_LENGTH_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5310 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5311 |
/* Array bound check. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5312 |
if((cur_agc >= IGP01E1000_AGC_LENGTH_TABLE_SIZE - 1) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5313 |
(cur_agc == 0)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5314 |
return -E1000_ERR_PHY; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5315 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5316 |
agc_value += cur_agc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5317 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5318 |
/* Update minimal AGC value. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5319 |
if(min_agc > cur_agc) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5320 |
min_agc = cur_agc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5321 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5322 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5323 |
/* Remove the minimal AGC result for length < 50m */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5324 |
if(agc_value < IGP01E1000_PHY_CHANNEL_NUM * e1000_igp_cable_length_50) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5325 |
agc_value -= min_agc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5326 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5327 |
/* Get the average length of the remaining 3 channels */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5328 |
agc_value /= (IGP01E1000_PHY_CHANNEL_NUM - 1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5329 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5330 |
/* Get the average length of all the 4 channels. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5331 |
agc_value /= IGP01E1000_PHY_CHANNEL_NUM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5332 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5333 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5334 |
/* Set the range of the calculated length. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5335 |
*min_length = ((e1000_igp_cable_length_table[agc_value] - |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5336 |
IGP01E1000_AGC_RANGE) > 0) ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5337 |
(e1000_igp_cable_length_table[agc_value] - |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5338 |
IGP01E1000_AGC_RANGE) : 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5339 |
*max_length = e1000_igp_cable_length_table[agc_value] + |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5340 |
IGP01E1000_AGC_RANGE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5341 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5342 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5343 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5344 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5345 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5346 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5347 |
* Check the cable polarity |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5348 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5349 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5350 |
* polarity - output parameter : 0 - Polarity is not reversed |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5351 |
* 1 - Polarity is reversed. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5352 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5353 |
* returns: - E1000_ERR_XXX |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5354 |
* E1000_SUCCESS |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5355 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5356 |
* For phy's older then IGP, this function simply reads the polarity bit in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5357 |
* Phy Status register. For IGP phy's, this bit is valid only if link speed is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5358 |
* 10 Mbps. If the link speed is 100 Mbps there is no polarity so this bit will |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5359 |
* return 0. If the link speed is 1000 Mbps the polarity status is in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5360 |
* IGP01E1000_PHY_PCS_INIT_REG. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5361 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5362 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5363 |
e1000_check_polarity(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5364 |
uint16_t *polarity) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5365 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5366 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5367 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5368 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5369 |
DEBUGFUNC("e1000_check_polarity"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5370 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5371 |
if(hw->phy_type == e1000_phy_m88) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5372 |
/* return the Polarity bit in the Status register. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5373 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5374 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5375 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5376 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5377 |
*polarity = (phy_data & M88E1000_PSSR_REV_POLARITY) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5378 |
M88E1000_PSSR_REV_POLARITY_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5379 |
} else if(hw->phy_type == e1000_phy_igp || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5380 |
hw->phy_type == e1000_phy_igp_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5381 |
/* Read the Status register to check the speed */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5382 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5383 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5384 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5385 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5386 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5387 |
/* If speed is 1000 Mbps, must read the IGP01E1000_PHY_PCS_INIT_REG to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5388 |
* find the polarity status */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5389 |
if((phy_data & IGP01E1000_PSSR_SPEED_MASK) == |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5390 |
IGP01E1000_PSSR_SPEED_1000MBPS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5391 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5392 |
/* Read the GIG initialization PCS register (0x00B4) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5393 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5394 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5395 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5396 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5397 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5398 |
/* Check the polarity bits */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5399 |
*polarity = (phy_data & IGP01E1000_PHY_POLARITY_MASK) ? 1 : 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5400 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5401 |
/* For 10 Mbps, read the polarity bit in the status register. (for |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5402 |
* 100 Mbps this bit is always 0) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5403 |
*polarity = phy_data & IGP01E1000_PSSR_POLARITY_REVERSED; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5404 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5405 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5406 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5407 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5408 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5409 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5410 |
* Check if Downshift occured |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5411 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5412 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5413 |
* downshift - output parameter : 0 - No Downshift ocured. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5414 |
* 1 - Downshift ocured. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5415 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5416 |
* returns: - E1000_ERR_XXX |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5417 |
* E1000_SUCCESS |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5418 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5419 |
* For phy's older then IGP, this function reads the Downshift bit in the Phy |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5420 |
* Specific Status register. For IGP phy's, it reads the Downgrade bit in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5421 |
* Link Health register. In IGP this bit is latched high, so the driver must |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5422 |
* read it immediately after link is established. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5423 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5424 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5425 |
e1000_check_downshift(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5426 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5427 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5428 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5429 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5430 |
DEBUGFUNC("e1000_check_downshift"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5431 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5432 |
if(hw->phy_type == e1000_phy_igp || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5433 |
hw->phy_type == e1000_phy_igp_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5434 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5435 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5436 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5437 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5438 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5439 |
hw->speed_downgraded = (phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5440 |
} else if(hw->phy_type == e1000_phy_m88) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5441 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5442 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5443 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5444 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5445 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5446 |
hw->speed_downgraded = (phy_data & M88E1000_PSSR_DOWNSHIFT) >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5447 |
M88E1000_PSSR_DOWNSHIFT_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5448 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5449 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5450 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5451 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5452 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5453 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5454 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5455 |
* 82541_rev_2 & 82547_rev_2 have the capability to configure the DSP when a |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5456 |
* gigabit link is achieved to improve link quality. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5457 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5458 |
* hw: Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5459 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5460 |
* returns: - E1000_ERR_PHY if fail to read/write the PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5461 |
* E1000_SUCCESS at any other case. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5462 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5463 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5464 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5465 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5466 |
e1000_config_dsp_after_link_change(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5467 |
boolean_t link_up) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5468 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5469 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5470 |
uint16_t phy_data, phy_saved_data, speed, duplex, i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5471 |
uint16_t dsp_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5472 |
{IGP01E1000_PHY_AGC_PARAM_A, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5473 |
IGP01E1000_PHY_AGC_PARAM_B, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5474 |
IGP01E1000_PHY_AGC_PARAM_C, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5475 |
IGP01E1000_PHY_AGC_PARAM_D}; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5476 |
uint16_t min_length, max_length; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5477 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5478 |
DEBUGFUNC("e1000_config_dsp_after_link_change"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5479 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5480 |
if(hw->phy_type != e1000_phy_igp) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5481 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5482 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5483 |
if(link_up) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5484 |
ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5485 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5486 |
DEBUGOUT("Error getting link speed and duplex\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5487 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5488 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5489 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5490 |
if(speed == SPEED_1000) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5491 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5492 |
e1000_get_cable_length(hw, &min_length, &max_length); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5493 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5494 |
if((hw->dsp_config_state == e1000_dsp_config_enabled) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5495 |
min_length >= e1000_igp_cable_length_50) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5496 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5497 |
for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5498 |
ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5499 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5500 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5501 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5502 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5503 |
phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5504 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5505 |
ret_val = e1000_write_phy_reg(hw, dsp_reg_array[i], |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5506 |
phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5507 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5508 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5509 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5510 |
hw->dsp_config_state = e1000_dsp_config_activated; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5511 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5512 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5513 |
if((hw->ffe_config_state == e1000_ffe_config_enabled) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5514 |
(min_length < e1000_igp_cable_length_50)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5515 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5516 |
uint16_t ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_20; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5517 |
uint32_t idle_errs = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5518 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5519 |
/* clear previous idle error counts */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5520 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5521 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5522 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5523 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5524 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5525 |
for(i = 0; i < ffe_idle_err_timeout; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5526 |
udelay(1000); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5527 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5528 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5529 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5530 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5531 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5532 |
idle_errs += (phy_data & SR_1000T_IDLE_ERROR_CNT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5533 |
if(idle_errs > SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5534 |
hw->ffe_config_state = e1000_ffe_config_active; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5535 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5536 |
ret_val = e1000_write_phy_reg(hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5537 |
IGP01E1000_PHY_DSP_FFE, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5538 |
IGP01E1000_PHY_DSP_FFE_CM_CP); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5539 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5540 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5541 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5542 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5543 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5544 |
if(idle_errs) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5545 |
ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_100; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5546 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5547 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5548 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5549 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5550 |
if(hw->dsp_config_state == e1000_dsp_config_activated) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5551 |
/* Save off the current value of register 0x2F5B to be restored at |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5552 |
* the end of the routines. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5553 |
ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5554 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5555 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5556 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5557 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5558 |
/* Disable the PHY transmitter */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5559 |
ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5560 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5561 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5562 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5563 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5564 |
msec_delay_irq(20); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5565 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5566 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5567 |
IGP01E1000_IEEE_FORCE_GIGA); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5568 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5569 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5570 |
for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5571 |
ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5572 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5573 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5574 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5575 |
phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5576 |
phy_data |= IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5577 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5578 |
ret_val = e1000_write_phy_reg(hw,dsp_reg_array[i], phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5579 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5580 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5581 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5582 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5583 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5584 |
IGP01E1000_IEEE_RESTART_AUTONEG); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5585 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5586 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5587 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5588 |
msec_delay_irq(20); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5589 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5590 |
/* Now enable the transmitter */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5591 |
ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5592 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5593 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5594 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5595 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5596 |
hw->dsp_config_state = e1000_dsp_config_enabled; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5597 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5598 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5599 |
if(hw->ffe_config_state == e1000_ffe_config_active) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5600 |
/* Save off the current value of register 0x2F5B to be restored at |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5601 |
* the end of the routines. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5602 |
ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5603 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5604 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5605 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5606 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5607 |
/* Disable the PHY transmitter */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5608 |
ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5609 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5610 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5611 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5612 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5613 |
msec_delay_irq(20); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5614 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5615 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5616 |
IGP01E1000_IEEE_FORCE_GIGA); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5617 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5618 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5619 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_DSP_FFE, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5620 |
IGP01E1000_PHY_DSP_FFE_DEFAULT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5621 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5622 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5623 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5624 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5625 |
IGP01E1000_IEEE_RESTART_AUTONEG); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5626 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5627 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5628 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5629 |
msec_delay_irq(20); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5630 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5631 |
/* Now enable the transmitter */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5632 |
ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5633 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5634 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5635 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5636 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5637 |
hw->ffe_config_state = e1000_ffe_config_enabled; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5638 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5639 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5640 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5641 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5642 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5643 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5644 |
* Set PHY to class A mode |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5645 |
* Assumes the following operations will follow to enable the new class mode. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5646 |
* 1. Do a PHY soft reset |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5647 |
* 2. Restart auto-negotiation or force link. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5648 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5649 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5650 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5651 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5652 |
e1000_set_phy_mode(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5653 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5654 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5655 |
uint16_t eeprom_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5656 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5657 |
DEBUGFUNC("e1000_set_phy_mode"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5658 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5659 |
if((hw->mac_type == e1000_82545_rev_3) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5660 |
(hw->media_type == e1000_media_type_copper)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5661 |
ret_val = e1000_read_eeprom(hw, EEPROM_PHY_CLASS_WORD, 1, &eeprom_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5662 |
if(ret_val) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5663 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5664 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5665 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5666 |
if((eeprom_data != EEPROM_RESERVED_WORD) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5667 |
(eeprom_data & EEPROM_PHY_CLASS_A)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5668 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x000B); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5669 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5670 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5671 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x8104); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5672 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5673 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5674 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5675 |
hw->phy_reset_disable = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5676 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5677 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5678 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5679 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5680 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5681 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5682 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5683 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5684 |
* This function sets the lplu state according to the active flag. When |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5685 |
* activating lplu this function also disables smart speed and vise versa. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5686 |
* lplu will not be activated unless the device autonegotiation advertisment |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5687 |
* meets standards of either 10 or 10/100 or 10/100/1000 at all duplexes. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5688 |
* hw: Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5689 |
* active - true to enable lplu false to disable lplu. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5690 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5691 |
* returns: - E1000_ERR_PHY if fail to read/write the PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5692 |
* E1000_SUCCESS at any other case. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5693 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5694 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5695 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5696 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5697 |
e1000_set_d3_lplu_state(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5698 |
boolean_t active) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5699 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5700 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5701 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5702 |
DEBUGFUNC("e1000_set_d3_lplu_state"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5703 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5704 |
if(hw->phy_type != e1000_phy_igp && hw->phy_type != e1000_phy_igp_2) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5705 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5706 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5707 |
/* During driver activity LPLU should not be used or it will attain link |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5708 |
* from the lowest speeds starting from 10Mbps. The capability is used for |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5709 |
* Dx transitions and states */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5710 |
if(hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5711 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5712 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5713 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5714 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5715 |
ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5716 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5717 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5718 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5719 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5720 |
if(!active) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5721 |
if(hw->mac_type == e1000_82541_rev_2 || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5722 |
hw->mac_type == e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5723 |
phy_data &= ~IGP01E1000_GMII_FLEX_SPD; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5724 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5725 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5726 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5727 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5728 |
phy_data &= ~IGP02E1000_PM_D3_LPLU; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5729 |
ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5730 |
phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5731 |
if (ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5732 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5733 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5734 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5735 |
/* LPLU and SmartSpeed are mutually exclusive. LPLU is used during |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5736 |
* Dx states where the power conservation is most important. During |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5737 |
* driver activity we should enable SmartSpeed, so performance is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5738 |
* maintained. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5739 |
if (hw->smart_speed == e1000_smart_speed_on) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5740 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5741 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5742 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5743 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5744 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5745 |
phy_data |= IGP01E1000_PSCFR_SMART_SPEED; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5746 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5747 |
phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5748 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5749 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5750 |
} else if (hw->smart_speed == e1000_smart_speed_off) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5751 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5752 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5753 |
if (ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5754 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5755 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5756 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5757 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5758 |
phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5759 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5760 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5761 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5762 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5763 |
} else if((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5764 |
(hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL ) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5765 |
(hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5766 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5767 |
if(hw->mac_type == e1000_82541_rev_2 || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5768 |
hw->mac_type == e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5769 |
phy_data |= IGP01E1000_GMII_FLEX_SPD; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5770 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5771 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5772 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5773 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5774 |
phy_data |= IGP02E1000_PM_D3_LPLU; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5775 |
ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5776 |
phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5777 |
if (ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5778 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5779 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5780 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5781 |
/* When LPLU is enabled we should disable SmartSpeed */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5782 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5783 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5784 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5785 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5786 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5787 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5788 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5789 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5790 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5791 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5792 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5793 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5794 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5795 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5796 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5797 |
* This function sets the lplu d0 state according to the active flag. When |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5798 |
* activating lplu this function also disables smart speed and vise versa. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5799 |
* lplu will not be activated unless the device autonegotiation advertisment |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5800 |
* meets standards of either 10 or 10/100 or 10/100/1000 at all duplexes. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5801 |
* hw: Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5802 |
* active - true to enable lplu false to disable lplu. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5803 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5804 |
* returns: - E1000_ERR_PHY if fail to read/write the PHY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5805 |
* E1000_SUCCESS at any other case. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5806 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5807 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5808 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5809 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5810 |
e1000_set_d0_lplu_state(struct e1000_hw *hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5811 |
boolean_t active) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5812 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5813 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5814 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5815 |
DEBUGFUNC("e1000_set_d0_lplu_state"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5816 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5817 |
if(hw->mac_type <= e1000_82547_rev_2) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5818 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5819 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5820 |
ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5821 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5822 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5823 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5824 |
if (!active) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5825 |
phy_data &= ~IGP02E1000_PM_D0_LPLU; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5826 |
ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5827 |
if (ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5828 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5829 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5830 |
/* LPLU and SmartSpeed are mutually exclusive. LPLU is used during |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5831 |
* Dx states where the power conservation is most important. During |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5832 |
* driver activity we should enable SmartSpeed, so performance is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5833 |
* maintained. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5834 |
if (hw->smart_speed == e1000_smart_speed_on) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5835 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5836 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5837 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5838 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5839 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5840 |
phy_data |= IGP01E1000_PSCFR_SMART_SPEED; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5841 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5842 |
phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5843 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5844 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5845 |
} else if (hw->smart_speed == e1000_smart_speed_off) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5846 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5847 |
&phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5848 |
if (ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5849 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5850 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5851 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5852 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5853 |
phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5854 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5855 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5856 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5857 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5858 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5859 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5860 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5861 |
phy_data |= IGP02E1000_PM_D0_LPLU; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5862 |
ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5863 |
if (ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5864 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5865 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5866 |
/* When LPLU is enabled we should disable SmartSpeed */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5867 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5868 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5869 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5870 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5871 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5872 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5873 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5874 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5875 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5876 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5877 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5878 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5879 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5880 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5881 |
* Change VCO speed register to improve Bit Error Rate performance of SERDES. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5882 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5883 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5884 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5885 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5886 |
e1000_set_vco_speed(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5887 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5888 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5889 |
uint16_t default_page = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5890 |
uint16_t phy_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5891 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5892 |
DEBUGFUNC("e1000_set_vco_speed"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5893 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5894 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5895 |
case e1000_82545_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5896 |
case e1000_82546_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5897 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5898 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5899 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5900 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5901 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5902 |
/* Set PHY register 30, page 5, bit 8 to 0 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5903 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5904 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, &default_page); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5905 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5906 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5907 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5908 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5909 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5910 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5911 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5912 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5913 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5914 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5915 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5916 |
phy_data &= ~M88E1000_PHY_VCO_REG_BIT8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5917 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5918 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5919 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5920 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5921 |
/* Set PHY register 30, page 4, bit 11 to 1 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5922 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5923 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5924 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5925 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5926 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5927 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5928 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5929 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5930 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5931 |
phy_data |= M88E1000_PHY_VCO_REG_BIT11; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5932 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5933 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5934 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5935 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5936 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, default_page); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5937 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5938 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5939 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5940 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5941 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5942 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5943 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5944 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5945 |
* This function reads the cookie from ARC ram. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5946 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5947 |
* returns: - E1000_SUCCESS . |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5948 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5949 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5950 |
e1000_host_if_read_cookie(struct e1000_hw * hw, uint8_t *buffer) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5951 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5952 |
uint8_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5953 |
uint32_t offset = E1000_MNG_DHCP_COOKIE_OFFSET; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5954 |
uint8_t length = E1000_MNG_DHCP_COOKIE_LENGTH; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5955 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5956 |
length = (length >> 2); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5957 |
offset = (offset >> 2); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5958 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5959 |
for (i = 0; i < length; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5960 |
*((uint32_t *) buffer + i) = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5961 |
E1000_READ_REG_ARRAY_DWORD(hw, HOST_IF, offset + i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5962 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5963 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5964 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5965 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5966 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5967 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5968 |
* This function checks whether the HOST IF is enabled for command operaton |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5969 |
* and also checks whether the previous command is completed. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5970 |
* It busy waits in case of previous command is not completed. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5971 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5972 |
* returns: - E1000_ERR_HOST_INTERFACE_COMMAND in case if is not ready or |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5973 |
* timeout |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5974 |
* - E1000_SUCCESS for success. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5975 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5976 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5977 |
e1000_mng_enable_host_if(struct e1000_hw * hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5978 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5979 |
uint32_t hicr; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5980 |
uint8_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5981 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5982 |
/* Check that the host interface is enabled. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5983 |
hicr = E1000_READ_REG(hw, HICR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5984 |
if ((hicr & E1000_HICR_EN) == 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5985 |
DEBUGOUT("E1000_HOST_EN bit disabled.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5986 |
return -E1000_ERR_HOST_INTERFACE_COMMAND; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5987 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5988 |
/* check the previous command is completed */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5989 |
for (i = 0; i < E1000_MNG_DHCP_COMMAND_TIMEOUT; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5990 |
hicr = E1000_READ_REG(hw, HICR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5991 |
if (!(hicr & E1000_HICR_C)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5992 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5993 |
msec_delay_irq(1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5994 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5995 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5996 |
if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5997 |
DEBUGOUT("Previous command timeout failed .\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5998 |
return -E1000_ERR_HOST_INTERFACE_COMMAND; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5999 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6000 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6001 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6002 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6003 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6004 |
* This function writes the buffer content at the offset given on the host if. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6005 |
* It also does alignment considerations to do the writes in most efficient way. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6006 |
* Also fills up the sum of the buffer in *buffer parameter. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6007 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6008 |
* returns - E1000_SUCCESS for success. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6009 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6010 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6011 |
e1000_mng_host_if_write(struct e1000_hw * hw, uint8_t *buffer, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6012 |
uint16_t length, uint16_t offset, uint8_t *sum) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6013 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6014 |
uint8_t *tmp; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6015 |
uint8_t *bufptr = buffer; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6016 |
uint32_t data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6017 |
uint16_t remaining, i, j, prev_bytes; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6018 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6019 |
/* sum = only sum of the data and it is not checksum */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6020 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6021 |
if (length == 0 || offset + length > E1000_HI_MAX_MNG_DATA_LENGTH) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6022 |
return -E1000_ERR_PARAM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6023 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6024 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6025 |
tmp = (uint8_t *)&data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6026 |
prev_bytes = offset & 0x3; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6027 |
offset &= 0xFFFC; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6028 |
offset >>= 2; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6029 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6030 |
if (prev_bytes) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6031 |
data = E1000_READ_REG_ARRAY_DWORD(hw, HOST_IF, offset); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6032 |
for (j = prev_bytes; j < sizeof(uint32_t); j++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6033 |
*(tmp + j) = *bufptr++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6034 |
*sum += *(tmp + j); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6035 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6036 |
E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, offset, data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6037 |
length -= j - prev_bytes; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6038 |
offset++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6039 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6040 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6041 |
remaining = length & 0x3; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6042 |
length -= remaining; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6043 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6044 |
/* Calculate length in DWORDs */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6045 |
length >>= 2; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6046 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6047 |
/* The device driver writes the relevant command block into the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6048 |
* ram area. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6049 |
for (i = 0; i < length; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6050 |
for (j = 0; j < sizeof(uint32_t); j++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6051 |
*(tmp + j) = *bufptr++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6052 |
*sum += *(tmp + j); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6053 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6054 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6055 |
E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, offset + i, data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6056 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6057 |
if (remaining) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6058 |
for (j = 0; j < sizeof(uint32_t); j++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6059 |
if (j < remaining) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6060 |
*(tmp + j) = *bufptr++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6061 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6062 |
*(tmp + j) = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6063 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6064 |
*sum += *(tmp + j); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6065 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6066 |
E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, offset + i, data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6067 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6068 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6069 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6070 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6071 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6072 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6073 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6074 |
* This function writes the command header after does the checksum calculation. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6075 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6076 |
* returns - E1000_SUCCESS for success. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6077 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6078 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6079 |
e1000_mng_write_cmd_header(struct e1000_hw * hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6080 |
struct e1000_host_mng_command_header * hdr) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6081 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6082 |
uint16_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6083 |
uint8_t sum; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6084 |
uint8_t *buffer; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6085 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6086 |
/* Write the whole command header structure which includes sum of |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6087 |
* the buffer */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6088 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6089 |
uint16_t length = sizeof(struct e1000_host_mng_command_header); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6090 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6091 |
sum = hdr->checksum; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6092 |
hdr->checksum = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6093 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6094 |
buffer = (uint8_t *) hdr; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6095 |
i = length; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6096 |
while(i--) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6097 |
sum += buffer[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6098 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6099 |
hdr->checksum = 0 - sum; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6100 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6101 |
length >>= 2; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6102 |
/* The device driver writes the relevant command block into the ram area. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6103 |
for (i = 0; i < length; i++) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6104 |
E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, i, *((uint32_t *) hdr + i)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6105 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6106 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6107 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6108 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6109 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6110 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6111 |
* This function indicates to ARC that a new command is pending which completes |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6112 |
* one write operation by the driver. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6113 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6114 |
* returns - E1000_SUCCESS for success. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6115 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6116 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6117 |
e1000_mng_write_commit( |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6118 |
struct e1000_hw * hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6119 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6120 |
uint32_t hicr; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6121 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6122 |
hicr = E1000_READ_REG(hw, HICR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6123 |
/* Setting this bit tells the ARC that a new command is pending. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6124 |
E1000_WRITE_REG(hw, HICR, hicr | E1000_HICR_C); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6125 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6126 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6127 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6128 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6129 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6130 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6131 |
* This function checks the mode of the firmware. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6132 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6133 |
* returns - TRUE when the mode is IAMT or FALSE. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6134 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6135 |
boolean_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6136 |
e1000_check_mng_mode( |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6137 |
struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6138 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6139 |
uint32_t fwsm; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6140 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6141 |
fwsm = E1000_READ_REG(hw, FWSM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6142 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6143 |
if((fwsm & E1000_FWSM_MODE_MASK) == |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6144 |
(E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6145 |
return TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6146 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6147 |
return FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6148 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6149 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6150 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6151 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6152 |
* This function writes the dhcp info . |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6153 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6154 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6155 |
e1000_mng_write_dhcp_info(struct e1000_hw * hw, uint8_t *buffer, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6156 |
uint16_t length) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6157 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6158 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6159 |
struct e1000_host_mng_command_header hdr; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6160 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6161 |
hdr.command_id = E1000_MNG_DHCP_TX_PAYLOAD_CMD; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6162 |
hdr.command_length = length; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6163 |
hdr.reserved1 = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6164 |
hdr.reserved2 = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6165 |
hdr.checksum = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6166 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6167 |
ret_val = e1000_mng_enable_host_if(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6168 |
if (ret_val == E1000_SUCCESS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6169 |
ret_val = e1000_mng_host_if_write(hw, buffer, length, sizeof(hdr), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6170 |
&(hdr.checksum)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6171 |
if (ret_val == E1000_SUCCESS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6172 |
ret_val = e1000_mng_write_cmd_header(hw, &hdr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6173 |
if (ret_val == E1000_SUCCESS) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6174 |
ret_val = e1000_mng_write_commit(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6175 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6176 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6177 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6178 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6179 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6180 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6181 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6182 |
* This function calculates the checksum. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6183 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6184 |
* returns - checksum of buffer contents. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6185 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6186 |
uint8_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6187 |
e1000_calculate_mng_checksum(char *buffer, uint32_t length) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6188 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6189 |
uint8_t sum = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6190 |
uint32_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6191 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6192 |
if (!buffer) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6193 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6194 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6195 |
for (i=0; i < length; i++) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6196 |
sum += buffer[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6197 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6198 |
return (uint8_t) (0 - sum); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6199 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6200 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6201 |
/***************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6202 |
* This function checks whether tx pkt filtering needs to be enabled or not. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6203 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6204 |
* returns - TRUE for packet filtering or FALSE. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6205 |
****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6206 |
boolean_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6207 |
e1000_enable_tx_pkt_filtering(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6208 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6209 |
/* called in init as well as watchdog timer functions */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6210 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6211 |
int32_t ret_val, checksum; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6212 |
boolean_t tx_filter = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6213 |
struct e1000_host_mng_dhcp_cookie *hdr = &(hw->mng_cookie); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6214 |
uint8_t *buffer = (uint8_t *) &(hw->mng_cookie); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6215 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6216 |
if (e1000_check_mng_mode(hw)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6217 |
ret_val = e1000_mng_enable_host_if(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6218 |
if (ret_val == E1000_SUCCESS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6219 |
ret_val = e1000_host_if_read_cookie(hw, buffer); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6220 |
if (ret_val == E1000_SUCCESS) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6221 |
checksum = hdr->checksum; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6222 |
hdr->checksum = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6223 |
if ((hdr->signature == E1000_IAMT_SIGNATURE) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6224 |
checksum == e1000_calculate_mng_checksum((char *)buffer, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6225 |
E1000_MNG_DHCP_COOKIE_LENGTH)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6226 |
if (hdr->status & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6227 |
E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6228 |
tx_filter = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6229 |
} else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6230 |
tx_filter = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6231 |
} else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6232 |
tx_filter = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6233 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6234 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6235 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6236 |
hw->tx_pkt_filtering = tx_filter; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6237 |
return tx_filter; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6238 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6239 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6240 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6241 |
* Verifies the hardware needs to allow ARPs to be processed by the host |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6242 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6243 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6244 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6245 |
* returns: - TRUE/FALSE |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6246 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6247 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6248 |
uint32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6249 |
e1000_enable_mng_pass_thru(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6250 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6251 |
uint32_t manc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6252 |
uint32_t fwsm, factps; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6253 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6254 |
if (hw->asf_firmware_present) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6255 |
manc = E1000_READ_REG(hw, MANC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6256 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6257 |
if (!(manc & E1000_MANC_RCV_TCO_EN) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6258 |
!(manc & E1000_MANC_EN_MAC_ADDR_FILTER)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6259 |
return FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6260 |
if (e1000_arc_subsystem_valid(hw) == TRUE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6261 |
fwsm = E1000_READ_REG(hw, FWSM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6262 |
factps = E1000_READ_REG(hw, FACTPS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6263 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6264 |
if (((fwsm & E1000_FWSM_MODE_MASK) == |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6265 |
(e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT)) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6266 |
(factps & E1000_FACTPS_MNGCG)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6267 |
return TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6268 |
} else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6269 |
if ((manc & E1000_MANC_SMBUS_EN) && !(manc & E1000_MANC_ASF_EN)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6270 |
return TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6271 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6272 |
return FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6273 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6274 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6275 |
static int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6276 |
e1000_polarity_reversal_workaround(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6277 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6278 |
int32_t ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6279 |
uint16_t mii_status_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6280 |
uint16_t i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6281 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6282 |
/* Polarity reversal workaround for forced 10F/10H links. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6283 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6284 |
/* Disable the transmitter on the PHY */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6285 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6286 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6287 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6288 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6289 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFFF); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6290 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6291 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6292 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6293 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6294 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6295 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6296 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6297 |
/* This loop will early-out if the NO link condition has been met. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6298 |
for(i = PHY_FORCE_TIME; i > 0; i--) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6299 |
/* Read the MII Status Register and wait for Link Status bit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6300 |
* to be clear. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6301 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6302 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6303 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6304 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6305 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6306 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6307 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6308 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6309 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6310 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6311 |
if((mii_status_reg & ~MII_SR_LINK_STATUS) == 0) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6312 |
msec_delay_irq(100); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6313 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6314 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6315 |
/* Recommended delay time after link has been lost */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6316 |
msec_delay_irq(1000); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6317 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6318 |
/* Now we will re-enable th transmitter on the PHY */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6319 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6320 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6321 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6322 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6323 |
msec_delay_irq(50); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6324 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFF0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6325 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6326 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6327 |
msec_delay_irq(50); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6328 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFF00); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6329 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6330 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6331 |
msec_delay_irq(50); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6332 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x0000); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6333 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6334 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6335 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6336 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6337 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6338 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6339 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6340 |
/* This loop will early-out if the link condition has been met. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6341 |
for(i = PHY_FORCE_TIME; i > 0; i--) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6342 |
/* Read the MII Status Register and wait for Link Status bit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6343 |
* to be set. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6344 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6345 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6346 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6347 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6348 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6349 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6350 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6351 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6352 |
return ret_val; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6353 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6354 |
if(mii_status_reg & MII_SR_LINK_STATUS) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6355 |
msec_delay_irq(100); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6356 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6357 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6358 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6359 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6360 |
/*************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6361 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6362 |
* Disables PCI-Express master access. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6363 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6364 |
* hw: Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6365 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6366 |
* returns: - none. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6367 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6368 |
***************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6369 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6370 |
e1000_set_pci_express_master_disable(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6371 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6372 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6373 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6374 |
DEBUGFUNC("e1000_set_pci_express_master_disable"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6375 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6376 |
if (hw->bus_type != e1000_bus_type_pci_express) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6377 |
return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6378 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6379 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6380 |
ctrl |= E1000_CTRL_GIO_MASTER_DISABLE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6381 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6382 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6383 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6384 |
/*************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6385 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6386 |
* Enables PCI-Express master access. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6387 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6388 |
* hw: Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6389 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6390 |
* returns: - none. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6391 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6392 |
***************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6393 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6394 |
e1000_enable_pciex_master(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6395 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6396 |
uint32_t ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6397 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6398 |
DEBUGFUNC("e1000_enable_pciex_master"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6399 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6400 |
if (hw->bus_type != e1000_bus_type_pci_express) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6401 |
return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6402 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6403 |
ctrl = E1000_READ_REG(hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6404 |
ctrl &= ~E1000_CTRL_GIO_MASTER_DISABLE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6405 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6406 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6407 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6408 |
/******************************************************************************* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6409 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6410 |
* Disables PCI-Express master access and verifies there are no pending requests |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6411 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6412 |
* hw: Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6413 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6414 |
* returns: - E1000_ERR_MASTER_REQUESTS_PENDING if master disable bit hasn't |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6415 |
* caused the master requests to be disabled. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6416 |
* E1000_SUCCESS master requests disabled. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6417 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6418 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6419 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6420 |
e1000_disable_pciex_master(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6421 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6422 |
int32_t timeout = MASTER_DISABLE_TIMEOUT; /* 80ms */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6423 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6424 |
DEBUGFUNC("e1000_disable_pciex_master"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6425 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6426 |
if (hw->bus_type != e1000_bus_type_pci_express) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6427 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6428 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6429 |
e1000_set_pci_express_master_disable(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6430 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6431 |
while(timeout) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6432 |
if(!(E1000_READ_REG(hw, STATUS) & E1000_STATUS_GIO_MASTER_ENABLE)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6433 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6434 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6435 |
udelay(100); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6436 |
timeout--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6437 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6438 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6439 |
if(!timeout) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6440 |
DEBUGOUT("Master requests are pending.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6441 |
return -E1000_ERR_MASTER_REQUESTS_PENDING; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6442 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6443 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6444 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6445 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6446 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6447 |
/******************************************************************************* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6448 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6449 |
* Check for EEPROM Auto Read bit done. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6450 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6451 |
* hw: Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6452 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6453 |
* returns: - E1000_ERR_RESET if fail to reset MAC |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6454 |
* E1000_SUCCESS at any other case. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6455 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6456 |
******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6457 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6458 |
e1000_get_auto_rd_done(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6459 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6460 |
int32_t timeout = AUTO_READ_DONE_TIMEOUT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6461 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6462 |
DEBUGFUNC("e1000_get_auto_rd_done"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6463 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6464 |
switch (hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6465 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6466 |
msec_delay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6467 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6468 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6469 |
while(timeout) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6470 |
if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6471 |
else msec_delay(1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6472 |
timeout--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6473 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6474 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6475 |
if(!timeout) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6476 |
DEBUGOUT("Auto read by HW from EEPROM has not completed.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6477 |
return -E1000_ERR_RESET; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6478 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6479 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6480 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6481 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6482 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6483 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6484 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6485 |
/*************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6486 |
* Checks if the PHY configuration is done |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6487 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6488 |
* hw: Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6489 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6490 |
* returns: - E1000_ERR_RESET if fail to reset MAC |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6491 |
* E1000_SUCCESS at any other case. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6492 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6493 |
***************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6494 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6495 |
e1000_get_phy_cfg_done(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6496 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6497 |
DEBUGFUNC("e1000_get_phy_cfg_done"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6498 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6499 |
/* Simply wait for 10ms */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6500 |
msec_delay(10); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6501 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6502 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6503 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6504 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6505 |
/*************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6506 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6507 |
* Using the combination of SMBI and SWESMBI semaphore bits when resetting |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6508 |
* adapter or Eeprom access. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6509 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6510 |
* hw: Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6511 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6512 |
* returns: - E1000_ERR_EEPROM if fail to access EEPROM. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6513 |
* E1000_SUCCESS at any other case. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6514 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6515 |
***************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6516 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6517 |
e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6518 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6519 |
int32_t timeout; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6520 |
uint32_t swsm; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6521 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6522 |
DEBUGFUNC("e1000_get_hw_eeprom_semaphore"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6523 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6524 |
if(!hw->eeprom_semaphore_present) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6525 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6526 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6527 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6528 |
/* Get the FW semaphore. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6529 |
timeout = hw->eeprom.word_size + 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6530 |
while(timeout) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6531 |
swsm = E1000_READ_REG(hw, SWSM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6532 |
swsm |= E1000_SWSM_SWESMBI; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6533 |
E1000_WRITE_REG(hw, SWSM, swsm); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6534 |
/* if we managed to set the bit we got the semaphore. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6535 |
swsm = E1000_READ_REG(hw, SWSM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6536 |
if(swsm & E1000_SWSM_SWESMBI) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6537 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6538 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6539 |
udelay(50); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6540 |
timeout--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6541 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6542 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6543 |
if(!timeout) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6544 |
/* Release semaphores */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6545 |
e1000_put_hw_eeprom_semaphore(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6546 |
DEBUGOUT("Driver can't access the Eeprom - SWESMBI bit is set.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6547 |
return -E1000_ERR_EEPROM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6548 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6549 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6550 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6551 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6552 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6553 |
/*************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6554 |
* This function clears HW semaphore bits. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6555 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6556 |
* hw: Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6557 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6558 |
* returns: - None. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6559 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6560 |
***************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6561 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6562 |
e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6563 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6564 |
uint32_t swsm; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6565 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6566 |
DEBUGFUNC("e1000_put_hw_eeprom_semaphore"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6567 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6568 |
if(!hw->eeprom_semaphore_present) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6569 |
return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6570 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6571 |
swsm = E1000_READ_REG(hw, SWSM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6572 |
/* Release both semaphores. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6573 |
swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6574 |
E1000_WRITE_REG(hw, SWSM, swsm); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6575 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6576 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6577 |
/****************************************************************************** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6578 |
* Checks if PHY reset is blocked due to SOL/IDER session, for example. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6579 |
* Returning E1000_BLK_PHY_RESET isn't necessarily an error. But it's up to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6580 |
* the caller to figure out how to deal with it. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6581 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6582 |
* hw - Struct containing variables accessed by shared code |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6583 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6584 |
* returns: - E1000_BLK_PHY_RESET |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6585 |
* E1000_SUCCESS |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6586 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6587 |
*****************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6588 |
int32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6589 |
e1000_check_phy_reset_block(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6590 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6591 |
uint32_t manc = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6592 |
if(hw->mac_type > e1000_82547_rev_2) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6593 |
manc = E1000_READ_REG(hw, MANC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6594 |
return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6595 |
E1000_BLK_PHY_RESET : E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6596 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6597 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6598 |
uint8_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6599 |
e1000_arc_subsystem_valid(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6600 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6601 |
uint32_t fwsm; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6602 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6603 |
/* On 8257x silicon, registers in the range of 0x8800 - 0x8FFC |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6604 |
* may not be provided a DMA clock when no manageability features are |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6605 |
* enabled. We do not want to perform any reads/writes to these registers |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6606 |
* if this is the case. We read FWSM to determine the manageability mode. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6607 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6608 |
switch (hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6609 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6610 |
fwsm = E1000_READ_REG(hw, FWSM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6611 |
if((fwsm & E1000_FWSM_MODE_MASK) != 0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6612 |
return TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6613 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6614 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6615 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6616 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6617 |
return FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6618 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6619 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6620 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6621 |