author | Florian Pose <fp@igh.de> |
Fri, 27 Oct 2017 12:18:11 +0200 | |
branch | stable-1.5 |
changeset 2690 | d984f57bef97 |
parent 1360 | afcea72f0040 |
permissions | -rw-r--r-- |
1360
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/******************************************************************************* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
Intel PRO/1000 Linux driver |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
Copyright(c) 1999 - 2006 Intel Corporation. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
This program is free software; you can redistribute it and/or modify it |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
under the terms and conditions of the GNU General Public License, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
version 2, as published by the Free Software Foundation. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
This program is distributed in the hope it will be useful, but WITHOUT |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
more details. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
You should have received a copy of the GNU General Public License along with |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
this program; if not, write to the Free Software Foundation, Inc., |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
The full GNU General Public License is included in this distribution in |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
the file called "COPYING". |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
Contact Information: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
Linux NICS <linux.nics@intel.com> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
*******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
/* e1000_hw.c |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* Shared functions for accessing and configuring the MAC |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
#include "e1000_hw-2.6.26-ethercat.h" |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
static s32 e1000_swfw_sync_acquire(struct e1000_hw *hw, u16 mask); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
static void e1000_swfw_sync_release(struct e1000_hw *hw, u16 mask); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
static s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 reg_addr, u16 *data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
static s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 reg_addr, u16 data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
static s32 e1000_get_software_semaphore(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
static void e1000_release_software_semaphore(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
static u8 e1000_arc_subsystem_valid(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
static s32 e1000_check_downshift(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
static s32 e1000_check_polarity(struct e1000_hw *hw, e1000_rev_polarity *polarity); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
static void e1000_clear_hw_cntrs(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
static void e1000_clear_vfta(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
static s32 e1000_commit_shadow_ram(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
static s32 e1000_config_dsp_after_link_change(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
bool link_up); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
static s32 e1000_config_fc_after_link_up(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
static s32 e1000_detect_gig_phy(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
static s32 e1000_erase_ich8_4k_segment(struct e1000_hw *hw, u32 bank); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
static s32 e1000_get_auto_rd_done(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length, u16 *max_length); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
static s32 e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
static s32 e1000_get_software_flag(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
static s32 e1000_ich8_cycle_init(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
static s32 e1000_ich8_flash_cycle(struct e1000_hw *hw, u32 timeout); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
static s32 e1000_id_led_init(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
static s32 e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, u32 cnf_base_addr, u32 cnf_size); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
static s32 e1000_init_lcd_from_nvm(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
static void e1000_init_rx_addrs(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
static void e1000_initialize_hardware_bits(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
static bool e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
static s32 e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
static s32 e1000_mng_enable_host_if(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
static s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length, u16 offset, u8 *sum); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
static s32 e1000_mng_write_cmd_header(struct e1000_hw* hw, struct e1000_host_mng_command_header* hdr); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
static s32 e1000_mng_write_commit(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
static s32 e1000_phy_ife_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
static s32 e1000_phy_igp_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
static s32 e1000_read_eeprom_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
static s32 e1000_write_eeprom_eewr(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
static s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
static s32 e1000_phy_m88_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
static void e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
static s32 e1000_read_ich8_byte(struct e1000_hw *hw, u32 index, u8 *data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
static s32 e1000_verify_write_ich8_byte(struct e1000_hw *hw, u32 index, u8 byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
static s32 e1000_write_ich8_byte(struct e1000_hw *hw, u32 index, u8 byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
static s32 e1000_read_ich8_word(struct e1000_hw *hw, u32 index, u16 *data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
static s32 e1000_read_ich8_data(struct e1000_hw *hw, u32 index, u32 size, u16 *data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
static s32 e1000_write_ich8_data(struct e1000_hw *hw, u32 index, u32 size, u16 data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
static s32 e1000_read_eeprom_ich8(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
static s32 e1000_write_eeprom_ich8(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
static void e1000_release_software_flag(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
static s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
static s32 e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, u32 no_snoop); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
static void e1000_set_pci_express_master_disable(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
static s32 e1000_wait_autoneg(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
static void e1000_write_reg_io(struct e1000_hw *hw, u32 offset, u32 value); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
static s32 e1000_set_phy_type(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
static void e1000_phy_init_script(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
static s32 e1000_setup_copper_link(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
static s32 e1000_adjust_serdes_amplitude(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
static s32 e1000_config_mac_to_phy(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
static void e1000_raise_mdi_clk(struct e1000_hw *hw, u32 *ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
static void e1000_lower_mdi_clk(struct e1000_hw *hw, u32 *ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
static void e1000_shift_out_mdi_bits(struct e1000_hw *hw, u32 data, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
u16 count); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
static u16 e1000_shift_in_mdi_bits(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
static s32 e1000_phy_reset_dsp(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
static s32 e1000_write_eeprom_spi(struct e1000_hw *hw, u16 offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
u16 words, u16 *data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
u16 offset, u16 words, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
u16 *data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
static void e1000_raise_ee_clk(struct e1000_hw *hw, u32 *eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
static void e1000_lower_ee_clk(struct e1000_hw *hw, u32 *eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
static void e1000_shift_out_ee_bits(struct e1000_hw *hw, u16 data, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
u16 count); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
u16 phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw,u32 reg_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
u16 *phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
static u16 e1000_shift_in_ee_bits(struct e1000_hw *hw, u16 count); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
static s32 e1000_acquire_eeprom(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
static void e1000_release_eeprom(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
static void e1000_standby_eeprom(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
static s32 e1000_set_vco_speed(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
static s32 e1000_polarity_reversal_workaround(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
static s32 e1000_set_phy_mode(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
static s32 e1000_host_if_read_cookie(struct e1000_hw *hw, u8 *buffer); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
static u8 e1000_calculate_mng_checksum(char *buffer, u32 length); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
static s32 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
u16 duplex); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
static s32 e1000_configure_kmrn_for_1000(struct e1000_hw *hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
/* IGP cable length table */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
static const |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
u16 e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
{ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
5, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 25, 25, 25, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
25, 25, 25, 25, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
40, 50, 50, 50, 50, 50, 50, 50, 60, 60, 60, 60, 60, 60, 60, 60, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
60, 70, 70, 70, 70, 70, 70, 80, 80, 80, 80, 80, 80, 90, 90, 90, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
90, 90, 90, 90, 90, 90, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
100, 100, 100, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
110, 110, 110, 110, 110, 110, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120}; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
static const |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
u16 e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] = |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
{ 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
0, 0, 0, 3, 6, 10, 13, 16, 19, 23, 26, 29, 32, 35, 38, 41, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
6, 10, 14, 18, 22, 26, 30, 33, 37, 41, 44, 48, 51, 54, 58, 61, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
21, 26, 31, 35, 40, 44, 49, 53, 57, 61, 65, 68, 72, 75, 79, 82, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
40, 45, 51, 56, 61, 66, 70, 75, 79, 83, 87, 91, 94, 98, 101, 104, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
60, 66, 72, 77, 82, 87, 92, 96, 100, 104, 108, 111, 114, 117, 119, 121, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
104, 109, 114, 118, 121, 124}; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
* Set the phy type member in the hw struct. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
e1000_set_phy_type(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
DEBUGFUNC("e1000_set_phy_type"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
if (hw->mac_type == e1000_undefined) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
return -E1000_ERR_PHY_TYPE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
switch (hw->phy_id) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
case M88E1000_E_PHY_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
case M88E1000_I_PHY_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
case M88E1011_I_PHY_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
case M88E1111_I_PHY_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
hw->phy_type = e1000_phy_m88; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
case IGP01E1000_I_PHY_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
if (hw->mac_type == e1000_82541 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
hw->mac_type == e1000_82541_rev_2 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
hw->mac_type == e1000_82547 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
hw->mac_type == e1000_82547_rev_2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
hw->phy_type = e1000_phy_igp; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
case IGP03E1000_E_PHY_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
hw->phy_type = e1000_phy_igp_3; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
case IFE_E_PHY_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
case IFE_PLUS_E_PHY_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
case IFE_C_E_PHY_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
hw->phy_type = e1000_phy_ife; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
case GG82563_E_PHY_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
if (hw->mac_type == e1000_80003es2lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
hw->phy_type = e1000_phy_gg82563; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
/* Fall Through */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
/* Should never have loaded on this device */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
hw->phy_type = e1000_phy_undefined; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
return -E1000_ERR_PHY_TYPE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
* IGP phy init script - initializes the GbE PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
e1000_phy_init_script(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
u32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
u16 phy_saved_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
DEBUGFUNC("e1000_phy_init_script"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
if (hw->phy_init_script) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
msleep(20); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
/* Save off the current value of register 0x2F5B to be restored at |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
* the end of this routine. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
/* Disabled the PHY transmitter */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
msleep(20); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
e1000_write_phy_reg(hw,0x0000,0x0140); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
msleep(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
case e1000_82541: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
case e1000_82547: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
e1000_write_phy_reg(hw, 0x1F95, 0x0001); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
e1000_write_phy_reg(hw, 0x1F71, 0xBD21); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
e1000_write_phy_reg(hw, 0x1F79, 0x0018); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
e1000_write_phy_reg(hw, 0x1F30, 0x1600); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
e1000_write_phy_reg(hw, 0x1F31, 0x0014); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
e1000_write_phy_reg(hw, 0x1F32, 0x161C); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
e1000_write_phy_reg(hw, 0x1F94, 0x0003); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
e1000_write_phy_reg(hw, 0x1F96, 0x003F); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
e1000_write_phy_reg(hw, 0x2010, 0x0008); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
case e1000_82541_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
case e1000_82547_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
e1000_write_phy_reg(hw, 0x1F73, 0x0099); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
e1000_write_phy_reg(hw, 0x0000, 0x3300); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
msleep(20); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
/* Now enable the transmitter */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
if (hw->mac_type == e1000_82547) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
u16 fused, fine, coarse; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
/* Move to analog registers page */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
e1000_read_phy_reg(hw, IGP01E1000_ANALOG_SPARE_FUSE_STATUS, &fused); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
if (!(fused & IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
e1000_read_phy_reg(hw, IGP01E1000_ANALOG_FUSE_STATUS, &fused); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
fine = fused & IGP01E1000_ANALOG_FUSE_FINE_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
coarse = fused & IGP01E1000_ANALOG_FUSE_COARSE_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
if (coarse > IGP01E1000_ANALOG_FUSE_COARSE_THRESH) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
coarse -= IGP01E1000_ANALOG_FUSE_COARSE_10; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
fine -= IGP01E1000_ANALOG_FUSE_FINE_1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
} else if (coarse == IGP01E1000_ANALOG_FUSE_COARSE_THRESH) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
fine -= IGP01E1000_ANALOG_FUSE_FINE_10; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
fused = (fused & IGP01E1000_ANALOG_FUSE_POLY_MASK) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
(fine & IGP01E1000_ANALOG_FUSE_FINE_MASK) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
(coarse & IGP01E1000_ANALOG_FUSE_COARSE_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_CONTROL, fused); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
e1000_write_phy_reg(hw, IGP01E1000_ANALOG_FUSE_BYPASS, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
* Set the mac type member in the hw struct. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
e1000_set_mac_type(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
DEBUGFUNC("e1000_set_mac_type"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
switch (hw->device_id) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
case E1000_DEV_ID_82542: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
switch (hw->revision_id) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
case E1000_82542_2_0_REV_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
hw->mac_type = e1000_82542_rev2_0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
case E1000_82542_2_1_REV_ID: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
hw->mac_type = e1000_82542_rev2_1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
/* Invalid 82542 revision ID */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
return -E1000_ERR_MAC_TYPE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
case E1000_DEV_ID_82543GC_FIBER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
case E1000_DEV_ID_82543GC_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
hw->mac_type = e1000_82543; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
case E1000_DEV_ID_82544EI_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
case E1000_DEV_ID_82544EI_FIBER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
case E1000_DEV_ID_82544GC_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
case E1000_DEV_ID_82544GC_LOM: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
hw->mac_type = e1000_82544; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
case E1000_DEV_ID_82540EM: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
case E1000_DEV_ID_82540EM_LOM: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
case E1000_DEV_ID_82540EP: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
case E1000_DEV_ID_82540EP_LOM: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
case E1000_DEV_ID_82540EP_LP: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
hw->mac_type = e1000_82540; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
case E1000_DEV_ID_82545EM_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
case E1000_DEV_ID_82545EM_FIBER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
hw->mac_type = e1000_82545; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
case E1000_DEV_ID_82545GM_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
case E1000_DEV_ID_82545GM_FIBER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
case E1000_DEV_ID_82545GM_SERDES: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
hw->mac_type = e1000_82545_rev_3; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
case E1000_DEV_ID_82546EB_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
case E1000_DEV_ID_82546EB_FIBER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
case E1000_DEV_ID_82546EB_QUAD_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
hw->mac_type = e1000_82546; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
case E1000_DEV_ID_82546GB_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
case E1000_DEV_ID_82546GB_FIBER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
case E1000_DEV_ID_82546GB_SERDES: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
case E1000_DEV_ID_82546GB_PCIE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
case E1000_DEV_ID_82546GB_QUAD_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
hw->mac_type = e1000_82546_rev_3; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
case E1000_DEV_ID_82541EI: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
case E1000_DEV_ID_82541EI_MOBILE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
case E1000_DEV_ID_82541ER_LOM: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
hw->mac_type = e1000_82541; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
case E1000_DEV_ID_82541ER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
case E1000_DEV_ID_82541GI: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
case E1000_DEV_ID_82541GI_LF: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
case E1000_DEV_ID_82541GI_MOBILE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
hw->mac_type = e1000_82541_rev_2; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
case E1000_DEV_ID_82547EI: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
case E1000_DEV_ID_82547EI_MOBILE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
hw->mac_type = e1000_82547; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
case E1000_DEV_ID_82547GI: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
hw->mac_type = e1000_82547_rev_2; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
case E1000_DEV_ID_82571EB_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
case E1000_DEV_ID_82571EB_FIBER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
case E1000_DEV_ID_82571EB_SERDES: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
case E1000_DEV_ID_82571EB_SERDES_DUAL: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
case E1000_DEV_ID_82571EB_SERDES_QUAD: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
case E1000_DEV_ID_82571EB_QUAD_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
case E1000_DEV_ID_82571PT_QUAD_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
case E1000_DEV_ID_82571EB_QUAD_FIBER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
hw->mac_type = e1000_82571; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
case E1000_DEV_ID_82572EI_COPPER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
case E1000_DEV_ID_82572EI_FIBER: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
case E1000_DEV_ID_82572EI_SERDES: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
case E1000_DEV_ID_82572EI: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
hw->mac_type = e1000_82572; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
case E1000_DEV_ID_82573E: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
case E1000_DEV_ID_82573E_IAMT: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
case E1000_DEV_ID_82573L: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
hw->mac_type = e1000_82573; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
case E1000_DEV_ID_80003ES2LAN_COPPER_SPT: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
case E1000_DEV_ID_80003ES2LAN_SERDES_SPT: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
case E1000_DEV_ID_80003ES2LAN_COPPER_DPT: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
hw->mac_type = e1000_80003es2lan; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
case E1000_DEV_ID_ICH8_IGP_M_AMT: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
case E1000_DEV_ID_ICH8_IGP_AMT: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
case E1000_DEV_ID_ICH8_IGP_C: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
case E1000_DEV_ID_ICH8_IFE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
case E1000_DEV_ID_ICH8_IFE_GT: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
case E1000_DEV_ID_ICH8_IFE_G: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
case E1000_DEV_ID_ICH8_IGP_M: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
hw->mac_type = e1000_ich8lan; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
/* Should never have loaded on this device */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
return -E1000_ERR_MAC_TYPE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
hw->swfwhw_semaphore_present = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
hw->asf_firmware_present = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
hw->swfw_sync_present = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
/* fall through */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
case e1000_82571: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
case e1000_82572: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
case e1000_82573: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
hw->eeprom_semaphore_present = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
/* fall through */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
case e1000_82541: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
case e1000_82547: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
case e1000_82541_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
case e1000_82547_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
hw->asf_firmware_present = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
448 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
/* The 82543 chip does not count tx_carrier_errors properly in |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
* FD mode |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
if (hw->mac_type == e1000_82543) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
hw->bad_tx_carr_stats_fd = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
/* capable of receiving management packets to the host */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
if (hw->mac_type >= e1000_82571) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
hw->has_manc2h = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
/* In rare occasions, ESB2 systems would end up started without |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
* the RX unit being turned on. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
if (hw->mac_type == e1000_80003es2lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
hw->rx_needs_kicking = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
if (hw->mac_type > e1000_82544) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
hw->has_smbus = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
* Set media type and TBI compatibility. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
* **************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
e1000_set_media_type(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
u32 status; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
DEBUGFUNC("e1000_set_media_type"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
if (hw->mac_type != e1000_82543) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
/* tbi_compatibility is only valid on 82543 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
hw->tbi_compatibility_en = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
switch (hw->device_id) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
case E1000_DEV_ID_82545GM_SERDES: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
case E1000_DEV_ID_82546GB_SERDES: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
case E1000_DEV_ID_82571EB_SERDES: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
case E1000_DEV_ID_82571EB_SERDES_DUAL: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
case E1000_DEV_ID_82571EB_SERDES_QUAD: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
case E1000_DEV_ID_82572EI_SERDES: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
hw->media_type = e1000_media_type_internal_serdes; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
case e1000_82542_rev2_0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
case e1000_82542_rev2_1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
hw->media_type = e1000_media_type_fiber; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
case e1000_82573: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
/* The STATUS_TBIMODE bit is reserved or reused for the this |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
* device. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
hw->media_type = e1000_media_type_copper; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
status = E1000_READ_REG(hw, STATUS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
if (status & E1000_STATUS_TBIMODE) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
hw->media_type = e1000_media_type_fiber; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
/* tbi_compatibility not valid on fiber */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
hw->tbi_compatibility_en = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
hw->media_type = e1000_media_type_copper; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
* Reset the transmit and receive units; mask and clear all interrupts. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
e1000_reset_hw(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
u32 ctrl_ext; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
u32 icr; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
u32 manc; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
u32 led_ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
539 |
u32 timeout; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
u32 extcnf_ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
DEBUGFUNC("e1000_reset_hw"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
/* For 82542 (rev 2.0), disable MWI before issuing a device reset */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
if (hw->mac_type == e1000_82542_rev2_0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
e1000_pci_clear_mwi(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
if (hw->bus_type == e1000_bus_type_pci_express) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
/* Prevent the PCI-E bus from sticking if there is no TLP connection |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
* on the last TLP read/write transaction when MAC is reset. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
if (e1000_disable_pciex_master(hw) != E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
DEBUGOUT("PCI-E Master disable polling has failed.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
/* Clear interrupt mask to stop board from generating interrupts */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
DEBUGOUT("Masking off all interrupts\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
E1000_WRITE_REG(hw, IMC, 0xffffffff); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
/* Disable the Transmit and Receive units. Then delay to allow |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
* any pending transactions to complete before we hit the MAC with |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
* the global reset. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
E1000_WRITE_REG(hw, RCTL, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
E1000_WRITE_REG(hw, TCTL, E1000_TCTL_PSP); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
/* The tbi_compatibility_on Flag must be cleared when Rctl is cleared. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
hw->tbi_compatibility_on = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
/* Delay to allow any outstanding PCI transactions to complete before |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
* resetting the device |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
msleep(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
/* Must reset the PHY before resetting the MAC */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
msleep(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
/* Must acquire the MDIO ownership before MAC reset. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
* Ownership defaults to firmware after a reset. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
if (hw->mac_type == e1000_82573) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
timeout = 10; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
do { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
msleep(2); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
timeout--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
} while (timeout); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
/* Workaround for ICH8 bit corruption issue in FIFO memory */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
/* Set Tx and Rx buffer allocation to 8k apiece. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
E1000_WRITE_REG(hw, PBA, E1000_PBA_8K); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
/* Set Packet Buffer Size to 16k. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
E1000_WRITE_REG(hw, PBS, E1000_PBS_16K); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
617 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
/* Issue a global reset to the MAC. This will reset the chip's |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
* transmit, receive, DMA, and link units. It will not effect |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
* the current PCI configuration. The global reset bit is self- |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
* clearing, and should clear within a microsecond. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
DEBUGOUT("Issuing a global reset to MAC\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
case e1000_82544: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
case e1000_82540: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
case e1000_82545: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
case e1000_82546: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
case e1000_82541: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
case e1000_82541_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
/* These controllers can't ack the 64-bit write when issuing the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
* reset, so use IO-mapping as a workaround to issue the reset */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
case e1000_82545_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
case e1000_82546_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
/* Reset is performed on a shadow of the control register */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
E1000_WRITE_REG(hw, CTRL_DUP, (ctrl | E1000_CTRL_RST)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
641 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
if (!hw->phy_reset_disable && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
e1000_check_phy_reset_block(hw) == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
/* e1000_ich8lan PHY HW reset requires MAC CORE reset |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
* at the same time to make sure the interface between |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
* MAC and the external PHY is reset. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
ctrl |= E1000_CTRL_PHY_RST; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
650 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
651 |
e1000_get_software_flag(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
msleep(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
659 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
/* After MAC reset, force reload of EEPROM to restore power-on settings to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
* device. Later controllers reload the EEPROM automatically, so just wait |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
* for reload to complete. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
case e1000_82542_rev2_0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
case e1000_82542_rev2_1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
case e1000_82543: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
case e1000_82544: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
/* Wait for reset to complete */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
udelay(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
ctrl_ext |= E1000_CTRL_EXT_EE_RST; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
/* Wait for EEPROM reload */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
msleep(2); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
case e1000_82541: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
case e1000_82541_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
case e1000_82547: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
case e1000_82547_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
/* Wait for EEPROM reload */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
msleep(20); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
case e1000_82573: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
if (!e1000_is_onboard_nvm_eeprom(hw)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
udelay(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
ctrl_ext |= E1000_CTRL_EXT_EE_RST; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
/* fall through */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
/* Auto read done will delay 5ms or poll based on mac type */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
ret_val = e1000_get_auto_rd_done(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
/* Disable HW ARPs on ASF enabled adapters */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
703 |
if (hw->mac_type >= e1000_82540 && hw->mac_type <= e1000_82547_rev_2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
manc = E1000_READ_REG(hw, MANC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
manc &= ~(E1000_MANC_ARP_EN); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
E1000_WRITE_REG(hw, MANC, manc); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
e1000_phy_init_script(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
/* Configure activity LED after PHY reset */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
led_ctrl = E1000_READ_REG(hw, LEDCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
led_ctrl &= IGP_ACTIVITY_LED_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
E1000_WRITE_REG(hw, LEDCTL, led_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
717 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
/* Clear interrupt mask to stop board from generating interrupts */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
DEBUGOUT("Masking off all interrupts\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
E1000_WRITE_REG(hw, IMC, 0xffffffff); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
/* Clear any pending interrupt events. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
icr = E1000_READ_REG(hw, ICR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
/* If MWI was previously enabled, reenable it. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
if (hw->mac_type == e1000_82542_rev2_0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
if (hw->pci_cmd_word & PCI_COMMAND_INVALIDATE) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
e1000_pci_set_mwi(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
u32 kab = E1000_READ_REG(hw, KABGTXD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
kab |= E1000_KABGTXD_BGSQLBIAS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
E1000_WRITE_REG(hw, KABGTXD, kab); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
* Initialize a number of hardware-dependent bits |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
* This function contains hardware limitation workarounds for PCI-E adapters |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
e1000_initialize_hardware_bits(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
if ((hw->mac_type >= e1000_82571) && (!hw->initialize_hw_bits_disable)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
/* Settings common to all PCI-express silicon */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
u32 reg_ctrl, reg_ctrl_ext; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
u32 reg_tarc0, reg_tarc1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
u32 reg_tctl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
u32 reg_txdctl, reg_txdctl1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
/* link autonegotiation/sync workarounds */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
reg_tarc0 = E1000_READ_REG(hw, TARC0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
reg_tarc0 &= ~((1 << 30)|(1 << 29)|(1 << 28)|(1 << 27)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
/* Enable not-done TX descriptor counting */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
reg_txdctl = E1000_READ_REG(hw, TXDCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
reg_txdctl |= E1000_TXDCTL_COUNT_DESC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
E1000_WRITE_REG(hw, TXDCTL, reg_txdctl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
reg_txdctl1 = E1000_READ_REG(hw, TXDCTL1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
reg_txdctl1 |= E1000_TXDCTL_COUNT_DESC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
E1000_WRITE_REG(hw, TXDCTL1, reg_txdctl1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
case e1000_82571: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
case e1000_82572: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
/* Clear PHY TX compatible mode bits */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
reg_tarc1 = E1000_READ_REG(hw, TARC1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
reg_tarc1 &= ~((1 << 30)|(1 << 29)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
/* link autonegotiation/sync workarounds */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
reg_tarc0 |= ((1 << 26)|(1 << 25)|(1 << 24)|(1 << 23)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
/* TX ring control fixes */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
reg_tarc1 |= ((1 << 26)|(1 << 25)|(1 << 24)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
/* Multiple read bit is reversed polarity */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
reg_tctl = E1000_READ_REG(hw, TCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
if (reg_tctl & E1000_TCTL_MULR) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
reg_tarc1 &= ~(1 << 28); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
reg_tarc1 |= (1 << 28); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
E1000_WRITE_REG(hw, TARC1, reg_tarc1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
case e1000_82573: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
reg_ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
reg_ctrl_ext &= ~(1 << 23); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
reg_ctrl_ext |= (1 << 22); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
/* TX byte count fix */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
reg_ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
reg_ctrl &= ~(1 << 29); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
E1000_WRITE_REG(hw, CTRL_EXT, reg_ctrl_ext); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
E1000_WRITE_REG(hw, CTRL, reg_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
805 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
807 |
/* improve small packet performace for fiber/serdes */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
if ((hw->media_type == e1000_media_type_fiber) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
(hw->media_type == e1000_media_type_internal_serdes)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
reg_tarc0 &= ~(1 << 20); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
/* Multiple read bit is reversed polarity */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
814 |
reg_tctl = E1000_READ_REG(hw, TCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
reg_tarc1 = E1000_READ_REG(hw, TARC1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
if (reg_tctl & E1000_TCTL_MULR) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
reg_tarc1 &= ~(1 << 28); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
reg_tarc1 |= (1 << 28); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
E1000_WRITE_REG(hw, TARC1, reg_tarc1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
823 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
/* Reduce concurrent DMA requests to 3 from 4 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
if ((hw->revision_id < 3) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
((hw->device_id != E1000_DEV_ID_ICH8_IGP_M_AMT) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
(hw->device_id != E1000_DEV_ID_ICH8_IGP_M))) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
reg_tarc0 |= ((1 << 29)|(1 << 28)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
reg_ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
reg_ctrl_ext |= (1 << 22); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
E1000_WRITE_REG(hw, CTRL_EXT, reg_ctrl_ext); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
/* workaround TX hang with TSO=on */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
reg_tarc0 |= ((1 << 27)|(1 << 26)|(1 << 24)|(1 << 23)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
/* Multiple read bit is reversed polarity */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
reg_tctl = E1000_READ_REG(hw, TCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
reg_tarc1 = E1000_READ_REG(hw, TARC1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
if (reg_tctl & E1000_TCTL_MULR) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
reg_tarc1 &= ~(1 << 28); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
reg_tarc1 |= (1 << 28); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
/* workaround TX hang with TSO=on */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
reg_tarc1 |= ((1 << 30)|(1 << 26)|(1 << 24)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
E1000_WRITE_REG(hw, TARC1, reg_tarc1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
E1000_WRITE_REG(hw, TARC0, reg_tarc0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
* Performs basic configuration of the adapter. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
* Assumes that the controller has previously been reset and is in a |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
* post-reset uninitialized state. Initializes the receive address registers, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
* multicast table, and VLAN filter table. Calls routines to setup link |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
* configuration and flow control settings. Clears all on-chip counters. Leaves |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
* the transmit and receive units disabled and uninitialized. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
e1000_init_hw(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
u32 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
u32 mta_size; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
u32 reg_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
u32 ctrl_ext; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
DEBUGFUNC("e1000_init_hw"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
/* force full DMA clock frequency for 10/100 on ICH8 A0-B0 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
if ((hw->mac_type == e1000_ich8lan) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
((hw->revision_id < 3) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
((hw->device_id != E1000_DEV_ID_ICH8_IGP_M_AMT) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
(hw->device_id != E1000_DEV_ID_ICH8_IGP_M)))) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
reg_data = E1000_READ_REG(hw, STATUS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
reg_data &= ~0x80000000; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
E1000_WRITE_REG(hw, STATUS, reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
/* Initialize Identification LED */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
ret_val = e1000_id_led_init(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
DEBUGOUT("Error Initializing Identification LED\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
/* Set the media type and TBI compatibility */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
e1000_set_media_type(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
/* Must be called after e1000_set_media_type because media_type is used */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
e1000_initialize_hardware_bits(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
/* Disabling VLAN filtering. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
DEBUGOUT("Initializing the IEEE VLAN\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
/* VET hardcoded to standard value and VFTA removed in ICH8 LAN */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
if (hw->mac_type != e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
if (hw->mac_type < e1000_82545_rev_3) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
909 |
E1000_WRITE_REG(hw, VET, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
910 |
e1000_clear_vfta(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
/* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
if (hw->mac_type == e1000_82542_rev2_0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
e1000_pci_clear_mwi(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
E1000_WRITE_REG(hw, RCTL, E1000_RCTL_RST); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
918 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
msleep(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
/* Setup the receive address. This involves initializing all of the Receive |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
* Address Registers (RARs 0 - 15). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
e1000_init_rx_addrs(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
927 |
/* For 82542 (rev 2.0), take the receiver out of reset and enable MWI */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
if (hw->mac_type == e1000_82542_rev2_0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
E1000_WRITE_REG(hw, RCTL, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
msleep(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
if (hw->pci_cmd_word & PCI_COMMAND_INVALIDATE) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
e1000_pci_set_mwi(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
/* Zero out the Multicast HASH table */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
DEBUGOUT("Zeroing the MTA\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
mta_size = E1000_MC_TBL_SIZE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
if (hw->mac_type == e1000_ich8lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
mta_size = E1000_MC_TBL_SIZE_ICH8LAN; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
for (i = 0; i < mta_size; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
/* use write flush to prevent Memory Write Block (MWB) from |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
* occuring when accessing our register space */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
/* Set the PCI priority bit correctly in the CTRL register. This |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
949 |
* determines if the adapter gives priority to receives, or if it |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
950 |
* gives equal priority to transmits and receives. Valid only on |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
* 82542 and 82543 silicon. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
if (hw->dma_fairness && hw->mac_type <= e1000_82543) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PRIOR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
case e1000_82545_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
case e1000_82546_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
/* Workaround for PCI-X problem when BIOS sets MMRBC incorrectly. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
if (hw->bus_type == e1000_bus_type_pcix && e1000_pcix_get_mmrbc(hw) > 2048) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
e1000_pcix_set_mmrbc(hw, 2048); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
/* More time needed for PHY to initialize */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
if (hw->mac_type == e1000_ich8lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
msleep(15); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
/* Call a subroutine to configure the link and setup flow control. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
ret_val = e1000_setup_link(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
/* Set the transmit descriptor write-back policy */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
if (hw->mac_type > e1000_82544) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
ctrl = E1000_READ_REG(hw, TXDCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
E1000_WRITE_REG(hw, TXDCTL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
if (hw->mac_type == e1000_82573) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
e1000_enable_tx_pkt_filtering(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
/* Enable retransmit on late collisions */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
reg_data = E1000_READ_REG(hw, TCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
reg_data |= E1000_TCTL_RTLC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
E1000_WRITE_REG(hw, TCTL, reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
/* Configure Gigabit Carry Extend Padding */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
reg_data = E1000_READ_REG(hw, TCTL_EXT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
reg_data &= ~E1000_TCTL_EXT_GCEX_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
reg_data |= DEFAULT_80003ES2LAN_TCTL_EXT_GCEX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
E1000_WRITE_REG(hw, TCTL_EXT, reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
/* Configure Transmit Inter-Packet Gap */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
reg_data = E1000_READ_REG(hw, TIPG); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
reg_data &= ~E1000_TIPG_IPGT_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
reg_data |= DEFAULT_80003ES2LAN_TIPG_IPGT_1000; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
E1000_WRITE_REG(hw, TIPG, reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
reg_data = E1000_READ_REG_ARRAY(hw, FFLT, 0x0001); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
reg_data &= ~0x00100000; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
E1000_WRITE_REG_ARRAY(hw, FFLT, 0x0001, reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
/* Fall through */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
case e1000_82571: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
case e1000_82572: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
ctrl = E1000_READ_REG(hw, TXDCTL1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
E1000_WRITE_REG(hw, TXDCTL1, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
if (hw->mac_type == e1000_82573) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
u32 gcr = E1000_READ_REG(hw, GCR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
gcr |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
E1000_WRITE_REG(hw, GCR, gcr); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
/* Clear all of the statistics registers (clear on read). It is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
* important that we do this after we have tried to establish link |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1030 |
* because the symbol error count will increment wildly if there |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1031 |
* is no link. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
e1000_clear_hw_cntrs(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
/* ICH8 No-snoop bits are opposite polarity. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
* Set to snoop by default after reset. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
if (hw->mac_type == e1000_ich8lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
e1000_set_pci_ex_no_snoop(hw, PCI_EX_82566_SNOOP_ALL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
if (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
/* Relaxed ordering must be disabled to avoid a parity |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
* error crash in a PCI slot. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
ctrl_ext |= E1000_CTRL_EXT_RO_DIS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
* Adjust SERDES output amplitude based on EEPROM setting. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
* hw - Struct containing variables accessed by shared code. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
e1000_adjust_serdes_amplitude(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
u16 eeprom_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
DEBUGFUNC("e1000_adjust_serdes_amplitude"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
if (hw->media_type != e1000_media_type_internal_serdes) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1066 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
case e1000_82545_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
case e1000_82546_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1071 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
ret_val = e1000_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1, &eeprom_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
if (eeprom_data != EEPROM_RESERVED_WORD) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
/* Adjust SERDES output amplitude only. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
* Configures flow control and link settings. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
* Determines which flow control settings to use. Calls the apropriate media- |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
* specific link configuration function. Configures the flow control settings. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
* Assuming the adapter has a valid link partner, a valid link should be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
* established. Assumes the hardware has previously been reset and the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
* transmitter and receiver are not enabled. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
e1000_setup_link(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
u32 ctrl_ext; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
u16 eeprom_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
DEBUGFUNC("e1000_setup_link"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
/* In the case of the phy reset being blocked, we already have a link. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
* We do not have to set it up again. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1114 |
if (e1000_check_phy_reset_block(hw)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
/* Read and store word 0x0F of the EEPROM. This word contains bits |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
* that determine the hardware's default PAUSE (flow control) mode, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
* a bit that determines whether the HW defaults to enabling or |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
* disabling auto-negotiation, and the direction of the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
* SW defined pins. If there is no SW over-ride of the flow |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
* control setting, then the variable hw->fc will |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
* be initialized based on a value in the EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
if (hw->fc == E1000_FC_DEFAULT) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
case e1000_82573: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
hw->fc = E1000_FC_FULL; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
1, &eeprom_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1135 |
DEBUGOUT("EEPROM Read Error\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
if ((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == 0) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
hw->fc = E1000_FC_NONE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
else if ((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
EEPROM_WORD0F_ASM_DIR) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
hw->fc = E1000_FC_TX_PAUSE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
hw->fc = E1000_FC_FULL; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
/* We want to save off the original Flow Control configuration just |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1150 |
* in case we get disconnected and then reconnected into a different |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
* hub or switch with different Flow Control capabilities. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
if (hw->mac_type == e1000_82542_rev2_0) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
hw->fc &= (~E1000_FC_TX_PAUSE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1155 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
if ((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
hw->fc &= (~E1000_FC_RX_PAUSE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
hw->original_fc = hw->fc; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
/* Take the 4 bits from EEPROM word 0x0F that determine the initial |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
* polarity value for the SW controlled pins, and setup the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
* Extended Device Control reg with that info. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
* This is needed because one of the SW controlled pins is used for |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
* signal detection. So this should be done before e1000_setup_pcs_link() |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
* or e1000_phy_setup() is called. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
if (hw->mac_type == e1000_82543) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
ret_val = e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
1, &eeprom_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
DEBUGOUT("EEPROM Read Error\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1177 |
ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) << |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
SWDPIO__EXT_SHIFT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
/* Call the necessary subroutine to configure the link. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
ret_val = (hw->media_type == e1000_media_type_copper) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
e1000_setup_copper_link(hw) : |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
e1000_setup_fiber_serdes_link(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
/* Initialize the flow control address, type, and PAUSE timer |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
* registers to their default values. This is done even if flow |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
* control is disabled, because it does not hurt anything to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
* initialize these registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
DEBUGOUT("Initializing the Flow Control address, type and timer regs\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
/* FCAL/H and FCT are hardcoded to standard values in e1000_ich8lan. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
if (hw->mac_type != e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
/* Set the flow control receive threshold registers. Normally, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
* these registers will be set to a default threshold that may be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
* adjusted later by the driver's runtime code. However, if the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
* ability to transmit pause frames in not enabled, then these |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
* registers will be set to 0. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
if (!(hw->fc & E1000_FC_TX_PAUSE)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
E1000_WRITE_REG(hw, FCRTL, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
E1000_WRITE_REG(hw, FCRTH, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
/* We need to set up the Receive Threshold high and low water marks |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
* as well as (optionally) enabling the transmission of XON frames. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
if (hw->fc_send_xon) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
E1000_WRITE_REG(hw, FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
E1000_WRITE_REG(hw, FCRTL, hw->fc_low_water); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
* Sets up link for a fiber based or serdes based adapter |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
* Manipulates Physical Coding Sublayer functions in order to configure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
* link. Assumes the hardware has been previously reset and the transmitter |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
* and receiver are not enabled. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
e1000_setup_fiber_serdes_link(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
u32 status; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
u32 txcw = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
u32 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
u32 signal = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
DEBUGFUNC("e1000_setup_fiber_serdes_link"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
/* On 82571 and 82572 Fiber connections, SerDes loopback mode persists |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
* until explicitly turned off or a power cycle is performed. A read to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
* the register does not indicate its status. Therefore, we ensure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
* loopback mode is disabled during initialization. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1253 |
if (hw->mac_type == e1000_82571 || hw->mac_type == e1000_82572) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
E1000_WRITE_REG(hw, SCTL, E1000_DISABLE_SERDES_LOOPBACK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
/* On adapters with a MAC newer than 82544, SWDP 1 will be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
* set when the optics detect a signal. On older adapters, it will be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
* cleared when there is a signal. This applies to fiber media only. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
* If we're on serdes media, adjust the output amplitude to value |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
* set in the EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
if (hw->media_type == e1000_media_type_fiber) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
ret_val = e1000_adjust_serdes_amplitude(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
/* Take the link out of reset */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
ctrl &= ~(E1000_CTRL_LRST); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
/* Adjust VCO speed to improve BER performance */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
ret_val = e1000_set_vco_speed(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1277 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
e1000_config_collision_dist(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
/* Check for a software override of the flow control settings, and setup |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
* the device accordingly. If auto-negotiation is enabled, then software |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
* will have to set the "PAUSE" bits to the correct value in the Tranmsit |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
* Config Word Register (TXCW) and re-start auto-negotiation. However, if |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
* auto-negotiation is disabled, then software will have to manually |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
* configure the two flow control enable bits in the CTRL register. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
* The possible values of the "fc" parameter are: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
* 0: Flow control is completely disabled |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
* 1: Rx flow control is enabled (we can receive pause frames, but |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
* not send pause frames). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
* 2: Tx flow control is enabled (we can send pause frames but we do |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
* not support receiving pause frames). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
* 3: Both Rx and TX flow control (symmetric) are enabled. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
switch (hw->fc) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
case E1000_FC_NONE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
/* Flow control is completely disabled by a software over-ride. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1298 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
case E1000_FC_RX_PAUSE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
/* RX Flow control is enabled and TX Flow control is disabled by a |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
* software over-ride. Since there really isn't a way to advertise |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
* that we are capable of RX Pause ONLY, we will advertise that we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
* support both symmetric and asymmetric RX PAUSE. Later, we will |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1305 |
* disable the adapter's ability to send PAUSE frames. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
case E1000_FC_TX_PAUSE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
/* TX Flow control is enabled, and RX Flow control is disabled, by a |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1311 |
* software over-ride. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_ASM_DIR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
case E1000_FC_FULL: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
/* Flow control (both RX and TX) is enabled by a software over-ride. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1319 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1320 |
DEBUGOUT("Flow control param set incorrectly\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
return -E1000_ERR_CONFIG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1324 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
/* Since auto-negotiation is enabled, take the link out of reset (the link |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
* will be in reset, because we previously reset the chip). This will |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
* restart auto-negotiation. If auto-neogtiation is successful then the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
* link-up status bit will be set and the flow control enable bits (RFCE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
* and TFCE) will be set according to their negotiated value. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
DEBUGOUT("Auto-negotiation enabled\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1333 |
E1000_WRITE_REG(hw, TXCW, txcw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1336 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
hw->txcw = txcw; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
msleep(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
/* If we have a signal (the cable is plugged in) then poll for a "Link-Up" |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
* indication in the Device Status Register. Time-out if a link isn't |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
* seen in 500 milliseconds seconds (Auto-negotiation should complete in |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
* less than 500 milliseconds even if the other end is doing it in SW). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
* For internal serdes, we just assume a signal is present, then poll. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1346 |
if (hw->media_type == e1000_media_type_internal_serdes || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
(E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1348 |
DEBUGOUT("Looking for Link\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
for (i = 0; i < (LINK_UP_TIMEOUT / 10); i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
msleep(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
status = E1000_READ_REG(hw, STATUS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
if (status & E1000_STATUS_LU) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
if (i == (LINK_UP_TIMEOUT / 10)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
DEBUGOUT("Never got a valid link from auto-neg!!!\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
hw->autoneg_failed = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1357 |
/* AutoNeg failed to achieve a link, so we'll call |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
* e1000_check_for_link. This routine will force the link up if |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
* we detect a signal. This will allow us to communicate with |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
* non-autonegotiating link partners. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1362 |
ret_val = e1000_check_for_link(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
DEBUGOUT("Error while checking for link\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1367 |
hw->autoneg_failed = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
hw->autoneg_failed = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
DEBUGOUT("Valid Link Found\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
DEBUGOUT("No Signal Detected\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1374 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
* Make sure we have a valid PHY and change PHY mode before link setup. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
e1000_copper_link_preconfig(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
DEBUGFUNC("e1000_copper_link_preconfig"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
/* With 82543, we need to force speed and duplex on the MAC equal to what |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
* the PHY speed and duplex configuration is. In addition, we need to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
* perform a hardware reset on the PHY to take it out of reset. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
if (hw->mac_type > e1000_82543) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
ctrl |= E1000_CTRL_SLU; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | E1000_CTRL_SLU); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
ret_val = e1000_phy_hw_reset(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
/* Make sure we have a valid PHY */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
ret_val = e1000_detect_gig_phy(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
DEBUGOUT("Error, did not detect valid phy.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
DEBUGOUT1("Phy ID = %x \n", hw->phy_id); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
/* Set PHY to class A mode (if necessary) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
ret_val = e1000_set_phy_mode(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
if ((hw->mac_type == e1000_82545_rev_3) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
(hw->mac_type == e1000_82546_rev_3)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1424 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
phy_data |= 0x00000008; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
if (hw->mac_type <= e1000_82543 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1432 |
hw->phy_reset_disable = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1433 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1434 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
/******************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
* Copper link setup for e1000_phy_igp series. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
*********************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1443 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
e1000_copper_link_igp_setup(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
u32 led_ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
DEBUGFUNC("e1000_copper_link_igp_setup"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1452 |
if (hw->phy_reset_disable) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
ret_val = e1000_phy_reset(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
DEBUGOUT("Error Resetting the PHY\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1461 |
/* Wait 15ms for MAC to configure PHY from eeprom settings */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
msleep(15); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
if (hw->mac_type != e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
/* Configure activity LED after PHY reset */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
led_ctrl = E1000_READ_REG(hw, LEDCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1466 |
led_ctrl &= IGP_ACTIVITY_LED_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1467 |
led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
E1000_WRITE_REG(hw, LEDCTL, led_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
/* The NVM settings will configure LPLU in D3 for IGP2 and IGP3 PHYs */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
if (hw->phy_type == e1000_phy_igp) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
/* disable lplu d3 during driver init */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
ret_val = e1000_set_d3_lplu_state(hw, false); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
DEBUGOUT("Error Disabling LPLU D3\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
/* disable lplu d0 during driver init */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
ret_val = e1000_set_d0_lplu_state(hw, false); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
DEBUGOUT("Error Disabling LPLU D0\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
/* Configure mdi-mdix settings */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1489 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
hw->dsp_config_state = e1000_dsp_config_disabled; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
/* Force MDI for earlier revs of the IGP PHY */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
phy_data &= ~(IGP01E1000_PSCR_AUTO_MDIX | IGP01E1000_PSCR_FORCE_MDI_MDIX); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1496 |
hw->mdix = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
hw->dsp_config_state = e1000_dsp_config_enabled; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1502 |
switch (hw->mdix) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
case 1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
case 2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
phy_data |= IGP01E1000_PSCR_FORCE_MDI_MDIX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
case 0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
phy_data |= IGP01E1000_PSCR_AUTO_MDIX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
/* set auto-master slave resolution settings */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
if (hw->autoneg) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1521 |
e1000_ms_type phy_ms_setting = hw->master_slave; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
if (hw->ffe_config_state == e1000_ffe_config_active) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
hw->ffe_config_state = e1000_ffe_config_enabled; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
if (hw->dsp_config_state == e1000_dsp_config_activated) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
hw->dsp_config_state = e1000_dsp_config_enabled; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
/* when autonegotiation advertisment is only 1000Mbps then we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
* should disable SmartSpeed and enable Auto MasterSlave |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
* resolution as hardware default. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
if (hw->autoneg_advertised == ADVERTISE_1000_FULL) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
/* Disable SmartSpeed */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1538 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1542 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
/* Set auto Master/Slave resolution process */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
phy_data &= ~CR_1000T_MS_ENABLE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1553 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
/* load defaults for future use */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
hw->original_master_slave = (phy_data & CR_1000T_MS_ENABLE) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
((phy_data & CR_1000T_MS_VALUE) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
e1000_ms_force_master : |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
e1000_ms_force_slave) : |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
e1000_ms_auto; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
switch (phy_ms_setting) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
case e1000_ms_force_master: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
phy_data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1568 |
case e1000_ms_force_slave: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1569 |
phy_data |= CR_1000T_MS_ENABLE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
phy_data &= ~(CR_1000T_MS_VALUE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
case e1000_ms_auto: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
phy_data &= ~CR_1000T_MS_ENABLE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1580 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
/******************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
* Copper link setup for e1000_phy_gg82563 series. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
*********************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
e1000_copper_link_ggp_setup(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1594 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
u32 reg_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
DEBUGFUNC("e1000_copper_link_ggp_setup"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
if (!hw->phy_reset_disable) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
/* Enable CRS on TX for half-duplex operation. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
/* Use 25MHz for both link down and 1000BASE-T for Tx clock */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
phy_data |= GG82563_MSCR_TX_CLK_1000MBPS_25MHZ; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
ret_val = e1000_write_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1613 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1615 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
/* Options: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
* MDI/MDI-X = 0 (default) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
* 0 - Auto for all speeds |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
* 1 - MDI mode |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
* 2 - MDI-X mode |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
* 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_SPEC_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
phy_data &= ~GG82563_PSCR_CROSSOVER_MODE_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
switch (hw->mdix) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
case 1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
phy_data |= GG82563_PSCR_CROSSOVER_MODE_MDI; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
case 2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
phy_data |= GG82563_PSCR_CROSSOVER_MODE_MDIX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
case 0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
phy_data |= GG82563_PSCR_CROSSOVER_MODE_AUTO; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
/* Options: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
* disable_polarity_correction = 0 (default) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
* Automatic Correction for Reversed Cable Polarity |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
* 0 - Disabled |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
* 1 - Enabled |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
phy_data &= ~GG82563_PSCR_POLARITY_REVERSAL_DISABLE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
if (hw->disable_polarity_correction == 1) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
phy_data |= GG82563_PSCR_POLARITY_REVERSAL_DISABLE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
ret_val = e1000_write_phy_reg(hw, GG82563_PHY_SPEC_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
/* SW Reset the PHY so all changes take effect */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
ret_val = e1000_phy_reset(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
DEBUGOUT("Error Resetting the PHY\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
} /* phy_reset_disable */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
if (hw->mac_type == e1000_80003es2lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
/* Bypass RX and TX FIFO's */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_FIFO_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
E1000_KUMCTRLSTA_FIFO_CTRL_RX_BYPASS | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
E1000_KUMCTRLSTA_FIFO_CTRL_TX_BYPASS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_SPEC_CTRL_2, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
phy_data &= ~GG82563_PSCR2_REVERSE_AUTO_NEG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
ret_val = e1000_write_phy_reg(hw, GG82563_PHY_SPEC_CTRL_2, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
reg_data = E1000_READ_REG(hw, CTRL_EXT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
reg_data &= ~(E1000_CTRL_EXT_LINK_MODE_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
E1000_WRITE_REG(hw, CTRL_EXT, reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_PWR_MGMT_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1688 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
/* Do not init these registers when the HW is in IAMT mode, since the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
* firmware will have already initialized them. We only initialize |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
* them if the HW is not in IAMT mode. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
if (!e1000_check_mng_mode(hw)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
/* Enable Electrical Idle on the PHY */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
phy_data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
ret_val = e1000_write_phy_reg(hw, GG82563_PHY_PWR_MGMT_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
phy_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1715 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
/* Workaround: Disable padding in Kumeran interface in the MAC |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
* and in the PHY to avoid CRC errors. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_INBAND_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
phy_data |= GG82563_ICR_DIS_PADDING; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
ret_val = e1000_write_phy_reg(hw, GG82563_PHY_INBAND_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1726 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
/******************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
* Copper link setup for e1000_phy_m88 series. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
*********************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
e1000_copper_link_mgp_setup(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
DEBUGFUNC("e1000_copper_link_mgp_setup"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
if (hw->phy_reset_disable) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
/* Enable CRS on TX. This must be set for half-duplex operation. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
/* Options: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
* MDI/MDI-X = 0 (default) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
* 0 - Auto for all speeds |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
* 1 - MDI mode |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
* 2 - MDI-X mode |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1761 |
* 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
switch (hw->mdix) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
case 1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
phy_data |= M88E1000_PSCR_MDI_MANUAL_MODE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
case 2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
phy_data |= M88E1000_PSCR_MDIX_MANUAL_MODE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
case 3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
phy_data |= M88E1000_PSCR_AUTO_X_1000T; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
case 0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
phy_data |= M88E1000_PSCR_AUTO_X_MODE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1778 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
/* Options: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
* disable_polarity_correction = 0 (default) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
* Automatic Correction for Reversed Cable Polarity |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
* 0 - Disabled |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
* 1 - Enabled |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
if (hw->disable_polarity_correction == 1) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
if (hw->phy_revision < M88E1011_I_REV_4) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
/* Force TX_CLK in the Extended PHY Specific Control Register |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
* to 25MHz clock. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
phy_data |= M88E1000_EPSCR_TX_CLK_25; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
if ((hw->phy_revision == E1000_REVISION_2) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
(hw->phy_id == M88E1111_I_PHY_ID)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
/* Vidalia Phy, set the downshift counter to 5x */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
phy_data &= ~(M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
phy_data |= M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
ret_val = e1000_write_phy_reg(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
M88E1000_EXT_PHY_SPEC_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
/* Configure Master and Slave downshift values */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
ret_val = e1000_write_phy_reg(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
M88E1000_EXT_PHY_SPEC_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1825 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
/* SW Reset the PHY so all changes take effect */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
ret_val = e1000_phy_reset(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
DEBUGOUT("Error Resetting the PHY\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1832 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
/******************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
* Setup auto-negotiation and flow control advertisements, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
* and then perform auto-negotiation. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
*********************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
e1000_copper_link_autoneg(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
DEBUGFUNC("e1000_copper_link_autoneg"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
/* Perform some bounds checking on the hw->autoneg_advertised |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
* parameter. If this variable is zero, then set it to the default. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
hw->autoneg_advertised &= AUTONEG_ADVERTISE_SPEED_DEFAULT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
/* If autoneg_advertised is zero, we assume it was not defaulted |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
* by the calling code so we set to advertise full capability. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
if (hw->autoneg_advertised == 0) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
/* IFE phy only supports 10/100 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
if (hw->phy_type == e1000_phy_ife) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
hw->autoneg_advertised &= AUTONEG_ADVERTISE_10_100_ALL; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
ret_val = e1000_phy_setup_autoneg(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1868 |
DEBUGOUT("Error Setting up Auto-Negotiation\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1869 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
DEBUGOUT("Restarting Auto-Neg\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
/* Restart auto-negotiation by setting the Auto Neg Enable bit and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
* the Auto Neg Restart bit in the PHY control register. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
/* Does the user want to wait for Auto-Neg to complete here, or |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
* check at a later time (for example, callback routine). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
if (hw->wait_autoneg_complete) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
ret_val = e1000_wait_autoneg(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
DEBUGOUT("Error while waiting for autoneg to complete\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1895 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
hw->get_link_status = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1898 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
* Config the MAC and the PHY after link is up. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
* 1) Set up the MAC to the current PHY speed/duplex |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
* if we are on 82543. If we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
* are on newer silicon, we only need to configure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
* collision distance in the Transmit Control Register. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
* 2) Set up flow control on the MAC to that established with |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
* the link partner. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
* 3) Config DSP to improve Gigabit link quality for some PHY revisions. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1913 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
e1000_copper_link_postconfig(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
DEBUGFUNC("e1000_copper_link_postconfig"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1919 |
if (hw->mac_type >= e1000_82544) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
e1000_config_collision_dist(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
ret_val = e1000_config_mac_to_phy(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
DEBUGOUT("Error configuring MAC to PHY settings\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
ret_val = e1000_config_fc_after_link_up(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
DEBUGOUT("Error Configuring Flow Control\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
/* Config DSP to improve Giga link quality */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
if (hw->phy_type == e1000_phy_igp) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
ret_val = e1000_config_dsp_after_link_change(hw, true); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
DEBUGOUT("Error Configuring DSP after link up\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
* Detects which PHY is present and setup the speed and duplex |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
e1000_setup_copper_link(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
u16 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
u16 reg_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
DEBUGFUNC("e1000_setup_copper_link"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
/* Set the mac to wait the maximum time between each |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
* iteration and increase the max iterations when |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
* polling the phy; this fixes erroneous timeouts at 10Mbps. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
ret_val = e1000_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
ret_val = e1000_read_kmrn_reg(hw, GG82563_REG(0x34, 9), ®_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
reg_data |= 0x3F; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
ret_val = e1000_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1979 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
/* Check if it is a valid PHY and set PHY mode if necessary. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
ret_val = e1000_copper_link_preconfig(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
/* Kumeran registers are written-only */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
reg_data = E1000_KUMCTRLSTA_INB_CTRL_LINK_STATUS_TX_TIMEOUT_DEFAULT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
reg_data |= E1000_KUMCTRLSTA_INB_CTRL_DIS_PADDING; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1991 |
ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_INB_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
if (hw->phy_type == e1000_phy_igp || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
hw->phy_type == e1000_phy_igp_3 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
hw->phy_type == e1000_phy_igp_2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
ret_val = e1000_copper_link_igp_setup(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
} else if (hw->phy_type == e1000_phy_m88) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
ret_val = e1000_copper_link_mgp_setup(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
} else if (hw->phy_type == e1000_phy_gg82563) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
ret_val = e1000_copper_link_ggp_setup(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2016 |
if (hw->autoneg) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
/* Setup autoneg and flow control advertisement |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
* and perform autonegotiation */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
ret_val = e1000_copper_link_autoneg(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
/* PHY will be set to 10H, 10F, 100H,or 100F |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
* depending on value from forced_speed_duplex. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
DEBUGOUT("Forcing speed and duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
ret_val = e1000_phy_force_speed_duplex(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
DEBUGOUT("Error Forcing Speed and Duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
/* Check link status. Wait up to 100 microseconds for link to become |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
* valid. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
for (i = 0; i < 10; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
if (phy_data & MII_SR_LINK_STATUS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
/* Config the MAC and PHY after link is up */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
ret_val = e1000_copper_link_postconfig(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
DEBUGOUT("Valid link established!!!\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
udelay(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
DEBUGOUT("Unable to establish link!!!\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2057 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2058 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2059 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2060 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2061 |
* Configure the MAC-to-PHY interface for 10/100Mbps |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2062 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2063 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2064 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2065 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2066 |
e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, u16 duplex) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2067 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2068 |
s32 ret_val = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2069 |
u32 tipg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2070 |
u16 reg_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2071 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2072 |
DEBUGFUNC("e1000_configure_kmrn_for_10_100"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2073 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2074 |
reg_data = E1000_KUMCTRLSTA_HD_CTRL_10_100_DEFAULT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2075 |
ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_HD_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2076 |
reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2077 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2078 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2079 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2080 |
/* Configure Transmit Inter-Packet Gap */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2081 |
tipg = E1000_READ_REG(hw, TIPG); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2082 |
tipg &= ~E1000_TIPG_IPGT_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2083 |
tipg |= DEFAULT_80003ES2LAN_TIPG_IPGT_10_100; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2084 |
E1000_WRITE_REG(hw, TIPG, tipg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2085 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2086 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2087 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2088 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2089 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2090 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2091 |
if (duplex == HALF_DUPLEX) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2092 |
reg_data |= GG82563_KMCR_PASS_FALSE_CARRIER; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2093 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2094 |
reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2095 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2096 |
ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2097 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2098 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2099 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2100 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2101 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2102 |
e1000_configure_kmrn_for_1000(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2103 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2104 |
s32 ret_val = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2105 |
u16 reg_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2106 |
u32 tipg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2107 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2108 |
DEBUGFUNC("e1000_configure_kmrn_for_1000"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2109 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2110 |
reg_data = E1000_KUMCTRLSTA_HD_CTRL_1000_DEFAULT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2111 |
ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_HD_CTRL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2112 |
reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2113 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2114 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2115 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2116 |
/* Configure Transmit Inter-Packet Gap */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2117 |
tipg = E1000_READ_REG(hw, TIPG); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2118 |
tipg &= ~E1000_TIPG_IPGT_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2119 |
tipg |= DEFAULT_80003ES2LAN_TIPG_IPGT_1000; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2120 |
E1000_WRITE_REG(hw, TIPG, tipg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2121 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2122 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2123 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2124 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2125 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2126 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2127 |
reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2128 |
ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2129 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2130 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2131 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2132 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2133 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2134 |
* Configures PHY autoneg and flow control advertisement settings |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2135 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2136 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2137 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2138 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2139 |
e1000_phy_setup_autoneg(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2140 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2141 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2142 |
u16 mii_autoneg_adv_reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2143 |
u16 mii_1000t_ctrl_reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2144 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2145 |
DEBUGFUNC("e1000_phy_setup_autoneg"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2146 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2147 |
/* Read the MII Auto-Neg Advertisement Register (Address 4). */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2148 |
ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2149 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2150 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2151 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2152 |
if (hw->phy_type != e1000_phy_ife) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2153 |
/* Read the MII 1000Base-T Control Register (Address 9). */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2154 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2155 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2156 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2157 |
} else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2158 |
mii_1000t_ctrl_reg=0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2159 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2160 |
/* Need to parse both autoneg_advertised and fc and set up |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2161 |
* the appropriate PHY registers. First we will parse for |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2162 |
* autoneg_advertised software override. Since we can advertise |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2163 |
* a plethora of combinations, we need to check each bit |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2164 |
* individually. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2165 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2166 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2167 |
/* First we clear all the 10/100 mb speed bits in the Auto-Neg |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2168 |
* Advertisement Register (Address 4) and the 1000 mb speed bits in |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2169 |
* the 1000Base-T Control Register (Address 9). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2170 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2171 |
mii_autoneg_adv_reg &= ~REG4_SPEED_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2172 |
mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2173 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2174 |
DEBUGOUT1("autoneg_advertised %x\n", hw->autoneg_advertised); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2175 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2176 |
/* Do we want to advertise 10 Mb Half Duplex? */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2177 |
if (hw->autoneg_advertised & ADVERTISE_10_HALF) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2178 |
DEBUGOUT("Advertise 10mb Half duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2179 |
mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2180 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2181 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2182 |
/* Do we want to advertise 10 Mb Full Duplex? */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2183 |
if (hw->autoneg_advertised & ADVERTISE_10_FULL) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2184 |
DEBUGOUT("Advertise 10mb Full duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2185 |
mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2186 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2187 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2188 |
/* Do we want to advertise 100 Mb Half Duplex? */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2189 |
if (hw->autoneg_advertised & ADVERTISE_100_HALF) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2190 |
DEBUGOUT("Advertise 100mb Half duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2191 |
mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2192 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2193 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2194 |
/* Do we want to advertise 100 Mb Full Duplex? */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2195 |
if (hw->autoneg_advertised & ADVERTISE_100_FULL) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2196 |
DEBUGOUT("Advertise 100mb Full duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2197 |
mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2198 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2199 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2200 |
/* We do not allow the Phy to advertise 1000 Mb Half Duplex */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2201 |
if (hw->autoneg_advertised & ADVERTISE_1000_HALF) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2202 |
DEBUGOUT("Advertise 1000mb Half duplex requested, request denied!\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2203 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2204 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2205 |
/* Do we want to advertise 1000 Mb Full Duplex? */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2206 |
if (hw->autoneg_advertised & ADVERTISE_1000_FULL) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2207 |
DEBUGOUT("Advertise 1000mb Full duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2208 |
mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2209 |
if (hw->phy_type == e1000_phy_ife) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2210 |
DEBUGOUT("e1000_phy_ife is a 10/100 PHY. Gigabit speed is not supported.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2211 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2212 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2213 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2214 |
/* Check for a software override of the flow control settings, and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2215 |
* setup the PHY advertisement registers accordingly. If |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2216 |
* auto-negotiation is enabled, then software will have to set the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2217 |
* "PAUSE" bits to the correct value in the Auto-Negotiation |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2218 |
* Advertisement Register (PHY_AUTONEG_ADV) and re-start auto-negotiation. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2219 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2220 |
* The possible values of the "fc" parameter are: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2221 |
* 0: Flow control is completely disabled |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2222 |
* 1: Rx flow control is enabled (we can receive pause frames |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2223 |
* but not send pause frames). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2224 |
* 2: Tx flow control is enabled (we can send pause frames |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2225 |
* but we do not support receiving pause frames). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2226 |
* 3: Both Rx and TX flow control (symmetric) are enabled. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2227 |
* other: No software override. The flow control configuration |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2228 |
* in the EEPROM is used. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2229 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2230 |
switch (hw->fc) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2231 |
case E1000_FC_NONE: /* 0 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2232 |
/* Flow control (RX & TX) is completely disabled by a |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2233 |
* software over-ride. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2234 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2235 |
mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2236 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2237 |
case E1000_FC_RX_PAUSE: /* 1 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2238 |
/* RX Flow control is enabled, and TX Flow control is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2239 |
* disabled, by a software over-ride. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2240 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2241 |
/* Since there really isn't a way to advertise that we are |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2242 |
* capable of RX Pause ONLY, we will advertise that we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2243 |
* support both symmetric and asymmetric RX PAUSE. Later |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2244 |
* (in e1000_config_fc_after_link_up) we will disable the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2245 |
*hw's ability to send PAUSE frames. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2246 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2247 |
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2248 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2249 |
case E1000_FC_TX_PAUSE: /* 2 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2250 |
/* TX Flow control is enabled, and RX Flow control is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2251 |
* disabled, by a software over-ride. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2252 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2253 |
mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2254 |
mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2255 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2256 |
case E1000_FC_FULL: /* 3 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2257 |
/* Flow control (both RX and TX) is enabled by a software |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2258 |
* over-ride. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2259 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2260 |
mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2261 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2262 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2263 |
DEBUGOUT("Flow control param set incorrectly\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2264 |
return -E1000_ERR_CONFIG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2265 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2266 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2267 |
ret_val = e1000_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2268 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2269 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2270 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2271 |
DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2272 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2273 |
if (hw->phy_type != e1000_phy_ife) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2274 |
ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2275 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2276 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2277 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2278 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2279 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2280 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2281 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2282 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2283 |
* Force PHY speed and duplex settings to hw->forced_speed_duplex |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2284 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2285 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2286 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2287 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2288 |
e1000_phy_force_speed_duplex(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2289 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2290 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2291 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2292 |
u16 mii_ctrl_reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2293 |
u16 mii_status_reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2294 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2295 |
u16 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2296 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2297 |
DEBUGFUNC("e1000_phy_force_speed_duplex"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2298 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2299 |
/* Turn off Flow control if we are forcing speed and duplex. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2300 |
hw->fc = E1000_FC_NONE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2301 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2302 |
DEBUGOUT1("hw->fc = %d\n", hw->fc); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2303 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2304 |
/* Read the Device Control Register. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2305 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2306 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2307 |
/* Set the bits to Force Speed and Duplex in the Device Ctrl Reg. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2308 |
ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2309 |
ctrl &= ~(DEVICE_SPEED_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2310 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2311 |
/* Clear the Auto Speed Detect Enable bit. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2312 |
ctrl &= ~E1000_CTRL_ASDE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2313 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2314 |
/* Read the MII Control Register. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2315 |
ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2316 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2317 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2318 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2319 |
/* We need to disable autoneg in order to force link and duplex. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2320 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2321 |
mii_ctrl_reg &= ~MII_CR_AUTO_NEG_EN; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2322 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2323 |
/* Are we forcing Full or Half Duplex? */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2324 |
if (hw->forced_speed_duplex == e1000_100_full || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2325 |
hw->forced_speed_duplex == e1000_10_full) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2326 |
/* We want to force full duplex so we SET the full duplex bits in the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2327 |
* Device and MII Control Registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2328 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2329 |
ctrl |= E1000_CTRL_FD; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2330 |
mii_ctrl_reg |= MII_CR_FULL_DUPLEX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2331 |
DEBUGOUT("Full Duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2332 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2333 |
/* We want to force half duplex so we CLEAR the full duplex bits in |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2334 |
* the Device and MII Control Registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2335 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2336 |
ctrl &= ~E1000_CTRL_FD; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2337 |
mii_ctrl_reg &= ~MII_CR_FULL_DUPLEX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2338 |
DEBUGOUT("Half Duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2339 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2340 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2341 |
/* Are we forcing 100Mbps??? */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2342 |
if (hw->forced_speed_duplex == e1000_100_full || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2343 |
hw->forced_speed_duplex == e1000_100_half) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2344 |
/* Set the 100Mb bit and turn off the 1000Mb and 10Mb bits. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2345 |
ctrl |= E1000_CTRL_SPD_100; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2346 |
mii_ctrl_reg |= MII_CR_SPEED_100; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2347 |
mii_ctrl_reg &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2348 |
DEBUGOUT("Forcing 100mb "); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2349 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2350 |
/* Set the 10Mb bit and turn off the 1000Mb and 100Mb bits. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2351 |
ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2352 |
mii_ctrl_reg |= MII_CR_SPEED_10; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2353 |
mii_ctrl_reg &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2354 |
DEBUGOUT("Forcing 10mb "); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2355 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2356 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2357 |
e1000_config_collision_dist(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2358 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2359 |
/* Write the configured values back to the Device Control Reg. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2360 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2361 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2362 |
if ((hw->phy_type == e1000_phy_m88) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2363 |
(hw->phy_type == e1000_phy_gg82563)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2364 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2365 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2366 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2367 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2368 |
/* Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2369 |
* forced whenever speed are duplex are forced. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2370 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2371 |
phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2372 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2373 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2374 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2375 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2376 |
DEBUGOUT1("M88E1000 PSCR: %x \n", phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2377 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2378 |
/* Need to reset the PHY or these changes will be ignored */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2379 |
mii_ctrl_reg |= MII_CR_RESET; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2380 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2381 |
/* Disable MDI-X support for 10/100 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2382 |
} else if (hw->phy_type == e1000_phy_ife) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2383 |
ret_val = e1000_read_phy_reg(hw, IFE_PHY_MDIX_CONTROL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2384 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2385 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2386 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2387 |
phy_data &= ~IFE_PMC_AUTO_MDIX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2388 |
phy_data &= ~IFE_PMC_FORCE_MDIX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2389 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2390 |
ret_val = e1000_write_phy_reg(hw, IFE_PHY_MDIX_CONTROL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2391 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2392 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2393 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2394 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2395 |
/* Clear Auto-Crossover to force MDI manually. IGP requires MDI |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2396 |
* forced whenever speed or duplex are forced. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2397 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2398 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2399 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2400 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2401 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2402 |
phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2403 |
phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2404 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2405 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2406 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2407 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2408 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2409 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2410 |
/* Write back the modified PHY MII control register. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2411 |
ret_val = e1000_write_phy_reg(hw, PHY_CTRL, mii_ctrl_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2412 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2413 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2414 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2415 |
udelay(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2416 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2417 |
/* The wait_autoneg_complete flag may be a little misleading here. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2418 |
* Since we are forcing speed and duplex, Auto-Neg is not enabled. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2419 |
* But we do want to delay for a period while forcing only so we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2420 |
* don't generate false No Link messages. So we will wait here |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2421 |
* only if the user has set wait_autoneg_complete to 1, which is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2422 |
* the default. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2423 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2424 |
if (hw->wait_autoneg_complete) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2425 |
/* We will wait for autoneg to complete. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2426 |
DEBUGOUT("Waiting for forced speed/duplex link.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2427 |
mii_status_reg = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2428 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2429 |
/* We will wait for autoneg to complete or 4.5 seconds to expire. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2430 |
for (i = PHY_FORCE_TIME; i > 0; i--) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2431 |
/* Read the MII Status Register and wait for Auto-Neg Complete bit |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2432 |
* to be set. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2433 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2434 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2435 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2436 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2437 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2438 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2439 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2440 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2441 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2442 |
if (mii_status_reg & MII_SR_LINK_STATUS) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2443 |
msleep(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2444 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2445 |
if ((i == 0) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2446 |
((hw->phy_type == e1000_phy_m88) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2447 |
(hw->phy_type == e1000_phy_gg82563))) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2448 |
/* We didn't get link. Reset the DSP and wait again for link. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2449 |
ret_val = e1000_phy_reset_dsp(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2450 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2451 |
DEBUGOUT("Error Resetting PHY DSP\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2452 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2453 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2454 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2455 |
/* This loop will early-out if the link condition has been met. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2456 |
for (i = PHY_FORCE_TIME; i > 0; i--) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2457 |
if (mii_status_reg & MII_SR_LINK_STATUS) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2458 |
msleep(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2459 |
/* Read the MII Status Register and wait for Auto-Neg Complete bit |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2460 |
* to be set. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2461 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2462 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2463 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2464 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2465 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2466 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2467 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2468 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2469 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2470 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2471 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2472 |
if (hw->phy_type == e1000_phy_m88) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2473 |
/* Because we reset the PHY above, we need to re-force TX_CLK in the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2474 |
* Extended PHY Specific Control Register to 25MHz clock. This value |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2475 |
* defaults back to a 2.5MHz clock when the PHY is reset. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2476 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2477 |
ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2478 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2479 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2480 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2481 |
phy_data |= M88E1000_EPSCR_TX_CLK_25; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2482 |
ret_val = e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2483 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2484 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2485 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2486 |
/* In addition, because of the s/w reset above, we need to enable CRS on |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2487 |
* TX. This must be set for both full and half duplex operation. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2488 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2489 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2490 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2491 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2492 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2493 |
phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2494 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2495 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2496 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2497 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2498 |
if ((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2499 |
(!hw->autoneg) && (hw->forced_speed_duplex == e1000_10_full || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2500 |
hw->forced_speed_duplex == e1000_10_half)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2501 |
ret_val = e1000_polarity_reversal_workaround(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2502 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2503 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2504 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2505 |
} else if (hw->phy_type == e1000_phy_gg82563) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2506 |
/* The TX_CLK of the Extended PHY Specific Control Register defaults |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2507 |
* to 2.5MHz on a reset. We need to re-force it back to 25MHz, if |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2508 |
* we're not in a forced 10/duplex configuration. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2509 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2510 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2511 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2512 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2513 |
phy_data &= ~GG82563_MSCR_TX_CLK_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2514 |
if ((hw->forced_speed_duplex == e1000_10_full) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2515 |
(hw->forced_speed_duplex == e1000_10_half)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2516 |
phy_data |= GG82563_MSCR_TX_CLK_10MBPS_2_5MHZ; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2517 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2518 |
phy_data |= GG82563_MSCR_TX_CLK_100MBPS_25MHZ; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2519 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2520 |
/* Also due to the reset, we need to enable CRS on Tx. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2521 |
phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2522 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2523 |
ret_val = e1000_write_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2524 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2525 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2526 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2527 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2528 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2529 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2530 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2531 |
* Sets the collision distance in the Transmit Control register |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2532 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2533 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2534 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2535 |
* Link should have been established previously. Reads the speed and duplex |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2536 |
* information from the Device Status register. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2537 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2538 |
void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2539 |
e1000_config_collision_dist(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2540 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2541 |
u32 tctl, coll_dist; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2542 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2543 |
DEBUGFUNC("e1000_config_collision_dist"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2544 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2545 |
if (hw->mac_type < e1000_82543) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2546 |
coll_dist = E1000_COLLISION_DISTANCE_82542; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2547 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2548 |
coll_dist = E1000_COLLISION_DISTANCE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2549 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2550 |
tctl = E1000_READ_REG(hw, TCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2551 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2552 |
tctl &= ~E1000_TCTL_COLD; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2553 |
tctl |= coll_dist << E1000_COLD_SHIFT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2554 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2555 |
E1000_WRITE_REG(hw, TCTL, tctl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2556 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2557 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2558 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2559 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2560 |
* Sets MAC speed and duplex settings to reflect the those in the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2561 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2562 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2563 |
* mii_reg - data to write to the MII control register |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2564 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2565 |
* The contents of the PHY register containing the needed information need to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2566 |
* be passed in. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2567 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2568 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2569 |
e1000_config_mac_to_phy(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2570 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2571 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2572 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2573 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2574 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2575 |
DEBUGFUNC("e1000_config_mac_to_phy"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2576 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2577 |
/* 82544 or newer MAC, Auto Speed Detection takes care of |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2578 |
* MAC speed/duplex configuration.*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2579 |
if (hw->mac_type >= e1000_82544) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2580 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2581 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2582 |
/* Read the Device Control Register and set the bits to Force Speed |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2583 |
* and Duplex. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2584 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2585 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2586 |
ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2587 |
ctrl &= ~(E1000_CTRL_SPD_SEL | E1000_CTRL_ILOS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2588 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2589 |
/* Set up duplex in the Device Control and Transmit Control |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2590 |
* registers depending on negotiated values. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2591 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2592 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2593 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2594 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2595 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2596 |
if (phy_data & M88E1000_PSSR_DPLX) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2597 |
ctrl |= E1000_CTRL_FD; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2598 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2599 |
ctrl &= ~E1000_CTRL_FD; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2600 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2601 |
e1000_config_collision_dist(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2602 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2603 |
/* Set up speed in the Device Control register depending on |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2604 |
* negotiated values. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2605 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2606 |
if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2607 |
ctrl |= E1000_CTRL_SPD_1000; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2608 |
else if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_100MBS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2609 |
ctrl |= E1000_CTRL_SPD_100; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2610 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2611 |
/* Write the configured values back to the Device Control Reg. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2612 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2613 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2614 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2615 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2616 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2617 |
* Forces the MAC's flow control settings. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2618 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2619 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2620 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2621 |
* Sets the TFCE and RFCE bits in the device control register to reflect |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2622 |
* the adapter settings. TFCE and RFCE need to be explicitly set by |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2623 |
* software when a Copper PHY is used because autonegotiation is managed |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2624 |
* by the PHY rather than the MAC. Software must also configure these |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2625 |
* bits when link is forced on a fiber connection. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2626 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2627 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2628 |
e1000_force_mac_fc(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2629 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2630 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2631 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2632 |
DEBUGFUNC("e1000_force_mac_fc"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2633 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2634 |
/* Get the current configuration of the Device Control Register */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2635 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2636 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2637 |
/* Because we didn't get link via the internal auto-negotiation |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2638 |
* mechanism (we either forced link or we got link via PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2639 |
* auto-neg), we have to manually enable/disable transmit an |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2640 |
* receive flow control. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2641 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2642 |
* The "Case" statement below enables/disable flow control |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2643 |
* according to the "hw->fc" parameter. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2644 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2645 |
* The possible values of the "fc" parameter are: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2646 |
* 0: Flow control is completely disabled |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2647 |
* 1: Rx flow control is enabled (we can receive pause |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2648 |
* frames but not send pause frames). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2649 |
* 2: Tx flow control is enabled (we can send pause frames |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2650 |
* frames but we do not receive pause frames). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2651 |
* 3: Both Rx and TX flow control (symmetric) is enabled. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2652 |
* other: No other values should be possible at this point. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2653 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2654 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2655 |
switch (hw->fc) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2656 |
case E1000_FC_NONE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2657 |
ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2658 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2659 |
case E1000_FC_RX_PAUSE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2660 |
ctrl &= (~E1000_CTRL_TFCE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2661 |
ctrl |= E1000_CTRL_RFCE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2662 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2663 |
case E1000_FC_TX_PAUSE: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2664 |
ctrl &= (~E1000_CTRL_RFCE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2665 |
ctrl |= E1000_CTRL_TFCE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2666 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2667 |
case E1000_FC_FULL: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2668 |
ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2669 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2670 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2671 |
DEBUGOUT("Flow control param set incorrectly\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2672 |
return -E1000_ERR_CONFIG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2673 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2674 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2675 |
/* Disable TX Flow Control for 82542 (rev 2.0) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2676 |
if (hw->mac_type == e1000_82542_rev2_0) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2677 |
ctrl &= (~E1000_CTRL_TFCE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2678 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2679 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2680 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2681 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2682 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2683 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2684 |
* Configures flow control settings after link is established |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2685 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2686 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2687 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2688 |
* Should be called immediately after a valid link has been established. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2689 |
* Forces MAC flow control settings if link was forced. When in MII/GMII mode |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2690 |
* and autonegotiation is enabled, the MAC flow control settings will be set |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2691 |
* based on the flow control negotiated by the PHY. In TBI mode, the TFCE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2692 |
* and RFCE bits will be automaticaly set to the negotiated flow control mode. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2693 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2694 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2695 |
e1000_config_fc_after_link_up(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2696 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2697 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2698 |
u16 mii_status_reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2699 |
u16 mii_nway_adv_reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2700 |
u16 mii_nway_lp_ability_reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2701 |
u16 speed; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2702 |
u16 duplex; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2703 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2704 |
DEBUGFUNC("e1000_config_fc_after_link_up"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2705 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2706 |
/* Check for the case where we have fiber media and auto-neg failed |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2707 |
* so we had to force link. In this case, we need to force the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2708 |
* configuration of the MAC to match the "fc" parameter. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2709 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2710 |
if (((hw->media_type == e1000_media_type_fiber) && (hw->autoneg_failed)) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2711 |
((hw->media_type == e1000_media_type_internal_serdes) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2712 |
(hw->autoneg_failed)) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2713 |
((hw->media_type == e1000_media_type_copper) && (!hw->autoneg))) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2714 |
ret_val = e1000_force_mac_fc(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2715 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2716 |
DEBUGOUT("Error forcing flow control settings\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2717 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2718 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2719 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2720 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2721 |
/* Check for the case where we have copper media and auto-neg is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2722 |
* enabled. In this case, we need to check and see if Auto-Neg |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2723 |
* has completed, and if so, how the PHY and link partner has |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2724 |
* flow control configured. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2725 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2726 |
if ((hw->media_type == e1000_media_type_copper) && hw->autoneg) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2727 |
/* Read the MII Status Register and check to see if AutoNeg |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2728 |
* has completed. We read this twice because this reg has |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2729 |
* some "sticky" (latched) bits. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2730 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2731 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2732 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2733 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2734 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2735 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2736 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2737 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2738 |
if (mii_status_reg & MII_SR_AUTONEG_COMPLETE) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2739 |
/* The AutoNeg process has completed, so we now need to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2740 |
* read both the Auto Negotiation Advertisement Register |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2741 |
* (Address 4) and the Auto_Negotiation Base Page Ability |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2742 |
* Register (Address 5) to determine how flow control was |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2743 |
* negotiated. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2744 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2745 |
ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_ADV, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2746 |
&mii_nway_adv_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2747 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2748 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2749 |
ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2750 |
&mii_nway_lp_ability_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2751 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2752 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2753 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2754 |
/* Two bits in the Auto Negotiation Advertisement Register |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2755 |
* (Address 4) and two bits in the Auto Negotiation Base |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2756 |
* Page Ability Register (Address 5) determine flow control |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2757 |
* for both the PHY and the link partner. The following |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2758 |
* table, taken out of the IEEE 802.3ab/D6.0 dated March 25, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2759 |
* 1999, describes these PAUSE resolution bits and how flow |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2760 |
* control is determined based upon these settings. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2761 |
* NOTE: DC = Don't Care |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2762 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2763 |
* LOCAL DEVICE | LINK PARTNER |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2764 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | NIC Resolution |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2765 |
*-------|---------|-------|---------|-------------------- |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2766 |
* 0 | 0 | DC | DC | E1000_FC_NONE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2767 |
* 0 | 1 | 0 | DC | E1000_FC_NONE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2768 |
* 0 | 1 | 1 | 0 | E1000_FC_NONE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2769 |
* 0 | 1 | 1 | 1 | E1000_FC_TX_PAUSE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2770 |
* 1 | 0 | 0 | DC | E1000_FC_NONE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2771 |
* 1 | DC | 1 | DC | E1000_FC_FULL |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2772 |
* 1 | 1 | 0 | 0 | E1000_FC_NONE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2773 |
* 1 | 1 | 0 | 1 | E1000_FC_RX_PAUSE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2774 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2775 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2776 |
/* Are both PAUSE bits set to 1? If so, this implies |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2777 |
* Symmetric Flow Control is enabled at both ends. The |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2778 |
* ASM_DIR bits are irrelevant per the spec. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2779 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2780 |
* For Symmetric Flow Control: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2781 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2782 |
* LOCAL DEVICE | LINK PARTNER |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2783 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2784 |
*-------|---------|-------|---------|-------------------- |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2785 |
* 1 | DC | 1 | DC | E1000_FC_FULL |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2786 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2787 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2788 |
if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2789 |
(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2790 |
/* Now we need to check if the user selected RX ONLY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2791 |
* of pause frames. In this case, we had to advertise |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2792 |
* FULL flow control because we could not advertise RX |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2793 |
* ONLY. Hence, we must now check to see if we need to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2794 |
* turn OFF the TRANSMISSION of PAUSE frames. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2795 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2796 |
if (hw->original_fc == E1000_FC_FULL) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2797 |
hw->fc = E1000_FC_FULL; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2798 |
DEBUGOUT("Flow Control = FULL.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2799 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2800 |
hw->fc = E1000_FC_RX_PAUSE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2801 |
DEBUGOUT("Flow Control = RX PAUSE frames only.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2802 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2803 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2804 |
/* For receiving PAUSE frames ONLY. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2805 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2806 |
* LOCAL DEVICE | LINK PARTNER |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2807 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2808 |
*-------|---------|-------|---------|-------------------- |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2809 |
* 0 | 1 | 1 | 1 | E1000_FC_TX_PAUSE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2810 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2811 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2812 |
else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2813 |
(mii_nway_adv_reg & NWAY_AR_ASM_DIR) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2814 |
(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2815 |
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2816 |
hw->fc = E1000_FC_TX_PAUSE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2817 |
DEBUGOUT("Flow Control = TX PAUSE frames only.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2818 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2819 |
/* For transmitting PAUSE frames ONLY. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2820 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2821 |
* LOCAL DEVICE | LINK PARTNER |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2822 |
* PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2823 |
*-------|---------|-------|---------|-------------------- |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2824 |
* 1 | 1 | 0 | 1 | E1000_FC_RX_PAUSE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2825 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2826 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2827 |
else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2828 |
(mii_nway_adv_reg & NWAY_AR_ASM_DIR) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2829 |
!(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2830 |
(mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2831 |
hw->fc = E1000_FC_RX_PAUSE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2832 |
DEBUGOUT("Flow Control = RX PAUSE frames only.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2833 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2834 |
/* Per the IEEE spec, at this point flow control should be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2835 |
* disabled. However, we want to consider that we could |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2836 |
* be connected to a legacy switch that doesn't advertise |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2837 |
* desired flow control, but can be forced on the link |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2838 |
* partner. So if we advertised no flow control, that is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2839 |
* what we will resolve to. If we advertised some kind of |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2840 |
* receive capability (Rx Pause Only or Full Flow Control) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2841 |
* and the link partner advertised none, we will configure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2842 |
* ourselves to enable Rx Flow Control only. We can do |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2843 |
* this safely for two reasons: If the link partner really |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2844 |
* didn't want flow control enabled, and we enable Rx, no |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2845 |
* harm done since we won't be receiving any PAUSE frames |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2846 |
* anyway. If the intent on the link partner was to have |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2847 |
* flow control enabled, then by us enabling RX only, we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2848 |
* can at least receive pause frames and process them. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2849 |
* This is a good idea because in most cases, since we are |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2850 |
* predominantly a server NIC, more times than not we will |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2851 |
* be asked to delay transmission of packets than asking |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2852 |
* our link partner to pause transmission of frames. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2853 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2854 |
else if ((hw->original_fc == E1000_FC_NONE || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2855 |
hw->original_fc == E1000_FC_TX_PAUSE) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2856 |
hw->fc_strict_ieee) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2857 |
hw->fc = E1000_FC_NONE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2858 |
DEBUGOUT("Flow Control = NONE.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2859 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2860 |
hw->fc = E1000_FC_RX_PAUSE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2861 |
DEBUGOUT("Flow Control = RX PAUSE frames only.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2862 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2863 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2864 |
/* Now we need to do one last check... If we auto- |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2865 |
* negotiated to HALF DUPLEX, flow control should not be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2866 |
* enabled per IEEE 802.3 spec. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2867 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2868 |
ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2869 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2870 |
DEBUGOUT("Error getting link speed and duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2871 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2872 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2873 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2874 |
if (duplex == HALF_DUPLEX) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2875 |
hw->fc = E1000_FC_NONE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2876 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2877 |
/* Now we call a subroutine to actually force the MAC |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2878 |
* controller to use the correct flow control settings. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2879 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2880 |
ret_val = e1000_force_mac_fc(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2881 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2882 |
DEBUGOUT("Error forcing flow control settings\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2883 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2884 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2885 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2886 |
DEBUGOUT("Copper PHY and Auto Neg has not completed.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2887 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2888 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2889 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2890 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2891 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2892 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2893 |
* Checks to see if the link status of the hardware has changed. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2894 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2895 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2896 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2897 |
* Called by any function that needs to check the link status of the adapter. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2898 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2899 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2900 |
e1000_check_for_link(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2901 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2902 |
u32 rxcw = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2903 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2904 |
u32 status; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2905 |
u32 rctl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2906 |
u32 icr; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2907 |
u32 signal = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2908 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2909 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2910 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2911 |
DEBUGFUNC("e1000_check_for_link"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2912 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2913 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2914 |
status = E1000_READ_REG(hw, STATUS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2915 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2916 |
/* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2917 |
* set when the optics detect a signal. On older adapters, it will be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2918 |
* cleared when there is a signal. This applies to fiber media only. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2919 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2920 |
if ((hw->media_type == e1000_media_type_fiber) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2921 |
(hw->media_type == e1000_media_type_internal_serdes)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2922 |
rxcw = E1000_READ_REG(hw, RXCW); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2923 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2924 |
if (hw->media_type == e1000_media_type_fiber) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2925 |
signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2926 |
if (status & E1000_STATUS_LU) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2927 |
hw->get_link_status = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2928 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2929 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2930 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2931 |
/* If we have a copper PHY then we only want to go out to the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2932 |
* registers to see if Auto-Neg has completed and/or if our link |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2933 |
* status has changed. The get_link_status flag will be set if we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2934 |
* receive a Link Status Change interrupt or we have Rx Sequence |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2935 |
* Errors. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2936 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2937 |
if ((hw->media_type == e1000_media_type_copper) && hw->get_link_status) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2938 |
/* First we want to see if the MII Status Register reports |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2939 |
* link. If so, then we want to get the current speed/duplex |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2940 |
* of the PHY. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2941 |
* Read the register twice since the link bit is sticky. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2942 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2943 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2944 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2945 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2946 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2947 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2948 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2949 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2950 |
if (phy_data & MII_SR_LINK_STATUS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2951 |
hw->get_link_status = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2952 |
/* Check if there was DownShift, must be checked immediately after |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2953 |
* link-up */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2954 |
e1000_check_downshift(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2955 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2956 |
/* If we are on 82544 or 82543 silicon and speed/duplex |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2957 |
* are forced to 10H or 10F, then we will implement the polarity |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2958 |
* reversal workaround. We disable interrupts first, and upon |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2959 |
* returning, place the devices interrupt state to its previous |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2960 |
* value except for the link status change interrupt which will |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2961 |
* happen due to the execution of this workaround. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2962 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2963 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2964 |
if ((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2965 |
(!hw->autoneg) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2966 |
(hw->forced_speed_duplex == e1000_10_full || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2967 |
hw->forced_speed_duplex == e1000_10_half)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2968 |
E1000_WRITE_REG(hw, IMC, 0xffffffff); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2969 |
ret_val = e1000_polarity_reversal_workaround(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2970 |
icr = E1000_READ_REG(hw, ICR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2971 |
E1000_WRITE_REG(hw, ICS, (icr & ~E1000_ICS_LSC)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2972 |
E1000_WRITE_REG(hw, IMS, IMS_ENABLE_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2973 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2974 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2975 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2976 |
/* No link detected */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2977 |
e1000_config_dsp_after_link_change(hw, false); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2978 |
return 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2979 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2980 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2981 |
/* If we are forcing speed/duplex, then we simply return since |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2982 |
* we have already determined whether we have link or not. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2983 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2984 |
if (!hw->autoneg) return -E1000_ERR_CONFIG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2985 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2986 |
/* optimize the dsp settings for the igp phy */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2987 |
e1000_config_dsp_after_link_change(hw, true); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2988 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2989 |
/* We have a M88E1000 PHY and Auto-Neg is enabled. If we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2990 |
* have Si on board that is 82544 or newer, Auto |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2991 |
* Speed Detection takes care of MAC speed/duplex |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2992 |
* configuration. So we only need to configure Collision |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2993 |
* Distance in the MAC. Otherwise, we need to force |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2994 |
* speed/duplex on the MAC to the current PHY speed/duplex |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2995 |
* settings. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2996 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2997 |
if (hw->mac_type >= e1000_82544) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2998 |
e1000_config_collision_dist(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2999 |
else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3000 |
ret_val = e1000_config_mac_to_phy(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3001 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3002 |
DEBUGOUT("Error configuring MAC to PHY settings\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3003 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3004 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3005 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3006 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3007 |
/* Configure Flow Control now that Auto-Neg has completed. First, we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3008 |
* need to restore the desired flow control settings because we may |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3009 |
* have had to re-autoneg with a different link partner. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3010 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3011 |
ret_val = e1000_config_fc_after_link_up(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3012 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3013 |
DEBUGOUT("Error configuring flow control\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3014 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3015 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3016 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3017 |
/* At this point we know that we are on copper and we have |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3018 |
* auto-negotiated link. These are conditions for checking the link |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3019 |
* partner capability register. We use the link speed to determine if |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3020 |
* TBI compatibility needs to be turned on or off. If the link is not |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3021 |
* at gigabit speed, then TBI compatibility is not needed. If we are |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3022 |
* at gigabit speed, we turn on TBI compatibility. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3023 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3024 |
if (hw->tbi_compatibility_en) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3025 |
u16 speed, duplex; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3026 |
ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3027 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3028 |
DEBUGOUT("Error getting link speed and duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3029 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3030 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3031 |
if (speed != SPEED_1000) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3032 |
/* If link speed is not set to gigabit speed, we do not need |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3033 |
* to enable TBI compatibility. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3034 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3035 |
if (hw->tbi_compatibility_on) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3036 |
/* If we previously were in the mode, turn it off. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3037 |
rctl = E1000_READ_REG(hw, RCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3038 |
rctl &= ~E1000_RCTL_SBP; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3039 |
E1000_WRITE_REG(hw, RCTL, rctl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3040 |
hw->tbi_compatibility_on = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3041 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3042 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3043 |
/* If TBI compatibility is was previously off, turn it on. For |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3044 |
* compatibility with a TBI link partner, we will store bad |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3045 |
* packets. Some frames have an additional byte on the end and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3046 |
* will look like CRC errors to to the hardware. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3047 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3048 |
if (!hw->tbi_compatibility_on) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3049 |
hw->tbi_compatibility_on = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3050 |
rctl = E1000_READ_REG(hw, RCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3051 |
rctl |= E1000_RCTL_SBP; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3052 |
E1000_WRITE_REG(hw, RCTL, rctl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3053 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3054 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3055 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3056 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3057 |
/* If we don't have link (auto-negotiation failed or link partner cannot |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3058 |
* auto-negotiate), the cable is plugged in (we have signal), and our |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3059 |
* link partner is not trying to auto-negotiate with us (we are receiving |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3060 |
* idles or data), we need to force link up. We also need to give |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3061 |
* auto-negotiation time to complete, in case the cable was just plugged |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3062 |
* in. The autoneg_failed flag does this. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3063 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3064 |
else if ((((hw->media_type == e1000_media_type_fiber) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3065 |
((ctrl & E1000_CTRL_SWDPIN1) == signal)) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3066 |
(hw->media_type == e1000_media_type_internal_serdes)) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3067 |
(!(status & E1000_STATUS_LU)) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3068 |
(!(rxcw & E1000_RXCW_C))) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3069 |
if (hw->autoneg_failed == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3070 |
hw->autoneg_failed = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3071 |
return 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3072 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3073 |
DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3074 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3075 |
/* Disable auto-negotiation in the TXCW register */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3076 |
E1000_WRITE_REG(hw, TXCW, (hw->txcw & ~E1000_TXCW_ANE)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3077 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3078 |
/* Force link-up and also force full-duplex. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3079 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3080 |
ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3081 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3082 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3083 |
/* Configure Flow Control after forcing link up. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3084 |
ret_val = e1000_config_fc_after_link_up(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3085 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3086 |
DEBUGOUT("Error configuring flow control\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3087 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3088 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3089 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3090 |
/* If we are forcing link and we are receiving /C/ ordered sets, re-enable |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3091 |
* auto-negotiation in the TXCW register and disable forced link in the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3092 |
* Device Control register in an attempt to auto-negotiate with our link |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3093 |
* partner. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3094 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3095 |
else if (((hw->media_type == e1000_media_type_fiber) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3096 |
(hw->media_type == e1000_media_type_internal_serdes)) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3097 |
(ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3098 |
DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3099 |
E1000_WRITE_REG(hw, TXCW, hw->txcw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3100 |
E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3101 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3102 |
hw->serdes_link_down = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3103 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3104 |
/* If we force link for non-auto-negotiation switch, check link status |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3105 |
* based on MAC synchronization for internal serdes media type. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3106 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3107 |
else if ((hw->media_type == e1000_media_type_internal_serdes) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3108 |
!(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3109 |
/* SYNCH bit and IV bit are sticky. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3110 |
udelay(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3111 |
if (E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3112 |
if (!(rxcw & E1000_RXCW_IV)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3113 |
hw->serdes_link_down = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3114 |
DEBUGOUT("SERDES: Link is up.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3115 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3116 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3117 |
hw->serdes_link_down = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3118 |
DEBUGOUT("SERDES: Link is down.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3119 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3120 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3121 |
if ((hw->media_type == e1000_media_type_internal_serdes) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3122 |
(E1000_TXCW_ANE & E1000_READ_REG(hw, TXCW))) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3123 |
hw->serdes_link_down = !(E1000_STATUS_LU & E1000_READ_REG(hw, STATUS)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3124 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3125 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3126 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3127 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3128 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3129 |
* Detects the current speed and duplex settings of the hardware. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3130 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3131 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3132 |
* speed - Speed of the connection |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3133 |
* duplex - Duplex setting of the connection |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3134 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3135 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3136 |
e1000_get_speed_and_duplex(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3137 |
u16 *speed, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3138 |
u16 *duplex) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3139 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3140 |
u32 status; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3141 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3142 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3143 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3144 |
DEBUGFUNC("e1000_get_speed_and_duplex"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3145 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3146 |
if (hw->mac_type >= e1000_82543) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3147 |
status = E1000_READ_REG(hw, STATUS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3148 |
if (status & E1000_STATUS_SPEED_1000) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3149 |
*speed = SPEED_1000; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3150 |
DEBUGOUT("1000 Mbs, "); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3151 |
} else if (status & E1000_STATUS_SPEED_100) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3152 |
*speed = SPEED_100; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3153 |
DEBUGOUT("100 Mbs, "); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3154 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3155 |
*speed = SPEED_10; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3156 |
DEBUGOUT("10 Mbs, "); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3157 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3158 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3159 |
if (status & E1000_STATUS_FD) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3160 |
*duplex = FULL_DUPLEX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3161 |
DEBUGOUT("Full Duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3162 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3163 |
*duplex = HALF_DUPLEX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3164 |
DEBUGOUT(" Half Duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3165 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3166 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3167 |
DEBUGOUT("1000 Mbs, Full Duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3168 |
*speed = SPEED_1000; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3169 |
*duplex = FULL_DUPLEX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3170 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3171 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3172 |
/* IGP01 PHY may advertise full duplex operation after speed downgrade even |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3173 |
* if it is operating at half duplex. Here we set the duplex settings to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3174 |
* match the duplex in the link partner's capabilities. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3175 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3176 |
if (hw->phy_type == e1000_phy_igp && hw->speed_downgraded) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3177 |
ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3178 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3179 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3180 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3181 |
if (!(phy_data & NWAY_ER_LP_NWAY_CAPS)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3182 |
*duplex = HALF_DUPLEX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3183 |
else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3184 |
ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3185 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3186 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3187 |
if ((*speed == SPEED_100 && !(phy_data & NWAY_LPAR_100TX_FD_CAPS)) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3188 |
(*speed == SPEED_10 && !(phy_data & NWAY_LPAR_10T_FD_CAPS))) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3189 |
*duplex = HALF_DUPLEX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3190 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3191 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3192 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3193 |
if ((hw->mac_type == e1000_80003es2lan) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3194 |
(hw->media_type == e1000_media_type_copper)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3195 |
if (*speed == SPEED_1000) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3196 |
ret_val = e1000_configure_kmrn_for_1000(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3197 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3198 |
ret_val = e1000_configure_kmrn_for_10_100(hw, *duplex); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3199 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3200 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3201 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3202 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3203 |
if ((hw->phy_type == e1000_phy_igp_3) && (*speed == SPEED_1000)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3204 |
ret_val = e1000_kumeran_lock_loss_workaround(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3205 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3206 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3207 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3208 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3209 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3210 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3211 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3212 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3213 |
* Blocks until autoneg completes or times out (~4.5 seconds) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3214 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3215 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3216 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3217 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3218 |
e1000_wait_autoneg(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3219 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3220 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3221 |
u16 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3222 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3223 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3224 |
DEBUGFUNC("e1000_wait_autoneg"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3225 |
DEBUGOUT("Waiting for Auto-Neg to complete.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3226 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3227 |
/* We will wait for autoneg to complete or 4.5 seconds to expire. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3228 |
for (i = PHY_AUTO_NEG_TIME; i > 0; i--) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3229 |
/* Read the MII Status Register and wait for Auto-Neg |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3230 |
* Complete bit to be set. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3231 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3232 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3233 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3234 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3235 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3236 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3237 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3238 |
if (phy_data & MII_SR_AUTONEG_COMPLETE) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3239 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3240 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3241 |
msleep(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3242 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3243 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3244 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3245 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3246 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3247 |
* Raises the Management Data Clock |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3248 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3249 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3250 |
* ctrl - Device control register's current value |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3251 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3252 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3253 |
e1000_raise_mdi_clk(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3254 |
u32 *ctrl) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3255 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3256 |
/* Raise the clock input to the Management Data Clock (by setting the MDC |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3257 |
* bit), and then delay 10 microseconds. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3258 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3259 |
E1000_WRITE_REG(hw, CTRL, (*ctrl | E1000_CTRL_MDC)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3260 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3261 |
udelay(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3262 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3263 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3264 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3265 |
* Lowers the Management Data Clock |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3266 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3267 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3268 |
* ctrl - Device control register's current value |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3269 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3270 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3271 |
e1000_lower_mdi_clk(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3272 |
u32 *ctrl) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3273 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3274 |
/* Lower the clock input to the Management Data Clock (by clearing the MDC |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3275 |
* bit), and then delay 10 microseconds. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3276 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3277 |
E1000_WRITE_REG(hw, CTRL, (*ctrl & ~E1000_CTRL_MDC)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3278 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3279 |
udelay(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3280 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3281 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3282 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3283 |
* Shifts data bits out to the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3284 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3285 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3286 |
* data - Data to send out to the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3287 |
* count - Number of bits to shift out |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3288 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3289 |
* Bits are shifted out in MSB to LSB order. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3290 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3291 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3292 |
e1000_shift_out_mdi_bits(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3293 |
u32 data, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3294 |
u16 count) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3295 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3296 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3297 |
u32 mask; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3298 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3299 |
/* We need to shift "count" number of bits out to the PHY. So, the value |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3300 |
* in the "data" parameter will be shifted out to the PHY one bit at a |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3301 |
* time. In order to do this, "data" must be broken down into bits. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3302 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3303 |
mask = 0x01; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3304 |
mask <<= (count - 1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3305 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3306 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3307 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3308 |
/* Set MDIO_DIR and MDC_DIR direction bits to be used as output pins. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3309 |
ctrl |= (E1000_CTRL_MDIO_DIR | E1000_CTRL_MDC_DIR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3310 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3311 |
while (mask) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3312 |
/* A "1" is shifted out to the PHY by setting the MDIO bit to "1" and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3313 |
* then raising and lowering the Management Data Clock. A "0" is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3314 |
* shifted out to the PHY by setting the MDIO bit to "0" and then |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3315 |
* raising and lowering the clock. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3316 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3317 |
if (data & mask) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3318 |
ctrl |= E1000_CTRL_MDIO; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3319 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3320 |
ctrl &= ~E1000_CTRL_MDIO; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3321 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3322 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3323 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3324 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3325 |
udelay(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3326 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3327 |
e1000_raise_mdi_clk(hw, &ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3328 |
e1000_lower_mdi_clk(hw, &ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3329 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3330 |
mask = mask >> 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3331 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3332 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3333 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3334 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3335 |
* Shifts data bits in from the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3336 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3337 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3338 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3339 |
* Bits are shifted in in MSB to LSB order. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3340 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3341 |
static u16 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3342 |
e1000_shift_in_mdi_bits(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3343 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3344 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3345 |
u16 data = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3346 |
u8 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3347 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3348 |
/* In order to read a register from the PHY, we need to shift in a total |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3349 |
* of 18 bits from the PHY. The first two bit (turnaround) times are used |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3350 |
* to avoid contention on the MDIO pin when a read operation is performed. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3351 |
* These two bits are ignored by us and thrown away. Bits are "shifted in" |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3352 |
* by raising the input to the Management Data Clock (setting the MDC bit), |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3353 |
* and then reading the value of the MDIO bit. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3354 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3355 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3356 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3357 |
/* Clear MDIO_DIR (SWDPIO1) to indicate this bit is to be used as input. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3358 |
ctrl &= ~E1000_CTRL_MDIO_DIR; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3359 |
ctrl &= ~E1000_CTRL_MDIO; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3360 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3361 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3362 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3363 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3364 |
/* Raise and Lower the clock before reading in the data. This accounts for |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3365 |
* the turnaround bits. The first clock occurred when we clocked out the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3366 |
* last bit of the Register Address. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3367 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3368 |
e1000_raise_mdi_clk(hw, &ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3369 |
e1000_lower_mdi_clk(hw, &ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3370 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3371 |
for (data = 0, i = 0; i < 16; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3372 |
data = data << 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3373 |
e1000_raise_mdi_clk(hw, &ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3374 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3375 |
/* Check to see if we shifted in a "1". */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3376 |
if (ctrl & E1000_CTRL_MDIO) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3377 |
data |= 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3378 |
e1000_lower_mdi_clk(hw, &ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3379 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3380 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3381 |
e1000_raise_mdi_clk(hw, &ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3382 |
e1000_lower_mdi_clk(hw, &ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3383 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3384 |
return data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3385 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3386 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3387 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3388 |
e1000_swfw_sync_acquire(struct e1000_hw *hw, u16 mask) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3389 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3390 |
u32 swfw_sync = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3391 |
u32 swmask = mask; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3392 |
u32 fwmask = mask << 16; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3393 |
s32 timeout = 200; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3394 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3395 |
DEBUGFUNC("e1000_swfw_sync_acquire"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3396 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3397 |
if (hw->swfwhw_semaphore_present) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3398 |
return e1000_get_software_flag(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3399 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3400 |
if (!hw->swfw_sync_present) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3401 |
return e1000_get_hw_eeprom_semaphore(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3402 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3403 |
while (timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3404 |
if (e1000_get_hw_eeprom_semaphore(hw)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3405 |
return -E1000_ERR_SWFW_SYNC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3406 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3407 |
swfw_sync = E1000_READ_REG(hw, SW_FW_SYNC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3408 |
if (!(swfw_sync & (fwmask | swmask))) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3409 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3410 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3411 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3412 |
/* firmware currently using resource (fwmask) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3413 |
/* or other software thread currently using resource (swmask) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3414 |
e1000_put_hw_eeprom_semaphore(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3415 |
mdelay(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3416 |
timeout--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3417 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3418 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3419 |
if (!timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3420 |
DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3421 |
return -E1000_ERR_SWFW_SYNC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3422 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3423 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3424 |
swfw_sync |= swmask; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3425 |
E1000_WRITE_REG(hw, SW_FW_SYNC, swfw_sync); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3426 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3427 |
e1000_put_hw_eeprom_semaphore(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3428 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3429 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3430 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3431 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3432 |
e1000_swfw_sync_release(struct e1000_hw *hw, u16 mask) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3433 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3434 |
u32 swfw_sync; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3435 |
u32 swmask = mask; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3436 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3437 |
DEBUGFUNC("e1000_swfw_sync_release"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3438 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3439 |
if (hw->swfwhw_semaphore_present) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3440 |
e1000_release_software_flag(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3441 |
return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3442 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3443 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3444 |
if (!hw->swfw_sync_present) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3445 |
e1000_put_hw_eeprom_semaphore(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3446 |
return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3447 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3448 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3449 |
/* if (e1000_get_hw_eeprom_semaphore(hw)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3450 |
* return -E1000_ERR_SWFW_SYNC; */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3451 |
while (e1000_get_hw_eeprom_semaphore(hw) != E1000_SUCCESS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3452 |
/* empty */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3453 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3454 |
swfw_sync = E1000_READ_REG(hw, SW_FW_SYNC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3455 |
swfw_sync &= ~swmask; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3456 |
E1000_WRITE_REG(hw, SW_FW_SYNC, swfw_sync); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3457 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3458 |
e1000_put_hw_eeprom_semaphore(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3459 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3460 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3461 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3462 |
* Reads the value from a PHY register, if the value is on a specific non zero |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3463 |
* page, sets the page first. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3464 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3465 |
* reg_addr - address of the PHY register to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3466 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3467 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3468 |
e1000_read_phy_reg(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3469 |
u32 reg_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3470 |
u16 *phy_data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3471 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3472 |
u32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3473 |
u16 swfw; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3474 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3475 |
DEBUGFUNC("e1000_read_phy_reg"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3476 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3477 |
if ((hw->mac_type == e1000_80003es2lan) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3478 |
(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3479 |
swfw = E1000_SWFW_PHY1_SM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3480 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3481 |
swfw = E1000_SWFW_PHY0_SM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3482 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3483 |
if (e1000_swfw_sync_acquire(hw, swfw)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3484 |
return -E1000_ERR_SWFW_SYNC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3485 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3486 |
if ((hw->phy_type == e1000_phy_igp || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3487 |
hw->phy_type == e1000_phy_igp_3 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3488 |
hw->phy_type == e1000_phy_igp_2) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3489 |
(reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3490 |
ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3491 |
(u16)reg_addr); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3492 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3493 |
e1000_swfw_sync_release(hw, swfw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3494 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3495 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3496 |
} else if (hw->phy_type == e1000_phy_gg82563) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3497 |
if (((reg_addr & MAX_PHY_REG_ADDRESS) > MAX_PHY_MULTI_PAGE_REG) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3498 |
(hw->mac_type == e1000_80003es2lan)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3499 |
/* Select Configuration Page */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3500 |
if ((reg_addr & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3501 |
ret_val = e1000_write_phy_reg_ex(hw, GG82563_PHY_PAGE_SELECT, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3502 |
(u16)((u16)reg_addr >> GG82563_PAGE_SHIFT)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3503 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3504 |
/* Use Alternative Page Select register to access |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3505 |
* registers 30 and 31 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3506 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3507 |
ret_val = e1000_write_phy_reg_ex(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3508 |
GG82563_PHY_PAGE_SELECT_ALT, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3509 |
(u16)((u16)reg_addr >> GG82563_PAGE_SHIFT)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3510 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3511 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3512 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3513 |
e1000_swfw_sync_release(hw, swfw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3514 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3515 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3516 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3517 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3518 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3519 |
ret_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3520 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3521 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3522 |
e1000_swfw_sync_release(hw, swfw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3523 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3524 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3525 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3526 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3527 |
e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3528 |
u16 *phy_data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3529 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3530 |
u32 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3531 |
u32 mdic = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3532 |
const u32 phy_addr = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3533 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3534 |
DEBUGFUNC("e1000_read_phy_reg_ex"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3535 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3536 |
if (reg_addr > MAX_PHY_REG_ADDRESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3537 |
DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3538 |
return -E1000_ERR_PARAM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3539 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3540 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3541 |
if (hw->mac_type > e1000_82543) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3542 |
/* Set up Op-code, Phy Address, and register address in the MDI |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3543 |
* Control register. The MAC will take care of interfacing with the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3544 |
* PHY to retrieve the desired data. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3545 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3546 |
mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3547 |
(phy_addr << E1000_MDIC_PHY_SHIFT) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3548 |
(E1000_MDIC_OP_READ)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3549 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3550 |
E1000_WRITE_REG(hw, MDIC, mdic); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3551 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3552 |
/* Poll the ready bit to see if the MDI read completed */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3553 |
for (i = 0; i < 64; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3554 |
udelay(50); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3555 |
mdic = E1000_READ_REG(hw, MDIC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3556 |
if (mdic & E1000_MDIC_READY) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3557 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3558 |
if (!(mdic & E1000_MDIC_READY)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3559 |
DEBUGOUT("MDI Read did not complete\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3560 |
return -E1000_ERR_PHY; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3561 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3562 |
if (mdic & E1000_MDIC_ERROR) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3563 |
DEBUGOUT("MDI Error\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3564 |
return -E1000_ERR_PHY; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3565 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3566 |
*phy_data = (u16) mdic; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3567 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3568 |
/* We must first send a preamble through the MDIO pin to signal the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3569 |
* beginning of an MII instruction. This is done by sending 32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3570 |
* consecutive "1" bits. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3571 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3572 |
e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3573 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3574 |
/* Now combine the next few fields that are required for a read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3575 |
* operation. We use this method instead of calling the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3576 |
* e1000_shift_out_mdi_bits routine five different times. The format of |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3577 |
* a MII read instruction consists of a shift out of 14 bits and is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3578 |
* defined as follows: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3579 |
* <Preamble><SOF><Op Code><Phy Addr><Reg Addr> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3580 |
* followed by a shift in of 18 bits. This first two bits shifted in |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3581 |
* are TurnAround bits used to avoid contention on the MDIO pin when a |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3582 |
* READ operation is performed. These two bits are thrown away |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3583 |
* followed by a shift in of 16 bits which contains the desired data. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3584 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3585 |
mdic = ((reg_addr) | (phy_addr << 5) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3586 |
(PHY_OP_READ << 10) | (PHY_SOF << 12)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3587 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3588 |
e1000_shift_out_mdi_bits(hw, mdic, 14); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3589 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3590 |
/* Now that we've shifted out the read command to the MII, we need to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3591 |
* "shift in" the 16-bit value (18 total bits) of the requested PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3592 |
* register address. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3593 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3594 |
*phy_data = e1000_shift_in_mdi_bits(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3595 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3596 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3597 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3598 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3599 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3600 |
* Writes a value to a PHY register |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3601 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3602 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3603 |
* reg_addr - address of the PHY register to write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3604 |
* data - data to write to the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3605 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3606 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3607 |
e1000_write_phy_reg(struct e1000_hw *hw, u32 reg_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3608 |
u16 phy_data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3609 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3610 |
u32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3611 |
u16 swfw; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3612 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3613 |
DEBUGFUNC("e1000_write_phy_reg"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3614 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3615 |
if ((hw->mac_type == e1000_80003es2lan) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3616 |
(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3617 |
swfw = E1000_SWFW_PHY1_SM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3618 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3619 |
swfw = E1000_SWFW_PHY0_SM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3620 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3621 |
if (e1000_swfw_sync_acquire(hw, swfw)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3622 |
return -E1000_ERR_SWFW_SYNC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3623 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3624 |
if ((hw->phy_type == e1000_phy_igp || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3625 |
hw->phy_type == e1000_phy_igp_3 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3626 |
hw->phy_type == e1000_phy_igp_2) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3627 |
(reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3628 |
ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3629 |
(u16)reg_addr); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3630 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3631 |
e1000_swfw_sync_release(hw, swfw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3632 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3633 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3634 |
} else if (hw->phy_type == e1000_phy_gg82563) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3635 |
if (((reg_addr & MAX_PHY_REG_ADDRESS) > MAX_PHY_MULTI_PAGE_REG) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3636 |
(hw->mac_type == e1000_80003es2lan)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3637 |
/* Select Configuration Page */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3638 |
if ((reg_addr & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3639 |
ret_val = e1000_write_phy_reg_ex(hw, GG82563_PHY_PAGE_SELECT, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3640 |
(u16)((u16)reg_addr >> GG82563_PAGE_SHIFT)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3641 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3642 |
/* Use Alternative Page Select register to access |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3643 |
* registers 30 and 31 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3644 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3645 |
ret_val = e1000_write_phy_reg_ex(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3646 |
GG82563_PHY_PAGE_SELECT_ALT, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3647 |
(u16)((u16)reg_addr >> GG82563_PAGE_SHIFT)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3648 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3649 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3650 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3651 |
e1000_swfw_sync_release(hw, swfw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3652 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3653 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3654 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3655 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3656 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3657 |
ret_val = e1000_write_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3658 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3659 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3660 |
e1000_swfw_sync_release(hw, swfw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3661 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3662 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3663 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3664 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3665 |
e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3666 |
u16 phy_data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3667 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3668 |
u32 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3669 |
u32 mdic = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3670 |
const u32 phy_addr = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3671 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3672 |
DEBUGFUNC("e1000_write_phy_reg_ex"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3673 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3674 |
if (reg_addr > MAX_PHY_REG_ADDRESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3675 |
DEBUGOUT1("PHY Address %d is out of range\n", reg_addr); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3676 |
return -E1000_ERR_PARAM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3677 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3678 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3679 |
if (hw->mac_type > e1000_82543) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3680 |
/* Set up Op-code, Phy Address, register address, and data intended |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3681 |
* for the PHY register in the MDI Control register. The MAC will take |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3682 |
* care of interfacing with the PHY to send the desired data. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3683 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3684 |
mdic = (((u32) phy_data) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3685 |
(reg_addr << E1000_MDIC_REG_SHIFT) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3686 |
(phy_addr << E1000_MDIC_PHY_SHIFT) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3687 |
(E1000_MDIC_OP_WRITE)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3688 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3689 |
E1000_WRITE_REG(hw, MDIC, mdic); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3690 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3691 |
/* Poll the ready bit to see if the MDI read completed */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3692 |
for (i = 0; i < 641; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3693 |
udelay(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3694 |
mdic = E1000_READ_REG(hw, MDIC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3695 |
if (mdic & E1000_MDIC_READY) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3696 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3697 |
if (!(mdic & E1000_MDIC_READY)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3698 |
DEBUGOUT("MDI Write did not complete\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3699 |
return -E1000_ERR_PHY; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3700 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3701 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3702 |
/* We'll need to use the SW defined pins to shift the write command |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3703 |
* out to the PHY. We first send a preamble to the PHY to signal the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3704 |
* beginning of the MII instruction. This is done by sending 32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3705 |
* consecutive "1" bits. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3706 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3707 |
e1000_shift_out_mdi_bits(hw, PHY_PREAMBLE, PHY_PREAMBLE_SIZE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3708 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3709 |
/* Now combine the remaining required fields that will indicate a |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3710 |
* write operation. We use this method instead of calling the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3711 |
* e1000_shift_out_mdi_bits routine for each field in the command. The |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3712 |
* format of a MII write instruction is as follows: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3713 |
* <Preamble><SOF><Op Code><Phy Addr><Reg Addr><Turnaround><Data>. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3714 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3715 |
mdic = ((PHY_TURNAROUND) | (reg_addr << 2) | (phy_addr << 7) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3716 |
(PHY_OP_WRITE << 12) | (PHY_SOF << 14)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3717 |
mdic <<= 16; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3718 |
mdic |= (u32) phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3719 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3720 |
e1000_shift_out_mdi_bits(hw, mdic, 32); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3721 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3722 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3723 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3724 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3725 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3726 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3727 |
e1000_read_kmrn_reg(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3728 |
u32 reg_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3729 |
u16 *data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3730 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3731 |
u32 reg_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3732 |
u16 swfw; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3733 |
DEBUGFUNC("e1000_read_kmrn_reg"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3734 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3735 |
if ((hw->mac_type == e1000_80003es2lan) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3736 |
(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3737 |
swfw = E1000_SWFW_PHY1_SM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3738 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3739 |
swfw = E1000_SWFW_PHY0_SM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3740 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3741 |
if (e1000_swfw_sync_acquire(hw, swfw)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3742 |
return -E1000_ERR_SWFW_SYNC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3743 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3744 |
/* Write register address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3745 |
reg_val = ((reg_addr << E1000_KUMCTRLSTA_OFFSET_SHIFT) & |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3746 |
E1000_KUMCTRLSTA_OFFSET) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3747 |
E1000_KUMCTRLSTA_REN; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3748 |
E1000_WRITE_REG(hw, KUMCTRLSTA, reg_val); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3749 |
udelay(2); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3750 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3751 |
/* Read the data returned */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3752 |
reg_val = E1000_READ_REG(hw, KUMCTRLSTA); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3753 |
*data = (u16)reg_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3754 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3755 |
e1000_swfw_sync_release(hw, swfw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3756 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3757 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3758 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3759 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3760 |
e1000_write_kmrn_reg(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3761 |
u32 reg_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3762 |
u16 data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3763 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3764 |
u32 reg_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3765 |
u16 swfw; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3766 |
DEBUGFUNC("e1000_write_kmrn_reg"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3767 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3768 |
if ((hw->mac_type == e1000_80003es2lan) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3769 |
(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3770 |
swfw = E1000_SWFW_PHY1_SM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3771 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3772 |
swfw = E1000_SWFW_PHY0_SM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3773 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3774 |
if (e1000_swfw_sync_acquire(hw, swfw)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3775 |
return -E1000_ERR_SWFW_SYNC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3776 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3777 |
reg_val = ((reg_addr << E1000_KUMCTRLSTA_OFFSET_SHIFT) & |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3778 |
E1000_KUMCTRLSTA_OFFSET) | data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3779 |
E1000_WRITE_REG(hw, KUMCTRLSTA, reg_val); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3780 |
udelay(2); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3781 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3782 |
e1000_swfw_sync_release(hw, swfw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3783 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3784 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3785 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3786 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3787 |
* Returns the PHY to the power-on reset state |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3788 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3789 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3790 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3791 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3792 |
e1000_phy_hw_reset(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3793 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3794 |
u32 ctrl, ctrl_ext; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3795 |
u32 led_ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3796 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3797 |
u16 swfw; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3798 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3799 |
DEBUGFUNC("e1000_phy_hw_reset"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3800 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3801 |
/* In the case of the phy reset being blocked, it's not an error, we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3802 |
* simply return success without performing the reset. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3803 |
ret_val = e1000_check_phy_reset_block(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3804 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3805 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3806 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3807 |
DEBUGOUT("Resetting Phy...\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3808 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3809 |
if (hw->mac_type > e1000_82543) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3810 |
if ((hw->mac_type == e1000_80003es2lan) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3811 |
(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3812 |
swfw = E1000_SWFW_PHY1_SM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3813 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3814 |
swfw = E1000_SWFW_PHY0_SM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3815 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3816 |
if (e1000_swfw_sync_acquire(hw, swfw)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3817 |
DEBUGOUT("Unable to acquire swfw sync\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3818 |
return -E1000_ERR_SWFW_SYNC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3819 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3820 |
/* Read the device control register and assert the E1000_CTRL_PHY_RST |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3821 |
* bit. Then, take it out of reset. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3822 |
* For pre-e1000_82571 hardware, we delay for 10ms between the assert |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3823 |
* and deassert. For e1000_82571 hardware and later, we instead delay |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3824 |
* for 50us between and 10ms after the deassertion. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3825 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3826 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3827 |
E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PHY_RST); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3828 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3829 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3830 |
if (hw->mac_type < e1000_82571) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3831 |
msleep(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3832 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3833 |
udelay(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3834 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3835 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3836 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3837 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3838 |
if (hw->mac_type >= e1000_82571) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3839 |
mdelay(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3840 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3841 |
e1000_swfw_sync_release(hw, swfw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3842 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3843 |
/* Read the Extended Device Control Register, assert the PHY_RESET_DIR |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3844 |
* bit to put the PHY into reset. Then, take it out of reset. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3845 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3846 |
ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3847 |
ctrl_ext |= E1000_CTRL_EXT_SDP4_DIR; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3848 |
ctrl_ext &= ~E1000_CTRL_EXT_SDP4_DATA; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3849 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3850 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3851 |
msleep(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3852 |
ctrl_ext |= E1000_CTRL_EXT_SDP4_DATA; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3853 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3854 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3855 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3856 |
udelay(150); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3857 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3858 |
if ((hw->mac_type == e1000_82541) || (hw->mac_type == e1000_82547)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3859 |
/* Configure activity LED after PHY reset */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3860 |
led_ctrl = E1000_READ_REG(hw, LEDCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3861 |
led_ctrl &= IGP_ACTIVITY_LED_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3862 |
led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3863 |
E1000_WRITE_REG(hw, LEDCTL, led_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3864 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3865 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3866 |
/* Wait for FW to finish PHY configuration. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3867 |
ret_val = e1000_get_phy_cfg_done(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3868 |
if (ret_val != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3869 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3870 |
e1000_release_software_semaphore(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3871 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3872 |
if ((hw->mac_type == e1000_ich8lan) && (hw->phy_type == e1000_phy_igp_3)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3873 |
ret_val = e1000_init_lcd_from_nvm(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3874 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3875 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3876 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3877 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3878 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3879 |
* Resets the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3880 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3881 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3882 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3883 |
* Sets bit 15 of the MII Control register |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3884 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3885 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3886 |
e1000_phy_reset(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3887 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3888 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3889 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3890 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3891 |
DEBUGFUNC("e1000_phy_reset"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3892 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3893 |
/* In the case of the phy reset being blocked, it's not an error, we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3894 |
* simply return success without performing the reset. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3895 |
ret_val = e1000_check_phy_reset_block(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3896 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3897 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3898 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3899 |
switch (hw->phy_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3900 |
case e1000_phy_igp: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3901 |
case e1000_phy_igp_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3902 |
case e1000_phy_igp_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3903 |
case e1000_phy_ife: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3904 |
ret_val = e1000_phy_hw_reset(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3905 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3906 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3907 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3908 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3909 |
ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3910 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3911 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3912 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3913 |
phy_data |= MII_CR_RESET; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3914 |
ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3915 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3916 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3917 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3918 |
udelay(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3919 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3920 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3921 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3922 |
if (hw->phy_type == e1000_phy_igp || hw->phy_type == e1000_phy_igp_2) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3923 |
e1000_phy_init_script(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3924 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3925 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3926 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3927 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3928 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3929 |
* Work-around for 82566 power-down: on D3 entry- |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3930 |
* 1) disable gigabit link |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3931 |
* 2) write VR power-down enable |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3932 |
* 3) read it back |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3933 |
* if successful continue, else issue LCD reset and repeat |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3934 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3935 |
* hw - struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3936 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3937 |
void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3938 |
e1000_phy_powerdown_workaround(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3939 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3940 |
s32 reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3941 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3942 |
s32 retry = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3943 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3944 |
DEBUGFUNC("e1000_phy_powerdown_workaround"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3945 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3946 |
if (hw->phy_type != e1000_phy_igp_3) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3947 |
return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3948 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3949 |
do { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3950 |
/* Disable link */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3951 |
reg = E1000_READ_REG(hw, PHY_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3952 |
E1000_WRITE_REG(hw, PHY_CTRL, reg | E1000_PHY_CTRL_GBE_DISABLE | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3953 |
E1000_PHY_CTRL_NOND0A_GBE_DISABLE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3954 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3955 |
/* Write VR power-down enable - bits 9:8 should be 10b */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3956 |
e1000_read_phy_reg(hw, IGP3_VR_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3957 |
phy_data |= (1 << 9); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3958 |
phy_data &= ~(1 << 8); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3959 |
e1000_write_phy_reg(hw, IGP3_VR_CTRL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3960 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3961 |
/* Read it back and test */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3962 |
e1000_read_phy_reg(hw, IGP3_VR_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3963 |
if (((phy_data & IGP3_VR_CTRL_MODE_MASK) == IGP3_VR_CTRL_MODE_SHUT) || retry) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3964 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3965 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3966 |
/* Issue PHY reset and repeat at most one more time */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3967 |
reg = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3968 |
E1000_WRITE_REG(hw, CTRL, reg | E1000_CTRL_PHY_RST); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3969 |
retry++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3970 |
} while (retry); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3971 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3972 |
return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3973 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3974 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3975 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3976 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3977 |
* Work-around for 82566 Kumeran PCS lock loss: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3978 |
* On link status change (i.e. PCI reset, speed change) and link is up and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3979 |
* speed is gigabit- |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3980 |
* 0) if workaround is optionally disabled do nothing |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3981 |
* 1) wait 1ms for Kumeran link to come up |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3982 |
* 2) check Kumeran Diagnostic register PCS lock loss bit |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3983 |
* 3) if not set the link is locked (all is good), otherwise... |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3984 |
* 4) reset the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3985 |
* 5) repeat up to 10 times |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3986 |
* Note: this is only called for IGP3 copper when speed is 1gb. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3987 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3988 |
* hw - struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3989 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3990 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3991 |
e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3992 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3993 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3994 |
s32 reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3995 |
s32 cnt; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3996 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3997 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3998 |
if (hw->kmrn_lock_loss_workaround_disabled) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3999 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4000 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4001 |
/* Make sure link is up before proceeding. If not just return. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4002 |
* Attempting this while link is negotiating fouled up link |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4003 |
* stability */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4004 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4005 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4006 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4007 |
if (phy_data & MII_SR_LINK_STATUS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4008 |
for (cnt = 0; cnt < 10; cnt++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4009 |
/* read once to clear */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4010 |
ret_val = e1000_read_phy_reg(hw, IGP3_KMRN_DIAG, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4011 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4012 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4013 |
/* and again to get new status */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4014 |
ret_val = e1000_read_phy_reg(hw, IGP3_KMRN_DIAG, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4015 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4016 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4017 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4018 |
/* check for PCS lock */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4019 |
if (!(phy_data & IGP3_KMRN_DIAG_PCS_LOCK_LOSS)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4020 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4021 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4022 |
/* Issue PHY reset */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4023 |
e1000_phy_hw_reset(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4024 |
mdelay(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4025 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4026 |
/* Disable GigE link negotiation */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4027 |
reg = E1000_READ_REG(hw, PHY_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4028 |
E1000_WRITE_REG(hw, PHY_CTRL, reg | E1000_PHY_CTRL_GBE_DISABLE | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4029 |
E1000_PHY_CTRL_NOND0A_GBE_DISABLE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4030 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4031 |
/* unable to acquire PCS lock */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4032 |
return E1000_ERR_PHY; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4033 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4034 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4035 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4036 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4037 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4038 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4039 |
* Probes the expected PHY address for known PHY IDs |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4040 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4041 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4042 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4043 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4044 |
e1000_detect_gig_phy(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4045 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4046 |
s32 phy_init_status, ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4047 |
u16 phy_id_high, phy_id_low; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4048 |
bool match = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4049 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4050 |
DEBUGFUNC("e1000_detect_gig_phy"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4051 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4052 |
if (hw->phy_id != 0) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4053 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4054 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4055 |
/* The 82571 firmware may still be configuring the PHY. In this |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4056 |
* case, we cannot access the PHY until the configuration is done. So |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4057 |
* we explicitly set the PHY values. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4058 |
if (hw->mac_type == e1000_82571 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4059 |
hw->mac_type == e1000_82572) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4060 |
hw->phy_id = IGP01E1000_I_PHY_ID; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4061 |
hw->phy_type = e1000_phy_igp_2; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4062 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4063 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4064 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4065 |
/* ESB-2 PHY reads require e1000_phy_gg82563 to be set because of a work- |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4066 |
* around that forces PHY page 0 to be set or the reads fail. The rest of |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4067 |
* the code in this routine uses e1000_read_phy_reg to read the PHY ID. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4068 |
* So for ESB-2 we need to have this set so our reads won't fail. If the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4069 |
* attached PHY is not a e1000_phy_gg82563, the routines below will figure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4070 |
* this out as well. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4071 |
if (hw->mac_type == e1000_80003es2lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4072 |
hw->phy_type = e1000_phy_gg82563; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4073 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4074 |
/* Read the PHY ID Registers to identify which PHY is onboard. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4075 |
ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4076 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4077 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4078 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4079 |
hw->phy_id = (u32) (phy_id_high << 16); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4080 |
udelay(20); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4081 |
ret_val = e1000_read_phy_reg(hw, PHY_ID2, &phy_id_low); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4082 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4083 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4084 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4085 |
hw->phy_id |= (u32) (phy_id_low & PHY_REVISION_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4086 |
hw->phy_revision = (u32) phy_id_low & ~PHY_REVISION_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4087 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4088 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4089 |
case e1000_82543: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4090 |
if (hw->phy_id == M88E1000_E_PHY_ID) match = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4091 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4092 |
case e1000_82544: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4093 |
if (hw->phy_id == M88E1000_I_PHY_ID) match = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4094 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4095 |
case e1000_82540: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4096 |
case e1000_82545: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4097 |
case e1000_82545_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4098 |
case e1000_82546: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4099 |
case e1000_82546_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4100 |
if (hw->phy_id == M88E1011_I_PHY_ID) match = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4101 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4102 |
case e1000_82541: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4103 |
case e1000_82541_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4104 |
case e1000_82547: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4105 |
case e1000_82547_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4106 |
if (hw->phy_id == IGP01E1000_I_PHY_ID) match = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4107 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4108 |
case e1000_82573: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4109 |
if (hw->phy_id == M88E1111_I_PHY_ID) match = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4110 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4111 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4112 |
if (hw->phy_id == GG82563_E_PHY_ID) match = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4113 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4114 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4115 |
if (hw->phy_id == IGP03E1000_E_PHY_ID) match = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4116 |
if (hw->phy_id == IFE_E_PHY_ID) match = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4117 |
if (hw->phy_id == IFE_PLUS_E_PHY_ID) match = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4118 |
if (hw->phy_id == IFE_C_E_PHY_ID) match = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4119 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4120 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4121 |
DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4122 |
return -E1000_ERR_CONFIG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4123 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4124 |
phy_init_status = e1000_set_phy_type(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4125 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4126 |
if ((match) && (phy_init_status == E1000_SUCCESS)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4127 |
DEBUGOUT1("PHY ID 0x%X detected\n", hw->phy_id); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4128 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4129 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4130 |
DEBUGOUT1("Invalid PHY ID 0x%X\n", hw->phy_id); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4131 |
return -E1000_ERR_PHY; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4132 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4133 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4134 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4135 |
* Resets the PHY's DSP |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4136 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4137 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4138 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4139 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4140 |
e1000_phy_reset_dsp(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4141 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4142 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4143 |
DEBUGFUNC("e1000_phy_reset_dsp"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4144 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4145 |
do { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4146 |
if (hw->phy_type != e1000_phy_gg82563) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4147 |
ret_val = e1000_write_phy_reg(hw, 29, 0x001d); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4148 |
if (ret_val) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4149 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4150 |
ret_val = e1000_write_phy_reg(hw, 30, 0x00c1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4151 |
if (ret_val) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4152 |
ret_val = e1000_write_phy_reg(hw, 30, 0x0000); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4153 |
if (ret_val) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4154 |
ret_val = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4155 |
} while (0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4156 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4157 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4158 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4159 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4160 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4161 |
* Get PHY information from various PHY registers for igp PHY only. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4162 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4163 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4164 |
* phy_info - PHY information structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4165 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4166 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4167 |
e1000_phy_igp_get_info(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4168 |
struct e1000_phy_info *phy_info) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4169 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4170 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4171 |
u16 phy_data, min_length, max_length, average; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4172 |
e1000_rev_polarity polarity; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4173 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4174 |
DEBUGFUNC("e1000_phy_igp_get_info"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4175 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4176 |
/* The downshift status is checked only once, after link is established, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4177 |
* and it stored in the hw->speed_downgraded parameter. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4178 |
phy_info->downshift = (e1000_downshift)hw->speed_downgraded; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4179 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4180 |
/* IGP01E1000 does not need to support it. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4181 |
phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_normal; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4182 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4183 |
/* IGP01E1000 always correct polarity reversal */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4184 |
phy_info->polarity_correction = e1000_polarity_reversal_enabled; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4185 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4186 |
/* Check polarity status */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4187 |
ret_val = e1000_check_polarity(hw, &polarity); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4188 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4189 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4190 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4191 |
phy_info->cable_polarity = polarity; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4192 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4193 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4194 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4195 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4196 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4197 |
phy_info->mdix_mode = (e1000_auto_x_mode)((phy_data & IGP01E1000_PSSR_MDIX) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4198 |
IGP01E1000_PSSR_MDIX_SHIFT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4199 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4200 |
if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) == |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4201 |
IGP01E1000_PSSR_SPEED_1000MBPS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4202 |
/* Local/Remote Receiver Information are only valid at 1000 Mbps */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4203 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4204 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4205 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4206 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4207 |
phy_info->local_rx = ((phy_data & SR_1000T_LOCAL_RX_STATUS) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4208 |
SR_1000T_LOCAL_RX_STATUS_SHIFT) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4209 |
e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4210 |
phy_info->remote_rx = ((phy_data & SR_1000T_REMOTE_RX_STATUS) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4211 |
SR_1000T_REMOTE_RX_STATUS_SHIFT) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4212 |
e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4213 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4214 |
/* Get cable length */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4215 |
ret_val = e1000_get_cable_length(hw, &min_length, &max_length); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4216 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4217 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4218 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4219 |
/* Translate to old method */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4220 |
average = (max_length + min_length) / 2; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4221 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4222 |
if (average <= e1000_igp_cable_length_50) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4223 |
phy_info->cable_length = e1000_cable_length_50; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4224 |
else if (average <= e1000_igp_cable_length_80) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4225 |
phy_info->cable_length = e1000_cable_length_50_80; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4226 |
else if (average <= e1000_igp_cable_length_110) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4227 |
phy_info->cable_length = e1000_cable_length_80_110; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4228 |
else if (average <= e1000_igp_cable_length_140) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4229 |
phy_info->cable_length = e1000_cable_length_110_140; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4230 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4231 |
phy_info->cable_length = e1000_cable_length_140; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4232 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4233 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4234 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4235 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4236 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4237 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4238 |
* Get PHY information from various PHY registers for ife PHY only. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4239 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4240 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4241 |
* phy_info - PHY information structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4242 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4243 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4244 |
e1000_phy_ife_get_info(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4245 |
struct e1000_phy_info *phy_info) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4246 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4247 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4248 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4249 |
e1000_rev_polarity polarity; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4250 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4251 |
DEBUGFUNC("e1000_phy_ife_get_info"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4252 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4253 |
phy_info->downshift = (e1000_downshift)hw->speed_downgraded; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4254 |
phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_normal; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4255 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4256 |
ret_val = e1000_read_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4257 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4258 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4259 |
phy_info->polarity_correction = |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4260 |
((phy_data & IFE_PSC_AUTO_POLARITY_DISABLE) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4261 |
IFE_PSC_AUTO_POLARITY_DISABLE_SHIFT) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4262 |
e1000_polarity_reversal_disabled : e1000_polarity_reversal_enabled; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4263 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4264 |
if (phy_info->polarity_correction == e1000_polarity_reversal_enabled) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4265 |
ret_val = e1000_check_polarity(hw, &polarity); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4266 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4267 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4268 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4269 |
/* Polarity is forced. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4270 |
polarity = ((phy_data & IFE_PSC_FORCE_POLARITY) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4271 |
IFE_PSC_FORCE_POLARITY_SHIFT) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4272 |
e1000_rev_polarity_reversed : e1000_rev_polarity_normal; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4273 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4274 |
phy_info->cable_polarity = polarity; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4275 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4276 |
ret_val = e1000_read_phy_reg(hw, IFE_PHY_MDIX_CONTROL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4277 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4278 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4279 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4280 |
phy_info->mdix_mode = (e1000_auto_x_mode) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4281 |
((phy_data & (IFE_PMC_AUTO_MDIX | IFE_PMC_FORCE_MDIX)) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4282 |
IFE_PMC_MDIX_MODE_SHIFT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4283 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4284 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4285 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4286 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4287 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4288 |
* Get PHY information from various PHY registers fot m88 PHY only. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4289 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4290 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4291 |
* phy_info - PHY information structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4292 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4293 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4294 |
e1000_phy_m88_get_info(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4295 |
struct e1000_phy_info *phy_info) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4296 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4297 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4298 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4299 |
e1000_rev_polarity polarity; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4300 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4301 |
DEBUGFUNC("e1000_phy_m88_get_info"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4302 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4303 |
/* The downshift status is checked only once, after link is established, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4304 |
* and it stored in the hw->speed_downgraded parameter. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4305 |
phy_info->downshift = (e1000_downshift)hw->speed_downgraded; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4306 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4307 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4308 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4309 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4310 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4311 |
phy_info->extended_10bt_distance = |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4312 |
((phy_data & M88E1000_PSCR_10BT_EXT_DIST_ENABLE) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4313 |
M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4314 |
e1000_10bt_ext_dist_enable_lower : e1000_10bt_ext_dist_enable_normal; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4315 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4316 |
phy_info->polarity_correction = |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4317 |
((phy_data & M88E1000_PSCR_POLARITY_REVERSAL) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4318 |
M88E1000_PSCR_POLARITY_REVERSAL_SHIFT) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4319 |
e1000_polarity_reversal_disabled : e1000_polarity_reversal_enabled; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4320 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4321 |
/* Check polarity status */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4322 |
ret_val = e1000_check_polarity(hw, &polarity); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4323 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4324 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4325 |
phy_info->cable_polarity = polarity; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4326 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4327 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4328 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4329 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4330 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4331 |
phy_info->mdix_mode = (e1000_auto_x_mode)((phy_data & M88E1000_PSSR_MDIX) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4332 |
M88E1000_PSSR_MDIX_SHIFT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4333 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4334 |
if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4335 |
/* Cable Length Estimation and Local/Remote Receiver Information |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4336 |
* are only valid at 1000 Mbps. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4337 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4338 |
if (hw->phy_type != e1000_phy_gg82563) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4339 |
phy_info->cable_length = (e1000_cable_length)((phy_data & M88E1000_PSSR_CABLE_LENGTH) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4340 |
M88E1000_PSSR_CABLE_LENGTH_SHIFT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4341 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4342 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_DSP_DISTANCE, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4343 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4344 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4345 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4346 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4347 |
phy_info->cable_length = (e1000_cable_length)(phy_data & GG82563_DSPD_CABLE_LENGTH); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4348 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4349 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4350 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4351 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4352 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4353 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4354 |
phy_info->local_rx = ((phy_data & SR_1000T_LOCAL_RX_STATUS) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4355 |
SR_1000T_LOCAL_RX_STATUS_SHIFT) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4356 |
e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4357 |
phy_info->remote_rx = ((phy_data & SR_1000T_REMOTE_RX_STATUS) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4358 |
SR_1000T_REMOTE_RX_STATUS_SHIFT) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4359 |
e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4360 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4361 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4362 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4363 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4364 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4365 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4366 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4367 |
* Get PHY information from various PHY registers |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4368 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4369 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4370 |
* phy_info - PHY information structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4371 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4372 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4373 |
e1000_phy_get_info(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4374 |
struct e1000_phy_info *phy_info) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4375 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4376 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4377 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4378 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4379 |
DEBUGFUNC("e1000_phy_get_info"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4380 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4381 |
phy_info->cable_length = e1000_cable_length_undefined; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4382 |
phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_undefined; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4383 |
phy_info->cable_polarity = e1000_rev_polarity_undefined; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4384 |
phy_info->downshift = e1000_downshift_undefined; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4385 |
phy_info->polarity_correction = e1000_polarity_reversal_undefined; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4386 |
phy_info->mdix_mode = e1000_auto_x_mode_undefined; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4387 |
phy_info->local_rx = e1000_1000t_rx_status_undefined; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4388 |
phy_info->remote_rx = e1000_1000t_rx_status_undefined; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4389 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4390 |
if (hw->media_type != e1000_media_type_copper) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4391 |
DEBUGOUT("PHY info is only valid for copper media\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4392 |
return -E1000_ERR_CONFIG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4393 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4394 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4395 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4396 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4397 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4398 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4399 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4400 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4401 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4402 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4403 |
if ((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4404 |
DEBUGOUT("PHY info is only valid if link is up\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4405 |
return -E1000_ERR_CONFIG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4406 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4407 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4408 |
if (hw->phy_type == e1000_phy_igp || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4409 |
hw->phy_type == e1000_phy_igp_3 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4410 |
hw->phy_type == e1000_phy_igp_2) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4411 |
return e1000_phy_igp_get_info(hw, phy_info); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4412 |
else if (hw->phy_type == e1000_phy_ife) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4413 |
return e1000_phy_ife_get_info(hw, phy_info); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4414 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4415 |
return e1000_phy_m88_get_info(hw, phy_info); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4416 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4417 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4418 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4419 |
e1000_validate_mdi_setting(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4420 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4421 |
DEBUGFUNC("e1000_validate_mdi_settings"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4422 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4423 |
if (!hw->autoneg && (hw->mdix == 0 || hw->mdix == 3)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4424 |
DEBUGOUT("Invalid MDI setting detected\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4425 |
hw->mdix = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4426 |
return -E1000_ERR_CONFIG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4427 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4428 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4429 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4430 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4431 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4432 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4433 |
* Sets up eeprom variables in the hw struct. Must be called after mac_type |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4434 |
* is configured. Additionally, if this is ICH8, the flash controller GbE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4435 |
* registers must be mapped, or this will crash. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4436 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4437 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4438 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4439 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4440 |
e1000_init_eeprom_params(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4441 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4442 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4443 |
u32 eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4444 |
s32 ret_val = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4445 |
u16 eeprom_size; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4446 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4447 |
DEBUGFUNC("e1000_init_eeprom_params"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4448 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4449 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4450 |
case e1000_82542_rev2_0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4451 |
case e1000_82542_rev2_1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4452 |
case e1000_82543: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4453 |
case e1000_82544: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4454 |
eeprom->type = e1000_eeprom_microwire; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4455 |
eeprom->word_size = 64; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4456 |
eeprom->opcode_bits = 3; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4457 |
eeprom->address_bits = 6; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4458 |
eeprom->delay_usec = 50; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4459 |
eeprom->use_eerd = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4460 |
eeprom->use_eewr = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4461 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4462 |
case e1000_82540: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4463 |
case e1000_82545: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4464 |
case e1000_82545_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4465 |
case e1000_82546: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4466 |
case e1000_82546_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4467 |
eeprom->type = e1000_eeprom_microwire; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4468 |
eeprom->opcode_bits = 3; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4469 |
eeprom->delay_usec = 50; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4470 |
if (eecd & E1000_EECD_SIZE) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4471 |
eeprom->word_size = 256; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4472 |
eeprom->address_bits = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4473 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4474 |
eeprom->word_size = 64; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4475 |
eeprom->address_bits = 6; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4476 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4477 |
eeprom->use_eerd = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4478 |
eeprom->use_eewr = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4479 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4480 |
case e1000_82541: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4481 |
case e1000_82541_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4482 |
case e1000_82547: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4483 |
case e1000_82547_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4484 |
if (eecd & E1000_EECD_TYPE) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4485 |
eeprom->type = e1000_eeprom_spi; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4486 |
eeprom->opcode_bits = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4487 |
eeprom->delay_usec = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4488 |
if (eecd & E1000_EECD_ADDR_BITS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4489 |
eeprom->page_size = 32; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4490 |
eeprom->address_bits = 16; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4491 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4492 |
eeprom->page_size = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4493 |
eeprom->address_bits = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4494 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4495 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4496 |
eeprom->type = e1000_eeprom_microwire; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4497 |
eeprom->opcode_bits = 3; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4498 |
eeprom->delay_usec = 50; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4499 |
if (eecd & E1000_EECD_ADDR_BITS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4500 |
eeprom->word_size = 256; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4501 |
eeprom->address_bits = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4502 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4503 |
eeprom->word_size = 64; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4504 |
eeprom->address_bits = 6; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4505 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4506 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4507 |
eeprom->use_eerd = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4508 |
eeprom->use_eewr = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4509 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4510 |
case e1000_82571: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4511 |
case e1000_82572: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4512 |
eeprom->type = e1000_eeprom_spi; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4513 |
eeprom->opcode_bits = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4514 |
eeprom->delay_usec = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4515 |
if (eecd & E1000_EECD_ADDR_BITS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4516 |
eeprom->page_size = 32; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4517 |
eeprom->address_bits = 16; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4518 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4519 |
eeprom->page_size = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4520 |
eeprom->address_bits = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4521 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4522 |
eeprom->use_eerd = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4523 |
eeprom->use_eewr = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4524 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4525 |
case e1000_82573: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4526 |
eeprom->type = e1000_eeprom_spi; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4527 |
eeprom->opcode_bits = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4528 |
eeprom->delay_usec = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4529 |
if (eecd & E1000_EECD_ADDR_BITS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4530 |
eeprom->page_size = 32; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4531 |
eeprom->address_bits = 16; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4532 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4533 |
eeprom->page_size = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4534 |
eeprom->address_bits = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4535 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4536 |
eeprom->use_eerd = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4537 |
eeprom->use_eewr = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4538 |
if (!e1000_is_onboard_nvm_eeprom(hw)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4539 |
eeprom->type = e1000_eeprom_flash; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4540 |
eeprom->word_size = 2048; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4541 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4542 |
/* Ensure that the Autonomous FLASH update bit is cleared due to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4543 |
* Flash update issue on parts which use a FLASH for NVM. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4544 |
eecd &= ~E1000_EECD_AUPDEN; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4545 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4546 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4547 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4548 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4549 |
eeprom->type = e1000_eeprom_spi; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4550 |
eeprom->opcode_bits = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4551 |
eeprom->delay_usec = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4552 |
if (eecd & E1000_EECD_ADDR_BITS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4553 |
eeprom->page_size = 32; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4554 |
eeprom->address_bits = 16; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4555 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4556 |
eeprom->page_size = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4557 |
eeprom->address_bits = 8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4558 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4559 |
eeprom->use_eerd = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4560 |
eeprom->use_eewr = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4561 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4562 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4563 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4564 |
s32 i = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4565 |
u32 flash_size = E1000_READ_ICH_FLASH_REG(hw, ICH_FLASH_GFPREG); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4566 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4567 |
eeprom->type = e1000_eeprom_ich8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4568 |
eeprom->use_eerd = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4569 |
eeprom->use_eewr = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4570 |
eeprom->word_size = E1000_SHADOW_RAM_WORDS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4571 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4572 |
/* Zero the shadow RAM structure. But don't load it from NVM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4573 |
* so as to save time for driver init */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4574 |
if (hw->eeprom_shadow_ram != NULL) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4575 |
for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4576 |
hw->eeprom_shadow_ram[i].modified = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4577 |
hw->eeprom_shadow_ram[i].eeprom_word = 0xFFFF; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4578 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4579 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4580 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4581 |
hw->flash_base_addr = (flash_size & ICH_GFPREG_BASE_MASK) * |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4582 |
ICH_FLASH_SECTOR_SIZE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4583 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4584 |
hw->flash_bank_size = ((flash_size >> 16) & ICH_GFPREG_BASE_MASK) + 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4585 |
hw->flash_bank_size -= (flash_size & ICH_GFPREG_BASE_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4586 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4587 |
hw->flash_bank_size *= ICH_FLASH_SECTOR_SIZE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4588 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4589 |
hw->flash_bank_size /= 2 * sizeof(u16); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4590 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4591 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4592 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4593 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4594 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4595 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4596 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4597 |
if (eeprom->type == e1000_eeprom_spi) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4598 |
/* eeprom_size will be an enum [0..8] that maps to eeprom sizes 128B to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4599 |
* 32KB (incremented by powers of 2). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4600 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4601 |
if (hw->mac_type <= e1000_82547_rev_2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4602 |
/* Set to default value for initial eeprom read. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4603 |
eeprom->word_size = 64; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4604 |
ret_val = e1000_read_eeprom(hw, EEPROM_CFG, 1, &eeprom_size); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4605 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4606 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4607 |
eeprom_size = (eeprom_size & EEPROM_SIZE_MASK) >> EEPROM_SIZE_SHIFT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4608 |
/* 256B eeprom size was not supported in earlier hardware, so we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4609 |
* bump eeprom_size up one to ensure that "1" (which maps to 256B) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4610 |
* is never the result used in the shifting logic below. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4611 |
if (eeprom_size) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4612 |
eeprom_size++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4613 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4614 |
eeprom_size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4615 |
E1000_EECD_SIZE_EX_SHIFT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4616 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4617 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4618 |
eeprom->word_size = 1 << (eeprom_size + EEPROM_WORD_SIZE_SHIFT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4619 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4620 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4621 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4622 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4623 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4624 |
* Raises the EEPROM's clock input. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4625 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4626 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4627 |
* eecd - EECD's current value |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4628 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4629 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4630 |
e1000_raise_ee_clk(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4631 |
u32 *eecd) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4632 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4633 |
/* Raise the clock input to the EEPROM (by setting the SK bit), and then |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4634 |
* wait <delay> microseconds. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4635 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4636 |
*eecd = *eecd | E1000_EECD_SK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4637 |
E1000_WRITE_REG(hw, EECD, *eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4638 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4639 |
udelay(hw->eeprom.delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4640 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4641 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4642 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4643 |
* Lowers the EEPROM's clock input. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4644 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4645 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4646 |
* eecd - EECD's current value |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4647 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4648 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4649 |
e1000_lower_ee_clk(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4650 |
u32 *eecd) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4651 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4652 |
/* Lower the clock input to the EEPROM (by clearing the SK bit), and then |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4653 |
* wait 50 microseconds. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4654 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4655 |
*eecd = *eecd & ~E1000_EECD_SK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4656 |
E1000_WRITE_REG(hw, EECD, *eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4657 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4658 |
udelay(hw->eeprom.delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4659 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4660 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4661 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4662 |
* Shift data bits out to the EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4663 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4664 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4665 |
* data - data to send to the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4666 |
* count - number of bits to shift out |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4667 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4668 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4669 |
e1000_shift_out_ee_bits(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4670 |
u16 data, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4671 |
u16 count) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4672 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4673 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4674 |
u32 eecd; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4675 |
u32 mask; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4676 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4677 |
/* We need to shift "count" bits out to the EEPROM. So, value in the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4678 |
* "data" parameter will be shifted out to the EEPROM one bit at a time. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4679 |
* In order to do this, "data" must be broken down into bits. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4680 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4681 |
mask = 0x01 << (count - 1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4682 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4683 |
if (eeprom->type == e1000_eeprom_microwire) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4684 |
eecd &= ~E1000_EECD_DO; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4685 |
} else if (eeprom->type == e1000_eeprom_spi) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4686 |
eecd |= E1000_EECD_DO; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4687 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4688 |
do { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4689 |
/* A "1" is shifted out to the EEPROM by setting bit "DI" to a "1", |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4690 |
* and then raising and then lowering the clock (the SK bit controls |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4691 |
* the clock input to the EEPROM). A "0" is shifted out to the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4692 |
* by setting "DI" to "0" and then raising and then lowering the clock. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4693 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4694 |
eecd &= ~E1000_EECD_DI; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4695 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4696 |
if (data & mask) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4697 |
eecd |= E1000_EECD_DI; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4698 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4699 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4700 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4701 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4702 |
udelay(eeprom->delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4703 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4704 |
e1000_raise_ee_clk(hw, &eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4705 |
e1000_lower_ee_clk(hw, &eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4706 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4707 |
mask = mask >> 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4708 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4709 |
} while (mask); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4710 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4711 |
/* We leave the "DI" bit set to "0" when we leave this routine. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4712 |
eecd &= ~E1000_EECD_DI; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4713 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4714 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4715 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4716 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4717 |
* Shift data bits in from the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4718 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4719 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4720 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4721 |
static u16 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4722 |
e1000_shift_in_ee_bits(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4723 |
u16 count) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4724 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4725 |
u32 eecd; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4726 |
u32 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4727 |
u16 data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4728 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4729 |
/* In order to read a register from the EEPROM, we need to shift 'count' |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4730 |
* bits in from the EEPROM. Bits are "shifted in" by raising the clock |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4731 |
* input to the EEPROM (setting the SK bit), and then reading the value of |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4732 |
* the "DO" bit. During this "shifting in" process the "DI" bit should |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4733 |
* always be clear. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4734 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4735 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4736 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4737 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4738 |
eecd &= ~(E1000_EECD_DO | E1000_EECD_DI); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4739 |
data = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4740 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4741 |
for (i = 0; i < count; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4742 |
data = data << 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4743 |
e1000_raise_ee_clk(hw, &eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4744 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4745 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4746 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4747 |
eecd &= ~(E1000_EECD_DI); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4748 |
if (eecd & E1000_EECD_DO) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4749 |
data |= 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4750 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4751 |
e1000_lower_ee_clk(hw, &eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4752 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4753 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4754 |
return data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4755 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4756 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4757 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4758 |
* Prepares EEPROM for access |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4759 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4760 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4761 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4762 |
* Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4763 |
* function should be called before issuing a command to the EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4764 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4765 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4766 |
e1000_acquire_eeprom(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4767 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4768 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4769 |
u32 eecd, i=0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4770 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4771 |
DEBUGFUNC("e1000_acquire_eeprom"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4772 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4773 |
if (e1000_swfw_sync_acquire(hw, E1000_SWFW_EEP_SM)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4774 |
return -E1000_ERR_SWFW_SYNC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4775 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4776 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4777 |
if (hw->mac_type != e1000_82573) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4778 |
/* Request EEPROM Access */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4779 |
if (hw->mac_type > e1000_82544) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4780 |
eecd |= E1000_EECD_REQ; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4781 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4782 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4783 |
while ((!(eecd & E1000_EECD_GNT)) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4784 |
(i < E1000_EEPROM_GRANT_ATTEMPTS)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4785 |
i++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4786 |
udelay(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4787 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4788 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4789 |
if (!(eecd & E1000_EECD_GNT)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4790 |
eecd &= ~E1000_EECD_REQ; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4791 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4792 |
DEBUGOUT("Could not acquire EEPROM grant\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4793 |
e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4794 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4795 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4796 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4797 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4798 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4799 |
/* Setup EEPROM for Read/Write */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4800 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4801 |
if (eeprom->type == e1000_eeprom_microwire) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4802 |
/* Clear SK and DI */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4803 |
eecd &= ~(E1000_EECD_DI | E1000_EECD_SK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4804 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4805 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4806 |
/* Set CS */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4807 |
eecd |= E1000_EECD_CS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4808 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4809 |
} else if (eeprom->type == e1000_eeprom_spi) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4810 |
/* Clear SK and CS */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4811 |
eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4812 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4813 |
udelay(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4814 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4815 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4816 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4817 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4818 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4819 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4820 |
* Returns EEPROM to a "standby" state |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4821 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4822 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4823 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4824 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4825 |
e1000_standby_eeprom(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4826 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4827 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4828 |
u32 eecd; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4829 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4830 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4831 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4832 |
if (eeprom->type == e1000_eeprom_microwire) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4833 |
eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4834 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4835 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4836 |
udelay(eeprom->delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4837 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4838 |
/* Clock high */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4839 |
eecd |= E1000_EECD_SK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4840 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4841 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4842 |
udelay(eeprom->delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4843 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4844 |
/* Select EEPROM */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4845 |
eecd |= E1000_EECD_CS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4846 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4847 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4848 |
udelay(eeprom->delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4849 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4850 |
/* Clock low */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4851 |
eecd &= ~E1000_EECD_SK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4852 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4853 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4854 |
udelay(eeprom->delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4855 |
} else if (eeprom->type == e1000_eeprom_spi) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4856 |
/* Toggle CS to flush commands */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4857 |
eecd |= E1000_EECD_CS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4858 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4859 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4860 |
udelay(eeprom->delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4861 |
eecd &= ~E1000_EECD_CS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4862 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4863 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4864 |
udelay(eeprom->delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4865 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4866 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4867 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4868 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4869 |
* Terminates a command by inverting the EEPROM's chip select pin |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4870 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4871 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4872 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4873 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4874 |
e1000_release_eeprom(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4875 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4876 |
u32 eecd; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4877 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4878 |
DEBUGFUNC("e1000_release_eeprom"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4879 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4880 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4881 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4882 |
if (hw->eeprom.type == e1000_eeprom_spi) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4883 |
eecd |= E1000_EECD_CS; /* Pull CS high */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4884 |
eecd &= ~E1000_EECD_SK; /* Lower SCK */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4885 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4886 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4887 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4888 |
udelay(hw->eeprom.delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4889 |
} else if (hw->eeprom.type == e1000_eeprom_microwire) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4890 |
/* cleanup eeprom */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4891 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4892 |
/* CS on Microwire is active-high */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4893 |
eecd &= ~(E1000_EECD_CS | E1000_EECD_DI); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4894 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4895 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4896 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4897 |
/* Rising edge of clock */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4898 |
eecd |= E1000_EECD_SK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4899 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4900 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4901 |
udelay(hw->eeprom.delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4902 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4903 |
/* Falling edge of clock */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4904 |
eecd &= ~E1000_EECD_SK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4905 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4906 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4907 |
udelay(hw->eeprom.delay_usec); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4908 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4909 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4910 |
/* Stop requesting EEPROM access */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4911 |
if (hw->mac_type > e1000_82544) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4912 |
eecd &= ~E1000_EECD_REQ; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4913 |
E1000_WRITE_REG(hw, EECD, eecd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4914 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4915 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4916 |
e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4917 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4918 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4919 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4920 |
* Reads a 16 bit word from the EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4921 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4922 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4923 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4924 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4925 |
e1000_spi_eeprom_ready(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4926 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4927 |
u16 retry_count = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4928 |
u8 spi_stat_reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4929 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4930 |
DEBUGFUNC("e1000_spi_eeprom_ready"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4931 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4932 |
/* Read "Status Register" repeatedly until the LSB is cleared. The |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4933 |
* EEPROM will signal that the command has been completed by clearing |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4934 |
* bit 0 of the internal status register. If it's not cleared within |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4935 |
* 5 milliseconds, then error out. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4936 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4937 |
retry_count = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4938 |
do { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4939 |
e1000_shift_out_ee_bits(hw, EEPROM_RDSR_OPCODE_SPI, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4940 |
hw->eeprom.opcode_bits); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4941 |
spi_stat_reg = (u8)e1000_shift_in_ee_bits(hw, 8); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4942 |
if (!(spi_stat_reg & EEPROM_STATUS_RDY_SPI)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4943 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4944 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4945 |
udelay(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4946 |
retry_count += 5; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4947 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4948 |
e1000_standby_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4949 |
} while (retry_count < EEPROM_MAX_RETRY_SPI); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4950 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4951 |
/* ATMEL SPI write time could vary from 0-20mSec on 3.3V devices (and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4952 |
* only 0-5mSec on 5V devices) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4953 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4954 |
if (retry_count >= EEPROM_MAX_RETRY_SPI) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4955 |
DEBUGOUT("SPI EEPROM Status error\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4956 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4957 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4958 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4959 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4960 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4961 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4962 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4963 |
* Reads a 16 bit word from the EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4964 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4965 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4966 |
* offset - offset of word in the EEPROM to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4967 |
* data - word read from the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4968 |
* words - number of words to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4969 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4970 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4971 |
e1000_read_eeprom(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4972 |
u16 offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4973 |
u16 words, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4974 |
u16 *data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4975 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4976 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4977 |
u32 i = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4978 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4979 |
DEBUGFUNC("e1000_read_eeprom"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4980 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4981 |
/* If eeprom is not yet detected, do so now */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4982 |
if (eeprom->word_size == 0) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4983 |
e1000_init_eeprom_params(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4984 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4985 |
/* A check for invalid values: offset too large, too many words, and not |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4986 |
* enough words. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4987 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4988 |
if ((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4989 |
(words == 0)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4990 |
DEBUGOUT2("\"words\" parameter out of bounds. Words = %d, size = %d\n", offset, eeprom->word_size); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4991 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4992 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4993 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4994 |
/* EEPROM's that don't use EERD to read require us to bit-bang the SPI |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4995 |
* directly. In this case, we need to acquire the EEPROM so that |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4996 |
* FW or other port software does not interrupt. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4997 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4998 |
if (e1000_is_onboard_nvm_eeprom(hw) && !hw->eeprom.use_eerd) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4999 |
/* Prepare the EEPROM for bit-bang reading */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5000 |
if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5001 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5002 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5003 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5004 |
/* Eerd register EEPROM access requires no eeprom aquire/release */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5005 |
if (eeprom->use_eerd) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5006 |
return e1000_read_eeprom_eerd(hw, offset, words, data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5007 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5008 |
/* ICH EEPROM access is done via the ICH flash controller */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5009 |
if (eeprom->type == e1000_eeprom_ich8) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5010 |
return e1000_read_eeprom_ich8(hw, offset, words, data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5011 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5012 |
/* Set up the SPI or Microwire EEPROM for bit-bang reading. We have |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5013 |
* acquired the EEPROM at this point, so any returns should relase it */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5014 |
if (eeprom->type == e1000_eeprom_spi) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5015 |
u16 word_in; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5016 |
u8 read_opcode = EEPROM_READ_OPCODE_SPI; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5017 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5018 |
if (e1000_spi_eeprom_ready(hw)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5019 |
e1000_release_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5020 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5021 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5022 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5023 |
e1000_standby_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5024 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5025 |
/* Some SPI eeproms use the 8th address bit embedded in the opcode */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5026 |
if ((eeprom->address_bits == 8) && (offset >= 128)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5027 |
read_opcode |= EEPROM_A8_OPCODE_SPI; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5028 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5029 |
/* Send the READ command (opcode + addr) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5030 |
e1000_shift_out_ee_bits(hw, read_opcode, eeprom->opcode_bits); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5031 |
e1000_shift_out_ee_bits(hw, (u16)(offset*2), eeprom->address_bits); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5032 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5033 |
/* Read the data. The address of the eeprom internally increments with |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5034 |
* each byte (spi) being read, saving on the overhead of eeprom setup |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5035 |
* and tear-down. The address counter will roll over if reading beyond |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5036 |
* the size of the eeprom, thus allowing the entire memory to be read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5037 |
* starting from any offset. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5038 |
for (i = 0; i < words; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5039 |
word_in = e1000_shift_in_ee_bits(hw, 16); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5040 |
data[i] = (word_in >> 8) | (word_in << 8); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5041 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5042 |
} else if (eeprom->type == e1000_eeprom_microwire) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5043 |
for (i = 0; i < words; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5044 |
/* Send the READ command (opcode + addr) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5045 |
e1000_shift_out_ee_bits(hw, EEPROM_READ_OPCODE_MICROWIRE, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5046 |
eeprom->opcode_bits); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5047 |
e1000_shift_out_ee_bits(hw, (u16)(offset + i), |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5048 |
eeprom->address_bits); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5049 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5050 |
/* Read the data. For microwire, each word requires the overhead |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5051 |
* of eeprom setup and tear-down. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5052 |
data[i] = e1000_shift_in_ee_bits(hw, 16); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5053 |
e1000_standby_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5054 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5055 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5056 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5057 |
/* End this read operation */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5058 |
e1000_release_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5059 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5060 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5061 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5062 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5063 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5064 |
* Reads a 16 bit word from the EEPROM using the EERD register. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5065 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5066 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5067 |
* offset - offset of word in the EEPROM to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5068 |
* data - word read from the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5069 |
* words - number of words to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5070 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5071 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5072 |
e1000_read_eeprom_eerd(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5073 |
u16 offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5074 |
u16 words, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5075 |
u16 *data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5076 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5077 |
u32 i, eerd = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5078 |
s32 error = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5079 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5080 |
for (i = 0; i < words; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5081 |
eerd = ((offset+i) << E1000_EEPROM_RW_ADDR_SHIFT) + |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5082 |
E1000_EEPROM_RW_REG_START; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5083 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5084 |
E1000_WRITE_REG(hw, EERD, eerd); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5085 |
error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_READ); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5086 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5087 |
if (error) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5088 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5089 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5090 |
data[i] = (E1000_READ_REG(hw, EERD) >> E1000_EEPROM_RW_REG_DATA); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5091 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5092 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5093 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5094 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5095 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5096 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5097 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5098 |
* Writes a 16 bit word from the EEPROM using the EEWR register. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5099 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5100 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5101 |
* offset - offset of word in the EEPROM to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5102 |
* data - word read from the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5103 |
* words - number of words to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5104 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5105 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5106 |
e1000_write_eeprom_eewr(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5107 |
u16 offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5108 |
u16 words, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5109 |
u16 *data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5110 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5111 |
u32 register_value = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5112 |
u32 i = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5113 |
s32 error = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5114 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5115 |
if (e1000_swfw_sync_acquire(hw, E1000_SWFW_EEP_SM)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5116 |
return -E1000_ERR_SWFW_SYNC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5117 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5118 |
for (i = 0; i < words; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5119 |
register_value = (data[i] << E1000_EEPROM_RW_REG_DATA) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5120 |
((offset+i) << E1000_EEPROM_RW_ADDR_SHIFT) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5121 |
E1000_EEPROM_RW_REG_START; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5122 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5123 |
error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5124 |
if (error) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5125 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5126 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5127 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5128 |
E1000_WRITE_REG(hw, EEWR, register_value); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5129 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5130 |
error = e1000_poll_eerd_eewr_done(hw, E1000_EEPROM_POLL_WRITE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5131 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5132 |
if (error) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5133 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5134 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5135 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5136 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5137 |
e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5138 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5139 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5140 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5141 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5142 |
* Polls the status bit (bit 1) of the EERD to determine when the read is done. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5143 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5144 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5145 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5146 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5147 |
e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5148 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5149 |
u32 attempts = 100000; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5150 |
u32 i, reg = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5151 |
s32 done = E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5152 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5153 |
for (i = 0; i < attempts; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5154 |
if (eerd == E1000_EEPROM_POLL_READ) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5155 |
reg = E1000_READ_REG(hw, EERD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5156 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5157 |
reg = E1000_READ_REG(hw, EEWR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5158 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5159 |
if (reg & E1000_EEPROM_RW_REG_DONE) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5160 |
done = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5161 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5162 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5163 |
udelay(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5164 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5165 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5166 |
return done; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5167 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5168 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5169 |
/*************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5170 |
* Description: Determines if the onboard NVM is FLASH or EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5171 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5172 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5173 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5174 |
static bool |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5175 |
e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5176 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5177 |
u32 eecd = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5178 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5179 |
DEBUGFUNC("e1000_is_onboard_nvm_eeprom"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5180 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5181 |
if (hw->mac_type == e1000_ich8lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5182 |
return false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5183 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5184 |
if (hw->mac_type == e1000_82573) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5185 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5186 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5187 |
/* Isolate bits 15 & 16 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5188 |
eecd = ((eecd >> 15) & 0x03); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5189 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5190 |
/* If both bits are set, device is Flash type */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5191 |
if (eecd == 0x03) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5192 |
return false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5193 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5194 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5195 |
return true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5196 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5197 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5198 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5199 |
* Verifies that the EEPROM has a valid checksum |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5200 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5201 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5202 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5203 |
* Reads the first 64 16 bit words of the EEPROM and sums the values read. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5204 |
* If the the sum of the 64 16 bit words is 0xBABA, the EEPROM's checksum is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5205 |
* valid. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5206 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5207 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5208 |
e1000_validate_eeprom_checksum(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5209 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5210 |
u16 checksum = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5211 |
u16 i, eeprom_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5212 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5213 |
DEBUGFUNC("e1000_validate_eeprom_checksum"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5214 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5215 |
if ((hw->mac_type == e1000_82573) && !e1000_is_onboard_nvm_eeprom(hw)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5216 |
/* Check bit 4 of word 10h. If it is 0, firmware is done updating |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5217 |
* 10h-12h. Checksum may need to be fixed. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5218 |
e1000_read_eeprom(hw, 0x10, 1, &eeprom_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5219 |
if ((eeprom_data & 0x10) == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5220 |
/* Read 0x23 and check bit 15. This bit is a 1 when the checksum |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5221 |
* has already been fixed. If the checksum is still wrong and this |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5222 |
* bit is a 1, we need to return bad checksum. Otherwise, we need |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5223 |
* to set this bit to a 1 and update the checksum. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5224 |
e1000_read_eeprom(hw, 0x23, 1, &eeprom_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5225 |
if ((eeprom_data & 0x8000) == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5226 |
eeprom_data |= 0x8000; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5227 |
e1000_write_eeprom(hw, 0x23, 1, &eeprom_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5228 |
e1000_update_eeprom_checksum(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5229 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5230 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5231 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5232 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5233 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5234 |
/* Drivers must allocate the shadow ram structure for the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5235 |
* EEPROM checksum to be updated. Otherwise, this bit as well |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5236 |
* as the checksum must both be set correctly for this |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5237 |
* validation to pass. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5238 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5239 |
e1000_read_eeprom(hw, 0x19, 1, &eeprom_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5240 |
if ((eeprom_data & 0x40) == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5241 |
eeprom_data |= 0x40; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5242 |
e1000_write_eeprom(hw, 0x19, 1, &eeprom_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5243 |
e1000_update_eeprom_checksum(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5244 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5245 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5246 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5247 |
for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5248 |
if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5249 |
DEBUGOUT("EEPROM Read Error\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5250 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5251 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5252 |
checksum += eeprom_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5253 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5254 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5255 |
if (checksum == (u16) EEPROM_SUM) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5256 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5257 |
else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5258 |
DEBUGOUT("EEPROM Checksum Invalid\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5259 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5260 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5261 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5262 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5263 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5264 |
* Calculates the EEPROM checksum and writes it to the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5265 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5266 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5267 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5268 |
* Sums the first 63 16 bit words of the EEPROM. Subtracts the sum from 0xBABA. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5269 |
* Writes the difference to word offset 63 of the EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5270 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5271 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5272 |
e1000_update_eeprom_checksum(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5273 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5274 |
u32 ctrl_ext; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5275 |
u16 checksum = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5276 |
u16 i, eeprom_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5277 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5278 |
DEBUGFUNC("e1000_update_eeprom_checksum"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5279 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5280 |
for (i = 0; i < EEPROM_CHECKSUM_REG; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5281 |
if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5282 |
DEBUGOUT("EEPROM Read Error\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5283 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5284 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5285 |
checksum += eeprom_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5286 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5287 |
checksum = (u16) EEPROM_SUM - checksum; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5288 |
if (e1000_write_eeprom(hw, EEPROM_CHECKSUM_REG, 1, &checksum) < 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5289 |
DEBUGOUT("EEPROM Write Error\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5290 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5291 |
} else if (hw->eeprom.type == e1000_eeprom_flash) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5292 |
e1000_commit_shadow_ram(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5293 |
} else if (hw->eeprom.type == e1000_eeprom_ich8) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5294 |
e1000_commit_shadow_ram(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5295 |
/* Reload the EEPROM, or else modifications will not appear |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5296 |
* until after next adapter reset. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5297 |
ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5298 |
ctrl_ext |= E1000_CTRL_EXT_EE_RST; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5299 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5300 |
msleep(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5301 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5302 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5303 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5304 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5305 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5306 |
* Parent function for writing words to the different EEPROM types. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5307 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5308 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5309 |
* offset - offset within the EEPROM to be written to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5310 |
* words - number of words to write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5311 |
* data - 16 bit word to be written to the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5312 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5313 |
* If e1000_update_eeprom_checksum is not called after this function, the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5314 |
* EEPROM will most likely contain an invalid checksum. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5315 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5316 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5317 |
e1000_write_eeprom(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5318 |
u16 offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5319 |
u16 words, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5320 |
u16 *data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5321 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5322 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5323 |
s32 status = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5324 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5325 |
DEBUGFUNC("e1000_write_eeprom"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5326 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5327 |
/* If eeprom is not yet detected, do so now */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5328 |
if (eeprom->word_size == 0) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5329 |
e1000_init_eeprom_params(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5330 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5331 |
/* A check for invalid values: offset too large, too many words, and not |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5332 |
* enough words. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5333 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5334 |
if ((offset >= eeprom->word_size) || (words > eeprom->word_size - offset) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5335 |
(words == 0)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5336 |
DEBUGOUT("\"words\" parameter out of bounds\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5337 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5338 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5339 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5340 |
/* 82573 writes only through eewr */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5341 |
if (eeprom->use_eewr) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5342 |
return e1000_write_eeprom_eewr(hw, offset, words, data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5343 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5344 |
if (eeprom->type == e1000_eeprom_ich8) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5345 |
return e1000_write_eeprom_ich8(hw, offset, words, data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5346 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5347 |
/* Prepare the EEPROM for writing */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5348 |
if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5349 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5350 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5351 |
if (eeprom->type == e1000_eeprom_microwire) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5352 |
status = e1000_write_eeprom_microwire(hw, offset, words, data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5353 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5354 |
status = e1000_write_eeprom_spi(hw, offset, words, data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5355 |
msleep(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5356 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5357 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5358 |
/* Done with writing */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5359 |
e1000_release_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5360 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5361 |
return status; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5362 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5363 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5364 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5365 |
* Writes a 16 bit word to a given offset in an SPI EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5366 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5367 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5368 |
* offset - offset within the EEPROM to be written to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5369 |
* words - number of words to write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5370 |
* data - pointer to array of 8 bit words to be written to the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5371 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5372 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5373 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5374 |
e1000_write_eeprom_spi(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5375 |
u16 offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5376 |
u16 words, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5377 |
u16 *data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5378 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5379 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5380 |
u16 widx = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5381 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5382 |
DEBUGFUNC("e1000_write_eeprom_spi"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5383 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5384 |
while (widx < words) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5385 |
u8 write_opcode = EEPROM_WRITE_OPCODE_SPI; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5386 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5387 |
if (e1000_spi_eeprom_ready(hw)) return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5388 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5389 |
e1000_standby_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5390 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5391 |
/* Send the WRITE ENABLE command (8 bit opcode ) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5392 |
e1000_shift_out_ee_bits(hw, EEPROM_WREN_OPCODE_SPI, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5393 |
eeprom->opcode_bits); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5394 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5395 |
e1000_standby_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5396 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5397 |
/* Some SPI eeproms use the 8th address bit embedded in the opcode */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5398 |
if ((eeprom->address_bits == 8) && (offset >= 128)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5399 |
write_opcode |= EEPROM_A8_OPCODE_SPI; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5400 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5401 |
/* Send the Write command (8-bit opcode + addr) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5402 |
e1000_shift_out_ee_bits(hw, write_opcode, eeprom->opcode_bits); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5403 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5404 |
e1000_shift_out_ee_bits(hw, (u16)((offset + widx)*2), |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5405 |
eeprom->address_bits); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5406 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5407 |
/* Send the data */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5408 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5409 |
/* Loop to allow for up to whole page write (32 bytes) of eeprom */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5410 |
while (widx < words) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5411 |
u16 word_out = data[widx]; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5412 |
word_out = (word_out >> 8) | (word_out << 8); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5413 |
e1000_shift_out_ee_bits(hw, word_out, 16); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5414 |
widx++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5415 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5416 |
/* Some larger eeprom sizes are capable of a 32-byte PAGE WRITE |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5417 |
* operation, while the smaller eeproms are capable of an 8-byte |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5418 |
* PAGE WRITE operation. Break the inner loop to pass new address |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5419 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5420 |
if ((((offset + widx)*2) % eeprom->page_size) == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5421 |
e1000_standby_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5422 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5423 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5424 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5425 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5426 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5427 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5428 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5429 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5430 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5431 |
* Writes a 16 bit word to a given offset in a Microwire EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5432 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5433 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5434 |
* offset - offset within the EEPROM to be written to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5435 |
* words - number of words to write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5436 |
* data - pointer to array of 16 bit words to be written to the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5437 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5438 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5439 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5440 |
e1000_write_eeprom_microwire(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5441 |
u16 offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5442 |
u16 words, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5443 |
u16 *data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5444 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5445 |
struct e1000_eeprom_info *eeprom = &hw->eeprom; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5446 |
u32 eecd; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5447 |
u16 words_written = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5448 |
u16 i = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5449 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5450 |
DEBUGFUNC("e1000_write_eeprom_microwire"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5451 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5452 |
/* Send the write enable command to the EEPROM (3-bit opcode plus |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5453 |
* 6/8-bit dummy address beginning with 11). It's less work to include |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5454 |
* the 11 of the dummy address as part of the opcode than it is to shift |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5455 |
* it over the correct number of bits for the address. This puts the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5456 |
* EEPROM into write/erase mode. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5457 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5458 |
e1000_shift_out_ee_bits(hw, EEPROM_EWEN_OPCODE_MICROWIRE, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5459 |
(u16)(eeprom->opcode_bits + 2)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5460 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5461 |
e1000_shift_out_ee_bits(hw, 0, (u16)(eeprom->address_bits - 2)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5462 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5463 |
/* Prepare the EEPROM */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5464 |
e1000_standby_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5465 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5466 |
while (words_written < words) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5467 |
/* Send the Write command (3-bit opcode + addr) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5468 |
e1000_shift_out_ee_bits(hw, EEPROM_WRITE_OPCODE_MICROWIRE, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5469 |
eeprom->opcode_bits); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5470 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5471 |
e1000_shift_out_ee_bits(hw, (u16)(offset + words_written), |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5472 |
eeprom->address_bits); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5473 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5474 |
/* Send the data */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5475 |
e1000_shift_out_ee_bits(hw, data[words_written], 16); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5476 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5477 |
/* Toggle the CS line. This in effect tells the EEPROM to execute |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5478 |
* the previous command. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5479 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5480 |
e1000_standby_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5481 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5482 |
/* Read DO repeatedly until it is high (equal to '1'). The EEPROM will |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5483 |
* signal that the command has been completed by raising the DO signal. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5484 |
* If DO does not go high in 10 milliseconds, then error out. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5485 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5486 |
for (i = 0; i < 200; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5487 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5488 |
if (eecd & E1000_EECD_DO) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5489 |
udelay(50); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5490 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5491 |
if (i == 200) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5492 |
DEBUGOUT("EEPROM Write did not complete\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5493 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5494 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5495 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5496 |
/* Recover from write */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5497 |
e1000_standby_eeprom(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5498 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5499 |
words_written++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5500 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5501 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5502 |
/* Send the write disable command to the EEPROM (3-bit opcode plus |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5503 |
* 6/8-bit dummy address beginning with 10). It's less work to include |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5504 |
* the 10 of the dummy address as part of the opcode than it is to shift |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5505 |
* it over the correct number of bits for the address. This takes the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5506 |
* EEPROM out of write/erase mode. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5507 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5508 |
e1000_shift_out_ee_bits(hw, EEPROM_EWDS_OPCODE_MICROWIRE, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5509 |
(u16)(eeprom->opcode_bits + 2)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5510 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5511 |
e1000_shift_out_ee_bits(hw, 0, (u16)(eeprom->address_bits - 2)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5512 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5513 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5514 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5515 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5516 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5517 |
* Flushes the cached eeprom to NVM. This is done by saving the modified values |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5518 |
* in the eeprom cache and the non modified values in the currently active bank |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5519 |
* to the new bank. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5520 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5521 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5522 |
* offset - offset of word in the EEPROM to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5523 |
* data - word read from the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5524 |
* words - number of words to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5525 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5526 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5527 |
e1000_commit_shadow_ram(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5528 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5529 |
u32 attempts = 100000; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5530 |
u32 eecd = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5531 |
u32 flop = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5532 |
u32 i = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5533 |
s32 error = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5534 |
u32 old_bank_offset = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5535 |
u32 new_bank_offset = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5536 |
u8 low_byte = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5537 |
u8 high_byte = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5538 |
bool sector_write_failed = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5539 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5540 |
if (hw->mac_type == e1000_82573) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5541 |
/* The flop register will be used to determine if flash type is STM */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5542 |
flop = E1000_READ_REG(hw, FLOP); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5543 |
for (i=0; i < attempts; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5544 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5545 |
if ((eecd & E1000_EECD_FLUPD) == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5546 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5547 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5548 |
udelay(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5549 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5550 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5551 |
if (i == attempts) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5552 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5553 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5554 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5555 |
/* If STM opcode located in bits 15:8 of flop, reset firmware */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5556 |
if ((flop & 0xFF00) == E1000_STM_OPCODE) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5557 |
E1000_WRITE_REG(hw, HICR, E1000_HICR_FW_RESET); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5558 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5559 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5560 |
/* Perform the flash update */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5561 |
E1000_WRITE_REG(hw, EECD, eecd | E1000_EECD_FLUPD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5562 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5563 |
for (i=0; i < attempts; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5564 |
eecd = E1000_READ_REG(hw, EECD); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5565 |
if ((eecd & E1000_EECD_FLUPD) == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5566 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5567 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5568 |
udelay(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5569 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5570 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5571 |
if (i == attempts) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5572 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5573 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5574 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5575 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5576 |
if (hw->mac_type == e1000_ich8lan && hw->eeprom_shadow_ram != NULL) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5577 |
/* We're writing to the opposite bank so if we're on bank 1, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5578 |
* write to bank 0 etc. We also need to erase the segment that |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5579 |
* is going to be written */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5580 |
if (!(E1000_READ_REG(hw, EECD) & E1000_EECD_SEC1VAL)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5581 |
new_bank_offset = hw->flash_bank_size * 2; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5582 |
old_bank_offset = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5583 |
e1000_erase_ich8_4k_segment(hw, 1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5584 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5585 |
old_bank_offset = hw->flash_bank_size * 2; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5586 |
new_bank_offset = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5587 |
e1000_erase_ich8_4k_segment(hw, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5588 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5589 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5590 |
sector_write_failed = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5591 |
/* Loop for every byte in the shadow RAM, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5592 |
* which is in units of words. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5593 |
for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5594 |
/* Determine whether to write the value stored |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5595 |
* in the other NVM bank or a modified value stored |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5596 |
* in the shadow RAM */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5597 |
if (hw->eeprom_shadow_ram[i].modified) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5598 |
low_byte = (u8)hw->eeprom_shadow_ram[i].eeprom_word; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5599 |
udelay(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5600 |
error = e1000_verify_write_ich8_byte(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5601 |
(i << 1) + new_bank_offset, low_byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5602 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5603 |
if (error != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5604 |
sector_write_failed = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5605 |
else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5606 |
high_byte = |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5607 |
(u8)(hw->eeprom_shadow_ram[i].eeprom_word >> 8); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5608 |
udelay(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5609 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5610 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5611 |
e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5612 |
&low_byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5613 |
udelay(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5614 |
error = e1000_verify_write_ich8_byte(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5615 |
(i << 1) + new_bank_offset, low_byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5616 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5617 |
if (error != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5618 |
sector_write_failed = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5619 |
else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5620 |
e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset + 1, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5621 |
&high_byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5622 |
udelay(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5623 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5624 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5625 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5626 |
/* If the write of the low byte was successful, go ahead and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5627 |
* write the high byte while checking to make sure that if it |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5628 |
* is the signature byte, then it is handled properly */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5629 |
if (!sector_write_failed) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5630 |
/* If the word is 0x13, then make sure the signature bits |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5631 |
* (15:14) are 11b until the commit has completed. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5632 |
* This will allow us to write 10b which indicates the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5633 |
* signature is valid. We want to do this after the write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5634 |
* has completed so that we don't mark the segment valid |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5635 |
* while the write is still in progress */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5636 |
if (i == E1000_ICH_NVM_SIG_WORD) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5637 |
high_byte = E1000_ICH_NVM_SIG_MASK | high_byte; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5638 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5639 |
error = e1000_verify_write_ich8_byte(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5640 |
(i << 1) + new_bank_offset + 1, high_byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5641 |
if (error != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5642 |
sector_write_failed = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5643 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5644 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5645 |
/* If the write failed then break from the loop and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5646 |
* return an error */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5647 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5648 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5649 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5650 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5651 |
/* Don't bother writing the segment valid bits if sector |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5652 |
* programming failed. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5653 |
if (!sector_write_failed) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5654 |
/* Finally validate the new segment by setting bit 15:14 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5655 |
* to 10b in word 0x13 , this can be done without an |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5656 |
* erase as well since these bits are 11 to start with |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5657 |
* and we need to change bit 14 to 0b */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5658 |
e1000_read_ich8_byte(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5659 |
E1000_ICH_NVM_SIG_WORD * 2 + 1 + new_bank_offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5660 |
&high_byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5661 |
high_byte &= 0xBF; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5662 |
error = e1000_verify_write_ich8_byte(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5663 |
E1000_ICH_NVM_SIG_WORD * 2 + 1 + new_bank_offset, high_byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5664 |
/* And invalidate the previously valid segment by setting |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5665 |
* its signature word (0x13) high_byte to 0b. This can be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5666 |
* done without an erase because flash erase sets all bits |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5667 |
* to 1's. We can write 1's to 0's without an erase */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5668 |
if (error == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5669 |
error = e1000_verify_write_ich8_byte(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5670 |
E1000_ICH_NVM_SIG_WORD * 2 + 1 + old_bank_offset, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5671 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5672 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5673 |
/* Clear the now not used entry in the cache */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5674 |
for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5675 |
hw->eeprom_shadow_ram[i].modified = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5676 |
hw->eeprom_shadow_ram[i].eeprom_word = 0xFFFF; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5677 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5678 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5679 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5680 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5681 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5682 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5683 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5684 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5685 |
* Reads the adapter's MAC address from the EEPROM and inverts the LSB for the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5686 |
* second function of dual function devices |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5687 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5688 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5689 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5690 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5691 |
e1000_read_mac_addr(struct e1000_hw * hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5692 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5693 |
u16 offset; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5694 |
u16 eeprom_data, i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5695 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5696 |
DEBUGFUNC("e1000_read_mac_addr"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5697 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5698 |
for (i = 0; i < NODE_ADDRESS_SIZE; i += 2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5699 |
offset = i >> 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5700 |
if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5701 |
DEBUGOUT("EEPROM Read Error\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5702 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5703 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5704 |
hw->perm_mac_addr[i] = (u8) (eeprom_data & 0x00FF); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5705 |
hw->perm_mac_addr[i+1] = (u8) (eeprom_data >> 8); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5706 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5707 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5708 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5709 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5710 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5711 |
case e1000_82546: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5712 |
case e1000_82546_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5713 |
case e1000_82571: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5714 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5715 |
if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5716 |
hw->perm_mac_addr[5] ^= 0x01; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5717 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5718 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5719 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5720 |
for (i = 0; i < NODE_ADDRESS_SIZE; i++) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5721 |
hw->mac_addr[i] = hw->perm_mac_addr[i]; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5722 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5723 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5724 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5725 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5726 |
* Initializes receive address filters. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5727 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5728 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5729 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5730 |
* Places the MAC address in receive address register 0 and clears the rest |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5731 |
* of the receive addresss registers. Clears the multicast table. Assumes |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5732 |
* the receiver is in reset when the routine is called. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5733 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5734 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5735 |
e1000_init_rx_addrs(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5736 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5737 |
u32 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5738 |
u32 rar_num; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5739 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5740 |
DEBUGFUNC("e1000_init_rx_addrs"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5741 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5742 |
/* Setup the receive address. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5743 |
DEBUGOUT("Programming MAC Address into RAR[0]\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5744 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5745 |
e1000_rar_set(hw, hw->mac_addr, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5746 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5747 |
rar_num = E1000_RAR_ENTRIES; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5748 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5749 |
/* Reserve a spot for the Locally Administered Address to work around |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5750 |
* an 82571 issue in which a reset on one port will reload the MAC on |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5751 |
* the other port. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5752 |
if ((hw->mac_type == e1000_82571) && (hw->laa_is_present)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5753 |
rar_num -= 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5754 |
if (hw->mac_type == e1000_ich8lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5755 |
rar_num = E1000_RAR_ENTRIES_ICH8LAN; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5756 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5757 |
/* Zero out the other 15 receive addresses. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5758 |
DEBUGOUT("Clearing RAR[1-15]\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5759 |
for (i = 1; i < rar_num; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5760 |
E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5761 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5762 |
E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5763 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5764 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5765 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5766 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5767 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5768 |
* Hashes an address to determine its location in the multicast table |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5769 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5770 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5771 |
* mc_addr - the multicast address to hash |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5772 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5773 |
u32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5774 |
e1000_hash_mc_addr(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5775 |
u8 *mc_addr) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5776 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5777 |
u32 hash_value = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5778 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5779 |
/* The portion of the address that is used for the hash table is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5780 |
* determined by the mc_filter_type setting. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5781 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5782 |
switch (hw->mc_filter_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5783 |
/* [0] [1] [2] [3] [4] [5] |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5784 |
* 01 AA 00 12 34 56 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5785 |
* LSB MSB |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5786 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5787 |
case 0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5788 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5789 |
/* [47:38] i.e. 0x158 for above example address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5790 |
hash_value = ((mc_addr[4] >> 6) | (((u16) mc_addr[5]) << 2)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5791 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5792 |
/* [47:36] i.e. 0x563 for above example address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5793 |
hash_value = ((mc_addr[4] >> 4) | (((u16) mc_addr[5]) << 4)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5794 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5795 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5796 |
case 1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5797 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5798 |
/* [46:37] i.e. 0x2B1 for above example address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5799 |
hash_value = ((mc_addr[4] >> 5) | (((u16) mc_addr[5]) << 3)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5800 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5801 |
/* [46:35] i.e. 0xAC6 for above example address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5802 |
hash_value = ((mc_addr[4] >> 3) | (((u16) mc_addr[5]) << 5)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5803 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5804 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5805 |
case 2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5806 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5807 |
/*[45:36] i.e. 0x163 for above example address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5808 |
hash_value = ((mc_addr[4] >> 4) | (((u16) mc_addr[5]) << 4)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5809 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5810 |
/* [45:34] i.e. 0x5D8 for above example address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5811 |
hash_value = ((mc_addr[4] >> 2) | (((u16) mc_addr[5]) << 6)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5812 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5813 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5814 |
case 3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5815 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5816 |
/* [43:34] i.e. 0x18D for above example address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5817 |
hash_value = ((mc_addr[4] >> 2) | (((u16) mc_addr[5]) << 6)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5818 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5819 |
/* [43:32] i.e. 0x634 for above example address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5820 |
hash_value = ((mc_addr[4]) | (((u16) mc_addr[5]) << 8)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5821 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5822 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5823 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5824 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5825 |
hash_value &= 0xFFF; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5826 |
if (hw->mac_type == e1000_ich8lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5827 |
hash_value &= 0x3FF; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5828 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5829 |
return hash_value; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5830 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5831 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5832 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5833 |
* Sets the bit in the multicast table corresponding to the hash value. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5834 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5835 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5836 |
* hash_value - Multicast address hash value |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5837 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5838 |
void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5839 |
e1000_mta_set(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5840 |
u32 hash_value) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5841 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5842 |
u32 hash_bit, hash_reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5843 |
u32 mta; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5844 |
u32 temp; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5845 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5846 |
/* The MTA is a register array of 128 32-bit registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5847 |
* It is treated like an array of 4096 bits. We want to set |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5848 |
* bit BitArray[hash_value]. So we figure out what register |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5849 |
* the bit is in, read it, OR in the new bit, then write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5850 |
* back the new value. The register is determined by the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5851 |
* upper 7 bits of the hash value and the bit within that |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5852 |
* register are determined by the lower 5 bits of the value. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5853 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5854 |
hash_reg = (hash_value >> 5) & 0x7F; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5855 |
if (hw->mac_type == e1000_ich8lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5856 |
hash_reg &= 0x1F; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5857 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5858 |
hash_bit = hash_value & 0x1F; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5859 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5860 |
mta = E1000_READ_REG_ARRAY(hw, MTA, hash_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5861 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5862 |
mta |= (1 << hash_bit); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5863 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5864 |
/* If we are on an 82544 and we are trying to write an odd offset |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5865 |
* in the MTA, save off the previous entry before writing and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5866 |
* restore the old value after writing. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5867 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5868 |
if ((hw->mac_type == e1000_82544) && ((hash_reg & 0x1) == 1)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5869 |
temp = E1000_READ_REG_ARRAY(hw, MTA, (hash_reg - 1)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5870 |
E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5871 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5872 |
E1000_WRITE_REG_ARRAY(hw, MTA, (hash_reg - 1), temp); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5873 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5874 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5875 |
E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5876 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5877 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5878 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5879 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5880 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5881 |
* Puts an ethernet address into a receive address register. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5882 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5883 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5884 |
* addr - Address to put into receive address register |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5885 |
* index - Receive address register to write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5886 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5887 |
void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5888 |
e1000_rar_set(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5889 |
u8 *addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5890 |
u32 index) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5891 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5892 |
u32 rar_low, rar_high; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5893 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5894 |
/* HW expects these in little endian so we reverse the byte order |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5895 |
* from network order (big endian) to little endian |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5896 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5897 |
rar_low = ((u32) addr[0] | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5898 |
((u32) addr[1] << 8) | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5899 |
((u32) addr[2] << 16) | ((u32) addr[3] << 24)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5900 |
rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5901 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5902 |
/* Disable Rx and flush all Rx frames before enabling RSS to avoid Rx |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5903 |
* unit hang. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5904 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5905 |
* Description: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5906 |
* If there are any Rx frames queued up or otherwise present in the HW |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5907 |
* before RSS is enabled, and then we enable RSS, the HW Rx unit will |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5908 |
* hang. To work around this issue, we have to disable receives and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5909 |
* flush out all Rx frames before we enable RSS. To do so, we modify we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5910 |
* redirect all Rx traffic to manageability and then reset the HW. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5911 |
* This flushes away Rx frames, and (since the redirections to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5912 |
* manageability persists across resets) keeps new ones from coming in |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5913 |
* while we work. Then, we clear the Address Valid AV bit for all MAC |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5914 |
* addresses and undo the re-direction to manageability. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5915 |
* Now, frames are coming in again, but the MAC won't accept them, so |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5916 |
* far so good. We now proceed to initialize RSS (if necessary) and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5917 |
* configure the Rx unit. Last, we re-enable the AV bits and continue |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5918 |
* on our merry way. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5919 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5920 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5921 |
case e1000_82571: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5922 |
case e1000_82572: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5923 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5924 |
if (hw->leave_av_bit_off) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5925 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5926 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5927 |
/* Indicate to hardware the Address is Valid. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5928 |
rar_high |= E1000_RAH_AV; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5929 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5930 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5931 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5932 |
E1000_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5933 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5934 |
E1000_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5935 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5936 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5937 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5938 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5939 |
* Writes a value to the specified offset in the VLAN filter table. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5940 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5941 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5942 |
* offset - Offset in VLAN filer table to write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5943 |
* value - Value to write into VLAN filter table |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5944 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5945 |
void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5946 |
e1000_write_vfta(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5947 |
u32 offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5948 |
u32 value) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5949 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5950 |
u32 temp; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5951 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5952 |
if (hw->mac_type == e1000_ich8lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5953 |
return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5954 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5955 |
if ((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5956 |
temp = E1000_READ_REG_ARRAY(hw, VFTA, (offset - 1)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5957 |
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5958 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5959 |
E1000_WRITE_REG_ARRAY(hw, VFTA, (offset - 1), temp); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5960 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5961 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5962 |
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5963 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5964 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5965 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5966 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5967 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5968 |
* Clears the VLAN filer table |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5969 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5970 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5971 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5972 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5973 |
e1000_clear_vfta(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5974 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5975 |
u32 offset; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5976 |
u32 vfta_value = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5977 |
u32 vfta_offset = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5978 |
u32 vfta_bit_in_reg = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5979 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5980 |
if (hw->mac_type == e1000_ich8lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5981 |
return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5982 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5983 |
if (hw->mac_type == e1000_82573) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5984 |
if (hw->mng_cookie.vlan_id != 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5985 |
/* The VFTA is a 4096b bit-field, each identifying a single VLAN |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5986 |
* ID. The following operations determine which 32b entry |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5987 |
* (i.e. offset) into the array we want to set the VLAN ID |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5988 |
* (i.e. bit) of the manageability unit. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5989 |
vfta_offset = (hw->mng_cookie.vlan_id >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5990 |
E1000_VFTA_ENTRY_SHIFT) & |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5991 |
E1000_VFTA_ENTRY_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5992 |
vfta_bit_in_reg = 1 << (hw->mng_cookie.vlan_id & |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5993 |
E1000_VFTA_ENTRY_BIT_SHIFT_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5994 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5995 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5996 |
for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5997 |
/* If the offset we want to clear is the same offset of the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5998 |
* manageability VLAN ID, then clear all bits except that of the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5999 |
* manageability unit */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6000 |
vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6001 |
E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6002 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6003 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6004 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6005 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6006 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6007 |
e1000_id_led_init(struct e1000_hw * hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6008 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6009 |
u32 ledctl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6010 |
const u32 ledctl_mask = 0x000000FF; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6011 |
const u32 ledctl_on = E1000_LEDCTL_MODE_LED_ON; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6012 |
const u32 ledctl_off = E1000_LEDCTL_MODE_LED_OFF; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6013 |
u16 eeprom_data, i, temp; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6014 |
const u16 led_mask = 0x0F; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6015 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6016 |
DEBUGFUNC("e1000_id_led_init"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6017 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6018 |
if (hw->mac_type < e1000_82540) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6019 |
/* Nothing to do */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6020 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6021 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6022 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6023 |
ledctl = E1000_READ_REG(hw, LEDCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6024 |
hw->ledctl_default = ledctl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6025 |
hw->ledctl_mode1 = hw->ledctl_default; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6026 |
hw->ledctl_mode2 = hw->ledctl_default; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6027 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6028 |
if (e1000_read_eeprom(hw, EEPROM_ID_LED_SETTINGS, 1, &eeprom_data) < 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6029 |
DEBUGOUT("EEPROM Read Error\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6030 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6031 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6032 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6033 |
if ((hw->mac_type == e1000_82573) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6034 |
(eeprom_data == ID_LED_RESERVED_82573)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6035 |
eeprom_data = ID_LED_DEFAULT_82573; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6036 |
else if ((eeprom_data == ID_LED_RESERVED_0000) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6037 |
(eeprom_data == ID_LED_RESERVED_FFFF)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6038 |
if (hw->mac_type == e1000_ich8lan) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6039 |
eeprom_data = ID_LED_DEFAULT_ICH8LAN; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6040 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6041 |
eeprom_data = ID_LED_DEFAULT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6042 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6043 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6044 |
for (i = 0; i < 4; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6045 |
temp = (eeprom_data >> (i << 2)) & led_mask; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6046 |
switch (temp) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6047 |
case ID_LED_ON1_DEF2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6048 |
case ID_LED_ON1_ON2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6049 |
case ID_LED_ON1_OFF2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6050 |
hw->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6051 |
hw->ledctl_mode1 |= ledctl_on << (i << 3); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6052 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6053 |
case ID_LED_OFF1_DEF2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6054 |
case ID_LED_OFF1_ON2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6055 |
case ID_LED_OFF1_OFF2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6056 |
hw->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6057 |
hw->ledctl_mode1 |= ledctl_off << (i << 3); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6058 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6059 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6060 |
/* Do nothing */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6061 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6062 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6063 |
switch (temp) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6064 |
case ID_LED_DEF1_ON2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6065 |
case ID_LED_ON1_ON2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6066 |
case ID_LED_OFF1_ON2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6067 |
hw->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6068 |
hw->ledctl_mode2 |= ledctl_on << (i << 3); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6069 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6070 |
case ID_LED_DEF1_OFF2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6071 |
case ID_LED_ON1_OFF2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6072 |
case ID_LED_OFF1_OFF2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6073 |
hw->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6074 |
hw->ledctl_mode2 |= ledctl_off << (i << 3); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6075 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6076 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6077 |
/* Do nothing */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6078 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6079 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6080 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6081 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6082 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6083 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6084 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6085 |
* Prepares SW controlable LED for use and saves the current state of the LED. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6086 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6087 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6088 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6089 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6090 |
e1000_setup_led(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6091 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6092 |
u32 ledctl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6093 |
s32 ret_val = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6094 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6095 |
DEBUGFUNC("e1000_setup_led"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6096 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6097 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6098 |
case e1000_82542_rev2_0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6099 |
case e1000_82542_rev2_1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6100 |
case e1000_82543: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6101 |
case e1000_82544: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6102 |
/* No setup necessary */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6103 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6104 |
case e1000_82541: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6105 |
case e1000_82547: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6106 |
case e1000_82541_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6107 |
case e1000_82547_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6108 |
/* Turn off PHY Smart Power Down (if enabled) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6109 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6110 |
&hw->phy_spd_default); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6111 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6112 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6113 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6114 |
(u16)(hw->phy_spd_default & |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6115 |
~IGP01E1000_GMII_SPD)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6116 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6117 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6118 |
/* Fall Through */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6119 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6120 |
if (hw->media_type == e1000_media_type_fiber) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6121 |
ledctl = E1000_READ_REG(hw, LEDCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6122 |
/* Save current LEDCTL settings */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6123 |
hw->ledctl_default = ledctl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6124 |
/* Turn off LED0 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6125 |
ledctl &= ~(E1000_LEDCTL_LED0_IVRT | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6126 |
E1000_LEDCTL_LED0_BLINK | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6127 |
E1000_LEDCTL_LED0_MODE_MASK); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6128 |
ledctl |= (E1000_LEDCTL_MODE_LED_OFF << |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6129 |
E1000_LEDCTL_LED0_MODE_SHIFT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6130 |
E1000_WRITE_REG(hw, LEDCTL, ledctl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6131 |
} else if (hw->media_type == e1000_media_type_copper) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6132 |
E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6133 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6134 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6135 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6136 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6137 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6138 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6139 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6140 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6141 |
* Used on 82571 and later Si that has LED blink bits. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6142 |
* Callers must use their own timer and should have already called |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6143 |
* e1000_id_led_init() |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6144 |
* Call e1000_cleanup led() to stop blinking |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6145 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6146 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6147 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6148 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6149 |
e1000_blink_led_start(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6150 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6151 |
s16 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6152 |
u32 ledctl_blink = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6153 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6154 |
DEBUGFUNC("e1000_id_led_blink_on"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6155 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6156 |
if (hw->mac_type < e1000_82571) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6157 |
/* Nothing to do */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6158 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6159 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6160 |
if (hw->media_type == e1000_media_type_fiber) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6161 |
/* always blink LED0 for PCI-E fiber */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6162 |
ledctl_blink = E1000_LEDCTL_LED0_BLINK | |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6163 |
(E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED0_MODE_SHIFT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6164 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6165 |
/* set the blink bit for each LED that's "on" (0x0E) in ledctl_mode2 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6166 |
ledctl_blink = hw->ledctl_mode2; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6167 |
for (i=0; i < 4; i++) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6168 |
if (((hw->ledctl_mode2 >> (i * 8)) & 0xFF) == |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6169 |
E1000_LEDCTL_MODE_LED_ON) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6170 |
ledctl_blink |= (E1000_LEDCTL_LED0_BLINK << (i * 8)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6171 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6172 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6173 |
E1000_WRITE_REG(hw, LEDCTL, ledctl_blink); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6174 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6175 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6176 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6177 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6178 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6179 |
* Restores the saved state of the SW controlable LED. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6180 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6181 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6182 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6183 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6184 |
e1000_cleanup_led(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6185 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6186 |
s32 ret_val = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6187 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6188 |
DEBUGFUNC("e1000_cleanup_led"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6189 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6190 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6191 |
case e1000_82542_rev2_0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6192 |
case e1000_82542_rev2_1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6193 |
case e1000_82543: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6194 |
case e1000_82544: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6195 |
/* No cleanup necessary */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6196 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6197 |
case e1000_82541: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6198 |
case e1000_82547: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6199 |
case e1000_82541_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6200 |
case e1000_82547_rev_2: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6201 |
/* Turn on PHY Smart Power Down (if previously enabled) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6202 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6203 |
hw->phy_spd_default); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6204 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6205 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6206 |
/* Fall Through */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6207 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6208 |
if (hw->phy_type == e1000_phy_ife) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6209 |
e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6210 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6211 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6212 |
/* Restore LEDCTL settings */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6213 |
E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_default); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6214 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6215 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6216 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6217 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6218 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6219 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6220 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6221 |
* Turns on the software controllable LED |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6222 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6223 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6224 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6225 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6226 |
e1000_led_on(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6227 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6228 |
u32 ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6229 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6230 |
DEBUGFUNC("e1000_led_on"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6231 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6232 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6233 |
case e1000_82542_rev2_0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6234 |
case e1000_82542_rev2_1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6235 |
case e1000_82543: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6236 |
/* Set SW Defineable Pin 0 to turn on the LED */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6237 |
ctrl |= E1000_CTRL_SWDPIN0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6238 |
ctrl |= E1000_CTRL_SWDPIO0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6239 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6240 |
case e1000_82544: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6241 |
if (hw->media_type == e1000_media_type_fiber) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6242 |
/* Set SW Defineable Pin 0 to turn on the LED */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6243 |
ctrl |= E1000_CTRL_SWDPIN0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6244 |
ctrl |= E1000_CTRL_SWDPIO0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6245 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6246 |
/* Clear SW Defineable Pin 0 to turn on the LED */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6247 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6248 |
ctrl |= E1000_CTRL_SWDPIO0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6249 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6250 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6251 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6252 |
if (hw->media_type == e1000_media_type_fiber) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6253 |
/* Clear SW Defineable Pin 0 to turn on the LED */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6254 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6255 |
ctrl |= E1000_CTRL_SWDPIO0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6256 |
} else if (hw->phy_type == e1000_phy_ife) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6257 |
e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6258 |
(IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_ON)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6259 |
} else if (hw->media_type == e1000_media_type_copper) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6260 |
E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode2); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6261 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6262 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6263 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6264 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6265 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6266 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6267 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6268 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6269 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6270 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6271 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6272 |
* Turns off the software controllable LED |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6273 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6274 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6275 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6276 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6277 |
e1000_led_off(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6278 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6279 |
u32 ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6280 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6281 |
DEBUGFUNC("e1000_led_off"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6282 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6283 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6284 |
case e1000_82542_rev2_0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6285 |
case e1000_82542_rev2_1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6286 |
case e1000_82543: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6287 |
/* Clear SW Defineable Pin 0 to turn off the LED */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6288 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6289 |
ctrl |= E1000_CTRL_SWDPIO0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6290 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6291 |
case e1000_82544: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6292 |
if (hw->media_type == e1000_media_type_fiber) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6293 |
/* Clear SW Defineable Pin 0 to turn off the LED */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6294 |
ctrl &= ~E1000_CTRL_SWDPIN0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6295 |
ctrl |= E1000_CTRL_SWDPIO0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6296 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6297 |
/* Set SW Defineable Pin 0 to turn off the LED */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6298 |
ctrl |= E1000_CTRL_SWDPIN0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6299 |
ctrl |= E1000_CTRL_SWDPIO0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6300 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6301 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6302 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6303 |
if (hw->media_type == e1000_media_type_fiber) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6304 |
/* Set SW Defineable Pin 0 to turn off the LED */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6305 |
ctrl |= E1000_CTRL_SWDPIN0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6306 |
ctrl |= E1000_CTRL_SWDPIO0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6307 |
} else if (hw->phy_type == e1000_phy_ife) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6308 |
e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6309 |
(IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_OFF)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6310 |
} else if (hw->media_type == e1000_media_type_copper) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6311 |
E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6312 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6313 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6314 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6315 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6316 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6317 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6318 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6319 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6320 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6321 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6322 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6323 |
* Clears all hardware statistics counters. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6324 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6325 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6326 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6327 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6328 |
e1000_clear_hw_cntrs(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6329 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6330 |
volatile u32 temp; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6331 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6332 |
temp = E1000_READ_REG(hw, CRCERRS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6333 |
temp = E1000_READ_REG(hw, SYMERRS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6334 |
temp = E1000_READ_REG(hw, MPC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6335 |
temp = E1000_READ_REG(hw, SCC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6336 |
temp = E1000_READ_REG(hw, ECOL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6337 |
temp = E1000_READ_REG(hw, MCC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6338 |
temp = E1000_READ_REG(hw, LATECOL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6339 |
temp = E1000_READ_REG(hw, COLC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6340 |
temp = E1000_READ_REG(hw, DC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6341 |
temp = E1000_READ_REG(hw, SEC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6342 |
temp = E1000_READ_REG(hw, RLEC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6343 |
temp = E1000_READ_REG(hw, XONRXC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6344 |
temp = E1000_READ_REG(hw, XONTXC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6345 |
temp = E1000_READ_REG(hw, XOFFRXC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6346 |
temp = E1000_READ_REG(hw, XOFFTXC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6347 |
temp = E1000_READ_REG(hw, FCRUC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6348 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6349 |
if (hw->mac_type != e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6350 |
temp = E1000_READ_REG(hw, PRC64); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6351 |
temp = E1000_READ_REG(hw, PRC127); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6352 |
temp = E1000_READ_REG(hw, PRC255); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6353 |
temp = E1000_READ_REG(hw, PRC511); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6354 |
temp = E1000_READ_REG(hw, PRC1023); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6355 |
temp = E1000_READ_REG(hw, PRC1522); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6356 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6357 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6358 |
temp = E1000_READ_REG(hw, GPRC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6359 |
temp = E1000_READ_REG(hw, BPRC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6360 |
temp = E1000_READ_REG(hw, MPRC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6361 |
temp = E1000_READ_REG(hw, GPTC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6362 |
temp = E1000_READ_REG(hw, GORCL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6363 |
temp = E1000_READ_REG(hw, GORCH); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6364 |
temp = E1000_READ_REG(hw, GOTCL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6365 |
temp = E1000_READ_REG(hw, GOTCH); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6366 |
temp = E1000_READ_REG(hw, RNBC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6367 |
temp = E1000_READ_REG(hw, RUC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6368 |
temp = E1000_READ_REG(hw, RFC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6369 |
temp = E1000_READ_REG(hw, ROC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6370 |
temp = E1000_READ_REG(hw, RJC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6371 |
temp = E1000_READ_REG(hw, TORL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6372 |
temp = E1000_READ_REG(hw, TORH); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6373 |
temp = E1000_READ_REG(hw, TOTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6374 |
temp = E1000_READ_REG(hw, TOTH); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6375 |
temp = E1000_READ_REG(hw, TPR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6376 |
temp = E1000_READ_REG(hw, TPT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6377 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6378 |
if (hw->mac_type != e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6379 |
temp = E1000_READ_REG(hw, PTC64); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6380 |
temp = E1000_READ_REG(hw, PTC127); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6381 |
temp = E1000_READ_REG(hw, PTC255); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6382 |
temp = E1000_READ_REG(hw, PTC511); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6383 |
temp = E1000_READ_REG(hw, PTC1023); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6384 |
temp = E1000_READ_REG(hw, PTC1522); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6385 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6386 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6387 |
temp = E1000_READ_REG(hw, MPTC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6388 |
temp = E1000_READ_REG(hw, BPTC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6389 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6390 |
if (hw->mac_type < e1000_82543) return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6391 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6392 |
temp = E1000_READ_REG(hw, ALGNERRC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6393 |
temp = E1000_READ_REG(hw, RXERRC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6394 |
temp = E1000_READ_REG(hw, TNCRS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6395 |
temp = E1000_READ_REG(hw, CEXTERR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6396 |
temp = E1000_READ_REG(hw, TSCTC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6397 |
temp = E1000_READ_REG(hw, TSCTFC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6398 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6399 |
if (hw->mac_type <= e1000_82544) return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6400 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6401 |
temp = E1000_READ_REG(hw, MGTPRC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6402 |
temp = E1000_READ_REG(hw, MGTPDC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6403 |
temp = E1000_READ_REG(hw, MGTPTC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6404 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6405 |
if (hw->mac_type <= e1000_82547_rev_2) return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6406 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6407 |
temp = E1000_READ_REG(hw, IAC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6408 |
temp = E1000_READ_REG(hw, ICRXOC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6409 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6410 |
if (hw->mac_type == e1000_ich8lan) return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6411 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6412 |
temp = E1000_READ_REG(hw, ICRXPTC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6413 |
temp = E1000_READ_REG(hw, ICRXATC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6414 |
temp = E1000_READ_REG(hw, ICTXPTC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6415 |
temp = E1000_READ_REG(hw, ICTXATC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6416 |
temp = E1000_READ_REG(hw, ICTXQEC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6417 |
temp = E1000_READ_REG(hw, ICTXQMTC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6418 |
temp = E1000_READ_REG(hw, ICRXDMTC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6419 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6420 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6421 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6422 |
* Resets Adaptive IFS to its default state. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6423 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6424 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6425 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6426 |
* Call this after e1000_init_hw. You may override the IFS defaults by setting |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6427 |
* hw->ifs_params_forced to true. However, you must initialize hw-> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6428 |
* current_ifs_val, ifs_min_val, ifs_max_val, ifs_step_size, and ifs_ratio |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6429 |
* before calling this function. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6430 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6431 |
void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6432 |
e1000_reset_adaptive(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6433 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6434 |
DEBUGFUNC("e1000_reset_adaptive"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6435 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6436 |
if (hw->adaptive_ifs) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6437 |
if (!hw->ifs_params_forced) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6438 |
hw->current_ifs_val = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6439 |
hw->ifs_min_val = IFS_MIN; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6440 |
hw->ifs_max_val = IFS_MAX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6441 |
hw->ifs_step_size = IFS_STEP; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6442 |
hw->ifs_ratio = IFS_RATIO; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6443 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6444 |
hw->in_ifs_mode = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6445 |
E1000_WRITE_REG(hw, AIT, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6446 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6447 |
DEBUGOUT("Not in Adaptive IFS mode!\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6448 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6449 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6450 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6451 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6452 |
* Called during the callback/watchdog routine to update IFS value based on |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6453 |
* the ratio of transmits to collisions. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6454 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6455 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6456 |
* tx_packets - Number of transmits since last callback |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6457 |
* total_collisions - Number of collisions since last callback |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6458 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6459 |
void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6460 |
e1000_update_adaptive(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6461 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6462 |
DEBUGFUNC("e1000_update_adaptive"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6463 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6464 |
if (hw->adaptive_ifs) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6465 |
if ((hw->collision_delta * hw->ifs_ratio) > hw->tx_packet_delta) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6466 |
if (hw->tx_packet_delta > MIN_NUM_XMITS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6467 |
hw->in_ifs_mode = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6468 |
if (hw->current_ifs_val < hw->ifs_max_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6469 |
if (hw->current_ifs_val == 0) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6470 |
hw->current_ifs_val = hw->ifs_min_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6471 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6472 |
hw->current_ifs_val += hw->ifs_step_size; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6473 |
E1000_WRITE_REG(hw, AIT, hw->current_ifs_val); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6474 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6475 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6476 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6477 |
if (hw->in_ifs_mode && (hw->tx_packet_delta <= MIN_NUM_XMITS)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6478 |
hw->current_ifs_val = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6479 |
hw->in_ifs_mode = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6480 |
E1000_WRITE_REG(hw, AIT, 0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6481 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6482 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6483 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6484 |
DEBUGOUT("Not in Adaptive IFS mode!\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6485 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6486 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6487 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6488 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6489 |
* Adjusts the statistic counters when a frame is accepted by TBI_ACCEPT |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6490 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6491 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6492 |
* frame_len - The length of the frame in question |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6493 |
* mac_addr - The Ethernet destination address of the frame in question |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6494 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6495 |
void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6496 |
e1000_tbi_adjust_stats(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6497 |
struct e1000_hw_stats *stats, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6498 |
u32 frame_len, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6499 |
u8 *mac_addr) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6500 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6501 |
u64 carry_bit; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6502 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6503 |
/* First adjust the frame length. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6504 |
frame_len--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6505 |
/* We need to adjust the statistics counters, since the hardware |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6506 |
* counters overcount this packet as a CRC error and undercount |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6507 |
* the packet as a good packet |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6508 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6509 |
/* This packet should not be counted as a CRC error. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6510 |
stats->crcerrs--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6511 |
/* This packet does count as a Good Packet Received. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6512 |
stats->gprc++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6513 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6514 |
/* Adjust the Good Octets received counters */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6515 |
carry_bit = 0x80000000 & stats->gorcl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6516 |
stats->gorcl += frame_len; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6517 |
/* If the high bit of Gorcl (the low 32 bits of the Good Octets |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6518 |
* Received Count) was one before the addition, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6519 |
* AND it is zero after, then we lost the carry out, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6520 |
* need to add one to Gorch (Good Octets Received Count High). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6521 |
* This could be simplified if all environments supported |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6522 |
* 64-bit integers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6523 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6524 |
if (carry_bit && ((stats->gorcl & 0x80000000) == 0)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6525 |
stats->gorch++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6526 |
/* Is this a broadcast or multicast? Check broadcast first, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6527 |
* since the test for a multicast frame will test positive on |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6528 |
* a broadcast frame. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6529 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6530 |
if ((mac_addr[0] == (u8) 0xff) && (mac_addr[1] == (u8) 0xff)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6531 |
/* Broadcast packet */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6532 |
stats->bprc++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6533 |
else if (*mac_addr & 0x01) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6534 |
/* Multicast packet */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6535 |
stats->mprc++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6536 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6537 |
if (frame_len == hw->max_frame_size) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6538 |
/* In this case, the hardware has overcounted the number of |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6539 |
* oversize frames. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6540 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6541 |
if (stats->roc > 0) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6542 |
stats->roc--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6543 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6544 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6545 |
/* Adjust the bin counters when the extra byte put the frame in the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6546 |
* wrong bin. Remember that the frame_len was adjusted above. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6547 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6548 |
if (frame_len == 64) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6549 |
stats->prc64++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6550 |
stats->prc127--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6551 |
} else if (frame_len == 127) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6552 |
stats->prc127++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6553 |
stats->prc255--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6554 |
} else if (frame_len == 255) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6555 |
stats->prc255++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6556 |
stats->prc511--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6557 |
} else if (frame_len == 511) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6558 |
stats->prc511++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6559 |
stats->prc1023--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6560 |
} else if (frame_len == 1023) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6561 |
stats->prc1023++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6562 |
stats->prc1522--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6563 |
} else if (frame_len == 1522) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6564 |
stats->prc1522++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6565 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6566 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6567 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6568 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6569 |
* Gets the current PCI bus type, speed, and width of the hardware |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6570 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6571 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6572 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6573 |
void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6574 |
e1000_get_bus_info(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6575 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6576 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6577 |
u16 pci_ex_link_status; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6578 |
u32 status; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6579 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6580 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6581 |
case e1000_82542_rev2_0: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6582 |
case e1000_82542_rev2_1: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6583 |
hw->bus_type = e1000_bus_type_pci; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6584 |
hw->bus_speed = e1000_bus_speed_unknown; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6585 |
hw->bus_width = e1000_bus_width_unknown; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6586 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6587 |
case e1000_82571: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6588 |
case e1000_82572: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6589 |
case e1000_82573: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6590 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6591 |
hw->bus_type = e1000_bus_type_pci_express; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6592 |
hw->bus_speed = e1000_bus_speed_2500; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6593 |
ret_val = e1000_read_pcie_cap_reg(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6594 |
PCI_EX_LINK_STATUS, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6595 |
&pci_ex_link_status); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6596 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6597 |
hw->bus_width = e1000_bus_width_unknown; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6598 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6599 |
hw->bus_width = (pci_ex_link_status & PCI_EX_LINK_WIDTH_MASK) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6600 |
PCI_EX_LINK_WIDTH_SHIFT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6601 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6602 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6603 |
hw->bus_type = e1000_bus_type_pci_express; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6604 |
hw->bus_speed = e1000_bus_speed_2500; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6605 |
hw->bus_width = e1000_bus_width_pciex_1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6606 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6607 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6608 |
status = E1000_READ_REG(hw, STATUS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6609 |
hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6610 |
e1000_bus_type_pcix : e1000_bus_type_pci; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6611 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6612 |
if (hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6613 |
hw->bus_speed = (hw->bus_type == e1000_bus_type_pci) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6614 |
e1000_bus_speed_66 : e1000_bus_speed_120; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6615 |
} else if (hw->bus_type == e1000_bus_type_pci) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6616 |
hw->bus_speed = (status & E1000_STATUS_PCI66) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6617 |
e1000_bus_speed_66 : e1000_bus_speed_33; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6618 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6619 |
switch (status & E1000_STATUS_PCIX_SPEED) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6620 |
case E1000_STATUS_PCIX_SPEED_66: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6621 |
hw->bus_speed = e1000_bus_speed_66; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6622 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6623 |
case E1000_STATUS_PCIX_SPEED_100: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6624 |
hw->bus_speed = e1000_bus_speed_100; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6625 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6626 |
case E1000_STATUS_PCIX_SPEED_133: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6627 |
hw->bus_speed = e1000_bus_speed_133; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6628 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6629 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6630 |
hw->bus_speed = e1000_bus_speed_reserved; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6631 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6632 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6633 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6634 |
hw->bus_width = (status & E1000_STATUS_BUS64) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6635 |
e1000_bus_width_64 : e1000_bus_width_32; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6636 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6637 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6638 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6639 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6640 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6641 |
* Writes a value to one of the devices registers using port I/O (as opposed to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6642 |
* memory mapped I/O). Only 82544 and newer devices support port I/O. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6643 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6644 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6645 |
* offset - offset to write to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6646 |
* value - value to write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6647 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6648 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6649 |
e1000_write_reg_io(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6650 |
u32 offset, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6651 |
u32 value) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6652 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6653 |
unsigned long io_addr = hw->io_base; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6654 |
unsigned long io_data = hw->io_base + 4; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6655 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6656 |
e1000_io_write(hw, io_addr, offset); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6657 |
e1000_io_write(hw, io_data, value); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6658 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6659 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6660 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6661 |
* Estimates the cable length. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6662 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6663 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6664 |
* min_length - The estimated minimum length |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6665 |
* max_length - The estimated maximum length |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6666 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6667 |
* returns: - E1000_ERR_XXX |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6668 |
* E1000_SUCCESS |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6669 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6670 |
* This function always returns a ranged length (minimum & maximum). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6671 |
* So for M88 phy's, this function interprets the one value returned from the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6672 |
* register to the minimum and maximum range. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6673 |
* For IGP phy's, the function calculates the range by the AGC registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6674 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6675 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6676 |
e1000_get_cable_length(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6677 |
u16 *min_length, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6678 |
u16 *max_length) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6679 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6680 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6681 |
u16 agc_value = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6682 |
u16 i, phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6683 |
u16 cable_length; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6684 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6685 |
DEBUGFUNC("e1000_get_cable_length"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6686 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6687 |
*min_length = *max_length = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6688 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6689 |
/* Use old method for Phy older than IGP */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6690 |
if (hw->phy_type == e1000_phy_m88) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6691 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6692 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6693 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6694 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6695 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6696 |
cable_length = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6697 |
M88E1000_PSSR_CABLE_LENGTH_SHIFT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6698 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6699 |
/* Convert the enum value to ranged values */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6700 |
switch (cable_length) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6701 |
case e1000_cable_length_50: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6702 |
*min_length = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6703 |
*max_length = e1000_igp_cable_length_50; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6704 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6705 |
case e1000_cable_length_50_80: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6706 |
*min_length = e1000_igp_cable_length_50; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6707 |
*max_length = e1000_igp_cable_length_80; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6708 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6709 |
case e1000_cable_length_80_110: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6710 |
*min_length = e1000_igp_cable_length_80; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6711 |
*max_length = e1000_igp_cable_length_110; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6712 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6713 |
case e1000_cable_length_110_140: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6714 |
*min_length = e1000_igp_cable_length_110; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6715 |
*max_length = e1000_igp_cable_length_140; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6716 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6717 |
case e1000_cable_length_140: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6718 |
*min_length = e1000_igp_cable_length_140; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6719 |
*max_length = e1000_igp_cable_length_170; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6720 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6721 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6722 |
return -E1000_ERR_PHY; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6723 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6724 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6725 |
} else if (hw->phy_type == e1000_phy_gg82563) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6726 |
ret_val = e1000_read_phy_reg(hw, GG82563_PHY_DSP_DISTANCE, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6727 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6728 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6729 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6730 |
cable_length = phy_data & GG82563_DSPD_CABLE_LENGTH; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6731 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6732 |
switch (cable_length) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6733 |
case e1000_gg_cable_length_60: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6734 |
*min_length = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6735 |
*max_length = e1000_igp_cable_length_60; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6736 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6737 |
case e1000_gg_cable_length_60_115: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6738 |
*min_length = e1000_igp_cable_length_60; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6739 |
*max_length = e1000_igp_cable_length_115; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6740 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6741 |
case e1000_gg_cable_length_115_150: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6742 |
*min_length = e1000_igp_cable_length_115; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6743 |
*max_length = e1000_igp_cable_length_150; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6744 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6745 |
case e1000_gg_cable_length_150: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6746 |
*min_length = e1000_igp_cable_length_150; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6747 |
*max_length = e1000_igp_cable_length_180; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6748 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6749 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6750 |
return -E1000_ERR_PHY; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6751 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6752 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6753 |
} else if (hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6754 |
u16 cur_agc_value; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6755 |
u16 min_agc_value = IGP01E1000_AGC_LENGTH_TABLE_SIZE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6756 |
u16 agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6757 |
{IGP01E1000_PHY_AGC_A, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6758 |
IGP01E1000_PHY_AGC_B, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6759 |
IGP01E1000_PHY_AGC_C, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6760 |
IGP01E1000_PHY_AGC_D}; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6761 |
/* Read the AGC registers for all channels */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6762 |
for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6763 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6764 |
ret_val = e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6765 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6766 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6767 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6768 |
cur_agc_value = phy_data >> IGP01E1000_AGC_LENGTH_SHIFT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6769 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6770 |
/* Value bound check. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6771 |
if ((cur_agc_value >= IGP01E1000_AGC_LENGTH_TABLE_SIZE - 1) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6772 |
(cur_agc_value == 0)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6773 |
return -E1000_ERR_PHY; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6774 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6775 |
agc_value += cur_agc_value; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6776 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6777 |
/* Update minimal AGC value. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6778 |
if (min_agc_value > cur_agc_value) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6779 |
min_agc_value = cur_agc_value; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6780 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6781 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6782 |
/* Remove the minimal AGC result for length < 50m */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6783 |
if (agc_value < IGP01E1000_PHY_CHANNEL_NUM * e1000_igp_cable_length_50) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6784 |
agc_value -= min_agc_value; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6785 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6786 |
/* Get the average length of the remaining 3 channels */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6787 |
agc_value /= (IGP01E1000_PHY_CHANNEL_NUM - 1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6788 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6789 |
/* Get the average length of all the 4 channels. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6790 |
agc_value /= IGP01E1000_PHY_CHANNEL_NUM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6791 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6792 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6793 |
/* Set the range of the calculated length. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6794 |
*min_length = ((e1000_igp_cable_length_table[agc_value] - |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6795 |
IGP01E1000_AGC_RANGE) > 0) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6796 |
(e1000_igp_cable_length_table[agc_value] - |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6797 |
IGP01E1000_AGC_RANGE) : 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6798 |
*max_length = e1000_igp_cable_length_table[agc_value] + |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6799 |
IGP01E1000_AGC_RANGE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6800 |
} else if (hw->phy_type == e1000_phy_igp_2 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6801 |
hw->phy_type == e1000_phy_igp_3) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6802 |
u16 cur_agc_index, max_agc_index = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6803 |
u16 min_agc_index = IGP02E1000_AGC_LENGTH_TABLE_SIZE - 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6804 |
u16 agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] = |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6805 |
{IGP02E1000_PHY_AGC_A, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6806 |
IGP02E1000_PHY_AGC_B, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6807 |
IGP02E1000_PHY_AGC_C, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6808 |
IGP02E1000_PHY_AGC_D}; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6809 |
/* Read the AGC registers for all channels */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6810 |
for (i = 0; i < IGP02E1000_PHY_CHANNEL_NUM; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6811 |
ret_val = e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6812 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6813 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6814 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6815 |
/* Getting bits 15:9, which represent the combination of course and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6816 |
* fine gain values. The result is a number that can be put into |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6817 |
* the lookup table to obtain the approximate cable length. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6818 |
cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) & |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6819 |
IGP02E1000_AGC_LENGTH_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6820 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6821 |
/* Array index bound check. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6822 |
if ((cur_agc_index >= IGP02E1000_AGC_LENGTH_TABLE_SIZE) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6823 |
(cur_agc_index == 0)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6824 |
return -E1000_ERR_PHY; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6825 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6826 |
/* Remove min & max AGC values from calculation. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6827 |
if (e1000_igp_2_cable_length_table[min_agc_index] > |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6828 |
e1000_igp_2_cable_length_table[cur_agc_index]) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6829 |
min_agc_index = cur_agc_index; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6830 |
if (e1000_igp_2_cable_length_table[max_agc_index] < |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6831 |
e1000_igp_2_cable_length_table[cur_agc_index]) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6832 |
max_agc_index = cur_agc_index; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6833 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6834 |
agc_value += e1000_igp_2_cable_length_table[cur_agc_index]; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6835 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6836 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6837 |
agc_value -= (e1000_igp_2_cable_length_table[min_agc_index] + |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6838 |
e1000_igp_2_cable_length_table[max_agc_index]); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6839 |
agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6840 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6841 |
/* Calculate cable length with the error range of +/- 10 meters. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6842 |
*min_length = ((agc_value - IGP02E1000_AGC_RANGE) > 0) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6843 |
(agc_value - IGP02E1000_AGC_RANGE) : 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6844 |
*max_length = agc_value + IGP02E1000_AGC_RANGE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6845 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6846 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6847 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6848 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6849 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6850 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6851 |
* Check the cable polarity |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6852 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6853 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6854 |
* polarity - output parameter : 0 - Polarity is not reversed |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6855 |
* 1 - Polarity is reversed. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6856 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6857 |
* returns: - E1000_ERR_XXX |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6858 |
* E1000_SUCCESS |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6859 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6860 |
* For phy's older then IGP, this function simply reads the polarity bit in the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6861 |
* Phy Status register. For IGP phy's, this bit is valid only if link speed is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6862 |
* 10 Mbps. If the link speed is 100 Mbps there is no polarity so this bit will |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6863 |
* return 0. If the link speed is 1000 Mbps the polarity status is in the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6864 |
* IGP01E1000_PHY_PCS_INIT_REG. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6865 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6866 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6867 |
e1000_check_polarity(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6868 |
e1000_rev_polarity *polarity) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6869 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6870 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6871 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6872 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6873 |
DEBUGFUNC("e1000_check_polarity"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6874 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6875 |
if ((hw->phy_type == e1000_phy_m88) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6876 |
(hw->phy_type == e1000_phy_gg82563)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6877 |
/* return the Polarity bit in the Status register. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6878 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6879 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6880 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6881 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6882 |
*polarity = ((phy_data & M88E1000_PSSR_REV_POLARITY) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6883 |
M88E1000_PSSR_REV_POLARITY_SHIFT) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6884 |
e1000_rev_polarity_reversed : e1000_rev_polarity_normal; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6885 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6886 |
} else if (hw->phy_type == e1000_phy_igp || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6887 |
hw->phy_type == e1000_phy_igp_3 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6888 |
hw->phy_type == e1000_phy_igp_2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6889 |
/* Read the Status register to check the speed */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6890 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6891 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6892 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6893 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6894 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6895 |
/* If speed is 1000 Mbps, must read the IGP01E1000_PHY_PCS_INIT_REG to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6896 |
* find the polarity status */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6897 |
if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) == |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6898 |
IGP01E1000_PSSR_SPEED_1000MBPS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6899 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6900 |
/* Read the GIG initialization PCS register (0x00B4) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6901 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PCS_INIT_REG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6902 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6903 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6904 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6905 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6906 |
/* Check the polarity bits */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6907 |
*polarity = (phy_data & IGP01E1000_PHY_POLARITY_MASK) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6908 |
e1000_rev_polarity_reversed : e1000_rev_polarity_normal; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6909 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6910 |
/* For 10 Mbps, read the polarity bit in the status register. (for |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6911 |
* 100 Mbps this bit is always 0) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6912 |
*polarity = (phy_data & IGP01E1000_PSSR_POLARITY_REVERSED) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6913 |
e1000_rev_polarity_reversed : e1000_rev_polarity_normal; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6914 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6915 |
} else if (hw->phy_type == e1000_phy_ife) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6916 |
ret_val = e1000_read_phy_reg(hw, IFE_PHY_EXTENDED_STATUS_CONTROL, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6917 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6918 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6919 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6920 |
*polarity = ((phy_data & IFE_PESC_POLARITY_REVERSED) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6921 |
IFE_PESC_POLARITY_REVERSED_SHIFT) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6922 |
e1000_rev_polarity_reversed : e1000_rev_polarity_normal; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6923 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6924 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6925 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6926 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6927 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6928 |
* Check if Downshift occured |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6929 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6930 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6931 |
* downshift - output parameter : 0 - No Downshift ocured. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6932 |
* 1 - Downshift ocured. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6933 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6934 |
* returns: - E1000_ERR_XXX |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6935 |
* E1000_SUCCESS |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6936 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6937 |
* For phy's older then IGP, this function reads the Downshift bit in the Phy |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6938 |
* Specific Status register. For IGP phy's, it reads the Downgrade bit in the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6939 |
* Link Health register. In IGP this bit is latched high, so the driver must |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6940 |
* read it immediately after link is established. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6941 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6942 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6943 |
e1000_check_downshift(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6944 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6945 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6946 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6947 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6948 |
DEBUGFUNC("e1000_check_downshift"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6949 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6950 |
if (hw->phy_type == e1000_phy_igp || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6951 |
hw->phy_type == e1000_phy_igp_3 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6952 |
hw->phy_type == e1000_phy_igp_2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6953 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6954 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6955 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6956 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6957 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6958 |
hw->speed_downgraded = (phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6959 |
} else if ((hw->phy_type == e1000_phy_m88) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6960 |
(hw->phy_type == e1000_phy_gg82563)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6961 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6962 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6963 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6964 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6965 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6966 |
hw->speed_downgraded = (phy_data & M88E1000_PSSR_DOWNSHIFT) >> |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6967 |
M88E1000_PSSR_DOWNSHIFT_SHIFT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6968 |
} else if (hw->phy_type == e1000_phy_ife) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6969 |
/* e1000_phy_ife supports 10/100 speed only */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6970 |
hw->speed_downgraded = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6971 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6972 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6973 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6974 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6975 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6976 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6977 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6978 |
* 82541_rev_2 & 82547_rev_2 have the capability to configure the DSP when a |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6979 |
* gigabit link is achieved to improve link quality. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6980 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6981 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6982 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6983 |
* returns: - E1000_ERR_PHY if fail to read/write the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6984 |
* E1000_SUCCESS at any other case. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6985 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6986 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6987 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6988 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6989 |
e1000_config_dsp_after_link_change(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6990 |
bool link_up) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6991 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6992 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6993 |
u16 phy_data, phy_saved_data, speed, duplex, i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6994 |
u16 dsp_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6995 |
{IGP01E1000_PHY_AGC_PARAM_A, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6996 |
IGP01E1000_PHY_AGC_PARAM_B, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6997 |
IGP01E1000_PHY_AGC_PARAM_C, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6998 |
IGP01E1000_PHY_AGC_PARAM_D}; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6999 |
u16 min_length, max_length; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7000 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7001 |
DEBUGFUNC("e1000_config_dsp_after_link_change"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7002 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7003 |
if (hw->phy_type != e1000_phy_igp) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7004 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7005 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7006 |
if (link_up) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7007 |
ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7008 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7009 |
DEBUGOUT("Error getting link speed and duplex\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7010 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7011 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7012 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7013 |
if (speed == SPEED_1000) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7014 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7015 |
ret_val = e1000_get_cable_length(hw, &min_length, &max_length); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7016 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7017 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7018 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7019 |
if ((hw->dsp_config_state == e1000_dsp_config_enabled) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7020 |
min_length >= e1000_igp_cable_length_50) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7021 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7022 |
for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7023 |
ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7024 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7025 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7026 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7027 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7028 |
phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7029 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7030 |
ret_val = e1000_write_phy_reg(hw, dsp_reg_array[i], |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7031 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7032 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7033 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7034 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7035 |
hw->dsp_config_state = e1000_dsp_config_activated; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7036 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7037 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7038 |
if ((hw->ffe_config_state == e1000_ffe_config_enabled) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7039 |
(min_length < e1000_igp_cable_length_50)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7040 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7041 |
u16 ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_20; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7042 |
u32 idle_errs = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7043 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7044 |
/* clear previous idle error counts */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7045 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7046 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7047 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7048 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7049 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7050 |
for (i = 0; i < ffe_idle_err_timeout; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7051 |
udelay(1000); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7052 |
ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7053 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7054 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7055 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7056 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7057 |
idle_errs += (phy_data & SR_1000T_IDLE_ERROR_CNT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7058 |
if (idle_errs > SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7059 |
hw->ffe_config_state = e1000_ffe_config_active; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7060 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7061 |
ret_val = e1000_write_phy_reg(hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7062 |
IGP01E1000_PHY_DSP_FFE, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7063 |
IGP01E1000_PHY_DSP_FFE_CM_CP); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7064 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7065 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7066 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7067 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7068 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7069 |
if (idle_errs) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7070 |
ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_100; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7071 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7072 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7073 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7074 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7075 |
if (hw->dsp_config_state == e1000_dsp_config_activated) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7076 |
/* Save off the current value of register 0x2F5B to be restored at |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7077 |
* the end of the routines. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7078 |
ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7079 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7080 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7081 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7082 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7083 |
/* Disable the PHY transmitter */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7084 |
ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7085 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7086 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7087 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7088 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7089 |
mdelay(20); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7090 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7091 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7092 |
IGP01E1000_IEEE_FORCE_GIGA); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7093 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7094 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7095 |
for (i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7096 |
ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7097 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7098 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7099 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7100 |
phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7101 |
phy_data |= IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7102 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7103 |
ret_val = e1000_write_phy_reg(hw,dsp_reg_array[i], phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7104 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7105 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7106 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7107 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7108 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7109 |
IGP01E1000_IEEE_RESTART_AUTONEG); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7110 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7111 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7112 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7113 |
mdelay(20); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7114 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7115 |
/* Now enable the transmitter */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7116 |
ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7117 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7118 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7119 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7120 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7121 |
hw->dsp_config_state = e1000_dsp_config_enabled; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7122 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7123 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7124 |
if (hw->ffe_config_state == e1000_ffe_config_active) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7125 |
/* Save off the current value of register 0x2F5B to be restored at |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7126 |
* the end of the routines. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7127 |
ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7128 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7129 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7130 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7131 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7132 |
/* Disable the PHY transmitter */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7133 |
ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7134 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7135 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7136 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7137 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7138 |
mdelay(20); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7139 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7140 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7141 |
IGP01E1000_IEEE_FORCE_GIGA); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7142 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7143 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7144 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_DSP_FFE, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7145 |
IGP01E1000_PHY_DSP_FFE_DEFAULT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7146 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7147 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7148 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7149 |
ret_val = e1000_write_phy_reg(hw, 0x0000, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7150 |
IGP01E1000_IEEE_RESTART_AUTONEG); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7151 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7152 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7153 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7154 |
mdelay(20); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7155 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7156 |
/* Now enable the transmitter */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7157 |
ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7158 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7159 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7160 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7161 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7162 |
hw->ffe_config_state = e1000_ffe_config_enabled; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7163 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7164 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7165 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7166 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7167 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7168 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7169 |
* Set PHY to class A mode |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7170 |
* Assumes the following operations will follow to enable the new class mode. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7171 |
* 1. Do a PHY soft reset |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7172 |
* 2. Restart auto-negotiation or force link. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7173 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7174 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7175 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7176 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7177 |
e1000_set_phy_mode(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7178 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7179 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7180 |
u16 eeprom_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7181 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7182 |
DEBUGFUNC("e1000_set_phy_mode"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7183 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7184 |
if ((hw->mac_type == e1000_82545_rev_3) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7185 |
(hw->media_type == e1000_media_type_copper)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7186 |
ret_val = e1000_read_eeprom(hw, EEPROM_PHY_CLASS_WORD, 1, &eeprom_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7187 |
if (ret_val) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7188 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7189 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7190 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7191 |
if ((eeprom_data != EEPROM_RESERVED_WORD) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7192 |
(eeprom_data & EEPROM_PHY_CLASS_A)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7193 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x000B); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7194 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7195 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7196 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x8104); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7197 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7198 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7199 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7200 |
hw->phy_reset_disable = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7201 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7202 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7203 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7204 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7205 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7206 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7207 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7208 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7209 |
* This function sets the lplu state according to the active flag. When |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7210 |
* activating lplu this function also disables smart speed and vise versa. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7211 |
* lplu will not be activated unless the device autonegotiation advertisment |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7212 |
* meets standards of either 10 or 10/100 or 10/100/1000 at all duplexes. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7213 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7214 |
* active - true to enable lplu false to disable lplu. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7215 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7216 |
* returns: - E1000_ERR_PHY if fail to read/write the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7217 |
* E1000_SUCCESS at any other case. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7218 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7219 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7220 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7221 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7222 |
e1000_set_d3_lplu_state(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7223 |
bool active) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7224 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7225 |
u32 phy_ctrl = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7226 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7227 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7228 |
DEBUGFUNC("e1000_set_d3_lplu_state"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7229 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7230 |
if (hw->phy_type != e1000_phy_igp && hw->phy_type != e1000_phy_igp_2 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7231 |
&& hw->phy_type != e1000_phy_igp_3) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7232 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7233 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7234 |
/* During driver activity LPLU should not be used or it will attain link |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7235 |
* from the lowest speeds starting from 10Mbps. The capability is used for |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7236 |
* Dx transitions and states */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7237 |
if (hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7238 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7239 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7240 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7241 |
} else if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7242 |
/* MAC writes into PHY register based on the state transition |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7243 |
* and start auto-negotiation. SW driver can overwrite the settings |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7244 |
* in CSR PHY power control E1000_PHY_CTRL register. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7245 |
phy_ctrl = E1000_READ_REG(hw, PHY_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7246 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7247 |
ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7248 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7249 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7250 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7251 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7252 |
if (!active) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7253 |
if (hw->mac_type == e1000_82541_rev_2 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7254 |
hw->mac_type == e1000_82547_rev_2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7255 |
phy_data &= ~IGP01E1000_GMII_FLEX_SPD; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7256 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7257 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7258 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7259 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7260 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7261 |
phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7262 |
E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7263 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7264 |
phy_data &= ~IGP02E1000_PM_D3_LPLU; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7265 |
ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7266 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7267 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7268 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7269 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7270 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7271 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7272 |
/* LPLU and SmartSpeed are mutually exclusive. LPLU is used during |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7273 |
* Dx states where the power conservation is most important. During |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7274 |
* driver activity we should enable SmartSpeed, so performance is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7275 |
* maintained. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7276 |
if (hw->smart_speed == e1000_smart_speed_on) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7277 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7278 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7279 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7280 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7281 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7282 |
phy_data |= IGP01E1000_PSCFR_SMART_SPEED; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7283 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7284 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7285 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7286 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7287 |
} else if (hw->smart_speed == e1000_smart_speed_off) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7288 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7289 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7290 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7291 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7292 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7293 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7294 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7295 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7296 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7297 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7298 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7299 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7300 |
} else if ((hw->autoneg_advertised == AUTONEG_ADVERTISE_SPEED_DEFAULT) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7301 |
(hw->autoneg_advertised == AUTONEG_ADVERTISE_10_ALL ) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7302 |
(hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7303 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7304 |
if (hw->mac_type == e1000_82541_rev_2 || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7305 |
hw->mac_type == e1000_82547_rev_2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7306 |
phy_data |= IGP01E1000_GMII_FLEX_SPD; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7307 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7308 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7309 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7310 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7311 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7312 |
phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7313 |
E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7314 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7315 |
phy_data |= IGP02E1000_PM_D3_LPLU; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7316 |
ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7317 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7318 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7319 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7320 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7321 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7322 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7323 |
/* When LPLU is enabled we should disable SmartSpeed */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7324 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7325 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7326 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7327 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7328 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7329 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7330 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7331 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7332 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7333 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7334 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7335 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7336 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7337 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7338 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7339 |
* This function sets the lplu d0 state according to the active flag. When |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7340 |
* activating lplu this function also disables smart speed and vise versa. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7341 |
* lplu will not be activated unless the device autonegotiation advertisment |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7342 |
* meets standards of either 10 or 10/100 or 10/100/1000 at all duplexes. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7343 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7344 |
* active - true to enable lplu false to disable lplu. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7345 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7346 |
* returns: - E1000_ERR_PHY if fail to read/write the PHY |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7347 |
* E1000_SUCCESS at any other case. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7348 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7349 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7350 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7351 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7352 |
e1000_set_d0_lplu_state(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7353 |
bool active) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7354 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7355 |
u32 phy_ctrl = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7356 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7357 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7358 |
DEBUGFUNC("e1000_set_d0_lplu_state"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7359 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7360 |
if (hw->mac_type <= e1000_82547_rev_2) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7361 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7362 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7363 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7364 |
phy_ctrl = E1000_READ_REG(hw, PHY_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7365 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7366 |
ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7367 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7368 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7369 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7370 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7371 |
if (!active) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7372 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7373 |
phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7374 |
E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7375 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7376 |
phy_data &= ~IGP02E1000_PM_D0_LPLU; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7377 |
ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7378 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7379 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7380 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7381 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7382 |
/* LPLU and SmartSpeed are mutually exclusive. LPLU is used during |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7383 |
* Dx states where the power conservation is most important. During |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7384 |
* driver activity we should enable SmartSpeed, so performance is |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7385 |
* maintained. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7386 |
if (hw->smart_speed == e1000_smart_speed_on) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7387 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7388 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7389 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7390 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7391 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7392 |
phy_data |= IGP01E1000_PSCFR_SMART_SPEED; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7393 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7394 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7395 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7396 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7397 |
} else if (hw->smart_speed == e1000_smart_speed_off) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7398 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7399 |
&phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7400 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7401 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7402 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7403 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7404 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7405 |
phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7406 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7407 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7408 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7409 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7410 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7411 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7412 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7413 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7414 |
phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7415 |
E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7416 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7417 |
phy_data |= IGP02E1000_PM_D0_LPLU; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7418 |
ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7419 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7420 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7421 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7422 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7423 |
/* When LPLU is enabled we should disable SmartSpeed */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7424 |
ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7425 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7426 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7427 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7428 |
phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7429 |
ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7430 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7431 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7432 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7433 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7434 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7435 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7436 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7437 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7438 |
* Change VCO speed register to improve Bit Error Rate performance of SERDES. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7439 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7440 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7441 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7442 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7443 |
e1000_set_vco_speed(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7444 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7445 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7446 |
u16 default_page = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7447 |
u16 phy_data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7448 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7449 |
DEBUGFUNC("e1000_set_vco_speed"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7450 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7451 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7452 |
case e1000_82545_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7453 |
case e1000_82546_rev_3: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7454 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7455 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7456 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7457 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7458 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7459 |
/* Set PHY register 30, page 5, bit 8 to 0 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7460 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7461 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, &default_page); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7462 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7463 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7464 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7465 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0005); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7466 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7467 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7468 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7469 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7470 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7471 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7472 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7473 |
phy_data &= ~M88E1000_PHY_VCO_REG_BIT8; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7474 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7475 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7476 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7477 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7478 |
/* Set PHY register 30, page 4, bit 11 to 1 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7479 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7480 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0004); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7481 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7482 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7483 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7484 |
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, &phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7485 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7486 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7487 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7488 |
phy_data |= M88E1000_PHY_VCO_REG_BIT11; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7489 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, phy_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7490 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7491 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7492 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7493 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, default_page); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7494 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7495 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7496 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7497 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7498 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7499 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7500 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7501 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7502 |
* This function reads the cookie from ARC ram. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7503 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7504 |
* returns: - E1000_SUCCESS . |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7505 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7506 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7507 |
e1000_host_if_read_cookie(struct e1000_hw * hw, u8 *buffer) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7508 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7509 |
u8 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7510 |
u32 offset = E1000_MNG_DHCP_COOKIE_OFFSET; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7511 |
u8 length = E1000_MNG_DHCP_COOKIE_LENGTH; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7512 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7513 |
length = (length >> 2); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7514 |
offset = (offset >> 2); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7515 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7516 |
for (i = 0; i < length; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7517 |
*((u32 *) buffer + i) = |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7518 |
E1000_READ_REG_ARRAY_DWORD(hw, HOST_IF, offset + i); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7519 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7520 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7521 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7522 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7523 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7524 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7525 |
* This function checks whether the HOST IF is enabled for command operaton |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7526 |
* and also checks whether the previous command is completed. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7527 |
* It busy waits in case of previous command is not completed. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7528 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7529 |
* returns: - E1000_ERR_HOST_INTERFACE_COMMAND in case if is not ready or |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7530 |
* timeout |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7531 |
* - E1000_SUCCESS for success. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7532 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7533 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7534 |
e1000_mng_enable_host_if(struct e1000_hw * hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7535 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7536 |
u32 hicr; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7537 |
u8 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7538 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7539 |
/* Check that the host interface is enabled. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7540 |
hicr = E1000_READ_REG(hw, HICR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7541 |
if ((hicr & E1000_HICR_EN) == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7542 |
DEBUGOUT("E1000_HOST_EN bit disabled.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7543 |
return -E1000_ERR_HOST_INTERFACE_COMMAND; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7544 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7545 |
/* check the previous command is completed */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7546 |
for (i = 0; i < E1000_MNG_DHCP_COMMAND_TIMEOUT; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7547 |
hicr = E1000_READ_REG(hw, HICR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7548 |
if (!(hicr & E1000_HICR_C)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7549 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7550 |
mdelay(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7551 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7552 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7553 |
if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7554 |
DEBUGOUT("Previous command timeout failed .\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7555 |
return -E1000_ERR_HOST_INTERFACE_COMMAND; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7556 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7557 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7558 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7559 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7560 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7561 |
* This function writes the buffer content at the offset given on the host if. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7562 |
* It also does alignment considerations to do the writes in most efficient way. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7563 |
* Also fills up the sum of the buffer in *buffer parameter. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7564 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7565 |
* returns - E1000_SUCCESS for success. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7566 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7567 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7568 |
e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7569 |
u16 length, u16 offset, u8 *sum) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7570 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7571 |
u8 *tmp; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7572 |
u8 *bufptr = buffer; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7573 |
u32 data = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7574 |
u16 remaining, i, j, prev_bytes; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7575 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7576 |
/* sum = only sum of the data and it is not checksum */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7577 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7578 |
if (length == 0 || offset + length > E1000_HI_MAX_MNG_DATA_LENGTH) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7579 |
return -E1000_ERR_PARAM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7580 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7581 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7582 |
tmp = (u8 *)&data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7583 |
prev_bytes = offset & 0x3; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7584 |
offset &= 0xFFFC; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7585 |
offset >>= 2; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7586 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7587 |
if (prev_bytes) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7588 |
data = E1000_READ_REG_ARRAY_DWORD(hw, HOST_IF, offset); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7589 |
for (j = prev_bytes; j < sizeof(u32); j++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7590 |
*(tmp + j) = *bufptr++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7591 |
*sum += *(tmp + j); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7592 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7593 |
E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, offset, data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7594 |
length -= j - prev_bytes; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7595 |
offset++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7596 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7597 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7598 |
remaining = length & 0x3; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7599 |
length -= remaining; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7600 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7601 |
/* Calculate length in DWORDs */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7602 |
length >>= 2; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7603 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7604 |
/* The device driver writes the relevant command block into the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7605 |
* ram area. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7606 |
for (i = 0; i < length; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7607 |
for (j = 0; j < sizeof(u32); j++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7608 |
*(tmp + j) = *bufptr++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7609 |
*sum += *(tmp + j); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7610 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7611 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7612 |
E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, offset + i, data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7613 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7614 |
if (remaining) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7615 |
for (j = 0; j < sizeof(u32); j++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7616 |
if (j < remaining) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7617 |
*(tmp + j) = *bufptr++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7618 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7619 |
*(tmp + j) = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7620 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7621 |
*sum += *(tmp + j); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7622 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7623 |
E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, offset + i, data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7624 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7625 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7626 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7627 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7628 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7629 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7630 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7631 |
* This function writes the command header after does the checksum calculation. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7632 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7633 |
* returns - E1000_SUCCESS for success. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7634 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7635 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7636 |
e1000_mng_write_cmd_header(struct e1000_hw * hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7637 |
struct e1000_host_mng_command_header * hdr) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7638 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7639 |
u16 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7640 |
u8 sum; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7641 |
u8 *buffer; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7642 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7643 |
/* Write the whole command header structure which includes sum of |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7644 |
* the buffer */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7645 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7646 |
u16 length = sizeof(struct e1000_host_mng_command_header); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7647 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7648 |
sum = hdr->checksum; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7649 |
hdr->checksum = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7650 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7651 |
buffer = (u8 *) hdr; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7652 |
i = length; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7653 |
while (i--) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7654 |
sum += buffer[i]; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7655 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7656 |
hdr->checksum = 0 - sum; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7657 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7658 |
length >>= 2; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7659 |
/* The device driver writes the relevant command block into the ram area. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7660 |
for (i = 0; i < length; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7661 |
E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, i, *((u32 *) hdr + i)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7662 |
E1000_WRITE_FLUSH(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7663 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7664 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7665 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7666 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7667 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7668 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7669 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7670 |
* This function indicates to ARC that a new command is pending which completes |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7671 |
* one write operation by the driver. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7672 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7673 |
* returns - E1000_SUCCESS for success. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7674 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7675 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7676 |
e1000_mng_write_commit(struct e1000_hw * hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7677 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7678 |
u32 hicr; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7679 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7680 |
hicr = E1000_READ_REG(hw, HICR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7681 |
/* Setting this bit tells the ARC that a new command is pending. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7682 |
E1000_WRITE_REG(hw, HICR, hicr | E1000_HICR_C); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7683 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7684 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7685 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7686 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7687 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7688 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7689 |
* This function checks the mode of the firmware. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7690 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7691 |
* returns - true when the mode is IAMT or false. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7692 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7693 |
bool |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7694 |
e1000_check_mng_mode(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7695 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7696 |
u32 fwsm; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7697 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7698 |
fwsm = E1000_READ_REG(hw, FWSM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7699 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7700 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7701 |
if ((fwsm & E1000_FWSM_MODE_MASK) == |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7702 |
(E1000_MNG_ICH_IAMT_MODE << E1000_FWSM_MODE_SHIFT)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7703 |
return true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7704 |
} else if ((fwsm & E1000_FWSM_MODE_MASK) == |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7705 |
(E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7706 |
return true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7707 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7708 |
return false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7709 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7710 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7711 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7712 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7713 |
* This function writes the dhcp info . |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7714 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7715 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7716 |
e1000_mng_write_dhcp_info(struct e1000_hw * hw, u8 *buffer, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7717 |
u16 length) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7718 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7719 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7720 |
struct e1000_host_mng_command_header hdr; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7721 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7722 |
hdr.command_id = E1000_MNG_DHCP_TX_PAYLOAD_CMD; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7723 |
hdr.command_length = length; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7724 |
hdr.reserved1 = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7725 |
hdr.reserved2 = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7726 |
hdr.checksum = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7727 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7728 |
ret_val = e1000_mng_enable_host_if(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7729 |
if (ret_val == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7730 |
ret_val = e1000_mng_host_if_write(hw, buffer, length, sizeof(hdr), |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7731 |
&(hdr.checksum)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7732 |
if (ret_val == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7733 |
ret_val = e1000_mng_write_cmd_header(hw, &hdr); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7734 |
if (ret_val == E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7735 |
ret_val = e1000_mng_write_commit(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7736 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7737 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7738 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7739 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7740 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7741 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7742 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7743 |
* This function calculates the checksum. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7744 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7745 |
* returns - checksum of buffer contents. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7746 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7747 |
static u8 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7748 |
e1000_calculate_mng_checksum(char *buffer, u32 length) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7749 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7750 |
u8 sum = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7751 |
u32 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7752 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7753 |
if (!buffer) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7754 |
return 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7755 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7756 |
for (i=0; i < length; i++) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7757 |
sum += buffer[i]; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7758 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7759 |
return (u8) (0 - sum); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7760 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7761 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7762 |
/***************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7763 |
* This function checks whether tx pkt filtering needs to be enabled or not. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7764 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7765 |
* returns - true for packet filtering or false. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7766 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7767 |
bool |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7768 |
e1000_enable_tx_pkt_filtering(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7769 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7770 |
/* called in init as well as watchdog timer functions */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7771 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7772 |
s32 ret_val, checksum; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7773 |
bool tx_filter = false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7774 |
struct e1000_host_mng_dhcp_cookie *hdr = &(hw->mng_cookie); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7775 |
u8 *buffer = (u8 *) &(hw->mng_cookie); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7776 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7777 |
if (e1000_check_mng_mode(hw)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7778 |
ret_val = e1000_mng_enable_host_if(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7779 |
if (ret_val == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7780 |
ret_val = e1000_host_if_read_cookie(hw, buffer); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7781 |
if (ret_val == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7782 |
checksum = hdr->checksum; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7783 |
hdr->checksum = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7784 |
if ((hdr->signature == E1000_IAMT_SIGNATURE) && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7785 |
checksum == e1000_calculate_mng_checksum((char *)buffer, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7786 |
E1000_MNG_DHCP_COOKIE_LENGTH)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7787 |
if (hdr->status & |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7788 |
E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7789 |
tx_filter = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7790 |
} else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7791 |
tx_filter = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7792 |
} else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7793 |
tx_filter = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7794 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7795 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7796 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7797 |
hw->tx_pkt_filtering = tx_filter; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7798 |
return tx_filter; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7799 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7800 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7801 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7802 |
* Verifies the hardware needs to allow ARPs to be processed by the host |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7803 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7804 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7805 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7806 |
* returns: - true/false |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7807 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7808 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7809 |
u32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7810 |
e1000_enable_mng_pass_thru(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7811 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7812 |
u32 manc; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7813 |
u32 fwsm, factps; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7814 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7815 |
if (hw->asf_firmware_present) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7816 |
manc = E1000_READ_REG(hw, MANC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7817 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7818 |
if (!(manc & E1000_MANC_RCV_TCO_EN) || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7819 |
!(manc & E1000_MANC_EN_MAC_ADDR_FILTER)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7820 |
return false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7821 |
if (e1000_arc_subsystem_valid(hw)) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7822 |
fwsm = E1000_READ_REG(hw, FWSM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7823 |
factps = E1000_READ_REG(hw, FACTPS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7824 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7825 |
if ((((fwsm & E1000_FWSM_MODE_MASK) >> E1000_FWSM_MODE_SHIFT) == |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7826 |
e1000_mng_mode_pt) && !(factps & E1000_FACTPS_MNGCG)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7827 |
return true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7828 |
} else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7829 |
if ((manc & E1000_MANC_SMBUS_EN) && !(manc & E1000_MANC_ASF_EN)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7830 |
return true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7831 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7832 |
return false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7833 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7834 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7835 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7836 |
e1000_polarity_reversal_workaround(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7837 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7838 |
s32 ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7839 |
u16 mii_status_reg; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7840 |
u16 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7841 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7842 |
/* Polarity reversal workaround for forced 10F/10H links. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7843 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7844 |
/* Disable the transmitter on the PHY */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7845 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7846 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7847 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7848 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7849 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFFF); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7850 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7851 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7852 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7853 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7854 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7855 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7856 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7857 |
/* This loop will early-out if the NO link condition has been met. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7858 |
for (i = PHY_FORCE_TIME; i > 0; i--) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7859 |
/* Read the MII Status Register and wait for Link Status bit |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7860 |
* to be clear. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7861 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7862 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7863 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7864 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7865 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7866 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7867 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7868 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7869 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7870 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7871 |
if ((mii_status_reg & ~MII_SR_LINK_STATUS) == 0) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7872 |
mdelay(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7873 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7874 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7875 |
/* Recommended delay time after link has been lost */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7876 |
mdelay(1000); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7877 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7878 |
/* Now we will re-enable th transmitter on the PHY */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7879 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7880 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7881 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7882 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7883 |
mdelay(50); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7884 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFF0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7885 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7886 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7887 |
mdelay(50); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7888 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFF00); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7889 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7890 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7891 |
mdelay(50); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7892 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x0000); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7893 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7894 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7895 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7896 |
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7897 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7898 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7899 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7900 |
/* This loop will early-out if the link condition has been met. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7901 |
for (i = PHY_FORCE_TIME; i > 0; i--) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7902 |
/* Read the MII Status Register and wait for Link Status bit |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7903 |
* to be set. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7904 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7905 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7906 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7907 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7908 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7909 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7910 |
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7911 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7912 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7913 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7914 |
if (mii_status_reg & MII_SR_LINK_STATUS) break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7915 |
mdelay(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7916 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7917 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7918 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7919 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7920 |
/*************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7921 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7922 |
* Disables PCI-Express master access. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7923 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7924 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7925 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7926 |
* returns: - none. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7927 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7928 |
***************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7929 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7930 |
e1000_set_pci_express_master_disable(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7931 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7932 |
u32 ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7933 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7934 |
DEBUGFUNC("e1000_set_pci_express_master_disable"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7935 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7936 |
if (hw->bus_type != e1000_bus_type_pci_express) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7937 |
return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7938 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7939 |
ctrl = E1000_READ_REG(hw, CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7940 |
ctrl |= E1000_CTRL_GIO_MASTER_DISABLE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7941 |
E1000_WRITE_REG(hw, CTRL, ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7942 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7943 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7944 |
/******************************************************************************* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7945 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7946 |
* Disables PCI-Express master access and verifies there are no pending requests |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7947 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7948 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7949 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7950 |
* returns: - E1000_ERR_MASTER_REQUESTS_PENDING if master disable bit hasn't |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7951 |
* caused the master requests to be disabled. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7952 |
* E1000_SUCCESS master requests disabled. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7953 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7954 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7955 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7956 |
e1000_disable_pciex_master(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7957 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7958 |
s32 timeout = MASTER_DISABLE_TIMEOUT; /* 80ms */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7959 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7960 |
DEBUGFUNC("e1000_disable_pciex_master"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7961 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7962 |
if (hw->bus_type != e1000_bus_type_pci_express) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7963 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7964 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7965 |
e1000_set_pci_express_master_disable(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7966 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7967 |
while (timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7968 |
if (!(E1000_READ_REG(hw, STATUS) & E1000_STATUS_GIO_MASTER_ENABLE)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7969 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7970 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7971 |
udelay(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7972 |
timeout--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7973 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7974 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7975 |
if (!timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7976 |
DEBUGOUT("Master requests are pending.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7977 |
return -E1000_ERR_MASTER_REQUESTS_PENDING; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7978 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7979 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7980 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7981 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7982 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7983 |
/******************************************************************************* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7984 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7985 |
* Check for EEPROM Auto Read bit done. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7986 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7987 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7988 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7989 |
* returns: - E1000_ERR_RESET if fail to reset MAC |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7990 |
* E1000_SUCCESS at any other case. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7991 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7992 |
******************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7993 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7994 |
e1000_get_auto_rd_done(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7995 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7996 |
s32 timeout = AUTO_READ_DONE_TIMEOUT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7997 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7998 |
DEBUGFUNC("e1000_get_auto_rd_done"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7999 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8000 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8001 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8002 |
msleep(5); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8003 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8004 |
case e1000_82571: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8005 |
case e1000_82572: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8006 |
case e1000_82573: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8007 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8008 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8009 |
while (timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8010 |
if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8011 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8012 |
else msleep(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8013 |
timeout--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8014 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8015 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8016 |
if (!timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8017 |
DEBUGOUT("Auto read by HW from EEPROM has not completed.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8018 |
return -E1000_ERR_RESET; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8019 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8020 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8021 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8022 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8023 |
/* PHY configuration from NVM just starts after EECD_AUTO_RD sets to high. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8024 |
* Need to wait for PHY configuration completion before accessing NVM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8025 |
* and PHY. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8026 |
if (hw->mac_type == e1000_82573) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8027 |
msleep(25); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8028 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8029 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8030 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8031 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8032 |
/*************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8033 |
* Checks if the PHY configuration is done |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8034 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8035 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8036 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8037 |
* returns: - E1000_ERR_RESET if fail to reset MAC |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8038 |
* E1000_SUCCESS at any other case. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8039 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8040 |
***************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8041 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8042 |
e1000_get_phy_cfg_done(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8043 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8044 |
s32 timeout = PHY_CFG_TIMEOUT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8045 |
u32 cfg_mask = E1000_EEPROM_CFG_DONE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8046 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8047 |
DEBUGFUNC("e1000_get_phy_cfg_done"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8048 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8049 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8050 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8051 |
mdelay(10); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8052 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8053 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8054 |
/* Separate *_CFG_DONE_* bit for each port */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8055 |
if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8056 |
cfg_mask = E1000_EEPROM_CFG_DONE_PORT_1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8057 |
/* Fall Through */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8058 |
case e1000_82571: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8059 |
case e1000_82572: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8060 |
while (timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8061 |
if (E1000_READ_REG(hw, EEMNGCTL) & cfg_mask) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8062 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8063 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8064 |
msleep(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8065 |
timeout--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8066 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8067 |
if (!timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8068 |
DEBUGOUT("MNG configuration cycle has not completed.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8069 |
return -E1000_ERR_RESET; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8070 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8071 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8072 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8073 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8074 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8075 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8076 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8077 |
/*************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8078 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8079 |
* Using the combination of SMBI and SWESMBI semaphore bits when resetting |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8080 |
* adapter or Eeprom access. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8081 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8082 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8083 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8084 |
* returns: - E1000_ERR_EEPROM if fail to access EEPROM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8085 |
* E1000_SUCCESS at any other case. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8086 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8087 |
***************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8088 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8089 |
e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8090 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8091 |
s32 timeout; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8092 |
u32 swsm; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8093 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8094 |
DEBUGFUNC("e1000_get_hw_eeprom_semaphore"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8095 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8096 |
if (!hw->eeprom_semaphore_present) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8097 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8098 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8099 |
if (hw->mac_type == e1000_80003es2lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8100 |
/* Get the SW semaphore. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8101 |
if (e1000_get_software_semaphore(hw) != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8102 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8103 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8104 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8105 |
/* Get the FW semaphore. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8106 |
timeout = hw->eeprom.word_size + 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8107 |
while (timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8108 |
swsm = E1000_READ_REG(hw, SWSM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8109 |
swsm |= E1000_SWSM_SWESMBI; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8110 |
E1000_WRITE_REG(hw, SWSM, swsm); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8111 |
/* if we managed to set the bit we got the semaphore. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8112 |
swsm = E1000_READ_REG(hw, SWSM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8113 |
if (swsm & E1000_SWSM_SWESMBI) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8114 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8115 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8116 |
udelay(50); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8117 |
timeout--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8118 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8119 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8120 |
if (!timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8121 |
/* Release semaphores */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8122 |
e1000_put_hw_eeprom_semaphore(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8123 |
DEBUGOUT("Driver can't access the Eeprom - SWESMBI bit is set.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8124 |
return -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8125 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8126 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8127 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8128 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8129 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8130 |
/*************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8131 |
* This function clears HW semaphore bits. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8132 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8133 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8134 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8135 |
* returns: - None. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8136 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8137 |
***************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8138 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8139 |
e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8140 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8141 |
u32 swsm; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8142 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8143 |
DEBUGFUNC("e1000_put_hw_eeprom_semaphore"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8144 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8145 |
if (!hw->eeprom_semaphore_present) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8146 |
return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8147 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8148 |
swsm = E1000_READ_REG(hw, SWSM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8149 |
if (hw->mac_type == e1000_80003es2lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8150 |
/* Release both semaphores. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8151 |
swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8152 |
} else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8153 |
swsm &= ~(E1000_SWSM_SWESMBI); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8154 |
E1000_WRITE_REG(hw, SWSM, swsm); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8155 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8156 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8157 |
/*************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8158 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8159 |
* Obtaining software semaphore bit (SMBI) before resetting PHY. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8160 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8161 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8162 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8163 |
* returns: - E1000_ERR_RESET if fail to obtain semaphore. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8164 |
* E1000_SUCCESS at any other case. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8165 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8166 |
***************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8167 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8168 |
e1000_get_software_semaphore(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8169 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8170 |
s32 timeout = hw->eeprom.word_size + 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8171 |
u32 swsm; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8172 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8173 |
DEBUGFUNC("e1000_get_software_semaphore"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8174 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8175 |
if (hw->mac_type != e1000_80003es2lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8176 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8177 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8178 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8179 |
while (timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8180 |
swsm = E1000_READ_REG(hw, SWSM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8181 |
/* If SMBI bit cleared, it is now set and we hold the semaphore */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8182 |
if (!(swsm & E1000_SWSM_SMBI)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8183 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8184 |
mdelay(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8185 |
timeout--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8186 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8187 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8188 |
if (!timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8189 |
DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8190 |
return -E1000_ERR_RESET; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8191 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8192 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8193 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8194 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8195 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8196 |
/*************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8197 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8198 |
* Release semaphore bit (SMBI). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8199 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8200 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8201 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8202 |
***************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8203 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8204 |
e1000_release_software_semaphore(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8205 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8206 |
u32 swsm; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8207 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8208 |
DEBUGFUNC("e1000_release_software_semaphore"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8209 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8210 |
if (hw->mac_type != e1000_80003es2lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8211 |
return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8212 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8213 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8214 |
swsm = E1000_READ_REG(hw, SWSM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8215 |
/* Release the SW semaphores.*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8216 |
swsm &= ~E1000_SWSM_SMBI; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8217 |
E1000_WRITE_REG(hw, SWSM, swsm); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8218 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8219 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8220 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8221 |
* Checks if PHY reset is blocked due to SOL/IDER session, for example. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8222 |
* Returning E1000_BLK_PHY_RESET isn't necessarily an error. But it's up to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8223 |
* the caller to figure out how to deal with it. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8224 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8225 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8226 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8227 |
* returns: - E1000_BLK_PHY_RESET |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8228 |
* E1000_SUCCESS |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8229 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8230 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8231 |
s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8232 |
e1000_check_phy_reset_block(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8233 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8234 |
u32 manc = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8235 |
u32 fwsm = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8236 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8237 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8238 |
fwsm = E1000_READ_REG(hw, FWSM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8239 |
return (fwsm & E1000_FWSM_RSPCIPHY) ? E1000_SUCCESS |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8240 |
: E1000_BLK_PHY_RESET; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8241 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8242 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8243 |
if (hw->mac_type > e1000_82547_rev_2) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8244 |
manc = E1000_READ_REG(hw, MANC); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8245 |
return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ? |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8246 |
E1000_BLK_PHY_RESET : E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8247 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8248 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8249 |
static u8 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8250 |
e1000_arc_subsystem_valid(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8251 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8252 |
u32 fwsm; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8253 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8254 |
/* On 8257x silicon, registers in the range of 0x8800 - 0x8FFC |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8255 |
* may not be provided a DMA clock when no manageability features are |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8256 |
* enabled. We do not want to perform any reads/writes to these registers |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8257 |
* if this is the case. We read FWSM to determine the manageability mode. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8258 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8259 |
switch (hw->mac_type) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8260 |
case e1000_82571: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8261 |
case e1000_82572: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8262 |
case e1000_82573: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8263 |
case e1000_80003es2lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8264 |
fwsm = E1000_READ_REG(hw, FWSM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8265 |
if ((fwsm & E1000_FWSM_MODE_MASK) != 0) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8266 |
return true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8267 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8268 |
case e1000_ich8lan: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8269 |
return true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8270 |
default: |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8271 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8272 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8273 |
return false; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8274 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8275 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8276 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8277 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8278 |
* Configure PCI-Ex no-snoop |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8279 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8280 |
* hw - Struct containing variables accessed by shared code. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8281 |
* no_snoop - Bitmap of no-snoop events. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8282 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8283 |
* returns: E1000_SUCCESS |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8284 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8285 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8286 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8287 |
e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, u32 no_snoop) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8288 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8289 |
u32 gcr_reg = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8290 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8291 |
DEBUGFUNC("e1000_set_pci_ex_no_snoop"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8292 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8293 |
if (hw->bus_type == e1000_bus_type_unknown) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8294 |
e1000_get_bus_info(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8295 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8296 |
if (hw->bus_type != e1000_bus_type_pci_express) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8297 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8298 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8299 |
if (no_snoop) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8300 |
gcr_reg = E1000_READ_REG(hw, GCR); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8301 |
gcr_reg &= ~(PCI_EX_NO_SNOOP_ALL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8302 |
gcr_reg |= no_snoop; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8303 |
E1000_WRITE_REG(hw, GCR, gcr_reg); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8304 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8305 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8306 |
u32 ctrl_ext; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8307 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8308 |
E1000_WRITE_REG(hw, GCR, PCI_EX_82566_SNOOP_ALL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8309 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8310 |
ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8311 |
ctrl_ext |= E1000_CTRL_EXT_RO_DIS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8312 |
E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8313 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8314 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8315 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8316 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8317 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8318 |
/*************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8319 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8320 |
* Get software semaphore FLAG bit (SWFLAG). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8321 |
* SWFLAG is used to synchronize the access to all shared resource between |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8322 |
* SW, FW and HW. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8323 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8324 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8325 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8326 |
***************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8327 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8328 |
e1000_get_software_flag(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8329 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8330 |
s32 timeout = PHY_CFG_TIMEOUT; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8331 |
u32 extcnf_ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8332 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8333 |
DEBUGFUNC("e1000_get_software_flag"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8334 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8335 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8336 |
while (timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8337 |
extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8338 |
extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8339 |
E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8340 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8341 |
extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8342 |
if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8343 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8344 |
mdelay(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8345 |
timeout--; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8346 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8347 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8348 |
if (!timeout) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8349 |
DEBUGOUT("FW or HW locks the resource too long.\n"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8350 |
return -E1000_ERR_CONFIG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8351 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8352 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8353 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8354 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8355 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8356 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8357 |
/*************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8358 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8359 |
* Release software semaphore FLAG bit (SWFLAG). |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8360 |
* SWFLAG is used to synchronize the access to all shared resource between |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8361 |
* SW, FW and HW. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8362 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8363 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8364 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8365 |
***************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8366 |
static void |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8367 |
e1000_release_software_flag(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8368 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8369 |
u32 extcnf_ctrl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8370 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8371 |
DEBUGFUNC("e1000_release_software_flag"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8372 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8373 |
if (hw->mac_type == e1000_ich8lan) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8374 |
extcnf_ctrl= E1000_READ_REG(hw, EXTCNF_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8375 |
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8376 |
E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8377 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8378 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8379 |
return; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8380 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8381 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8382 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8383 |
* Reads a 16 bit word or words from the EEPROM using the ICH8's flash access |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8384 |
* register. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8385 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8386 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8387 |
* offset - offset of word in the EEPROM to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8388 |
* data - word read from the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8389 |
* words - number of words to read |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8390 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8391 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8392 |
e1000_read_eeprom_ich8(struct e1000_hw *hw, u16 offset, u16 words, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8393 |
u16 *data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8394 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8395 |
s32 error = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8396 |
u32 flash_bank = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8397 |
u32 act_offset = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8398 |
u32 bank_offset = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8399 |
u16 word = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8400 |
u16 i = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8401 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8402 |
/* We need to know which is the valid flash bank. In the event |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8403 |
* that we didn't allocate eeprom_shadow_ram, we may not be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8404 |
* managing flash_bank. So it cannot be trusted and needs |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8405 |
* to be updated with each read. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8406 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8407 |
/* Value of bit 22 corresponds to the flash bank we're on. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8408 |
flash_bank = (E1000_READ_REG(hw, EECD) & E1000_EECD_SEC1VAL) ? 1 : 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8409 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8410 |
/* Adjust offset appropriately if we're on bank 1 - adjust for word size */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8411 |
bank_offset = flash_bank * (hw->flash_bank_size * 2); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8412 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8413 |
error = e1000_get_software_flag(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8414 |
if (error != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8415 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8416 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8417 |
for (i = 0; i < words; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8418 |
if (hw->eeprom_shadow_ram != NULL && |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8419 |
hw->eeprom_shadow_ram[offset+i].modified) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8420 |
data[i] = hw->eeprom_shadow_ram[offset+i].eeprom_word; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8421 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8422 |
/* The NVM part needs a byte offset, hence * 2 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8423 |
act_offset = bank_offset + ((offset + i) * 2); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8424 |
error = e1000_read_ich8_word(hw, act_offset, &word); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8425 |
if (error != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8426 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8427 |
data[i] = word; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8428 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8429 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8430 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8431 |
e1000_release_software_flag(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8432 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8433 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8434 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8435 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8436 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8437 |
* Writes a 16 bit word or words to the EEPROM using the ICH8's flash access |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8438 |
* register. Actually, writes are written to the shadow ram cache in the hw |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8439 |
* structure hw->e1000_shadow_ram. e1000_commit_shadow_ram flushes this to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8440 |
* the NVM, which occurs when the NVM checksum is updated. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8441 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8442 |
* hw - Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8443 |
* offset - offset of word in the EEPROM to write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8444 |
* words - number of words to write |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8445 |
* data - words to write to the EEPROM |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8446 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8447 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8448 |
e1000_write_eeprom_ich8(struct e1000_hw *hw, u16 offset, u16 words, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8449 |
u16 *data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8450 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8451 |
u32 i = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8452 |
s32 error = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8453 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8454 |
error = e1000_get_software_flag(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8455 |
if (error != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8456 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8457 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8458 |
/* A driver can write to the NVM only if it has eeprom_shadow_ram |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8459 |
* allocated. Subsequent reads to the modified words are read from |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8460 |
* this cached structure as well. Writes will only go into this |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8461 |
* cached structure unless it's followed by a call to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8462 |
* e1000_update_eeprom_checksum() where it will commit the changes |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8463 |
* and clear the "modified" field. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8464 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8465 |
if (hw->eeprom_shadow_ram != NULL) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8466 |
for (i = 0; i < words; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8467 |
if ((offset + i) < E1000_SHADOW_RAM_WORDS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8468 |
hw->eeprom_shadow_ram[offset+i].modified = true; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8469 |
hw->eeprom_shadow_ram[offset+i].eeprom_word = data[i]; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8470 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8471 |
error = -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8472 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8473 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8474 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8475 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8476 |
/* Drivers have the option to not allocate eeprom_shadow_ram as long |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8477 |
* as they don't perform any NVM writes. An attempt in doing so |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8478 |
* will result in this error. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8479 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8480 |
error = -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8481 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8482 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8483 |
e1000_release_software_flag(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8484 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8485 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8486 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8487 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8488 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8489 |
* This function does initial flash setup so that a new read/write/erase cycle |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8490 |
* can be started. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8491 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8492 |
* hw - The pointer to the hw structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8493 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8494 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8495 |
e1000_ich8_cycle_init(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8496 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8497 |
union ich8_hws_flash_status hsfsts; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8498 |
s32 error = E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8499 |
s32 i = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8500 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8501 |
DEBUGFUNC("e1000_ich8_cycle_init"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8502 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8503 |
hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8504 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8505 |
/* May be check the Flash Des Valid bit in Hw status */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8506 |
if (hsfsts.hsf_status.fldesvalid == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8507 |
DEBUGOUT("Flash descriptor invalid. SW Sequencing must be used."); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8508 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8509 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8510 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8511 |
/* Clear FCERR in Hw status by writing 1 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8512 |
/* Clear DAEL in Hw status by writing a 1 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8513 |
hsfsts.hsf_status.flcerr = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8514 |
hsfsts.hsf_status.dael = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8515 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8516 |
E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS, hsfsts.regval); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8517 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8518 |
/* Either we should have a hardware SPI cycle in progress bit to check |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8519 |
* against, in order to start a new cycle or FDONE bit should be changed |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8520 |
* in the hardware so that it is 1 after harware reset, which can then be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8521 |
* used as an indication whether a cycle is in progress or has been |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8522 |
* completed .. we should also have some software semaphore mechanism to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8523 |
* guard FDONE or the cycle in progress bit so that two threads access to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8524 |
* those bits can be sequentiallized or a way so that 2 threads dont |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8525 |
* start the cycle at the same time */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8526 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8527 |
if (hsfsts.hsf_status.flcinprog == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8528 |
/* There is no cycle running at present, so we can start a cycle */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8529 |
/* Begin by setting Flash Cycle Done. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8530 |
hsfsts.hsf_status.flcdone = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8531 |
E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS, hsfsts.regval); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8532 |
error = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8533 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8534 |
/* otherwise poll for sometime so the current cycle has a chance |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8535 |
* to end before giving up. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8536 |
for (i = 0; i < ICH_FLASH_COMMAND_TIMEOUT; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8537 |
hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8538 |
if (hsfsts.hsf_status.flcinprog == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8539 |
error = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8540 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8541 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8542 |
udelay(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8543 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8544 |
if (error == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8545 |
/* Successful in waiting for previous cycle to timeout, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8546 |
* now set the Flash Cycle Done. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8547 |
hsfsts.hsf_status.flcdone = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8548 |
E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS, hsfsts.regval); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8549 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8550 |
DEBUGOUT("Flash controller busy, cannot get access"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8551 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8552 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8553 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8554 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8555 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8556 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8557 |
* This function starts a flash cycle and waits for its completion |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8558 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8559 |
* hw - The pointer to the hw structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8560 |
****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8561 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8562 |
e1000_ich8_flash_cycle(struct e1000_hw *hw, u32 timeout) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8563 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8564 |
union ich8_hws_flash_ctrl hsflctl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8565 |
union ich8_hws_flash_status hsfsts; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8566 |
s32 error = E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8567 |
u32 i = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8568 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8569 |
/* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8570 |
hsflctl.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8571 |
hsflctl.hsf_ctrl.flcgo = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8572 |
E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL, hsflctl.regval); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8573 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8574 |
/* wait till FDONE bit is set to 1 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8575 |
do { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8576 |
hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8577 |
if (hsfsts.hsf_status.flcdone == 1) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8578 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8579 |
udelay(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8580 |
i++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8581 |
} while (i < timeout); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8582 |
if (hsfsts.hsf_status.flcdone == 1 && hsfsts.hsf_status.flcerr == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8583 |
error = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8584 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8585 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8586 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8587 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8588 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8589 |
* Reads a byte or word from the NVM using the ICH8 flash access registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8590 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8591 |
* hw - The pointer to the hw structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8592 |
* index - The index of the byte or word to read. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8593 |
* size - Size of data to read, 1=byte 2=word |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8594 |
* data - Pointer to the word to store the value read. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8595 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8596 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8597 |
e1000_read_ich8_data(struct e1000_hw *hw, u32 index, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8598 |
u32 size, u16* data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8599 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8600 |
union ich8_hws_flash_status hsfsts; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8601 |
union ich8_hws_flash_ctrl hsflctl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8602 |
u32 flash_linear_address; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8603 |
u32 flash_data = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8604 |
s32 error = -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8605 |
s32 count = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8606 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8607 |
DEBUGFUNC("e1000_read_ich8_data"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8608 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8609 |
if (size < 1 || size > 2 || data == NULL || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8610 |
index > ICH_FLASH_LINEAR_ADDR_MASK) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8611 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8612 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8613 |
flash_linear_address = (ICH_FLASH_LINEAR_ADDR_MASK & index) + |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8614 |
hw->flash_base_addr; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8615 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8616 |
do { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8617 |
udelay(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8618 |
/* Steps */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8619 |
error = e1000_ich8_cycle_init(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8620 |
if (error != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8621 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8622 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8623 |
hsflctl.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8624 |
/* 0b/1b corresponds to 1 or 2 byte size, respectively. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8625 |
hsflctl.hsf_ctrl.fldbcount = size - 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8626 |
hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_READ; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8627 |
E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL, hsflctl.regval); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8628 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8629 |
/* Write the last 24 bits of index into Flash Linear address field in |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8630 |
* Flash Address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8631 |
/* TODO: TBD maybe check the index against the size of flash */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8632 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8633 |
E1000_WRITE_ICH_FLASH_REG(hw, ICH_FLASH_FADDR, flash_linear_address); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8634 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8635 |
error = e1000_ich8_flash_cycle(hw, ICH_FLASH_COMMAND_TIMEOUT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8636 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8637 |
/* Check if FCERR is set to 1, if set to 1, clear it and try the whole |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8638 |
* sequence a few more times, else read in (shift in) the Flash Data0, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8639 |
* the order is least significant byte first msb to lsb */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8640 |
if (error == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8641 |
flash_data = E1000_READ_ICH_FLASH_REG(hw, ICH_FLASH_FDATA0); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8642 |
if (size == 1) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8643 |
*data = (u8)(flash_data & 0x000000FF); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8644 |
} else if (size == 2) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8645 |
*data = (u16)(flash_data & 0x0000FFFF); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8646 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8647 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8648 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8649 |
/* If we've gotten here, then things are probably completely hosed, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8650 |
* but if the error condition is detected, it won't hurt to give |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8651 |
* it another try...ICH_FLASH_CYCLE_REPEAT_COUNT times. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8652 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8653 |
hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8654 |
if (hsfsts.hsf_status.flcerr == 1) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8655 |
/* Repeat for some time before giving up. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8656 |
continue; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8657 |
} else if (hsfsts.hsf_status.flcdone == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8658 |
DEBUGOUT("Timeout error - flash cycle did not complete."); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8659 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8660 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8661 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8662 |
} while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8663 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8664 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8665 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8666 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8667 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8668 |
* Writes One /two bytes to the NVM using the ICH8 flash access registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8669 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8670 |
* hw - The pointer to the hw structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8671 |
* index - The index of the byte/word to read. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8672 |
* size - Size of data to read, 1=byte 2=word |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8673 |
* data - The byte(s) to write to the NVM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8674 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8675 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8676 |
e1000_write_ich8_data(struct e1000_hw *hw, u32 index, u32 size, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8677 |
u16 data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8678 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8679 |
union ich8_hws_flash_status hsfsts; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8680 |
union ich8_hws_flash_ctrl hsflctl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8681 |
u32 flash_linear_address; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8682 |
u32 flash_data = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8683 |
s32 error = -E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8684 |
s32 count = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8685 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8686 |
DEBUGFUNC("e1000_write_ich8_data"); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8687 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8688 |
if (size < 1 || size > 2 || data > size * 0xff || |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8689 |
index > ICH_FLASH_LINEAR_ADDR_MASK) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8690 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8691 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8692 |
flash_linear_address = (ICH_FLASH_LINEAR_ADDR_MASK & index) + |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8693 |
hw->flash_base_addr; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8694 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8695 |
do { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8696 |
udelay(1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8697 |
/* Steps */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8698 |
error = e1000_ich8_cycle_init(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8699 |
if (error != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8700 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8701 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8702 |
hsflctl.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8703 |
/* 0b/1b corresponds to 1 or 2 byte size, respectively. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8704 |
hsflctl.hsf_ctrl.fldbcount = size -1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8705 |
hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_WRITE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8706 |
E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL, hsflctl.regval); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8707 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8708 |
/* Write the last 24 bits of index into Flash Linear address field in |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8709 |
* Flash Address */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8710 |
E1000_WRITE_ICH_FLASH_REG(hw, ICH_FLASH_FADDR, flash_linear_address); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8711 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8712 |
if (size == 1) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8713 |
flash_data = (u32)data & 0x00FF; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8714 |
else |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8715 |
flash_data = (u32)data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8716 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8717 |
E1000_WRITE_ICH_FLASH_REG(hw, ICH_FLASH_FDATA0, flash_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8718 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8719 |
/* check if FCERR is set to 1 , if set to 1, clear it and try the whole |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8720 |
* sequence a few more times else done */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8721 |
error = e1000_ich8_flash_cycle(hw, ICH_FLASH_COMMAND_TIMEOUT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8722 |
if (error == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8723 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8724 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8725 |
/* If we're here, then things are most likely completely hosed, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8726 |
* but if the error condition is detected, it won't hurt to give |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8727 |
* it another try...ICH_FLASH_CYCLE_REPEAT_COUNT times. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8728 |
*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8729 |
hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8730 |
if (hsfsts.hsf_status.flcerr == 1) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8731 |
/* Repeat for some time before giving up. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8732 |
continue; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8733 |
} else if (hsfsts.hsf_status.flcdone == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8734 |
DEBUGOUT("Timeout error - flash cycle did not complete."); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8735 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8736 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8737 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8738 |
} while (count++ < ICH_FLASH_CYCLE_REPEAT_COUNT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8739 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8740 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8741 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8742 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8743 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8744 |
* Reads a single byte from the NVM using the ICH8 flash access registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8745 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8746 |
* hw - pointer to e1000_hw structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8747 |
* index - The index of the byte to read. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8748 |
* data - Pointer to a byte to store the value read. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8749 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8750 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8751 |
e1000_read_ich8_byte(struct e1000_hw *hw, u32 index, u8* data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8752 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8753 |
s32 status = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8754 |
u16 word = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8755 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8756 |
status = e1000_read_ich8_data(hw, index, 1, &word); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8757 |
if (status == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8758 |
*data = (u8)word; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8759 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8760 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8761 |
return status; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8762 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8763 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8764 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8765 |
* Writes a single byte to the NVM using the ICH8 flash access registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8766 |
* Performs verification by reading back the value and then going through |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8767 |
* a retry algorithm before giving up. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8768 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8769 |
* hw - pointer to e1000_hw structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8770 |
* index - The index of the byte to write. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8771 |
* byte - The byte to write to the NVM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8772 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8773 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8774 |
e1000_verify_write_ich8_byte(struct e1000_hw *hw, u32 index, u8 byte) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8775 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8776 |
s32 error = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8777 |
s32 program_retries = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8778 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8779 |
DEBUGOUT2("Byte := %2.2X Offset := %d\n", byte, index); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8780 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8781 |
error = e1000_write_ich8_byte(hw, index, byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8782 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8783 |
if (error != E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8784 |
for (program_retries = 0; program_retries < 100; program_retries++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8785 |
DEBUGOUT2("Retrying \t Byte := %2.2X Offset := %d\n", byte, index); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8786 |
error = e1000_write_ich8_byte(hw, index, byte); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8787 |
udelay(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8788 |
if (error == E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8789 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8790 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8791 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8792 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8793 |
if (program_retries == 100) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8794 |
error = E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8795 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8796 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8797 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8798 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8799 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8800 |
* Writes a single byte to the NVM using the ICH8 flash access registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8801 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8802 |
* hw - pointer to e1000_hw structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8803 |
* index - The index of the byte to read. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8804 |
* data - The byte to write to the NVM. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8805 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8806 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8807 |
e1000_write_ich8_byte(struct e1000_hw *hw, u32 index, u8 data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8808 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8809 |
s32 status = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8810 |
u16 word = (u16)data; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8811 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8812 |
status = e1000_write_ich8_data(hw, index, 1, word); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8813 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8814 |
return status; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8815 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8816 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8817 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8818 |
* Reads a word from the NVM using the ICH8 flash access registers. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8819 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8820 |
* hw - pointer to e1000_hw structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8821 |
* index - The starting byte index of the word to read. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8822 |
* data - Pointer to a word to store the value read. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8823 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8824 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8825 |
e1000_read_ich8_word(struct e1000_hw *hw, u32 index, u16 *data) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8826 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8827 |
s32 status = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8828 |
status = e1000_read_ich8_data(hw, index, 2, data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8829 |
return status; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8830 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8831 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8832 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8833 |
* Erases the bank specified. Each bank may be a 4, 8 or 64k block. Banks are 0 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8834 |
* based. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8835 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8836 |
* hw - pointer to e1000_hw structure |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8837 |
* bank - 0 for first bank, 1 for second bank |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8838 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8839 |
* Note that this function may actually erase as much as 8 or 64 KBytes. The |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8840 |
* amount of NVM used in each bank is a *minimum* of 4 KBytes, but in fact the |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8841 |
* bank size may be 4, 8 or 64 KBytes |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8842 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8843 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8844 |
e1000_erase_ich8_4k_segment(struct e1000_hw *hw, u32 bank) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8845 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8846 |
union ich8_hws_flash_status hsfsts; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8847 |
union ich8_hws_flash_ctrl hsflctl; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8848 |
u32 flash_linear_address; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8849 |
s32 count = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8850 |
s32 error = E1000_ERR_EEPROM; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8851 |
s32 iteration; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8852 |
s32 sub_sector_size = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8853 |
s32 bank_size; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8854 |
s32 j = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8855 |
s32 error_flag = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8856 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8857 |
hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8858 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8859 |
/* Determine HW Sector size: Read BERASE bits of Hw flash Status register */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8860 |
/* 00: The Hw sector is 256 bytes, hence we need to erase 16 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8861 |
* consecutive sectors. The start index for the nth Hw sector can be |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8862 |
* calculated as bank * 4096 + n * 256 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8863 |
* 01: The Hw sector is 4K bytes, hence we need to erase 1 sector. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8864 |
* The start index for the nth Hw sector can be calculated |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8865 |
* as bank * 4096 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8866 |
* 10: The HW sector is 8K bytes |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8867 |
* 11: The Hw sector size is 64K bytes */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8868 |
if (hsfsts.hsf_status.berasesz == 0x0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8869 |
/* Hw sector size 256 */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8870 |
sub_sector_size = ICH_FLASH_SEG_SIZE_256; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8871 |
bank_size = ICH_FLASH_SECTOR_SIZE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8872 |
iteration = ICH_FLASH_SECTOR_SIZE / ICH_FLASH_SEG_SIZE_256; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8873 |
} else if (hsfsts.hsf_status.berasesz == 0x1) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8874 |
bank_size = ICH_FLASH_SEG_SIZE_4K; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8875 |
iteration = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8876 |
} else if (hsfsts.hsf_status.berasesz == 0x3) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8877 |
bank_size = ICH_FLASH_SEG_SIZE_64K; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8878 |
iteration = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8879 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8880 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8881 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8882 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8883 |
for (j = 0; j < iteration ; j++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8884 |
do { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8885 |
count++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8886 |
/* Steps */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8887 |
error = e1000_ich8_cycle_init(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8888 |
if (error != E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8889 |
error_flag = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8890 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8891 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8892 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8893 |
/* Write a value 11 (block Erase) in Flash Cycle field in Hw flash |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8894 |
* Control */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8895 |
hsflctl.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8896 |
hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_ERASE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8897 |
E1000_WRITE_ICH_FLASH_REG16(hw, ICH_FLASH_HSFCTL, hsflctl.regval); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8898 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8899 |
/* Write the last 24 bits of an index within the block into Flash |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8900 |
* Linear address field in Flash Address. This probably needs to |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8901 |
* be calculated here based off the on-chip erase sector size and |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8902 |
* the software bank size (4, 8 or 64 KBytes) */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8903 |
flash_linear_address = bank * bank_size + j * sub_sector_size; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8904 |
flash_linear_address += hw->flash_base_addr; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8905 |
flash_linear_address &= ICH_FLASH_LINEAR_ADDR_MASK; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8906 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8907 |
E1000_WRITE_ICH_FLASH_REG(hw, ICH_FLASH_FADDR, flash_linear_address); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8908 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8909 |
error = e1000_ich8_flash_cycle(hw, ICH_FLASH_ERASE_TIMEOUT); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8910 |
/* Check if FCERR is set to 1. If 1, clear it and try the whole |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8911 |
* sequence a few more times else Done */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8912 |
if (error == E1000_SUCCESS) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8913 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8914 |
} else { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8915 |
hsfsts.regval = E1000_READ_ICH_FLASH_REG16(hw, ICH_FLASH_HSFSTS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8916 |
if (hsfsts.hsf_status.flcerr == 1) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8917 |
/* repeat for some time before giving up */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8918 |
continue; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8919 |
} else if (hsfsts.hsf_status.flcdone == 0) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8920 |
error_flag = 1; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8921 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8922 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8923 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8924 |
} while ((count < ICH_FLASH_CYCLE_REPEAT_COUNT) && !error_flag); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8925 |
if (error_flag == 1) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8926 |
break; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8927 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8928 |
if (error_flag != 1) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8929 |
error = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8930 |
return error; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8931 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8932 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8933 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8934 |
e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8935 |
u32 cnf_base_addr, u32 cnf_size) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8936 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8937 |
u32 ret_val = E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8938 |
u16 word_addr, reg_data, reg_addr; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8939 |
u16 i; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8940 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8941 |
/* cnf_base_addr is in DWORD */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8942 |
word_addr = (u16)(cnf_base_addr << 1); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8943 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8944 |
/* cnf_size is returned in size of dwords */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8945 |
for (i = 0; i < cnf_size; i++) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8946 |
ret_val = e1000_read_eeprom(hw, (word_addr + i*2), 1, ®_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8947 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8948 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8949 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8950 |
ret_val = e1000_read_eeprom(hw, (word_addr + i*2 + 1), 1, ®_addr); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8951 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8952 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8953 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8954 |
ret_val = e1000_get_software_flag(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8955 |
if (ret_val != E1000_SUCCESS) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8956 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8957 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8958 |
ret_val = e1000_write_phy_reg_ex(hw, (u32)reg_addr, reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8959 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8960 |
e1000_release_software_flag(hw); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8961 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8962 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8963 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8964 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8965 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8966 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8967 |
/****************************************************************************** |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8968 |
* This function initializes the PHY from the NVM on ICH8 platforms. This |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8969 |
* is needed due to an issue where the NVM configuration is not properly |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8970 |
* autoloaded after power transitions. Therefore, after each PHY reset, we |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8971 |
* will load the configuration data out of the NVM manually. |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8972 |
* |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8973 |
* hw: Struct containing variables accessed by shared code |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8974 |
*****************************************************************************/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8975 |
static s32 |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8976 |
e1000_init_lcd_from_nvm(struct e1000_hw *hw) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8977 |
{ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8978 |
u32 reg_data, cnf_base_addr, cnf_size, ret_val, loop; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8979 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8980 |
if (hw->phy_type != e1000_phy_igp_3) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8981 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8982 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8983 |
/* Check if SW needs configure the PHY */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8984 |
reg_data = E1000_READ_REG(hw, FEXTNVM); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8985 |
if (!(reg_data & FEXTNVM_SW_CONFIG)) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8986 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8987 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8988 |
/* Wait for basic configuration completes before proceeding*/ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8989 |
loop = 0; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8990 |
do { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8991 |
reg_data = E1000_READ_REG(hw, STATUS) & E1000_STATUS_LAN_INIT_DONE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8992 |
udelay(100); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8993 |
loop++; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8994 |
} while ((!reg_data) && (loop < 50)); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8995 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8996 |
/* Clear the Init Done bit for the next init event */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8997 |
reg_data = E1000_READ_REG(hw, STATUS); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8998 |
reg_data &= ~E1000_STATUS_LAN_INIT_DONE; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8999 |
E1000_WRITE_REG(hw, STATUS, reg_data); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9000 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9001 |
/* Make sure HW does not configure LCD from PHY extended configuration |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9002 |
before SW configuration */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9003 |
reg_data = E1000_READ_REG(hw, EXTCNF_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9004 |
if ((reg_data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) == 0x0000) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9005 |
reg_data = E1000_READ_REG(hw, EXTCNF_SIZE); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9006 |
cnf_size = reg_data & E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9007 |
cnf_size >>= 16; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9008 |
if (cnf_size) { |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9009 |
reg_data = E1000_READ_REG(hw, EXTCNF_CTRL); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9010 |
cnf_base_addr = reg_data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9011 |
/* cnf_base_addr is in DWORD */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9012 |
cnf_base_addr >>= 16; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9013 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9014 |
/* Configure LCD from extended configuration region. */ |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9015 |
ret_val = e1000_init_lcd_from_nvm_config_region(hw, cnf_base_addr, |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9016 |
cnf_size); |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9017 |
if (ret_val) |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9018 |
return ret_val; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9019 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9020 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9021 |
|
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9022 |
return E1000_SUCCESS; |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9023 |
} |
afcea72f0040
Added e1000 driver for 2.6.26, thanks to M. Luescher.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9024 |