aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_82598.c
diff options
context:
space:
mode:
authorMallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com>2009-09-01 09:49:35 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-01 20:40:14 -0400
commit8620a103b5e38d952280f3d97b5e1bcce8d7874c (patch)
treeedb7b63d24fe6208529cef8fadffbdcd12972f6e /drivers/net/ixgbe/ixgbe_82598.c
parentfd38d7a0a0618656e491ed67af735bc4e3600367 (diff)
ixgbe: refactor link setup code
Link code cleanup: a number of redundant functions and MAC variables are cleaned up, with some functions being consolidated into a single-purpose code path. Removed following deprecated link functions and mac variables * ixgbe_setup_copper_link_speed_82598 * ixgbe_setup_mac_link_speed_multispeed_fiber * ixgbe_setup_mac_link_speed_82599 * mac.autoneg, mac.autoneg_succeeded, phy.autoneg_wait_to_complete Signed-off-by: Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com> Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@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/ixgbe/ixgbe_82598.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_82598.c49
1 files changed, 11 insertions, 38 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 916430f2a7e7..cb7f0c3c6e16 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -41,8 +41,7 @@
41static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw, 41static s32 ixgbe_get_copper_link_capabilities_82598(struct ixgbe_hw *hw,
42 ixgbe_link_speed *speed, 42 ixgbe_link_speed *speed,
43 bool *autoneg); 43 bool *autoneg);
44static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw); 44static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
45static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw,
46 ixgbe_link_speed speed, 45 ixgbe_link_speed speed,
47 bool autoneg, 46 bool autoneg,
48 bool autoneg_wait_to_complete); 47 bool autoneg_wait_to_complete);
@@ -156,8 +155,6 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
156 /* Overwrite the link function pointers if copper PHY */ 155 /* Overwrite the link function pointers if copper PHY */
157 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { 156 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
158 mac->ops.setup_link = &ixgbe_setup_copper_link_82598; 157 mac->ops.setup_link = &ixgbe_setup_copper_link_82598;
159 mac->ops.setup_link_speed =
160 &ixgbe_setup_copper_link_speed_82598;
161 mac->ops.get_link_capabilities = 158 mac->ops.get_link_capabilities =
162 &ixgbe_get_copper_link_capabilities_82598; 159 &ixgbe_get_copper_link_capabilities_82598;
163 } 160 }
@@ -465,13 +462,14 @@ out:
465} 462}
466 463
467/** 464/**
468 * ixgbe_setup_mac_link_82598 - Configures MAC link settings 465 * ixgbe_start_mac_link_82598 - Configures MAC link settings
469 * @hw: pointer to hardware structure 466 * @hw: pointer to hardware structure
470 * 467 *
471 * Configures link settings based on values in the ixgbe_hw struct. 468 * Configures link settings based on values in the ixgbe_hw struct.
472 * Restarts the link. Performs autonegotiation if needed. 469 * Restarts the link. Performs autonegotiation if needed.
473 **/ 470 **/
474static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw) 471static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw,
472 bool autoneg_wait_to_complete)
475{ 473{
476 u32 autoc_reg; 474 u32 autoc_reg;
477 u32 links_reg; 475 u32 links_reg;
@@ -484,7 +482,7 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw)
484 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); 482 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
485 483
486 /* Only poll for autoneg to complete if specified to do so */ 484 /* Only poll for autoneg to complete if specified to do so */
487 if (hw->phy.autoneg_wait_to_complete) { 485 if (autoneg_wait_to_complete) {
488 if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == 486 if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
489 IXGBE_AUTOC_LMS_KX4_AN || 487 IXGBE_AUTOC_LMS_KX4_AN ||
490 (autoc_reg & IXGBE_AUTOC_LMS_MASK) == 488 (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
@@ -600,7 +598,7 @@ out:
600 598
601 599
602/** 600/**
603 * ixgbe_setup_mac_link_speed_82598 - Set MAC link speed 601 * ixgbe_setup_mac_link_82598 - Set MAC link speed
604 * @hw: pointer to hardware structure 602 * @hw: pointer to hardware structure
605 * @speed: new link speed 603 * @speed: new link speed
606 * @autoneg: true if auto-negotiation enabled 604 * @autoneg: true if auto-negotiation enabled
@@ -608,7 +606,7 @@ out:
608 * 606 *
609 * Set the link speed in the AUTOC register and restarts link. 607 * Set the link speed in the AUTOC register and restarts link.
610 **/ 608 **/
611static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw, 609static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
612 ixgbe_link_speed speed, bool autoneg, 610 ixgbe_link_speed speed, bool autoneg,
613 bool autoneg_wait_to_complete) 611 bool autoneg_wait_to_complete)
614{ 612{
@@ -638,14 +636,12 @@ static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw,
638 } 636 }
639 637
640 if (status == 0) { 638 if (status == 0) {
641 hw->phy.autoneg_wait_to_complete = autoneg_wait_to_complete;
642
643 /* 639 /*
644 * Setup and restart the link based on the new values in 640 * Setup and restart the link based on the new values in
645 * ixgbe_hw This will write the AUTOC register based on the new 641 * ixgbe_hw This will write the AUTOC register based on the new
646 * stored values 642 * stored values
647 */ 643 */
648 status = ixgbe_setup_mac_link_82598(hw); 644 status = ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete);
649 } 645 }
650 646
651 return status; 647 return status;
@@ -653,29 +649,7 @@ static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw,
653 649
654 650
655/** 651/**
656 * ixgbe_setup_copper_link_82598 - Setup copper link settings 652 * ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field
657 * @hw: pointer to hardware structure
658 *
659 * Configures link settings based on values in the ixgbe_hw struct.
660 * Restarts the link. Performs autonegotiation if needed. Restart
661 * phy and wait for autonegotiate to finish. Then synchronize the
662 * MAC and PHY.
663 **/
664static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw)
665{
666 s32 status;
667
668 /* Restart autonegotiation on PHY */
669 status = hw->phy.ops.setup_link(hw);
670
671 /* Set up MAC */
672 ixgbe_setup_mac_link_82598(hw);
673
674 return status;
675}
676
677/**
678 * ixgbe_setup_copper_link_speed_82598 - Set the PHY autoneg advertised field
679 * @hw: pointer to hardware structure 653 * @hw: pointer to hardware structure
680 * @speed: new link speed 654 * @speed: new link speed
681 * @autoneg: true if autonegotiation enabled 655 * @autoneg: true if autonegotiation enabled
@@ -683,7 +657,7 @@ static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw)
683 * 657 *
684 * Sets the link speed in the AUTOC register in the MAC and restarts link. 658 * Sets the link speed in the AUTOC register in the MAC and restarts link.
685 **/ 659 **/
686static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw, 660static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
687 ixgbe_link_speed speed, 661 ixgbe_link_speed speed,
688 bool autoneg, 662 bool autoneg,
689 bool autoneg_wait_to_complete) 663 bool autoneg_wait_to_complete)
@@ -695,7 +669,7 @@ static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw,
695 autoneg_wait_to_complete); 669 autoneg_wait_to_complete);
696 670
697 /* Set up MAC */ 671 /* Set up MAC */
698 ixgbe_setup_mac_link_82598(hw); 672 ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete);
699 673
700 return status; 674 return status;
701} 675}
@@ -1163,7 +1137,6 @@ static struct ixgbe_mac_operations mac_ops_82598 = {
1163 .read_analog_reg8 = &ixgbe_read_analog_reg8_82598, 1137 .read_analog_reg8 = &ixgbe_read_analog_reg8_82598,
1164 .write_analog_reg8 = &ixgbe_write_analog_reg8_82598, 1138 .write_analog_reg8 = &ixgbe_write_analog_reg8_82598,
1165 .setup_link = &ixgbe_setup_mac_link_82598, 1139 .setup_link = &ixgbe_setup_mac_link_82598,
1166 .setup_link_speed = &ixgbe_setup_mac_link_speed_82598,
1167 .check_link = &ixgbe_check_mac_link_82598, 1140 .check_link = &ixgbe_check_mac_link_82598,
1168 .get_link_capabilities = &ixgbe_get_link_capabilities_82598, 1141 .get_link_capabilities = &ixgbe_get_link_capabilities_82598,
1169 .led_on = &ixgbe_led_on_generic, 1142 .led_on = &ixgbe_led_on_generic,