aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn Wyborny <carolyn.wyborny@intel.com>2012-03-03 22:26:26 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-05-12 16:16:52 -0400
commitda02cde1c1ffb798df6159a2252653a9becea51a (patch)
treef509e3f36d9feb512eaf3b97ced1659313373a1b
parent4b549a2ef4bef9965d97cbd992ba67930cd3e0fe (diff)
igb: Add function and pointers for 82580 low power state settings.
82580 and later parts did not have low power setting functions. This patch adds the specific functions, pointers and assignments for these low power settings. Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_82575.c94
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_phy.h7
2 files changed, 101 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index 08bdc33715ee..b945992af9ef 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -52,6 +52,8 @@ static s32 igb_write_phy_reg_82580(struct e1000_hw *, u32, u16);
52static s32 igb_reset_hw_82575(struct e1000_hw *); 52static s32 igb_reset_hw_82575(struct e1000_hw *);
53static s32 igb_reset_hw_82580(struct e1000_hw *); 53static s32 igb_reset_hw_82580(struct e1000_hw *);
54static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *, bool); 54static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *, bool);
55static s32 igb_set_d0_lplu_state_82580(struct e1000_hw *, bool);
56static s32 igb_set_d3_lplu_state_82580(struct e1000_hw *, bool);
55static s32 igb_setup_copper_link_82575(struct e1000_hw *); 57static s32 igb_setup_copper_link_82575(struct e1000_hw *);
56static s32 igb_setup_serdes_link_82575(struct e1000_hw *); 58static s32 igb_setup_serdes_link_82575(struct e1000_hw *);
57static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16); 59static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16);
@@ -359,6 +361,8 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
359 phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_82580; 361 phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_82580;
360 phy->ops.get_cable_length = igb_get_cable_length_82580; 362 phy->ops.get_cable_length = igb_get_cable_length_82580;
361 phy->ops.get_phy_info = igb_get_phy_info_82580; 363 phy->ops.get_phy_info = igb_get_phy_info_82580;
364 phy->ops.set_d0_lplu_state = igb_set_d0_lplu_state_82580;
365 phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state_82580;
362 break; 366 break;
363 default: 367 default:
364 return -E1000_ERR_PHY; 368 return -E1000_ERR_PHY;
@@ -674,6 +678,96 @@ out:
674} 678}
675 679
676/** 680/**
681 * igb_set_d0_lplu_state_82580 - Set Low Power Linkup D0 state
682 * @hw: pointer to the HW structure
683 * @active: true to enable LPLU, false to disable
684 *
685 * Sets the LPLU D0 state according to the active flag. When
686 * activating LPLU this function also disables smart speed
687 * and vice versa. LPLU will not be activated unless the
688 * device autonegotiation advertisement meets standards of
689 * either 10 or 10/100 or 10/100/1000 at all duplexes.
690 * This is a function pointer entry point only called by
691 * PHY setup routines.
692 **/
693static s32 igb_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active)
694{
695 struct e1000_phy_info *phy = &hw->phy;
696 s32 ret_val = 0;
697 u16 data;
698
699 data = rd32(E1000_82580_PHY_POWER_MGMT);
700
701 if (active) {
702 data |= E1000_82580_PM_D0_LPLU;
703
704 /* When LPLU is enabled, we should disable SmartSpeed */
705 data &= ~E1000_82580_PM_SPD;
706 } else {
707 data &= ~E1000_82580_PM_D0_LPLU;
708
709 /*
710 * LPLU and SmartSpeed are mutually exclusive. LPLU is used
711 * during Dx states where the power conservation is most
712 * important. During driver activity we should enable
713 * SmartSpeed, so performance is maintained.
714 */
715 if (phy->smart_speed == e1000_smart_speed_on)
716 data |= E1000_82580_PM_SPD;
717 else if (phy->smart_speed == e1000_smart_speed_off)
718 data &= ~E1000_82580_PM_SPD; }
719
720 wr32(E1000_82580_PHY_POWER_MGMT, data);
721 return ret_val;
722}
723
724/**
725 * igb_set_d3_lplu_state_82580 - Sets low power link up state for D3
726 * @hw: pointer to the HW structure
727 * @active: boolean used to enable/disable lplu
728 *
729 * Success returns 0, Failure returns 1
730 *
731 * The low power link up (lplu) state is set to the power management level D3
732 * and SmartSpeed is disabled when active is true, else clear lplu for D3
733 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
734 * is used during Dx states where the power conservation is most important.
735 * During driver activity, SmartSpeed should be enabled so performance is
736 * maintained.
737 **/
738s32 igb_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active)
739{
740 struct e1000_phy_info *phy = &hw->phy;
741 s32 ret_val = 0;
742 u16 data;
743
744 data = rd32(E1000_82580_PHY_POWER_MGMT);
745
746 if (!active) {
747 data &= ~E1000_82580_PM_D3_LPLU;
748 /*
749 * LPLU and SmartSpeed are mutually exclusive. LPLU is used
750 * during Dx states where the power conservation is most
751 * important. During driver activity we should enable
752 * SmartSpeed, so performance is maintained.
753 */
754 if (phy->smart_speed == e1000_smart_speed_on)
755 data |= E1000_82580_PM_SPD;
756 else if (phy->smart_speed == e1000_smart_speed_off)
757 data &= ~E1000_82580_PM_SPD;
758 } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) ||
759 (phy->autoneg_advertised == E1000_ALL_NOT_GIG) ||
760 (phy->autoneg_advertised == E1000_ALL_10_SPEED)) {
761 data |= E1000_82580_PM_D3_LPLU;
762 /* When LPLU is enabled, we should disable SmartSpeed */
763 data &= ~E1000_82580_PM_SPD;
764 }
765
766 wr32(E1000_82580_PHY_POWER_MGMT, data);
767 return ret_val;
768}
769
770/**
677 * igb_acquire_nvm_82575 - Request for access to EEPROM 771 * igb_acquire_nvm_82575 - Request for access to EEPROM
678 * @hw: pointer to the HW structure 772 * @hw: pointer to the HW structure
679 * 773 *
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.h b/drivers/net/ethernet/intel/igb/e1000_phy.h
index 4c32ac66ff39..84172ea2bc1b 100644
--- a/drivers/net/ethernet/intel/igb/e1000_phy.h
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.h
@@ -114,6 +114,13 @@ s32 igb_get_cable_length_82580(struct e1000_hw *hw);
114/* I82580 PHY Diagnostics Status */ 114/* I82580 PHY Diagnostics Status */
115#define I82580_DSTATUS_CABLE_LENGTH 0x03FC 115#define I82580_DSTATUS_CABLE_LENGTH 0x03FC
116#define I82580_DSTATUS_CABLE_LENGTH_SHIFT 2 116#define I82580_DSTATUS_CABLE_LENGTH_SHIFT 2
117
118/* 82580 PHY Power Management */
119#define E1000_82580_PHY_POWER_MGMT 0xE14
120#define E1000_82580_PM_SPD 0x0001 /* Smart Power Down */
121#define E1000_82580_PM_D0_LPLU 0x0002 /* For D0a states */
122#define E1000_82580_PM_D3_LPLU 0x0004 /* For all other states */
123
117/* Enable flexible speed on link-up */ 124/* Enable flexible speed on link-up */
118#define IGP02E1000_PM_D0_LPLU 0x0002 /* For D0a states */ 125#define IGP02E1000_PM_D0_LPLU 0x0002 /* For D0a states */
119#define IGP02E1000_PM_D3_LPLU 0x0004 /* For all other states */ 126#define IGP02E1000_PM_D3_LPLU 0x0004 /* For all other states */