author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Thu, 27 Sep 2018 00:21:27 +0200 | |
branch | stable-1.5 |
changeset 2712 | 5d21d80777a6 |
parent 2584 | 0e3d989ff233 |
permissions | -rw-r--r-- |
2584
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/******************************************************************************* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
Intel PRO/1000 Linux driver |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
Copyright(c) 1999 - 2006 Intel Corporation. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
This program is free software; you can redistribute it and/or modify it |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
under the terms and conditions of the GNU General Public License, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
version 2, as published by the Free Software Foundation. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
This program is distributed in the hope it will be useful, but WITHOUT |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
more details. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
You should have received a copy of the GNU General Public License along with |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
this program; if not, write to the Free Software Foundation, Inc., |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
The full GNU General Public License is included in this distribution in |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
the file called "COPYING". |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
Contact Information: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
Linux NICS <linux.nics@intel.com> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
/* e1000_hw.c |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* Shared functions for accessing and configuring the MAC |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
#include "e1000-3.8-ethercat.h" |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
static s32 e1000_check_downshift(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
static s32 e1000_check_polarity(struct e1000_hw *hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
e1000_rev_polarity *polarity); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
static void e1000_clear_hw_cntrs(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
static void e1000_clear_vfta(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
static s32 e1000_config_dsp_after_link_change(struct e1000_hw *hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
bool link_up); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
static s32 e1000_detect_gig_phy(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
static s32 e1000_get_auto_rd_done(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
u16 *max_length); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
static s32 e1000_id_led_init(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
static void e1000_init_rx_addrs(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
static s32 e1000_phy_igp_get_info(struct e1000_hw *hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
struct e1000_phy_info *phy_info); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
static s32 e1000_phy_m88_get_info(struct e1000_hw *hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
struct e1000_phy_info *phy_info); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
static s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
static s32 e1000_wait_autoneg(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
static void e1000_write_reg_io(struct e1000_hw *hw, u32 offset, u32 value); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
static s32 e1000_set_phy_type(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
static void e1000_phy_init_script(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
static s32 e1000_setup_copper_link(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
static s32 e1000_adjust_serdes_amplitude(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
static s32 e1000_config_mac_to_phy(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
static void e1000_raise_mdi_clk(struct e1000_hw *hw, u32 *ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
static void e1000_lower_mdi_clk(struct e1000_hw *hw, u32 *ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, u32 data, u16 count); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
static u16 e1000_shift_in_mdi_bits(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
static s32 e1000_phy_reset_dsp(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
static s32 e1000_write_eeprom_spi(struct e1000_hw *hw, u16 offset, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
u16 words, u16 *data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
u16 words, u16 *data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
static void e1000_raise_ee_clk(struct e1000_hw *hw, u32 *eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
static void e1000_lower_ee_clk(struct e1000_hw *hw, u32 *eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
static void e1000_shift_out_ee_bits(struct e1000_hw *hw, u16 data, u16 count); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
u16 phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
u16 *phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
static u16 e1000_shift_in_ee_bits(struct e1000_hw *hw, u16 count); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
static s32 e1000_acquire_eeprom(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
static void e1000_release_eeprom(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
static void e1000_standby_eeprom(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
static s32 e1000_set_vco_speed(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
static s32 e1000_polarity_reversal_workaround(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
static s32 e1000_set_phy_mode(struct e1000_hw *hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
u16 *data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
u16 *data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
/* IGP cable length table */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
static const |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
u16 e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
5, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 25, 25, 25, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
25, 25, 25, 25, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
40, 50, 50, 50, 50, 50, 50, 50, 60, 60, 60, 60, 60, 60, 60, 60, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
60, 70, 70, 70, 70, 70, 70, 80, 80, 80, 80, 80, 80, 90, 90, 90, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
90, 90, 90, 90, 90, 90, 100, 100, 100, 100, 100, 100, 100, 100, 100, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
100, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
100, 100, 100, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
110, 110, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
110, 110, 110, 110, 110, 110, 120, 120, 120, 120, 120, 120, 120, 120, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
120, 120 |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
}; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
static DEFINE_SPINLOCK(e1000_eeprom_lock); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
static DEFINE_SPINLOCK(e1000_phy_lock); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
* e1000_set_phy_type - Set the phy type member in the hw struct. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
static s32 e1000_set_phy_type(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
e_dbg("e1000_set_phy_type"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
if (hw->mac_type == e1000_undefined) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
return -E1000_ERR_PHY_TYPE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
switch (hw->phy_id) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
case M88E1000_E_PHY_ID: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
case M88E1000_I_PHY_ID: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
case M88E1011_I_PHY_ID: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
case M88E1111_I_PHY_ID: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
case M88E1118_E_PHY_ID: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
hw->phy_type = e1000_phy_m88; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
case IGP01E1000_I_PHY_ID: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
if (hw->mac_type == e1000_82541 || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
hw->mac_type == e1000_82541_rev_2 || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
hw->mac_type == e1000_82547 || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
hw->mac_type == e1000_82547_rev_2) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
hw->phy_type = e1000_phy_igp; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
case RTL8211B_PHY_ID: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
hw->phy_type = e1000_phy_8211; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
case RTL8201N_PHY_ID: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
hw->phy_type = e1000_phy_8201; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
/* Should never have loaded on this device */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
hw->phy_type = e1000_phy_undefined; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
return -E1000_ERR_PHY_TYPE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
* e1000_phy_init_script - IGP phy init script - initializes the GbE PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
static void e1000_phy_init_script(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
u32 ret_val __attribute__ ((unused)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
u16 phy_saved_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
e_dbg("e1000_phy_init_script"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
if (hw->phy_init_script) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
msleep(20); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
/* Save off the current value of register 0x2F5B to be restored at |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
* the end of this routine. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
/* Disabled the PHY transmitter */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
msleep(20); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
e1000_write_phy_reg(hw, 0x0000, 0x0140); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
msleep(5); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
case e1000_82541: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
case e1000_82547: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
e1000_write_phy_reg(hw, 0x1F95, 0x0001); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
e1000_write_phy_reg(hw, 0x1F71, 0xBD21); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
e1000_write_phy_reg(hw, 0x1F79, 0x0018); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
e1000_write_phy_reg(hw, 0x1F30, 0x1600); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
e1000_write_phy_reg(hw, 0x1F31, 0x0014); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
e1000_write_phy_reg(hw, 0x1F32, 0x161C); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
e1000_write_phy_reg(hw, 0x1F94, 0x0003); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
e1000_write_phy_reg(hw, 0x1F96, 0x003F); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
e1000_write_phy_reg(hw, 0x2010, 0x0008); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
case e1000_82541_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
case e1000_82547_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
e1000_write_phy_reg(hw, 0x1F73, 0x0099); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
e1000_write_phy_reg(hw, 0x0000, 0x3300); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
msleep(20); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
/* Now enable the transmitter */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
if (hw->mac_type == e1000_82547) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
u16 fused, fine, coarse; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
/* Move to analog registers page */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
e1000_read_phy_reg(hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
IGP01E1000_ANALOG_SPARE_FUSE_STATUS, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
&fused); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
if (!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
e1000_read_phy_reg(hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
IGP01E1000_ANALOG_FUSE_STATUS, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
&fused); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
fine = fused & IGP01E1000_ANALOG_FUSE_FINE_MASK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
coarse = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
fused & IGP01E1000_ANALOG_FUSE_COARSE_MASK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
if (coarse > |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
IGP01E1000_ANALOG_FUSE_COARSE_THRESH) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
coarse -= |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
IGP01E1000_ANALOG_FUSE_COARSE_10; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
fine -= IGP01E1000_ANALOG_FUSE_FINE_1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
} else if (coarse == |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
IGP01E1000_ANALOG_FUSE_COARSE_THRESH) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
fine -= IGP01E1000_ANALOG_FUSE_FINE_10; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
fused = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
(fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
(fine & IGP01E1000_ANALOG_FUSE_FINE_MASK) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
(coarse & |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
IGP01E1000_ANALOG_FUSE_COARSE_MASK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
e1000_write_phy_reg(hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
IGP01E1000_ANALOG_FUSE_CONTROL, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
fused); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
e1000_write_phy_reg(hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
IGP01E1000_ANALOG_FUSE_BYPASS, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
* e1000_set_mac_type - Set the mac type member in the hw struct. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
s32 e1000_set_mac_type(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
e_dbg("e1000_set_mac_type"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
switch (hw->device_id) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
case E1000_DEV_ID_82542: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
switch (hw->revision_id) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
case E1000_82542_2_0_REV_ID: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
hw->mac_type = e1000_82542_rev2_0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
case E1000_82542_2_1_REV_ID: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
hw->mac_type = e1000_82542_rev2_1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
/* Invalid 82542 revision ID */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
return -E1000_ERR_MAC_TYPE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
case E1000_DEV_ID_82543GC_FIBER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
case E1000_DEV_ID_82543GC_COPPER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
hw->mac_type = e1000_82543; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
case E1000_DEV_ID_82544EI_COPPER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
case E1000_DEV_ID_82544EI_FIBER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
case E1000_DEV_ID_82544GC_COPPER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
case E1000_DEV_ID_82544GC_LOM: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
hw->mac_type = e1000_82544; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
case E1000_DEV_ID_82540EM: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
case E1000_DEV_ID_82540EM_LOM: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
case E1000_DEV_ID_82540EP: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
case E1000_DEV_ID_82540EP_LOM: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
case E1000_DEV_ID_82540EP_LP: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
hw->mac_type = e1000_82540; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
case E1000_DEV_ID_82545EM_COPPER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
case E1000_DEV_ID_82545EM_FIBER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
hw->mac_type = e1000_82545; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
case E1000_DEV_ID_82545GM_COPPER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
case E1000_DEV_ID_82545GM_FIBER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
case E1000_DEV_ID_82545GM_SERDES: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
hw->mac_type = e1000_82545_rev_3; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
case E1000_DEV_ID_82546EB_COPPER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
case E1000_DEV_ID_82546EB_FIBER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
case E1000_DEV_ID_82546EB_QUAD_COPPER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
hw->mac_type = e1000_82546; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
case E1000_DEV_ID_82546GB_COPPER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
case E1000_DEV_ID_82546GB_FIBER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
case E1000_DEV_ID_82546GB_SERDES: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
case E1000_DEV_ID_82546GB_PCIE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
case E1000_DEV_ID_82546GB_QUAD_COPPER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
hw->mac_type = e1000_82546_rev_3; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
case E1000_DEV_ID_82541EI: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
case E1000_DEV_ID_82541EI_MOBILE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
case E1000_DEV_ID_82541ER_LOM: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
hw->mac_type = e1000_82541; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
case E1000_DEV_ID_82541ER: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
case E1000_DEV_ID_82541GI: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
case E1000_DEV_ID_82541GI_LF: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
case E1000_DEV_ID_82541GI_MOBILE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
hw->mac_type = e1000_82541_rev_2; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
case E1000_DEV_ID_82547EI: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
case E1000_DEV_ID_82547EI_MOBILE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
hw->mac_type = e1000_82547; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
case E1000_DEV_ID_82547GI: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
hw->mac_type = e1000_82547_rev_2; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
case E1000_DEV_ID_INTEL_CE4100_GBE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
hw->mac_type = e1000_ce4100; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
/* Should never have loaded on this device */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
return -E1000_ERR_MAC_TYPE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
case e1000_82541: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
case e1000_82547: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
case e1000_82541_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
case e1000_82547_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
hw->asf_firmware_present = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
/* The 82543 chip does not count tx_carrier_errors properly in |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
* FD mode |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
if (hw->mac_type == e1000_82543) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
hw->bad_tx_carr_stats_fd = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
if (hw->mac_type > e1000_82544) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
hw->has_smbus = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
* e1000_set_media_type - Set media type and TBI compatibility. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
void e1000_set_media_type(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
u32 status; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
e_dbg("e1000_set_media_type"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
if (hw->mac_type != e1000_82543) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
/* tbi_compatibility is only valid on 82543 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
hw->tbi_compatibility_en = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
switch (hw->device_id) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
case E1000_DEV_ID_82545GM_SERDES: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
case E1000_DEV_ID_82546GB_SERDES: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
hw->media_type = e1000_media_type_internal_serdes; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
case e1000_82542_rev2_0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
case e1000_82542_rev2_1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
hw->media_type = e1000_media_type_fiber; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
case e1000_ce4100: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
hw->media_type = e1000_media_type_copper; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
status = er32(STATUS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
if (status & E1000_STATUS_TBIMODE) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
hw->media_type = e1000_media_type_fiber; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
/* tbi_compatibility not valid on fiber */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
hw->tbi_compatibility_en = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
hw->media_type = e1000_media_type_copper; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
* e1000_reset_hw - reset the hardware completely |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
* Reset the transmit and receive units; mask and clear all interrupts. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
s32 e1000_reset_hw(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
u32 ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
u32 ctrl_ext; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
u32 icr __attribute__ ((unused)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
u32 manc; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
u32 led_ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
e_dbg("e1000_reset_hw"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
/* For 82542 (rev 2.0), disable MWI before issuing a device reset */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
if (hw->mac_type == e1000_82542_rev2_0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
e_dbg("Disabling MWI on 82542 rev 2.0\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
e1000_pci_clear_mwi(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
/* Clear interrupt mask to stop board from generating interrupts */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
e_dbg("Masking off all interrupts\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
ew32(IMC, 0xffffffff); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
/* Disable the Transmit and Receive units. Then delay to allow |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
* any pending transactions to complete before we hit the MAC with |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
* the global reset. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
ew32(RCTL, 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
ew32(TCTL, E1000_TCTL_PSP); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
/* The tbi_compatibility_on Flag must be cleared when Rctl is cleared. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
hw->tbi_compatibility_on = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
/* Delay to allow any outstanding PCI transactions to complete before |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
* resetting the device |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
msleep(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
/* Must reset the PHY before resetting the MAC */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
448 |
if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
ew32(CTRL, (ctrl | E1000_CTRL_PHY_RST)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
msleep(5); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
/* Issue a global reset to the MAC. This will reset the chip's |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
* transmit, receive, DMA, and link units. It will not effect |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
* the current PCI configuration. The global reset bit is self- |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
* clearing, and should clear within a microsecond. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
e_dbg("Issuing a global reset to MAC\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
case e1000_82544: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
case e1000_82540: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
case e1000_82545: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
case e1000_82546: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
case e1000_82541: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
case e1000_82541_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
/* These controllers can't ack the 64-bit write when issuing the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
* reset, so use IO-mapping as a workaround to issue the reset */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
case e1000_82545_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
case e1000_82546_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
/* Reset is performed on a shadow of the control register */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
ew32(CTRL_DUP, (ctrl | E1000_CTRL_RST)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
case e1000_ce4100: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
ew32(CTRL, (ctrl | E1000_CTRL_RST)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
/* After MAC reset, force reload of EEPROM to restore power-on settings to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
* device. Later controllers reload the EEPROM automatically, so just wait |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
* for reload to complete. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
case e1000_82542_rev2_0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
case e1000_82542_rev2_1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
case e1000_82543: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
case e1000_82544: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
/* Wait for reset to complete */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
udelay(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
ctrl_ext = er32(CTRL_EXT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
ctrl_ext |= E1000_CTRL_EXT_EE_RST; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
ew32(CTRL_EXT, ctrl_ext); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
/* Wait for EEPROM reload */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
msleep(2); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
case e1000_82541: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
case e1000_82541_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
case e1000_82547: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
case e1000_82547_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
/* Wait for EEPROM reload */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
msleep(20); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
/* Auto read done will delay 5ms or poll based on mac type */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
ret_val = e1000_get_auto_rd_done(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
/* Disable HW ARPs on ASF enabled adapters */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
if (hw->mac_type >= e1000_82540) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
manc = er32(MANC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
manc &= ~(E1000_MANC_ARP_EN); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
ew32(MANC, manc); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
e1000_phy_init_script(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
/* Configure activity LED after PHY reset */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
led_ctrl = er32(LEDCTL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
led_ctrl &= IGP_ACTIVITY_LED_MASK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
ew32(LEDCTL, led_ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
/* Clear interrupt mask to stop board from generating interrupts */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
e_dbg("Masking off all interrupts\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
ew32(IMC, 0xffffffff); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
/* Clear any pending interrupt events. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
icr = er32(ICR); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
539 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
/* If MWI was previously enabled, reenable it. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
if (hw->mac_type == e1000_82542_rev2_0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
if (hw->pci_cmd_word & PCI_COMMAND_INVALIDATE) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
e1000_pci_set_mwi(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
* e1000_init_hw - Performs basic configuration of the adapter. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
* Assumes that the controller has previously been reset and is in a |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
* post-reset uninitialized state. Initializes the receive address registers, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
* multicast table, and VLAN filter table. Calls routines to setup link |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
* configuration and flow control settings. Clears all on-chip counters. Leaves |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
* the transmit and receive units disabled and uninitialized. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
s32 e1000_init_hw(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
u32 ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
u32 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
u32 mta_size; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
u32 ctrl_ext; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
e_dbg("e1000_init_hw"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
/* Initialize Identification LED */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
ret_val = e1000_id_led_init(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
e_dbg("Error Initializing Identification LED\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
/* Set the media type and TBI compatibility */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
e1000_set_media_type(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
/* Disabling VLAN filtering. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
e_dbg("Initializing the IEEE VLAN\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
if (hw->mac_type < e1000_82545_rev_3) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
ew32(VET, 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
e1000_clear_vfta(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
/* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
if (hw->mac_type == e1000_82542_rev2_0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
e_dbg("Disabling MWI on 82542 rev 2.0\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
e1000_pci_clear_mwi(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
ew32(RCTL, E1000_RCTL_RST); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
msleep(5); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
/* Setup the receive address. This involves initializing all of the Receive |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
* Address Registers (RARs 0 - 15). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
e1000_init_rx_addrs(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
/* For 82542 (rev 2.0), take the receiver out of reset and enable MWI */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
if (hw->mac_type == e1000_82542_rev2_0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
ew32(RCTL, 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
msleep(1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
if (hw->pci_cmd_word & PCI_COMMAND_INVALIDATE) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
e1000_pci_set_mwi(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
/* Zero out the Multicast HASH table */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
e_dbg("Zeroing the MTA\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
mta_size = E1000_MC_TBL_SIZE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
for (i = 0; i < mta_size; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
/* use write flush to prevent Memory Write Block (MWB) from |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
* occurring when accessing our register space */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
617 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
/* Set the PCI priority bit correctly in the CTRL register. This |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
* determines if the adapter gives priority to receives, or if it |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
* gives equal priority to transmits and receives. Valid only on |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
* 82542 and 82543 silicon. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
if (hw->dma_fairness && hw->mac_type <= e1000_82543) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
ew32(CTRL, ctrl | E1000_CTRL_PRIOR); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
case e1000_82545_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
case e1000_82546_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
/* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
if (hw->bus_type == e1000_bus_type_pcix |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
&& e1000_pcix_get_mmrbc(hw) > 2048) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
e1000_pcix_set_mmrbc(hw, 2048); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
/* Call a subroutine to configure the link and setup flow control. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
641 |
ret_val = e1000_setup_link(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
/* Set the transmit descriptor write-back policy */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
if (hw->mac_type > e1000_82544) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
ctrl = er32(TXDCTL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
ctrl = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
(ctrl & ~E1000_TXDCTL_WTHRESH) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
E1000_TXDCTL_FULL_TX_DESC_WB; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
ew32(TXDCTL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
650 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
651 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
/* Clear all of the statistics registers (clear on read). It is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
* important that we do this after we have tried to establish link |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
* because the symbol error count will increment wildly if there |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
* is no link. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
e1000_clear_hw_cntrs(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
659 |
if (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
ctrl_ext = er32(CTRL_EXT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
/* Relaxed ordering must be disabled to avoid a parity |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
* error crash in a PCI slot. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
ctrl_ext |= E1000_CTRL_EXT_RO_DIS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
ew32(CTRL_EXT, ctrl_ext); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
* e1000_adjust_serdes_amplitude - Adjust SERDES output amplitude based on EEPROM setting. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
* @hw: Struct containing variables accessed by shared code. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
static s32 e1000_adjust_serdes_amplitude(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
u16 eeprom_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
e_dbg("e1000_adjust_serdes_amplitude"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
if (hw->media_type != e1000_media_type_internal_serdes) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
case e1000_82545_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
case e1000_82546_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
ret_val = e1000_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
&eeprom_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
if (eeprom_data != EEPROM_RESERVED_WORD) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
/* Adjust SERDES output amplitude only. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
703 |
e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
* e1000_setup_link - Configures flow control and link settings. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
* Determines which flow control settings to use. Calls the appropriate media- |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
* specific link configuration function. Configures the flow control settings. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
717 |
* Assuming the adapter has a valid link partner, a valid link should be |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
* established. Assumes the hardware has previously been reset and the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
* transmitter and receiver are not enabled. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
s32 e1000_setup_link(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
u32 ctrl_ext; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
u16 eeprom_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
e_dbg("e1000_setup_link"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
/* Read and store word 0x0F of the EEPROM. This word contains bits |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
* that determine the hardware's default PAUSE (flow control) mode, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
* a bit that determines whether the HW defaults to enabling or |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
* disabling auto-negotiation, and the direction of the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
* SW defined pins. If there is no SW over-ride of the flow |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
* control setting, then the variable hw->fc will |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
* be initialized based on a value in the EEPROM. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
if (hw->fc == E1000_FC_DEFAULT) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
1, &eeprom_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
e_dbg("EEPROM Read Error\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
if ((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == 0) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
hw->fc = E1000_FC_NONE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
else if ((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
EEPROM_WORD0F_ASM_DIR) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
hw->fc = E1000_FC_TX_PAUSE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
else |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
hw->fc = E1000_FC_FULL; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
/* We want to save off the original Flow Control configuration just |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
* in case we get disconnected and then reconnected into a different |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
* hub or switch with different Flow Control capabilities. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
if (hw->mac_type == e1000_82542_rev2_0) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
hw->fc &= (~E1000_FC_TX_PAUSE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
if ((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
hw->fc &= (~E1000_FC_RX_PAUSE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
hw->original_fc = hw->fc; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
e_dbg("After fix-ups FlowControl is now = %x\n", hw->fc); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
/* Take the 4 bits from EEPROM word 0x0F that determine the initial |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
* polarity value for the SW controlled pins, and setup the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
* Extended Device Control reg with that info. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
* This is needed because one of the SW controlled pins is used for |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
* signal detection. So this should be done before e1000_setup_pcs_link() |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
* or e1000_phy_setup() is called. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
if (hw->mac_type == e1000_82543) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
1, &eeprom_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
e_dbg("EEPROM Read Error\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) << |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
SWDPIO__EXT_SHIFT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
ew32(CTRL_EXT, ctrl_ext); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
/* Call the necessary subroutine to configure the link. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
ret_val = (hw->media_type == e1000_media_type_copper) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
e1000_setup_copper_link(hw) : e1000_setup_fiber_serdes_link(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
/* Initialize the flow control address, type, and PAUSE timer |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
* registers to their default values. This is done even if flow |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
* control is disabled, because it does not hurt anything to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
* initialize these registers. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
e_dbg("Initializing the Flow Control address, type and timer regs\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
ew32(FCT, FLOW_CONTROL_TYPE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
ew32(FCAH, FLOW_CONTROL_ADDRESS_HIGH); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
ew32(FCAL, FLOW_CONTROL_ADDRESS_LOW); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
ew32(FCTTV, hw->fc_pause_time); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
/* Set the flow control receive threshold registers. Normally, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
* these registers will be set to a default threshold that may be |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
805 |
* adjusted later by the driver's runtime code. However, if the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
* ability to transmit pause frames in not enabled, then these |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
807 |
* registers will be set to 0. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
if (!(hw->fc & E1000_FC_TX_PAUSE)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
ew32(FCRTL, 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
ew32(FCRTH, 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
/* We need to set up the Receive Threshold high and low water marks |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
814 |
* as well as (optionally) enabling the transmission of XON frames. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
if (hw->fc_send_xon) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
ew32(FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
ew32(FCRTH, hw->fc_high_water); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
ew32(FCRTL, hw->fc_low_water); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
ew32(FCRTH, hw->fc_high_water); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
823 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
* e1000_setup_fiber_serdes_link - prepare fiber or serdes link |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
* Manipulates Physical Coding Sublayer functions in order to configure |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
* link. Assumes the hardware has been previously reset and the transmitter |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
* and receiver are not enabled. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
u32 ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
u32 status; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
u32 txcw = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
u32 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
u32 signal = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
e_dbg("e1000_setup_fiber_serdes_link"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
/* On adapters with a MAC newer than 82544, SWDP 1 will be |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
* set when the optics detect a signal. On older adapters, it will be |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
* cleared when there is a signal. This applies to fiber media only. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
* If we're on serdes media, adjust the output amplitude to value |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
* set in the EEPROM. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
if (hw->media_type == e1000_media_type_fiber) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
ret_val = e1000_adjust_serdes_amplitude(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
/* Take the link out of reset */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
ctrl &= ~(E1000_CTRL_LRST); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
/* Adjust VCO speed to improve BER performance */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
ret_val = e1000_set_vco_speed(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
e1000_config_collision_dist(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
/* Check for a software override of the flow control settings, and setup |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
* the device accordingly. If auto-negotiation is enabled, then software |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
* will have to set the "PAUSE" bits to the correct value in the Tranmsit |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
* Config Word Register (TXCW) and re-start auto-negotiation. However, if |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
* auto-negotiation is disabled, then software will have to manually |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
* configure the two flow control enable bits in the CTRL register. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
* The possible values of the "fc" parameter are: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
* 0: Flow control is completely disabled |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
* 1: Rx flow control is enabled (we can receive pause frames, but |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
* not send pause frames). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
* 2: Tx flow control is enabled (we can send pause frames but we do |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
* not support receiving pause frames). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
* 3: Both Rx and TX flow control (symmetric) are enabled. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
switch (hw->fc) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
case E1000_FC_NONE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
/* Flow control is completely disabled by a software over-ride. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
case E1000_FC_RX_PAUSE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
/* RX Flow control is enabled and TX Flow control is disabled by a |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
* software over-ride. Since there really isn't a way to advertise |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
* that we are capable of RX Pause ONLY, we will advertise that we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
* support both symmetric and asymmetric RX PAUSE. Later, we will |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
* disable the adapter's ability to send PAUSE frames. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
case E1000_FC_TX_PAUSE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
/* TX Flow control is enabled, and RX Flow control is disabled, by a |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
* software over-ride. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_ASM_DIR); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
case E1000_FC_FULL: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
/* Flow control (both RX and TX) is enabled by a software over-ride. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
909 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
910 |
e_dbg("Flow control param set incorrectly\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
return -E1000_ERR_CONFIG; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
/* Since auto-negotiation is enabled, take the link out of reset (the link |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
* will be in reset, because we previously reset the chip). This will |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
* restart auto-negotiation. If auto-negotiation is successful then the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
918 |
* link-up status bit will be set and the flow control enable bits (RFCE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
* and TFCE) will be set according to their negotiated value. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
e_dbg("Auto-negotiation enabled\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
ew32(TXCW, txcw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
927 |
hw->txcw = txcw; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
msleep(1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
/* If we have a signal (the cable is plugged in) then poll for a "Link-Up" |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
* indication in the Device Status Register. Time-out if a link isn't |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
* seen in 500 milliseconds seconds (Auto-negotiation should complete in |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
* less than 500 milliseconds even if the other end is doing it in SW). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
* For internal serdes, we just assume a signal is present, then poll. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
if (hw->media_type == e1000_media_type_internal_serdes || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
(er32(CTRL) & E1000_CTRL_SWDPIN1) == signal) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
e_dbg("Looking for Link\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
for (i = 0; i < (LINK_UP_TIMEOUT / 10); i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
msleep(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
status = er32(STATUS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
if (status & E1000_STATUS_LU) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
if (i == (LINK_UP_TIMEOUT / 10)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
e_dbg("Never got a valid link from auto-neg!!!\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
hw->autoneg_failed = 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
/* AutoNeg failed to achieve a link, so we'll call |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
949 |
* e1000_check_for_link. This routine will force the link up if |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
950 |
* we detect a signal. This will allow us to communicate with |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
* non-autonegotiating link partners. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
ret_val = e1000_check_for_link(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
e_dbg("Error while checking for link\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
hw->autoneg_failed = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
hw->autoneg_failed = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
e_dbg("Valid Link Found\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
e_dbg("No Signal Detected\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
* e1000_copper_link_rtl_setup - Copper link setup for e1000_phy_rtl series. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
* Commits changes to PHY configuration by calling e1000_phy_reset(). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
static s32 e1000_copper_link_rtl_setup(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
/* SW reset the PHY so all changes take effect */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
ret_val = e1000_phy_reset(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
e_dbg("Error Resetting the PHY\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
static s32 gbe_dhg_phy_setup(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
u32 ctrl_aux; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
switch (hw->phy_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
case e1000_phy_8211: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
ret_val = e1000_copper_link_rtl_setup(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
e_dbg("e1000_copper_link_rtl_setup failed!\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
case e1000_phy_8201: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
/* Set RMII mode */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
ctrl_aux = er32(CTL_AUX); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
ctrl_aux |= E1000_CTL_AUX_RMII; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
ew32(CTL_AUX, ctrl_aux); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
/* Disable the J/K bits required for receive */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
ctrl_aux = er32(CTL_AUX); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
ctrl_aux |= 0x4; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
ctrl_aux &= ~0x2; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
ew32(CTL_AUX, ctrl_aux); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
ret_val = e1000_copper_link_rtl_setup(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
e_dbg("e1000_copper_link_rtl_setup failed!\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
e_dbg("Error Resetting the PHY\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
return E1000_ERR_PHY_TYPE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1030 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1031 |
* e1000_copper_link_preconfig - early configuration for copper |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
* Make sure we have a valid PHY and change PHY mode before link setup. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
static s32 e1000_copper_link_preconfig(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
u32 ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
e_dbg("e1000_copper_link_preconfig"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
/* With 82543, we need to force speed and duplex on the MAC equal to what |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
* the PHY speed and duplex configuration is. In addition, we need to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
* perform a hardware reset on the PHY to take it out of reset. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
if (hw->mac_type > e1000_82543) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
ctrl |= E1000_CTRL_SLU; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
ctrl |= |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | E1000_CTRL_SLU); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
ret_val = e1000_phy_hw_reset(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
/* Make sure we have a valid PHY */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
ret_val = e1000_detect_gig_phy(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
e_dbg("Error, did not detect valid phy.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1066 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
e_dbg("Phy ID = %x\n", hw->phy_id); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
/* Set PHY to class A mode (if necessary) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1071 |
ret_val = e1000_set_phy_mode(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
if ((hw->mac_type == e1000_82545_rev_3) || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
(hw->mac_type == e1000_82546_rev_3)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
phy_data |= 0x00000008; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
if (hw->mac_type <= e1000_82543 || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
hw->mac_type == e1000_82541_rev_2 |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
|| hw->mac_type == e1000_82547_rev_2) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
hw->phy_reset_disable = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
* e1000_copper_link_igp_setup - Copper link setup for e1000_phy_igp series. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
static s32 e1000_copper_link_igp_setup(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
u32 led_ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
e_dbg("e1000_copper_link_igp_setup"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
if (hw->phy_reset_disable) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
ret_val = e1000_phy_reset(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
e_dbg("Error Resetting the PHY\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1114 |
/* Wait 15ms for MAC to configure PHY from eeprom settings */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
msleep(15); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
/* Configure activity LED after PHY reset */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
led_ctrl = er32(LEDCTL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
led_ctrl &= IGP_ACTIVITY_LED_MASK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
ew32(LEDCTL, led_ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
/* The NVM settings will configure LPLU in D3 for IGP2 and IGP3 PHYs */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
if (hw->phy_type == e1000_phy_igp) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
/* disable lplu d3 during driver init */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
ret_val = e1000_set_d3_lplu_state(hw, false); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
e_dbg("Error Disabling LPLU D3\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
/* Configure mdi-mdix settings */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1135 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
hw->dsp_config_state = e1000_dsp_config_disabled; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
/* Force MDI for earlier revs of the IGP PHY */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
phy_data &= |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
~(IGP01E1000_PSCR_AUTO_MDIX | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
IGP01E1000_PSCR_FORCE_MDI_MDIX); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
hw->mdix = 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
hw->dsp_config_state = e1000_dsp_config_enabled; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
switch (hw->mdix) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1150 |
case 1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
case 2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
phy_data |= IGP01E1000_PSCR_FORCE_MDI_MDIX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1155 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
case 0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
phy_data |= IGP01E1000_PSCR_AUTO_MDIX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
/* set auto-master slave resolution settings */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
if (hw->autoneg) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
e1000_ms_type phy_ms_setting = hw->master_slave; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
if (hw->ffe_config_state == e1000_ffe_config_active) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
hw->ffe_config_state = e1000_ffe_config_enabled; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
if (hw->dsp_config_state == e1000_dsp_config_activated) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
hw->dsp_config_state = e1000_dsp_config_enabled; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
/* when autonegotiation advertisement is only 1000Mbps then we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1177 |
* should disable SmartSpeed and enable Auto MasterSlave |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
* resolution as hardware default. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
if (hw->autoneg_advertised == ADVERTISE_1000_FULL) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
/* Disable SmartSpeed */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
/* Set auto Master/Slave resolution process */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
phy_data &= ~CR_1000T_MS_ENABLE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
/* load defaults for future use */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
hw->original_master_slave = (phy_data & CR_1000T_MS_ENABLE) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
((phy_data & CR_1000T_MS_VALUE) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
e1000_ms_force_master : |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
e1000_ms_force_slave) : e1000_ms_auto; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
switch (phy_ms_setting) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
case e1000_ms_force_master: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
phy_data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
case e1000_ms_force_slave: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
phy_data |= CR_1000T_MS_ENABLE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
phy_data &= ~(CR_1000T_MS_VALUE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
case e1000_ms_auto: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
phy_data &= ~CR_1000T_MS_ENABLE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
* e1000_copper_link_mgp_setup - Copper link setup for e1000_phy_m88 series. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
static s32 e1000_copper_link_mgp_setup(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
e_dbg("e1000_copper_link_mgp_setup"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
if (hw->phy_reset_disable) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
/* Enable CRS on TX. This must be set for half-duplex operation. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1253 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
/* Options: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
* MDI/MDI-X = 0 (default) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
* 0 - Auto for all speeds |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
* 1 - MDI mode |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
* 2 - MDI-X mode |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
* 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
switch (hw->mdix) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
case 1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
phy_data |= M88E1000_PSCR_MDI_MANUAL_MODE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
case 2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
phy_data |= M88E1000_PSCR_MDIX_MANUAL_MODE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
case 3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
phy_data |= M88E1000_PSCR_AUTO_X_1000T; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
case 0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1277 |
phy_data |= M88E1000_PSCR_AUTO_X_MODE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
/* Options: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
* disable_polarity_correction = 0 (default) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
* Automatic Correction for Reversed Cable Polarity |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
* 0 - Disabled |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
* 1 - Enabled |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
if (hw->disable_polarity_correction == 1) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
if (hw->phy_revision < M88E1011_I_REV_4) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
/* Force TX_CLK in the Extended PHY Specific Control Register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
* to 25MHz clock. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1298 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
phy_data |= M88E1000_EPSCR_TX_CLK_25; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1305 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
if ((hw->phy_revision == E1000_REVISION_2) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
(hw->phy_id == M88E1111_I_PHY_ID)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
/* Vidalia Phy, set the downshift counter to 5x */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
phy_data &= ~(M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
phy_data |= M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1311 |
ret_val = e1000_write_phy_reg(hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
M88E1000_EXT_PHY_SPEC_CTRL, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
/* Configure Master and Slave downshift values */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1319 |
M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1320 |
phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
ret_val = e1000_write_phy_reg(hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
M88E1000_EXT_PHY_SPEC_CTRL, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1324 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
/* SW Reset the PHY so all changes take effect */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
ret_val = e1000_phy_reset(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1333 |
e_dbg("Error Resetting the PHY\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1336 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
* e1000_copper_link_autoneg - setup auto-neg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
* Setup auto-negotiation and flow control advertisements, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
* and then perform auto-negotiation. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1346 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1348 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
e_dbg("e1000_copper_link_autoneg"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
/* Perform some bounds checking on the hw->autoneg_advertised |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
* parameter. If this variable is zero, then set it to the default. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1357 |
hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
/* If autoneg_advertised is zero, we assume it was not defaulted |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
* by the calling code so we set to advertise full capability. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1362 |
if (hw->autoneg_advertised == 0) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
/* IFE/RTL8201N PHY only supports 10/100 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
if (hw->phy_type == e1000_phy_8201) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1367 |
hw->autoneg_advertised &= AUTONEG_ADVERTISE_10_100_ALL; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
e_dbg("Reconfiguring auto-neg advertisement params\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
ret_val = e1000_phy_setup_autoneg(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
e_dbg("Error Setting up Auto-Negotiation\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1374 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
e_dbg("Restarting Auto-Neg\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
/* Restart auto-negotiation by setting the Auto Neg Enable bit and |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
* the Auto Neg Restart bit in the PHY control register. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
/* Does the user want to wait for Auto-Neg to complete here, or |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
* check at a later time (for example, callback routine). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
if (hw->wait_autoneg_complete) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
ret_val = e1000_wait_autoneg(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
("Error while waiting for autoneg to complete\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
hw->get_link_status = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
* e1000_copper_link_postconfig - post link setup |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
* Config the MAC and the PHY after link is up. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
* 1) Set up the MAC to the current PHY speed/duplex |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
* if we are on 82543. If we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
* are on newer silicon, we only need to configure |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
* collision distance in the Transmit Control Register. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
* 2) Set up flow control on the MAC to that established with |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
* the link partner. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
* 3) Config DSP to improve Gigabit link quality for some PHY revisions. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
static s32 e1000_copper_link_postconfig(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
e_dbg("e1000_copper_link_postconfig"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1424 |
if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_ce4100)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
e1000_config_collision_dist(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
ret_val = e1000_config_mac_to_phy(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
e_dbg("Error configuring MAC to PHY settings\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1432 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1433 |
ret_val = e1000_config_fc_after_link_up(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1434 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
e_dbg("Error Configuring Flow Control\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
/* Config DSP to improve Giga link quality */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
if (hw->phy_type == e1000_phy_igp) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
ret_val = e1000_config_dsp_after_link_change(hw, true); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1443 |
e_dbg("Error Configuring DSP after link up\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1452 |
* e1000_setup_copper_link - phy/speed/duplex setting |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
* Detects which PHY is present and sets up the speed and duplex |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
static s32 e1000_setup_copper_link(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
u16 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1461 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
e_dbg("e1000_setup_copper_link"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
/* Check if it is a valid PHY and set PHY mode if necessary. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1466 |
ret_val = e1000_copper_link_preconfig(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1467 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
if (hw->phy_type == e1000_phy_igp) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
ret_val = e1000_copper_link_igp_setup(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
} else if (hw->phy_type == e1000_phy_m88) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
ret_val = e1000_copper_link_mgp_setup(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
ret_val = gbe_dhg_phy_setup(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
e_dbg("gbe_dhg_phy_setup failed!\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
if (hw->autoneg) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
/* Setup autoneg and flow control advertisement |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
* and perform autonegotiation */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1489 |
ret_val = e1000_copper_link_autoneg(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
/* PHY will be set to 10H, 10F, 100H,or 100F |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
* depending on value from forced_speed_duplex. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
e_dbg("Forcing speed and duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1496 |
ret_val = e1000_phy_force_speed_duplex(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
e_dbg("Error Forcing Speed and Duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1502 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
/* Check link status. Wait up to 100 microseconds for link to become |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
* valid. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
for (i = 0; i < 10; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
if (phy_data & MII_SR_LINK_STATUS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
/* Config the MAC and PHY after link is up */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
ret_val = e1000_copper_link_postconfig(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
e_dbg("Valid link established!!!\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1521 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
udelay(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
e_dbg("Unable to establish link!!!\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
* e1000_phy_setup_autoneg - phy settings |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
* Configures PHY autoneg and flow control advertisement settings |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1538 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
u16 mii_autoneg_adv_reg; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
u16 mii_1000t_ctrl_reg; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1542 |
e_dbg("e1000_phy_setup_autoneg"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
/* Read the MII Auto-Neg Advertisement Register (Address 4). */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
/* Read the MII 1000Base-T Control Register (Address 9). */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1553 |
else if (hw->phy_type == e1000_phy_8201) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
/* Need to parse both autoneg_advertised and fc and set up |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
* the appropriate PHY registers. First we will parse for |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
* autoneg_advertised software override. Since we can advertise |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
* a plethora of combinations, we need to check each bit |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
* individually. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
/* First we clear all the 10/100 mb speed bits in the Auto-Neg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
* Advertisement Register (Address 4) and the 1000 mb speed bits in |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
* the 1000Base-T Control Register (Address 9). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
mii_autoneg_adv_reg &= ~REG4_SPEED_MASK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1568 |
mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1569 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
e_dbg("autoneg_advertised %x\n", hw->autoneg_advertised); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
/* Do we want to advertise 10 Mb Half Duplex? */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
if (hw->autoneg_advertised & ADVERTISE_10_HALF) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
e_dbg("Advertise 10mb Half duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
/* Do we want to advertise 10 Mb Full Duplex? */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
if (hw->autoneg_advertised & ADVERTISE_10_FULL) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1580 |
e_dbg("Advertise 10mb Full duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
/* Do we want to advertise 100 Mb Half Duplex? */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
if (hw->autoneg_advertised & ADVERTISE_100_HALF) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
e_dbg("Advertise 100mb Half duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
/* Do we want to advertise 100 Mb Full Duplex? */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
if (hw->autoneg_advertised & ADVERTISE_100_FULL) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
e_dbg("Advertise 100mb Full duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1594 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
/* We do not allow the Phy to advertise 1000 Mb Half Duplex */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
if (hw->autoneg_advertised & ADVERTISE_1000_HALF) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
("Advertise 1000mb Half duplex requested, request denied!\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
/* Do we want to advertise 1000 Mb Full Duplex? */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
if (hw->autoneg_advertised & ADVERTISE_1000_FULL) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
e_dbg("Advertise 1000mb Full duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
/* Check for a software override of the flow control settings, and |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
* setup the PHY advertisement registers accordingly. If |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
* auto-negotiation is enabled, then software will have to set the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
* "PAUSE" bits to the correct value in the Auto-Negotiation |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
* Advertisement Register (PHY_AUTONEG_ADV) and re-start auto-negotiation. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1613 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
* The possible values of the "fc" parameter are: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1615 |
* 0: Flow control is completely disabled |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
* 1: Rx flow control is enabled (we can receive pause frames |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
* but not send pause frames). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
* 2: Tx flow control is enabled (we can send pause frames |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
* but we do not support receiving pause frames). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
* 3: Both Rx and TX flow control (symmetric) are enabled. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
* other: No software override. The flow control configuration |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
* in the EEPROM is used. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
switch (hw->fc) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
case E1000_FC_NONE: /* 0 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
/* Flow control (RX & TX) is completely disabled by a |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
* software over-ride. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
case E1000_FC_RX_PAUSE: /* 1 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
/* RX Flow control is enabled, and TX Flow control is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
* disabled, by a software over-ride. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
/* Since there really isn't a way to advertise that we are |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
* capable of RX Pause ONLY, we will advertise that we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
* support both symmetric and asymmetric RX PAUSE. Later |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
* (in e1000_config_fc_after_link_up) we will disable the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
*hw's ability to send PAUSE frames. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
case E1000_FC_TX_PAUSE: /* 2 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
/* TX Flow control is enabled, and RX Flow control is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
* disabled, by a software over-ride. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
case E1000_FC_FULL: /* 3 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
/* Flow control (both RX and TX) is enabled by a software |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
* over-ride. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
e_dbg("Flow control param set incorrectly\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
return -E1000_ERR_CONFIG; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
if (hw->phy_type == e1000_phy_8201) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
mii_1000t_ctrl_reg = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
mii_1000t_ctrl_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
* e1000_phy_force_speed_duplex - force link settings |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
* Force PHY speed and duplex settings to hw->forced_speed_duplex |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
u32 ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1688 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
u16 mii_ctrl_reg; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
u16 mii_status_reg; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
u16 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
e_dbg("e1000_phy_force_speed_duplex"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
/* Turn off Flow control if we are forcing speed and duplex. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
hw->fc = E1000_FC_NONE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
e_dbg("hw->fc = %d\n", hw->fc); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
/* Read the Device Control Register. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
/* Set the bits to Force Speed and Duplex in the Device Ctrl Reg. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
ctrl &= ~(DEVICE_SPEED_MASK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
/* Clear the Auto Speed Detect Enable bit. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
ctrl &= ~E1000_CTRL_ASDE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
/* Read the MII Control Register. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1715 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
/* We need to disable autoneg in order to force link and duplex. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
mii_ctrl_reg &= ~MII_CR_AUTO_NEG_EN; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
/* Are we forcing Full or Half Duplex? */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
if (hw->forced_speed_duplex == e1000_100_full || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
hw->forced_speed_duplex == e1000_10_full) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
/* We want to force full duplex so we SET the full duplex bits in the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
* Device and MII Control Registers. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1726 |
ctrl |= E1000_CTRL_FD; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
mii_ctrl_reg |= MII_CR_FULL_DUPLEX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
e_dbg("Full Duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
/* We want to force half duplex so we CLEAR the full duplex bits in |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
* the Device and MII Control Registers. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
ctrl &= ~E1000_CTRL_FD; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
mii_ctrl_reg &= ~MII_CR_FULL_DUPLEX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
e_dbg("Half Duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
/* Are we forcing 100Mbps??? */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
if (hw->forced_speed_duplex == e1000_100_full || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
hw->forced_speed_duplex == e1000_100_half) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
/* Set the 100Mb bit and turn off the 1000Mb and 10Mb bits. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
ctrl |= E1000_CTRL_SPD_100; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
mii_ctrl_reg |= MII_CR_SPEED_100; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
mii_ctrl_reg &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
e_dbg("Forcing 100mb "); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
/* Set the 10Mb bit and turn off the 1000Mb and 100Mb bits. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
mii_ctrl_reg |= MII_CR_SPEED_10; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
mii_ctrl_reg &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
e_dbg("Forcing 10mb "); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
e1000_config_collision_dist(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
/* Write the configured values back to the Device Control Reg. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
if (hw->phy_type == e1000_phy_m88) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1761 |
e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
/* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
* forced whenever speed are duplex are forced. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
e_dbg("M88E1000 PSCR: %x\n", phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
/* Need to reset the PHY or these changes will be ignored */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
mii_ctrl_reg |= MII_CR_RESET; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1778 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
/* Disable MDI-X support for 10/100 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
/* Clear Auto-Crossover to force MDI manually. IGP requires MDI |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
* forced whenever speed or duplex are forced. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
/* Write back the modified PHY MII control register. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
ret_val = e1000_write_phy_reg(hw, PHY_CTRL, mii_ctrl_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
udelay(1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
/* The wait_autoneg_complete flag may be a little misleading here. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
* Since we are forcing speed and duplex, Auto-Neg is not enabled. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
* But we do want to delay for a period while forcing only so we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
* don't generate false No Link messages. So we will wait here |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
* only if the user has set wait_autoneg_complete to 1, which is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
* the default. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
if (hw->wait_autoneg_complete) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
/* We will wait for autoneg to complete. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
e_dbg("Waiting for forced speed/duplex link.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
mii_status_reg = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
/* We will wait for autoneg to complete or 4.5 seconds to expire. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
for (i = PHY_FORCE_TIME; i > 0; i--) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
/* Read the MII Status Register and wait for Auto-Neg Complete bit |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
* to be set. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1825 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1832 |
if (mii_status_reg & MII_SR_LINK_STATUS) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
msleep(100); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
if ((i == 0) && (hw->phy_type == e1000_phy_m88)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
/* We didn't get link. Reset the DSP and wait again for link. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
ret_val = e1000_phy_reset_dsp(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
e_dbg("Error Resetting PHY DSP\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
/* This loop will early-out if the link condition has been met. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
for (i = PHY_FORCE_TIME; i > 0; i--) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
if (mii_status_reg & MII_SR_LINK_STATUS) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
msleep(100); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
/* Read the MII Status Register and wait for Auto-Neg Complete bit |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
* to be set. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
if (hw->phy_type == e1000_phy_m88) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
/* Because we reset the PHY above, we need to re-force TX_CLK in the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
* Extended PHY Specific Control Register to 25MHz clock. This value |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
* defaults back to a 2.5MHz clock when the PHY is reset. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1868 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1869 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
phy_data |= M88E1000_EPSCR_TX_CLK_25; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
/* In addition, because of the s/w reset above, we need to enable CRS on |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
* TX. This must be set for both full and half duplex operation. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1895 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
if ((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
&& (!hw->autoneg) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1898 |
&& (hw->forced_speed_duplex == e1000_10_full |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
|| hw->forced_speed_duplex == e1000_10_half)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
ret_val = e1000_polarity_reversal_workaround(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
* e1000_config_collision_dist - set collision distance register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
* Sets the collision distance in the Transmit Control register. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1913 |
* Link should have been established previously. Reads the speed and duplex |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
* information from the Device Status register. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
void e1000_config_collision_dist(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
u32 tctl, coll_dist; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1919 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
e_dbg("e1000_config_collision_dist"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
if (hw->mac_type < e1000_82543) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
coll_dist = E1000_COLLISION_DISTANCE_82542; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
else |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
coll_dist = E1000_COLLISION_DISTANCE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
tctl = er32(TCTL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
tctl &= ~E1000_TCTL_COLD; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
tctl |= coll_dist << E1000_COLD_SHIFT; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
ew32(TCTL, tctl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
* e1000_config_mac_to_phy - sync phy and mac settings |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
* @mii_reg: data to write to the MII control register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
* Sets MAC speed and duplex settings to reflect the those in the PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
* The contents of the PHY register containing the needed information need to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
* be passed in. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
static s32 e1000_config_mac_to_phy(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
u32 ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
e_dbg("e1000_config_mac_to_phy"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
/* 82544 or newer MAC, Auto Speed Detection takes care of |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
* MAC speed/duplex configuration.*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_ce4100)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
/* Read the Device Control Register and set the bits to Force Speed |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
* and Duplex. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
ctrl &= ~(E1000_CTRL_SPD_SEL | E1000_CTRL_ILOS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
switch (hw->phy_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
case e1000_phy_8201: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
if (phy_data & RTL_PHY_CTRL_FD) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
ctrl |= E1000_CTRL_FD; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
else |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
ctrl &= ~E1000_CTRL_FD; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
if (phy_data & RTL_PHY_CTRL_SPD_100) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
ctrl |= E1000_CTRL_SPD_100; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
else |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1979 |
ctrl |= E1000_CTRL_SPD_10; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
e1000_config_collision_dist(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
/* Set up duplex in the Device Control and Transmit Control |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
* registers depending on negotiated values. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1991 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
if (phy_data & M88E1000_PSSR_DPLX) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
ctrl |= E1000_CTRL_FD; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
else |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
ctrl &= ~E1000_CTRL_FD; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
e1000_config_collision_dist(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
/* Set up speed in the Device Control register depending on |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
* negotiated values. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
ctrl |= E1000_CTRL_SPD_1000; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
else if ((phy_data & M88E1000_PSSR_SPEED) == |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
M88E1000_PSSR_100MBS) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
ctrl |= E1000_CTRL_SPD_100; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
/* Write the configured values back to the Device Control Reg. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
* e1000_force_mac_fc - force flow control settings |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2016 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
* Forces the MAC's flow control settings. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
* Sets the TFCE and RFCE bits in the device control register to reflect |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
* the adapter settings. TFCE and RFCE need to be explicitly set by |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
* software when a Copper PHY is used because autonegotiation is managed |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
* by the PHY rather than the MAC. Software must also configure these |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
* bits when link is forced on a fiber connection. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
s32 e1000_force_mac_fc(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
u32 ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
e_dbg("e1000_force_mac_fc"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
/* Get the current configuration of the Device Control Register */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
/* Because we didn't get link via the internal auto-negotiation |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
* mechanism (we either forced link or we got link via PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
* auto-neg), we have to manually enable/disable transmit an |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
* receive flow control. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
* The "Case" statement below enables/disable flow control |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
* according to the "hw->fc" parameter. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
* The possible values of the "fc" parameter are: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
* 0: Flow control is completely disabled |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
* 1: Rx flow control is enabled (we can receive pause |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
* frames but not send pause frames). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
* 2: Tx flow control is enabled (we can send pause frames |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
* frames but we do not receive pause frames). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
* 3: Both Rx and TX flow control (symmetric) is enabled. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
* other: No other values should be possible at this point. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
switch (hw->fc) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
case E1000_FC_NONE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
case E1000_FC_RX_PAUSE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2057 |
ctrl &= (~E1000_CTRL_TFCE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2058 |
ctrl |= E1000_CTRL_RFCE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2059 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2060 |
case E1000_FC_TX_PAUSE: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2061 |
ctrl &= (~E1000_CTRL_RFCE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2062 |
ctrl |= E1000_CTRL_TFCE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2063 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2064 |
case E1000_FC_FULL: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2065 |
ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2066 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2067 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2068 |
e_dbg("Flow control param set incorrectly\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2069 |
return -E1000_ERR_CONFIG; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2070 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2071 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2072 |
/* Disable TX Flow Control for 82542 (rev 2.0) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2073 |
if (hw->mac_type == e1000_82542_rev2_0) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2074 |
ctrl &= (~E1000_CTRL_TFCE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2075 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2076 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2077 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2078 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2079 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2080 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2081 |
* e1000_config_fc_after_link_up - configure flow control after autoneg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2082 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2083 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2084 |
* Configures flow control settings after link is established |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2085 |
* Should be called immediately after a valid link has been established. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2086 |
* Forces MAC flow control settings if link was forced. When in MII/GMII mode |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2087 |
* and autonegotiation is enabled, the MAC flow control settings will be set |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2088 |
* based on the flow control negotiated by the PHY. In TBI mode, the TFCE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2089 |
* and RFCE bits will be automatically set to the negotiated flow control mode. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2090 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2091 |
static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2092 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2093 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2094 |
u16 mii_status_reg; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2095 |
u16 mii_nway_adv_reg; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2096 |
u16 mii_nway_lp_ability_reg; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2097 |
u16 speed; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2098 |
u16 duplex; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2099 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2100 |
e_dbg("e1000_config_fc_after_link_up"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2101 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2102 |
/* Check for the case where we have fiber media and auto-neg failed |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2103 |
* so we had to force link. In this case, we need to force the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2104 |
* configuration of the MAC to match the "fc" parameter. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2105 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2106 |
if (((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2107 |
|| ((hw->media_type == e1000_media_type_internal_serdes) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2108 |
&& (hw->autoneg_failed)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2109 |
|| ((hw->media_type == e1000_media_type_copper) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2110 |
&& (!hw->autoneg))) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2111 |
ret_val = e1000_force_mac_fc(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2112 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2113 |
e_dbg("Error forcing flow control settings\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2114 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2115 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2116 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2117 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2118 |
/* Check for the case where we have copper media and auto-neg is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2119 |
* enabled. In this case, we need to check and see if Auto-Neg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2120 |
* has completed, and if so, how the PHY and link partner has |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2121 |
* flow control configured. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2122 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2123 |
if ((hw->media_type == e1000_media_type_copper) && hw->autoneg) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2124 |
/* Read the MII Status Register and check to see if AutoNeg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2125 |
* has completed. We read this twice because this reg has |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2126 |
* some "sticky" (latched) bits. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2127 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2128 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2129 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2130 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2131 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2132 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2133 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2134 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2135 |
if (mii_status_reg & MII_SR_AUTONEG_COMPLETE) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2136 |
/* The AutoNeg process has completed, so we now need to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2137 |
* read both the Auto Negotiation Advertisement Register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2138 |
* (Address 4) and the Auto_Negotiation Base Page Ability |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2139 |
* Register (Address 5) to determine how flow control was |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2140 |
* negotiated. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2141 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2142 |
ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2143 |
&mii_nway_adv_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2144 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2145 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2146 |
ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2147 |
&mii_nway_lp_ability_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2148 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2149 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2150 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2151 |
/* Two bits in the Auto Negotiation Advertisement Register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2152 |
* (Address 4) and two bits in the Auto Negotiation Base |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2153 |
* Page Ability Register (Address 5) determine flow control |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2154 |
* for both the PHY and the link partner. The following |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2155 |
* table, taken out of the IEEE 802.3ab/D6.0 dated March 25, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2156 |
* 1999, describes these PAUSE resolution bits and how flow |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2157 |
* control is determined based upon these settings. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2158 |
* NOTE: DC = Don't Care |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2159 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2160 |
* LOCAL DEVICE | LINK PARTNER |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2161 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | NIC Resolution |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2162 |
*-------|---------|-------|---------|-------------------- |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2163 |
* 0 | 0 | DC | DC | E1000_FC_NONE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2164 |
* 0 | 1 | 0 | DC | E1000_FC_NONE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2165 |
* 0 | 1 | 1 | 0 | E1000_FC_NONE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2166 |
* 0 | 1 | 1 | 1 | E1000_FC_TX_PAUSE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2167 |
* 1 | 0 | 0 | DC | E1000_FC_NONE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2168 |
* 1 | DC | 1 | DC | E1000_FC_FULL |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2169 |
* 1 | 1 | 0 | 0 | E1000_FC_NONE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2170 |
* 1 | 1 | 0 | 1 | E1000_FC_RX_PAUSE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2171 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2172 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2173 |
/* Are both PAUSE bits set to 1? If so, this implies |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2174 |
* Symmetric Flow Control is enabled at both ends. The |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2175 |
* ASM_DIR bits are irrelevant per the spec. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2176 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2177 |
* For Symmetric Flow Control: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2178 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2179 |
* LOCAL DEVICE | LINK PARTNER |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2180 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2181 |
*-------|---------|-------|---------|-------------------- |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2182 |
* 1 | DC | 1 | DC | E1000_FC_FULL |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2183 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2184 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2185 |
if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2186 |
(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2187 |
/* Now we need to check if the user selected RX ONLY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2188 |
* of pause frames. In this case, we had to advertise |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2189 |
* FULL flow control because we could not advertise RX |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2190 |
* ONLY. Hence, we must now check to see if we need to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2191 |
* turn OFF the TRANSMISSION of PAUSE frames. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2192 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2193 |
if (hw->original_fc == E1000_FC_FULL) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2194 |
hw->fc = E1000_FC_FULL; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2195 |
e_dbg("Flow Control = FULL.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2196 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2197 |
hw->fc = E1000_FC_RX_PAUSE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2198 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2199 |
("Flow Control = RX PAUSE frames only.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2200 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2201 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2202 |
/* For receiving PAUSE frames ONLY. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2203 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2204 |
* LOCAL DEVICE | LINK PARTNER |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2205 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2206 |
*-------|---------|-------|---------|-------------------- |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2207 |
* 0 | 1 | 1 | 1 | E1000_FC_TX_PAUSE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2208 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2209 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2210 |
else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2211 |
(mii_nway_adv_reg & NWAY_AR_ASM_DIR) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2212 |
(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2213 |
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2214 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2215 |
hw->fc = E1000_FC_TX_PAUSE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2216 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2217 |
("Flow Control = TX PAUSE frames only.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2218 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2219 |
/* For transmitting PAUSE frames ONLY. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2220 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2221 |
* LOCAL DEVICE | LINK PARTNER |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2222 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2223 |
*-------|---------|-------|---------|-------------------- |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2224 |
* 1 | 1 | 0 | 1 | E1000_FC_RX_PAUSE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2225 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2226 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2227 |
else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2228 |
(mii_nway_adv_reg & NWAY_AR_ASM_DIR) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2229 |
!(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2230 |
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2231 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2232 |
hw->fc = E1000_FC_RX_PAUSE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2233 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2234 |
("Flow Control = RX PAUSE frames only.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2235 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2236 |
/* Per the IEEE spec, at this point flow control should be |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2237 |
* disabled. However, we want to consider that we could |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2238 |
* be connected to a legacy switch that doesn't advertise |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2239 |
* desired flow control, but can be forced on the link |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2240 |
* partner. So if we advertised no flow control, that is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2241 |
* what we will resolve to. If we advertised some kind of |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2242 |
* receive capability (Rx Pause Only or Full Flow Control) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2243 |
* and the link partner advertised none, we will configure |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2244 |
* ourselves to enable Rx Flow Control only. We can do |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2245 |
* this safely for two reasons: If the link partner really |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2246 |
* didn't want flow control enabled, and we enable Rx, no |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2247 |
* harm done since we won't be receiving any PAUSE frames |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2248 |
* anyway. If the intent on the link partner was to have |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2249 |
* flow control enabled, then by us enabling RX only, we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2250 |
* can at least receive pause frames and process them. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2251 |
* This is a good idea because in most cases, since we are |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2252 |
* predominantly a server NIC, more times than not we will |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2253 |
* be asked to delay transmission of packets than asking |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2254 |
* our link partner to pause transmission of frames. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2255 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2256 |
else if ((hw->original_fc == E1000_FC_NONE || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2257 |
hw->original_fc == E1000_FC_TX_PAUSE) || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2258 |
hw->fc_strict_ieee) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2259 |
hw->fc = E1000_FC_NONE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2260 |
e_dbg("Flow Control = NONE.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2261 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2262 |
hw->fc = E1000_FC_RX_PAUSE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2263 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2264 |
("Flow Control = RX PAUSE frames only.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2265 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2266 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2267 |
/* Now we need to do one last check... If we auto- |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2268 |
* negotiated to HALF DUPLEX, flow control should not be |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2269 |
* enabled per IEEE 802.3 spec. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2270 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2271 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2272 |
e1000_get_speed_and_duplex(hw, &speed, &duplex); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2273 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2274 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2275 |
("Error getting link speed and duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2276 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2277 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2278 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2279 |
if (duplex == HALF_DUPLEX) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2280 |
hw->fc = E1000_FC_NONE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2281 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2282 |
/* Now we call a subroutine to actually force the MAC |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2283 |
* controller to use the correct flow control settings. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2284 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2285 |
ret_val = e1000_force_mac_fc(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2286 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2287 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2288 |
("Error forcing flow control settings\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2289 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2290 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2291 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2292 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2293 |
("Copper PHY and Auto Neg has not completed.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2294 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2295 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2296 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2297 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2298 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2299 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2300 |
* e1000_check_for_serdes_link_generic - Check for link (Serdes) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2301 |
* @hw: pointer to the HW structure |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2302 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2303 |
* Checks for link up on the hardware. If link is not up and we have |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2304 |
* a signal, then we need to force link up. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2305 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2306 |
static s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2307 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2308 |
u32 rxcw; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2309 |
u32 ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2310 |
u32 status; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2311 |
s32 ret_val = E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2312 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2313 |
e_dbg("e1000_check_for_serdes_link_generic"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2314 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2315 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2316 |
status = er32(STATUS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2317 |
rxcw = er32(RXCW); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2318 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2319 |
/* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2320 |
* If we don't have link (auto-negotiation failed or link partner |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2321 |
* cannot auto-negotiate), and our link partner is not trying to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2322 |
* auto-negotiate with us (we are receiving idles or data), |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2323 |
* we need to force link up. We also need to give auto-negotiation |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2324 |
* time to complete. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2325 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2326 |
/* (ctrl & E1000_CTRL_SWDPIN1) == 1 == have signal */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2327 |
if ((!(status & E1000_STATUS_LU)) && (!(rxcw & E1000_RXCW_C))) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2328 |
if (hw->autoneg_failed == 0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2329 |
hw->autoneg_failed = 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2330 |
goto out; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2331 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2332 |
e_dbg("NOT RXing /C/, disable AutoNeg and force link.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2333 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2334 |
/* Disable auto-negotiation in the TXCW register */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2335 |
ew32(TXCW, (hw->txcw & ~E1000_TXCW_ANE)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2336 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2337 |
/* Force link-up and also force full-duplex. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2338 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2339 |
ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2340 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2341 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2342 |
/* Configure Flow Control after forcing link up. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2343 |
ret_val = e1000_config_fc_after_link_up(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2344 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2345 |
e_dbg("Error configuring flow control\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2346 |
goto out; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2347 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2348 |
} else if ((ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2349 |
/* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2350 |
* If we are forcing link and we are receiving /C/ ordered |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2351 |
* sets, re-enable auto-negotiation in the TXCW register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2352 |
* and disable forced link in the Device Control register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2353 |
* in an attempt to auto-negotiate with our link partner. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2354 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2355 |
e_dbg("RXing /C/, enable AutoNeg and stop forcing link.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2356 |
ew32(TXCW, hw->txcw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2357 |
ew32(CTRL, (ctrl & ~E1000_CTRL_SLU)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2358 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2359 |
hw->serdes_has_link = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2360 |
} else if (!(E1000_TXCW_ANE & er32(TXCW))) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2361 |
/* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2362 |
* If we force link for non-auto-negotiation switch, check |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2363 |
* link status based on MAC synchronization for internal |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2364 |
* serdes media type. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2365 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2366 |
/* SYNCH bit and IV bit are sticky. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2367 |
udelay(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2368 |
rxcw = er32(RXCW); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2369 |
if (rxcw & E1000_RXCW_SYNCH) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2370 |
if (!(rxcw & E1000_RXCW_IV)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2371 |
hw->serdes_has_link = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2372 |
e_dbg("SERDES: Link up - forced.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2373 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2374 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2375 |
hw->serdes_has_link = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2376 |
e_dbg("SERDES: Link down - force failed.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2377 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2378 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2379 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2380 |
if (E1000_TXCW_ANE & er32(TXCW)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2381 |
status = er32(STATUS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2382 |
if (status & E1000_STATUS_LU) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2383 |
/* SYNCH bit and IV bit are sticky, so reread rxcw. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2384 |
udelay(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2385 |
rxcw = er32(RXCW); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2386 |
if (rxcw & E1000_RXCW_SYNCH) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2387 |
if (!(rxcw & E1000_RXCW_IV)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2388 |
hw->serdes_has_link = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2389 |
e_dbg("SERDES: Link up - autoneg " |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2390 |
"completed successfully.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2391 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2392 |
hw->serdes_has_link = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2393 |
e_dbg("SERDES: Link down - invalid" |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2394 |
"codewords detected in autoneg.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2395 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2396 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2397 |
hw->serdes_has_link = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2398 |
e_dbg("SERDES: Link down - no sync.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2399 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2400 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2401 |
hw->serdes_has_link = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2402 |
e_dbg("SERDES: Link down - autoneg failed\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2403 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2404 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2405 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2406 |
out: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2407 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2408 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2409 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2410 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2411 |
* e1000_check_for_link |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2412 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2413 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2414 |
* Checks to see if the link status of the hardware has changed. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2415 |
* Called by any function that needs to check the link status of the adapter. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2416 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2417 |
s32 e1000_check_for_link(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2418 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2419 |
u32 rxcw __attribute__ ((unused)) = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2420 |
u32 ctrl __attribute__ ((unused)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2421 |
u32 status; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2422 |
u32 rctl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2423 |
u32 icr; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2424 |
u32 signal __attribute__ ((unused)) = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2425 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2426 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2427 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2428 |
e_dbg("e1000_check_for_link"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2429 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2430 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2431 |
status = er32(STATUS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2432 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2433 |
/* On adapters with a MAC newer than 82544, SW Definable pin 1 will be |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2434 |
* set when the optics detect a signal. On older adapters, it will be |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2435 |
* cleared when there is a signal. This applies to fiber media only. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2436 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2437 |
if ((hw->media_type == e1000_media_type_fiber) || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2438 |
(hw->media_type == e1000_media_type_internal_serdes)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2439 |
rxcw = er32(RXCW); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2440 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2441 |
if (hw->media_type == e1000_media_type_fiber) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2442 |
signal = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2443 |
(hw->mac_type > |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2444 |
e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2445 |
if (status & E1000_STATUS_LU) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2446 |
hw->get_link_status = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2447 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2448 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2449 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2450 |
/* If we have a copper PHY then we only want to go out to the PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2451 |
* registers to see if Auto-Neg has completed and/or if our link |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2452 |
* status has changed. The get_link_status flag will be set if we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2453 |
* receive a Link Status Change interrupt or we have Rx Sequence |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2454 |
* Errors. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2455 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2456 |
if ((hw->media_type == e1000_media_type_copper) && hw->get_link_status) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2457 |
/* First we want to see if the MII Status Register reports |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2458 |
* link. If so, then we want to get the current speed/duplex |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2459 |
* of the PHY. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2460 |
* Read the register twice since the link bit is sticky. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2461 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2462 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2463 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2464 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2465 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2466 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2467 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2468 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2469 |
if (phy_data & MII_SR_LINK_STATUS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2470 |
hw->get_link_status = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2471 |
/* Check if there was DownShift, must be checked immediately after |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2472 |
* link-up */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2473 |
e1000_check_downshift(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2474 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2475 |
/* If we are on 82544 or 82543 silicon and speed/duplex |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2476 |
* are forced to 10H or 10F, then we will implement the polarity |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2477 |
* reversal workaround. We disable interrupts first, and upon |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2478 |
* returning, place the devices interrupt state to its previous |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2479 |
* value except for the link status change interrupt which will |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2480 |
* happen due to the execution of this workaround. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2481 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2482 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2483 |
if ((hw->mac_type == e1000_82544 |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2484 |
|| hw->mac_type == e1000_82543) && (!hw->autoneg) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2485 |
&& (hw->forced_speed_duplex == e1000_10_full |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2486 |
|| hw->forced_speed_duplex == e1000_10_half)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2487 |
ew32(IMC, 0xffffffff); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2488 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2489 |
e1000_polarity_reversal_workaround(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2490 |
icr = er32(ICR); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2491 |
ew32(ICS, (icr & ~E1000_ICS_LSC)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2492 |
ew32(IMS, IMS_ENABLE_MASK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2493 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2494 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2495 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2496 |
/* No link detected */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2497 |
e1000_config_dsp_after_link_change(hw, false); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2498 |
return 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2499 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2500 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2501 |
/* If we are forcing speed/duplex, then we simply return since |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2502 |
* we have already determined whether we have link or not. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2503 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2504 |
if (!hw->autoneg) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2505 |
return -E1000_ERR_CONFIG; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2506 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2507 |
/* optimize the dsp settings for the igp phy */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2508 |
e1000_config_dsp_after_link_change(hw, true); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2509 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2510 |
/* We have a M88E1000 PHY and Auto-Neg is enabled. If we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2511 |
* have Si on board that is 82544 or newer, Auto |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2512 |
* Speed Detection takes care of MAC speed/duplex |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2513 |
* configuration. So we only need to configure Collision |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2514 |
* Distance in the MAC. Otherwise, we need to force |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2515 |
* speed/duplex on the MAC to the current PHY speed/duplex |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2516 |
* settings. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2517 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2518 |
if ((hw->mac_type >= e1000_82544) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2519 |
(hw->mac_type != e1000_ce4100)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2520 |
e1000_config_collision_dist(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2521 |
else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2522 |
ret_val = e1000_config_mac_to_phy(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2523 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2524 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2525 |
("Error configuring MAC to PHY settings\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2526 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2527 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2528 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2529 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2530 |
/* Configure Flow Control now that Auto-Neg has completed. First, we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2531 |
* need to restore the desired flow control settings because we may |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2532 |
* have had to re-autoneg with a different link partner. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2533 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2534 |
ret_val = e1000_config_fc_after_link_up(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2535 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2536 |
e_dbg("Error configuring flow control\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2537 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2538 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2539 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2540 |
/* At this point we know that we are on copper and we have |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2541 |
* auto-negotiated link. These are conditions for checking the link |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2542 |
* partner capability register. We use the link speed to determine if |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2543 |
* TBI compatibility needs to be turned on or off. If the link is not |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2544 |
* at gigabit speed, then TBI compatibility is not needed. If we are |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2545 |
* at gigabit speed, we turn on TBI compatibility. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2546 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2547 |
if (hw->tbi_compatibility_en) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2548 |
u16 speed, duplex; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2549 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2550 |
e1000_get_speed_and_duplex(hw, &speed, &duplex); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2551 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2552 |
e_dbg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2553 |
("Error getting link speed and duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2554 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2555 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2556 |
if (speed != SPEED_1000) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2557 |
/* If link speed is not set to gigabit speed, we do not need |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2558 |
* to enable TBI compatibility. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2559 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2560 |
if (hw->tbi_compatibility_on) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2561 |
/* If we previously were in the mode, turn it off. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2562 |
rctl = er32(RCTL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2563 |
rctl &= ~E1000_RCTL_SBP; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2564 |
ew32(RCTL, rctl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2565 |
hw->tbi_compatibility_on = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2566 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2567 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2568 |
/* If TBI compatibility is was previously off, turn it on. For |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2569 |
* compatibility with a TBI link partner, we will store bad |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2570 |
* packets. Some frames have an additional byte on the end and |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2571 |
* will look like CRC errors to to the hardware. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2572 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2573 |
if (!hw->tbi_compatibility_on) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2574 |
hw->tbi_compatibility_on = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2575 |
rctl = er32(RCTL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2576 |
rctl |= E1000_RCTL_SBP; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2577 |
ew32(RCTL, rctl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2578 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2579 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2580 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2581 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2582 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2583 |
if ((hw->media_type == e1000_media_type_fiber) || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2584 |
(hw->media_type == e1000_media_type_internal_serdes)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2585 |
e1000_check_for_serdes_link_generic(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2586 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2587 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2588 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2589 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2590 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2591 |
* e1000_get_speed_and_duplex |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2592 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2593 |
* @speed: Speed of the connection |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2594 |
* @duplex: Duplex setting of the connection |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2595 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2596 |
* Detects the current speed and duplex settings of the hardware. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2597 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2598 |
s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2599 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2600 |
u32 status; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2601 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2602 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2603 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2604 |
e_dbg("e1000_get_speed_and_duplex"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2605 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2606 |
if (hw->mac_type >= e1000_82543) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2607 |
status = er32(STATUS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2608 |
if (status & E1000_STATUS_SPEED_1000) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2609 |
*speed = SPEED_1000; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2610 |
e_dbg("1000 Mbs, "); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2611 |
} else if (status & E1000_STATUS_SPEED_100) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2612 |
*speed = SPEED_100; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2613 |
e_dbg("100 Mbs, "); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2614 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2615 |
*speed = SPEED_10; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2616 |
e_dbg("10 Mbs, "); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2617 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2618 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2619 |
if (status & E1000_STATUS_FD) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2620 |
*duplex = FULL_DUPLEX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2621 |
e_dbg("Full Duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2622 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2623 |
*duplex = HALF_DUPLEX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2624 |
e_dbg(" Half Duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2625 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2626 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2627 |
e_dbg("1000 Mbs, Full Duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2628 |
*speed = SPEED_1000; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2629 |
*duplex = FULL_DUPLEX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2630 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2631 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2632 |
/* IGP01 PHY may advertise full duplex operation after speed downgrade even |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2633 |
* if it is operating at half duplex. Here we set the duplex settings to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2634 |
* match the duplex in the link partner's capabilities. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2635 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2636 |
if (hw->phy_type == e1000_phy_igp && hw->speed_downgraded) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2637 |
ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2638 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2639 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2640 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2641 |
if (!(phy_data & NWAY_ER_LP_NWAY_CAPS)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2642 |
*duplex = HALF_DUPLEX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2643 |
else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2644 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2645 |
e1000_read_phy_reg(hw, PHY_LP_ABILITY, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2646 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2647 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2648 |
if ((*speed == SPEED_100 |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2649 |
&& !(phy_data & NWAY_LPAR_100TX_FD_CAPS)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2650 |
|| (*speed == SPEED_10 |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2651 |
&& !(phy_data & NWAY_LPAR_10T_FD_CAPS))) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2652 |
*duplex = HALF_DUPLEX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2653 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2654 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2655 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2656 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2657 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2658 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2659 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2660 |
* e1000_wait_autoneg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2661 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2662 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2663 |
* Blocks until autoneg completes or times out (~4.5 seconds) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2664 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2665 |
static s32 e1000_wait_autoneg(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2666 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2667 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2668 |
u16 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2669 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2670 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2671 |
e_dbg("e1000_wait_autoneg"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2672 |
e_dbg("Waiting for Auto-Neg to complete.\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2673 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2674 |
/* We will wait for autoneg to complete or 4.5 seconds to expire. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2675 |
for (i = PHY_AUTO_NEG_TIME; i > 0; i--) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2676 |
/* Read the MII Status Register and wait for Auto-Neg |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2677 |
* Complete bit to be set. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2678 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2679 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2680 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2681 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2682 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2683 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2684 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2685 |
if (phy_data & MII_SR_AUTONEG_COMPLETE) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2686 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2687 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2688 |
msleep(100); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2689 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2690 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2691 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2692 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2693 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2694 |
* e1000_raise_mdi_clk - Raises the Management Data Clock |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2695 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2696 |
* @ctrl: Device control register's current value |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2697 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2698 |
static void e1000_raise_mdi_clk(struct e1000_hw *hw, u32 *ctrl) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2699 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2700 |
/* Raise the clock input to the Management Data Clock (by setting the MDC |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2701 |
* bit), and then delay 10 microseconds. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2702 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2703 |
ew32(CTRL, (*ctrl | E1000_CTRL_MDC)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2704 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2705 |
udelay(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2706 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2707 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2708 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2709 |
* e1000_lower_mdi_clk - Lowers the Management Data Clock |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2710 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2711 |
* @ctrl: Device control register's current value |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2712 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2713 |
static void e1000_lower_mdi_clk(struct e1000_hw *hw, u32 *ctrl) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2714 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2715 |
/* Lower the clock input to the Management Data Clock (by clearing the MDC |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2716 |
* bit), and then delay 10 microseconds. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2717 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2718 |
ew32(CTRL, (*ctrl & ~E1000_CTRL_MDC)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2719 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2720 |
udelay(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2721 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2722 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2723 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2724 |
* e1000_shift_out_mdi_bits - Shifts data bits out to the PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2725 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2726 |
* @data: Data to send out to the PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2727 |
* @count: Number of bits to shift out |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2728 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2729 |
* Bits are shifted out in MSB to LSB order. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2730 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2731 |
static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, u32 data, u16 count) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2732 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2733 |
u32 ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2734 |
u32 mask; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2735 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2736 |
/* We need to shift "count" number of bits out to the PHY. So, the value |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2737 |
* in the "data" parameter will be shifted out to the PHY one bit at a |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2738 |
* time. In order to do this, "data" must be broken down into bits. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2739 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2740 |
mask = 0x01; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2741 |
mask <<= (count - 1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2742 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2743 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2744 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2745 |
/* Set MDIO_DIR and MDC_DIR direction bits to be used as output pins. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2746 |
ctrl |= (E1000_CTRL_MDIO_DIR | E1000_CTRL_MDC_DIR); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2747 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2748 |
while (mask) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2749 |
/* A "1" is shifted out to the PHY by setting the MDIO bit to "1" and |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2750 |
* then raising and lowering the Management Data Clock. A "0" is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2751 |
* shifted out to the PHY by setting the MDIO bit to "0" and then |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2752 |
* raising and lowering the clock. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2753 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2754 |
if (data & mask) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2755 |
ctrl |= E1000_CTRL_MDIO; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2756 |
else |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2757 |
ctrl &= ~E1000_CTRL_MDIO; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2758 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2759 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2760 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2761 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2762 |
udelay(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2763 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2764 |
e1000_raise_mdi_clk(hw, &ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2765 |
e1000_lower_mdi_clk(hw, &ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2766 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2767 |
mask = mask >> 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2768 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2769 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2770 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2771 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2772 |
* e1000_shift_in_mdi_bits - Shifts data bits in from the PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2773 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2774 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2775 |
* Bits are shifted in in MSB to LSB order. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2776 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2777 |
static u16 e1000_shift_in_mdi_bits(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2778 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2779 |
u32 ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2780 |
u16 data = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2781 |
u8 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2782 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2783 |
/* In order to read a register from the PHY, we need to shift in a total |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2784 |
* of 18 bits from the PHY. The first two bit (turnaround) times are used |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2785 |
* to avoid contention on the MDIO pin when a read operation is performed. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2786 |
* These two bits are ignored by us and thrown away. Bits are "shifted in" |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2787 |
* by raising the input to the Management Data Clock (setting the MDC bit), |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2788 |
* and then reading the value of the MDIO bit. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2789 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2790 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2791 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2792 |
/* Clear MDIO_DIR (SWDPIO1) to indicate this bit is to be used as input. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2793 |
ctrl &= ~E1000_CTRL_MDIO_DIR; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2794 |
ctrl &= ~E1000_CTRL_MDIO; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2795 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2796 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2797 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2798 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2799 |
/* Raise and Lower the clock before reading in the data. This accounts for |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2800 |
* the turnaround bits. The first clock occurred when we clocked out the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2801 |
* last bit of the Register Address. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2802 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2803 |
e1000_raise_mdi_clk(hw, &ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2804 |
e1000_lower_mdi_clk(hw, &ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2805 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2806 |
for (data = 0, i = 0; i < 16; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2807 |
data = data << 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2808 |
e1000_raise_mdi_clk(hw, &ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2809 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2810 |
/* Check to see if we shifted in a "1". */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2811 |
if (ctrl & E1000_CTRL_MDIO) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2812 |
data |= 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2813 |
e1000_lower_mdi_clk(hw, &ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2814 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2815 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2816 |
e1000_raise_mdi_clk(hw, &ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2817 |
e1000_lower_mdi_clk(hw, &ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2818 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2819 |
return data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2820 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2821 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2822 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2823 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2824 |
* e1000_read_phy_reg - read a phy register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2825 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2826 |
* @reg_addr: address of the PHY register to read |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2827 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2828 |
* Reads the value from a PHY register, if the value is on a specific non zero |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2829 |
* page, sets the page first. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2830 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2831 |
s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 reg_addr, u16 *phy_data) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2832 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2833 |
u32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2834 |
unsigned long flags; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2835 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2836 |
e_dbg("e1000_read_phy_reg"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2837 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2838 |
spin_lock_irqsave(&e1000_phy_lock, flags); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2839 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2840 |
if ((hw->phy_type == e1000_phy_igp) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2841 |
(reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2842 |
ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2843 |
(u16) reg_addr); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2844 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2845 |
spin_unlock_irqrestore(&e1000_phy_lock, flags); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2846 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2847 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2848 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2849 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2850 |
ret_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2851 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2852 |
spin_unlock_irqrestore(&e1000_phy_lock, flags); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2853 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2854 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2855 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2856 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2857 |
static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2858 |
u16 *phy_data) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2859 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2860 |
u32 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2861 |
u32 mdic = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2862 |
const u32 phy_addr = (hw->mac_type == e1000_ce4100) ? hw->phy_addr : 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2863 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2864 |
e_dbg("e1000_read_phy_reg_ex"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2865 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2866 |
if (reg_addr > MAX_PHY_REG_ADDRESS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2867 |
e_dbg("PHY Address %d is out of range\n", reg_addr); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2868 |
return -E1000_ERR_PARAM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2869 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2870 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2871 |
if (hw->mac_type > e1000_82543) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2872 |
/* Set up Op-code, Phy Address, and register address in the MDI |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2873 |
* Control register. The MAC will take care of interfacing with the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2874 |
* PHY to retrieve the desired data. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2875 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2876 |
if (hw->mac_type == e1000_ce4100) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2877 |
mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2878 |
(phy_addr << E1000_MDIC_PHY_SHIFT) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2879 |
(INTEL_CE_GBE_MDIC_OP_READ) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2880 |
(INTEL_CE_GBE_MDIC_GO)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2881 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2882 |
writel(mdic, E1000_MDIO_CMD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2883 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2884 |
/* Poll the ready bit to see if the MDI read |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2885 |
* completed |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2886 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2887 |
for (i = 0; i < 64; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2888 |
udelay(50); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2889 |
mdic = readl(E1000_MDIO_CMD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2890 |
if (!(mdic & INTEL_CE_GBE_MDIC_GO)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2891 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2892 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2893 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2894 |
if (mdic & INTEL_CE_GBE_MDIC_GO) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2895 |
e_dbg("MDI Read did not complete\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2896 |
return -E1000_ERR_PHY; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2897 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2898 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2899 |
mdic = readl(E1000_MDIO_STS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2900 |
if (mdic & INTEL_CE_GBE_MDIC_READ_ERROR) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2901 |
e_dbg("MDI Read Error\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2902 |
return -E1000_ERR_PHY; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2903 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2904 |
*phy_data = (u16) mdic; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2905 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2906 |
mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2907 |
(phy_addr << E1000_MDIC_PHY_SHIFT) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2908 |
(E1000_MDIC_OP_READ)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2909 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2910 |
ew32(MDIC, mdic); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2911 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2912 |
/* Poll the ready bit to see if the MDI read |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2913 |
* completed |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2914 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2915 |
for (i = 0; i < 64; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2916 |
udelay(50); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2917 |
mdic = er32(MDIC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2918 |
if (mdic & E1000_MDIC_READY) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2919 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2920 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2921 |
if (!(mdic & E1000_MDIC_READY)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2922 |
e_dbg("MDI Read did not complete\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2923 |
return -E1000_ERR_PHY; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2924 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2925 |
if (mdic & E1000_MDIC_ERROR) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2926 |
e_dbg("MDI Error\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2927 |
return -E1000_ERR_PHY; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2928 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2929 |
*phy_data = (u16) mdic; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2930 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2931 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2932 |
/* We must first send a preamble through the MDIO pin to signal the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2933 |
* beginning of an MII instruction. This is done by sending 32 |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2934 |
* consecutive "1" bits. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2935 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2936 |
e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2937 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2938 |
/* Now combine the next few fields that are required for a read |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2939 |
* operation. We use this method instead of calling the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2940 |
* e1000_shift_out_mdi_bits routine five different times. The format of |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2941 |
* a MII read instruction consists of a shift out of 14 bits and is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2942 |
* defined as follows: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2943 |
* <Preamble><SOF><Op Code><Phy Addr><Reg Addr> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2944 |
* followed by a shift in of 18 bits. This first two bits shifted in |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2945 |
* are TurnAround bits used to avoid contention on the MDIO pin when a |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2946 |
* READ operation is performed. These two bits are thrown away |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2947 |
* followed by a shift in of 16 bits which contains the desired data. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2948 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2949 |
mdic = ((reg_addr) | (phy_addr << 5) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2950 |
(PHY_OP_READ << 10) | (PHY_SOF << 12)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2951 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2952 |
e1000_shift_out_mdi_bits(hw, mdic, 14); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2953 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2954 |
/* Now that we've shifted out the read command to the MII, we need to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2955 |
* "shift in" the 16-bit value (18 total bits) of the requested PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2956 |
* register address. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2957 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2958 |
*phy_data = e1000_shift_in_mdi_bits(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2959 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2960 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2961 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2962 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2963 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2964 |
* e1000_write_phy_reg - write a phy register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2965 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2966 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2967 |
* @reg_addr: address of the PHY register to write |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2968 |
* @data: data to write to the PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2969 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2970 |
* Writes a value to a PHY register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2971 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2972 |
s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 reg_addr, u16 phy_data) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2973 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2974 |
u32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2975 |
unsigned long flags; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2976 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2977 |
e_dbg("e1000_write_phy_reg"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2978 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2979 |
spin_lock_irqsave(&e1000_phy_lock, flags); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2980 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2981 |
if ((hw->phy_type == e1000_phy_igp) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2982 |
(reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2983 |
ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2984 |
(u16) reg_addr); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2985 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2986 |
spin_unlock_irqrestore(&e1000_phy_lock, flags); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2987 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2988 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2989 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2990 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2991 |
ret_val = e1000_write_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2992 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2993 |
spin_unlock_irqrestore(&e1000_phy_lock, flags); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2994 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2995 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2996 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2997 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2998 |
static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2999 |
u16 phy_data) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3000 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3001 |
u32 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3002 |
u32 mdic = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3003 |
const u32 phy_addr = (hw->mac_type == e1000_ce4100) ? hw->phy_addr : 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3004 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3005 |
e_dbg("e1000_write_phy_reg_ex"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3006 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3007 |
if (reg_addr > MAX_PHY_REG_ADDRESS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3008 |
e_dbg("PHY Address %d is out of range\n", reg_addr); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3009 |
return -E1000_ERR_PARAM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3010 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3011 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3012 |
if (hw->mac_type > e1000_82543) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3013 |
/* Set up Op-code, Phy Address, register address, and data |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3014 |
* intended for the PHY register in the MDI Control register. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3015 |
* The MAC will take care of interfacing with the PHY to send |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3016 |
* the desired data. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3017 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3018 |
if (hw->mac_type == e1000_ce4100) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3019 |
mdic = (((u32) phy_data) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3020 |
(reg_addr << E1000_MDIC_REG_SHIFT) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3021 |
(phy_addr << E1000_MDIC_PHY_SHIFT) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3022 |
(INTEL_CE_GBE_MDIC_OP_WRITE) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3023 |
(INTEL_CE_GBE_MDIC_GO)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3024 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3025 |
writel(mdic, E1000_MDIO_CMD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3026 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3027 |
/* Poll the ready bit to see if the MDI read |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3028 |
* completed |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3029 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3030 |
for (i = 0; i < 640; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3031 |
udelay(5); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3032 |
mdic = readl(E1000_MDIO_CMD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3033 |
if (!(mdic & INTEL_CE_GBE_MDIC_GO)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3034 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3035 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3036 |
if (mdic & INTEL_CE_GBE_MDIC_GO) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3037 |
e_dbg("MDI Write did not complete\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3038 |
return -E1000_ERR_PHY; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3039 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3040 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3041 |
mdic = (((u32) phy_data) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3042 |
(reg_addr << E1000_MDIC_REG_SHIFT) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3043 |
(phy_addr << E1000_MDIC_PHY_SHIFT) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3044 |
(E1000_MDIC_OP_WRITE)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3045 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3046 |
ew32(MDIC, mdic); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3047 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3048 |
/* Poll the ready bit to see if the MDI read |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3049 |
* completed |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3050 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3051 |
for (i = 0; i < 641; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3052 |
udelay(5); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3053 |
mdic = er32(MDIC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3054 |
if (mdic & E1000_MDIC_READY) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3055 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3056 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3057 |
if (!(mdic & E1000_MDIC_READY)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3058 |
e_dbg("MDI Write did not complete\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3059 |
return -E1000_ERR_PHY; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3060 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3061 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3062 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3063 |
/* We'll need to use the SW defined pins to shift the write command |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3064 |
* out to the PHY. We first send a preamble to the PHY to signal the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3065 |
* beginning of the MII instruction. This is done by sending 32 |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3066 |
* consecutive "1" bits. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3067 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3068 |
e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3069 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3070 |
/* Now combine the remaining required fields that will indicate a |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3071 |
* write operation. We use this method instead of calling the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3072 |
* e1000_shift_out_mdi_bits routine for each field in the command. The |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3073 |
* format of a MII write instruction is as follows: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3074 |
* <Preamble><SOF><Op Code><Phy Addr><Reg Addr><Turnaround><Data>. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3075 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3076 |
mdic = ((PHY_TURNAROUND) | (reg_addr << 2) | (phy_addr << 7) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3077 |
(PHY_OP_WRITE << 12) | (PHY_SOF << 14)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3078 |
mdic <<= 16; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3079 |
mdic |= (u32) phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3080 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3081 |
e1000_shift_out_mdi_bits(hw, mdic, 32); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3082 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3083 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3084 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3085 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3086 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3087 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3088 |
* e1000_phy_hw_reset - reset the phy, hardware style |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3089 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3090 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3091 |
* Returns the PHY to the power-on reset state |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3092 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3093 |
s32 e1000_phy_hw_reset(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3094 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3095 |
u32 ctrl, ctrl_ext; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3096 |
u32 led_ctrl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3097 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3098 |
e_dbg("e1000_phy_hw_reset"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3099 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3100 |
e_dbg("Resetting Phy...\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3101 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3102 |
if (hw->mac_type > e1000_82543) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3103 |
/* Read the device control register and assert the E1000_CTRL_PHY_RST |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3104 |
* bit. Then, take it out of reset. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3105 |
* For e1000 hardware, we delay for 10ms between the assert |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3106 |
* and deassert. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3107 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3108 |
ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3109 |
ew32(CTRL, ctrl | E1000_CTRL_PHY_RST); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3110 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3111 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3112 |
msleep(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3113 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3114 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3115 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3116 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3117 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3118 |
/* Read the Extended Device Control Register, assert the PHY_RESET_DIR |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3119 |
* bit to put the PHY into reset. Then, take it out of reset. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3120 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3121 |
ctrl_ext = er32(CTRL_EXT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3122 |
ctrl_ext |= E1000_CTRL_EXT_SDP4_DIR; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3123 |
ctrl_ext &= ~E1000_CTRL_EXT_SDP4_DATA; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3124 |
ew32(CTRL_EXT, ctrl_ext); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3125 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3126 |
msleep(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3127 |
ctrl_ext |= E1000_CTRL_EXT_SDP4_DATA; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3128 |
ew32(CTRL_EXT, ctrl_ext); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3129 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3130 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3131 |
udelay(150); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3132 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3133 |
if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3134 |
/* Configure activity LED after PHY reset */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3135 |
led_ctrl = er32(LEDCTL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3136 |
led_ctrl &= IGP_ACTIVITY_LED_MASK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3137 |
led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3138 |
ew32(LEDCTL, led_ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3139 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3140 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3141 |
/* Wait for FW to finish PHY configuration. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3142 |
return e1000_get_phy_cfg_done(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3143 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3144 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3145 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3146 |
* e1000_phy_reset - reset the phy to commit settings |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3147 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3148 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3149 |
* Resets the PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3150 |
* Sets bit 15 of the MII Control register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3151 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3152 |
s32 e1000_phy_reset(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3153 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3154 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3155 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3156 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3157 |
e_dbg("e1000_phy_reset"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3158 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3159 |
switch (hw->phy_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3160 |
case e1000_phy_igp: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3161 |
ret_val = e1000_phy_hw_reset(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3162 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3163 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3164 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3165 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3166 |
ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3167 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3168 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3169 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3170 |
phy_data |= MII_CR_RESET; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3171 |
ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3172 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3173 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3174 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3175 |
udelay(1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3176 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3177 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3178 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3179 |
if (hw->phy_type == e1000_phy_igp) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3180 |
e1000_phy_init_script(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3181 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3182 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3183 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3184 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3185 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3186 |
* e1000_detect_gig_phy - check the phy type |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3187 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3188 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3189 |
* Probes the expected PHY address for known PHY IDs |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3190 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3191 |
static s32 e1000_detect_gig_phy(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3192 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3193 |
s32 phy_init_status, ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3194 |
u16 phy_id_high, phy_id_low; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3195 |
bool match = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3196 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3197 |
e_dbg("e1000_detect_gig_phy"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3198 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3199 |
if (hw->phy_id != 0) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3200 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3201 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3202 |
/* Read the PHY ID Registers to identify which PHY is onboard. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3203 |
ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3204 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3205 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3206 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3207 |
hw->phy_id = (u32) (phy_id_high << 16); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3208 |
udelay(20); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3209 |
ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3210 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3211 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3212 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3213 |
hw->phy_id |= (u32) (phy_id_low & PHY_REVISION_MASK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3214 |
hw->phy_revision = (u32) phy_id_low & ~PHY_REVISION_MASK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3215 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3216 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3217 |
case e1000_82543: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3218 |
if (hw->phy_id == M88E1000_E_PHY_ID) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3219 |
match = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3220 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3221 |
case e1000_82544: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3222 |
if (hw->phy_id == M88E1000_I_PHY_ID) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3223 |
match = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3224 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3225 |
case e1000_82540: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3226 |
case e1000_82545: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3227 |
case e1000_82545_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3228 |
case e1000_82546: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3229 |
case e1000_82546_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3230 |
if (hw->phy_id == M88E1011_I_PHY_ID) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3231 |
match = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3232 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3233 |
case e1000_ce4100: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3234 |
if ((hw->phy_id == RTL8211B_PHY_ID) || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3235 |
(hw->phy_id == RTL8201N_PHY_ID) || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3236 |
(hw->phy_id == M88E1118_E_PHY_ID)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3237 |
match = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3238 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3239 |
case e1000_82541: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3240 |
case e1000_82541_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3241 |
case e1000_82547: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3242 |
case e1000_82547_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3243 |
if (hw->phy_id == IGP01E1000_I_PHY_ID) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3244 |
match = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3245 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3246 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3247 |
e_dbg("Invalid MAC type %d\n", hw->mac_type); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3248 |
return -E1000_ERR_CONFIG; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3249 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3250 |
phy_init_status = e1000_set_phy_type(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3251 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3252 |
if ((match) && (phy_init_status == E1000_SUCCESS)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3253 |
e_dbg("PHY ID 0x%X detected\n", hw->phy_id); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3254 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3255 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3256 |
e_dbg("Invalid PHY ID 0x%X\n", hw->phy_id); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3257 |
return -E1000_ERR_PHY; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3258 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3259 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3260 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3261 |
* e1000_phy_reset_dsp - reset DSP |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3262 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3263 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3264 |
* Resets the PHY's DSP |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3265 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3266 |
static s32 e1000_phy_reset_dsp(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3267 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3268 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3269 |
e_dbg("e1000_phy_reset_dsp"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3270 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3271 |
do { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3272 |
ret_val = e1000_write_phy_reg(hw, 29, 0x001d); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3273 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3274 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3275 |
ret_val = e1000_write_phy_reg(hw, 30, 0x00c1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3276 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3277 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3278 |
ret_val = e1000_write_phy_reg(hw, 30, 0x0000); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3279 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3280 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3281 |
ret_val = E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3282 |
} while (0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3283 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3284 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3285 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3286 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3287 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3288 |
* e1000_phy_igp_get_info - get igp specific registers |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3289 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3290 |
* @phy_info: PHY information structure |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3291 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3292 |
* Get PHY information from various PHY registers for igp PHY only. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3293 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3294 |
static s32 e1000_phy_igp_get_info(struct e1000_hw *hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3295 |
struct e1000_phy_info *phy_info) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3296 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3297 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3298 |
u16 phy_data, min_length, max_length, average; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3299 |
e1000_rev_polarity polarity; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3300 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3301 |
e_dbg("e1000_phy_igp_get_info"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3302 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3303 |
/* The downshift status is checked only once, after link is established, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3304 |
* and it stored in the hw->speed_downgraded parameter. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3305 |
phy_info->downshift = (e1000_downshift) hw->speed_downgraded; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3306 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3307 |
/* IGP01E1000 does not need to support it. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3308 |
phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_normal; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3309 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3310 |
/* IGP01E1000 always correct polarity reversal */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3311 |
phy_info->polarity_correction = e1000_polarity_reversal_enabled; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3312 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3313 |
/* Check polarity status */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3314 |
ret_val = e1000_check_polarity(hw, &polarity); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3315 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3316 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3317 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3318 |
phy_info->cable_polarity = polarity; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3319 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3320 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3321 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3322 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3323 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3324 |
phy_info->mdix_mode = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3325 |
(e1000_auto_x_mode) ((phy_data & IGP01E1000_PSSR_MDIX) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3326 |
IGP01E1000_PSSR_MDIX_SHIFT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3327 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3328 |
if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) == |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3329 |
IGP01E1000_PSSR_SPEED_1000MBPS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3330 |
/* Local/Remote Receiver Information are only valid at 1000 Mbps */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3331 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3332 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3333 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3334 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3335 |
phy_info->local_rx = ((phy_data & SR_1000T_LOCAL_RX_STATUS) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3336 |
SR_1000T_LOCAL_RX_STATUS_SHIFT) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3337 |
e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3338 |
phy_info->remote_rx = ((phy_data & SR_1000T_REMOTE_RX_STATUS) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3339 |
SR_1000T_REMOTE_RX_STATUS_SHIFT) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3340 |
e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3341 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3342 |
/* Get cable length */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3343 |
ret_val = e1000_get_cable_length(hw, &min_length, &max_length); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3344 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3345 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3346 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3347 |
/* Translate to old method */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3348 |
average = (max_length + min_length) / 2; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3349 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3350 |
if (average <= e1000_igp_cable_length_50) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3351 |
phy_info->cable_length = e1000_cable_length_50; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3352 |
else if (average <= e1000_igp_cable_length_80) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3353 |
phy_info->cable_length = e1000_cable_length_50_80; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3354 |
else if (average <= e1000_igp_cable_length_110) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3355 |
phy_info->cable_length = e1000_cable_length_80_110; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3356 |
else if (average <= e1000_igp_cable_length_140) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3357 |
phy_info->cable_length = e1000_cable_length_110_140; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3358 |
else |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3359 |
phy_info->cable_length = e1000_cable_length_140; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3360 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3361 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3362 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3363 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3364 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3365 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3366 |
* e1000_phy_m88_get_info - get m88 specific registers |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3367 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3368 |
* @phy_info: PHY information structure |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3369 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3370 |
* Get PHY information from various PHY registers for m88 PHY only. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3371 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3372 |
static s32 e1000_phy_m88_get_info(struct e1000_hw *hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3373 |
struct e1000_phy_info *phy_info) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3374 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3375 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3376 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3377 |
e1000_rev_polarity polarity; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3378 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3379 |
e_dbg("e1000_phy_m88_get_info"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3380 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3381 |
/* The downshift status is checked only once, after link is established, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3382 |
* and it stored in the hw->speed_downgraded parameter. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3383 |
phy_info->downshift = (e1000_downshift) hw->speed_downgraded; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3384 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3385 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3386 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3387 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3388 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3389 |
phy_info->extended_10bt_distance = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3390 |
((phy_data & M88E1000_PSCR_10BT_EXT_DIST_ENABLE) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3391 |
M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3392 |
e1000_10bt_ext_dist_enable_lower : |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3393 |
e1000_10bt_ext_dist_enable_normal; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3394 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3395 |
phy_info->polarity_correction = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3396 |
((phy_data & M88E1000_PSCR_POLARITY_REVERSAL) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3397 |
M88E1000_PSCR_POLARITY_REVERSAL_SHIFT) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3398 |
e1000_polarity_reversal_disabled : e1000_polarity_reversal_enabled; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3399 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3400 |
/* Check polarity status */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3401 |
ret_val = e1000_check_polarity(hw, &polarity); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3402 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3403 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3404 |
phy_info->cable_polarity = polarity; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3405 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3406 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3407 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3408 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3409 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3410 |
phy_info->mdix_mode = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3411 |
(e1000_auto_x_mode) ((phy_data & M88E1000_PSSR_MDIX) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3412 |
M88E1000_PSSR_MDIX_SHIFT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3413 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3414 |
if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3415 |
/* Cable Length Estimation and Local/Remote Receiver Information |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3416 |
* are only valid at 1000 Mbps. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3417 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3418 |
phy_info->cable_length = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3419 |
(e1000_cable_length) ((phy_data & |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3420 |
M88E1000_PSSR_CABLE_LENGTH) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3421 |
M88E1000_PSSR_CABLE_LENGTH_SHIFT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3422 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3423 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3424 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3425 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3426 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3427 |
phy_info->local_rx = ((phy_data & SR_1000T_LOCAL_RX_STATUS) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3428 |
SR_1000T_LOCAL_RX_STATUS_SHIFT) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3429 |
e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3430 |
phy_info->remote_rx = ((phy_data & SR_1000T_REMOTE_RX_STATUS) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3431 |
SR_1000T_REMOTE_RX_STATUS_SHIFT) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3432 |
e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3433 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3434 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3435 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3436 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3437 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3438 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3439 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3440 |
* e1000_phy_get_info - request phy info |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3441 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3442 |
* @phy_info: PHY information structure |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3443 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3444 |
* Get PHY information from various PHY registers |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3445 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3446 |
s32 e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3447 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3448 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3449 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3450 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3451 |
e_dbg("e1000_phy_get_info"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3452 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3453 |
phy_info->cable_length = e1000_cable_length_undefined; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3454 |
phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_undefined; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3455 |
phy_info->cable_polarity = e1000_rev_polarity_undefined; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3456 |
phy_info->downshift = e1000_downshift_undefined; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3457 |
phy_info->polarity_correction = e1000_polarity_reversal_undefined; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3458 |
phy_info->mdix_mode = e1000_auto_x_mode_undefined; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3459 |
phy_info->local_rx = e1000_1000t_rx_status_undefined; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3460 |
phy_info->remote_rx = e1000_1000t_rx_status_undefined; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3461 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3462 |
if (hw->media_type != e1000_media_type_copper) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3463 |
e_dbg("PHY info is only valid for copper media\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3464 |
return -E1000_ERR_CONFIG; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3465 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3466 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3467 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3468 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3469 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3470 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3471 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3472 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3473 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3474 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3475 |
if ((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3476 |
e_dbg("PHY info is only valid if link is up\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3477 |
return -E1000_ERR_CONFIG; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3478 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3479 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3480 |
if (hw->phy_type == e1000_phy_igp) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3481 |
return e1000_phy_igp_get_info(hw, phy_info); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3482 |
else if ((hw->phy_type == e1000_phy_8211) || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3483 |
(hw->phy_type == e1000_phy_8201)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3484 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3485 |
else |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3486 |
return e1000_phy_m88_get_info(hw, phy_info); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3487 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3488 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3489 |
s32 e1000_validate_mdi_setting(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3490 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3491 |
e_dbg("e1000_validate_mdi_settings"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3492 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3493 |
if (!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3494 |
e_dbg("Invalid MDI setting detected\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3495 |
hw->mdix = 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3496 |
return -E1000_ERR_CONFIG; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3497 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3498 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3499 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3500 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3501 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3502 |
* e1000_init_eeprom_params - initialize sw eeprom vars |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3503 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3504 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3505 |
* Sets up eeprom variables in the hw struct. Must be called after mac_type |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3506 |
* is configured. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3507 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3508 |
s32 e1000_init_eeprom_params(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3509 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3510 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3511 |
u32 eecd = er32(EECD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3512 |
s32 ret_val = E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3513 |
u16 eeprom_size; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3514 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3515 |
e_dbg("e1000_init_eeprom_params"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3516 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3517 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3518 |
case e1000_82542_rev2_0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3519 |
case e1000_82542_rev2_1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3520 |
case e1000_82543: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3521 |
case e1000_82544: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3522 |
eeprom->type = e1000_eeprom_microwire; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3523 |
eeprom->word_size = 64; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3524 |
eeprom->opcode_bits = 3; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3525 |
eeprom->address_bits = 6; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3526 |
eeprom->delay_usec = 50; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3527 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3528 |
case e1000_82540: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3529 |
case e1000_82545: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3530 |
case e1000_82545_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3531 |
case e1000_82546: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3532 |
case e1000_82546_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3533 |
eeprom->type = e1000_eeprom_microwire; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3534 |
eeprom->opcode_bits = 3; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3535 |
eeprom->delay_usec = 50; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3536 |
if (eecd & E1000_EECD_SIZE) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3537 |
eeprom->word_size = 256; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3538 |
eeprom->address_bits = 8; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3539 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3540 |
eeprom->word_size = 64; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3541 |
eeprom->address_bits = 6; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3542 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3543 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3544 |
case e1000_82541: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3545 |
case e1000_82541_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3546 |
case e1000_82547: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3547 |
case e1000_82547_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3548 |
if (eecd & E1000_EECD_TYPE) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3549 |
eeprom->type = e1000_eeprom_spi; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3550 |
eeprom->opcode_bits = 8; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3551 |
eeprom->delay_usec = 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3552 |
if (eecd & E1000_EECD_ADDR_BITS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3553 |
eeprom->page_size = 32; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3554 |
eeprom->address_bits = 16; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3555 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3556 |
eeprom->page_size = 8; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3557 |
eeprom->address_bits = 8; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3558 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3559 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3560 |
eeprom->type = e1000_eeprom_microwire; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3561 |
eeprom->opcode_bits = 3; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3562 |
eeprom->delay_usec = 50; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3563 |
if (eecd & E1000_EECD_ADDR_BITS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3564 |
eeprom->word_size = 256; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3565 |
eeprom->address_bits = 8; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3566 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3567 |
eeprom->word_size = 64; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3568 |
eeprom->address_bits = 6; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3569 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3570 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3571 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3572 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3573 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3574 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3575 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3576 |
if (eeprom->type == e1000_eeprom_spi) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3577 |
/* eeprom_size will be an enum [0..8] that maps to eeprom sizes 128B to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3578 |
* 32KB (incremented by powers of 2). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3579 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3580 |
/* Set to default value for initial eeprom read. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3581 |
eeprom->word_size = 64; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3582 |
ret_val = e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3583 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3584 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3585 |
eeprom_size = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3586 |
(eeprom_size & EEPROM_SIZE_MASK) >> EEPROM_SIZE_SHIFT; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3587 |
/* 256B eeprom size was not supported in earlier hardware, so we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3588 |
* bump eeprom_size up one to ensure that "1" (which maps to 256B) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3589 |
* is never the result used in the shifting logic below. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3590 |
if (eeprom_size) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3591 |
eeprom_size++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3592 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3593 |
eeprom->word_size = 1 << (eeprom_size + EEPROM_WORD_SIZE_SHIFT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3594 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3595 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3596 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3597 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3598 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3599 |
* e1000_raise_ee_clk - Raises the EEPROM's clock input. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3600 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3601 |
* @eecd: EECD's current value |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3602 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3603 |
static void e1000_raise_ee_clk(struct e1000_hw *hw, u32 *eecd) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3604 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3605 |
/* Raise the clock input to the EEPROM (by setting the SK bit), and then |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3606 |
* wait <delay> microseconds. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3607 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3608 |
*eecd = *eecd | E1000_EECD_SK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3609 |
ew32(EECD, *eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3610 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3611 |
udelay(hw->eeprom.delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3612 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3613 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3614 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3615 |
* e1000_lower_ee_clk - Lowers the EEPROM's clock input. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3616 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3617 |
* @eecd: EECD's current value |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3618 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3619 |
static void e1000_lower_ee_clk(struct e1000_hw *hw, u32 *eecd) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3620 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3621 |
/* Lower the clock input to the EEPROM (by clearing the SK bit), and then |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3622 |
* wait 50 microseconds. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3623 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3624 |
*eecd = *eecd & ~E1000_EECD_SK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3625 |
ew32(EECD, *eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3626 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3627 |
udelay(hw->eeprom.delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3628 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3629 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3630 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3631 |
* e1000_shift_out_ee_bits - Shift data bits out to the EEPROM. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3632 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3633 |
* @data: data to send to the EEPROM |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3634 |
* @count: number of bits to shift out |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3635 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3636 |
static void e1000_shift_out_ee_bits(struct e1000_hw *hw, u16 data, u16 count) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3637 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3638 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3639 |
u32 eecd; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3640 |
u32 mask; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3641 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3642 |
/* We need to shift "count" bits out to the EEPROM. So, value in the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3643 |
* "data" parameter will be shifted out to the EEPROM one bit at a time. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3644 |
* In order to do this, "data" must be broken down into bits. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3645 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3646 |
mask = 0x01 << (count - 1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3647 |
eecd = er32(EECD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3648 |
if (eeprom->type == e1000_eeprom_microwire) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3649 |
eecd &= ~E1000_EECD_DO; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3650 |
} else if (eeprom->type == e1000_eeprom_spi) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3651 |
eecd |= E1000_EECD_DO; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3652 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3653 |
do { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3654 |
/* A "1" is shifted out to the EEPROM by setting bit "DI" to a "1", |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3655 |
* and then raising and then lowering the clock (the SK bit controls |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3656 |
* the clock input to the EEPROM). A "0" is shifted out to the EEPROM |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3657 |
* by setting "DI" to "0" and then raising and then lowering the clock. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3658 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3659 |
eecd &= ~E1000_EECD_DI; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3660 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3661 |
if (data & mask) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3662 |
eecd |= E1000_EECD_DI; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3663 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3664 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3665 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3666 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3667 |
udelay(eeprom->delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3668 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3669 |
e1000_raise_ee_clk(hw, &eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3670 |
e1000_lower_ee_clk(hw, &eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3671 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3672 |
mask = mask >> 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3673 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3674 |
} while (mask); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3675 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3676 |
/* We leave the "DI" bit set to "0" when we leave this routine. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3677 |
eecd &= ~E1000_EECD_DI; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3678 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3679 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3680 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3681 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3682 |
* e1000_shift_in_ee_bits - Shift data bits in from the EEPROM |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3683 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3684 |
* @count: number of bits to shift in |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3685 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3686 |
static u16 e1000_shift_in_ee_bits(struct e1000_hw *hw, u16 count) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3687 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3688 |
u32 eecd; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3689 |
u32 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3690 |
u16 data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3691 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3692 |
/* In order to read a register from the EEPROM, we need to shift 'count' |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3693 |
* bits in from the EEPROM. Bits are "shifted in" by raising the clock |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3694 |
* input to the EEPROM (setting the SK bit), and then reading the value of |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3695 |
* the "DO" bit. During this "shifting in" process the "DI" bit should |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3696 |
* always be clear. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3697 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3698 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3699 |
eecd = er32(EECD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3700 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3701 |
eecd &= ~(E1000_EECD_DO | E1000_EECD_DI); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3702 |
data = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3703 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3704 |
for (i = 0; i < count; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3705 |
data = data << 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3706 |
e1000_raise_ee_clk(hw, &eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3707 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3708 |
eecd = er32(EECD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3709 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3710 |
eecd &= ~(E1000_EECD_DI); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3711 |
if (eecd & E1000_EECD_DO) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3712 |
data |= 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3713 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3714 |
e1000_lower_ee_clk(hw, &eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3715 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3716 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3717 |
return data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3718 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3719 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3720 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3721 |
* e1000_acquire_eeprom - Prepares EEPROM for access |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3722 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3723 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3724 |
* Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3725 |
* function should be called before issuing a command to the EEPROM. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3726 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3727 |
static s32 e1000_acquire_eeprom(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3728 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3729 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3730 |
u32 eecd, i = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3731 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3732 |
e_dbg("e1000_acquire_eeprom"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3733 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3734 |
eecd = er32(EECD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3735 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3736 |
/* Request EEPROM Access */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3737 |
if (hw->mac_type > e1000_82544) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3738 |
eecd |= E1000_EECD_REQ; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3739 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3740 |
eecd = er32(EECD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3741 |
while ((!(eecd & E1000_EECD_GNT)) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3742 |
(i < E1000_EEPROM_GRANT_ATTEMPTS)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3743 |
i++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3744 |
udelay(5); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3745 |
eecd = er32(EECD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3746 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3747 |
if (!(eecd & E1000_EECD_GNT)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3748 |
eecd &= ~E1000_EECD_REQ; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3749 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3750 |
e_dbg("Could not acquire EEPROM grant\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3751 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3752 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3753 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3754 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3755 |
/* Setup EEPROM for Read/Write */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3756 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3757 |
if (eeprom->type == e1000_eeprom_microwire) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3758 |
/* Clear SK and DI */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3759 |
eecd &= ~(E1000_EECD_DI | E1000_EECD_SK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3760 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3761 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3762 |
/* Set CS */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3763 |
eecd |= E1000_EECD_CS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3764 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3765 |
} else if (eeprom->type == e1000_eeprom_spi) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3766 |
/* Clear SK and CS */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3767 |
eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3768 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3769 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3770 |
udelay(1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3771 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3772 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3773 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3774 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3775 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3776 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3777 |
* e1000_standby_eeprom - Returns EEPROM to a "standby" state |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3778 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3779 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3780 |
static void e1000_standby_eeprom(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3781 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3782 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3783 |
u32 eecd; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3784 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3785 |
eecd = er32(EECD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3786 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3787 |
if (eeprom->type == e1000_eeprom_microwire) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3788 |
eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3789 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3790 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3791 |
udelay(eeprom->delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3792 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3793 |
/* Clock high */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3794 |
eecd |= E1000_EECD_SK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3795 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3796 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3797 |
udelay(eeprom->delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3798 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3799 |
/* Select EEPROM */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3800 |
eecd |= E1000_EECD_CS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3801 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3802 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3803 |
udelay(eeprom->delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3804 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3805 |
/* Clock low */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3806 |
eecd &= ~E1000_EECD_SK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3807 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3808 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3809 |
udelay(eeprom->delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3810 |
} else if (eeprom->type == e1000_eeprom_spi) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3811 |
/* Toggle CS to flush commands */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3812 |
eecd |= E1000_EECD_CS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3813 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3814 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3815 |
udelay(eeprom->delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3816 |
eecd &= ~E1000_EECD_CS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3817 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3818 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3819 |
udelay(eeprom->delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3820 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3821 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3822 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3823 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3824 |
* e1000_release_eeprom - drop chip select |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3825 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3826 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3827 |
* Terminates a command by inverting the EEPROM's chip select pin |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3828 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3829 |
static void e1000_release_eeprom(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3830 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3831 |
u32 eecd; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3832 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3833 |
e_dbg("e1000_release_eeprom"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3834 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3835 |
eecd = er32(EECD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3836 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3837 |
if (hw->eeprom.type == e1000_eeprom_spi) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3838 |
eecd |= E1000_EECD_CS; /* Pull CS high */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3839 |
eecd &= ~E1000_EECD_SK; /* Lower SCK */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3840 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3841 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3842 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3843 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3844 |
udelay(hw->eeprom.delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3845 |
} else if (hw->eeprom.type == e1000_eeprom_microwire) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3846 |
/* cleanup eeprom */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3847 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3848 |
/* CS on Microwire is active-high */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3849 |
eecd &= ~(E1000_EECD_CS | E1000_EECD_DI); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3850 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3851 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3852 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3853 |
/* Rising edge of clock */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3854 |
eecd |= E1000_EECD_SK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3855 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3856 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3857 |
udelay(hw->eeprom.delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3858 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3859 |
/* Falling edge of clock */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3860 |
eecd &= ~E1000_EECD_SK; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3861 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3862 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3863 |
udelay(hw->eeprom.delay_usec); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3864 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3865 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3866 |
/* Stop requesting EEPROM access */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3867 |
if (hw->mac_type > e1000_82544) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3868 |
eecd &= ~E1000_EECD_REQ; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3869 |
ew32(EECD, eecd); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3870 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3871 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3872 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3873 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3874 |
* e1000_spi_eeprom_ready - Reads a 16 bit word from the EEPROM. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3875 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3876 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3877 |
static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3878 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3879 |
u16 retry_count = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3880 |
u8 spi_stat_reg; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3881 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3882 |
e_dbg("e1000_spi_eeprom_ready"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3883 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3884 |
/* Read "Status Register" repeatedly until the LSB is cleared. The |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3885 |
* EEPROM will signal that the command has been completed by clearing |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3886 |
* bit 0 of the internal status register. If it's not cleared within |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3887 |
* 5 milliseconds, then error out. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3888 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3889 |
retry_count = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3890 |
do { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3891 |
e1000_shift_out_ee_bits(hw, EEPROM_RDSR_OPCODE_SPI, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3892 |
hw->eeprom.opcode_bits); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3893 |
spi_stat_reg = (u8) e1000_shift_in_ee_bits(hw, 8); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3894 |
if (!(spi_stat_reg & EEPROM_STATUS_RDY_SPI)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3895 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3896 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3897 |
udelay(5); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3898 |
retry_count += 5; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3899 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3900 |
e1000_standby_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3901 |
} while (retry_count < EEPROM_MAX_RETRY_SPI); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3902 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3903 |
/* ATMEL SPI write time could vary from 0-20mSec on 3.3V devices (and |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3904 |
* only 0-5mSec on 5V devices) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3905 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3906 |
if (retry_count >= EEPROM_MAX_RETRY_SPI) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3907 |
e_dbg("SPI EEPROM Status error\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3908 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3909 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3910 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3911 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3912 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3913 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3914 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3915 |
* e1000_read_eeprom - Reads a 16 bit word from the EEPROM. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3916 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3917 |
* @offset: offset of word in the EEPROM to read |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3918 |
* @data: word read from the EEPROM |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3919 |
* @words: number of words to read |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3920 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3921 |
s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3922 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3923 |
s32 ret; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3924 |
spin_lock(&e1000_eeprom_lock); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3925 |
ret = e1000_do_read_eeprom(hw, offset, words, data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3926 |
spin_unlock(&e1000_eeprom_lock); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3927 |
return ret; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3928 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3929 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3930 |
static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3931 |
u16 *data) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3932 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3933 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3934 |
u32 i = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3935 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3936 |
e_dbg("e1000_read_eeprom"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3937 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3938 |
if (hw->mac_type == e1000_ce4100) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3939 |
GBE_CONFIG_FLASH_READ(GBE_CONFIG_BASE_VIRT, offset, words, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3940 |
data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3941 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3942 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3943 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3944 |
/* If eeprom is not yet detected, do so now */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3945 |
if (eeprom->word_size == 0) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3946 |
e1000_init_eeprom_params(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3947 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3948 |
/* A check for invalid values: offset too large, too many words, and not |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3949 |
* enough words. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3950 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3951 |
if ((offset >= eeprom->word_size) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3952 |
|| (words > eeprom->word_size - offset) || (words == 0)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3953 |
e_dbg("\"words\" parameter out of bounds. Words = %d," |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3954 |
"size = %d\n", offset, eeprom->word_size); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3955 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3956 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3957 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3958 |
/* EEPROM's that don't use EERD to read require us to bit-bang the SPI |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3959 |
* directly. In this case, we need to acquire the EEPROM so that |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3960 |
* FW or other port software does not interrupt. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3961 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3962 |
/* Prepare the EEPROM for bit-bang reading */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3963 |
if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3964 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3965 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3966 |
/* Set up the SPI or Microwire EEPROM for bit-bang reading. We have |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3967 |
* acquired the EEPROM at this point, so any returns should release it */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3968 |
if (eeprom->type == e1000_eeprom_spi) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3969 |
u16 word_in; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3970 |
u8 read_opcode = EEPROM_READ_OPCODE_SPI; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3971 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3972 |
if (e1000_spi_eeprom_ready(hw)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3973 |
e1000_release_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3974 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3975 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3976 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3977 |
e1000_standby_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3978 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3979 |
/* Some SPI eeproms use the 8th address bit embedded in the opcode */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3980 |
if ((eeprom->address_bits == 8) && (offset >= 128)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3981 |
read_opcode |= EEPROM_A8_OPCODE_SPI; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3982 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3983 |
/* Send the READ command (opcode + addr) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3984 |
e1000_shift_out_ee_bits(hw, read_opcode, eeprom->opcode_bits); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3985 |
e1000_shift_out_ee_bits(hw, (u16) (offset * 2), |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3986 |
eeprom->address_bits); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3987 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3988 |
/* Read the data. The address of the eeprom internally increments with |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3989 |
* each byte (spi) being read, saving on the overhead of eeprom setup |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3990 |
* and tear-down. The address counter will roll over if reading beyond |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3991 |
* the size of the eeprom, thus allowing the entire memory to be read |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3992 |
* starting from any offset. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3993 |
for (i = 0; i < words; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3994 |
word_in = e1000_shift_in_ee_bits(hw, 16); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3995 |
data[i] = (word_in >> 8) | (word_in << 8); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3996 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3997 |
} else if (eeprom->type == e1000_eeprom_microwire) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3998 |
for (i = 0; i < words; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3999 |
/* Send the READ command (opcode + addr) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4000 |
e1000_shift_out_ee_bits(hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4001 |
EEPROM_READ_OPCODE_MICROWIRE, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4002 |
eeprom->opcode_bits); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4003 |
e1000_shift_out_ee_bits(hw, (u16) (offset + i), |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4004 |
eeprom->address_bits); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4005 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4006 |
/* Read the data. For microwire, each word requires the overhead |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4007 |
* of eeprom setup and tear-down. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4008 |
data[i] = e1000_shift_in_ee_bits(hw, 16); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4009 |
e1000_standby_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4010 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4011 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4012 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4013 |
/* End this read operation */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4014 |
e1000_release_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4015 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4016 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4017 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4018 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4019 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4020 |
* e1000_validate_eeprom_checksum - Verifies that the EEPROM has a valid checksum |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4021 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4022 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4023 |
* Reads the first 64 16 bit words of the EEPROM and sums the values read. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4024 |
* If the the sum of the 64 16 bit words is 0xBABA, the EEPROM's checksum is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4025 |
* valid. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4026 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4027 |
s32 e1000_validate_eeprom_checksum(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4028 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4029 |
u16 checksum = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4030 |
u16 i, eeprom_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4031 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4032 |
e_dbg("e1000_validate_eeprom_checksum"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4033 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4034 |
for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4035 |
if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4036 |
e_dbg("EEPROM Read Error\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4037 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4038 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4039 |
checksum += eeprom_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4040 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4041 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4042 |
#ifdef CONFIG_PARISC |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4043 |
/* This is a signature and not a checksum on HP c8000 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4044 |
if ((hw->subsystem_vendor_id == 0x103C) && (eeprom_data == 0x16d6)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4045 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4046 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4047 |
#endif |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4048 |
if (checksum == (u16) EEPROM_SUM) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4049 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4050 |
else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4051 |
e_dbg("EEPROM Checksum Invalid\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4052 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4053 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4054 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4055 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4056 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4057 |
* e1000_update_eeprom_checksum - Calculates/writes the EEPROM checksum |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4058 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4059 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4060 |
* Sums the first 63 16 bit words of the EEPROM. Subtracts the sum from 0xBABA. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4061 |
* Writes the difference to word offset 63 of the EEPROM. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4062 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4063 |
s32 e1000_update_eeprom_checksum(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4064 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4065 |
u16 checksum = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4066 |
u16 i, eeprom_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4067 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4068 |
e_dbg("e1000_update_eeprom_checksum"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4069 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4070 |
for (i = 0; i < EEPROM_CHECKSUM_REG; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4071 |
if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4072 |
e_dbg("EEPROM Read Error\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4073 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4074 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4075 |
checksum += eeprom_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4076 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4077 |
checksum = (u16) EEPROM_SUM - checksum; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4078 |
if (e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4079 |
e_dbg("EEPROM Write Error\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4080 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4081 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4082 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4083 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4084 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4085 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4086 |
* e1000_write_eeprom - write words to the different EEPROM types. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4087 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4088 |
* @offset: offset within the EEPROM to be written to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4089 |
* @words: number of words to write |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4090 |
* @data: 16 bit word to be written to the EEPROM |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4091 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4092 |
* If e1000_update_eeprom_checksum is not called after this function, the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4093 |
* EEPROM will most likely contain an invalid checksum. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4094 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4095 |
s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4096 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4097 |
s32 ret; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4098 |
spin_lock(&e1000_eeprom_lock); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4099 |
ret = e1000_do_write_eeprom(hw, offset, words, data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4100 |
spin_unlock(&e1000_eeprom_lock); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4101 |
return ret; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4102 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4103 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4104 |
static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4105 |
u16 *data) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4106 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4107 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4108 |
s32 status = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4109 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4110 |
e_dbg("e1000_write_eeprom"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4111 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4112 |
if (hw->mac_type == e1000_ce4100) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4113 |
GBE_CONFIG_FLASH_WRITE(GBE_CONFIG_BASE_VIRT, offset, words, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4114 |
data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4115 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4116 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4117 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4118 |
/* If eeprom is not yet detected, do so now */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4119 |
if (eeprom->word_size == 0) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4120 |
e1000_init_eeprom_params(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4121 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4122 |
/* A check for invalid values: offset too large, too many words, and not |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4123 |
* enough words. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4124 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4125 |
if ((offset >= eeprom->word_size) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4126 |
|| (words > eeprom->word_size - offset) || (words == 0)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4127 |
e_dbg("\"words\" parameter out of bounds\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4128 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4129 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4130 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4131 |
/* Prepare the EEPROM for writing */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4132 |
if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4133 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4134 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4135 |
if (eeprom->type == e1000_eeprom_microwire) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4136 |
status = e1000_write_eeprom_microwire(hw, offset, words, data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4137 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4138 |
status = e1000_write_eeprom_spi(hw, offset, words, data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4139 |
msleep(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4140 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4141 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4142 |
/* Done with writing */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4143 |
e1000_release_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4144 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4145 |
return status; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4146 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4147 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4148 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4149 |
* e1000_write_eeprom_spi - Writes a 16 bit word to a given offset in an SPI EEPROM. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4150 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4151 |
* @offset: offset within the EEPROM to be written to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4152 |
* @words: number of words to write |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4153 |
* @data: pointer to array of 8 bit words to be written to the EEPROM |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4154 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4155 |
static s32 e1000_write_eeprom_spi(struct e1000_hw *hw, u16 offset, u16 words, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4156 |
u16 *data) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4157 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4158 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4159 |
u16 widx = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4160 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4161 |
e_dbg("e1000_write_eeprom_spi"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4162 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4163 |
while (widx < words) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4164 |
u8 write_opcode = EEPROM_WRITE_OPCODE_SPI; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4165 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4166 |
if (e1000_spi_eeprom_ready(hw)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4167 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4168 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4169 |
e1000_standby_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4170 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4171 |
/* Send the WRITE ENABLE command (8 bit opcode ) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4172 |
e1000_shift_out_ee_bits(hw, EEPROM_WREN_OPCODE_SPI, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4173 |
eeprom->opcode_bits); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4174 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4175 |
e1000_standby_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4176 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4177 |
/* Some SPI eeproms use the 8th address bit embedded in the opcode */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4178 |
if ((eeprom->address_bits == 8) && (offset >= 128)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4179 |
write_opcode |= EEPROM_A8_OPCODE_SPI; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4180 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4181 |
/* Send the Write command (8-bit opcode + addr) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4182 |
e1000_shift_out_ee_bits(hw, write_opcode, eeprom->opcode_bits); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4183 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4184 |
e1000_shift_out_ee_bits(hw, (u16) ((offset + widx) * 2), |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4185 |
eeprom->address_bits); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4186 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4187 |
/* Send the data */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4188 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4189 |
/* Loop to allow for up to whole page write (32 bytes) of eeprom */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4190 |
while (widx < words) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4191 |
u16 word_out = data[widx]; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4192 |
word_out = (word_out >> 8) | (word_out << 8); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4193 |
e1000_shift_out_ee_bits(hw, word_out, 16); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4194 |
widx++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4195 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4196 |
/* Some larger eeprom sizes are capable of a 32-byte PAGE WRITE |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4197 |
* operation, while the smaller eeproms are capable of an 8-byte |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4198 |
* PAGE WRITE operation. Break the inner loop to pass new address |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4199 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4200 |
if ((((offset + widx) * 2) % eeprom->page_size) == 0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4201 |
e1000_standby_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4202 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4203 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4204 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4205 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4206 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4207 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4208 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4209 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4210 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4211 |
* e1000_write_eeprom_microwire - Writes a 16 bit word to a given offset in a Microwire EEPROM. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4212 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4213 |
* @offset: offset within the EEPROM to be written to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4214 |
* @words: number of words to write |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4215 |
* @data: pointer to array of 8 bit words to be written to the EEPROM |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4216 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4217 |
static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4218 |
u16 words, u16 *data) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4219 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4220 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4221 |
u32 eecd; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4222 |
u16 words_written = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4223 |
u16 i = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4224 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4225 |
e_dbg("e1000_write_eeprom_microwire"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4226 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4227 |
/* Send the write enable command to the EEPROM (3-bit opcode plus |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4228 |
* 6/8-bit dummy address beginning with 11). It's less work to include |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4229 |
* the 11 of the dummy address as part of the opcode than it is to shift |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4230 |
* it over the correct number of bits for the address. This puts the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4231 |
* EEPROM into write/erase mode. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4232 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4233 |
e1000_shift_out_ee_bits(hw, EEPROM_EWEN_OPCODE_MICROWIRE, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4234 |
(u16) (eeprom->opcode_bits + 2)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4235 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4236 |
e1000_shift_out_ee_bits(hw, 0, (u16) (eeprom->address_bits - 2)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4237 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4238 |
/* Prepare the EEPROM */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4239 |
e1000_standby_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4240 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4241 |
while (words_written < words) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4242 |
/* Send the Write command (3-bit opcode + addr) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4243 |
e1000_shift_out_ee_bits(hw, EEPROM_WRITE_OPCODE_MICROWIRE, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4244 |
eeprom->opcode_bits); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4245 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4246 |
e1000_shift_out_ee_bits(hw, (u16) (offset + words_written), |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4247 |
eeprom->address_bits); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4248 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4249 |
/* Send the data */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4250 |
e1000_shift_out_ee_bits(hw, data[words_written], 16); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4251 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4252 |
/* Toggle the CS line. This in effect tells the EEPROM to execute |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4253 |
* the previous command. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4254 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4255 |
e1000_standby_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4256 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4257 |
/* Read DO repeatedly until it is high (equal to '1'). The EEPROM will |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4258 |
* signal that the command has been completed by raising the DO signal. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4259 |
* If DO does not go high in 10 milliseconds, then error out. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4260 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4261 |
for (i = 0; i < 200; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4262 |
eecd = er32(EECD); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4263 |
if (eecd & E1000_EECD_DO) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4264 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4265 |
udelay(50); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4266 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4267 |
if (i == 200) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4268 |
e_dbg("EEPROM Write did not complete\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4269 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4270 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4271 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4272 |
/* Recover from write */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4273 |
e1000_standby_eeprom(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4274 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4275 |
words_written++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4276 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4277 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4278 |
/* Send the write disable command to the EEPROM (3-bit opcode plus |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4279 |
* 6/8-bit dummy address beginning with 10). It's less work to include |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4280 |
* the 10 of the dummy address as part of the opcode than it is to shift |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4281 |
* it over the correct number of bits for the address. This takes the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4282 |
* EEPROM out of write/erase mode. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4283 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4284 |
e1000_shift_out_ee_bits(hw, EEPROM_EWDS_OPCODE_MICROWIRE, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4285 |
(u16) (eeprom->opcode_bits + 2)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4286 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4287 |
e1000_shift_out_ee_bits(hw, 0, (u16) (eeprom->address_bits - 2)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4288 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4289 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4290 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4291 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4292 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4293 |
* e1000_read_mac_addr - read the adapters MAC from eeprom |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4294 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4295 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4296 |
* Reads the adapter's MAC address from the EEPROM and inverts the LSB for the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4297 |
* second function of dual function devices |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4298 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4299 |
s32 e1000_read_mac_addr(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4300 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4301 |
u16 offset; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4302 |
u16 eeprom_data, i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4303 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4304 |
e_dbg("e1000_read_mac_addr"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4305 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4306 |
for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4307 |
offset = i >> 1; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4308 |
if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4309 |
e_dbg("EEPROM Read Error\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4310 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4311 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4312 |
hw->perm_mac_addr[i] = (u8) (eeprom_data & 0x00FF); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4313 |
hw->perm_mac_addr[i + 1] = (u8) (eeprom_data >> 8); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4314 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4315 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4316 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4317 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4318 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4319 |
case e1000_82546: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4320 |
case e1000_82546_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4321 |
if (er32(STATUS) & E1000_STATUS_FUNC_1) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4322 |
hw->perm_mac_addr[5] ^= 0x01; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4323 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4324 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4325 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4326 |
for (i = 0; i < NODE_ADDRESS_SIZE; i++) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4327 |
hw->mac_addr[i] = hw->perm_mac_addr[i]; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4328 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4329 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4330 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4331 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4332 |
* e1000_init_rx_addrs - Initializes receive address filters. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4333 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4334 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4335 |
* Places the MAC address in receive address register 0 and clears the rest |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4336 |
* of the receive address registers. Clears the multicast table. Assumes |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4337 |
* the receiver is in reset when the routine is called. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4338 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4339 |
static void e1000_init_rx_addrs(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4340 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4341 |
u32 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4342 |
u32 rar_num; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4343 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4344 |
e_dbg("e1000_init_rx_addrs"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4345 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4346 |
/* Setup the receive address. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4347 |
e_dbg("Programming MAC Address into RAR[0]\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4348 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4349 |
e1000_rar_set(hw, hw->mac_addr, 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4350 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4351 |
rar_num = E1000_RAR_ENTRIES; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4352 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4353 |
/* Zero out the other 15 receive addresses. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4354 |
e_dbg("Clearing RAR[1-15]\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4355 |
for (i = 1; i < rar_num; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4356 |
E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4357 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4358 |
E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4359 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4360 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4361 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4362 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4363 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4364 |
* e1000_hash_mc_addr - Hashes an address to determine its location in the multicast table |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4365 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4366 |
* @mc_addr: the multicast address to hash |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4367 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4368 |
u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4369 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4370 |
u32 hash_value = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4371 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4372 |
/* The portion of the address that is used for the hash table is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4373 |
* determined by the mc_filter_type setting. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4374 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4375 |
switch (hw->mc_filter_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4376 |
/* [0] [1] [2] [3] [4] [5] |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4377 |
* 01 AA 00 12 34 56 |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4378 |
* LSB MSB |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4379 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4380 |
case 0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4381 |
/* [47:36] i.e. 0x563 for above example address */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4382 |
hash_value = ((mc_addr[4] >> 4) | (((u16) mc_addr[5]) << 4)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4383 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4384 |
case 1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4385 |
/* [46:35] i.e. 0xAC6 for above example address */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4386 |
hash_value = ((mc_addr[4] >> 3) | (((u16) mc_addr[5]) << 5)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4387 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4388 |
case 2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4389 |
/* [45:34] i.e. 0x5D8 for above example address */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4390 |
hash_value = ((mc_addr[4] >> 2) | (((u16) mc_addr[5]) << 6)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4391 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4392 |
case 3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4393 |
/* [43:32] i.e. 0x634 for above example address */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4394 |
hash_value = ((mc_addr[4]) | (((u16) mc_addr[5]) << 8)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4395 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4396 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4397 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4398 |
hash_value &= 0xFFF; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4399 |
return hash_value; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4400 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4401 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4402 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4403 |
* e1000_rar_set - Puts an ethernet address into a receive address register. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4404 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4405 |
* @addr: Address to put into receive address register |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4406 |
* @index: Receive address register to write |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4407 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4408 |
void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4409 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4410 |
u32 rar_low, rar_high; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4411 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4412 |
/* HW expects these in little endian so we reverse the byte order |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4413 |
* from network order (big endian) to little endian |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4414 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4415 |
rar_low = ((u32) addr[0] | ((u32) addr[1] << 8) | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4416 |
((u32) addr[2] << 16) | ((u32) addr[3] << 24)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4417 |
rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4418 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4419 |
/* Disable Rx and flush all Rx frames before enabling RSS to avoid Rx |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4420 |
* unit hang. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4421 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4422 |
* Description: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4423 |
* If there are any Rx frames queued up or otherwise present in the HW |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4424 |
* before RSS is enabled, and then we enable RSS, the HW Rx unit will |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4425 |
* hang. To work around this issue, we have to disable receives and |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4426 |
* flush out all Rx frames before we enable RSS. To do so, we modify we |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4427 |
* redirect all Rx traffic to manageability and then reset the HW. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4428 |
* This flushes away Rx frames, and (since the redirections to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4429 |
* manageability persists across resets) keeps new ones from coming in |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4430 |
* while we work. Then, we clear the Address Valid AV bit for all MAC |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4431 |
* addresses and undo the re-direction to manageability. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4432 |
* Now, frames are coming in again, but the MAC won't accept them, so |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4433 |
* far so good. We now proceed to initialize RSS (if necessary) and |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4434 |
* configure the Rx unit. Last, we re-enable the AV bits and continue |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4435 |
* on our merry way. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4436 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4437 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4438 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4439 |
/* Indicate to hardware the Address is Valid. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4440 |
rar_high |= E1000_RAH_AV; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4441 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4442 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4443 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4444 |
E1000_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4445 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4446 |
E1000_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4447 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4448 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4449 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4450 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4451 |
* e1000_write_vfta - Writes a value to the specified offset in the VLAN filter table. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4452 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4453 |
* @offset: Offset in VLAN filer table to write |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4454 |
* @value: Value to write into VLAN filter table |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4455 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4456 |
void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4457 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4458 |
u32 temp; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4459 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4460 |
if ((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4461 |
temp = E1000_READ_REG_ARRAY(hw, VFTA, (offset - 1)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4462 |
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4463 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4464 |
E1000_WRITE_REG_ARRAY(hw, VFTA, (offset - 1), temp); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4465 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4466 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4467 |
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4468 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4469 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4470 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4471 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4472 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4473 |
* e1000_clear_vfta - Clears the VLAN filer table |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4474 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4475 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4476 |
static void e1000_clear_vfta(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4477 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4478 |
u32 offset; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4479 |
u32 vfta_value = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4480 |
u32 vfta_offset = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4481 |
u32 vfta_bit_in_reg = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4482 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4483 |
for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4484 |
/* If the offset we want to clear is the same offset of the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4485 |
* manageability VLAN ID, then clear all bits except that of the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4486 |
* manageability unit */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4487 |
vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4488 |
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4489 |
E1000_WRITE_FLUSH(); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4490 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4491 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4492 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4493 |
static s32 e1000_id_led_init(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4494 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4495 |
u32 ledctl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4496 |
const u32 ledctl_mask = 0x000000FF; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4497 |
const u32 ledctl_on = E1000_LEDCTL_MODE_LED_ON; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4498 |
const u32 ledctl_off = E1000_LEDCTL_MODE_LED_OFF; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4499 |
u16 eeprom_data, i, temp; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4500 |
const u16 led_mask = 0x0F; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4501 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4502 |
e_dbg("e1000_id_led_init"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4503 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4504 |
if (hw->mac_type < e1000_82540) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4505 |
/* Nothing to do */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4506 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4507 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4508 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4509 |
ledctl = er32(LEDCTL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4510 |
hw->ledctl_default = ledctl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4511 |
hw->ledctl_mode1 = hw->ledctl_default; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4512 |
hw->ledctl_mode2 = hw->ledctl_default; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4513 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4514 |
if (e1000_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4515 |
e_dbg("EEPROM Read Error\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4516 |
return -E1000_ERR_EEPROM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4517 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4518 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4519 |
if ((eeprom_data == ID_LED_RESERVED_0000) || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4520 |
(eeprom_data == ID_LED_RESERVED_FFFF)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4521 |
eeprom_data = ID_LED_DEFAULT; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4522 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4523 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4524 |
for (i = 0; i < 4; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4525 |
temp = (eeprom_data >> (i << 2)) & led_mask; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4526 |
switch (temp) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4527 |
case ID_LED_ON1_DEF2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4528 |
case ID_LED_ON1_ON2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4529 |
case ID_LED_ON1_OFF2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4530 |
hw->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4531 |
hw->ledctl_mode1 |= ledctl_on << (i << 3); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4532 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4533 |
case ID_LED_OFF1_DEF2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4534 |
case ID_LED_OFF1_ON2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4535 |
case ID_LED_OFF1_OFF2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4536 |
hw->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4537 |
hw->ledctl_mode1 |= ledctl_off << (i << 3); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4538 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4539 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4540 |
/* Do nothing */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4541 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4542 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4543 |
switch (temp) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4544 |
case ID_LED_DEF1_ON2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4545 |
case ID_LED_ON1_ON2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4546 |
case ID_LED_OFF1_ON2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4547 |
hw->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4548 |
hw->ledctl_mode2 |= ledctl_on << (i << 3); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4549 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4550 |
case ID_LED_DEF1_OFF2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4551 |
case ID_LED_ON1_OFF2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4552 |
case ID_LED_OFF1_OFF2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4553 |
hw->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4554 |
hw->ledctl_mode2 |= ledctl_off << (i << 3); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4555 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4556 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4557 |
/* Do nothing */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4558 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4559 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4560 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4561 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4562 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4563 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4564 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4565 |
* e1000_setup_led |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4566 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4567 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4568 |
* Prepares SW controlable LED for use and saves the current state of the LED. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4569 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4570 |
s32 e1000_setup_led(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4571 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4572 |
u32 ledctl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4573 |
s32 ret_val = E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4574 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4575 |
e_dbg("e1000_setup_led"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4576 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4577 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4578 |
case e1000_82542_rev2_0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4579 |
case e1000_82542_rev2_1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4580 |
case e1000_82543: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4581 |
case e1000_82544: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4582 |
/* No setup necessary */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4583 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4584 |
case e1000_82541: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4585 |
case e1000_82547: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4586 |
case e1000_82541_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4587 |
case e1000_82547_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4588 |
/* Turn off PHY Smart Power Down (if enabled) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4589 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4590 |
&hw->phy_spd_default); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4591 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4592 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4593 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4594 |
(u16) (hw->phy_spd_default & |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4595 |
~IGP01E1000_GMII_SPD)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4596 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4597 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4598 |
/* Fall Through */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4599 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4600 |
if (hw->media_type == e1000_media_type_fiber) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4601 |
ledctl = er32(LEDCTL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4602 |
/* Save current LEDCTL settings */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4603 |
hw->ledctl_default = ledctl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4604 |
/* Turn off LED0 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4605 |
ledctl &= ~(E1000_LEDCTL_LED0_IVRT | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4606 |
E1000_LEDCTL_LED0_BLINK | |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4607 |
E1000_LEDCTL_LED0_MODE_MASK); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4608 |
ledctl |= (E1000_LEDCTL_MODE_LED_OFF << |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4609 |
E1000_LEDCTL_LED0_MODE_SHIFT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4610 |
ew32(LEDCTL, ledctl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4611 |
} else if (hw->media_type == e1000_media_type_copper) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4612 |
ew32(LEDCTL, hw->ledctl_mode1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4613 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4614 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4615 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4616 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4617 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4618 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4619 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4620 |
* e1000_cleanup_led - Restores the saved state of the SW controlable LED. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4621 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4622 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4623 |
s32 e1000_cleanup_led(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4624 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4625 |
s32 ret_val = E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4626 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4627 |
e_dbg("e1000_cleanup_led"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4628 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4629 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4630 |
case e1000_82542_rev2_0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4631 |
case e1000_82542_rev2_1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4632 |
case e1000_82543: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4633 |
case e1000_82544: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4634 |
/* No cleanup necessary */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4635 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4636 |
case e1000_82541: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4637 |
case e1000_82547: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4638 |
case e1000_82541_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4639 |
case e1000_82547_rev_2: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4640 |
/* Turn on PHY Smart Power Down (if previously enabled) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4641 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4642 |
hw->phy_spd_default); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4643 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4644 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4645 |
/* Fall Through */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4646 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4647 |
/* Restore LEDCTL settings */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4648 |
ew32(LEDCTL, hw->ledctl_default); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4649 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4650 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4651 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4652 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4653 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4654 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4655 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4656 |
* e1000_led_on - Turns on the software controllable LED |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4657 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4658 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4659 |
s32 e1000_led_on(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4660 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4661 |
u32 ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4662 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4663 |
e_dbg("e1000_led_on"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4664 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4665 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4666 |
case e1000_82542_rev2_0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4667 |
case e1000_82542_rev2_1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4668 |
case e1000_82543: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4669 |
/* Set SW Defineable Pin 0 to turn on the LED */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4670 |
ctrl |= E1000_CTRL_SWDPIN0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4671 |
ctrl |= E1000_CTRL_SWDPIO0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4672 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4673 |
case e1000_82544: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4674 |
if (hw->media_type == e1000_media_type_fiber) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4675 |
/* Set SW Defineable Pin 0 to turn on the LED */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4676 |
ctrl |= E1000_CTRL_SWDPIN0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4677 |
ctrl |= E1000_CTRL_SWDPIO0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4678 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4679 |
/* Clear SW Defineable Pin 0 to turn on the LED */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4680 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4681 |
ctrl |= E1000_CTRL_SWDPIO0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4682 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4683 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4684 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4685 |
if (hw->media_type == e1000_media_type_fiber) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4686 |
/* Clear SW Defineable Pin 0 to turn on the LED */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4687 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4688 |
ctrl |= E1000_CTRL_SWDPIO0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4689 |
} else if (hw->media_type == e1000_media_type_copper) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4690 |
ew32(LEDCTL, hw->ledctl_mode2); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4691 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4692 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4693 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4694 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4695 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4696 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4697 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4698 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4699 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4700 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4701 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4702 |
* e1000_led_off - Turns off the software controllable LED |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4703 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4704 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4705 |
s32 e1000_led_off(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4706 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4707 |
u32 ctrl = er32(CTRL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4708 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4709 |
e_dbg("e1000_led_off"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4710 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4711 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4712 |
case e1000_82542_rev2_0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4713 |
case e1000_82542_rev2_1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4714 |
case e1000_82543: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4715 |
/* Clear SW Defineable Pin 0 to turn off the LED */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4716 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4717 |
ctrl |= E1000_CTRL_SWDPIO0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4718 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4719 |
case e1000_82544: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4720 |
if (hw->media_type == e1000_media_type_fiber) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4721 |
/* Clear SW Defineable Pin 0 to turn off the LED */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4722 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4723 |
ctrl |= E1000_CTRL_SWDPIO0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4724 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4725 |
/* Set SW Defineable Pin 0 to turn off the LED */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4726 |
ctrl |= E1000_CTRL_SWDPIN0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4727 |
ctrl |= E1000_CTRL_SWDPIO0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4728 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4729 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4730 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4731 |
if (hw->media_type == e1000_media_type_fiber) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4732 |
/* Set SW Defineable Pin 0 to turn off the LED */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4733 |
ctrl |= E1000_CTRL_SWDPIN0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4734 |
ctrl |= E1000_CTRL_SWDPIO0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4735 |
} else if (hw->media_type == e1000_media_type_copper) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4736 |
ew32(LEDCTL, hw->ledctl_mode1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4737 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4738 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4739 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4740 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4741 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4742 |
ew32(CTRL, ctrl); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4743 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4744 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4745 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4746 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4747 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4748 |
* e1000_clear_hw_cntrs - Clears all hardware statistics counters. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4749 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4750 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4751 |
static void e1000_clear_hw_cntrs(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4752 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4753 |
volatile u32 temp __attribute__ ((unused)); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4754 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4755 |
temp = er32(CRCERRS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4756 |
temp = er32(SYMERRS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4757 |
temp = er32(MPC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4758 |
temp = er32(SCC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4759 |
temp = er32(ECOL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4760 |
temp = er32(MCC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4761 |
temp = er32(LATECOL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4762 |
temp = er32(COLC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4763 |
temp = er32(DC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4764 |
temp = er32(SEC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4765 |
temp = er32(RLEC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4766 |
temp = er32(XONRXC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4767 |
temp = er32(XONTXC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4768 |
temp = er32(XOFFRXC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4769 |
temp = er32(XOFFTXC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4770 |
temp = er32(FCRUC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4771 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4772 |
temp = er32(PRC64); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4773 |
temp = er32(PRC127); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4774 |
temp = er32(PRC255); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4775 |
temp = er32(PRC511); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4776 |
temp = er32(PRC1023); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4777 |
temp = er32(PRC1522); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4778 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4779 |
temp = er32(GPRC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4780 |
temp = er32(BPRC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4781 |
temp = er32(MPRC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4782 |
temp = er32(GPTC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4783 |
temp = er32(GORCL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4784 |
temp = er32(GORCH); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4785 |
temp = er32(GOTCL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4786 |
temp = er32(GOTCH); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4787 |
temp = er32(RNBC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4788 |
temp = er32(RUC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4789 |
temp = er32(RFC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4790 |
temp = er32(ROC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4791 |
temp = er32(RJC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4792 |
temp = er32(TORL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4793 |
temp = er32(TORH); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4794 |
temp = er32(TOTL); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4795 |
temp = er32(TOTH); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4796 |
temp = er32(TPR); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4797 |
temp = er32(TPT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4798 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4799 |
temp = er32(PTC64); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4800 |
temp = er32(PTC127); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4801 |
temp = er32(PTC255); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4802 |
temp = er32(PTC511); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4803 |
temp = er32(PTC1023); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4804 |
temp = er32(PTC1522); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4805 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4806 |
temp = er32(MPTC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4807 |
temp = er32(BPTC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4808 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4809 |
if (hw->mac_type < e1000_82543) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4810 |
return; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4811 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4812 |
temp = er32(ALGNERRC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4813 |
temp = er32(RXERRC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4814 |
temp = er32(TNCRS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4815 |
temp = er32(CEXTERR); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4816 |
temp = er32(TSCTC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4817 |
temp = er32(TSCTFC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4818 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4819 |
if (hw->mac_type <= e1000_82544) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4820 |
return; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4821 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4822 |
temp = er32(MGTPRC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4823 |
temp = er32(MGTPDC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4824 |
temp = er32(MGTPTC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4825 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4826 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4827 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4828 |
* e1000_reset_adaptive - Resets Adaptive IFS to its default state. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4829 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4830 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4831 |
* Call this after e1000_init_hw. You may override the IFS defaults by setting |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4832 |
* hw->ifs_params_forced to true. However, you must initialize hw-> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4833 |
* current_ifs_val, ifs_min_val, ifs_max_val, ifs_step_size, and ifs_ratio |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4834 |
* before calling this function. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4835 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4836 |
void e1000_reset_adaptive(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4837 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4838 |
e_dbg("e1000_reset_adaptive"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4839 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4840 |
if (hw->adaptive_ifs) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4841 |
if (!hw->ifs_params_forced) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4842 |
hw->current_ifs_val = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4843 |
hw->ifs_min_val = IFS_MIN; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4844 |
hw->ifs_max_val = IFS_MAX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4845 |
hw->ifs_step_size = IFS_STEP; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4846 |
hw->ifs_ratio = IFS_RATIO; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4847 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4848 |
hw->in_ifs_mode = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4849 |
ew32(AIT, 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4850 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4851 |
e_dbg("Not in Adaptive IFS mode!\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4852 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4853 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4854 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4855 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4856 |
* e1000_update_adaptive - update adaptive IFS |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4857 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4858 |
* @tx_packets: Number of transmits since last callback |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4859 |
* @total_collisions: Number of collisions since last callback |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4860 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4861 |
* Called during the callback/watchdog routine to update IFS value based on |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4862 |
* the ratio of transmits to collisions. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4863 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4864 |
void e1000_update_adaptive(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4865 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4866 |
e_dbg("e1000_update_adaptive"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4867 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4868 |
if (hw->adaptive_ifs) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4869 |
if ((hw->collision_delta *hw->ifs_ratio) > hw->tx_packet_delta) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4870 |
if (hw->tx_packet_delta > MIN_NUM_XMITS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4871 |
hw->in_ifs_mode = true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4872 |
if (hw->current_ifs_val < hw->ifs_max_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4873 |
if (hw->current_ifs_val == 0) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4874 |
hw->current_ifs_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4875 |
hw->ifs_min_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4876 |
else |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4877 |
hw->current_ifs_val += |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4878 |
hw->ifs_step_size; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4879 |
ew32(AIT, hw->current_ifs_val); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4880 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4881 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4882 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4883 |
if (hw->in_ifs_mode |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4884 |
&& (hw->tx_packet_delta <= MIN_NUM_XMITS)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4885 |
hw->current_ifs_val = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4886 |
hw->in_ifs_mode = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4887 |
ew32(AIT, 0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4888 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4889 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4890 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4891 |
e_dbg("Not in Adaptive IFS mode!\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4892 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4893 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4894 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4895 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4896 |
* e1000_tbi_adjust_stats |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4897 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4898 |
* @frame_len: The length of the frame in question |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4899 |
* @mac_addr: The Ethernet destination address of the frame in question |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4900 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4901 |
* Adjusts the statistic counters when a frame is accepted by TBI_ACCEPT |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4902 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4903 |
void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4904 |
u32 frame_len, u8 *mac_addr) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4905 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4906 |
u64 carry_bit; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4907 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4908 |
/* First adjust the frame length. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4909 |
frame_len--; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4910 |
/* We need to adjust the statistics counters, since the hardware |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4911 |
* counters overcount this packet as a CRC error and undercount |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4912 |
* the packet as a good packet |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4913 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4914 |
/* This packet should not be counted as a CRC error. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4915 |
stats->crcerrs--; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4916 |
/* This packet does count as a Good Packet Received. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4917 |
stats->gprc++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4918 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4919 |
/* Adjust the Good Octets received counters */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4920 |
carry_bit = 0x80000000 & stats->gorcl; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4921 |
stats->gorcl += frame_len; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4922 |
/* If the high bit of Gorcl (the low 32 bits of the Good Octets |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4923 |
* Received Count) was one before the addition, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4924 |
* AND it is zero after, then we lost the carry out, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4925 |
* need to add one to Gorch (Good Octets Received Count High). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4926 |
* This could be simplified if all environments supported |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4927 |
* 64-bit integers. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4928 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4929 |
if (carry_bit && ((stats->gorcl & 0x80000000) == 0)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4930 |
stats->gorch++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4931 |
/* Is this a broadcast or multicast? Check broadcast first, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4932 |
* since the test for a multicast frame will test positive on |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4933 |
* a broadcast frame. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4934 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4935 |
if ((mac_addr[0] == (u8) 0xff) && (mac_addr[1] == (u8) 0xff)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4936 |
/* Broadcast packet */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4937 |
stats->bprc++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4938 |
else if (*mac_addr & 0x01) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4939 |
/* Multicast packet */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4940 |
stats->mprc++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4941 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4942 |
if (frame_len == hw->max_frame_size) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4943 |
/* In this case, the hardware has overcounted the number of |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4944 |
* oversize frames. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4945 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4946 |
if (stats->roc > 0) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4947 |
stats->roc--; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4948 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4949 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4950 |
/* Adjust the bin counters when the extra byte put the frame in the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4951 |
* wrong bin. Remember that the frame_len was adjusted above. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4952 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4953 |
if (frame_len == 64) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4954 |
stats->prc64++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4955 |
stats->prc127--; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4956 |
} else if (frame_len == 127) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4957 |
stats->prc127++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4958 |
stats->prc255--; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4959 |
} else if (frame_len == 255) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4960 |
stats->prc255++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4961 |
stats->prc511--; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4962 |
} else if (frame_len == 511) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4963 |
stats->prc511++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4964 |
stats->prc1023--; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4965 |
} else if (frame_len == 1023) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4966 |
stats->prc1023++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4967 |
stats->prc1522--; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4968 |
} else if (frame_len == 1522) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4969 |
stats->prc1522++; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4970 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4971 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4972 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4973 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4974 |
* e1000_get_bus_info |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4975 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4976 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4977 |
* Gets the current PCI bus type, speed, and width of the hardware |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4978 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4979 |
void e1000_get_bus_info(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4980 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4981 |
u32 status; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4982 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4983 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4984 |
case e1000_82542_rev2_0: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4985 |
case e1000_82542_rev2_1: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4986 |
hw->bus_type = e1000_bus_type_pci; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4987 |
hw->bus_speed = e1000_bus_speed_unknown; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4988 |
hw->bus_width = e1000_bus_width_unknown; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4989 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4990 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4991 |
status = er32(STATUS); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4992 |
hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4993 |
e1000_bus_type_pcix : e1000_bus_type_pci; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4994 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4995 |
if (hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4996 |
hw->bus_speed = (hw->bus_type == e1000_bus_type_pci) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4997 |
e1000_bus_speed_66 : e1000_bus_speed_120; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4998 |
} else if (hw->bus_type == e1000_bus_type_pci) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4999 |
hw->bus_speed = (status & E1000_STATUS_PCI66) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5000 |
e1000_bus_speed_66 : e1000_bus_speed_33; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5001 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5002 |
switch (status & E1000_STATUS_PCIX_SPEED) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5003 |
case E1000_STATUS_PCIX_SPEED_66: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5004 |
hw->bus_speed = e1000_bus_speed_66; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5005 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5006 |
case E1000_STATUS_PCIX_SPEED_100: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5007 |
hw->bus_speed = e1000_bus_speed_100; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5008 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5009 |
case E1000_STATUS_PCIX_SPEED_133: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5010 |
hw->bus_speed = e1000_bus_speed_133; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5011 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5012 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5013 |
hw->bus_speed = e1000_bus_speed_reserved; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5014 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5015 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5016 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5017 |
hw->bus_width = (status & E1000_STATUS_BUS64) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5018 |
e1000_bus_width_64 : e1000_bus_width_32; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5019 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5020 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5021 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5022 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5023 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5024 |
* e1000_write_reg_io |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5025 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5026 |
* @offset: offset to write to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5027 |
* @value: value to write |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5028 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5029 |
* Writes a value to one of the devices registers using port I/O (as opposed to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5030 |
* memory mapped I/O). Only 82544 and newer devices support port I/O. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5031 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5032 |
static void e1000_write_reg_io(struct e1000_hw *hw, u32 offset, u32 value) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5033 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5034 |
unsigned long io_addr = hw->io_base; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5035 |
unsigned long io_data = hw->io_base + 4; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5036 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5037 |
e1000_io_write(hw, io_addr, offset); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5038 |
e1000_io_write(hw, io_data, value); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5039 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5040 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5041 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5042 |
* e1000_get_cable_length - Estimates the cable length. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5043 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5044 |
* @min_length: The estimated minimum length |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5045 |
* @max_length: The estimated maximum length |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5046 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5047 |
* returns: - E1000_ERR_XXX |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5048 |
* E1000_SUCCESS |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5049 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5050 |
* This function always returns a ranged length (minimum & maximum). |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5051 |
* So for M88 phy's, this function interprets the one value returned from the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5052 |
* register to the minimum and maximum range. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5053 |
* For IGP phy's, the function calculates the range by the AGC registers. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5054 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5055 |
static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5056 |
u16 *max_length) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5057 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5058 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5059 |
u16 agc_value = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5060 |
u16 i, phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5061 |
u16 cable_length; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5062 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5063 |
e_dbg("e1000_get_cable_length"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5064 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5065 |
*min_length = *max_length = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5066 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5067 |
/* Use old method for Phy older than IGP */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5068 |
if (hw->phy_type == e1000_phy_m88) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5069 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5070 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5071 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5072 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5073 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5074 |
cable_length = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5075 |
M88E1000_PSSR_CABLE_LENGTH_SHIFT; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5076 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5077 |
/* Convert the enum value to ranged values */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5078 |
switch (cable_length) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5079 |
case e1000_cable_length_50: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5080 |
*min_length = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5081 |
*max_length = e1000_igp_cable_length_50; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5082 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5083 |
case e1000_cable_length_50_80: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5084 |
*min_length = e1000_igp_cable_length_50; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5085 |
*max_length = e1000_igp_cable_length_80; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5086 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5087 |
case e1000_cable_length_80_110: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5088 |
*min_length = e1000_igp_cable_length_80; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5089 |
*max_length = e1000_igp_cable_length_110; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5090 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5091 |
case e1000_cable_length_110_140: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5092 |
*min_length = e1000_igp_cable_length_110; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5093 |
*max_length = e1000_igp_cable_length_140; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5094 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5095 |
case e1000_cable_length_140: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5096 |
*min_length = e1000_igp_cable_length_140; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5097 |
*max_length = e1000_igp_cable_length_170; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5098 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5099 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5100 |
return -E1000_ERR_PHY; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5101 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5102 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5103 |
} else if (hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5104 |
u16 cur_agc_value; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5105 |
u16 min_agc_value = IGP01E1000_AGC_LENGTH_TABLE_SIZE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5106 |
static const u16 agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5107 |
IGP01E1000_PHY_AGC_A, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5108 |
IGP01E1000_PHY_AGC_B, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5109 |
IGP01E1000_PHY_AGC_C, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5110 |
IGP01E1000_PHY_AGC_D |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5111 |
}; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5112 |
/* Read the AGC registers for all channels */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5113 |
for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5114 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5115 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5116 |
e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5117 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5118 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5119 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5120 |
cur_agc_value = phy_data >> IGP01E1000_AGC_LENGTH_SHIFT; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5121 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5122 |
/* Value bound check. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5123 |
if ((cur_agc_value >= |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5124 |
IGP01E1000_AGC_LENGTH_TABLE_SIZE - 1) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5125 |
|| (cur_agc_value == 0)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5126 |
return -E1000_ERR_PHY; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5127 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5128 |
agc_value += cur_agc_value; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5129 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5130 |
/* Update minimal AGC value. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5131 |
if (min_agc_value > cur_agc_value) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5132 |
min_agc_value = cur_agc_value; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5133 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5134 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5135 |
/* Remove the minimal AGC result for length < 50m */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5136 |
if (agc_value < |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5137 |
IGP01E1000_PHY_CHANNEL_NUM * e1000_igp_cable_length_50) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5138 |
agc_value -= min_agc_value; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5139 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5140 |
/* Get the average length of the remaining 3 channels */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5141 |
agc_value /= (IGP01E1000_PHY_CHANNEL_NUM - 1); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5142 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5143 |
/* Get the average length of all the 4 channels. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5144 |
agc_value /= IGP01E1000_PHY_CHANNEL_NUM; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5145 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5146 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5147 |
/* Set the range of the calculated length. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5148 |
*min_length = ((e1000_igp_cable_length_table[agc_value] - |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5149 |
IGP01E1000_AGC_RANGE) > 0) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5150 |
(e1000_igp_cable_length_table[agc_value] - |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5151 |
IGP01E1000_AGC_RANGE) : 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5152 |
*max_length = e1000_igp_cable_length_table[agc_value] + |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5153 |
IGP01E1000_AGC_RANGE; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5154 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5155 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5156 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5157 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5158 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5159 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5160 |
* e1000_check_polarity - Check the cable polarity |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5161 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5162 |
* @polarity: output parameter : 0 - Polarity is not reversed |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5163 |
* 1 - Polarity is reversed. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5164 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5165 |
* returns: - E1000_ERR_XXX |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5166 |
* E1000_SUCCESS |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5167 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5168 |
* For phy's older than IGP, this function simply reads the polarity bit in the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5169 |
* Phy Status register. For IGP phy's, this bit is valid only if link speed is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5170 |
* 10 Mbps. If the link speed is 100 Mbps there is no polarity so this bit will |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5171 |
* return 0. If the link speed is 1000 Mbps the polarity status is in the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5172 |
* IGP01E1000_PHY_PCS_INIT_REG. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5173 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5174 |
static s32 e1000_check_polarity(struct e1000_hw *hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5175 |
e1000_rev_polarity *polarity) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5176 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5177 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5178 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5179 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5180 |
e_dbg("e1000_check_polarity"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5181 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5182 |
if (hw->phy_type == e1000_phy_m88) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5183 |
/* return the Polarity bit in the Status register. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5184 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5185 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5186 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5187 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5188 |
*polarity = ((phy_data & M88E1000_PSSR_REV_POLARITY) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5189 |
M88E1000_PSSR_REV_POLARITY_SHIFT) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5190 |
e1000_rev_polarity_reversed : e1000_rev_polarity_normal; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5191 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5192 |
} else if (hw->phy_type == e1000_phy_igp) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5193 |
/* Read the Status register to check the speed */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5194 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5195 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5196 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5197 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5198 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5199 |
/* If speed is 1000 Mbps, must read the IGP01E1000_PHY_PCS_INIT_REG to |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5200 |
* find the polarity status */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5201 |
if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) == |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5202 |
IGP01E1000_PSSR_SPEED_1000MBPS) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5203 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5204 |
/* Read the GIG initialization PCS register (0x00B4) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5205 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5206 |
e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5207 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5208 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5209 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5210 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5211 |
/* Check the polarity bits */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5212 |
*polarity = (phy_data & IGP01E1000_PHY_POLARITY_MASK) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5213 |
e1000_rev_polarity_reversed : |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5214 |
e1000_rev_polarity_normal; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5215 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5216 |
/* For 10 Mbps, read the polarity bit in the status register. (for |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5217 |
* 100 Mbps this bit is always 0) */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5218 |
*polarity = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5219 |
(phy_data & IGP01E1000_PSSR_POLARITY_REVERSED) ? |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5220 |
e1000_rev_polarity_reversed : |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5221 |
e1000_rev_polarity_normal; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5222 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5223 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5224 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5225 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5226 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5227 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5228 |
* e1000_check_downshift - Check if Downshift occurred |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5229 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5230 |
* @downshift: output parameter : 0 - No Downshift occurred. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5231 |
* 1 - Downshift occurred. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5232 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5233 |
* returns: - E1000_ERR_XXX |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5234 |
* E1000_SUCCESS |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5235 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5236 |
* For phy's older than IGP, this function reads the Downshift bit in the Phy |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5237 |
* Specific Status register. For IGP phy's, it reads the Downgrade bit in the |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5238 |
* Link Health register. In IGP this bit is latched high, so the driver must |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5239 |
* read it immediately after link is established. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5240 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5241 |
static s32 e1000_check_downshift(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5242 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5243 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5244 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5245 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5246 |
e_dbg("e1000_check_downshift"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5247 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5248 |
if (hw->phy_type == e1000_phy_igp) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5249 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5250 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5251 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5252 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5253 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5254 |
hw->speed_downgraded = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5255 |
(phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5256 |
} else if (hw->phy_type == e1000_phy_m88) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5257 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5258 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5259 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5260 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5261 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5262 |
hw->speed_downgraded = (phy_data & M88E1000_PSSR_DOWNSHIFT) >> |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5263 |
M88E1000_PSSR_DOWNSHIFT_SHIFT; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5264 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5265 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5266 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5267 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5268 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5269 |
static const u16 dsp_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5270 |
IGP01E1000_PHY_AGC_PARAM_A, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5271 |
IGP01E1000_PHY_AGC_PARAM_B, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5272 |
IGP01E1000_PHY_AGC_PARAM_C, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5273 |
IGP01E1000_PHY_AGC_PARAM_D |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5274 |
}; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5275 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5276 |
static s32 e1000_1000Mb_check_cable_length(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5277 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5278 |
u16 min_length, max_length; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5279 |
u16 phy_data, i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5280 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5281 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5282 |
ret_val = e1000_get_cable_length(hw, &min_length, &max_length); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5283 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5284 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5285 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5286 |
if (hw->dsp_config_state != e1000_dsp_config_enabled) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5287 |
return 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5288 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5289 |
if (min_length >= e1000_igp_cable_length_50) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5290 |
for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5291 |
ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5292 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5293 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5294 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5295 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5296 |
phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5297 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5298 |
ret_val = e1000_write_phy_reg(hw, dsp_reg_array[i], |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5299 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5300 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5301 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5302 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5303 |
hw->dsp_config_state = e1000_dsp_config_activated; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5304 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5305 |
u16 ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_20; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5306 |
u32 idle_errs = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5307 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5308 |
/* clear previous idle error counts */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5309 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5310 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5311 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5312 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5313 |
for (i = 0; i < ffe_idle_err_timeout; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5314 |
udelay(1000); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5315 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5316 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5317 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5318 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5319 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5320 |
idle_errs += (phy_data & SR_1000T_IDLE_ERROR_CNT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5321 |
if (idle_errs > SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5322 |
hw->ffe_config_state = e1000_ffe_config_active; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5323 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5324 |
ret_val = e1000_write_phy_reg(hw, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5325 |
IGP01E1000_PHY_DSP_FFE, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5326 |
IGP01E1000_PHY_DSP_FFE_CM_CP); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5327 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5328 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5329 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5330 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5331 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5332 |
if (idle_errs) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5333 |
ffe_idle_err_timeout = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5334 |
FFE_IDLE_ERR_COUNT_TIMEOUT_100; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5335 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5336 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5337 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5338 |
return 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5339 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5340 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5341 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5342 |
* e1000_config_dsp_after_link_change |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5343 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5344 |
* @link_up: was link up at the time this was called |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5345 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5346 |
* returns: - E1000_ERR_PHY if fail to read/write the PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5347 |
* E1000_SUCCESS at any other case. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5348 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5349 |
* 82541_rev_2 & 82547_rev_2 have the capability to configure the DSP when a |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5350 |
* gigabit link is achieved to improve link quality. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5351 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5352 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5353 |
static s32 e1000_config_dsp_after_link_change(struct e1000_hw *hw, bool link_up) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5354 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5355 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5356 |
u16 phy_data, phy_saved_data, speed, duplex, i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5357 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5358 |
e_dbg("e1000_config_dsp_after_link_change"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5359 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5360 |
if (hw->phy_type != e1000_phy_igp) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5361 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5362 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5363 |
if (link_up) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5364 |
ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5365 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5366 |
e_dbg("Error getting link speed and duplex\n"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5367 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5368 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5369 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5370 |
if (speed == SPEED_1000) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5371 |
ret_val = e1000_1000Mb_check_cable_length(hw); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5372 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5373 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5374 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5375 |
} else { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5376 |
if (hw->dsp_config_state == e1000_dsp_config_activated) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5377 |
/* Save off the current value of register 0x2F5B to be restored at |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5378 |
* the end of the routines. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5379 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5380 |
e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5381 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5382 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5383 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5384 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5385 |
/* Disable the PHY transmitter */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5386 |
ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5387 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5388 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5389 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5390 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5391 |
msleep(20); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5392 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5393 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5394 |
IGP01E1000_IEEE_FORCE_GIGA); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5395 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5396 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5397 |
for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5398 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5399 |
e1000_read_phy_reg(hw, dsp_reg_array[i], |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5400 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5401 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5402 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5403 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5404 |
phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5405 |
phy_data |= IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5406 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5407 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5408 |
e1000_write_phy_reg(hw, dsp_reg_array[i], |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5409 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5410 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5411 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5412 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5413 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5414 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5415 |
IGP01E1000_IEEE_RESTART_AUTONEG); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5416 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5417 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5418 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5419 |
msleep(20); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5420 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5421 |
/* Now enable the transmitter */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5422 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5423 |
e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5424 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5425 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5426 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5427 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5428 |
hw->dsp_config_state = e1000_dsp_config_enabled; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5429 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5430 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5431 |
if (hw->ffe_config_state == e1000_ffe_config_active) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5432 |
/* Save off the current value of register 0x2F5B to be restored at |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5433 |
* the end of the routines. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5434 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5435 |
e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5436 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5437 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5438 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5439 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5440 |
/* Disable the PHY transmitter */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5441 |
ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5442 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5443 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5444 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5445 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5446 |
msleep(20); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5447 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5448 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5449 |
IGP01E1000_IEEE_FORCE_GIGA); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5450 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5451 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5452 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5453 |
e1000_write_phy_reg(hw, IGP01E1000_PHY_DSP_FFE, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5454 |
IGP01E1000_PHY_DSP_FFE_DEFAULT); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5455 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5456 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5457 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5458 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5459 |
IGP01E1000_IEEE_RESTART_AUTONEG); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5460 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5461 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5462 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5463 |
msleep(20); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5464 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5465 |
/* Now enable the transmitter */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5466 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5467 |
e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5468 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5469 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5470 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5471 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5472 |
hw->ffe_config_state = e1000_ffe_config_enabled; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5473 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5474 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5475 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5476 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5477 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5478 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5479 |
* e1000_set_phy_mode - Set PHY to class A mode |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5480 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5481 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5482 |
* Assumes the following operations will follow to enable the new class mode. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5483 |
* 1. Do a PHY soft reset |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5484 |
* 2. Restart auto-negotiation or force link. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5485 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5486 |
static s32 e1000_set_phy_mode(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5487 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5488 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5489 |
u16 eeprom_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5490 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5491 |
e_dbg("e1000_set_phy_mode"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5492 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5493 |
if ((hw->mac_type == e1000_82545_rev_3) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5494 |
(hw->media_type == e1000_media_type_copper)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5495 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5496 |
e1000_read_eeprom(hw, EEPROM_PHY_CLASS_WORD, 1, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5497 |
&eeprom_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5498 |
if (ret_val) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5499 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5500 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5501 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5502 |
if ((eeprom_data != EEPROM_RESERVED_WORD) && |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5503 |
(eeprom_data & EEPROM_PHY_CLASS_A)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5504 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5505 |
e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5506 |
0x000B); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5507 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5508 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5509 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5510 |
e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5511 |
0x8104); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5512 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5513 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5514 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5515 |
hw->phy_reset_disable = false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5516 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5517 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5518 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5519 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5520 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5521 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5522 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5523 |
* e1000_set_d3_lplu_state - set d3 link power state |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5524 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5525 |
* @active: true to enable lplu false to disable lplu. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5526 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5527 |
* This function sets the lplu state according to the active flag. When |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5528 |
* activating lplu this function also disables smart speed and vise versa. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5529 |
* lplu will not be activated unless the device autonegotiation advertisement |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5530 |
* meets standards of either 10 or 10/100 or 10/100/1000 at all duplexes. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5531 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5532 |
* returns: - E1000_ERR_PHY if fail to read/write the PHY |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5533 |
* E1000_SUCCESS at any other case. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5534 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5535 |
static s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5536 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5537 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5538 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5539 |
e_dbg("e1000_set_d3_lplu_state"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5540 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5541 |
if (hw->phy_type != e1000_phy_igp) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5542 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5543 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5544 |
/* During driver activity LPLU should not be used or it will attain link |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5545 |
* from the lowest speeds starting from 10Mbps. The capability is used for |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5546 |
* Dx transitions and states */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5547 |
if (hw->mac_type == e1000_82541_rev_2 |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5548 |
|| hw->mac_type == e1000_82547_rev_2) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5549 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5550 |
e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5551 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5552 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5553 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5554 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5555 |
if (!active) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5556 |
if (hw->mac_type == e1000_82541_rev_2 || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5557 |
hw->mac_type == e1000_82547_rev_2) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5558 |
phy_data &= ~IGP01E1000_GMII_FLEX_SPD; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5559 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5560 |
e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5561 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5562 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5563 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5564 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5565 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5566 |
/* LPLU and SmartSpeed are mutually exclusive. LPLU is used during |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5567 |
* Dx states where the power conservation is most important. During |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5568 |
* driver activity we should enable SmartSpeed, so performance is |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5569 |
* maintained. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5570 |
if (hw->smart_speed == e1000_smart_speed_on) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5571 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5572 |
e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5573 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5574 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5575 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5576 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5577 |
phy_data |= IGP01E1000_PSCFR_SMART_SPEED; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5578 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5579 |
e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5580 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5581 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5582 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5583 |
} else if (hw->smart_speed == e1000_smart_speed_off) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5584 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5585 |
e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5586 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5587 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5588 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5589 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5590 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5591 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5592 |
e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5593 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5594 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5595 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5596 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5597 |
} else if ((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5598 |
|| (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5599 |
|| (hw->autoneg_advertised == |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5600 |
AUTONEG_ADVERTISE_10_100_ALL)) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5601 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5602 |
if (hw->mac_type == e1000_82541_rev_2 || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5603 |
hw->mac_type == e1000_82547_rev_2) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5604 |
phy_data |= IGP01E1000_GMII_FLEX_SPD; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5605 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5606 |
e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5607 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5608 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5609 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5610 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5611 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5612 |
/* When LPLU is enabled we should disable SmartSpeed */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5613 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5614 |
e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5615 |
&phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5616 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5617 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5618 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5619 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5620 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5621 |
e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5622 |
phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5623 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5624 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5625 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5626 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5627 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5628 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5629 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5630 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5631 |
* e1000_set_vco_speed |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5632 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5633 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5634 |
* Change VCO speed register to improve Bit Error Rate performance of SERDES. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5635 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5636 |
static s32 e1000_set_vco_speed(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5637 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5638 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5639 |
u16 default_page = 0; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5640 |
u16 phy_data; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5641 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5642 |
e_dbg("e1000_set_vco_speed"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5643 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5644 |
switch (hw->mac_type) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5645 |
case e1000_82545_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5646 |
case e1000_82546_rev_3: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5647 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5648 |
default: |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5649 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5650 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5651 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5652 |
/* Set PHY register 30, page 5, bit 8 to 0 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5653 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5654 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5655 |
e1000_read_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, &default_page); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5656 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5657 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5658 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5659 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5660 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5661 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5662 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5663 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5664 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5665 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5666 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5667 |
phy_data &= ~M88E1000_PHY_VCO_REG_BIT8; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5668 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5669 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5670 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5671 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5672 |
/* Set PHY register 30, page 4, bit 11 to 1 */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5673 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5674 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5675 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5676 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5677 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5678 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5679 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5680 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5681 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5682 |
phy_data |= M88E1000_PHY_VCO_REG_BIT11; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5683 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5684 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5685 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5686 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5687 |
ret_val = |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5688 |
e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, default_page); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5689 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5690 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5691 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5692 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5693 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5694 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5695 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5696 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5697 |
* e1000_enable_mng_pass_thru - check for bmc pass through |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5698 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5699 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5700 |
* Verifies the hardware needs to allow ARPs to be processed by the host |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5701 |
* returns: - true/false |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5702 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5703 |
u32 e1000_enable_mng_pass_thru(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5704 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5705 |
u32 manc; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5706 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5707 |
if (hw->asf_firmware_present) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5708 |
manc = er32(MANC); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5709 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5710 |
if (!(manc & E1000_MANC_RCV_TCO_EN) || |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5711 |
!(manc & E1000_MANC_EN_MAC_ADDR_FILTER)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5712 |
return false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5713 |
if ((manc & E1000_MANC_SMBUS_EN) && !(manc & E1000_MANC_ASF_EN)) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5714 |
return true; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5715 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5716 |
return false; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5717 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5718 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5719 |
static s32 e1000_polarity_reversal_workaround(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5720 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5721 |
s32 ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5722 |
u16 mii_status_reg; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5723 |
u16 i; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5724 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5725 |
/* Polarity reversal workaround for forced 10F/10H links. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5726 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5727 |
/* Disable the transmitter on the PHY */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5728 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5729 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5730 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5731 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5732 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFFF); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5733 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5734 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5735 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5736 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5737 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5738 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5739 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5740 |
/* This loop will early-out if the NO link condition has been met. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5741 |
for (i = PHY_FORCE_TIME; i > 0; i--) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5742 |
/* Read the MII Status Register and wait for Link Status bit |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5743 |
* to be clear. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5744 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5745 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5746 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5747 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5748 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5749 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5750 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5751 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5752 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5753 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5754 |
if ((mii_status_reg & ~MII_SR_LINK_STATUS) == 0) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5755 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5756 |
msleep(100); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5757 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5758 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5759 |
/* Recommended delay time after link has been lost */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5760 |
msleep(1000); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5761 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5762 |
/* Now we will re-enable th transmitter on the PHY */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5763 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5764 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5765 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5766 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5767 |
msleep(50); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5768 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFF0); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5769 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5770 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5771 |
msleep(50); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5772 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFF00); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5773 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5774 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5775 |
msleep(50); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5776 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x0000); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5777 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5778 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5779 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5780 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5781 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5782 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5783 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5784 |
/* This loop will early-out if the link condition has been met. */ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5785 |
for (i = PHY_FORCE_TIME; i > 0; i--) { |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5786 |
/* Read the MII Status Register and wait for Link Status bit |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5787 |
* to be set. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5788 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5789 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5790 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5791 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5792 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5793 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5794 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5795 |
if (ret_val) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5796 |
return ret_val; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5797 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5798 |
if (mii_status_reg & MII_SR_LINK_STATUS) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5799 |
break; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5800 |
msleep(100); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5801 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5802 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5803 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5804 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5805 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5806 |
* e1000_get_auto_rd_done |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5807 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5808 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5809 |
* Check for EEPROM Auto Read bit done. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5810 |
* returns: - E1000_ERR_RESET if fail to reset MAC |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5811 |
* E1000_SUCCESS at any other case. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5812 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5813 |
static s32 e1000_get_auto_rd_done(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5814 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5815 |
e_dbg("e1000_get_auto_rd_done"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5816 |
msleep(5); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5817 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5818 |
} |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5819 |
|
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5820 |
/** |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5821 |
* e1000_get_phy_cfg_done |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5822 |
* @hw: Struct containing variables accessed by shared code |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5823 |
* |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5824 |
* Checks if the PHY configuration is done |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5825 |
* returns: - E1000_ERR_RESET if fail to reset MAC |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5826 |
* E1000_SUCCESS at any other case. |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5827 |
*/ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5828 |
static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw) |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5829 |
{ |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5830 |
e_dbg("e1000_get_phy_cfg_done"); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5831 |
msleep(10); |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5832 |
return E1000_SUCCESS; |
0e3d989ff233
Added all drivers for kernel 3.8.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5833 |
} |