e1000_82541.c (169589) | e1000_82541.c (173788) |
---|---|
1/******************************************************************************* 2 3 Copyright (c) 2001-2007, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 16 unchanged lines hidden (view full) --- 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32*******************************************************************************/ | 1/******************************************************************************* 2 3 Copyright (c) 2001-2007, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 16 unchanged lines hidden (view full) --- 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32*******************************************************************************/ |
33/*$FreeBSD: head/sys/dev/em/e1000_82541.c 169589 2007-05-16 00:14:23Z jfv $*/ | 33/* $FreeBSD: head/sys/dev/em/e1000_82541.c 173788 2007-11-20 21:41:22Z jfv $ */ |
34 35 36/* e1000_82541 37 * e1000_82547 38 * e1000_82541_rev_2 39 * e1000_82547_rev_2 40 */ 41 --- 9 unchanged lines hidden (view full) --- 51STATIC s32 e1000_init_hw_82541(struct e1000_hw *hw); 52STATIC s32 e1000_get_link_up_info_82541(struct e1000_hw *hw, u16 *speed, 53 u16 *duplex); 54STATIC s32 e1000_phy_hw_reset_82541(struct e1000_hw *hw); 55STATIC s32 e1000_setup_copper_link_82541(struct e1000_hw *hw); 56STATIC s32 e1000_check_for_link_82541(struct e1000_hw *hw); 57STATIC s32 e1000_get_cable_length_igp_82541(struct e1000_hw *hw); 58STATIC s32 e1000_set_d3_lplu_state_82541(struct e1000_hw *hw, | 34 35 36/* e1000_82541 37 * e1000_82547 38 * e1000_82541_rev_2 39 * e1000_82547_rev_2 40 */ 41 --- 9 unchanged lines hidden (view full) --- 51STATIC s32 e1000_init_hw_82541(struct e1000_hw *hw); 52STATIC s32 e1000_get_link_up_info_82541(struct e1000_hw *hw, u16 *speed, 53 u16 *duplex); 54STATIC s32 e1000_phy_hw_reset_82541(struct e1000_hw *hw); 55STATIC s32 e1000_setup_copper_link_82541(struct e1000_hw *hw); 56STATIC s32 e1000_check_for_link_82541(struct e1000_hw *hw); 57STATIC s32 e1000_get_cable_length_igp_82541(struct e1000_hw *hw); 58STATIC s32 e1000_set_d3_lplu_state_82541(struct e1000_hw *hw, |
59 boolean_t active); | 59 bool active); |
60STATIC s32 e1000_setup_led_82541(struct e1000_hw *hw); 61STATIC s32 e1000_cleanup_led_82541(struct e1000_hw *hw); 62STATIC void e1000_clear_hw_cntrs_82541(struct e1000_hw *hw); 63static s32 e1000_config_dsp_after_link_change_82541(struct e1000_hw *hw, | 60STATIC s32 e1000_setup_led_82541(struct e1000_hw *hw); 61STATIC s32 e1000_cleanup_led_82541(struct e1000_hw *hw); 62STATIC void e1000_clear_hw_cntrs_82541(struct e1000_hw *hw); 63static s32 e1000_config_dsp_after_link_change_82541(struct e1000_hw *hw, |
64 boolean_t link_up); | 64 bool link_up); |
65static s32 e1000_phy_init_script_82541(struct e1000_hw *hw); | 65static s32 e1000_phy_init_script_82541(struct e1000_hw *hw); |
66STATIC void e1000_power_down_phy_copper_82541(struct e1000_hw *hw); |
|
66 | 67 |
67static const 68u16 e1000_igp_cable_length_table[] = | 68static const u16 e1000_igp_cable_length_table[] = |
69 { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 70 5, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 25, 25, 25, 71 25, 25, 25, 25, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, 72 40, 50, 50, 50, 50, 50, 50, 50, 60, 60, 60, 60, 60, 60, 60, 60, 73 60, 70, 70, 70, 70, 70, 70, 80, 80, 80, 80, 80, 80, 90, 90, 90, 74 90, 90, 90, 90, 90, 90, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 75 100, 100, 100, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 76 110, 110, 110, 110, 110, 110, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120}; 77#define IGP01E1000_AGC_LENGTH_TABLE_SIZE \ 78 (sizeof(e1000_igp_cable_length_table) / \ 79 sizeof(e1000_igp_cable_length_table[0])) 80 81struct e1000_dev_spec_82541 { 82 e1000_dsp_config dsp_config; 83 e1000_ffe_config ffe_config; 84 u16 spd_default; | 69 { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 70 5, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 25, 25, 25, 71 25, 25, 25, 25, 30, 30, 30, 30, 40, 40, 40, 40, 40, 40, 40, 40, 72 40, 50, 50, 50, 50, 50, 50, 50, 60, 60, 60, 60, 60, 60, 60, 60, 73 60, 70, 70, 70, 70, 70, 70, 80, 80, 80, 80, 80, 80, 90, 90, 90, 74 90, 90, 90, 90, 90, 90, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 75 100, 100, 100, 100, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 76 110, 110, 110, 110, 110, 110, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120}; 77#define IGP01E1000_AGC_LENGTH_TABLE_SIZE \ 78 (sizeof(e1000_igp_cable_length_table) / \ 79 sizeof(e1000_igp_cable_length_table[0])) 80 81struct e1000_dev_spec_82541 { 82 e1000_dsp_config dsp_config; 83 e1000_ffe_config ffe_config; 84 u16 spd_default; |
85 boolean_t phy_init_script; | 85 bool phy_init_script; |
86}; 87 88/** 89 * e1000_init_phy_params_82541 - Init PHY func ptrs. 90 * @hw: pointer to the HW structure 91 * 92 * This is a function pointer entry point called by the api module. 93 **/ | 86}; 87 88/** 89 * e1000_init_phy_params_82541 - Init PHY func ptrs. 90 * @hw: pointer to the HW structure 91 * 92 * This is a function pointer entry point called by the api module. 93 **/ |
94STATIC s32 95e1000_init_phy_params_82541(struct e1000_hw *hw) | 94STATIC s32 e1000_init_phy_params_82541(struct e1000_hw *hw) |
96{ 97 struct e1000_phy_info *phy = &hw->phy; 98 struct e1000_functions *func = &hw->func; 99 s32 ret_val = E1000_SUCCESS; 100 101 DEBUGFUNC("e1000_init_phy_params_82541"); 102 103 phy->addr = 1; --- 6 unchanged lines hidden (view full) --- 110 func->force_speed_duplex = e1000_phy_force_speed_duplex_igp; 111 func->get_cable_length = e1000_get_cable_length_igp_82541; 112 func->get_cfg_done = e1000_get_cfg_done_generic; 113 func->get_phy_info = e1000_get_phy_info_igp; 114 func->read_phy_reg = e1000_read_phy_reg_igp; 115 func->reset_phy = e1000_phy_hw_reset_82541; 116 func->set_d3_lplu_state = e1000_set_d3_lplu_state_82541; 117 func->write_phy_reg = e1000_write_phy_reg_igp; | 95{ 96 struct e1000_phy_info *phy = &hw->phy; 97 struct e1000_functions *func = &hw->func; 98 s32 ret_val = E1000_SUCCESS; 99 100 DEBUGFUNC("e1000_init_phy_params_82541"); 101 102 phy->addr = 1; --- 6 unchanged lines hidden (view full) --- 109 func->force_speed_duplex = e1000_phy_force_speed_duplex_igp; 110 func->get_cable_length = e1000_get_cable_length_igp_82541; 111 func->get_cfg_done = e1000_get_cfg_done_generic; 112 func->get_phy_info = e1000_get_phy_info_igp; 113 func->read_phy_reg = e1000_read_phy_reg_igp; 114 func->reset_phy = e1000_phy_hw_reset_82541; 115 func->set_d3_lplu_state = e1000_set_d3_lplu_state_82541; 116 func->write_phy_reg = e1000_write_phy_reg_igp; |
117 func->power_up_phy = e1000_power_up_phy_copper; 118 func->power_down_phy = e1000_power_down_phy_copper_82541; |
|
118 119 ret_val = e1000_get_phy_id(hw); 120 if (ret_val) 121 goto out; 122 123 /* Verify phy id */ 124 if (phy->id != IGP01E1000_I_PHY_ID) { 125 ret_val = -E1000_ERR_PHY; --- 5 unchanged lines hidden (view full) --- 131} 132 133/** 134 * e1000_init_nvm_params_82541 - Init NVM func ptrs. 135 * @hw: pointer to the HW structure 136 * 137 * This is a function pointer entry point called by the api module. 138 **/ | 119 120 ret_val = e1000_get_phy_id(hw); 121 if (ret_val) 122 goto out; 123 124 /* Verify phy id */ 125 if (phy->id != IGP01E1000_I_PHY_ID) { 126 ret_val = -E1000_ERR_PHY; --- 5 unchanged lines hidden (view full) --- 132} 133 134/** 135 * e1000_init_nvm_params_82541 - Init NVM func ptrs. 136 * @hw: pointer to the HW structure 137 * 138 * This is a function pointer entry point called by the api module. 139 **/ |
139STATIC s32 140e1000_init_nvm_params_82541(struct e1000_hw *hw) | 140STATIC s32 e1000_init_nvm_params_82541(struct e1000_hw *hw) |
141{ 142 struct e1000_nvm_info *nvm = &hw->nvm; 143 struct e1000_functions *func = &hw->func; 144 s32 ret_val = E1000_SUCCESS; 145 u32 eecd = E1000_READ_REG(hw, E1000_EECD); 146 u16 size; 147 148 DEBUGFUNC("e1000_init_nvm_params_82541"); --- 34 unchanged lines hidden (view full) --- 183 func->acquire_nvm = e1000_acquire_nvm_generic; 184 func->read_nvm = e1000_read_nvm_spi; 185 func->release_nvm = e1000_release_nvm_generic; 186 func->update_nvm = e1000_update_nvm_checksum_generic; 187 func->valid_led_default = e1000_valid_led_default_generic; 188 func->validate_nvm = e1000_validate_nvm_checksum_generic; 189 func->write_nvm = e1000_write_nvm_spi; 190 | 141{ 142 struct e1000_nvm_info *nvm = &hw->nvm; 143 struct e1000_functions *func = &hw->func; 144 s32 ret_val = E1000_SUCCESS; 145 u32 eecd = E1000_READ_REG(hw, E1000_EECD); 146 u16 size; 147 148 DEBUGFUNC("e1000_init_nvm_params_82541"); --- 34 unchanged lines hidden (view full) --- 183 func->acquire_nvm = e1000_acquire_nvm_generic; 184 func->read_nvm = e1000_read_nvm_spi; 185 func->release_nvm = e1000_release_nvm_generic; 186 func->update_nvm = e1000_update_nvm_checksum_generic; 187 func->valid_led_default = e1000_valid_led_default_generic; 188 func->validate_nvm = e1000_validate_nvm_checksum_generic; 189 func->write_nvm = e1000_write_nvm_spi; 190 |
191 /* nvm->word_size must be discovered after the pointers | 191 /* 192 * nvm->word_size must be discovered after the pointers |
192 * are set so we can verify the size from the nvm image 193 * itself. Temporarily set it to a dummy value so the 194 * read will work. 195 */ 196 nvm->word_size = 64; 197 ret_val = e1000_read_nvm(hw, NVM_CFG, 1, &size); 198 if (ret_val) 199 goto out; 200 size = (size & NVM_SIZE_MASK) >> NVM_SIZE_SHIFT; | 193 * are set so we can verify the size from the nvm image 194 * itself. Temporarily set it to a dummy value so the 195 * read will work. 196 */ 197 nvm->word_size = 64; 198 ret_val = e1000_read_nvm(hw, NVM_CFG, 1, &size); 199 if (ret_val) 200 goto out; 201 size = (size & NVM_SIZE_MASK) >> NVM_SIZE_SHIFT; |
201 /* if size != 0, it can be added to a constant and become | 202 /* 203 * if size != 0, it can be added to a constant and become |
202 * the left-shift value to set the word_size. Otherwise, 203 * word_size stays at 64. 204 */ 205 if (size) { 206 size += NVM_WORD_SIZE_BASE_SHIFT_82541; 207 nvm->word_size = 1 << size; 208 } 209 } else { --- 19 unchanged lines hidden (view full) --- 229} 230 231/** 232 * e1000_init_mac_params_82541 - Init MAC func ptrs. 233 * @hw: pointer to the HW structure 234 * 235 * This is a function pointer entry point called by the api module. 236 **/ | 204 * the left-shift value to set the word_size. Otherwise, 205 * word_size stays at 64. 206 */ 207 if (size) { 208 size += NVM_WORD_SIZE_BASE_SHIFT_82541; 209 nvm->word_size = 1 << size; 210 } 211 } else { --- 19 unchanged lines hidden (view full) --- 231} 232 233/** 234 * e1000_init_mac_params_82541 - Init MAC func ptrs. 235 * @hw: pointer to the HW structure 236 * 237 * This is a function pointer entry point called by the api module. 238 **/ |
237STATIC s32 238e1000_init_mac_params_82541(struct e1000_hw *hw) | 239STATIC s32 e1000_init_mac_params_82541(struct e1000_hw *hw) |
239{ 240 struct e1000_mac_info *mac = &hw->mac; 241 struct e1000_functions *func = &hw->func; 242 s32 ret_val; 243 244 DEBUGFUNC("e1000_init_mac_params_82541"); 245 246 /* Set media type */ | 240{ 241 struct e1000_mac_info *mac = &hw->mac; 242 struct e1000_functions *func = &hw->func; 243 s32 ret_val; 244 245 DEBUGFUNC("e1000_init_mac_params_82541"); 246 247 /* Set media type */ |
247 hw->media_type = e1000_media_type_copper; | 248 hw->phy.media_type = e1000_media_type_copper; |
248 /* Set mta register count */ 249 mac->mta_reg_count = 128; 250 /* Set rar entry count */ 251 mac->rar_entry_count = E1000_RAR_ENTRIES; 252 /* Set if part includes ASF firmware */ 253 mac->asf_firmware_present = TRUE; 254 255 /* Function Pointers */ --- 8 unchanged lines hidden (view full) --- 264 func->setup_link = e1000_setup_link_generic; 265 /* physical interface link setup */ 266 func->setup_physical_interface = e1000_setup_copper_link_82541; 267 /* check for link */ 268 func->check_for_link = e1000_check_for_link_82541; 269 /* link info */ 270 func->get_link_up_info = e1000_get_link_up_info_82541; 271 /* multicast address update */ | 249 /* Set mta register count */ 250 mac->mta_reg_count = 128; 251 /* Set rar entry count */ 252 mac->rar_entry_count = E1000_RAR_ENTRIES; 253 /* Set if part includes ASF firmware */ 254 mac->asf_firmware_present = TRUE; 255 256 /* Function Pointers */ --- 8 unchanged lines hidden (view full) --- 265 func->setup_link = e1000_setup_link_generic; 266 /* physical interface link setup */ 267 func->setup_physical_interface = e1000_setup_copper_link_82541; 268 /* check for link */ 269 func->check_for_link = e1000_check_for_link_82541; 270 /* link info */ 271 func->get_link_up_info = e1000_get_link_up_info_82541; 272 /* multicast address update */ |
272 func->mc_addr_list_update = e1000_mc_addr_list_update_generic; | 273 func->update_mc_addr_list = e1000_update_mc_addr_list_generic; |
273 /* writing VFTA */ 274 func->write_vfta = e1000_write_vfta_generic; 275 /* clearing VFTA */ 276 func->clear_vfta = e1000_clear_vfta_generic; 277 /* setting MTA */ 278 func->mta_set = e1000_mta_set_generic; 279 /* setup LED */ 280 func->setup_led = e1000_setup_led_82541; --- 17 unchanged lines hidden (view full) --- 298 299/** 300 * e1000_init_function_pointers_82541 - Init func ptrs. 301 * @hw: pointer to the HW structure 302 * 303 * The only function explicitly called by the api module to initialize 304 * all function pointers and parameters. 305 **/ | 274 /* writing VFTA */ 275 func->write_vfta = e1000_write_vfta_generic; 276 /* clearing VFTA */ 277 func->clear_vfta = e1000_clear_vfta_generic; 278 /* setting MTA */ 279 func->mta_set = e1000_mta_set_generic; 280 /* setup LED */ 281 func->setup_led = e1000_setup_led_82541; --- 17 unchanged lines hidden (view full) --- 299 300/** 301 * e1000_init_function_pointers_82541 - Init func ptrs. 302 * @hw: pointer to the HW structure 303 * 304 * The only function explicitly called by the api module to initialize 305 * all function pointers and parameters. 306 **/ |
306void 307e1000_init_function_pointers_82541(struct e1000_hw *hw) | 307void e1000_init_function_pointers_82541(struct e1000_hw *hw) |
308{ 309 DEBUGFUNC("e1000_init_function_pointers_82541"); 310 311 hw->func.init_mac_params = e1000_init_mac_params_82541; 312 hw->func.init_nvm_params = e1000_init_nvm_params_82541; 313 hw->func.init_phy_params = e1000_init_phy_params_82541; 314} 315 316/** 317 * e1000_reset_hw_82541 - Reset hardware 318 * @hw: pointer to the HW structure 319 * 320 * This resets the hardware into a known state. This is a 321 * function pointer entry point called by the api module. 322 **/ | 308{ 309 DEBUGFUNC("e1000_init_function_pointers_82541"); 310 311 hw->func.init_mac_params = e1000_init_mac_params_82541; 312 hw->func.init_nvm_params = e1000_init_nvm_params_82541; 313 hw->func.init_phy_params = e1000_init_phy_params_82541; 314} 315 316/** 317 * e1000_reset_hw_82541 - Reset hardware 318 * @hw: pointer to the HW structure 319 * 320 * This resets the hardware into a known state. This is a 321 * function pointer entry point called by the api module. 322 **/ |
323STATIC s32 324e1000_reset_hw_82541(struct e1000_hw *hw) | 323STATIC s32 e1000_reset_hw_82541(struct e1000_hw *hw) |
325{ 326 u32 ledctl, ctrl, icr, manc; 327 328 DEBUGFUNC("e1000_reset_hw_82541"); 329 330 DEBUGOUT("Masking off all interrupts\n"); 331 E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF); 332 333 E1000_WRITE_REG(hw, E1000_RCTL, 0); 334 E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP); 335 E1000_WRITE_FLUSH(hw); 336 | 324{ 325 u32 ledctl, ctrl, icr, manc; 326 327 DEBUGFUNC("e1000_reset_hw_82541"); 328 329 DEBUGOUT("Masking off all interrupts\n"); 330 E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF); 331 332 E1000_WRITE_REG(hw, E1000_RCTL, 0); 333 E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP); 334 E1000_WRITE_FLUSH(hw); 335 |
337 /* Delay to allow any outstanding PCI transactions to complete | 336 /* 337 * Delay to allow any outstanding PCI transactions to complete |
338 * before resetting the device. 339 */ 340 msec_delay(10); 341 342 ctrl = E1000_READ_REG(hw, E1000_CTRL); 343 344 /* Must reset the Phy before resetting the MAC */ 345 if ((hw->mac.type == e1000_82541) || (hw->mac.type == e1000_82547)) { 346 E1000_WRITE_REG(hw, E1000_CTRL, (ctrl | E1000_CTRL_PHY_RST)); 347 msec_delay(5); 348 } 349 350 DEBUGOUT("Issuing a global reset to 82541/82547 MAC\n"); 351 switch (hw->mac.type) { 352 case e1000_82541: 353 case e1000_82541_rev_2: | 338 * before resetting the device. 339 */ 340 msec_delay(10); 341 342 ctrl = E1000_READ_REG(hw, E1000_CTRL); 343 344 /* Must reset the Phy before resetting the MAC */ 345 if ((hw->mac.type == e1000_82541) || (hw->mac.type == e1000_82547)) { 346 E1000_WRITE_REG(hw, E1000_CTRL, (ctrl | E1000_CTRL_PHY_RST)); 347 msec_delay(5); 348 } 349 350 DEBUGOUT("Issuing a global reset to 82541/82547 MAC\n"); 351 switch (hw->mac.type) { 352 case e1000_82541: 353 case e1000_82541_rev_2: |
354 /* These controllers can't ack the 64-bit write when | 354 /* 355 * These controllers can't ack the 64-bit write when |
355 * issuing the reset, so we use IO-mapping as a 356 * workaround to issue the reset. 357 */ 358 E1000_WRITE_REG_IO(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); 359 break; 360 default: 361 E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); 362 break; --- 29 unchanged lines hidden (view full) --- 392 393/** 394 * e1000_init_hw_82541 - Initialize hardware 395 * @hw: pointer to the HW structure 396 * 397 * This inits the hardware readying it for operation. This is a 398 * function pointer entry point called by the api module. 399 **/ | 356 * issuing the reset, so we use IO-mapping as a 357 * workaround to issue the reset. 358 */ 359 E1000_WRITE_REG_IO(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); 360 break; 361 default: 362 E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); 363 break; --- 29 unchanged lines hidden (view full) --- 393 394/** 395 * e1000_init_hw_82541 - Initialize hardware 396 * @hw: pointer to the HW structure 397 * 398 * This inits the hardware readying it for operation. This is a 399 * function pointer entry point called by the api module. 400 **/ |
400STATIC s32 401e1000_init_hw_82541(struct e1000_hw *hw) | 401STATIC s32 e1000_init_hw_82541(struct e1000_hw *hw) |
402{ 403 struct e1000_mac_info *mac = &hw->mac; 404 u32 i, txdctl; 405 s32 ret_val; 406 407 DEBUGFUNC("e1000_init_hw_82541"); 408 409 /* Initialize identification LED */ 410 ret_val = e1000_id_led_init_generic(hw); 411 if (ret_val) { 412 DEBUGOUT("Error initializing identification LED\n"); | 402{ 403 struct e1000_mac_info *mac = &hw->mac; 404 u32 i, txdctl; 405 s32 ret_val; 406 407 DEBUGFUNC("e1000_init_hw_82541"); 408 409 /* Initialize identification LED */ 410 ret_val = e1000_id_led_init_generic(hw); 411 if (ret_val) { 412 DEBUGOUT("Error initializing identification LED\n"); |
413 goto out; | 413 /* This is not fatal and we should not stop init due to this */ |
414 } 415 416 /* Disabling VLAN filtering */ 417 DEBUGOUT("Initializing the IEEE VLAN\n"); 418 e1000_clear_vfta(hw); 419 420 /* Setup the receive address. */ 421 e1000_init_rx_addrs_generic(hw, mac->rar_entry_count); 422 423 /* Zero out the Multicast HASH table */ 424 DEBUGOUT("Zeroing the MTA\n"); 425 for (i = 0; i < mac->mta_reg_count; i++) { 426 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); | 414 } 415 416 /* Disabling VLAN filtering */ 417 DEBUGOUT("Initializing the IEEE VLAN\n"); 418 e1000_clear_vfta(hw); 419 420 /* Setup the receive address. */ 421 e1000_init_rx_addrs_generic(hw, mac->rar_entry_count); 422 423 /* Zero out the Multicast HASH table */ 424 DEBUGOUT("Zeroing the MTA\n"); 425 for (i = 0; i < mac->mta_reg_count; i++) { 426 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); |
427 /* Avoid back to back register writes by adding the register | 427 /* 428 * Avoid back to back register writes by adding the register |
428 * read (flush). This is to protect against some strange 429 * bridge configurations that may issue Memory Write Block 430 * (MWB) to our register space. 431 */ 432 E1000_WRITE_FLUSH(hw); 433 } 434 435 /* Setup link and flow control */ 436 ret_val = e1000_setup_link(hw); 437 | 429 * read (flush). This is to protect against some strange 430 * bridge configurations that may issue Memory Write Block 431 * (MWB) to our register space. 432 */ 433 E1000_WRITE_FLUSH(hw); 434 } 435 436 /* Setup link and flow control */ 437 ret_val = e1000_setup_link(hw); 438 |
438 txdctl = E1000_READ_REG(hw, E1000_TXDCTL); | 439 txdctl = E1000_READ_REG(hw, E1000_TXDCTL(0)); |
439 txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) | 440 E1000_TXDCTL_FULL_TX_DESC_WB; | 440 txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) | 441 E1000_TXDCTL_FULL_TX_DESC_WB; |
441 E1000_WRITE_REG(hw, E1000_TXDCTL, txdctl); | 442 E1000_WRITE_REG(hw, E1000_TXDCTL(0), txdctl); |
442 | 443 |
443 /* Clear all of the statistics registers (clear on read). It is | 444 /* 445 * Clear all of the statistics registers (clear on read). It is |
444 * important that we do this after we have tried to establish link 445 * because the symbol error count will increment wildly if there 446 * is no link. 447 */ 448 e1000_clear_hw_cntrs_82541(hw); 449 | 446 * important that we do this after we have tried to establish link 447 * because the symbol error count will increment wildly if there 448 * is no link. 449 */ 450 e1000_clear_hw_cntrs_82541(hw); 451 |
450out: | |
451 return ret_val; 452} 453 454/** 455 * e1000_get_link_up_info_82541 - Report speed and duplex 456 * @hw: pointer to the HW structure 457 * @speed: pointer to speed buffer 458 * @duplex: pointer to duplex buffer 459 * 460 * Retrieve the current speed and duplex configuration. 461 * This is a function pointer entry point called by the api module. 462 **/ | 452 return ret_val; 453} 454 455/** 456 * e1000_get_link_up_info_82541 - Report speed and duplex 457 * @hw: pointer to the HW structure 458 * @speed: pointer to speed buffer 459 * @duplex: pointer to duplex buffer 460 * 461 * Retrieve the current speed and duplex configuration. 462 * This is a function pointer entry point called by the api module. 463 **/ |
463STATIC s32 464e1000_get_link_up_info_82541(struct e1000_hw *hw, u16 *speed, u16 *duplex) | 464STATIC s32 e1000_get_link_up_info_82541(struct e1000_hw *hw, u16 *speed, 465 u16 *duplex) |
465{ 466 struct e1000_phy_info *phy = &hw->phy; 467 s32 ret_val; 468 u16 data; 469 470 DEBUGFUNC("e1000_get_link_up_info_82541"); 471 472 ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed, duplex); 473 if (ret_val) 474 goto out; 475 476 if (!phy->speed_downgraded) 477 goto out; 478 | 466{ 467 struct e1000_phy_info *phy = &hw->phy; 468 s32 ret_val; 469 u16 data; 470 471 DEBUGFUNC("e1000_get_link_up_info_82541"); 472 473 ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed, duplex); 474 if (ret_val) 475 goto out; 476 477 if (!phy->speed_downgraded) 478 goto out; 479 |
479 /* IGP01 PHY may advertise full duplex operation after speed | 480 /* 481 * IGP01 PHY may advertise full duplex operation after speed |
480 * downgrade even if it is operating at half duplex. 481 * Here we set the duplex settings to match the duplex in the 482 * link partner's capabilities. 483 */ 484 ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &data); 485 if (ret_val) 486 goto out; 487 | 482 * downgrade even if it is operating at half duplex. 483 * Here we set the duplex settings to match the duplex in the 484 * link partner's capabilities. 485 */ 486 ret_val = e1000_read_phy_reg(hw, PHY_AUTONEG_EXP, &data); 487 if (ret_val) 488 goto out; 489 |
488 if (!(data & NWAY_ER_LP_NWAY_CAPS)) | 490 if (!(data & NWAY_ER_LP_NWAY_CAPS)) { |
489 *duplex = HALF_DUPLEX; | 491 *duplex = HALF_DUPLEX; |
490 else { | 492 } else { |
491 ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, &data); 492 if (ret_val) 493 goto out; 494 495 if (*speed == SPEED_100) { 496 if (!(data & NWAY_LPAR_100TX_FD_CAPS)) 497 *duplex = HALF_DUPLEX; 498 } else if (*speed == SPEED_10) { --- 11 unchanged lines hidden (view full) --- 510 * @hw: pointer to the HW structure 511 * 512 * Verify the reset block is not blocking us from resetting. Acquire 513 * semaphore (if necessary) and read/set/write the device control reset 514 * bit in the PHY. Wait the appropriate delay time for the device to 515 * reset and relase the semaphore (if necessary). 516 * This is a function pointer entry point called by the api module. 517 **/ | 493 ret_val = e1000_read_phy_reg(hw, PHY_LP_ABILITY, &data); 494 if (ret_val) 495 goto out; 496 497 if (*speed == SPEED_100) { 498 if (!(data & NWAY_LPAR_100TX_FD_CAPS)) 499 *duplex = HALF_DUPLEX; 500 } else if (*speed == SPEED_10) { --- 11 unchanged lines hidden (view full) --- 512 * @hw: pointer to the HW structure 513 * 514 * Verify the reset block is not blocking us from resetting. Acquire 515 * semaphore (if necessary) and read/set/write the device control reset 516 * bit in the PHY. Wait the appropriate delay time for the device to 517 * reset and relase the semaphore (if necessary). 518 * This is a function pointer entry point called by the api module. 519 **/ |
518STATIC s32 519e1000_phy_hw_reset_82541(struct e1000_hw *hw) | 520STATIC s32 e1000_phy_hw_reset_82541(struct e1000_hw *hw) |
520{ 521 s32 ret_val; 522 u32 ledctl; 523 524 DEBUGFUNC("e1000_phy_hw_reset_82541"); 525 526 ret_val = e1000_phy_hw_reset_generic(hw); 527 if (ret_val) --- 18 unchanged lines hidden (view full) --- 546 * @hw: pointer to the HW structure 547 * 548 * Calls the appropriate function to configure the link for auto-neg or forced 549 * speed and duplex. Then we check for link, once link is established calls 550 * to configure collision distance and flow control are called. If link is 551 * not established, we return -E1000_ERR_PHY (-2). This is a function 552 * pointer entry point called by the api module. 553 **/ | 521{ 522 s32 ret_val; 523 u32 ledctl; 524 525 DEBUGFUNC("e1000_phy_hw_reset_82541"); 526 527 ret_val = e1000_phy_hw_reset_generic(hw); 528 if (ret_val) --- 18 unchanged lines hidden (view full) --- 547 * @hw: pointer to the HW structure 548 * 549 * Calls the appropriate function to configure the link for auto-neg or forced 550 * speed and duplex. Then we check for link, once link is established calls 551 * to configure collision distance and flow control are called. If link is 552 * not established, we return -E1000_ERR_PHY (-2). This is a function 553 * pointer entry point called by the api module. 554 **/ |
554STATIC s32 555e1000_setup_copper_link_82541(struct e1000_hw *hw) | 555STATIC s32 e1000_setup_copper_link_82541(struct e1000_hw *hw) |
556{ 557 struct e1000_phy_info *phy = &hw->phy; 558 struct e1000_dev_spec_82541 *dev_spec; 559 s32 ret_val; 560 u32 ctrl, ledctl; 561 562 DEBUGFUNC("e1000_setup_copper_link_82541"); 563 --- 5 unchanged lines hidden (view full) --- 569 hw->phy.reset_disable = FALSE; 570 571 dev_spec = (struct e1000_dev_spec_82541 *)hw->dev_spec; 572 573 /* Earlier revs of the IGP phy require us to force MDI. */ 574 if (hw->mac.type == e1000_82541 || hw->mac.type == e1000_82547) { 575 dev_spec->dsp_config = e1000_dsp_config_disabled; 576 phy->mdix = 1; | 556{ 557 struct e1000_phy_info *phy = &hw->phy; 558 struct e1000_dev_spec_82541 *dev_spec; 559 s32 ret_val; 560 u32 ctrl, ledctl; 561 562 DEBUGFUNC("e1000_setup_copper_link_82541"); 563 --- 5 unchanged lines hidden (view full) --- 569 hw->phy.reset_disable = FALSE; 570 571 dev_spec = (struct e1000_dev_spec_82541 *)hw->dev_spec; 572 573 /* Earlier revs of the IGP phy require us to force MDI. */ 574 if (hw->mac.type == e1000_82541 || hw->mac.type == e1000_82547) { 575 dev_spec->dsp_config = e1000_dsp_config_disabled; 576 phy->mdix = 1; |
577 } else | 577 } else { |
578 dev_spec->dsp_config = e1000_dsp_config_enabled; | 578 dev_spec->dsp_config = e1000_dsp_config_enabled; |
579 } |
|
579 580 ret_val = e1000_copper_link_setup_igp(hw); 581 if (ret_val) 582 goto out; 583 584 if (hw->mac.autoneg) { 585 if (dev_spec->ffe_config == e1000_ffe_config_active) 586 dev_spec->ffe_config = e1000_ffe_config_enabled; --- 14 unchanged lines hidden (view full) --- 601/** 602 * e1000_check_for_link_82541 - Check/Store link connection 603 * @hw: pointer to the HW structure 604 * 605 * This checks the link condition of the adapter and stores the 606 * results in the hw->mac structure. This is a function pointer entry 607 * point called by the api module. 608 **/ | 580 581 ret_val = e1000_copper_link_setup_igp(hw); 582 if (ret_val) 583 goto out; 584 585 if (hw->mac.autoneg) { 586 if (dev_spec->ffe_config == e1000_ffe_config_active) 587 dev_spec->ffe_config = e1000_ffe_config_enabled; --- 14 unchanged lines hidden (view full) --- 602/** 603 * e1000_check_for_link_82541 - Check/Store link connection 604 * @hw: pointer to the HW structure 605 * 606 * This checks the link condition of the adapter and stores the 607 * results in the hw->mac structure. This is a function pointer entry 608 * point called by the api module. 609 **/ |
609STATIC s32 610e1000_check_for_link_82541(struct e1000_hw *hw) | 610STATIC s32 e1000_check_for_link_82541(struct e1000_hw *hw) |
611{ 612 struct e1000_mac_info *mac = &hw->mac; 613 s32 ret_val; | 611{ 612 struct e1000_mac_info *mac = &hw->mac; 613 s32 ret_val; |
614 boolean_t link; | 614 bool link; |
615 616 DEBUGFUNC("e1000_check_for_link_82541"); 617 | 615 616 DEBUGFUNC("e1000_check_for_link_82541"); 617 |
618 /* We only want to go out to the PHY registers to see if Auto-Neg | 618 /* 619 * We only want to go out to the PHY registers to see if Auto-Neg |
619 * has completed and/or if our link status has changed. The 620 * get_link_status flag is set upon receiving a Link Status 621 * Change or Rx Sequence Error interrupt. 622 */ 623 if (!mac->get_link_status) { 624 ret_val = E1000_SUCCESS; 625 goto out; 626 } 627 | 620 * has completed and/or if our link status has changed. The 621 * get_link_status flag is set upon receiving a Link Status 622 * Change or Rx Sequence Error interrupt. 623 */ 624 if (!mac->get_link_status) { 625 ret_val = E1000_SUCCESS; 626 goto out; 627 } 628 |
628 /* First we want to see if the MII Status Register reports | 629 /* 630 * First we want to see if the MII Status Register reports |
629 * link. If so, then we want to get the current speed/duplex 630 * of the PHY. 631 */ 632 ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); 633 if (ret_val) 634 goto out; 635 636 if (!link) { 637 ret_val = e1000_config_dsp_after_link_change_82541(hw, FALSE); 638 goto out; /* No link detected */ 639 } 640 641 mac->get_link_status = FALSE; 642 | 631 * link. If so, then we want to get the current speed/duplex 632 * of the PHY. 633 */ 634 ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link); 635 if (ret_val) 636 goto out; 637 638 if (!link) { 639 ret_val = e1000_config_dsp_after_link_change_82541(hw, FALSE); 640 goto out; /* No link detected */ 641 } 642 643 mac->get_link_status = FALSE; 644 |
643 /* Check if there was DownShift, must be checked 644 * immediately after link-up */ | 645 /* 646 * Check if there was DownShift, must be checked 647 * immediately after link-up 648 */ |
645 e1000_check_downshift_generic(hw); 646 | 649 e1000_check_downshift_generic(hw); 650 |
647 /* If we are forcing speed/duplex, then we simply return since | 651 /* 652 * If we are forcing speed/duplex, then we simply return since |
648 * we have already determined whether we have link or not. 649 */ 650 if (!mac->autoneg) { 651 ret_val = -E1000_ERR_CONFIG; 652 goto out; 653 } 654 655 ret_val = e1000_config_dsp_after_link_change_82541(hw, TRUE); 656 | 653 * we have already determined whether we have link or not. 654 */ 655 if (!mac->autoneg) { 656 ret_val = -E1000_ERR_CONFIG; 657 goto out; 658 } 659 660 ret_val = e1000_config_dsp_after_link_change_82541(hw, TRUE); 661 |
657 /* Auto-Neg is enabled. Auto Speed Detection takes care | 662 /* 663 * Auto-Neg is enabled. Auto Speed Detection takes care |
658 * of MAC speed/duplex configuration. So we only need to 659 * configure Collision Distance in the MAC. 660 */ 661 e1000_config_collision_dist_generic(hw); 662 | 664 * of MAC speed/duplex configuration. So we only need to 665 * configure Collision Distance in the MAC. 666 */ 667 e1000_config_collision_dist_generic(hw); 668 |
663 /* Configure Flow Control now that Auto-Neg has completed. | 669 /* 670 * Configure Flow Control now that Auto-Neg has completed. |
664 * First, we need to restore the desired flow control 665 * settings because we may have had to re-autoneg with a 666 * different link partner. 667 */ 668 ret_val = e1000_config_fc_after_link_up_generic(hw); 669 if (ret_val) { 670 DEBUGOUT("Error configuring flow control\n"); 671 } --- 9 unchanged lines hidden (view full) --- 681 * 682 * Return E1000_ERR_PHY when failing to read/write the PHY, else E1000_SUCCESS 683 * at any other case. 684 * 685 * 82541_rev_2 & 82547_rev_2 have the capability to configure the DSP when a 686 * gigabit link is achieved to improve link quality. 687 * This is a function pointer entry point called by the api module. 688 **/ | 671 * First, we need to restore the desired flow control 672 * settings because we may have had to re-autoneg with a 673 * different link partner. 674 */ 675 ret_val = e1000_config_fc_after_link_up_generic(hw); 676 if (ret_val) { 677 DEBUGOUT("Error configuring flow control\n"); 678 } --- 9 unchanged lines hidden (view full) --- 688 * 689 * Return E1000_ERR_PHY when failing to read/write the PHY, else E1000_SUCCESS 690 * at any other case. 691 * 692 * 82541_rev_2 & 82547_rev_2 have the capability to configure the DSP when a 693 * gigabit link is achieved to improve link quality. 694 * This is a function pointer entry point called by the api module. 695 **/ |
689static s32 690e1000_config_dsp_after_link_change_82541(struct e1000_hw *hw, boolean_t link_up) | 696static s32 e1000_config_dsp_after_link_change_82541(struct e1000_hw *hw, 697 bool link_up) |
691{ 692 struct e1000_phy_info *phy = &hw->phy; 693 struct e1000_dev_spec_82541 *dev_spec; 694 s32 ret_val; 695 u32 idle_errs = 0; 696 u16 phy_data, phy_saved_data, speed, duplex, i; 697 u16 ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_20; 698 u16 dsp_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = --- 75 unchanged lines hidden (view full) --- 774 } 775 776 if (idle_errs) 777 ffe_idle_err_timeout = 778 FFE_IDLE_ERR_COUNT_TIMEOUT_100; 779 } 780 } else { 781 if (dev_spec->dsp_config == e1000_dsp_config_activated) { | 698{ 699 struct e1000_phy_info *phy = &hw->phy; 700 struct e1000_dev_spec_82541 *dev_spec; 701 s32 ret_val; 702 u32 idle_errs = 0; 703 u16 phy_data, phy_saved_data, speed, duplex, i; 704 u16 ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_20; 705 u16 dsp_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = --- 75 unchanged lines hidden (view full) --- 781 } 782 783 if (idle_errs) 784 ffe_idle_err_timeout = 785 FFE_IDLE_ERR_COUNT_TIMEOUT_100; 786 } 787 } else { 788 if (dev_spec->dsp_config == e1000_dsp_config_activated) { |
782 /* Save off the current value of register 0x2F5B 783 * to be restored at the end of the routines. */ | 789 /* 790 * Save off the current value of register 0x2F5B 791 * to be restored at the end of the routines. 792 */ |
784 ret_val = e1000_read_phy_reg(hw, 785 0x2F5B, 786 &phy_saved_data); 787 if (ret_val) 788 goto out; 789 790 /* Disable the PHY transmitter */ 791 ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); --- 42 unchanged lines hidden (view full) --- 834 dev_spec->dsp_config = e1000_dsp_config_enabled; 835 } 836 837 if (dev_spec->ffe_config != e1000_ffe_config_active) { 838 ret_val = E1000_SUCCESS; 839 goto out; 840 } 841 | 793 ret_val = e1000_read_phy_reg(hw, 794 0x2F5B, 795 &phy_saved_data); 796 if (ret_val) 797 goto out; 798 799 /* Disable the PHY transmitter */ 800 ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); --- 42 unchanged lines hidden (view full) --- 843 dev_spec->dsp_config = e1000_dsp_config_enabled; 844 } 845 846 if (dev_spec->ffe_config != e1000_ffe_config_active) { 847 ret_val = E1000_SUCCESS; 848 goto out; 849 } 850 |
842 /* Save off the current value of register 0x2F5B 843 * to be restored at the end of the routines. */ | 851 /* 852 * Save off the current value of register 0x2F5B 853 * to be restored at the end of the routines. 854 */ |
844 ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); 845 if (ret_val) 846 goto out; 847 848 /* Disable the PHY transmitter */ 849 ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); 850 if (ret_val) 851 goto out; --- 40 unchanged lines hidden (view full) --- 892 * The automatic gain control (agc) normalizes the amplitude of the 893 * received signal, adjusting for the attenuation produced by the 894 * cable. By reading the AGC registers, which reperesent the 895 * cobination of course and fine gain value, the value can be put 896 * into a lookup table to obtain the approximate cable length 897 * for each channel. This is a function pointer entry point called by the 898 * api module. 899 **/ | 855 ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); 856 if (ret_val) 857 goto out; 858 859 /* Disable the PHY transmitter */ 860 ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003); 861 if (ret_val) 862 goto out; --- 40 unchanged lines hidden (view full) --- 903 * The automatic gain control (agc) normalizes the amplitude of the 904 * received signal, adjusting for the attenuation produced by the 905 * cable. By reading the AGC registers, which reperesent the 906 * cobination of course and fine gain value, the value can be put 907 * into a lookup table to obtain the approximate cable length 908 * for each channel. This is a function pointer entry point called by the 909 * api module. 910 **/ |
900STATIC s32 901e1000_get_cable_length_igp_82541(struct e1000_hw *hw) | 911STATIC s32 e1000_get_cable_length_igp_82541(struct e1000_hw *hw) |
902{ 903 struct e1000_phy_info *phy = &hw->phy; 904 s32 ret_val = E1000_SUCCESS; 905 u16 i, data; 906 u16 cur_agc_value, agc_value = 0; 907 u16 min_agc_value = IGP01E1000_AGC_LENGTH_TABLE_SIZE; 908 u16 agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = 909 {IGP01E1000_PHY_AGC_A, --- 58 unchanged lines hidden (view full) --- 968 * The low power link up (lplu) state is set to the power management level D3 969 * and SmartSpeed is disabled when active is true, else clear lplu for D3 970 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU 971 * is used during Dx states where the power conservation is most important. 972 * During driver activity, SmartSpeed should be enabled so performance is 973 * maintained. This is a function pointer entry point called by the 974 * api module. 975 **/ | 912{ 913 struct e1000_phy_info *phy = &hw->phy; 914 s32 ret_val = E1000_SUCCESS; 915 u16 i, data; 916 u16 cur_agc_value, agc_value = 0; 917 u16 min_agc_value = IGP01E1000_AGC_LENGTH_TABLE_SIZE; 918 u16 agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = 919 {IGP01E1000_PHY_AGC_A, --- 58 unchanged lines hidden (view full) --- 978 * The low power link up (lplu) state is set to the power management level D3 979 * and SmartSpeed is disabled when active is true, else clear lplu for D3 980 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU 981 * is used during Dx states where the power conservation is most important. 982 * During driver activity, SmartSpeed should be enabled so performance is 983 * maintained. This is a function pointer entry point called by the 984 * api module. 985 **/ |
976STATIC s32 977e1000_set_d3_lplu_state_82541(struct e1000_hw *hw, boolean_t active) | 986STATIC s32 e1000_set_d3_lplu_state_82541(struct e1000_hw *hw, bool active) |
978{ 979 struct e1000_phy_info *phy = &hw->phy; 980 s32 ret_val; 981 u16 data; 982 983 DEBUGFUNC("e1000_set_d3_lplu_state_82541"); 984 985 switch (hw->mac.type) { --- 11 unchanged lines hidden (view full) --- 997 goto out; 998 999 if (!active) { 1000 data &= ~IGP01E1000_GMII_FLEX_SPD; 1001 ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, data); 1002 if (ret_val) 1003 goto out; 1004 | 987{ 988 struct e1000_phy_info *phy = &hw->phy; 989 s32 ret_val; 990 u16 data; 991 992 DEBUGFUNC("e1000_set_d3_lplu_state_82541"); 993 994 switch (hw->mac.type) { --- 11 unchanged lines hidden (view full) --- 1006 goto out; 1007 1008 if (!active) { 1009 data &= ~IGP01E1000_GMII_FLEX_SPD; 1010 ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, data); 1011 if (ret_val) 1012 goto out; 1013 |
1005 /* LPLU and SmartSpeed are mutually exclusive. LPLU is used | 1014 /* 1015 * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
1006 * during Dx states where the power conservation is most 1007 * important. During driver activity we should enable | 1016 * during Dx states where the power conservation is most 1017 * important. During driver activity we should enable |
1008 * SmartSpeed, so performance is maintained. */ | 1018 * SmartSpeed, so performance is maintained. 1019 */ |
1009 if (phy->smart_speed == e1000_smart_speed_on) { 1010 ret_val = e1000_read_phy_reg(hw, 1011 IGP01E1000_PHY_PORT_CONFIG, 1012 &data); 1013 if (ret_val) 1014 goto out; 1015 1016 data |= IGP01E1000_PSCFR_SMART_SPEED; --- 44 unchanged lines hidden (view full) --- 1061/** 1062 * e1000_setup_led_82541 - Configures SW controllable LED 1063 * @hw: pointer to the HW structure 1064 * 1065 * This prepares the SW controllable LED for use and saves the current state 1066 * of the LED so it can be later restored. This is a function pointer entry 1067 * point called by the api module. 1068 **/ | 1020 if (phy->smart_speed == e1000_smart_speed_on) { 1021 ret_val = e1000_read_phy_reg(hw, 1022 IGP01E1000_PHY_PORT_CONFIG, 1023 &data); 1024 if (ret_val) 1025 goto out; 1026 1027 data |= IGP01E1000_PSCFR_SMART_SPEED; --- 44 unchanged lines hidden (view full) --- 1072/** 1073 * e1000_setup_led_82541 - Configures SW controllable LED 1074 * @hw: pointer to the HW structure 1075 * 1076 * This prepares the SW controllable LED for use and saves the current state 1077 * of the LED so it can be later restored. This is a function pointer entry 1078 * point called by the api module. 1079 **/ |
1069STATIC s32 1070e1000_setup_led_82541(struct e1000_hw *hw) | 1080STATIC s32 e1000_setup_led_82541(struct e1000_hw *hw) |
1071{ 1072 struct e1000_dev_spec_82541 *dev_spec; 1073 s32 ret_val; 1074 1075 DEBUGFUNC("e1000_setup_led_82541"); 1076 1077 dev_spec = (struct e1000_dev_spec_82541 *)hw->dev_spec; 1078 --- 19 unchanged lines hidden (view full) --- 1098/** 1099 * e1000_cleanup_led_82541 - Set LED config to default operation 1100 * @hw: pointer to the HW structure 1101 * 1102 * Remove the current LED configuration and set the LED configuration 1103 * to the default value, saved from the EEPROM. This is a function pointer 1104 * entry point called by the api module. 1105 **/ | 1081{ 1082 struct e1000_dev_spec_82541 *dev_spec; 1083 s32 ret_val; 1084 1085 DEBUGFUNC("e1000_setup_led_82541"); 1086 1087 dev_spec = (struct e1000_dev_spec_82541 *)hw->dev_spec; 1088 --- 19 unchanged lines hidden (view full) --- 1108/** 1109 * e1000_cleanup_led_82541 - Set LED config to default operation 1110 * @hw: pointer to the HW structure 1111 * 1112 * Remove the current LED configuration and set the LED configuration 1113 * to the default value, saved from the EEPROM. This is a function pointer 1114 * entry point called by the api module. 1115 **/ |
1106STATIC s32 1107e1000_cleanup_led_82541(struct e1000_hw *hw) | 1116STATIC s32 e1000_cleanup_led_82541(struct e1000_hw *hw) |
1108{ 1109 struct e1000_dev_spec_82541 *dev_spec; 1110 s32 ret_val; 1111 1112 DEBUGFUNC("e1000_cleanup_led_82541"); 1113 1114 dev_spec = (struct e1000_dev_spec_82541 *)hw->dev_spec; 1115 --- 10 unchanged lines hidden (view full) --- 1126} 1127 1128/** 1129 * e1000_phy_init_script_82541 - Initialize GbE PHY 1130 * @hw: pointer to the HW structure 1131 * 1132 * Initializes the IGP PHY. 1133 **/ | 1117{ 1118 struct e1000_dev_spec_82541 *dev_spec; 1119 s32 ret_val; 1120 1121 DEBUGFUNC("e1000_cleanup_led_82541"); 1122 1123 dev_spec = (struct e1000_dev_spec_82541 *)hw->dev_spec; 1124 --- 10 unchanged lines hidden (view full) --- 1135} 1136 1137/** 1138 * e1000_phy_init_script_82541 - Initialize GbE PHY 1139 * @hw: pointer to the HW structure 1140 * 1141 * Initializes the IGP PHY. 1142 **/ |
1134static s32 1135e1000_phy_init_script_82541(struct e1000_hw *hw) | 1143static s32 e1000_phy_init_script_82541(struct e1000_hw *hw) |
1136{ 1137 struct e1000_dev_spec_82541 *dev_spec; 1138 u32 ret_val; 1139 u16 phy_saved_data; 1140 1141 DEBUGFUNC("e1000_phy_init_script_82541"); 1142 1143 dev_spec = (struct e1000_dev_spec_82541 *)hw->dev_spec; 1144 1145 if (!dev_spec->phy_init_script) { 1146 ret_val = E1000_SUCCESS; 1147 goto out; 1148 } 1149 1150 /* Delay after phy reset to enable NVM configuration to load */ 1151 msec_delay(20); 1152 | 1144{ 1145 struct e1000_dev_spec_82541 *dev_spec; 1146 u32 ret_val; 1147 u16 phy_saved_data; 1148 1149 DEBUGFUNC("e1000_phy_init_script_82541"); 1150 1151 dev_spec = (struct e1000_dev_spec_82541 *)hw->dev_spec; 1152 1153 if (!dev_spec->phy_init_script) { 1154 ret_val = E1000_SUCCESS; 1155 goto out; 1156 } 1157 1158 /* Delay after phy reset to enable NVM configuration to load */ 1159 msec_delay(20); 1160 |
1153 /* Save off the current value of register 0x2F5B to be restored at 1154 * the end of this routine. */ | 1161 /* 1162 * Save off the current value of register 0x2F5B to be restored at 1163 * the end of this routine. 1164 */ |
1155 ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); 1156 1157 /* Disabled the PHY transmitter */ 1158 e1000_write_phy_reg(hw, 0x2F5B, 0x0003); 1159 1160 msec_delay(20); 1161 1162 e1000_write_phy_reg(hw, 0x0000, 0x0140); --- 79 unchanged lines hidden (view full) --- 1242/** 1243 * e1000_init_script_state_82541 - Enable/Disable PHY init script 1244 * @hw: pointer to the HW structure 1245 * @state: boolean value used to enable/disable PHY init script 1246 * 1247 * Allows the driver to enable/disable the PHY init script, if the PHY is an 1248 * IGP PHY. This is a function pointer entry point called by the api module. 1249 **/ | 1165 ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data); 1166 1167 /* Disabled the PHY transmitter */ 1168 e1000_write_phy_reg(hw, 0x2F5B, 0x0003); 1169 1170 msec_delay(20); 1171 1172 e1000_write_phy_reg(hw, 0x0000, 0x0140); --- 79 unchanged lines hidden (view full) --- 1252/** 1253 * e1000_init_script_state_82541 - Enable/Disable PHY init script 1254 * @hw: pointer to the HW structure 1255 * @state: boolean value used to enable/disable PHY init script 1256 * 1257 * Allows the driver to enable/disable the PHY init script, if the PHY is an 1258 * IGP PHY. This is a function pointer entry point called by the api module. 1259 **/ |
1250void 1251e1000_init_script_state_82541(struct e1000_hw *hw, boolean_t state) | 1260void e1000_init_script_state_82541(struct e1000_hw *hw, bool state) |
1252{ 1253 struct e1000_dev_spec_82541 *dev_spec; 1254 1255 DEBUGFUNC("e1000_init_script_state_82541"); 1256 1257 if (hw->phy.type != e1000_phy_igp) { 1258 DEBUGOUT("Initialization script not necessary.\n"); 1259 goto out; 1260 } 1261 1262 dev_spec = (struct e1000_dev_spec_82541 *)hw->dev_spec; 1263 | 1261{ 1262 struct e1000_dev_spec_82541 *dev_spec; 1263 1264 DEBUGFUNC("e1000_init_script_state_82541"); 1265 1266 if (hw->phy.type != e1000_phy_igp) { 1267 DEBUGOUT("Initialization script not necessary.\n"); 1268 goto out; 1269 } 1270 1271 dev_spec = (struct e1000_dev_spec_82541 *)hw->dev_spec; 1272 |
1264 if (dev_spec == NULL) { | 1273 if (!dev_spec) { |
1265 DEBUGOUT("dev_spec pointer is set to NULL.\n"); 1266 goto out; 1267 } 1268 1269 dev_spec->phy_init_script = state; 1270 1271out: 1272 return; 1273} 1274 1275/** | 1274 DEBUGOUT("dev_spec pointer is set to NULL.\n"); 1275 goto out; 1276 } 1277 1278 dev_spec->phy_init_script = state; 1279 1280out: 1281 return; 1282} 1283 1284/** |
1285 * e1000_power_down_phy_copper_82541 - Remove link in case of PHY power down 1286 * @hw: pointer to the HW structure 1287 * 1288 * In the case of a PHY power down to save power, or to turn off link during a 1289 * driver unload, or wake on lan is not enabled, remove the link. 1290 **/ 1291STATIC void e1000_power_down_phy_copper_82541(struct e1000_hw *hw) 1292{ 1293 /* If the management interface is not enabled, then power down */ 1294 if (!(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_SMBUS_EN)) 1295 e1000_power_down_phy_copper(hw); 1296 1297 return; 1298} 1299 1300/** |
|
1276 * e1000_clear_hw_cntrs_82541 - Clear device specific hardware counters 1277 * @hw: pointer to the HW structure 1278 * 1279 * Clears the hardware counters by reading the counter registers. 1280 **/ | 1301 * e1000_clear_hw_cntrs_82541 - Clear device specific hardware counters 1302 * @hw: pointer to the HW structure 1303 * 1304 * Clears the hardware counters by reading the counter registers. 1305 **/ |
1281STATIC void 1282e1000_clear_hw_cntrs_82541(struct e1000_hw *hw) | 1306STATIC void e1000_clear_hw_cntrs_82541(struct e1000_hw *hw) |
1283{ 1284 volatile u32 temp; 1285 1286 DEBUGFUNC("e1000_clear_hw_cntrs_82541"); 1287 1288 e1000_clear_hw_cntrs_base_generic(hw); 1289 1290 temp = E1000_READ_REG(hw, E1000_PRC64); --- 23 unchanged lines hidden --- | 1307{ 1308 volatile u32 temp; 1309 1310 DEBUGFUNC("e1000_clear_hw_cntrs_82541"); 1311 1312 e1000_clear_hw_cntrs_base_generic(hw); 1313 1314 temp = E1000_READ_REG(hw, E1000_PRC64); --- 23 unchanged lines hidden --- |