diff options
author | Carolyn Wyborny <carolyn.wyborny@intel.com> | 2011-03-11 23:42:13 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-03-12 07:09:20 -0500 |
commit | 09b068d45737abb49320ab25cb4ed2916017ace7 (patch) | |
tree | 489c503a733de2f1d632e27ac331a6be4bd7f41f | |
parent | 422e05d12af9c1063d57210074b4e6db36a0cf39 (diff) |
igb: Add Energy Efficient Ethernet (EEE) for i350 devices.
This patch adds the EEE feature for i350 devices, enabled by default.
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/igb/e1000_82575.c | 46 | ||||
-rw-r--r-- | drivers/net/igb/e1000_82575.h | 1 | ||||
-rw-r--r-- | drivers/net/igb/e1000_defines.h | 7 | ||||
-rw-r--r-- | drivers/net/igb/e1000_hw.h | 1 | ||||
-rw-r--r-- | drivers/net/igb/e1000_regs.h | 4 | ||||
-rw-r--r-- | drivers/net/igb/igb_main.c | 8 |
6 files changed, 65 insertions, 2 deletions
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index 65c1833244f7..20d172aeb1c0 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c | |||
@@ -195,7 +195,11 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) | |||
195 | mac->arc_subsystem_valid = | 195 | mac->arc_subsystem_valid = |
196 | (rd32(E1000_FWSM) & E1000_FWSM_MODE_MASK) | 196 | (rd32(E1000_FWSM) & E1000_FWSM_MODE_MASK) |
197 | ? true : false; | 197 | ? true : false; |
198 | 198 | /* enable EEE on i350 parts */ | |
199 | if (mac->type == e1000_i350) | ||
200 | dev_spec->eee_disable = false; | ||
201 | else | ||
202 | dev_spec->eee_disable = true; | ||
199 | /* physical interface link setup */ | 203 | /* physical interface link setup */ |
200 | mac->ops.setup_physical_interface = | 204 | mac->ops.setup_physical_interface = |
201 | (hw->phy.media_type == e1000_media_type_copper) | 205 | (hw->phy.media_type == e1000_media_type_copper) |
@@ -1754,6 +1758,46 @@ u16 igb_rxpbs_adjust_82580(u32 data) | |||
1754 | return ret_val; | 1758 | return ret_val; |
1755 | } | 1759 | } |
1756 | 1760 | ||
1761 | /** | ||
1762 | * igb_set_eee_i350 - Enable/disable EEE support | ||
1763 | * @hw: pointer to the HW structure | ||
1764 | * | ||
1765 | * Enable/disable EEE based on setting in dev_spec structure. | ||
1766 | * | ||
1767 | **/ | ||
1768 | s32 igb_set_eee_i350(struct e1000_hw *hw) | ||
1769 | { | ||
1770 | s32 ret_val = 0; | ||
1771 | u32 ipcnfg, eeer, ctrl_ext; | ||
1772 | |||
1773 | ctrl_ext = rd32(E1000_CTRL_EXT); | ||
1774 | if ((hw->mac.type != e1000_i350) || | ||
1775 | (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK)) | ||
1776 | goto out; | ||
1777 | ipcnfg = rd32(E1000_IPCNFG); | ||
1778 | eeer = rd32(E1000_EEER); | ||
1779 | |||
1780 | /* enable or disable per user setting */ | ||
1781 | if (!(hw->dev_spec._82575.eee_disable)) { | ||
1782 | ipcnfg |= (E1000_IPCNFG_EEE_1G_AN | | ||
1783 | E1000_IPCNFG_EEE_100M_AN); | ||
1784 | eeer |= (E1000_EEER_TX_LPI_EN | | ||
1785 | E1000_EEER_RX_LPI_EN | | ||
1786 | E1000_EEER_LPI_FC); | ||
1787 | |||
1788 | } else { | ||
1789 | ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN | | ||
1790 | E1000_IPCNFG_EEE_100M_AN); | ||
1791 | eeer &= ~(E1000_EEER_TX_LPI_EN | | ||
1792 | E1000_EEER_RX_LPI_EN | | ||
1793 | E1000_EEER_LPI_FC); | ||
1794 | } | ||
1795 | wr32(E1000_IPCNFG, ipcnfg); | ||
1796 | wr32(E1000_EEER, eeer); | ||
1797 | out: | ||
1798 | |||
1799 | return ret_val; | ||
1800 | } | ||
1757 | static struct e1000_mac_operations e1000_mac_ops_82575 = { | 1801 | static struct e1000_mac_operations e1000_mac_ops_82575 = { |
1758 | .init_hw = igb_init_hw_82575, | 1802 | .init_hw = igb_init_hw_82575, |
1759 | .check_for_link = igb_check_for_link_82575, | 1803 | .check_for_link = igb_check_for_link_82575, |
diff --git a/drivers/net/igb/e1000_82575.h b/drivers/net/igb/e1000_82575.h index 1d01af2472e7..dd6df3498998 100644 --- a/drivers/net/igb/e1000_82575.h +++ b/drivers/net/igb/e1000_82575.h | |||
@@ -251,5 +251,6 @@ void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *, bool, int); | |||
251 | void igb_vmdq_set_loopback_pf(struct e1000_hw *, bool); | 251 | void igb_vmdq_set_loopback_pf(struct e1000_hw *, bool); |
252 | void igb_vmdq_set_replication_pf(struct e1000_hw *, bool); | 252 | void igb_vmdq_set_replication_pf(struct e1000_hw *, bool); |
253 | u16 igb_rxpbs_adjust_82580(u32 data); | 253 | u16 igb_rxpbs_adjust_82580(u32 data); |
254 | s32 igb_set_eee_i350(struct e1000_hw *); | ||
254 | 255 | ||
255 | #endif | 256 | #endif |
diff --git a/drivers/net/igb/e1000_defines.h b/drivers/net/igb/e1000_defines.h index 92e11da25749..79267813982a 100644 --- a/drivers/net/igb/e1000_defines.h +++ b/drivers/net/igb/e1000_defines.h | |||
@@ -758,6 +758,13 @@ | |||
758 | #define E1000_MDIC_ERROR 0x40000000 | 758 | #define E1000_MDIC_ERROR 0x40000000 |
759 | #define E1000_MDIC_DEST 0x80000000 | 759 | #define E1000_MDIC_DEST 0x80000000 |
760 | 760 | ||
761 | /* Energy Efficient Ethernet */ | ||
762 | #define E1000_IPCNFG_EEE_1G_AN 0x00000008 /* EEE Enable 1G AN */ | ||
763 | #define E1000_IPCNFG_EEE_100M_AN 0x00000004 /* EEE Enable 100M AN */ | ||
764 | #define E1000_EEER_TX_LPI_EN 0x00010000 /* EEE Tx LPI Enable */ | ||
765 | #define E1000_EEER_RX_LPI_EN 0x00020000 /* EEE Rx LPI Enable */ | ||
766 | #define E1000_EEER_LPI_FC 0x00040000 /* EEE Enable on FC */ | ||
767 | |||
761 | /* SerDes Control */ | 768 | /* SerDes Control */ |
762 | #define E1000_GEN_CTL_READY 0x80000000 | 769 | #define E1000_GEN_CTL_READY 0x80000000 |
763 | #define E1000_GEN_CTL_ADDRESS_SHIFT 8 | 770 | #define E1000_GEN_CTL_ADDRESS_SHIFT 8 |
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h index eec9ed735588..17569bfe3f2e 100644 --- a/drivers/net/igb/e1000_hw.h +++ b/drivers/net/igb/e1000_hw.h | |||
@@ -488,6 +488,7 @@ struct e1000_mbx_info { | |||
488 | struct e1000_dev_spec_82575 { | 488 | struct e1000_dev_spec_82575 { |
489 | bool sgmii_active; | 489 | bool sgmii_active; |
490 | bool global_device_reset; | 490 | bool global_device_reset; |
491 | bool eee_disable; | ||
491 | }; | 492 | }; |
492 | 493 | ||
493 | struct e1000_hw { | 494 | struct e1000_hw { |
diff --git a/drivers/net/igb/e1000_regs.h b/drivers/net/igb/e1000_regs.h index 61713548c027..b2f8e593da87 100644 --- a/drivers/net/igb/e1000_regs.h +++ b/drivers/net/igb/e1000_regs.h | |||
@@ -329,6 +329,10 @@ | |||
329 | /* DMA Coalescing registers */ | 329 | /* DMA Coalescing registers */ |
330 | #define E1000_PCIEMISC 0x05BB8 /* PCIE misc config register */ | 330 | #define E1000_PCIEMISC 0x05BB8 /* PCIE misc config register */ |
331 | 331 | ||
332 | /* Energy Efficient Ethernet "EEE" register */ | ||
333 | #define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */ | ||
334 | #define E1000_EEER 0x0E30 /* Energy Efficient Ethernet */ | ||
335 | |||
332 | /* OS2BMC Registers */ | 336 | /* OS2BMC Registers */ |
333 | #define E1000_B2OSPC 0x08FE0 /* BMC2OS packets sent by BMC */ | 337 | #define E1000_B2OSPC 0x08FE0 /* BMC2OS packets sent by BMC */ |
334 | #define E1000_B2OGPRC 0x04158 /* BMC2OS packets received by host */ | 338 | #define E1000_B2OGPRC 0x04158 /* BMC2OS packets received by host */ |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 3666b967846a..8643f8c29199 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -2014,7 +2014,13 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
2014 | adapter->msix_entries ? "MSI-X" : | 2014 | adapter->msix_entries ? "MSI-X" : |
2015 | (adapter->flags & IGB_FLAG_HAS_MSI) ? "MSI" : "legacy", | 2015 | (adapter->flags & IGB_FLAG_HAS_MSI) ? "MSI" : "legacy", |
2016 | adapter->num_rx_queues, adapter->num_tx_queues); | 2016 | adapter->num_rx_queues, adapter->num_tx_queues); |
2017 | 2017 | switch (hw->mac.type) { | |
2018 | case e1000_i350: | ||
2019 | igb_set_eee_i350(hw); | ||
2020 | break; | ||
2021 | default: | ||
2022 | break; | ||
2023 | } | ||
2018 | return 0; | 2024 | return 0; |
2019 | 2025 | ||
2020 | err_register: | 2026 | err_register: |