e1000_82571.c (169248) | e1000_82571.c (169589) |
---|---|
1/******************************************************************************* 2 3 Copyright (c) 2001-2007, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 16 unchanged lines hidden (view full) --- 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32*******************************************************************************/ | 1/******************************************************************************* 2 3 Copyright (c) 2001-2007, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 16 unchanged lines hidden (view full) --- 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32*******************************************************************************/ |
33/*$FreeBSD: head/sys/dev/em/e1000_82571.c 169589 2007-05-16 00:14:23Z jfv $*/ |
|
33 | 34 |
34#include <sys/cdefs.h> 35__FBSDID("$FreeBSD: head/sys/dev/em/e1000_82571.c 169248 2007-05-04 13:30:44Z rwatson $"); | |
36 | 35 |
37 | |
38/* e1000_82571 39 * e1000_82572 40 * e1000_82573 41 */ 42 | 36/* e1000_82571 37 * e1000_82572 38 * e1000_82573 39 */ 40 |
41#include "e1000_api.h" |
|
43#include "e1000_82571.h" 44 45void e1000_init_function_pointers_82571(struct e1000_hw *hw); 46 47STATIC s32 e1000_init_phy_params_82571(struct e1000_hw *hw); 48STATIC s32 e1000_init_nvm_params_82571(struct e1000_hw *hw); 49STATIC s32 e1000_init_mac_params_82571(struct e1000_hw *hw); 50STATIC s32 e1000_acquire_nvm_82571(struct e1000_hw *hw); --- 11 unchanged lines hidden (view full) --- 62STATIC void e1000_mc_addr_list_update_82571(struct e1000_hw *hw, 63 u8 *mc_addr_list, u32 mc_addr_count, 64 u32 rar_used_count, u32 rar_count); 65STATIC s32 e1000_setup_link_82571(struct e1000_hw *hw); 66STATIC s32 e1000_setup_copper_link_82571(struct e1000_hw *hw); 67STATIC s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw); 68STATIC s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data); 69STATIC void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); | 42#include "e1000_82571.h" 43 44void e1000_init_function_pointers_82571(struct e1000_hw *hw); 45 46STATIC s32 e1000_init_phy_params_82571(struct e1000_hw *hw); 47STATIC s32 e1000_init_nvm_params_82571(struct e1000_hw *hw); 48STATIC s32 e1000_init_mac_params_82571(struct e1000_hw *hw); 49STATIC s32 e1000_acquire_nvm_82571(struct e1000_hw *hw); --- 11 unchanged lines hidden (view full) --- 61STATIC void e1000_mc_addr_list_update_82571(struct e1000_hw *hw, 62 u8 *mc_addr_list, u32 mc_addr_count, 63 u32 rar_used_count, u32 rar_count); 64STATIC s32 e1000_setup_link_82571(struct e1000_hw *hw); 65STATIC s32 e1000_setup_copper_link_82571(struct e1000_hw *hw); 66STATIC s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw); 67STATIC s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data); 68STATIC void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); |
69static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw); |
|
70static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw); 71static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); | 70static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw); 71static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); |
72static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); |
|
72static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); 73static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, 74 u16 words, u16 *data); 75 76struct e1000_dev_spec_82571 { 77 boolean_t laa_is_present; 78}; 79 80/** 81 * e1000_init_phy_params_82571 - Init PHY func ptrs. | 73static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); 74static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, 75 u16 words, u16 *data); 76 77struct e1000_dev_spec_82571 { 78 boolean_t laa_is_present; 79}; 80 81/** 82 * e1000_init_phy_params_82571 - Init PHY func ptrs. |
82 * @hw - pointer to the HW structure | 83 * @hw: pointer to the HW structure |
83 * 84 * This is a function pointer entry point called by the api module. 85 **/ 86STATIC s32 87e1000_init_phy_params_82571(struct e1000_hw *hw) 88{ 89 struct e1000_phy_info *phy = &hw->phy; 90 struct e1000_functions *func = &hw->func; --- 5 unchanged lines hidden (view full) --- 96 phy->type = e1000_phy_none; 97 goto out; 98 } 99 100 phy->addr = 1; 101 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; 102 phy->reset_delay_us = 100; 103 | 84 * 85 * This is a function pointer entry point called by the api module. 86 **/ 87STATIC s32 88e1000_init_phy_params_82571(struct e1000_hw *hw) 89{ 90 struct e1000_phy_info *phy = &hw->phy; 91 struct e1000_functions *func = &hw->func; --- 5 unchanged lines hidden (view full) --- 97 phy->type = e1000_phy_none; 98 goto out; 99 } 100 101 phy->addr = 1; 102 phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; 103 phy->reset_delay_us = 100; 104 |
104 func->acquire_phy = e1000_get_hw_semaphore_generic; | 105 func->acquire_phy = e1000_get_hw_semaphore_82571; |
105 func->check_polarity = e1000_check_polarity_igp; 106 func->check_reset_block = e1000_check_reset_block_generic; | 106 func->check_polarity = e1000_check_polarity_igp; 107 func->check_reset_block = e1000_check_reset_block_generic; |
107 func->release_phy = e1000_put_hw_semaphore_generic; | 108 func->release_phy = e1000_put_hw_semaphore_82571; |
108 func->reset_phy = e1000_phy_hw_reset_generic; 109 func->set_d0_lplu_state = e1000_set_d0_lplu_state_82571; 110 func->set_d3_lplu_state = e1000_set_d3_lplu_state_generic; 111 112 switch (hw->mac.type) { 113 case e1000_82571: 114 case e1000_82572: 115 phy->type = e1000_phy_igp_2; --- 45 unchanged lines hidden (view full) --- 161 } 162 163out: 164 return ret_val; 165} 166 167/** 168 * e1000_init_nvm_params_82571 - Init NVM func ptrs. | 109 func->reset_phy = e1000_phy_hw_reset_generic; 110 func->set_d0_lplu_state = e1000_set_d0_lplu_state_82571; 111 func->set_d3_lplu_state = e1000_set_d3_lplu_state_generic; 112 113 switch (hw->mac.type) { 114 case e1000_82571: 115 case e1000_82572: 116 phy->type = e1000_phy_igp_2; --- 45 unchanged lines hidden (view full) --- 162 } 163 164out: 165 return ret_val; 166} 167 168/** 169 * e1000_init_nvm_params_82571 - Init NVM func ptrs. |
169 * @hw - pointer to the HW structure | 170 * @hw: pointer to the HW structure |
170 * 171 * This is a function pointer entry point called by the api module. 172 **/ 173STATIC s32 174e1000_init_nvm_params_82571(struct e1000_hw *hw) 175{ 176 struct e1000_nvm_info *nvm = &hw->nvm; 177 struct e1000_functions *func = &hw->func; --- 55 unchanged lines hidden (view full) --- 233 func->valid_led_default = e1000_valid_led_default_82571; 234 func->write_nvm = e1000_write_nvm_82571; 235 236 return E1000_SUCCESS; 237} 238 239/** 240 * e1000_init_mac_params_82571 - Init MAC func ptrs. | 171 * 172 * This is a function pointer entry point called by the api module. 173 **/ 174STATIC s32 175e1000_init_nvm_params_82571(struct e1000_hw *hw) 176{ 177 struct e1000_nvm_info *nvm = &hw->nvm; 178 struct e1000_functions *func = &hw->func; --- 55 unchanged lines hidden (view full) --- 234 func->valid_led_default = e1000_valid_led_default_82571; 235 func->write_nvm = e1000_write_nvm_82571; 236 237 return E1000_SUCCESS; 238} 239 240/** 241 * e1000_init_mac_params_82571 - Init MAC func ptrs. |
241 * @hw - pointer to the HW structure | 242 * @hw: pointer to the HW structure |
242 * 243 * This is a function pointer entry point called by the api module. 244 **/ 245STATIC s32 246e1000_init_mac_params_82571(struct e1000_hw *hw) 247{ 248 struct e1000_mac_info *mac = &hw->mac; 249 struct e1000_functions *func = &hw->func; --- 4 unchanged lines hidden (view full) --- 254 /* Set media type */ 255 switch (hw->device_id) { 256 case E1000_DEV_ID_82571EB_FIBER: 257 case E1000_DEV_ID_82572EI_FIBER: 258 case E1000_DEV_ID_82571EB_QUAD_FIBER: 259 hw->media_type = e1000_media_type_fiber; 260 break; 261 case E1000_DEV_ID_82571EB_SERDES: | 243 * 244 * This is a function pointer entry point called by the api module. 245 **/ 246STATIC s32 247e1000_init_mac_params_82571(struct e1000_hw *hw) 248{ 249 struct e1000_mac_info *mac = &hw->mac; 250 struct e1000_functions *func = &hw->func; --- 4 unchanged lines hidden (view full) --- 255 /* Set media type */ 256 switch (hw->device_id) { 257 case E1000_DEV_ID_82571EB_FIBER: 258 case E1000_DEV_ID_82572EI_FIBER: 259 case E1000_DEV_ID_82571EB_QUAD_FIBER: 260 hw->media_type = e1000_media_type_fiber; 261 break; 262 case E1000_DEV_ID_82571EB_SERDES: |
263 case E1000_DEV_ID_82571EB_SERDES_DUAL: 264 case E1000_DEV_ID_82571EB_SERDES_QUAD: |
|
262 case E1000_DEV_ID_82572EI_SERDES: 263 hw->media_type = e1000_media_type_internal_serdes; 264 break; 265 default: 266 hw->media_type = e1000_media_type_copper; 267 break; 268 } 269 --- 74 unchanged lines hidden (view full) --- 344 ret_val = e1000_alloc_zeroed_dev_spec_struct(hw, hw->dev_spec_size); 345 346out: 347 return ret_val; 348} 349 350/** 351 * e1000_init_function_pointers_82571 - Init func ptrs. | 265 case E1000_DEV_ID_82572EI_SERDES: 266 hw->media_type = e1000_media_type_internal_serdes; 267 break; 268 default: 269 hw->media_type = e1000_media_type_copper; 270 break; 271 } 272 --- 74 unchanged lines hidden (view full) --- 347 ret_val = e1000_alloc_zeroed_dev_spec_struct(hw, hw->dev_spec_size); 348 349out: 350 return ret_val; 351} 352 353/** 354 * e1000_init_function_pointers_82571 - Init func ptrs. |
352 * @hw - pointer to the HW structure | 355 * @hw: pointer to the HW structure |
353 * 354 * The only function explicitly called by the api module to initialize 355 * all function pointers and parameters. 356 **/ 357void 358e1000_init_function_pointers_82571(struct e1000_hw *hw) 359{ 360 DEBUGFUNC("e1000_init_function_pointers_82571"); 361 362 hw->func.init_mac_params = e1000_init_mac_params_82571; 363 hw->func.init_nvm_params = e1000_init_nvm_params_82571; 364 hw->func.init_phy_params = e1000_init_phy_params_82571; 365} 366 367/** 368 * e1000_get_phy_id_82571 - Retrieve the PHY ID and revision | 356 * 357 * The only function explicitly called by the api module to initialize 358 * all function pointers and parameters. 359 **/ 360void 361e1000_init_function_pointers_82571(struct e1000_hw *hw) 362{ 363 DEBUGFUNC("e1000_init_function_pointers_82571"); 364 365 hw->func.init_mac_params = e1000_init_mac_params_82571; 366 hw->func.init_nvm_params = e1000_init_nvm_params_82571; 367 hw->func.init_phy_params = e1000_init_phy_params_82571; 368} 369 370/** 371 * e1000_get_phy_id_82571 - Retrieve the PHY ID and revision |
369 * @hw - pointer to the HW structure | 372 * @hw: pointer to the HW structure |
370 * 371 * Reads the PHY registers and stores the PHY ID and possibly the PHY 372 * revision in the hardware structure. 373 **/ 374static s32 375e1000_get_phy_id_82571(struct e1000_hw *hw) 376{ 377 struct e1000_phy_info *phy = &hw->phy; --- 17 unchanged lines hidden (view full) --- 395 ret_val = -E1000_ERR_PHY; 396 break; 397 } 398 399 return ret_val; 400} 401 402/** | 373 * 374 * Reads the PHY registers and stores the PHY ID and possibly the PHY 375 * revision in the hardware structure. 376 **/ 377static s32 378e1000_get_phy_id_82571(struct e1000_hw *hw) 379{ 380 struct e1000_phy_info *phy = &hw->phy; --- 17 unchanged lines hidden (view full) --- 398 ret_val = -E1000_ERR_PHY; 399 break; 400 } 401 402 return ret_val; 403} 404 405/** |
406 * e1000_get_hw_semaphore_82571 - Acquire hardware semaphore 407 * @hw: pointer to the HW structure 408 * 409 * Acquire the HW semaphore to access the PHY or NVM 410 **/ 411s32 412e1000_get_hw_semaphore_82571(struct e1000_hw *hw) 413{ 414 u32 swsm; 415 s32 ret_val = E1000_SUCCESS; 416 s32 timeout = hw->nvm.word_size + 1; 417 s32 i = 0; 418 419 DEBUGFUNC("e1000_get_hw_semaphore_82571"); 420 421 /* Get the FW semaphore. */ 422 for (i = 0; i < timeout; i++) { 423 swsm = E1000_READ_REG(hw, E1000_SWSM); 424 E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); 425 426 /* Semaphore acquired if bit latched */ 427 if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) 428 break; 429 430 usec_delay(50); 431 } 432 433 if (i == timeout) { 434 /* Release semaphores */ 435 e1000_put_hw_semaphore_generic(hw); 436 DEBUGOUT("Driver can't access the NVM\n"); 437 ret_val = -E1000_ERR_NVM; 438 goto out; 439 } 440 441out: 442 return ret_val; 443} 444 445/** 446 * e1000_put_hw_semaphore_82571 - Release hardware semaphore 447 * @hw: pointer to the HW structure 448 * 449 * Release hardware semaphore used to access the PHY or NVM 450 **/ 451void 452e1000_put_hw_semaphore_82571(struct e1000_hw *hw) 453{ 454 u32 swsm; 455 456 DEBUGFUNC("e1000_put_hw_semaphore_82571"); 457 458 swsm = E1000_READ_REG(hw, E1000_SWSM); 459 460 swsm &= ~E1000_SWSM_SWESMBI; 461 462 E1000_WRITE_REG(hw, E1000_SWSM, swsm); 463} 464 465/** |
|
403 * e1000_acquire_nvm_82571 - Request for access to the EEPROM | 466 * e1000_acquire_nvm_82571 - Request for access to the EEPROM |
404 * @hw - pointer to the HW structure | 467 * @hw: pointer to the HW structure |
405 * 406 * To gain access to the EEPROM, first we must obtain a hardware semaphore. 407 * Then for non-82573 hardware, set the EEPROM access request bit and wait 408 * for EEPROM access grant bit. If the access grant bit is not set, release 409 * hardware semaphore. 410 **/ 411STATIC s32 412e1000_acquire_nvm_82571(struct e1000_hw *hw) 413{ 414 s32 ret_val; 415 416 DEBUGFUNC("e1000_acquire_nvm_82571"); 417 | 468 * 469 * To gain access to the EEPROM, first we must obtain a hardware semaphore. 470 * Then for non-82573 hardware, set the EEPROM access request bit and wait 471 * for EEPROM access grant bit. If the access grant bit is not set, release 472 * hardware semaphore. 473 **/ 474STATIC s32 475e1000_acquire_nvm_82571(struct e1000_hw *hw) 476{ 477 s32 ret_val; 478 479 DEBUGFUNC("e1000_acquire_nvm_82571"); 480 |
418 ret_val = e1000_get_hw_semaphore_generic(hw); | 481 ret_val = e1000_get_hw_semaphore_82571(hw); |
419 if (ret_val) 420 goto out; 421 422 if (hw->mac.type != e1000_82573) 423 ret_val = e1000_acquire_nvm_generic(hw); 424 425 if (ret_val) | 482 if (ret_val) 483 goto out; 484 485 if (hw->mac.type != e1000_82573) 486 ret_val = e1000_acquire_nvm_generic(hw); 487 488 if (ret_val) |
426 e1000_put_hw_semaphore_generic(hw); | 489 e1000_put_hw_semaphore_82571(hw); |
427 428out: 429 return ret_val; 430} 431 432/** 433 * e1000_release_nvm_82571 - Release exclusive access to EEPROM | 490 491out: 492 return ret_val; 493} 494 495/** 496 * e1000_release_nvm_82571 - Release exclusive access to EEPROM |
434 * @hw - pointer to the HW structure | 497 * @hw: pointer to the HW structure |
435 * 436 * Stop any current commands to the EEPROM and clear the EEPROM request bit. 437 **/ 438STATIC void 439e1000_release_nvm_82571(struct e1000_hw *hw) 440{ 441 DEBUGFUNC("e1000_release_nvm_82571"); 442 443 e1000_release_nvm_generic(hw); | 498 * 499 * Stop any current commands to the EEPROM and clear the EEPROM request bit. 500 **/ 501STATIC void 502e1000_release_nvm_82571(struct e1000_hw *hw) 503{ 504 DEBUGFUNC("e1000_release_nvm_82571"); 505 506 e1000_release_nvm_generic(hw); |
444 e1000_put_hw_semaphore_generic(hw); | 507 e1000_put_hw_semaphore_82571(hw); |
445} 446 447/** 448 * e1000_write_nvm_82571 - Write to EEPROM using appropriate interface | 508} 509 510/** 511 * e1000_write_nvm_82571 - Write to EEPROM using appropriate interface |
449 * @hw - pointer to the HW structure 450 * @offset - offset within the EEPROM to be written to 451 * @words - number of words to write 452 * @data - 16 bit word(s) to be written to the EEPROM | 512 * @hw: pointer to the HW structure 513 * @offset: offset within the EEPROM to be written to 514 * @words: number of words to write 515 * @data: 16 bit word(s) to be written to the EEPROM |
453 * 454 * For non-82573 silicon, write data to EEPROM at offset using SPI interface. 455 * 456 * If e1000_update_nvm_checksum is not called after this function, the 457 * EEPROM will most likley contain an invalid checksum. 458 **/ 459STATIC s32 460e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) --- 15 unchanged lines hidden (view full) --- 476 break; 477 } 478 479 return ret_val; 480} 481 482/** 483 * e1000_update_nvm_checksum_82571 - Update EEPROM checksum | 516 * 517 * For non-82573 silicon, write data to EEPROM at offset using SPI interface. 518 * 519 * If e1000_update_nvm_checksum is not called after this function, the 520 * EEPROM will most likley contain an invalid checksum. 521 **/ 522STATIC s32 523e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) --- 15 unchanged lines hidden (view full) --- 539 break; 540 } 541 542 return ret_val; 543} 544 545/** 546 * e1000_update_nvm_checksum_82571 - Update EEPROM checksum |
484 * @hw - pointer to the HW structure | 547 * @hw: pointer to the HW structure |
485 * 486 * Updates the EEPROM checksum by reading/adding each word of the EEPROM 487 * up to the checksum. Then calculates the EEPROM checksum and writes the 488 * value to the EEPROM. 489 **/ 490STATIC s32 491e1000_update_nvm_checksum_82571(struct e1000_hw *hw) 492{ --- 50 unchanged lines hidden (view full) --- 543 } 544 545out: 546 return ret_val; 547} 548 549/** 550 * e1000_validate_nvm_checksum_82571 - Validate EEPROM checksum | 548 * 549 * Updates the EEPROM checksum by reading/adding each word of the EEPROM 550 * up to the checksum. Then calculates the EEPROM checksum and writes the 551 * value to the EEPROM. 552 **/ 553STATIC s32 554e1000_update_nvm_checksum_82571(struct e1000_hw *hw) 555{ --- 50 unchanged lines hidden (view full) --- 606 } 607 608out: 609 return ret_val; 610} 611 612/** 613 * e1000_validate_nvm_checksum_82571 - Validate EEPROM checksum |
551 * @hw - pointer to the HW structure | 614 * @hw: pointer to the HW structure |
552 * 553 * Calculates the EEPROM checksum by reading/adding each word of the EEPROM 554 * and then verifies that the sum of the EEPROM is equal to 0xBABA. 555 **/ 556STATIC s32 557e1000_validate_nvm_checksum_82571(struct e1000_hw *hw) 558{ 559 DEBUGFUNC("e1000_validate_nvm_checksum_82571"); 560 561 if (hw->nvm.type == e1000_nvm_flash_hw) 562 e1000_fix_nvm_checksum_82571(hw); 563 564 return e1000_validate_nvm_checksum_generic(hw); 565} 566 567/** 568 * e1000_write_nvm_eewr_82571 - Write to EEPROM for 82573 silicon | 615 * 616 * Calculates the EEPROM checksum by reading/adding each word of the EEPROM 617 * and then verifies that the sum of the EEPROM is equal to 0xBABA. 618 **/ 619STATIC s32 620e1000_validate_nvm_checksum_82571(struct e1000_hw *hw) 621{ 622 DEBUGFUNC("e1000_validate_nvm_checksum_82571"); 623 624 if (hw->nvm.type == e1000_nvm_flash_hw) 625 e1000_fix_nvm_checksum_82571(hw); 626 627 return e1000_validate_nvm_checksum_generic(hw); 628} 629 630/** 631 * e1000_write_nvm_eewr_82571 - Write to EEPROM for 82573 silicon |
569 * @hw - pointer to the HW structure 570 * @offset - offset within the EEPROM to be written to 571 * @words - number of words to write 572 * @data - 16 bit word(s) to be written to the EEPROM | 632 * @hw: pointer to the HW structure 633 * @offset: offset within the EEPROM to be written to 634 * @words: number of words to write 635 * @data: 16 bit word(s) to be written to the EEPROM |
573 * 574 * After checking for invalid values, poll the EEPROM to ensure the previous 575 * command has completed before trying to write the next word. After write 576 * poll for completion. 577 * 578 * If e1000_update_nvm_checksum is not called after this function, the 579 * EEPROM will most likley contain an invalid checksum. 580 **/ --- 33 unchanged lines hidden (view full) --- 614 } 615 616out: 617 return ret_val; 618} 619 620/** 621 * e1000_get_cfg_done_82571 - Poll for configuration done | 636 * 637 * After checking for invalid values, poll the EEPROM to ensure the previous 638 * command has completed before trying to write the next word. After write 639 * poll for completion. 640 * 641 * If e1000_update_nvm_checksum is not called after this function, the 642 * EEPROM will most likley contain an invalid checksum. 643 **/ --- 33 unchanged lines hidden (view full) --- 677 } 678 679out: 680 return ret_val; 681} 682 683/** 684 * e1000_get_cfg_done_82571 - Poll for configuration done |
622 * @hw - pointer to the HW structure | 685 * @hw: pointer to the HW structure |
623 * 624 * Reads the management control register for the config done bit to be set. 625 **/ 626STATIC s32 627e1000_get_cfg_done_82571(struct e1000_hw *hw) 628{ 629 s32 timeout = PHY_CFG_TIMEOUT; 630 s32 ret_val = E1000_SUCCESS; --- 13 unchanged lines hidden (view full) --- 644 } 645 646out: 647 return ret_val; 648} 649 650/** 651 * e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state | 686 * 687 * Reads the management control register for the config done bit to be set. 688 **/ 689STATIC s32 690e1000_get_cfg_done_82571(struct e1000_hw *hw) 691{ 692 s32 timeout = PHY_CFG_TIMEOUT; 693 s32 ret_val = E1000_SUCCESS; --- 13 unchanged lines hidden (view full) --- 707 } 708 709out: 710 return ret_val; 711} 712 713/** 714 * e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state |
652 * @hw - pointer to the HW structure 653 * @active - TRUE to enable LPLU, FALSE to disable | 715 * @hw: pointer to the HW structure 716 * @active: TRUE to enable LPLU, FALSE to disable |
654 * 655 * Sets the LPLU D0 state according to the active flag. When activating LPLU 656 * this function also disables smart speed and vice versa. LPLU will not be 657 * activated unless the device autonegotiation advertisement meets standards 658 * of either 10 or 10/100 or 10/100/1000 at all duplexes. This is a function 659 * pointer entry point only called by PHY setup routines. 660 **/ 661STATIC s32 --- 66 unchanged lines hidden (view full) --- 728 } 729 730out: 731 return ret_val; 732} 733 734/** 735 * e1000_reset_hw_82571 - Reset hardware | 717 * 718 * Sets the LPLU D0 state according to the active flag. When activating LPLU 719 * this function also disables smart speed and vice versa. LPLU will not be 720 * activated unless the device autonegotiation advertisement meets standards 721 * of either 10 or 10/100 or 10/100/1000 at all duplexes. This is a function 722 * pointer entry point only called by PHY setup routines. 723 **/ 724STATIC s32 --- 66 unchanged lines hidden (view full) --- 791 } 792 793out: 794 return ret_val; 795} 796 797/** 798 * e1000_reset_hw_82571 - Reset hardware |
736 * @hw - pointer to the HW structure | 799 * @hw: pointer to the HW structure |
737 * 738 * This resets the hardware into a known state. This is a 739 * function pointer entry point called by the api module. 740 **/ 741STATIC s32 742e1000_reset_hw_82571(struct e1000_hw *hw) 743{ 744 u32 ctrl, extcnf_ctrl, ctrl_ext, icr; --- 69 unchanged lines hidden (view full) --- 814 icr = E1000_READ_REG(hw, E1000_ICR); 815 816out: 817 return ret_val; 818} 819 820/** 821 * e1000_init_hw_82571 - Initialize hardware | 800 * 801 * This resets the hardware into a known state. This is a 802 * function pointer entry point called by the api module. 803 **/ 804STATIC s32 805e1000_reset_hw_82571(struct e1000_hw *hw) 806{ 807 u32 ctrl, extcnf_ctrl, ctrl_ext, icr; --- 69 unchanged lines hidden (view full) --- 877 icr = E1000_READ_REG(hw, E1000_ICR); 878 879out: 880 return ret_val; 881} 882 883/** 884 * e1000_init_hw_82571 - Initialize hardware |
822 * @hw - pointer to the HW structure | 885 * @hw: pointer to the HW structure |
823 * 824 * This inits the hardware readying it for operation. 825 **/ 826STATIC s32 827e1000_init_hw_82571(struct e1000_hw *hw) 828{ 829 struct e1000_mac_info *mac = &hw->mac; 830 u32 reg_data; --- 61 unchanged lines hidden (view full) --- 892 e1000_clear_hw_cntrs_82571(hw); 893 894out: 895 return ret_val; 896} 897 898/** 899 * e1000_initialize_hw_bits_82571 - Initialize hardware-dependent bits | 886 * 887 * This inits the hardware readying it for operation. 888 **/ 889STATIC s32 890e1000_init_hw_82571(struct e1000_hw *hw) 891{ 892 struct e1000_mac_info *mac = &hw->mac; 893 u32 reg_data; --- 61 unchanged lines hidden (view full) --- 955 e1000_clear_hw_cntrs_82571(hw); 956 957out: 958 return ret_val; 959} 960 961/** 962 * e1000_initialize_hw_bits_82571 - Initialize hardware-dependent bits |
900 * @hw - pointer to the HW structure | 963 * @hw: pointer to the HW structure |
901 * 902 * Initializes required hardware-dependent bits needed for normal operation. 903 **/ 904static void 905e1000_initialize_hw_bits_82571(struct e1000_hw *hw) 906{ 907 u32 reg; 908 --- 26 unchanged lines hidden (view full) --- 935 E1000_WRITE_REG(hw, E1000_TARC0, reg); 936 937 /* Transmit Arbitration Control 1 */ 938 reg = E1000_READ_REG(hw, E1000_TARC1); 939 switch (hw->mac.type) { 940 case e1000_82571: 941 case e1000_82572: 942 reg &= ~((1 << 29) | (1 << 30)); | 964 * 965 * Initializes required hardware-dependent bits needed for normal operation. 966 **/ 967static void 968e1000_initialize_hw_bits_82571(struct e1000_hw *hw) 969{ 970 u32 reg; 971 --- 26 unchanged lines hidden (view full) --- 998 E1000_WRITE_REG(hw, E1000_TARC0, reg); 999 1000 /* Transmit Arbitration Control 1 */ 1001 reg = E1000_READ_REG(hw, E1000_TARC1); 1002 switch (hw->mac.type) { 1003 case e1000_82571: 1004 case e1000_82572: 1005 reg &= ~((1 << 29) | (1 << 30)); |
943 reg |= (1 << 24) | (1 << 25) | (1 << 26); | 1006 reg |= (1 << 22) | (1 << 24) | (1 << 25) | (1 << 26); |
944 if (E1000_READ_REG(hw, E1000_TCTL) & E1000_TCTL_MULR) 945 reg &= ~(1 << 28); 946 else 947 reg |= (1 << 28); 948 E1000_WRITE_REG(hw, E1000_TARC1, reg); 949 break; 950 default: 951 break; --- 15 unchanged lines hidden (view full) --- 967 } 968 969out: 970 return; 971} 972 973/** 974 * e1000_clear_vfta_82571 - Clear VLAN filter table | 1007 if (E1000_READ_REG(hw, E1000_TCTL) & E1000_TCTL_MULR) 1008 reg &= ~(1 << 28); 1009 else 1010 reg |= (1 << 28); 1011 E1000_WRITE_REG(hw, E1000_TARC1, reg); 1012 break; 1013 default: 1014 break; --- 15 unchanged lines hidden (view full) --- 1030 } 1031 1032out: 1033 return; 1034} 1035 1036/** 1037 * e1000_clear_vfta_82571 - Clear VLAN filter table |
975 * @hw - pointer to the HW structure | 1038 * @hw: pointer to the HW structure |
976 * 977 * Clears the register array which contains the VLAN filter table by 978 * setting all the values to 0. 979 **/ 980STATIC void 981e1000_clear_vfta_82571(struct e1000_hw *hw) 982{ 983 u32 offset; --- 26 unchanged lines hidden (view full) --- 1010 vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; 1011 E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, vfta_value); 1012 E1000_WRITE_FLUSH(hw); 1013 } 1014} 1015 1016/** 1017 * e1000_mc_addr_list_update_82571 - Update Multicast addresses | 1039 * 1040 * Clears the register array which contains the VLAN filter table by 1041 * setting all the values to 0. 1042 **/ 1043STATIC void 1044e1000_clear_vfta_82571(struct e1000_hw *hw) 1045{ 1046 u32 offset; --- 26 unchanged lines hidden (view full) --- 1073 vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; 1074 E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, vfta_value); 1075 E1000_WRITE_FLUSH(hw); 1076 } 1077} 1078 1079/** 1080 * e1000_mc_addr_list_update_82571 - Update Multicast addresses |
1018 * @hw - pointer to the HW structure 1019 * @mc_addr_list - array of multicast addresses to program 1020 * @mc_addr_count - number of multicast addresses to program 1021 * @rar_used_count - the first RAR register free to program 1022 * @rar_count - total number of supported Receive Address Registers | 1081 * @hw: pointer to the HW structure 1082 * @mc_addr_list: array of multicast addresses to program 1083 * @mc_addr_count: number of multicast addresses to program 1084 * @rar_used_count: the first RAR register free to program 1085 * @rar_count: total number of supported Receive Address Registers |
1023 * 1024 * Updates the Receive Address Registers and Multicast Table Array. 1025 * The caller must have a packed mc_addr_list of multicast addresses. 1026 * The parameter rar_count will usually be hw->mac.rar_entry_count 1027 * unless there are workarounds that change this. 1028 **/ 1029STATIC void 1030e1000_mc_addr_list_update_82571(struct e1000_hw *hw, --- 6 unchanged lines hidden (view full) --- 1037 rar_count--; 1038 1039 e1000_mc_addr_list_update_generic(hw, mc_addr_list, mc_addr_count, 1040 rar_used_count, rar_count); 1041} 1042 1043/** 1044 * e1000_setup_link_82571 - Setup flow control and link settings | 1086 * 1087 * Updates the Receive Address Registers and Multicast Table Array. 1088 * The caller must have a packed mc_addr_list of multicast addresses. 1089 * The parameter rar_count will usually be hw->mac.rar_entry_count 1090 * unless there are workarounds that change this. 1091 **/ 1092STATIC void 1093e1000_mc_addr_list_update_82571(struct e1000_hw *hw, --- 6 unchanged lines hidden (view full) --- 1100 rar_count--; 1101 1102 e1000_mc_addr_list_update_generic(hw, mc_addr_list, mc_addr_count, 1103 rar_used_count, rar_count); 1104} 1105 1106/** 1107 * e1000_setup_link_82571 - Setup flow control and link settings |
1045 * @hw - pointer to the HW structure | 1108 * @hw: pointer to the HW structure |
1046 * 1047 * Determines which flow control settings to use, then configures flow 1048 * control. Calls the appropriate media-specific link configuration 1049 * function. Assuming the adapter has a valid link partner, a valid link 1050 * should be established. Assumes the hardware has previously been reset 1051 * and the transmitter and receiver are not enabled. 1052 **/ 1053STATIC s32 --- 8 unchanged lines hidden (view full) --- 1062 if (hw->mac.type == e1000_82573) 1063 hw->mac.fc = e1000_fc_full; 1064 1065 return e1000_setup_link_generic(hw); 1066} 1067 1068/** 1069 * e1000_setup_copper_link_82571 - Configure copper link settings | 1109 * 1110 * Determines which flow control settings to use, then configures flow 1111 * control. Calls the appropriate media-specific link configuration 1112 * function. Assuming the adapter has a valid link partner, a valid link 1113 * should be established. Assumes the hardware has previously been reset 1114 * and the transmitter and receiver are not enabled. 1115 **/ 1116STATIC s32 --- 8 unchanged lines hidden (view full) --- 1125 if (hw->mac.type == e1000_82573) 1126 hw->mac.fc = e1000_fc_full; 1127 1128 return e1000_setup_link_generic(hw); 1129} 1130 1131/** 1132 * e1000_setup_copper_link_82571 - Configure copper link settings |
1070 * @hw - pointer to the HW structure | 1133 * @hw: pointer to the HW structure |
1071 * 1072 * Configures the link for auto-neg or forced speed and duplex. Then we check 1073 * for link, once link is established calls to configure collision distance 1074 * and flow control are called. 1075 **/ 1076STATIC s32 1077e1000_setup_copper_link_82571(struct e1000_hw *hw) 1078{ --- 30 unchanged lines hidden (view full) --- 1109 ret_val = e1000_setup_copper_link_generic(hw); 1110 1111out: 1112 return ret_val; 1113} 1114 1115/** 1116 * e1000_setup_fiber_serdes_link_82571 - Setup link for fiber/serdes | 1134 * 1135 * Configures the link for auto-neg or forced speed and duplex. Then we check 1136 * for link, once link is established calls to configure collision distance 1137 * and flow control are called. 1138 **/ 1139STATIC s32 1140e1000_setup_copper_link_82571(struct e1000_hw *hw) 1141{ --- 30 unchanged lines hidden (view full) --- 1172 ret_val = e1000_setup_copper_link_generic(hw); 1173 1174out: 1175 return ret_val; 1176} 1177 1178/** 1179 * e1000_setup_fiber_serdes_link_82571 - Setup link for fiber/serdes |
1117 * @hw - pointer to the HW structure | 1180 * @hw: pointer to the HW structure |
1118 * 1119 * Configures collision distance and flow control for fiber and serdes links. 1120 * Upon successful setup, poll for link. 1121 **/ 1122STATIC s32 1123e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) 1124{ 1125 DEBUGFUNC("e1000_setup_fiber_serdes_link_82571"); --- 13 unchanged lines hidden (view full) --- 1139 break; 1140 } 1141 1142 return e1000_setup_fiber_serdes_link_generic(hw); 1143} 1144 1145/** 1146 * e1000_valid_led_default_82571 - Verify a valid default LED config | 1181 * 1182 * Configures collision distance and flow control for fiber and serdes links. 1183 * Upon successful setup, poll for link. 1184 **/ 1185STATIC s32 1186e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) 1187{ 1188 DEBUGFUNC("e1000_setup_fiber_serdes_link_82571"); --- 13 unchanged lines hidden (view full) --- 1202 break; 1203 } 1204 1205 return e1000_setup_fiber_serdes_link_generic(hw); 1206} 1207 1208/** 1209 * e1000_valid_led_default_82571 - Verify a valid default LED config |
1147 * @hw - pointer to the HW structure 1148 * @data - pointer to the NVM (EEPROM) | 1210 * @hw: pointer to the HW structure 1211 * @data: pointer to the NVM (EEPROM) |
1149 * 1150 * Read the EEPROM for the current default LED configuration. If the 1151 * LED configuration is not valid, set to a valid LED configuration. 1152 **/ 1153STATIC s32 1154e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data) 1155{ 1156 s32 ret_val; --- 14 unchanged lines hidden (view full) --- 1171 *data = ID_LED_DEFAULT; 1172 1173out: 1174 return ret_val; 1175} 1176 1177/** 1178 * e1000_get_laa_state_82571 - Get locally administered address state | 1212 * 1213 * Read the EEPROM for the current default LED configuration. If the 1214 * LED configuration is not valid, set to a valid LED configuration. 1215 **/ 1216STATIC s32 1217e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data) 1218{ 1219 s32 ret_val; --- 14 unchanged lines hidden (view full) --- 1234 *data = ID_LED_DEFAULT; 1235 1236out: 1237 return ret_val; 1238} 1239 1240/** 1241 * e1000_get_laa_state_82571 - Get locally administered address state |
1179 * @hw - pointer to the HW structure | 1242 * @hw: pointer to the HW structure |
1180 * 1181 * Retrieve and return the current locally administed address state. 1182 **/ 1183boolean_t 1184e1000_get_laa_state_82571(struct e1000_hw *hw) 1185{ 1186 struct e1000_dev_spec_82571 *dev_spec; 1187 boolean_t state = FALSE; --- 8 unchanged lines hidden (view full) --- 1196 state = dev_spec->laa_is_present; 1197 1198out: 1199 return state; 1200} 1201 1202/** 1203 * e1000_set_laa_state_82571 - Set locally administered address state | 1243 * 1244 * Retrieve and return the current locally administed address state. 1245 **/ 1246boolean_t 1247e1000_get_laa_state_82571(struct e1000_hw *hw) 1248{ 1249 struct e1000_dev_spec_82571 *dev_spec; 1250 boolean_t state = FALSE; --- 8 unchanged lines hidden (view full) --- 1259 state = dev_spec->laa_is_present; 1260 1261out: 1262 return state; 1263} 1264 1265/** 1266 * e1000_set_laa_state_82571 - Set locally administered address state |
1204 * @hw - pointer to the HW structure 1205 * @state - enable/disable locally administered address | 1267 * @hw: pointer to the HW structure 1268 * @state: enable/disable locally administered address |
1206 * 1207 * Enable/Disable the current locally administed address state. 1208 **/ 1209void 1210e1000_set_laa_state_82571(struct e1000_hw *hw, boolean_t state) 1211{ 1212 struct e1000_dev_spec_82571 *dev_spec; 1213 --- 19 unchanged lines hidden (view full) --- 1233 } 1234 1235out: 1236 return; 1237} 1238 1239/** 1240 * e1000_fix_nvm_checksum_82571 - Fix EEPROM checksum | 1269 * 1270 * Enable/Disable the current locally administed address state. 1271 **/ 1272void 1273e1000_set_laa_state_82571(struct e1000_hw *hw, boolean_t state) 1274{ 1275 struct e1000_dev_spec_82571 *dev_spec; 1276 --- 19 unchanged lines hidden (view full) --- 1296 } 1297 1298out: 1299 return; 1300} 1301 1302/** 1303 * e1000_fix_nvm_checksum_82571 - Fix EEPROM checksum |
1241 * @hw - pointer to the HW structure | 1304 * @hw: pointer to the HW structure |
1242 * 1243 * Verifies that the EEPROM has completed the update. After updating the 1244 * EEPROM, we need to check bit 15 in work 0x23 for the checksum fix. If 1245 * the checksum fix is not implemented, we need to set the bit and update 1246 * the checksum. Otherwise, if bit 15 is set and the checksum is incorrect, 1247 * we need to return bad checksum. 1248 **/ 1249static s32 --- 37 unchanged lines hidden (view full) --- 1287 } 1288 1289out: 1290 return ret_val; 1291} 1292 1293/** 1294 * e1000_clear_hw_cntrs_82571 - Clear device specific hardware counters | 1305 * 1306 * Verifies that the EEPROM has completed the update. After updating the 1307 * EEPROM, we need to check bit 15 in work 0x23 for the checksum fix. If 1308 * the checksum fix is not implemented, we need to set the bit and update 1309 * the checksum. Otherwise, if bit 15 is set and the checksum is incorrect, 1310 * we need to return bad checksum. 1311 **/ 1312static s32 --- 37 unchanged lines hidden (view full) --- 1350 } 1351 1352out: 1353 return ret_val; 1354} 1355 1356/** 1357 * e1000_clear_hw_cntrs_82571 - Clear device specific hardware counters |
1295 * @hw - pointer to the HW structure | 1358 * @hw: pointer to the HW structure |
1296 * 1297 * Clears the hardware counters by reading the counter registers. 1298 **/ 1299STATIC void 1300e1000_clear_hw_cntrs_82571(struct e1000_hw *hw) 1301{ 1302 volatile u32 temp; 1303 --- 39 unchanged lines hidden --- | 1359 * 1360 * Clears the hardware counters by reading the counter registers. 1361 **/ 1362STATIC void 1363e1000_clear_hw_cntrs_82571(struct e1000_hw *hw) 1364{ 1365 volatile u32 temp; 1366 --- 39 unchanged lines hidden --- |