diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2009-02-06 18:17:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-07 05:43:05 -0500 |
commit | a8d2a0c27f84bdbf54b7e1c1a52ef7b8b7196dbc (patch) | |
tree | 0c1a666348dd94797740a0788a025764a303f54e /drivers/net/igb/e1000_phy.c | |
parent | 40a70b3889ea50daa10a7f3468920c1f5483155d (diff) |
igb: rename phy ops
This patch renames write_phy_reg to write_reg and read_phy_reg to read_reg.
It seems redundant to call out phy in an operation that is part of the
phy_ops struct.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/igb/e1000_phy.c')
-rw-r--r-- | drivers/net/igb/e1000_phy.c | 347 |
1 files changed, 128 insertions, 219 deletions
diff --git a/drivers/net/igb/e1000_phy.c b/drivers/net/igb/e1000_phy.c index 17fddb91c9f5..d73ea71d741f 100644 --- a/drivers/net/igb/e1000_phy.c +++ b/drivers/net/igb/e1000_phy.c | |||
@@ -31,10 +31,6 @@ | |||
31 | #include "e1000_mac.h" | 31 | #include "e1000_mac.h" |
32 | #include "e1000_phy.h" | 32 | #include "e1000_phy.h" |
33 | 33 | ||
34 | static s32 igb_get_phy_cfg_done(struct e1000_hw *hw); | ||
35 | static void igb_release_phy(struct e1000_hw *hw); | ||
36 | static s32 igb_acquire_phy(struct e1000_hw *hw); | ||
37 | static s32 igb_phy_reset_dsp(struct e1000_hw *hw); | ||
38 | static s32 igb_phy_setup_autoneg(struct e1000_hw *hw); | 34 | static s32 igb_phy_setup_autoneg(struct e1000_hw *hw); |
39 | static void igb_phy_force_speed_duplex_setup(struct e1000_hw *hw, | 35 | static void igb_phy_force_speed_duplex_setup(struct e1000_hw *hw, |
40 | u16 *phy_ctrl); | 36 | u16 *phy_ctrl); |
@@ -91,13 +87,13 @@ s32 igb_get_phy_id(struct e1000_hw *hw) | |||
91 | s32 ret_val = 0; | 87 | s32 ret_val = 0; |
92 | u16 phy_id; | 88 | u16 phy_id; |
93 | 89 | ||
94 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_ID1, &phy_id); | 90 | ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); |
95 | if (ret_val) | 91 | if (ret_val) |
96 | goto out; | 92 | goto out; |
97 | 93 | ||
98 | phy->id = (u32)(phy_id << 16); | 94 | phy->id = (u32)(phy_id << 16); |
99 | udelay(20); | 95 | udelay(20); |
100 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_ID2, &phy_id); | 96 | ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); |
101 | if (ret_val) | 97 | if (ret_val) |
102 | goto out; | 98 | goto out; |
103 | 99 | ||
@@ -118,11 +114,11 @@ static s32 igb_phy_reset_dsp(struct e1000_hw *hw) | |||
118 | { | 114 | { |
119 | s32 ret_val; | 115 | s32 ret_val; |
120 | 116 | ||
121 | ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xC1); | 117 | ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xC1); |
122 | if (ret_val) | 118 | if (ret_val) |
123 | goto out; | 119 | goto out; |
124 | 120 | ||
125 | ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0); | 121 | ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0); |
126 | 122 | ||
127 | out: | 123 | out: |
128 | return ret_val; | 124 | return ret_val; |
@@ -257,9 +253,12 @@ out: | |||
257 | **/ | 253 | **/ |
258 | s32 igb_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) | 254 | s32 igb_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) |
259 | { | 255 | { |
260 | s32 ret_val; | 256 | s32 ret_val = 0; |
257 | |||
258 | if (!(hw->phy.ops.acquire)) | ||
259 | goto out; | ||
261 | 260 | ||
262 | ret_val = igb_acquire_phy(hw); | 261 | ret_val = hw->phy.ops.acquire(hw); |
263 | if (ret_val) | 262 | if (ret_val) |
264 | goto out; | 263 | goto out; |
265 | 264 | ||
@@ -268,16 +267,15 @@ s32 igb_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data) | |||
268 | IGP01E1000_PHY_PAGE_SELECT, | 267 | IGP01E1000_PHY_PAGE_SELECT, |
269 | (u16)offset); | 268 | (u16)offset); |
270 | if (ret_val) { | 269 | if (ret_val) { |
271 | igb_release_phy(hw); | 270 | hw->phy.ops.release(hw); |
272 | goto out; | 271 | goto out; |
273 | } | 272 | } |
274 | } | 273 | } |
275 | 274 | ||
276 | ret_val = igb_read_phy_reg_mdic(hw, | 275 | ret_val = igb_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, |
277 | MAX_PHY_REG_ADDRESS & offset, | 276 | data); |
278 | data); | ||
279 | 277 | ||
280 | igb_release_phy(hw); | 278 | hw->phy.ops.release(hw); |
281 | 279 | ||
282 | out: | 280 | out: |
283 | return ret_val; | 281 | return ret_val; |
@@ -294,9 +292,12 @@ out: | |||
294 | **/ | 292 | **/ |
295 | s32 igb_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) | 293 | s32 igb_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) |
296 | { | 294 | { |
297 | s32 ret_val; | 295 | s32 ret_val = 0; |
298 | 296 | ||
299 | ret_val = igb_acquire_phy(hw); | 297 | if (!(hw->phy.ops.acquire)) |
298 | goto out; | ||
299 | |||
300 | ret_val = hw->phy.ops.acquire(hw); | ||
300 | if (ret_val) | 301 | if (ret_val) |
301 | goto out; | 302 | goto out; |
302 | 303 | ||
@@ -305,16 +306,15 @@ s32 igb_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data) | |||
305 | IGP01E1000_PHY_PAGE_SELECT, | 306 | IGP01E1000_PHY_PAGE_SELECT, |
306 | (u16)offset); | 307 | (u16)offset); |
307 | if (ret_val) { | 308 | if (ret_val) { |
308 | igb_release_phy(hw); | 309 | hw->phy.ops.release(hw); |
309 | goto out; | 310 | goto out; |
310 | } | 311 | } |
311 | } | 312 | } |
312 | 313 | ||
313 | ret_val = igb_write_phy_reg_mdic(hw, | 314 | ret_val = igb_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, |
314 | MAX_PHY_REG_ADDRESS & offset, | ||
315 | data); | 315 | data); |
316 | 316 | ||
317 | igb_release_phy(hw); | 317 | hw->phy.ops.release(hw); |
318 | 318 | ||
319 | out: | 319 | out: |
320 | return ret_val; | 320 | return ret_val; |
@@ -339,8 +339,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw) | |||
339 | } | 339 | } |
340 | 340 | ||
341 | /* Enable CRS on TX. This must be set for half-duplex operation. */ | 341 | /* Enable CRS on TX. This must be set for half-duplex operation. */ |
342 | ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, | 342 | ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
343 | &phy_data); | ||
344 | if (ret_val) | 343 | if (ret_val) |
345 | goto out; | 344 | goto out; |
346 | 345 | ||
@@ -383,8 +382,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw) | |||
383 | if (phy->disable_polarity_correction == 1) | 382 | if (phy->disable_polarity_correction == 1) |
384 | phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; | 383 | phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; |
385 | 384 | ||
386 | ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, | 385 | ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
387 | phy_data); | ||
388 | if (ret_val) | 386 | if (ret_val) |
389 | goto out; | 387 | goto out; |
390 | 388 | ||
@@ -393,8 +391,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw) | |||
393 | * Force TX_CLK in the Extended PHY Specific Control Register | 391 | * Force TX_CLK in the Extended PHY Specific Control Register |
394 | * to 25MHz clock. | 392 | * to 25MHz clock. |
395 | */ | 393 | */ |
396 | ret_val = hw->phy.ops.read_phy_reg(hw, | 394 | ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, |
397 | M88E1000_EXT_PHY_SPEC_CTRL, | ||
398 | &phy_data); | 395 | &phy_data); |
399 | if (ret_val) | 396 | if (ret_val) |
400 | goto out; | 397 | goto out; |
@@ -413,8 +410,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw) | |||
413 | phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | | 410 | phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | |
414 | M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); | 411 | M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); |
415 | } | 412 | } |
416 | ret_val = hw->phy.ops.write_phy_reg(hw, | 413 | ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, |
417 | M88E1000_EXT_PHY_SPEC_CTRL, | ||
418 | phy_data); | 414 | phy_data); |
419 | if (ret_val) | 415 | if (ret_val) |
420 | goto out; | 416 | goto out; |
@@ -449,7 +445,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw) | |||
449 | goto out; | 445 | goto out; |
450 | } | 446 | } |
451 | 447 | ||
452 | ret_val = hw->phy.ops.reset_phy(hw); | 448 | ret_val = phy->ops.reset(hw); |
453 | if (ret_val) { | 449 | if (ret_val) { |
454 | hw_dbg("Error resetting the PHY.\n"); | 450 | hw_dbg("Error resetting the PHY.\n"); |
455 | goto out; | 451 | goto out; |
@@ -464,8 +460,8 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw) | |||
464 | */ | 460 | */ |
465 | if (phy->type == e1000_phy_igp) { | 461 | if (phy->type == e1000_phy_igp) { |
466 | /* disable lplu d3 during driver init */ | 462 | /* disable lplu d3 during driver init */ |
467 | if (hw->phy.ops.set_d3_lplu_state) | 463 | if (phy->ops.set_d3_lplu_state) |
468 | ret_val = hw->phy.ops.set_d3_lplu_state(hw, false); | 464 | ret_val = phy->ops.set_d3_lplu_state(hw, false); |
469 | if (ret_val) { | 465 | if (ret_val) { |
470 | hw_dbg("Error Disabling LPLU D3\n"); | 466 | hw_dbg("Error Disabling LPLU D3\n"); |
471 | goto out; | 467 | goto out; |
@@ -473,13 +469,13 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw) | |||
473 | } | 469 | } |
474 | 470 | ||
475 | /* disable lplu d0 during driver init */ | 471 | /* disable lplu d0 during driver init */ |
476 | ret_val = hw->phy.ops.set_d0_lplu_state(hw, false); | 472 | ret_val = phy->ops.set_d0_lplu_state(hw, false); |
477 | if (ret_val) { | 473 | if (ret_val) { |
478 | hw_dbg("Error Disabling LPLU D0\n"); | 474 | hw_dbg("Error Disabling LPLU D0\n"); |
479 | goto out; | 475 | goto out; |
480 | } | 476 | } |
481 | /* Configure mdi-mdix settings */ | 477 | /* Configure mdi-mdix settings */ |
482 | ret_val = hw->phy.ops.read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &data); | 478 | ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &data); |
483 | if (ret_val) | 479 | if (ret_val) |
484 | goto out; | 480 | goto out; |
485 | 481 | ||
@@ -497,7 +493,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw) | |||
497 | data |= IGP01E1000_PSCR_AUTO_MDIX; | 493 | data |= IGP01E1000_PSCR_AUTO_MDIX; |
498 | break; | 494 | break; |
499 | } | 495 | } |
500 | ret_val = hw->phy.ops.write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, data); | 496 | ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, data); |
501 | if (ret_val) | 497 | if (ret_val) |
502 | goto out; | 498 | goto out; |
503 | 499 | ||
@@ -510,33 +506,31 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw) | |||
510 | */ | 506 | */ |
511 | if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { | 507 | if (phy->autoneg_advertised == ADVERTISE_1000_FULL) { |
512 | /* Disable SmartSpeed */ | 508 | /* Disable SmartSpeed */ |
513 | ret_val = hw->phy.ops.read_phy_reg(hw, | 509 | ret_val = phy->ops.read_reg(hw, |
514 | IGP01E1000_PHY_PORT_CONFIG, | 510 | IGP01E1000_PHY_PORT_CONFIG, |
515 | &data); | 511 | &data); |
516 | if (ret_val) | 512 | if (ret_val) |
517 | goto out; | 513 | goto out; |
518 | 514 | ||
519 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; | 515 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
520 | ret_val = hw->phy.ops.write_phy_reg(hw, | 516 | ret_val = phy->ops.write_reg(hw, |
521 | IGP01E1000_PHY_PORT_CONFIG, | 517 | IGP01E1000_PHY_PORT_CONFIG, |
522 | data); | 518 | data); |
523 | if (ret_val) | 519 | if (ret_val) |
524 | goto out; | 520 | goto out; |
525 | 521 | ||
526 | /* Set auto Master/Slave resolution process */ | 522 | /* Set auto Master/Slave resolution process */ |
527 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_1000T_CTRL, | 523 | ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, &data); |
528 | &data); | ||
529 | if (ret_val) | 524 | if (ret_val) |
530 | goto out; | 525 | goto out; |
531 | 526 | ||
532 | data &= ~CR_1000T_MS_ENABLE; | 527 | data &= ~CR_1000T_MS_ENABLE; |
533 | ret_val = hw->phy.ops.write_phy_reg(hw, PHY_1000T_CTRL, | 528 | ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, data); |
534 | data); | ||
535 | if (ret_val) | 529 | if (ret_val) |
536 | goto out; | 530 | goto out; |
537 | } | 531 | } |
538 | 532 | ||
539 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_1000T_CTRL, &data); | 533 | ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, &data); |
540 | if (ret_val) | 534 | if (ret_val) |
541 | goto out; | 535 | goto out; |
542 | 536 | ||
@@ -560,7 +554,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw) | |||
560 | default: | 554 | default: |
561 | break; | 555 | break; |
562 | } | 556 | } |
563 | ret_val = hw->phy.ops.write_phy_reg(hw, PHY_1000T_CTRL, data); | 557 | ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, data); |
564 | if (ret_val) | 558 | if (ret_val) |
565 | goto out; | 559 | goto out; |
566 | } | 560 | } |
@@ -609,12 +603,12 @@ s32 igb_copper_link_autoneg(struct e1000_hw *hw) | |||
609 | * Restart auto-negotiation by setting the Auto Neg Enable bit and | 603 | * Restart auto-negotiation by setting the Auto Neg Enable bit and |
610 | * the Auto Neg Restart bit in the PHY control register. | 604 | * the Auto Neg Restart bit in the PHY control register. |
611 | */ | 605 | */ |
612 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &phy_ctrl); | 606 | ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); |
613 | if (ret_val) | 607 | if (ret_val) |
614 | goto out; | 608 | goto out; |
615 | 609 | ||
616 | phy_ctrl |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); | 610 | phy_ctrl |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG); |
617 | ret_val = hw->phy.ops.write_phy_reg(hw, PHY_CONTROL, phy_ctrl); | 611 | ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_ctrl); |
618 | if (ret_val) | 612 | if (ret_val) |
619 | goto out; | 613 | goto out; |
620 | 614 | ||
@@ -656,15 +650,13 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw) | |||
656 | phy->autoneg_advertised &= phy->autoneg_mask; | 650 | phy->autoneg_advertised &= phy->autoneg_mask; |
657 | 651 | ||
658 | /* Read the MII Auto-Neg Advertisement Register (Address 4). */ | 652 | /* Read the MII Auto-Neg Advertisement Register (Address 4). */ |
659 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_AUTONEG_ADV, | 653 | ret_val = phy->ops.read_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg); |
660 | &mii_autoneg_adv_reg); | ||
661 | if (ret_val) | 654 | if (ret_val) |
662 | goto out; | 655 | goto out; |
663 | 656 | ||
664 | if (phy->autoneg_mask & ADVERTISE_1000_FULL) { | 657 | if (phy->autoneg_mask & ADVERTISE_1000_FULL) { |
665 | /* Read the MII 1000Base-T Control Register (Address 9). */ | 658 | /* Read the MII 1000Base-T Control Register (Address 9). */ |
666 | ret_val = hw->phy.ops.read_phy_reg(hw, | 659 | ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, |
667 | PHY_1000T_CTRL, | ||
668 | &mii_1000t_ctrl_reg); | 660 | &mii_1000t_ctrl_reg); |
669 | if (ret_val) | 661 | if (ret_val) |
670 | goto out; | 662 | goto out; |
@@ -785,17 +777,16 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw) | |||
785 | goto out; | 777 | goto out; |
786 | } | 778 | } |
787 | 779 | ||
788 | ret_val = hw->phy.ops.write_phy_reg(hw, PHY_AUTONEG_ADV, | 780 | ret_val = phy->ops.write_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg); |
789 | mii_autoneg_adv_reg); | ||
790 | if (ret_val) | 781 | if (ret_val) |
791 | goto out; | 782 | goto out; |
792 | 783 | ||
793 | hw_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); | 784 | hw_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); |
794 | 785 | ||
795 | if (phy->autoneg_mask & ADVERTISE_1000_FULL) { | 786 | if (phy->autoneg_mask & ADVERTISE_1000_FULL) { |
796 | ret_val = hw->phy.ops.write_phy_reg(hw, | 787 | ret_val = phy->ops.write_reg(hw, |
797 | PHY_1000T_CTRL, | 788 | PHY_1000T_CTRL, |
798 | mii_1000t_ctrl_reg); | 789 | mii_1000t_ctrl_reg); |
799 | if (ret_val) | 790 | if (ret_val) |
800 | goto out; | 791 | goto out; |
801 | } | 792 | } |
@@ -819,13 +810,13 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw) | |||
819 | u16 phy_data; | 810 | u16 phy_data; |
820 | bool link; | 811 | bool link; |
821 | 812 | ||
822 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &phy_data); | 813 | ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); |
823 | if (ret_val) | 814 | if (ret_val) |
824 | goto out; | 815 | goto out; |
825 | 816 | ||
826 | igb_phy_force_speed_duplex_setup(hw, &phy_data); | 817 | igb_phy_force_speed_duplex_setup(hw, &phy_data); |
827 | 818 | ||
828 | ret_val = hw->phy.ops.write_phy_reg(hw, PHY_CONTROL, phy_data); | 819 | ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data); |
829 | if (ret_val) | 820 | if (ret_val) |
830 | goto out; | 821 | goto out; |
831 | 822 | ||
@@ -833,16 +824,14 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw) | |||
833 | * Clear Auto-Crossover to force MDI manually. IGP requires MDI | 824 | * Clear Auto-Crossover to force MDI manually. IGP requires MDI |
834 | * forced whenever speed and duplex are forced. | 825 | * forced whenever speed and duplex are forced. |
835 | */ | 826 | */ |
836 | ret_val = hw->phy.ops.read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, | 827 | ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data); |
837 | &phy_data); | ||
838 | if (ret_val) | 828 | if (ret_val) |
839 | goto out; | 829 | goto out; |
840 | 830 | ||
841 | phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; | 831 | phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX; |
842 | phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; | 832 | phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX; |
843 | 833 | ||
844 | ret_val = hw->phy.ops.write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, | 834 | ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data); |
845 | phy_data); | ||
846 | if (ret_val) | 835 | if (ret_val) |
847 | goto out; | 836 | goto out; |
848 | 837 | ||
@@ -897,20 +886,18 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
897 | * Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI | 886 | * Clear Auto-Crossover to force MDI manually. M88E1000 requires MDI |
898 | * forced whenever speed and duplex are forced. | 887 | * forced whenever speed and duplex are forced. |
899 | */ | 888 | */ |
900 | ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, | 889 | ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
901 | &phy_data); | ||
902 | if (ret_val) | 890 | if (ret_val) |
903 | goto out; | 891 | goto out; |
904 | 892 | ||
905 | phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; | 893 | phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; |
906 | ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, | 894 | ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
907 | phy_data); | ||
908 | if (ret_val) | 895 | if (ret_val) |
909 | goto out; | 896 | goto out; |
910 | 897 | ||
911 | hw_dbg("M88E1000 PSCR: %X\n", phy_data); | 898 | hw_dbg("M88E1000 PSCR: %X\n", phy_data); |
912 | 899 | ||
913 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &phy_data); | 900 | ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data); |
914 | if (ret_val) | 901 | if (ret_val) |
915 | goto out; | 902 | goto out; |
916 | 903 | ||
@@ -919,7 +906,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
919 | /* Reset the phy to commit changes. */ | 906 | /* Reset the phy to commit changes. */ |
920 | phy_data |= MII_CR_RESET; | 907 | phy_data |= MII_CR_RESET; |
921 | 908 | ||
922 | ret_val = hw->phy.ops.write_phy_reg(hw, PHY_CONTROL, phy_data); | 909 | ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data); |
923 | if (ret_val) | 910 | if (ret_val) |
924 | goto out; | 911 | goto out; |
925 | 912 | ||
@@ -940,7 +927,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
940 | * We didn't get link. | 927 | * We didn't get link. |
941 | * Reset the DSP and cross our fingers. | 928 | * Reset the DSP and cross our fingers. |
942 | */ | 929 | */ |
943 | ret_val = hw->phy.ops.write_phy_reg(hw, | 930 | ret_val = phy->ops.write_reg(hw, |
944 | M88E1000_PHY_PAGE_SELECT, | 931 | M88E1000_PHY_PAGE_SELECT, |
945 | 0x001d); | 932 | 0x001d); |
946 | if (ret_val) | 933 | if (ret_val) |
@@ -957,8 +944,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
957 | goto out; | 944 | goto out; |
958 | } | 945 | } |
959 | 946 | ||
960 | ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, | 947 | ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); |
961 | &phy_data); | ||
962 | if (ret_val) | 948 | if (ret_val) |
963 | goto out; | 949 | goto out; |
964 | 950 | ||
@@ -968,8 +954,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
968 | * the reset value of 2.5MHz. | 954 | * the reset value of 2.5MHz. |
969 | */ | 955 | */ |
970 | phy_data |= M88E1000_EPSCR_TX_CLK_25; | 956 | phy_data |= M88E1000_EPSCR_TX_CLK_25; |
971 | ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, | 957 | ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); |
972 | phy_data); | ||
973 | if (ret_val) | 958 | if (ret_val) |
974 | goto out; | 959 | goto out; |
975 | 960 | ||
@@ -977,14 +962,12 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw) | |||
977 | * In addition, we must re-enable CRS on Tx for both half and full | 962 | * In addition, we must re-enable CRS on Tx for both half and full |
978 | * duplex. | 963 | * duplex. |
979 | */ | 964 | */ |
980 | ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, | 965 | ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
981 | &phy_data); | ||
982 | if (ret_val) | 966 | if (ret_val) |
983 | goto out; | 967 | goto out; |
984 | 968 | ||
985 | phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; | 969 | phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; |
986 | ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, | 970 | ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
987 | phy_data); | ||
988 | 971 | ||
989 | out: | 972 | out: |
990 | return ret_val; | 973 | return ret_val; |
@@ -1071,15 +1054,13 @@ s32 igb_set_d3_lplu_state(struct e1000_hw *hw, bool active) | |||
1071 | s32 ret_val; | 1054 | s32 ret_val; |
1072 | u16 data; | 1055 | u16 data; |
1073 | 1056 | ||
1074 | ret_val = hw->phy.ops.read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, | 1057 | ret_val = phy->ops.read_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data); |
1075 | &data); | ||
1076 | if (ret_val) | 1058 | if (ret_val) |
1077 | goto out; | 1059 | goto out; |
1078 | 1060 | ||
1079 | if (!active) { | 1061 | if (!active) { |
1080 | data &= ~IGP02E1000_PM_D3_LPLU; | 1062 | data &= ~IGP02E1000_PM_D3_LPLU; |
1081 | ret_val = hw->phy.ops.write_phy_reg(hw, | 1063 | ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, |
1082 | IGP02E1000_PHY_POWER_MGMT, | ||
1083 | data); | 1064 | data); |
1084 | if (ret_val) | 1065 | if (ret_val) |
1085 | goto out; | 1066 | goto out; |
@@ -1090,27 +1071,27 @@ s32 igb_set_d3_lplu_state(struct e1000_hw *hw, bool active) | |||
1090 | * SmartSpeed, so performance is maintained. | 1071 | * SmartSpeed, so performance is maintained. |
1091 | */ | 1072 | */ |
1092 | if (phy->smart_speed == e1000_smart_speed_on) { | 1073 | if (phy->smart_speed == e1000_smart_speed_on) { |
1093 | ret_val = hw->phy.ops.read_phy_reg(hw, | 1074 | ret_val = phy->ops.read_reg(hw, |
1094 | IGP01E1000_PHY_PORT_CONFIG, | 1075 | IGP01E1000_PHY_PORT_CONFIG, |
1095 | &data); | 1076 | &data); |
1096 | if (ret_val) | 1077 | if (ret_val) |
1097 | goto out; | 1078 | goto out; |
1098 | 1079 | ||
1099 | data |= IGP01E1000_PSCFR_SMART_SPEED; | 1080 | data |= IGP01E1000_PSCFR_SMART_SPEED; |
1100 | ret_val = hw->phy.ops.write_phy_reg(hw, | 1081 | ret_val = phy->ops.write_reg(hw, |
1101 | IGP01E1000_PHY_PORT_CONFIG, | 1082 | IGP01E1000_PHY_PORT_CONFIG, |
1102 | data); | 1083 | data); |
1103 | if (ret_val) | 1084 | if (ret_val) |
1104 | goto out; | 1085 | goto out; |
1105 | } else if (phy->smart_speed == e1000_smart_speed_off) { | 1086 | } else if (phy->smart_speed == e1000_smart_speed_off) { |
1106 | ret_val = hw->phy.ops.read_phy_reg(hw, | 1087 | ret_val = phy->ops.read_reg(hw, |
1107 | IGP01E1000_PHY_PORT_CONFIG, | 1088 | IGP01E1000_PHY_PORT_CONFIG, |
1108 | &data); | 1089 | &data); |
1109 | if (ret_val) | 1090 | if (ret_val) |
1110 | goto out; | 1091 | goto out; |
1111 | 1092 | ||
1112 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; | 1093 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
1113 | ret_val = hw->phy.ops.write_phy_reg(hw, | 1094 | ret_val = phy->ops.write_reg(hw, |
1114 | IGP01E1000_PHY_PORT_CONFIG, | 1095 | IGP01E1000_PHY_PORT_CONFIG, |
1115 | data); | 1096 | data); |
1116 | if (ret_val) | 1097 | if (ret_val) |
@@ -1120,22 +1101,19 @@ s32 igb_set_d3_lplu_state(struct e1000_hw *hw, bool active) | |||
1120 | (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || | 1101 | (phy->autoneg_advertised == E1000_ALL_NOT_GIG) || |
1121 | (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { | 1102 | (phy->autoneg_advertised == E1000_ALL_10_SPEED)) { |
1122 | data |= IGP02E1000_PM_D3_LPLU; | 1103 | data |= IGP02E1000_PM_D3_LPLU; |
1123 | ret_val = hw->phy.ops.write_phy_reg(hw, | 1104 | ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT, |
1124 | IGP02E1000_PHY_POWER_MGMT, | ||
1125 | data); | 1105 | data); |
1126 | if (ret_val) | 1106 | if (ret_val) |
1127 | goto out; | 1107 | goto out; |
1128 | 1108 | ||
1129 | /* When LPLU is enabled, we should disable SmartSpeed */ | 1109 | /* When LPLU is enabled, we should disable SmartSpeed */ |
1130 | ret_val = hw->phy.ops.read_phy_reg(hw, | 1110 | ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
1131 | IGP01E1000_PHY_PORT_CONFIG, | ||
1132 | &data); | 1111 | &data); |
1133 | if (ret_val) | 1112 | if (ret_val) |
1134 | goto out; | 1113 | goto out; |
1135 | 1114 | ||
1136 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; | 1115 | data &= ~IGP01E1000_PSCFR_SMART_SPEED; |
1137 | ret_val = hw->phy.ops.write_phy_reg(hw, | 1116 | ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG, |
1138 | IGP01E1000_PHY_PORT_CONFIG, | ||
1139 | data); | 1117 | data); |
1140 | } | 1118 | } |
1141 | 1119 | ||
@@ -1176,7 +1154,7 @@ s32 igb_check_downshift(struct e1000_hw *hw) | |||
1176 | goto out; | 1154 | goto out; |
1177 | } | 1155 | } |
1178 | 1156 | ||
1179 | ret_val = hw->phy.ops.read_phy_reg(hw, offset, &phy_data); | 1157 | ret_val = phy->ops.read_reg(hw, offset, &phy_data); |
1180 | 1158 | ||
1181 | if (!ret_val) | 1159 | if (!ret_val) |
1182 | phy->speed_downgraded = (phy_data & mask) ? true : false; | 1160 | phy->speed_downgraded = (phy_data & mask) ? true : false; |
@@ -1199,7 +1177,7 @@ static s32 igb_check_polarity_m88(struct e1000_hw *hw) | |||
1199 | s32 ret_val; | 1177 | s32 ret_val; |
1200 | u16 data; | 1178 | u16 data; |
1201 | 1179 | ||
1202 | ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &data); | 1180 | ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &data); |
1203 | 1181 | ||
1204 | if (!ret_val) | 1182 | if (!ret_val) |
1205 | phy->cable_polarity = (data & M88E1000_PSSR_REV_POLARITY) | 1183 | phy->cable_polarity = (data & M88E1000_PSSR_REV_POLARITY) |
@@ -1228,8 +1206,7 @@ static s32 igb_check_polarity_igp(struct e1000_hw *hw) | |||
1228 | * Polarity is determined based on the speed of | 1206 | * Polarity is determined based on the speed of |
1229 | * our connection. | 1207 | * our connection. |
1230 | */ | 1208 | */ |
1231 | ret_val = hw->phy.ops.read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, | 1209 | ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data); |
1232 | &data); | ||
1233 | if (ret_val) | 1210 | if (ret_val) |
1234 | goto out; | 1211 | goto out; |
1235 | 1212 | ||
@@ -1246,7 +1223,7 @@ static s32 igb_check_polarity_igp(struct e1000_hw *hw) | |||
1246 | mask = IGP01E1000_PSSR_POLARITY_REVERSED; | 1223 | mask = IGP01E1000_PSSR_POLARITY_REVERSED; |
1247 | } | 1224 | } |
1248 | 1225 | ||
1249 | ret_val = hw->phy.ops.read_phy_reg(hw, offset, &data); | 1226 | ret_val = phy->ops.read_reg(hw, offset, &data); |
1250 | 1227 | ||
1251 | if (!ret_val) | 1228 | if (!ret_val) |
1252 | phy->cable_polarity = (data & mask) | 1229 | phy->cable_polarity = (data & mask) |
@@ -1271,10 +1248,10 @@ static s32 igb_wait_autoneg(struct e1000_hw *hw) | |||
1271 | 1248 | ||
1272 | /* Break after autoneg completes or PHY_AUTO_NEG_LIMIT expires. */ | 1249 | /* Break after autoneg completes or PHY_AUTO_NEG_LIMIT expires. */ |
1273 | for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) { | 1250 | for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) { |
1274 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS, &phy_status); | 1251 | ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); |
1275 | if (ret_val) | 1252 | if (ret_val) |
1276 | break; | 1253 | break; |
1277 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS, &phy_status); | 1254 | ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); |
1278 | if (ret_val) | 1255 | if (ret_val) |
1279 | break; | 1256 | break; |
1280 | if (phy_status & MII_SR_AUTONEG_COMPLETE) | 1257 | if (phy_status & MII_SR_AUTONEG_COMPLETE) |
@@ -1310,10 +1287,10 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations, | |||
1310 | * twice due to the link bit being sticky. No harm doing | 1287 | * twice due to the link bit being sticky. No harm doing |
1311 | * it across the board. | 1288 | * it across the board. |
1312 | */ | 1289 | */ |
1313 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS, &phy_status); | 1290 | ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); |
1314 | if (ret_val) | 1291 | if (ret_val) |
1315 | break; | 1292 | break; |
1316 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS, &phy_status); | 1293 | ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); |
1317 | if (ret_val) | 1294 | if (ret_val) |
1318 | break; | 1295 | break; |
1319 | if (phy_status & MII_SR_LINK_STATUS) | 1296 | if (phy_status & MII_SR_LINK_STATUS) |
@@ -1350,8 +1327,7 @@ s32 igb_get_cable_length_m88(struct e1000_hw *hw) | |||
1350 | s32 ret_val; | 1327 | s32 ret_val; |
1351 | u16 phy_data, index; | 1328 | u16 phy_data, index; |
1352 | 1329 | ||
1353 | ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, | 1330 | ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
1354 | &phy_data); | ||
1355 | if (ret_val) | 1331 | if (ret_val) |
1356 | goto out; | 1332 | goto out; |
1357 | 1333 | ||
@@ -1372,8 +1348,8 @@ out: | |||
1372 | * | 1348 | * |
1373 | * The automatic gain control (agc) normalizes the amplitude of the | 1349 | * The automatic gain control (agc) normalizes the amplitude of the |
1374 | * received signal, adjusting for the attenuation produced by the | 1350 | * received signal, adjusting for the attenuation produced by the |
1375 | * cable. By reading the AGC registers, which reperesent the | 1351 | * cable. By reading the AGC registers, which represent the |
1376 | * cobination of course and fine gain value, the value can be put | 1352 | * combination of coarse and fine gain value, the value can be put |
1377 | * into a lookup table to obtain the approximate cable length | 1353 | * into a lookup table to obtain the approximate cable length |
1378 | * for each channel. | 1354 | * for each channel. |
1379 | **/ | 1355 | **/ |
@@ -1392,14 +1368,13 @@ s32 igb_get_cable_length_igp_2(struct e1000_hw *hw) | |||
1392 | 1368 | ||
1393 | /* Read the AGC registers for all channels */ | 1369 | /* Read the AGC registers for all channels */ |
1394 | for (i = 0; i < IGP02E1000_PHY_CHANNEL_NUM; i++) { | 1370 | for (i = 0; i < IGP02E1000_PHY_CHANNEL_NUM; i++) { |
1395 | ret_val = hw->phy.ops.read_phy_reg(hw, agc_reg_array[i], | 1371 | ret_val = phy->ops.read_reg(hw, agc_reg_array[i], &phy_data); |
1396 | &phy_data); | ||
1397 | if (ret_val) | 1372 | if (ret_val) |
1398 | goto out; | 1373 | goto out; |
1399 | 1374 | ||
1400 | /* | 1375 | /* |
1401 | * Getting bits 15:9, which represent the combination of | 1376 | * Getting bits 15:9, which represent the combination of |
1402 | * course and fine gain values. The result is a number | 1377 | * coarse and fine gain values. The result is a number |
1403 | * that can be put into the lookup table to obtain the | 1378 | * that can be put into the lookup table to obtain the |
1404 | * approximate cable length. | 1379 | * approximate cable length. |
1405 | */ | 1380 | */ |
@@ -1456,7 +1431,7 @@ s32 igb_get_phy_info_m88(struct e1000_hw *hw) | |||
1456 | u16 phy_data; | 1431 | u16 phy_data; |
1457 | bool link; | 1432 | bool link; |
1458 | 1433 | ||
1459 | if (hw->phy.media_type != e1000_media_type_copper) { | 1434 | if (phy->media_type != e1000_media_type_copper) { |
1460 | hw_dbg("Phy info is only valid for copper media\n"); | 1435 | hw_dbg("Phy info is only valid for copper media\n"); |
1461 | ret_val = -E1000_ERR_CONFIG; | 1436 | ret_val = -E1000_ERR_CONFIG; |
1462 | goto out; | 1437 | goto out; |
@@ -1472,33 +1447,29 @@ s32 igb_get_phy_info_m88(struct e1000_hw *hw) | |||
1472 | goto out; | 1447 | goto out; |
1473 | } | 1448 | } |
1474 | 1449 | ||
1475 | ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, | 1450 | ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
1476 | &phy_data); | ||
1477 | if (ret_val) | 1451 | if (ret_val) |
1478 | goto out; | 1452 | goto out; |
1479 | 1453 | ||
1480 | phy->polarity_correction = (phy_data & M88E1000_PSCR_POLARITY_REVERSAL) | 1454 | phy->polarity_correction = (phy_data & M88E1000_PSCR_POLARITY_REVERSAL) |
1481 | ? true | 1455 | ? true : false; |
1482 | : false; | ||
1483 | 1456 | ||
1484 | ret_val = igb_check_polarity_m88(hw); | 1457 | ret_val = igb_check_polarity_m88(hw); |
1485 | if (ret_val) | 1458 | if (ret_val) |
1486 | goto out; | 1459 | goto out; |
1487 | 1460 | ||
1488 | ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, | 1461 | ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
1489 | &phy_data); | ||
1490 | if (ret_val) | 1462 | if (ret_val) |
1491 | goto out; | 1463 | goto out; |
1492 | 1464 | ||
1493 | phy->is_mdix = (phy_data & M88E1000_PSSR_MDIX) ? true : false; | 1465 | phy->is_mdix = (phy_data & M88E1000_PSSR_MDIX) ? true : false; |
1494 | 1466 | ||
1495 | if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) { | 1467 | if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) { |
1496 | ret_val = hw->phy.ops.get_cable_length(hw); | 1468 | ret_val = phy->ops.get_cable_length(hw); |
1497 | if (ret_val) | 1469 | if (ret_val) |
1498 | goto out; | 1470 | goto out; |
1499 | 1471 | ||
1500 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_1000T_STATUS, | 1472 | ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &phy_data); |
1501 | &phy_data); | ||
1502 | if (ret_val) | 1473 | if (ret_val) |
1503 | goto out; | 1474 | goto out; |
1504 | 1475 | ||
@@ -1552,8 +1523,7 @@ s32 igb_get_phy_info_igp(struct e1000_hw *hw) | |||
1552 | if (ret_val) | 1523 | if (ret_val) |
1553 | goto out; | 1524 | goto out; |
1554 | 1525 | ||
1555 | ret_val = hw->phy.ops.read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, | 1526 | ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data); |
1556 | &data); | ||
1557 | if (ret_val) | 1527 | if (ret_val) |
1558 | goto out; | 1528 | goto out; |
1559 | 1529 | ||
@@ -1561,12 +1531,11 @@ s32 igb_get_phy_info_igp(struct e1000_hw *hw) | |||
1561 | 1531 | ||
1562 | if ((data & IGP01E1000_PSSR_SPEED_MASK) == | 1532 | if ((data & IGP01E1000_PSSR_SPEED_MASK) == |
1563 | IGP01E1000_PSSR_SPEED_1000MBPS) { | 1533 | IGP01E1000_PSSR_SPEED_1000MBPS) { |
1564 | ret_val = hw->phy.ops.get_cable_length(hw); | 1534 | ret_val = phy->ops.get_cable_length(hw); |
1565 | if (ret_val) | 1535 | if (ret_val) |
1566 | goto out; | 1536 | goto out; |
1567 | 1537 | ||
1568 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_1000T_STATUS, | 1538 | ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &data); |
1569 | &data); | ||
1570 | if (ret_val) | 1539 | if (ret_val) |
1571 | goto out; | 1540 | goto out; |
1572 | 1541 | ||
@@ -1599,12 +1568,12 @@ s32 igb_phy_sw_reset(struct e1000_hw *hw) | |||
1599 | s32 ret_val; | 1568 | s32 ret_val; |
1600 | u16 phy_ctrl; | 1569 | u16 phy_ctrl; |
1601 | 1570 | ||
1602 | ret_val = hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &phy_ctrl); | 1571 | ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); |
1603 | if (ret_val) | 1572 | if (ret_val) |
1604 | goto out; | 1573 | goto out; |
1605 | 1574 | ||
1606 | phy_ctrl |= MII_CR_RESET; | 1575 | phy_ctrl |= MII_CR_RESET; |
1607 | ret_val = hw->phy.ops.write_phy_reg(hw, PHY_CONTROL, phy_ctrl); | 1576 | ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, phy_ctrl); |
1608 | if (ret_val) | 1577 | if (ret_val) |
1609 | goto out; | 1578 | goto out; |
1610 | 1579 | ||
@@ -1635,7 +1604,7 @@ s32 igb_phy_hw_reset(struct e1000_hw *hw) | |||
1635 | goto out; | 1604 | goto out; |
1636 | } | 1605 | } |
1637 | 1606 | ||
1638 | ret_val = igb_acquire_phy(hw); | 1607 | ret_val = phy->ops.acquire(hw); |
1639 | if (ret_val) | 1608 | if (ret_val) |
1640 | goto out; | 1609 | goto out; |
1641 | 1610 | ||
@@ -1650,74 +1619,14 @@ s32 igb_phy_hw_reset(struct e1000_hw *hw) | |||
1650 | 1619 | ||
1651 | udelay(150); | 1620 | udelay(150); |
1652 | 1621 | ||
1653 | igb_release_phy(hw); | 1622 | phy->ops.release(hw); |
1654 | 1623 | ||
1655 | ret_val = igb_get_phy_cfg_done(hw); | 1624 | ret_val = phy->ops.get_cfg_done(hw); |
1656 | 1625 | ||
1657 | out: | 1626 | out: |
1658 | return ret_val; | 1627 | return ret_val; |
1659 | } | 1628 | } |
1660 | 1629 | ||
1661 | /* Internal function pointers */ | ||
1662 | |||
1663 | /** | ||
1664 | * igb_get_phy_cfg_done - Generic PHY configuration done | ||
1665 | * @hw: pointer to the HW structure | ||
1666 | * | ||
1667 | * Return success if silicon family did not implement a family specific | ||
1668 | * get_cfg_done function. | ||
1669 | **/ | ||
1670 | static s32 igb_get_phy_cfg_done(struct e1000_hw *hw) | ||
1671 | { | ||
1672 | if (hw->phy.ops.get_cfg_done) | ||
1673 | return hw->phy.ops.get_cfg_done(hw); | ||
1674 | |||
1675 | return 0; | ||
1676 | } | ||
1677 | |||
1678 | /** | ||
1679 | * igb_release_phy - Generic release PHY | ||
1680 | * @hw: pointer to the HW structure | ||
1681 | * | ||
1682 | * Return if silicon family does not require a semaphore when accessing the | ||
1683 | * PHY. | ||
1684 | **/ | ||
1685 | static void igb_release_phy(struct e1000_hw *hw) | ||
1686 | { | ||
1687 | if (hw->phy.ops.release_phy) | ||
1688 | hw->phy.ops.release_phy(hw); | ||
1689 | } | ||
1690 | |||
1691 | /** | ||
1692 | * igb_acquire_phy - Generic acquire PHY | ||
1693 | * @hw: pointer to the HW structure | ||
1694 | * | ||
1695 | * Return success if silicon family does not require a semaphore when | ||
1696 | * accessing the PHY. | ||
1697 | **/ | ||
1698 | static s32 igb_acquire_phy(struct e1000_hw *hw) | ||
1699 | { | ||
1700 | if (hw->phy.ops.acquire_phy) | ||
1701 | return hw->phy.ops.acquire_phy(hw); | ||
1702 | |||
1703 | return 0; | ||
1704 | } | ||
1705 | |||
1706 | /** | ||
1707 | * igb_phy_force_speed_duplex - Generic force PHY speed/duplex | ||
1708 | * @hw: pointer to the HW structure | ||
1709 | * | ||
1710 | * When the silicon family has not implemented a forced speed/duplex | ||
1711 | * function for the PHY, simply return 0. | ||
1712 | **/ | ||
1713 | s32 igb_phy_force_speed_duplex(struct e1000_hw *hw) | ||
1714 | { | ||
1715 | if (hw->phy.ops.force_speed_duplex) | ||
1716 | return hw->phy.ops.force_speed_duplex(hw); | ||
1717 | |||
1718 | return 0; | ||
1719 | } | ||
1720 | |||
1721 | /** | 1630 | /** |
1722 | * igb_phy_init_script_igp3 - Inits the IGP3 PHY | 1631 | * igb_phy_init_script_igp3 - Inits the IGP3 PHY |
1723 | * @hw: pointer to the HW structure | 1632 | * @hw: pointer to the HW structure |
@@ -1730,75 +1639,75 @@ s32 igb_phy_init_script_igp3(struct e1000_hw *hw) | |||
1730 | 1639 | ||
1731 | /* PHY init IGP 3 */ | 1640 | /* PHY init IGP 3 */ |
1732 | /* Enable rise/fall, 10-mode work in class-A */ | 1641 | /* Enable rise/fall, 10-mode work in class-A */ |
1733 | hw->phy.ops.write_phy_reg(hw, 0x2F5B, 0x9018); | 1642 | hw->phy.ops.write_reg(hw, 0x2F5B, 0x9018); |
1734 | /* Remove all caps from Replica path filter */ | 1643 | /* Remove all caps from Replica path filter */ |
1735 | hw->phy.ops.write_phy_reg(hw, 0x2F52, 0x0000); | 1644 | hw->phy.ops.write_reg(hw, 0x2F52, 0x0000); |
1736 | /* Bias trimming for ADC, AFE and Driver (Default) */ | 1645 | /* Bias trimming for ADC, AFE and Driver (Default) */ |
1737 | hw->phy.ops.write_phy_reg(hw, 0x2FB1, 0x8B24); | 1646 | hw->phy.ops.write_reg(hw, 0x2FB1, 0x8B24); |
1738 | /* Increase Hybrid poly bias */ | 1647 | /* Increase Hybrid poly bias */ |
1739 | hw->phy.ops.write_phy_reg(hw, 0x2FB2, 0xF8F0); | 1648 | hw->phy.ops.write_reg(hw, 0x2FB2, 0xF8F0); |
1740 | /* Add 4% to TX amplitude in Giga mode */ | 1649 | /* Add 4% to TX amplitude in Giga mode */ |
1741 | hw->phy.ops.write_phy_reg(hw, 0x2010, 0x10B0); | 1650 | hw->phy.ops.write_reg(hw, 0x2010, 0x10B0); |
1742 | /* Disable trimming (TTT) */ | 1651 | /* Disable trimming (TTT) */ |
1743 | hw->phy.ops.write_phy_reg(hw, 0x2011, 0x0000); | 1652 | hw->phy.ops.write_reg(hw, 0x2011, 0x0000); |
1744 | /* Poly DC correction to 94.6% + 2% for all channels */ | 1653 | /* Poly DC correction to 94.6% + 2% for all channels */ |
1745 | hw->phy.ops.write_phy_reg(hw, 0x20DD, 0x249A); | 1654 | hw->phy.ops.write_reg(hw, 0x20DD, 0x249A); |
1746 | /* ABS DC correction to 95.9% */ | 1655 | /* ABS DC correction to 95.9% */ |
1747 | hw->phy.ops.write_phy_reg(hw, 0x20DE, 0x00D3); | 1656 | hw->phy.ops.write_reg(hw, 0x20DE, 0x00D3); |
1748 | /* BG temp curve trim */ | 1657 | /* BG temp curve trim */ |
1749 | hw->phy.ops.write_phy_reg(hw, 0x28B4, 0x04CE); | 1658 | hw->phy.ops.write_reg(hw, 0x28B4, 0x04CE); |
1750 | /* Increasing ADC OPAMP stage 1 currents to max */ | 1659 | /* Increasing ADC OPAMP stage 1 currents to max */ |
1751 | hw->phy.ops.write_phy_reg(hw, 0x2F70, 0x29E4); | 1660 | hw->phy.ops.write_reg(hw, 0x2F70, 0x29E4); |
1752 | /* Force 1000 ( required for enabling PHY regs configuration) */ | 1661 | /* Force 1000 ( required for enabling PHY regs configuration) */ |
1753 | hw->phy.ops.write_phy_reg(hw, 0x0000, 0x0140); | 1662 | hw->phy.ops.write_reg(hw, 0x0000, 0x0140); |
1754 | /* Set upd_freq to 6 */ | 1663 | /* Set upd_freq to 6 */ |
1755 | hw->phy.ops.write_phy_reg(hw, 0x1F30, 0x1606); | 1664 | hw->phy.ops.write_reg(hw, 0x1F30, 0x1606); |
1756 | /* Disable NPDFE */ | 1665 | /* Disable NPDFE */ |
1757 | hw->phy.ops.write_phy_reg(hw, 0x1F31, 0xB814); | 1666 | hw->phy.ops.write_reg(hw, 0x1F31, 0xB814); |
1758 | /* Disable adaptive fixed FFE (Default) */ | 1667 | /* Disable adaptive fixed FFE (Default) */ |
1759 | hw->phy.ops.write_phy_reg(hw, 0x1F35, 0x002A); | 1668 | hw->phy.ops.write_reg(hw, 0x1F35, 0x002A); |
1760 | /* Enable FFE hysteresis */ | 1669 | /* Enable FFE hysteresis */ |
1761 | hw->phy.ops.write_phy_reg(hw, 0x1F3E, 0x0067); | 1670 | hw->phy.ops.write_reg(hw, 0x1F3E, 0x0067); |
1762 | /* Fixed FFE for short cable lengths */ | 1671 | /* Fixed FFE for short cable lengths */ |
1763 | hw->phy.ops.write_phy_reg(hw, 0x1F54, 0x0065); | 1672 | hw->phy.ops.write_reg(hw, 0x1F54, 0x0065); |
1764 | /* Fixed FFE for medium cable lengths */ | 1673 | /* Fixed FFE for medium cable lengths */ |
1765 | hw->phy.ops.write_phy_reg(hw, 0x1F55, 0x002A); | 1674 | hw->phy.ops.write_reg(hw, 0x1F55, 0x002A); |
1766 | /* Fixed FFE for long cable lengths */ | 1675 | /* Fixed FFE for long cable lengths */ |
1767 | hw->phy.ops.write_phy_reg(hw, 0x1F56, 0x002A); | 1676 | hw->phy.ops.write_reg(hw, 0x1F56, 0x002A); |
1768 | /* Enable Adaptive Clip Threshold */ | 1677 | /* Enable Adaptive Clip Threshold */ |
1769 | hw->phy.ops.write_phy_reg(hw, 0x1F72, 0x3FB0); | 1678 | hw->phy.ops.write_reg(hw, 0x1F72, 0x3FB0); |
1770 | /* AHT reset limit to 1 */ | 1679 | /* AHT reset limit to 1 */ |
1771 | hw->phy.ops.write_phy_reg(hw, 0x1F76, 0xC0FF); | 1680 | hw->phy.ops.write_reg(hw, 0x1F76, 0xC0FF); |
1772 | /* Set AHT master delay to 127 msec */ | 1681 | /* Set AHT master delay to 127 msec */ |
1773 | hw->phy.ops.write_phy_reg(hw, 0x1F77, 0x1DEC); | 1682 | hw->phy.ops.write_reg(hw, 0x1F77, 0x1DEC); |
1774 | /* Set scan bits for AHT */ | 1683 | /* Set scan bits for AHT */ |
1775 | hw->phy.ops.write_phy_reg(hw, 0x1F78, 0xF9EF); | 1684 | hw->phy.ops.write_reg(hw, 0x1F78, 0xF9EF); |
1776 | /* Set AHT Preset bits */ | 1685 | /* Set AHT Preset bits */ |
1777 | hw->phy.ops.write_phy_reg(hw, 0x1F79, 0x0210); | 1686 | hw->phy.ops.write_reg(hw, 0x1F79, 0x0210); |
1778 | /* Change integ_factor of channel A to 3 */ | 1687 | /* Change integ_factor of channel A to 3 */ |
1779 | hw->phy.ops.write_phy_reg(hw, 0x1895, 0x0003); | 1688 | hw->phy.ops.write_reg(hw, 0x1895, 0x0003); |
1780 | /* Change prop_factor of channels BCD to 8 */ | 1689 | /* Change prop_factor of channels BCD to 8 */ |
1781 | hw->phy.ops.write_phy_reg(hw, 0x1796, 0x0008); | 1690 | hw->phy.ops.write_reg(hw, 0x1796, 0x0008); |
1782 | /* Change cg_icount + enable integbp for channels BCD */ | 1691 | /* Change cg_icount + enable integbp for channels BCD */ |
1783 | hw->phy.ops.write_phy_reg(hw, 0x1798, 0xD008); | 1692 | hw->phy.ops.write_reg(hw, 0x1798, 0xD008); |
1784 | /* | 1693 | /* |
1785 | * Change cg_icount + enable integbp + change prop_factor_master | 1694 | * Change cg_icount + enable integbp + change prop_factor_master |
1786 | * to 8 for channel A | 1695 | * to 8 for channel A |
1787 | */ | 1696 | */ |
1788 | hw->phy.ops.write_phy_reg(hw, 0x1898, 0xD918); | 1697 | hw->phy.ops.write_reg(hw, 0x1898, 0xD918); |
1789 | /* Disable AHT in Slave mode on channel A */ | 1698 | /* Disable AHT in Slave mode on channel A */ |
1790 | hw->phy.ops.write_phy_reg(hw, 0x187A, 0x0800); | 1699 | hw->phy.ops.write_reg(hw, 0x187A, 0x0800); |
1791 | /* | 1700 | /* |
1792 | * Enable LPLU and disable AN to 1000 in non-D0a states, | 1701 | * Enable LPLU and disable AN to 1000 in non-D0a states, |
1793 | * Enable SPD+B2B | 1702 | * Enable SPD+B2B |
1794 | */ | 1703 | */ |
1795 | hw->phy.ops.write_phy_reg(hw, 0x0019, 0x008D); | 1704 | hw->phy.ops.write_reg(hw, 0x0019, 0x008D); |
1796 | /* Enable restart AN on an1000_dis change */ | 1705 | /* Enable restart AN on an1000_dis change */ |
1797 | hw->phy.ops.write_phy_reg(hw, 0x001B, 0x2080); | 1706 | hw->phy.ops.write_reg(hw, 0x001B, 0x2080); |
1798 | /* Enable wh_fifo read clock in 10/100 modes */ | 1707 | /* Enable wh_fifo read clock in 10/100 modes */ |
1799 | hw->phy.ops.write_phy_reg(hw, 0x0014, 0x0045); | 1708 | hw->phy.ops.write_reg(hw, 0x0014, 0x0045); |
1800 | /* Restart AN, Speed selection is 1000 */ | 1709 | /* Restart AN, Speed selection is 1000 */ |
1801 | hw->phy.ops.write_phy_reg(hw, 0x0000, 0x1340); | 1710 | hw->phy.ops.write_reg(hw, 0x0000, 0x1340); |
1802 | 1711 | ||
1803 | return 0; | 1712 | return 0; |
1804 | } | 1713 | } |