e1000_80003es2lan.c (169248) | e1000_80003es2lan.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_80003es2lan.c 169589 2007-05-16 00:14:23Z jfv $*/ |
|
33 | 34 |
34#include <sys/cdefs.h> 35__FBSDID("$FreeBSD: head/sys/dev/em/e1000_80003es2lan.c 169248 2007-05-04 13:30:44Z rwatson $"); 36 | |
37/* e1000_80003es2lan 38 */ 39 | 35/* e1000_80003es2lan 36 */ 37 |
38#include "e1000_api.h" |
|
40#include "e1000_80003es2lan.h" 41 42void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); 43 44STATIC s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw); 45STATIC s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw); 46STATIC s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw); 47STATIC s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw); --- 16 unchanged lines hidden (view full) --- 64STATIC s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw); 65STATIC s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw); 66STATIC s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw); 67STATIC void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw); 68static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); 69static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex); 70static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); 71static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw); | 39#include "e1000_80003es2lan.h" 40 41void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); 42 43STATIC s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw); 44STATIC s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw); 45STATIC s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw); 46STATIC s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw); --- 16 unchanged lines hidden (view full) --- 63STATIC s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw); 64STATIC s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw); 65STATIC s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw); 66STATIC void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw); 67static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); 68static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex); 69static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); 70static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw); |
72static s32 e1000_get_hw_semaphore_80003es2lan(struct e1000_hw *hw); | |
73static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); | 71static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); |
74static void e1000_put_hw_semaphore_80003es2lan(struct e1000_hw *hw); | |
75static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); 76 77/* A table for the GG82563 cable length where the range is defined 78 * with a lower bound at "index" and the upper bound at 79 * "index + 5". 80 */ 81static const 82u16 e1000_gg82563_cable_length_table[] = 83 { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF }; 84#define GG82563_CABLE_LENGTH_TABLE_SIZE \ 85 (sizeof(e1000_gg82563_cable_length_table) / \ 86 sizeof(e1000_gg82563_cable_length_table[0])) 87 88/** 89 * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. | 72static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); 73 74/* A table for the GG82563 cable length where the range is defined 75 * with a lower bound at "index" and the upper bound at 76 * "index + 5". 77 */ 78static const 79u16 e1000_gg82563_cable_length_table[] = 80 { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF }; 81#define GG82563_CABLE_LENGTH_TABLE_SIZE \ 82 (sizeof(e1000_gg82563_cable_length_table) / \ 83 sizeof(e1000_gg82563_cable_length_table[0])) 84 85/** 86 * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. |
90 * @hw - pointer to the HW structure | 87 * @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_80003es2lan(struct e1000_hw *hw) 96{ 97 struct e1000_phy_info *phy = &hw->phy; 98 struct e1000_functions *func = &hw->func; --- 36 unchanged lines hidden (view full) --- 135 } 136 137out: 138 return ret_val; 139} 140 141/** 142 * e1000_init_nvm_params_80003es2lan - Init ESB2 NVM func ptrs. | 88 * 89 * This is a function pointer entry point called by the api module. 90 **/ 91STATIC s32 92e1000_init_phy_params_80003es2lan(struct e1000_hw *hw) 93{ 94 struct e1000_phy_info *phy = &hw->phy; 95 struct e1000_functions *func = &hw->func; --- 36 unchanged lines hidden (view full) --- 132 } 133 134out: 135 return ret_val; 136} 137 138/** 139 * e1000_init_nvm_params_80003es2lan - Init ESB2 NVM func ptrs. |
143 * @hw - pointer to the HW structure | 140 * @hw: pointer to the HW structure |
144 * 145 * This is a function pointer entry point called by the api module. 146 **/ 147STATIC s32 148e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) 149{ 150 struct e1000_nvm_info *nvm = &hw->nvm; 151 struct e1000_functions *func = &hw->func; --- 39 unchanged lines hidden (view full) --- 191 func->validate_nvm = e1000_validate_nvm_checksum_generic; 192 func->write_nvm = e1000_write_nvm_80003es2lan; 193 194 return E1000_SUCCESS; 195} 196 197/** 198 * e1000_init_mac_params_80003es2lan - Init ESB2 MAC func ptrs. | 141 * 142 * This is a function pointer entry point called by the api module. 143 **/ 144STATIC s32 145e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) 146{ 147 struct e1000_nvm_info *nvm = &hw->nvm; 148 struct e1000_functions *func = &hw->func; --- 39 unchanged lines hidden (view full) --- 188 func->validate_nvm = e1000_validate_nvm_checksum_generic; 189 func->write_nvm = e1000_write_nvm_80003es2lan; 190 191 return E1000_SUCCESS; 192} 193 194/** 195 * e1000_init_mac_params_80003es2lan - Init ESB2 MAC func ptrs. |
199 * @hw - pointer to the HW structure | 196 * @hw: pointer to the HW structure |
200 * 201 * This is a function pointer entry point called by the api module. 202 **/ 203STATIC s32 204e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) 205{ 206 struct e1000_mac_info *mac = &hw->mac; 207 struct e1000_functions *func = &hw->func; --- 80 unchanged lines hidden (view full) --- 288 func->get_link_up_info = e1000_get_link_up_info_80003es2lan; 289 290out: 291 return ret_val; 292} 293 294/** 295 * e1000_init_function_pointers_80003es2lan - Init ESB2 func ptrs. | 197 * 198 * This is a function pointer entry point called by the api module. 199 **/ 200STATIC s32 201e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) 202{ 203 struct e1000_mac_info *mac = &hw->mac; 204 struct e1000_functions *func = &hw->func; --- 80 unchanged lines hidden (view full) --- 285 func->get_link_up_info = e1000_get_link_up_info_80003es2lan; 286 287out: 288 return ret_val; 289} 290 291/** 292 * e1000_init_function_pointers_80003es2lan - Init ESB2 func ptrs. |
296 * @hw - pointer to the HW structure | 293 * @hw: pointer to the HW structure |
297 * 298 * The only function explicitly called by the api module to initialize 299 * all function pointers and parameters. 300 **/ 301void 302e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw) 303{ 304 DEBUGFUNC("e1000_init_function_pointers_80003es2lan"); 305 306 hw->func.init_mac_params = e1000_init_mac_params_80003es2lan; 307 hw->func.init_nvm_params = e1000_init_nvm_params_80003es2lan; 308 hw->func.init_phy_params = e1000_init_phy_params_80003es2lan; 309} 310 311/** 312 * e1000_acquire_phy_80003es2lan - Acquire rights to access PHY | 294 * 295 * The only function explicitly called by the api module to initialize 296 * all function pointers and parameters. 297 **/ 298void 299e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw) 300{ 301 DEBUGFUNC("e1000_init_function_pointers_80003es2lan"); 302 303 hw->func.init_mac_params = e1000_init_mac_params_80003es2lan; 304 hw->func.init_nvm_params = e1000_init_nvm_params_80003es2lan; 305 hw->func.init_phy_params = e1000_init_phy_params_80003es2lan; 306} 307 308/** 309 * e1000_acquire_phy_80003es2lan - Acquire rights to access PHY |
313 * @hw - pointer to the HW structure | 310 * @hw: pointer to the HW structure |
314 * 315 * A wrapper to acquire access rights to the correct PHY. This is a 316 * function pointer entry point called by the api module. 317 **/ 318STATIC s32 319e1000_acquire_phy_80003es2lan(struct e1000_hw *hw) 320{ 321 u16 mask; 322 323 DEBUGFUNC("e1000_acquire_phy_80003es2lan"); 324 325 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; 326 327 return e1000_acquire_swfw_sync_80003es2lan(hw, mask); 328} 329 330/** 331 * e1000_release_phy_80003es2lan - Release rights to access PHY | 311 * 312 * A wrapper to acquire access rights to the correct PHY. This is a 313 * function pointer entry point called by the api module. 314 **/ 315STATIC s32 316e1000_acquire_phy_80003es2lan(struct e1000_hw *hw) 317{ 318 u16 mask; 319 320 DEBUGFUNC("e1000_acquire_phy_80003es2lan"); 321 322 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; 323 324 return e1000_acquire_swfw_sync_80003es2lan(hw, mask); 325} 326 327/** 328 * e1000_release_phy_80003es2lan - Release rights to access PHY |
332 * @hw - pointer to the HW structure | 329 * @hw: pointer to the HW structure |
333 * 334 * A wrapper to release access rights to the correct PHY. This is a 335 * function pointer entry point called by the api module. 336 **/ 337STATIC void 338e1000_release_phy_80003es2lan(struct e1000_hw *hw) 339{ 340 u16 mask; 341 342 DEBUGFUNC("e1000_release_phy_80003es2lan"); 343 344 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; 345 e1000_release_swfw_sync_80003es2lan(hw, mask); 346} 347 348/** 349 * e1000_acquire_nvm_80003es2lan - Acquire rights to access NVM | 330 * 331 * A wrapper to release access rights to the correct PHY. This is a 332 * function pointer entry point called by the api module. 333 **/ 334STATIC void 335e1000_release_phy_80003es2lan(struct e1000_hw *hw) 336{ 337 u16 mask; 338 339 DEBUGFUNC("e1000_release_phy_80003es2lan"); 340 341 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; 342 e1000_release_swfw_sync_80003es2lan(hw, mask); 343} 344 345/** 346 * e1000_acquire_nvm_80003es2lan - Acquire rights to access NVM |
350 * @hw - pointer to the HW structure | 347 * @hw: pointer to the HW structure |
351 * 352 * Acquire the semaphore to access the EEPROM. This is a function 353 * pointer entry point called by the api module. 354 **/ 355STATIC s32 356e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw) 357{ 358 s32 ret_val; --- 10 unchanged lines hidden (view full) --- 369 e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); 370 371out: 372 return ret_val; 373} 374 375/** 376 * e1000_release_nvm_80003es2lan - Relinquish rights to access NVM | 348 * 349 * Acquire the semaphore to access the EEPROM. This is a function 350 * pointer entry point called by the api module. 351 **/ 352STATIC s32 353e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw) 354{ 355 s32 ret_val; --- 10 unchanged lines hidden (view full) --- 366 e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); 367 368out: 369 return ret_val; 370} 371 372/** 373 * e1000_release_nvm_80003es2lan - Relinquish rights to access NVM |
377 * @hw - pointer to the HW structure | 374 * @hw: pointer to the HW structure |
378 * 379 * Release the semaphore used to access the EEPROM. This is a 380 * function pointer entry point called by the api module. 381 **/ 382STATIC void 383e1000_release_nvm_80003es2lan(struct e1000_hw *hw) 384{ 385 DEBUGFUNC("e1000_release_nvm_80003es2lan"); 386 387 e1000_release_nvm_generic(hw); 388 e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); 389} 390 391/** | 375 * 376 * Release the semaphore used to access the EEPROM. This is a 377 * function pointer entry point called by the api module. 378 **/ 379STATIC void 380e1000_release_nvm_80003es2lan(struct e1000_hw *hw) 381{ 382 DEBUGFUNC("e1000_release_nvm_80003es2lan"); 383 384 e1000_release_nvm_generic(hw); 385 e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); 386} 387 388/** |
392 * e1000_get_hw_semaphore_80003es2lan - Acquire HW semaphore for PHY/NVM access 393 * @hw - pointer to the HW structure 394 * 395 * Acquire the HW semaphore to access the PHY or NVM 396 **/ 397static s32 398e1000_get_hw_semaphore_80003es2lan(struct e1000_hw *hw) 399{ 400 u32 swsm; 401 s32 ret_val = E1000_SUCCESS; 402 s32 timeout = hw->nvm.word_size + 1; 403 s32 i = 0; 404 405 DEBUGFUNC("e1000_get_hw_semaphore_80003es2lan"); 406 407 /* Get the SW semaphore. */ 408 while (i < timeout) { 409 swsm = E1000_READ_REG(hw, E1000_SWSM); 410 if (!(swsm & E1000_SWSM_SMBI)) 411 break; 412 413 msec_delay_irq(1); 414 i++; 415 } 416 417 if (i == timeout) { 418 DEBUGOUT("Driver can't access device " 419 "- SMBI bit is set.\n"); 420 ret_val = -E1000_ERR_NVM; 421 goto out; 422 } 423 424 /* Get the FW semaphore. */ 425 ret_val = e1000_get_hw_semaphore_generic(hw); 426 if (ret_val) { 427 /* Release 80003es2lan semaphores */ 428 e1000_put_hw_semaphore_80003es2lan(hw); 429 goto out; 430 } 431 432out: 433 return ret_val; 434} 435 436/** 437 * e1000_put_hw_semaphore_80003es2lan - Release HW semaphore for PHY/NVM access 438 * @hw - pointer to the HW structure 439 * 440 * Release the HW semaphore used to access the PHY or NVM 441 **/ 442static void 443e1000_put_hw_semaphore_80003es2lan(struct e1000_hw *hw) 444{ 445 u32 swsm; 446 447 DEBUGFUNC("e1000_put_hw_semaphore_80003es2lan"); 448 449 swsm = E1000_READ_REG(hw, E1000_SWSM); 450 451 swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); 452 453 E1000_WRITE_REG(hw, E1000_SWSM, swsm); 454} 455 456/** | |
457 * e1000_acquire_swfw_sync_80003es2lan - Acquire SW/FW semaphore | 389 * e1000_acquire_swfw_sync_80003es2lan - Acquire SW/FW semaphore |
458 * @hw - pointer to the HW structure 459 * @mask - specifies which semaphore to acquire | 390 * @hw: pointer to the HW structure 391 * @mask: specifies which semaphore to acquire |
460 * 461 * Acquire the SW/FW semaphore to access the PHY or NVM. The mask 462 * will also specify which port we're acquiring the lock for. 463 **/ 464static s32 465e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) 466{ 467 u32 swfw_sync; 468 u32 swmask = mask; 469 u32 fwmask = mask << 16; 470 s32 ret_val = E1000_SUCCESS; 471 s32 i = 0, timeout = 200; 472 473 DEBUGFUNC("e1000_acquire_swfw_sync_80003es2lan"); 474 475 while (i < timeout) { | 392 * 393 * Acquire the SW/FW semaphore to access the PHY or NVM. The mask 394 * will also specify which port we're acquiring the lock for. 395 **/ 396static s32 397e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) 398{ 399 u32 swfw_sync; 400 u32 swmask = mask; 401 u32 fwmask = mask << 16; 402 s32 ret_val = E1000_SUCCESS; 403 s32 i = 0, timeout = 200; 404 405 DEBUGFUNC("e1000_acquire_swfw_sync_80003es2lan"); 406 407 while (i < timeout) { |
476 if (e1000_get_hw_semaphore_80003es2lan(hw)) { | 408 if (e1000_get_hw_semaphore_generic(hw)) { |
477 ret_val = -E1000_ERR_SWFW_SYNC; 478 goto out; 479 } 480 481 swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); 482 if (!(swfw_sync & (fwmask | swmask))) 483 break; 484 485 /* Firmware currently using resource (fwmask) 486 * or other software thread using resource (swmask) */ | 409 ret_val = -E1000_ERR_SWFW_SYNC; 410 goto out; 411 } 412 413 swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); 414 if (!(swfw_sync & (fwmask | swmask))) 415 break; 416 417 /* Firmware currently using resource (fwmask) 418 * or other software thread using resource (swmask) */ |
487 e1000_put_hw_semaphore_80003es2lan(hw); | 419 e1000_put_hw_semaphore_generic(hw); |
488 msec_delay_irq(5); 489 i++; 490 } 491 492 if (i == timeout) { 493 DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); 494 ret_val = -E1000_ERR_SWFW_SYNC; 495 goto out; 496 } 497 498 swfw_sync |= swmask; 499 E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); 500 | 420 msec_delay_irq(5); 421 i++; 422 } 423 424 if (i == timeout) { 425 DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); 426 ret_val = -E1000_ERR_SWFW_SYNC; 427 goto out; 428 } 429 430 swfw_sync |= swmask; 431 E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); 432 |
501 e1000_put_hw_semaphore_80003es2lan(hw); | 433 e1000_put_hw_semaphore_generic(hw); |
502 503out: 504 return ret_val; 505} 506 507/** 508 * e1000_release_swfw_sync_80003es2lan - Release SW/FW semaphore | 434 435out: 436 return ret_val; 437} 438 439/** 440 * e1000_release_swfw_sync_80003es2lan - Release SW/FW semaphore |
509 * @hw - pointer to the HW structure 510 * @mask - specifies which semaphore to acquire | 441 * @hw: pointer to the HW structure 442 * @mask: specifies which semaphore to acquire |
511 * 512 * Release the SW/FW semaphore used to access the PHY or NVM. The mask 513 * will also specify which port we're releasing the lock for. 514 **/ 515static void 516e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) 517{ 518 u32 swfw_sync; 519 520 DEBUGFUNC("e1000_release_swfw_sync_80003es2lan"); 521 | 443 * 444 * Release the SW/FW semaphore used to access the PHY or NVM. The mask 445 * will also specify which port we're releasing the lock for. 446 **/ 447static void 448e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) 449{ 450 u32 swfw_sync; 451 452 DEBUGFUNC("e1000_release_swfw_sync_80003es2lan"); 453 |
522 while (e1000_get_hw_semaphore_80003es2lan(hw) != E1000_SUCCESS); | 454 while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS); |
523 /* Empty */ 524 525 swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); 526 swfw_sync &= ~mask; 527 E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); 528 | 455 /* Empty */ 456 457 swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); 458 swfw_sync &= ~mask; 459 E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); 460 |
529 e1000_put_hw_semaphore_80003es2lan(hw); | 461 e1000_put_hw_semaphore_generic(hw); |
530} 531 532/** 533 * e1000_read_phy_reg_gg82563_80003es2lan - Read GG82563 PHY register | 462} 463 464/** 465 * e1000_read_phy_reg_gg82563_80003es2lan - Read GG82563 PHY register |
534 * @hw - pointer to the HW structure 535 * @offset - offset of the register to read 536 * @data - pointer to the data returned from the operation | 466 * @hw: pointer to the HW structure 467 * @offset: offset of the register to read 468 * @data: pointer to the data returned from the operation |
537 * 538 * Read the GG82563 PHY register. This is a function pointer entry 539 * point called by the api module. 540 **/ 541STATIC s32 542e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, u32 offset, 543 u16 *data) 544{ --- 41 unchanged lines hidden (view full) --- 586 usec_delay(200); 587 588out: 589 return ret_val; 590} 591 592/** 593 * e1000_write_phy_reg_gg82563_80003es2lan - Write GG82563 PHY register | 469 * 470 * Read the GG82563 PHY register. This is a function pointer entry 471 * point called by the api module. 472 **/ 473STATIC s32 474e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, u32 offset, 475 u16 *data) 476{ --- 41 unchanged lines hidden (view full) --- 518 usec_delay(200); 519 520out: 521 return ret_val; 522} 523 524/** 525 * e1000_write_phy_reg_gg82563_80003es2lan - Write GG82563 PHY register |
594 * @hw - pointer to the HW structure 595 * @offset - offset of the register to read 596 * @data - value to write to the register | 526 * @hw: pointer to the HW structure 527 * @offset: offset of the register to read 528 * @data: value to write to the register |
597 * 598 * Write to the GG82563 PHY register. This is a function pointer entry 599 * point called by the api module. 600 **/ 601STATIC s32 602e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, u32 offset, 603 u16 data) 604{ --- 42 unchanged lines hidden (view full) --- 647 usec_delay(200); 648 649out: 650 return ret_val; 651} 652 653/** 654 * e1000_write_nvm_80003es2lan - Write to ESB2 NVM | 529 * 530 * Write to the GG82563 PHY register. This is a function pointer entry 531 * point called by the api module. 532 **/ 533STATIC s32 534e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, u32 offset, 535 u16 data) 536{ --- 42 unchanged lines hidden (view full) --- 579 usec_delay(200); 580 581out: 582 return ret_val; 583} 584 585/** 586 * e1000_write_nvm_80003es2lan - Write to ESB2 NVM |
655 * @hw - pointer to the HW structure 656 * @offset - offset of the register to read 657 * @words - number of words to write 658 * @data - buffer of data to write to the NVM | 587 * @hw: pointer to the HW structure 588 * @offset: offset of the register to read 589 * @words: number of words to write 590 * @data: buffer of data to write to the NVM |
659 * 660 * Write "words" of data to the ESB2 NVM. This is a function 661 * pointer entry point called by the api module. 662 **/ 663STATIC s32 664e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, 665 u16 words, u16 *data) 666{ 667 DEBUGFUNC("e1000_write_nvm_80003es2lan"); 668 669 return e1000_write_nvm_spi(hw, offset, words, data); 670} 671 672/** 673 * e1000_get_cfg_done_80003es2lan - Wait for configuration to complete | 591 * 592 * Write "words" of data to the ESB2 NVM. This is a function 593 * pointer entry point called by the api module. 594 **/ 595STATIC s32 596e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, 597 u16 words, u16 *data) 598{ 599 DEBUGFUNC("e1000_write_nvm_80003es2lan"); 600 601 return e1000_write_nvm_spi(hw, offset, words, data); 602} 603 604/** 605 * e1000_get_cfg_done_80003es2lan - Wait for configuration to complete |
674 * @hw - pointer to the HW structure | 606 * @hw: pointer to the HW structure |
675 * 676 * Wait a specific amount of time for manageability processes to complete. 677 * This is a function pointer entry point called by the phy module. 678 **/ 679STATIC s32 680e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw) 681{ 682 s32 timeout = PHY_CFG_TIMEOUT; --- 18 unchanged lines hidden (view full) --- 701 } 702 703out: 704 return ret_val; 705} 706 707/** 708 * e1000_phy_force_speed_duplex_80003es2lan - Force PHY speed and duplex | 607 * 608 * Wait a specific amount of time for manageability processes to complete. 609 * This is a function pointer entry point called by the phy module. 610 **/ 611STATIC s32 612e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw) 613{ 614 s32 timeout = PHY_CFG_TIMEOUT; --- 18 unchanged lines hidden (view full) --- 633 } 634 635out: 636 return ret_val; 637} 638 639/** 640 * e1000_phy_force_speed_duplex_80003es2lan - Force PHY speed and duplex |
709 * @hw - pointer to the HW structure | 641 * @hw: pointer to the HW structure |
710 * 711 * Force the speed and duplex settings onto the PHY. This is a 712 * function pointer entry point called by the phy module. 713 **/ 714STATIC s32 715e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) 716{ 717 s32 ret_val; --- 76 unchanged lines hidden (view full) --- 794 ret_val = e1000_write_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, phy_data); 795 796out: 797 return ret_val; 798} 799 800/** 801 * e1000_get_cable_length_80003es2lan - Set approximate cable length | 642 * 643 * Force the speed and duplex settings onto the PHY. This is a 644 * function pointer entry point called by the phy module. 645 **/ 646STATIC s32 647e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw) 648{ 649 s32 ret_val; --- 76 unchanged lines hidden (view full) --- 726 ret_val = e1000_write_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, phy_data); 727 728out: 729 return ret_val; 730} 731 732/** 733 * e1000_get_cable_length_80003es2lan - Set approximate cable length |
802 * @hw - pointer to the HW structure | 734 * @hw: pointer to the HW structure |
803 * 804 * Find the approximate cable length as measured by the GG82563 PHY. 805 * This is a function pointer entry point called by the phy module. 806 **/ 807STATIC s32 808e1000_get_cable_length_80003es2lan(struct e1000_hw *hw) 809{ 810 struct e1000_phy_info *phy = &hw->phy; --- 13 unchanged lines hidden (view full) --- 824 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; 825 826out: 827 return ret_val; 828} 829 830/** 831 * e1000_get_link_up_info_80003es2lan - Report speed and duplex | 735 * 736 * Find the approximate cable length as measured by the GG82563 PHY. 737 * This is a function pointer entry point called by the phy module. 738 **/ 739STATIC s32 740e1000_get_cable_length_80003es2lan(struct e1000_hw *hw) 741{ 742 struct e1000_phy_info *phy = &hw->phy; --- 13 unchanged lines hidden (view full) --- 756 phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2; 757 758out: 759 return ret_val; 760} 761 762/** 763 * e1000_get_link_up_info_80003es2lan - Report speed and duplex |
832 * @hw - pointer to the HW structure 833 * @speed - pointer to speed buffer 834 * @duplex - pointer to duplex buffer | 764 * @hw: pointer to the HW structure 765 * @speed: pointer to speed buffer 766 * @duplex: pointer to duplex buffer |
835 * 836 * Retrieve the current speed and duplex configuration. 837 * This is a function pointer entry point called by the api module. 838 **/ 839STATIC s32 840e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, u16 *duplex) 841{ 842 s32 ret_val; --- 17 unchanged lines hidden (view full) --- 860 duplex); 861 862out: 863 return ret_val; 864} 865 866/** 867 * e1000_reset_hw_80003es2lan - Reset the ESB2 controller | 767 * 768 * Retrieve the current speed and duplex configuration. 769 * This is a function pointer entry point called by the api module. 770 **/ 771STATIC s32 772e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, u16 *duplex) 773{ 774 s32 ret_val; --- 17 unchanged lines hidden (view full) --- 792 duplex); 793 794out: 795 return ret_val; 796} 797 798/** 799 * e1000_reset_hw_80003es2lan - Reset the ESB2 controller |
868 * @hw - pointer to the HW structure | 800 * @hw: pointer to the HW structure |
869 * 870 * Perform a global reset to the ESB2 controller. 871 * This is a function pointer entry point called by the api module. 872 **/ 873STATIC s32 874e1000_reset_hw_80003es2lan(struct e1000_hw *hw) 875{ 876 u32 ctrl, icr; --- 33 unchanged lines hidden (view full) --- 910 icr = E1000_READ_REG(hw, E1000_ICR); 911 912out: 913 return ret_val; 914} 915 916/** 917 * e1000_init_hw_80003es2lan - Initialize the ESB2 controller | 801 * 802 * Perform a global reset to the ESB2 controller. 803 * This is a function pointer entry point called by the api module. 804 **/ 805STATIC s32 806e1000_reset_hw_80003es2lan(struct e1000_hw *hw) 807{ 808 u32 ctrl, icr; --- 33 unchanged lines hidden (view full) --- 842 icr = E1000_READ_REG(hw, E1000_ICR); 843 844out: 845 return ret_val; 846} 847 848/** 849 * e1000_init_hw_80003es2lan - Initialize the ESB2 controller |
918 * @hw - pointer to the HW structure | 850 * @hw: pointer to the HW structure |
919 * 920 * Initialize the hw bits, LED, VFTA, MTA, link and hw counters. 921 * This is a function pointer entry point called by the api module. 922 **/ 923STATIC s32 924e1000_init_hw_80003es2lan(struct e1000_hw *hw) 925{ 926 struct e1000_mac_info *mac = &hw->mac; --- 68 unchanged lines hidden (view full) --- 995 e1000_clear_hw_cntrs_80003es2lan(hw); 996 997out: 998 return ret_val; 999} 1000 1001/** 1002 * e1000_initialize_hw_bits_80003es2lan - Init hw bits of ESB2 | 851 * 852 * Initialize the hw bits, LED, VFTA, MTA, link and hw counters. 853 * This is a function pointer entry point called by the api module. 854 **/ 855STATIC s32 856e1000_init_hw_80003es2lan(struct e1000_hw *hw) 857{ 858 struct e1000_mac_info *mac = &hw->mac; --- 68 unchanged lines hidden (view full) --- 927 e1000_clear_hw_cntrs_80003es2lan(hw); 928 929out: 930 return ret_val; 931} 932 933/** 934 * e1000_initialize_hw_bits_80003es2lan - Init hw bits of ESB2 |
1003 * @hw - pointer to the HW structure | 935 * @hw: pointer to the HW structure |
1004 * 1005 * Initializes required hardware-dependent bits needed for normal operation. 1006 **/ 1007static void 1008e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw) 1009{ 1010 u32 reg; 1011 --- 28 unchanged lines hidden (view full) --- 1040 E1000_WRITE_REG(hw, E1000_TARC1, reg); 1041 1042out: 1043 return; 1044} 1045 1046/** 1047 * e1000_copper_link_setup_gg82563_80003es2lan - Configure GG82563 Link | 936 * 937 * Initializes required hardware-dependent bits needed for normal operation. 938 **/ 939static void 940e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw) 941{ 942 u32 reg; 943 --- 28 unchanged lines hidden (view full) --- 972 E1000_WRITE_REG(hw, E1000_TARC1, reg); 973 974out: 975 return; 976} 977 978/** 979 * e1000_copper_link_setup_gg82563_80003es2lan - Configure GG82563 Link |
1048 * @hw - pointer to the HW structure | 980 * @hw: pointer to the HW structure |
1049 * 1050 * Setup some GG82563 PHY registers for obtaining link 1051 **/ 1052static s32 1053e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) 1054{ 1055 struct e1000_phy_info *phy = &hw->phy; 1056 s32 ret_val; --- 132 unchanged lines hidden (view full) --- 1189 goto out; 1190 1191out: 1192 return ret_val; 1193} 1194 1195/** 1196 * e1000_setup_copper_link_80003es2lan - Setup Copper Link for ESB2 | 981 * 982 * Setup some GG82563 PHY registers for obtaining link 983 **/ 984static s32 985e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw) 986{ 987 struct e1000_phy_info *phy = &hw->phy; 988 s32 ret_val; --- 132 unchanged lines hidden (view full) --- 1121 goto out; 1122 1123out: 1124 return ret_val; 1125} 1126 1127/** 1128 * e1000_setup_copper_link_80003es2lan - Setup Copper Link for ESB2 |
1197 * @hw - pointer to the HW structure | 1129 * @hw: pointer to the HW structure |
1198 * 1199 * Essentially a wrapper for setting up all things "copper" related. 1200 * This is a function pointer entry point called by the mac module. 1201 **/ 1202STATIC s32 1203e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw) 1204{ 1205 u32 ctrl; --- 39 unchanged lines hidden (view full) --- 1245 ret_val = e1000_setup_copper_link_generic(hw); 1246 1247out: 1248 return ret_val; 1249} 1250 1251/** 1252 * e1000_cfg_kmrn_10_100_80003es2lan - Apply "quirks" for 10/100 operation | 1130 * 1131 * Essentially a wrapper for setting up all things "copper" related. 1132 * This is a function pointer entry point called by the mac module. 1133 **/ 1134STATIC s32 1135e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw) 1136{ 1137 u32 ctrl; --- 39 unchanged lines hidden (view full) --- 1177 ret_val = e1000_setup_copper_link_generic(hw); 1178 1179out: 1180 return ret_val; 1181} 1182 1183/** 1184 * e1000_cfg_kmrn_10_100_80003es2lan - Apply "quirks" for 10/100 operation |
1253 * @hw - pointer to the HW structure 1254 * @duplex - current duplex setting | 1185 * @hw: pointer to the HW structure 1186 * @duplex: current duplex setting |
1255 * 1256 * Configure the KMRN interface by applying last minute quirks for 1257 * 10/100 operation. 1258 **/ 1259static s32 1260e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex) 1261{ 1262 s32 ret_val = E1000_SUCCESS; 1263 u32 tipg; | 1187 * 1188 * Configure the KMRN interface by applying last minute quirks for 1189 * 10/100 operation. 1190 **/ 1191static s32 1192e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex) 1193{ 1194 s32 ret_val = E1000_SUCCESS; 1195 u32 tipg; |
1264 u16 reg_data; | 1196 u32 i = 0; 1197 u16 reg_data, reg_data2; |
1265 1266 DEBUGFUNC("e1000_configure_kmrn_for_10_100"); 1267 1268 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; 1269 ret_val = e1000_write_kmrn_reg(hw, 1270 E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, 1271 reg_data); 1272 if (ret_val) 1273 goto out; 1274 1275 /* Configure Transmit Inter-Packet Gap */ 1276 tipg = E1000_READ_REG(hw, E1000_TIPG); 1277 tipg &= ~E1000_TIPG_IPGT_MASK; 1278 tipg |= DEFAULT_TIPG_IPGT_10_100_80003ES2LAN; 1279 E1000_WRITE_REG(hw, E1000_TIPG, tipg); 1280 | 1198 1199 DEBUGFUNC("e1000_configure_kmrn_for_10_100"); 1200 1201 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; 1202 ret_val = e1000_write_kmrn_reg(hw, 1203 E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, 1204 reg_data); 1205 if (ret_val) 1206 goto out; 1207 1208 /* Configure Transmit Inter-Packet Gap */ 1209 tipg = E1000_READ_REG(hw, E1000_TIPG); 1210 tipg &= ~E1000_TIPG_IPGT_MASK; 1211 tipg |= DEFAULT_TIPG_IPGT_10_100_80003ES2LAN; 1212 E1000_WRITE_REG(hw, E1000_TIPG, tipg); 1213 |
1281 ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); 1282 if (ret_val) 1283 goto out; | |
1284 | 1214 |
1215 do { 1216 ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, 1217 ®_data); 1218 if (ret_val) 1219 goto out; 1220 1221 ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, 1222 ®_data2); 1223 if (ret_val) 1224 goto out; 1225 i++; 1226 } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY)); 1227 |
|
1285 if (duplex == HALF_DUPLEX) 1286 reg_data |= GG82563_KMCR_PASS_FALSE_CARRIER; 1287 else 1288 reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; 1289 1290 ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); 1291 1292out: 1293 return ret_val; 1294} 1295 1296/** 1297 * e1000_cfg_kmrn_1000_80003es2lan - Apply "quirks" for gigabit operation | 1228 if (duplex == HALF_DUPLEX) 1229 reg_data |= GG82563_KMCR_PASS_FALSE_CARRIER; 1230 else 1231 reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; 1232 1233 ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); 1234 1235out: 1236 return ret_val; 1237} 1238 1239/** 1240 * e1000_cfg_kmrn_1000_80003es2lan - Apply "quirks" for gigabit operation |
1298 * @hw - pointer to the HW structure | 1241 * @hw: pointer to the HW structure |
1299 * 1300 * Configure the KMRN interface by applying last minute quirks for 1301 * gigabit operation. 1302 **/ 1303static s32 1304e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw) 1305{ 1306 s32 ret_val = E1000_SUCCESS; | 1242 * 1243 * Configure the KMRN interface by applying last minute quirks for 1244 * gigabit operation. 1245 **/ 1246static s32 1247e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw) 1248{ 1249 s32 ret_val = E1000_SUCCESS; |
1307 u16 reg_data; | 1250 u16 reg_data, reg_data2; |
1308 u32 tipg; | 1251 u32 tipg; |
1252 u32 i = 0; |
|
1309 1310 DEBUGFUNC("e1000_configure_kmrn_for_1000"); 1311 1312 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; 1313 ret_val = e1000_write_kmrn_reg(hw, 1314 E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, 1315 reg_data); 1316 if (ret_val) 1317 goto out; 1318 1319 /* Configure Transmit Inter-Packet Gap */ 1320 tipg = E1000_READ_REG(hw, E1000_TIPG); 1321 tipg &= ~E1000_TIPG_IPGT_MASK; 1322 tipg |= DEFAULT_TIPG_IPGT_1000_80003ES2LAN; 1323 E1000_WRITE_REG(hw, E1000_TIPG, tipg); 1324 | 1253 1254 DEBUGFUNC("e1000_configure_kmrn_for_1000"); 1255 1256 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; 1257 ret_val = e1000_write_kmrn_reg(hw, 1258 E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, 1259 reg_data); 1260 if (ret_val) 1261 goto out; 1262 1263 /* Configure Transmit Inter-Packet Gap */ 1264 tipg = E1000_READ_REG(hw, E1000_TIPG); 1265 tipg &= ~E1000_TIPG_IPGT_MASK; 1266 tipg |= DEFAULT_TIPG_IPGT_1000_80003ES2LAN; 1267 E1000_WRITE_REG(hw, E1000_TIPG, tipg); 1268 |
1325 ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); 1326 if (ret_val) 1327 goto out; | |
1328 | 1269 |
1270 do { 1271 ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, 1272 ®_data); 1273 if (ret_val) 1274 goto out; 1275 1276 ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, 1277 ®_data2); 1278 if (ret_val) 1279 goto out; 1280 i++; 1281 } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY)); 1282 |
|
1329 reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; 1330 ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); 1331 1332out: 1333 return ret_val; 1334} 1335 1336/** 1337 * e1000_clear_hw_cntrs_80003es2lan - Clear device specific hardware counters | 1283 reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; 1284 ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); 1285 1286out: 1287 return ret_val; 1288} 1289 1290/** 1291 * e1000_clear_hw_cntrs_80003es2lan - Clear device specific hardware counters |
1338 * @hw - pointer to the HW structure | 1292 * @hw: pointer to the HW structure |
1339 * 1340 * Clears the hardware counters by reading the counter registers. 1341 **/ 1342STATIC void 1343e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw) 1344{ 1345 volatile u32 temp; 1346 --- 39 unchanged lines hidden --- | 1293 * 1294 * Clears the hardware counters by reading the counter registers. 1295 **/ 1296STATIC void 1297e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw) 1298{ 1299 volatile u32 temp; 1300 --- 39 unchanged lines hidden --- |