e1000_82543.c (169248) | e1000_82543.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_82543.c 169589 2007-05-16 00:14:23Z jfv $*/ |
|
33 | 34 |
34#include <sys/cdefs.h> 35__FBSDID("$FreeBSD: head/sys/dev/em/e1000_82543.c 169248 2007-05-04 13:30:44Z rwatson $"); | |
36 | 35 |
37 | |
38/* e1000_82543 39 * e1000_82544 40 */ 41 | 36/* e1000_82543 37 * e1000_82544 38 */ 39 |
40#include "e1000_api.h" |
|
42#include "e1000_82543.h" 43 44void e1000_init_function_pointers_82543(struct e1000_hw *hw); 45 46STATIC s32 e1000_init_phy_params_82543(struct e1000_hw *hw); 47STATIC s32 e1000_init_nvm_params_82543(struct e1000_hw *hw); 48STATIC s32 e1000_init_mac_params_82543(struct e1000_hw *hw); 49STATIC s32 e1000_read_phy_reg_82543(struct e1000_hw *hw, u32 offset, --- 29 unchanged lines hidden (view full) --- 79struct e1000_dev_spec_82543 { 80 u32 tbi_compatibility; 81 boolean_t dma_fairness; 82 boolean_t init_phy_disabled; 83}; 84 85/** 86 * e1000_init_phy_params_82543 - Init PHY func ptrs. | 41#include "e1000_82543.h" 42 43void e1000_init_function_pointers_82543(struct e1000_hw *hw); 44 45STATIC s32 e1000_init_phy_params_82543(struct e1000_hw *hw); 46STATIC s32 e1000_init_nvm_params_82543(struct e1000_hw *hw); 47STATIC s32 e1000_init_mac_params_82543(struct e1000_hw *hw); 48STATIC s32 e1000_read_phy_reg_82543(struct e1000_hw *hw, u32 offset, --- 29 unchanged lines hidden (view full) --- 78struct e1000_dev_spec_82543 { 79 u32 tbi_compatibility; 80 boolean_t dma_fairness; 81 boolean_t init_phy_disabled; 82}; 83 84/** 85 * e1000_init_phy_params_82543 - Init PHY func ptrs. |
87 * @hw - pointer to the HW structure | 86 * @hw: pointer to the HW structure |
88 * 89 * This is a function pointer entry point called by the api module. 90 **/ 91STATIC s32 92e1000_init_phy_params_82543(struct e1000_hw *hw) 93{ 94 struct e1000_phy_info *phy = &hw->phy; 95 struct e1000_functions *func = &hw->func; --- 66 unchanged lines hidden (view full) --- 162 } 163 164out: 165 return ret_val; 166} 167 168/** 169 * e1000_init_nvm_params_82543 - Init NVM func ptrs. | 87 * 88 * This is a function pointer entry point called by the api module. 89 **/ 90STATIC s32 91e1000_init_phy_params_82543(struct e1000_hw *hw) 92{ 93 struct e1000_phy_info *phy = &hw->phy; 94 struct e1000_functions *func = &hw->func; --- 66 unchanged lines hidden (view full) --- 161 } 162 163out: 164 return ret_val; 165} 166 167/** 168 * e1000_init_nvm_params_82543 - Init NVM func ptrs. |
170 * @hw - pointer to the HW structure | 169 * @hw: pointer to the HW structure |
171 * 172 * This is a function pointer entry point called by the api module. 173 **/ 174STATIC s32 175e1000_init_nvm_params_82543(struct e1000_hw *hw) 176{ 177 struct e1000_nvm_info *nvm = &hw->nvm; 178 struct e1000_functions *func = &hw->func; --- 13 unchanged lines hidden (view full) --- 192 func->validate_nvm = e1000_validate_nvm_checksum_generic; 193 func->write_nvm = e1000_write_nvm_microwire; 194 195 return E1000_SUCCESS; 196} 197 198/** 199 * e1000_init_mac_params_82543 - Init MAC func ptrs. | 170 * 171 * This is a function pointer entry point called by the api module. 172 **/ 173STATIC s32 174e1000_init_nvm_params_82543(struct e1000_hw *hw) 175{ 176 struct e1000_nvm_info *nvm = &hw->nvm; 177 struct e1000_functions *func = &hw->func; --- 13 unchanged lines hidden (view full) --- 191 func->validate_nvm = e1000_validate_nvm_checksum_generic; 192 func->write_nvm = e1000_write_nvm_microwire; 193 194 return E1000_SUCCESS; 195} 196 197/** 198 * e1000_init_mac_params_82543 - Init MAC func ptrs. |
200 * @hw - pointer to the HW structure | 199 * @hw: pointer to the HW structure |
201 * 202 * This is a function pointer entry point called by the api module. 203 **/ 204STATIC s32 205e1000_init_mac_params_82543(struct e1000_hw *hw) 206{ 207 struct e1000_mac_info *mac = &hw->mac; 208 struct e1000_functions *func = &hw->func; --- 71 unchanged lines hidden (view full) --- 280 e1000_set_tbi_compatibility_82543(hw, FALSE); 281 282out: 283 return ret_val; 284} 285 286/** 287 * e1000_init_function_pointers_82543 - Init func ptrs. | 200 * 201 * This is a function pointer entry point called by the api module. 202 **/ 203STATIC s32 204e1000_init_mac_params_82543(struct e1000_hw *hw) 205{ 206 struct e1000_mac_info *mac = &hw->mac; 207 struct e1000_functions *func = &hw->func; --- 71 unchanged lines hidden (view full) --- 279 e1000_set_tbi_compatibility_82543(hw, FALSE); 280 281out: 282 return ret_val; 283} 284 285/** 286 * e1000_init_function_pointers_82543 - Init func ptrs. |
288 * @hw - pointer to the HW structure | 287 * @hw: pointer to the HW structure |
289 * 290 * The only function explicitly called by the api module to initialize 291 * all function pointers and parameters. 292 **/ 293void 294e1000_init_function_pointers_82543(struct e1000_hw *hw) 295{ 296 DEBUGFUNC("e1000_init_function_pointers_82543"); 297 298 hw->func.init_mac_params = e1000_init_mac_params_82543; 299 hw->func.init_nvm_params = e1000_init_nvm_params_82543; 300 hw->func.init_phy_params = e1000_init_phy_params_82543; 301} 302 303/** 304 * e1000_tbi_compatibility_enabled_82543 - Returns TBI compat status | 288 * 289 * The only function explicitly called by the api module to initialize 290 * all function pointers and parameters. 291 **/ 292void 293e1000_init_function_pointers_82543(struct e1000_hw *hw) 294{ 295 DEBUGFUNC("e1000_init_function_pointers_82543"); 296 297 hw->func.init_mac_params = e1000_init_mac_params_82543; 298 hw->func.init_nvm_params = e1000_init_nvm_params_82543; 299 hw->func.init_phy_params = e1000_init_phy_params_82543; 300} 301 302/** 303 * e1000_tbi_compatibility_enabled_82543 - Returns TBI compat status |
305 * @hw - pointer to the HW structure | 304 * @hw: pointer to the HW structure |
306 * 307 * Returns the curent status of 10-bit Interface (TBI) compatibility 308 * (enabled/disabled). 309 **/ 310static boolean_t 311e1000_tbi_compatibility_enabled_82543(struct e1000_hw *hw) 312{ 313 struct e1000_dev_spec_82543 *dev_spec; --- 17 unchanged lines hidden (view full) --- 331 ? TRUE : FALSE; 332 333out: 334 return state; 335} 336 337/** 338 * e1000_set_tbi_compatibility_82543 - Set TBI compatibility | 305 * 306 * Returns the curent status of 10-bit Interface (TBI) compatibility 307 * (enabled/disabled). 308 **/ 309static boolean_t 310e1000_tbi_compatibility_enabled_82543(struct e1000_hw *hw) 311{ 312 struct e1000_dev_spec_82543 *dev_spec; --- 17 unchanged lines hidden (view full) --- 330 ? TRUE : FALSE; 331 332out: 333 return state; 334} 335 336/** 337 * e1000_set_tbi_compatibility_82543 - Set TBI compatibility |
339 * @hw - pointer to the HW structure 340 * @state - enable/disable TBI compatibility | 338 * @hw: pointer to the HW structure 339 * @state: enable/disable TBI compatibility |
341 * 342 * Enables or disabled 10-bit Interface (TBI) compatibility. 343 **/ 344void 345e1000_set_tbi_compatibility_82543(struct e1000_hw *hw, boolean_t state) 346{ 347 struct e1000_dev_spec_82543 *dev_spec; 348 --- 17 unchanged lines hidden (view full) --- 366 dev_spec->tbi_compatibility &= ~TBI_COMPAT_ENABLED; 367 368out: 369 return; 370} 371 372/** 373 * e1000_tbi_sbp_enabled_82543 - Returns TBI SBP status | 340 * 341 * Enables or disabled 10-bit Interface (TBI) compatibility. 342 **/ 343void 344e1000_set_tbi_compatibility_82543(struct e1000_hw *hw, boolean_t state) 345{ 346 struct e1000_dev_spec_82543 *dev_spec; 347 --- 17 unchanged lines hidden (view full) --- 365 dev_spec->tbi_compatibility &= ~TBI_COMPAT_ENABLED; 366 367out: 368 return; 369} 370 371/** 372 * e1000_tbi_sbp_enabled_82543 - Returns TBI SBP status |
374 * @hw - pointer to the HW structure | 373 * @hw: pointer to the HW structure |
375 * 376 * Returns the curent status of 10-bit Interface (TBI) store bad packet (SBP) 377 * (enabled/disabled). 378 **/ 379boolean_t 380e1000_tbi_sbp_enabled_82543(struct e1000_hw *hw) 381{ 382 struct e1000_dev_spec_82543 *dev_spec; --- 17 unchanged lines hidden (view full) --- 400 ? TRUE : FALSE; 401 402out: 403 return state; 404} 405 406/** 407 * e1000_set_tbi_sbp_82543 - Set TBI SBP | 374 * 375 * Returns the curent status of 10-bit Interface (TBI) store bad packet (SBP) 376 * (enabled/disabled). 377 **/ 378boolean_t 379e1000_tbi_sbp_enabled_82543(struct e1000_hw *hw) 380{ 381 struct e1000_dev_spec_82543 *dev_spec; --- 17 unchanged lines hidden (view full) --- 399 ? TRUE : FALSE; 400 401out: 402 return state; 403} 404 405/** 406 * e1000_set_tbi_sbp_82543 - Set TBI SBP |
408 * @hw - pointer to the HW structure 409 * @state - enable/disable TBI store bad packet | 407 * @hw: pointer to the HW structure 408 * @state: enable/disable TBI store bad packet |
410 * 411 * Enables or disabled 10-bit Interface (TBI) store bad packet (SBP). 412 **/ 413static void 414e1000_set_tbi_sbp_82543(struct e1000_hw *hw, boolean_t state) 415{ 416 struct e1000_dev_spec_82543 *dev_spec; 417 --- 6 unchanged lines hidden (view full) --- 424 else 425 dev_spec->tbi_compatibility &= ~TBI_SBP_ENABLED; 426 427 return; 428} 429 430/** 431 * e1000_init_phy_disabled_82543 - Returns init PHY status | 409 * 410 * Enables or disabled 10-bit Interface (TBI) store bad packet (SBP). 411 **/ 412static void 413e1000_set_tbi_sbp_82543(struct e1000_hw *hw, boolean_t state) 414{ 415 struct e1000_dev_spec_82543 *dev_spec; 416 --- 6 unchanged lines hidden (view full) --- 423 else 424 dev_spec->tbi_compatibility &= ~TBI_SBP_ENABLED; 425 426 return; 427} 428 429/** 430 * e1000_init_phy_disabled_82543 - Returns init PHY status |
432 * @hw - pointer to the HW structure | 431 * @hw: pointer to the HW structure |
433 * 434 * Returns the current status of whether PHY initialization is disabled. 435 * True if PHY initialization is disabled else false. 436 **/ 437static boolean_t 438e1000_init_phy_disabled_82543(struct e1000_hw *hw) 439{ 440 struct e1000_dev_spec_82543 *dev_spec; --- 17 unchanged lines hidden (view full) --- 458 ret_val = dev_spec->init_phy_disabled; 459 460out: 461 return ret_val; 462} 463 464/** 465 * e1000_tbi_adjust_stats_82543 - Adjust stats when TBI enabled | 432 * 433 * Returns the current status of whether PHY initialization is disabled. 434 * True if PHY initialization is disabled else false. 435 **/ 436static boolean_t 437e1000_init_phy_disabled_82543(struct e1000_hw *hw) 438{ 439 struct e1000_dev_spec_82543 *dev_spec; --- 17 unchanged lines hidden (view full) --- 457 ret_val = dev_spec->init_phy_disabled; 458 459out: 460 return ret_val; 461} 462 463/** 464 * e1000_tbi_adjust_stats_82543 - Adjust stats when TBI enabled |
466 * @hw - pointer to the HW structure 467 * @stats - Struct containing statistic register values 468 * @frame_len - The length of the frame in question 469 * @mac_addr - The Ethernet destination address of the frame in question | 465 * @hw: pointer to the HW structure 466 * @stats: Struct containing statistic register values 467 * @frame_len: The length of the frame in question 468 * @mac_addr: The Ethernet destination address of the frame in question |
470 * 471 * Adjusts the statistic counters when a frame is accepted by TBI_ACCEPT 472 **/ 473void 474e1000_tbi_adjust_stats_82543(struct e1000_hw *hw, struct e1000_hw_stats *stats, 475 u32 frame_len, u8 *mac_addr) 476{ 477 u64 carry_bit; --- 64 unchanged lines hidden (view full) --- 542 } 543 544out: 545 return; 546} 547 548/** 549 * e1000_read_phy_reg_82543 - Read PHY register | 469 * 470 * Adjusts the statistic counters when a frame is accepted by TBI_ACCEPT 471 **/ 472void 473e1000_tbi_adjust_stats_82543(struct e1000_hw *hw, struct e1000_hw_stats *stats, 474 u32 frame_len, u8 *mac_addr) 475{ 476 u64 carry_bit; --- 64 unchanged lines hidden (view full) --- 541 } 542 543out: 544 return; 545} 546 547/** 548 * e1000_read_phy_reg_82543 - Read PHY register |
550 * @hw - pointer to the HW structure 551 * @offset - register offset to be read 552 * @data - pointer to the read data | 549 * @hw: pointer to the HW structure 550 * @offset: register offset to be read 551 * @data: pointer to the read data |
553 * 554 * Reads the PHY at offset and stores the information read to data. 555 **/ 556STATIC s32 557e1000_read_phy_reg_82543(struct e1000_hw *hw, u32 offset, u16 *data) 558{ 559 u32 mdic; 560 s32 ret_val = E1000_SUCCESS; --- 35 unchanged lines hidden (view full) --- 596 *data = e1000_shift_in_mdi_bits_82543(hw); 597 598out: 599 return ret_val; 600} 601 602/** 603 * e1000_write_phy_reg_82543 - Write PHY register | 552 * 553 * Reads the PHY at offset and stores the information read to data. 554 **/ 555STATIC s32 556e1000_read_phy_reg_82543(struct e1000_hw *hw, u32 offset, u16 *data) 557{ 558 u32 mdic; 559 s32 ret_val = E1000_SUCCESS; --- 35 unchanged lines hidden (view full) --- 595 *data = e1000_shift_in_mdi_bits_82543(hw); 596 597out: 598 return ret_val; 599} 600 601/** 602 * e1000_write_phy_reg_82543 - Write PHY register |
604 * @hw - pointer to the HW structure 605 * @offset - register offset to be written 606 * @data - pointer to the data to be written at offset | 603 * @hw: pointer to the HW structure 604 * @offset: register offset to be written 605 * @data: pointer to the data to be written at offset |
607 * 608 * Writes data to the PHY at offset. 609 **/ 610STATIC s32 611e1000_write_phy_reg_82543(struct e1000_hw *hw, u32 offset, u16 data) 612{ 613 u32 mdic; 614 s32 ret_val = E1000_SUCCESS; --- 27 unchanged lines hidden (view full) --- 642 e1000_shift_out_mdi_bits_82543(hw, mdic, 32); 643 644out: 645 return ret_val; 646} 647 648/** 649 * e1000_raise_mdi_clk_82543 - Raise Management Data Input clock | 606 * 607 * Writes data to the PHY at offset. 608 **/ 609STATIC s32 610e1000_write_phy_reg_82543(struct e1000_hw *hw, u32 offset, u16 data) 611{ 612 u32 mdic; 613 s32 ret_val = E1000_SUCCESS; --- 27 unchanged lines hidden (view full) --- 641 e1000_shift_out_mdi_bits_82543(hw, mdic, 32); 642 643out: 644 return ret_val; 645} 646 647/** 648 * e1000_raise_mdi_clk_82543 - Raise Management Data Input clock |
650 * @hw - pointer to the HW structure 651 * @ctrl - pointer to the control register | 649 * @hw: pointer to the HW structure 650 * @ctrl: pointer to the control register |
652 * 653 * Raise the management data input clock by setting the MDC bit in the control 654 * register. 655 **/ 656static void 657e1000_raise_mdi_clk_82543(struct e1000_hw *hw, u32 *ctrl) 658{ 659 /* Raise the clock input to the Management Data Clock (by setting the 660 * MDC bit), and then delay a sufficient amount of time. 661 */ 662 E1000_WRITE_REG(hw, E1000_CTRL, (*ctrl | E1000_CTRL_MDC)); 663 E1000_WRITE_FLUSH(hw); 664 usec_delay(10); 665} 666 667/** 668 * e1000_lower_mdi_clk_82543 - Lower Management Data Input clock | 651 * 652 * Raise the management data input clock by setting the MDC bit in the control 653 * register. 654 **/ 655static void 656e1000_raise_mdi_clk_82543(struct e1000_hw *hw, u32 *ctrl) 657{ 658 /* Raise the clock input to the Management Data Clock (by setting the 659 * MDC bit), and then delay a sufficient amount of time. 660 */ 661 E1000_WRITE_REG(hw, E1000_CTRL, (*ctrl | E1000_CTRL_MDC)); 662 E1000_WRITE_FLUSH(hw); 663 usec_delay(10); 664} 665 666/** 667 * e1000_lower_mdi_clk_82543 - Lower Management Data Input clock |
669 * @hw - pointer to the HW structure 670 * @ctrl - pointer to the control register | 668 * @hw: pointer to the HW structure 669 * @ctrl: pointer to the control register |
671 * 672 * Lower the management data input clock by clearing the MDC bit in the control 673 * register. 674 **/ 675static void 676e1000_lower_mdi_clk_82543(struct e1000_hw *hw, u32 *ctrl) 677{ 678 /* Lower the clock input to the Management Data Clock (by clearing the 679 * MDC bit), and then delay a sufficient amount of time. 680 */ 681 E1000_WRITE_REG(hw, E1000_CTRL, (*ctrl & ~E1000_CTRL_MDC)); 682 E1000_WRITE_FLUSH(hw); 683 usec_delay(10); 684} 685 686/** 687 * e1000_shift_out_mdi_bits_82543 - Shift data bits our to the PHY | 670 * 671 * Lower the management data input clock by clearing the MDC bit in the control 672 * register. 673 **/ 674static void 675e1000_lower_mdi_clk_82543(struct e1000_hw *hw, u32 *ctrl) 676{ 677 /* Lower the clock input to the Management Data Clock (by clearing the 678 * MDC bit), and then delay a sufficient amount of time. 679 */ 680 E1000_WRITE_REG(hw, E1000_CTRL, (*ctrl & ~E1000_CTRL_MDC)); 681 E1000_WRITE_FLUSH(hw); 682 usec_delay(10); 683} 684 685/** 686 * e1000_shift_out_mdi_bits_82543 - Shift data bits our to the PHY |
688 * @hw - pointer to the HW structure 689 * @data - data to send to the PHY 690 * @count - number of bits to shift out | 687 * @hw: pointer to the HW structure 688 * @data: data to send to the PHY 689 * @count: number of bits to shift out |
691 * 692 * We need to shift 'count' bits out to the PHY. So, the value in the 693 * "data" parameter will be shifted out to the PHY one bit at a time. 694 * In order to do this, "data" must be broken down into bits. 695 **/ 696static void 697e1000_shift_out_mdi_bits_82543(struct e1000_hw *hw, u32 data, u16 count) 698{ --- 30 unchanged lines hidden (view full) --- 729 e1000_lower_mdi_clk_82543(hw, &ctrl); 730 731 mask >>= 1; 732 } 733} 734 735/** 736 * e1000_shift_in_mdi_bits_82543 - Shift data bits in from the PHY | 690 * 691 * We need to shift 'count' bits out to the PHY. So, the value in the 692 * "data" parameter will be shifted out to the PHY one bit at a time. 693 * In order to do this, "data" must be broken down into bits. 694 **/ 695static void 696e1000_shift_out_mdi_bits_82543(struct e1000_hw *hw, u32 data, u16 count) 697{ --- 30 unchanged lines hidden (view full) --- 728 e1000_lower_mdi_clk_82543(hw, &ctrl); 729 730 mask >>= 1; 731 } 732} 733 734/** 735 * e1000_shift_in_mdi_bits_82543 - Shift data bits in from the PHY |
737 * @hw - pointer to the HW structure | 736 * @hw: pointer to the HW structure |
738 * 739 * In order to read a register from the PHY, we need to shift 18 bits 740 * in from the PHY. Bits are "shifted in" by raising the clock input to 741 * the PHY (setting the MDC bit), and then reading the value of the data out 742 * MDIO bit. 743 **/ 744static u16 745e1000_shift_in_mdi_bits_82543(struct e1000_hw *hw) --- 41 unchanged lines hidden (view full) --- 787 e1000_raise_mdi_clk_82543(hw, &ctrl); 788 e1000_lower_mdi_clk_82543(hw, &ctrl); 789 790 return data; 791} 792 793/** 794 * e1000_phy_force_speed_duplex_82543 - Force speed/duplex for PHY | 737 * 738 * In order to read a register from the PHY, we need to shift 18 bits 739 * in from the PHY. Bits are "shifted in" by raising the clock input to 740 * the PHY (setting the MDC bit), and then reading the value of the data out 741 * MDIO bit. 742 **/ 743static u16 744e1000_shift_in_mdi_bits_82543(struct e1000_hw *hw) --- 41 unchanged lines hidden (view full) --- 786 e1000_raise_mdi_clk_82543(hw, &ctrl); 787 e1000_lower_mdi_clk_82543(hw, &ctrl); 788 789 return data; 790} 791 792/** 793 * e1000_phy_force_speed_duplex_82543 - Force speed/duplex for PHY |
795 * @hw - pointer to the HW structure | 794 * @hw: pointer to the HW structure |
796 * 797 * Calls the function to force speed and duplex for the m88 PHY, and 798 * if the PHY is not auto-negotiating and the speed is forced to 10Mbit, 799 * then call the function for polarity reversal workaround. 800 **/ 801STATIC s32 802e1000_phy_force_speed_duplex_82543(struct e1000_hw *hw) 803{ --- 10 unchanged lines hidden (view full) --- 814 ret_val = e1000_polarity_reversal_workaround_82543(hw); 815 816out: 817 return ret_val; 818} 819 820/** 821 * e1000_polarity_reversal_workaround_82543 - Workaround polarity reversal | 795 * 796 * Calls the function to force speed and duplex for the m88 PHY, and 797 * if the PHY is not auto-negotiating and the speed is forced to 10Mbit, 798 * then call the function for polarity reversal workaround. 799 **/ 800STATIC s32 801e1000_phy_force_speed_duplex_82543(struct e1000_hw *hw) 802{ --- 10 unchanged lines hidden (view full) --- 813 ret_val = e1000_polarity_reversal_workaround_82543(hw); 814 815out: 816 return ret_val; 817} 818 819/** 820 * e1000_polarity_reversal_workaround_82543 - Workaround polarity reversal |
822 * @hw - pointer to the HW structure | 821 * @hw: pointer to the HW structure |
823 * 824 * When forcing link to 10 Full or 10 Half, the PHY can reverse the polarity 825 * inadvertantly. To workaround the issue, we disable the transmitter on 826 * the PHY until we have established the link partner's link parameters. 827 **/ 828static s32 829e1000_polarity_reversal_workaround_82543(struct e1000_hw *hw) 830{ --- 71 unchanged lines hidden (view full) --- 902 goto out; 903 904out: 905 return ret_val; 906} 907 908/** 909 * e1000_phy_hw_reset_82543 - PHY hardware reset | 822 * 823 * When forcing link to 10 Full or 10 Half, the PHY can reverse the polarity 824 * inadvertantly. To workaround the issue, we disable the transmitter on 825 * the PHY until we have established the link partner's link parameters. 826 **/ 827static s32 828e1000_polarity_reversal_workaround_82543(struct e1000_hw *hw) 829{ --- 71 unchanged lines hidden (view full) --- 901 goto out; 902 903out: 904 return ret_val; 905} 906 907/** 908 * e1000_phy_hw_reset_82543 - PHY hardware reset |
910 * @hw - pointer to the HW structure | 909 * @hw: pointer to the HW structure |
911 * 912 * Sets the PHY_RESET_DIR bit in the extended device control register 913 * to put the PHY into a reset and waits for completion. Once the reset 914 * has been accomplished, clear the PHY_RESET_DIR bit to take the PHY out 915 * of reset. This is a function pointer entry point called by the api module. 916 **/ 917STATIC s32 918e1000_phy_hw_reset_82543(struct e1000_hw *hw) --- 24 unchanged lines hidden (view full) --- 943 944 ret_val = func->get_cfg_done(hw); 945 946 return ret_val; 947} 948 949/** 950 * e1000_reset_hw_82543 - Reset hardware | 910 * 911 * Sets the PHY_RESET_DIR bit in the extended device control register 912 * to put the PHY into a reset and waits for completion. Once the reset 913 * has been accomplished, clear the PHY_RESET_DIR bit to take the PHY out 914 * of reset. This is a function pointer entry point called by the api module. 915 **/ 916STATIC s32 917e1000_phy_hw_reset_82543(struct e1000_hw *hw) --- 24 unchanged lines hidden (view full) --- 942 943 ret_val = func->get_cfg_done(hw); 944 945 return ret_val; 946} 947 948/** 949 * e1000_reset_hw_82543 - Reset hardware |
951 * @hw - pointer to the HW structure | 950 * @hw: pointer to the HW structure |
952 * 953 * This resets the hardware into a known state. This is a 954 * function pointer entry point called by the api module. 955 **/ 956STATIC s32 957e1000_reset_hw_82543(struct e1000_hw *hw) 958{ 959 u32 ctrl, icr; --- 37 unchanged lines hidden (view full) --- 997 E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); 998 icr = E1000_READ_REG(hw, E1000_ICR); 999 1000 return ret_val; 1001} 1002 1003/** 1004 * e1000_init_hw_82543 - Initialize hardware | 951 * 952 * This resets the hardware into a known state. This is a 953 * function pointer entry point called by the api module. 954 **/ 955STATIC s32 956e1000_reset_hw_82543(struct e1000_hw *hw) 957{ 958 u32 ctrl, icr; --- 37 unchanged lines hidden (view full) --- 996 E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); 997 icr = E1000_READ_REG(hw, E1000_ICR); 998 999 return ret_val; 1000} 1001 1002/** 1003 * e1000_init_hw_82543 - Initialize hardware |
1005 * @hw - pointer to the HW structure | 1004 * @hw: pointer to the HW structure |
1006 * 1007 * This inits the hardware readying it for operation. 1008 **/ 1009STATIC s32 1010e1000_init_hw_82543(struct e1000_hw *hw) 1011{ 1012 struct e1000_mac_info *mac = &hw->mac; 1013 struct e1000_dev_spec_82543 *dev_spec; --- 47 unchanged lines hidden (view full) --- 1061 e1000_clear_hw_cntrs_82543(hw); 1062 1063out: 1064 return ret_val; 1065} 1066 1067/** 1068 * e1000_setup_link_82543 - Setup flow control and link settings | 1005 * 1006 * This inits the hardware readying it for operation. 1007 **/ 1008STATIC s32 1009e1000_init_hw_82543(struct e1000_hw *hw) 1010{ 1011 struct e1000_mac_info *mac = &hw->mac; 1012 struct e1000_dev_spec_82543 *dev_spec; --- 47 unchanged lines hidden (view full) --- 1060 e1000_clear_hw_cntrs_82543(hw); 1061 1062out: 1063 return ret_val; 1064} 1065 1066/** 1067 * e1000_setup_link_82543 - Setup flow control and link settings |
1069 * @hw - pointer to the HW structure | 1068 * @hw: pointer to the HW structure |
1070 * 1071 * Read the EEPROM to determine the initial polarity value and write the 1072 * extended device control register with the information before calling 1073 * the generic setup link function, which does the following: 1074 * Determines which flow control settings to use, then configures flow 1075 * control. Calls the appropriate media-specific link configuration 1076 * function. Assuming the adapter has a valid link partner, a valid link 1077 * should be established. Assumes the hardware has previously been reset --- 29 unchanged lines hidden (view full) --- 1107 ret_val = e1000_setup_link_generic(hw); 1108 1109out: 1110 return ret_val; 1111} 1112 1113/** 1114 * e1000_setup_copper_link_82543 - Configure copper link settings | 1069 * 1070 * Read the EEPROM to determine the initial polarity value and write the 1071 * extended device control register with the information before calling 1072 * the generic setup link function, which does the following: 1073 * Determines which flow control settings to use, then configures flow 1074 * control. Calls the appropriate media-specific link configuration 1075 * function. Assuming the adapter has a valid link partner, a valid link 1076 * should be established. Assumes the hardware has previously been reset --- 29 unchanged lines hidden (view full) --- 1106 ret_val = e1000_setup_link_generic(hw); 1107 1108out: 1109 return ret_val; 1110} 1111 1112/** 1113 * e1000_setup_copper_link_82543 - Configure copper link settings |
1115 * @hw - pointer to the HW structure | 1114 * @hw: pointer to the HW structure |
1116 * 1117 * Configures the link for auto-neg or forced speed and duplex. Then we check 1118 * for link, once link is established calls to configure collision distance 1119 * and flow control are called. 1120 **/ 1121STATIC s32 1122e1000_setup_copper_link_82543(struct e1000_hw *hw) 1123{ --- 70 unchanged lines hidden (view full) --- 1194 } 1195 1196out: 1197 return ret_val; 1198} 1199 1200/** 1201 * e1000_setup_fiber_link_82543 - Setup link for fiber | 1115 * 1116 * Configures the link for auto-neg or forced speed and duplex. Then we check 1117 * for link, once link is established calls to configure collision distance 1118 * and flow control are called. 1119 **/ 1120STATIC s32 1121e1000_setup_copper_link_82543(struct e1000_hw *hw) 1122{ --- 70 unchanged lines hidden (view full) --- 1193 } 1194 1195out: 1196 return ret_val; 1197} 1198 1199/** 1200 * e1000_setup_fiber_link_82543 - Setup link for fiber |
1202 * @hw - pointer to the HW structure | 1201 * @hw: pointer to the HW structure |
1203 * 1204 * Configures collision distance and flow control for fiber links. Upon 1205 * successful setup, poll for link. 1206 **/ 1207STATIC s32 1208e1000_setup_fiber_link_82543(struct e1000_hw *hw) 1209{ 1210 u32 ctrl; --- 29 unchanged lines hidden (view full) --- 1240 } 1241 1242out: 1243 return ret_val; 1244} 1245 1246/** 1247 * e1000_check_for_copper_link_82543 - Check for link (Copper) | 1202 * 1203 * Configures collision distance and flow control for fiber links. Upon 1204 * successful setup, poll for link. 1205 **/ 1206STATIC s32 1207e1000_setup_fiber_link_82543(struct e1000_hw *hw) 1208{ 1209 u32 ctrl; --- 29 unchanged lines hidden (view full) --- 1239 } 1240 1241out: 1242 return ret_val; 1243} 1244 1245/** 1246 * e1000_check_for_copper_link_82543 - Check for link (Copper) |
1248 * @hw - pointer to the HW structure | 1247 * @hw: pointer to the HW structure |
1249 * 1250 * Checks the phy for link, if link exists, do the following: 1251 * - check for downshift 1252 * - do polarity workaround (if necessary) 1253 * - configure collision distance 1254 * - configure flow control after link up 1255 * - configure tbi compatibility 1256 **/ --- 117 unchanged lines hidden (view full) --- 1374 } 1375 } 1376out: 1377 return ret_val; 1378} 1379 1380/** 1381 * e1000_check_for_fiber_link_82543 - Check for link (Fiber) | 1248 * 1249 * Checks the phy for link, if link exists, do the following: 1250 * - check for downshift 1251 * - do polarity workaround (if necessary) 1252 * - configure collision distance 1253 * - configure flow control after link up 1254 * - configure tbi compatibility 1255 **/ --- 117 unchanged lines hidden (view full) --- 1373 } 1374 } 1375out: 1376 return ret_val; 1377} 1378 1379/** 1380 * e1000_check_for_fiber_link_82543 - Check for link (Fiber) |
1382 * @hw - pointer to the HW structure | 1381 * @hw: pointer to the HW structure |
1383 * 1384 * Checks for link up on the hardware. If link is not up and we have 1385 * a signal, then we need to force link up. 1386 **/ 1387STATIC s32 1388e1000_check_for_fiber_link_82543(struct e1000_hw *hw) 1389{ 1390 struct e1000_mac_info *mac = &hw->mac; --- 52 unchanged lines hidden (view full) --- 1443 } 1444 1445out: 1446 return ret_val; 1447} 1448 1449/** 1450 * e1000_config_mac_to_phy_82543 - Configure MAC to PHY settings | 1382 * 1383 * Checks for link up on the hardware. If link is not up and we have 1384 * a signal, then we need to force link up. 1385 **/ 1386STATIC s32 1387e1000_check_for_fiber_link_82543(struct e1000_hw *hw) 1388{ 1389 struct e1000_mac_info *mac = &hw->mac; --- 52 unchanged lines hidden (view full) --- 1442 } 1443 1444out: 1445 return ret_val; 1446} 1447 1448/** 1449 * e1000_config_mac_to_phy_82543 - Configure MAC to PHY settings |
1451 * @hw - pointer to the HW structure | 1450 * @hw: pointer to the HW structure |
1452 * 1453 * For the 82543 silicon, we need to set the MAC to match the settings 1454 * of the PHY, even if the PHY is auto-negotiating. 1455 **/ 1456static s32 1457e1000_config_mac_to_phy_82543(struct e1000_hw *hw) 1458{ 1459 u32 ctrl; --- 31 unchanged lines hidden (view full) --- 1491 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); 1492 1493out: 1494 return ret_val; 1495} 1496 1497/** 1498 * e1000_write_vfta_82543 - Write value to VLAN filter table | 1451 * 1452 * For the 82543 silicon, we need to set the MAC to match the settings 1453 * of the PHY, even if the PHY is auto-negotiating. 1454 **/ 1455static s32 1456e1000_config_mac_to_phy_82543(struct e1000_hw *hw) 1457{ 1458 u32 ctrl; --- 31 unchanged lines hidden (view full) --- 1490 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); 1491 1492out: 1493 return ret_val; 1494} 1495 1496/** 1497 * e1000_write_vfta_82543 - Write value to VLAN filter table |
1499 * @hw - pointer to the HW structure 1500 * @offset - the 32-bit offset in which to write the value to. 1501 * @value - the 32-bit value to write at location offset. | 1498 * @hw: pointer to the HW structure 1499 * @offset: the 32-bit offset in which to write the value to. 1500 * @value: the 32-bit value to write at location offset. |
1502 * 1503 * This writes a 32-bit value to a 32-bit offset in the VLAN filter 1504 * table. 1505 **/ 1506STATIC void 1507e1000_write_vfta_82543(struct e1000_hw *hw, u32 offset, u32 value) 1508{ 1509 u32 temp; --- 7 unchanged lines hidden (view full) --- 1517 E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset - 1, temp); 1518 E1000_WRITE_FLUSH(hw); 1519 } else 1520 e1000_write_vfta_generic(hw, offset, value); 1521} 1522 1523/** 1524 * e1000_mta_set_82543 - Set multicast filter table address | 1501 * 1502 * This writes a 32-bit value to a 32-bit offset in the VLAN filter 1503 * table. 1504 **/ 1505STATIC void 1506e1000_write_vfta_82543(struct e1000_hw *hw, u32 offset, u32 value) 1507{ 1508 u32 temp; --- 7 unchanged lines hidden (view full) --- 1516 E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset - 1, temp); 1517 E1000_WRITE_FLUSH(hw); 1518 } else 1519 e1000_write_vfta_generic(hw, offset, value); 1520} 1521 1522/** 1523 * e1000_mta_set_82543 - Set multicast filter table address |
1525 * @hw - pointer to the HW structure 1526 * @hash_value - determines the MTA register and bit to set | 1524 * @hw: pointer to the HW structure 1525 * @hash_value: determines the MTA register and bit to set |
1527 * 1528 * The multicast table address is a register array of 32-bit registers. 1529 * The hash_value is used to determine what register the bit is in, the 1530 * current value is read, the new bit is OR'd in and the new value is 1531 * written back into the register. 1532 **/ 1533STATIC void 1534e1000_mta_set_82543(struct e1000_hw *hw, u32 hash_value) --- 20 unchanged lines hidden (view full) --- 1555 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, hash_reg - 1, temp); 1556 E1000_WRITE_FLUSH(hw); 1557 } else 1558 e1000_mta_set_generic(hw, hash_value); 1559} 1560 1561/** 1562 * e1000_led_on_82543 - Turn on SW controllable LED | 1526 * 1527 * The multicast table address is a register array of 32-bit registers. 1528 * The hash_value is used to determine what register the bit is in, the 1529 * current value is read, the new bit is OR'd in and the new value is 1530 * written back into the register. 1531 **/ 1532STATIC void 1533e1000_mta_set_82543(struct e1000_hw *hw, u32 hash_value) --- 20 unchanged lines hidden (view full) --- 1554 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, hash_reg - 1, temp); 1555 E1000_WRITE_FLUSH(hw); 1556 } else 1557 e1000_mta_set_generic(hw, hash_value); 1558} 1559 1560/** 1561 * e1000_led_on_82543 - Turn on SW controllable LED |
1563 * @hw - pointer to the HW structure | 1562 * @hw: pointer to the HW structure |
1564 * 1565 * Turns the SW defined LED on. This is a function pointer entry point 1566 * called by the api module. 1567 **/ 1568STATIC s32 1569e1000_led_on_82543(struct e1000_hw *hw) 1570{ 1571 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL); --- 12 unchanged lines hidden (view full) --- 1584 } 1585 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); 1586 1587 return E1000_SUCCESS; 1588} 1589 1590/** 1591 * e1000_led_off_82543 - Turn off SW controllable LED | 1563 * 1564 * Turns the SW defined LED on. This is a function pointer entry point 1565 * called by the api module. 1566 **/ 1567STATIC s32 1568e1000_led_on_82543(struct e1000_hw *hw) 1569{ 1570 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL); --- 12 unchanged lines hidden (view full) --- 1583 } 1584 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); 1585 1586 return E1000_SUCCESS; 1587} 1588 1589/** 1590 * e1000_led_off_82543 - Turn off SW controllable LED |
1592 * @hw - pointer to the HW structure | 1591 * @hw: pointer to the HW structure |
1593 * 1594 * Turns the SW defined LED off. This is a function pointer entry point 1595 * called by the api module. 1596 **/ 1597STATIC s32 1598e1000_led_off_82543(struct e1000_hw *hw) 1599{ 1600 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL); --- 11 unchanged lines hidden (view full) --- 1612 } 1613 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); 1614 1615 return E1000_SUCCESS; 1616} 1617 1618/** 1619 * e1000_clear_hw_cntrs_82543 - Clear device specific hardware counters | 1592 * 1593 * Turns the SW defined LED off. This is a function pointer entry point 1594 * called by the api module. 1595 **/ 1596STATIC s32 1597e1000_led_off_82543(struct e1000_hw *hw) 1598{ 1599 u32 ctrl = E1000_READ_REG(hw, E1000_CTRL); --- 11 unchanged lines hidden (view full) --- 1611 } 1612 E1000_WRITE_REG(hw, E1000_CTRL, ctrl); 1613 1614 return E1000_SUCCESS; 1615} 1616 1617/** 1618 * e1000_clear_hw_cntrs_82543 - Clear device specific hardware counters |
1620 * @hw - pointer to the HW structure | 1619 * @hw: pointer to the HW structure |
1621 * 1622 * Clears the hardware counters by reading the counter registers. 1623 **/ 1624STATIC void 1625e1000_clear_hw_cntrs_82543(struct e1000_hw *hw) 1626{ 1627 volatile u32 temp; 1628 --- 24 unchanged lines hidden --- | 1620 * 1621 * Clears the hardware counters by reading the counter registers. 1622 **/ 1623STATIC void 1624e1000_clear_hw_cntrs_82543(struct e1000_hw *hw) 1625{ 1626 volatile u32 temp; 1627 --- 24 unchanged lines hidden --- |