diff options
author | Bruce Allan <bruce.w.allan@intel.com> | 2010-06-16 09:27:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-19 01:12:17 -0400 |
commit | e52997f96008fda655d7ec3aa4297d1272e8a385 (patch) | |
tree | 5ef658bdfd94b4e752113388d0deaf4c78d38aac /drivers | |
parent | d3738bb8203acf8552c3ec8b3447133fc0938ddd (diff) |
e1000e: enable support for EEE on 82579
This patch enables IEEE802.3az (a.k.a. Energy Efficient Ethernet) on the
new 82579 LOMs. An optional module parameter is provided to disable the
feature if desired.
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@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')
-rw-r--r-- | drivers/net/e1000e/e1000.h | 1 | ||||
-rw-r--r-- | drivers/net/e1000e/hw.h | 1 | ||||
-rw-r--r-- | drivers/net/e1000e/ich8lan.c | 41 | ||||
-rw-r--r-- | drivers/net/e1000e/param.c | 28 |
4 files changed, 70 insertions, 1 deletions
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 0e59f15be110..c233496b1f47 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -423,6 +423,7 @@ struct e1000_info { | |||
423 | #define FLAG2_IS_DISCARDING (1 << 2) | 423 | #define FLAG2_IS_DISCARDING (1 << 2) |
424 | #define FLAG2_DISABLE_ASPM_L1 (1 << 3) | 424 | #define FLAG2_DISABLE_ASPM_L1 (1 << 3) |
425 | #define FLAG2_HAS_PHY_STATS (1 << 4) | 425 | #define FLAG2_HAS_PHY_STATS (1 << 4) |
426 | #define FLAG2_HAS_EEE (1 << 5) | ||
426 | 427 | ||
427 | #define E1000_RX_DESC_PS(R, i) \ | 428 | #define E1000_RX_DESC_PS(R, i) \ |
428 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) | 429 | (&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 96116ce5e5cc..eecb2eca507b 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -937,6 +937,7 @@ struct e1000_dev_spec_ich8lan { | |||
937 | bool kmrn_lock_loss_workaround_enabled; | 937 | bool kmrn_lock_loss_workaround_enabled; |
938 | struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS]; | 938 | struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS]; |
939 | bool nvm_k1_enabled; | 939 | bool nvm_k1_enabled; |
940 | bool eee_disable; | ||
940 | }; | 941 | }; |
941 | 942 | ||
942 | struct e1000_hw { | 943 | struct e1000_hw { |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 8274499b7df6..5e55de002487 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -131,6 +131,10 @@ | |||
131 | /* PHY Power Management Control */ | 131 | /* PHY Power Management Control */ |
132 | #define HV_PM_CTRL PHY_REG(770, 17) | 132 | #define HV_PM_CTRL PHY_REG(770, 17) |
133 | 133 | ||
134 | /* PHY Low Power Idle Control */ | ||
135 | #define I82579_LPI_CTRL PHY_REG(772, 20) | ||
136 | #define I82579_LPI_CTRL_ENABLE_MASK 0x6000 | ||
137 | |||
134 | /* Strapping Option Register - RO */ | 138 | /* Strapping Option Register - RO */ |
135 | #define E1000_STRAP 0x0000C | 139 | #define E1000_STRAP 0x0000C |
136 | #define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000 | 140 | #define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000 |
@@ -569,6 +573,35 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter) | |||
569 | } | 573 | } |
570 | 574 | ||
571 | /** | 575 | /** |
576 | * e1000_set_eee_pchlan - Enable/disable EEE support | ||
577 | * @hw: pointer to the HW structure | ||
578 | * | ||
579 | * Enable/disable EEE based on setting in dev_spec structure. The bits in | ||
580 | * the LPI Control register will remain set only if/when link is up. | ||
581 | **/ | ||
582 | static s32 e1000_set_eee_pchlan(struct e1000_hw *hw) | ||
583 | { | ||
584 | s32 ret_val = 0; | ||
585 | u16 phy_reg; | ||
586 | |||
587 | if (hw->phy.type != e1000_phy_82579) | ||
588 | goto out; | ||
589 | |||
590 | ret_val = e1e_rphy(hw, I82579_LPI_CTRL, &phy_reg); | ||
591 | if (ret_val) | ||
592 | goto out; | ||
593 | |||
594 | if (hw->dev_spec.ich8lan.eee_disable) | ||
595 | phy_reg &= ~I82579_LPI_CTRL_ENABLE_MASK; | ||
596 | else | ||
597 | phy_reg |= I82579_LPI_CTRL_ENABLE_MASK; | ||
598 | |||
599 | ret_val = e1e_wphy(hw, I82579_LPI_CTRL, phy_reg); | ||
600 | out: | ||
601 | return ret_val; | ||
602 | } | ||
603 | |||
604 | /** | ||
572 | * e1000_check_for_copper_link_ich8lan - Check for link (Copper) | 605 | * e1000_check_for_copper_link_ich8lan - Check for link (Copper) |
573 | * @hw: pointer to the HW structure | 606 | * @hw: pointer to the HW structure |
574 | * | 607 | * |
@@ -625,6 +658,11 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) | |||
625 | */ | 658 | */ |
626 | e1000e_check_downshift(hw); | 659 | e1000e_check_downshift(hw); |
627 | 660 | ||
661 | /* Enable/Disable EEE after link up */ | ||
662 | ret_val = e1000_set_eee_pchlan(hw); | ||
663 | if (ret_val) | ||
664 | goto out; | ||
665 | |||
628 | /* | 666 | /* |
629 | * If we are forcing speed/duplex, then we simply return since | 667 | * If we are forcing speed/duplex, then we simply return since |
630 | * we have already determined whether we have link or not. | 668 | * we have already determined whether we have link or not. |
@@ -3820,7 +3858,8 @@ struct e1000_info e1000_pch2_info = { | |||
3820 | | FLAG_HAS_FLASH | 3858 | | FLAG_HAS_FLASH |
3821 | | FLAG_HAS_JUMBO_FRAMES | 3859 | | FLAG_HAS_JUMBO_FRAMES |
3822 | | FLAG_APME_IN_WUC, | 3860 | | FLAG_APME_IN_WUC, |
3823 | .flags2 = FLAG2_HAS_PHY_STATS, | 3861 | .flags2 = FLAG2_HAS_PHY_STATS |
3862 | | FLAG2_HAS_EEE, | ||
3824 | .pba = 18, | 3863 | .pba = 18, |
3825 | .max_hw_frame_size = DEFAULT_JUMBO, | 3864 | .max_hw_frame_size = DEFAULT_JUMBO, |
3826 | .get_variants = e1000_get_variants_ich8lan, | 3865 | .get_variants = e1000_get_variants_ich8lan, |
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c index a150e48a117f..a74846097afd 100644 --- a/drivers/net/e1000e/param.c +++ b/drivers/net/e1000e/param.c | |||
@@ -161,6 +161,15 @@ E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lea | |||
161 | E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs " \ | 161 | E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs " \ |
162 | "the CRC"); | 162 | "the CRC"); |
163 | 163 | ||
164 | /* | ||
165 | * Enable/disable EEE (a.k.a. IEEE802.3az) | ||
166 | * | ||
167 | * Valid Range: 0, 1 | ||
168 | * | ||
169 | * Default Value: 1 | ||
170 | */ | ||
171 | E1000_PARAM(EEE, "Enable/disable on parts that support the feature"); | ||
172 | |||
164 | struct e1000_option { | 173 | struct e1000_option { |
165 | enum { enable_option, range_option, list_option } type; | 174 | enum { enable_option, range_option, list_option } type; |
166 | const char *name; | 175 | const char *name; |
@@ -477,4 +486,23 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
477 | } | 486 | } |
478 | } | 487 | } |
479 | } | 488 | } |
489 | { /* EEE for parts supporting the feature */ | ||
490 | static const struct e1000_option opt = { | ||
491 | .type = enable_option, | ||
492 | .name = "EEE Support", | ||
493 | .err = "defaulting to Enabled", | ||
494 | .def = OPTION_ENABLED | ||
495 | }; | ||
496 | |||
497 | if (adapter->flags2 & FLAG2_HAS_EEE) { | ||
498 | /* Currently only supported on 82579 */ | ||
499 | if (num_EEE > bd) { | ||
500 | unsigned int eee = EEE[bd]; | ||
501 | e1000_validate_option(&eee, &opt, adapter); | ||
502 | hw->dev_spec.ich8lan.eee_disable = !eee; | ||
503 | } else { | ||
504 | hw->dev_spec.ich8lan.eee_disable = !opt.def; | ||
505 | } | ||
506 | } | ||
507 | } | ||
480 | } | 508 | } |