Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

e1000e: initial support for i217

i217 is the next-generation LOM that will be available on systems with the
Lynx Point Platform Controller Hub (PCH) chipset from Intel. This patch
provides the initial support for the device.

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>

authored by

Bruce Allan and committed by
Jeff Kirsher
2fbe4526 d02c70a8

+398 -28
+8
drivers/net/ethernet/intel/e1000e/defines.h
··· 74 74 #define E1000_WUS_BC E1000_WUFC_BC 75 75 76 76 /* Extended Device Control */ 77 + #define E1000_CTRL_EXT_LPCD 0x00000004 /* LCD Power Cycle Done */ 77 78 #define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Definable Pin 3 */ 79 + #define E1000_CTRL_EXT_FORCE_SMBUS 0x00000004 /* Force SMBus mode*/ 78 80 #define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ 79 81 #define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */ 80 82 #define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ ··· 575 573 #define NWAY_AR_ASM_DIR 0x0800 /* Asymmetric Pause Direction bit */ 576 574 577 575 /* Link Partner Ability Register (Base Page) */ 576 + #define NWAY_LPAR_100TX_FD_CAPS 0x0100 /* LP 100TX Full Dplx Capable */ 578 577 #define NWAY_LPAR_PAUSE 0x0400 /* LP Pause operation desired */ 579 578 #define NWAY_LPAR_ASM_DIR 0x0800 /* LP Asymmetric Pause Direction bit */ 580 579 ··· 742 739 #define I82577_E_PHY_ID 0x01540050 743 740 #define I82578_E_PHY_ID 0x004DD040 744 741 #define I82579_E_PHY_ID 0x01540090 742 + #define I217_E_PHY_ID 0x015400A0 745 743 746 744 /* M88E1000 Specific Registers */ 747 745 #define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ ··· 853 849 854 850 /* SerDes Control */ 855 851 #define E1000_GEN_POLL_TIMEOUT 640 852 + 853 + /* FW Semaphore */ 854 + #define E1000_FWSM_WLOCK_MAC_MASK 0x0380 855 + #define E1000_FWSM_WLOCK_MAC_SHIFT 7 856 856 857 857 #endif /* _E1000_DEFINES_H_ */
+2
drivers/net/ethernet/intel/e1000e/e1000.h
··· 206 206 board_ich10lan, 207 207 board_pchlan, 208 208 board_pch2lan, 209 + board_pch_lpt, 209 210 }; 210 211 211 212 struct e1000_ps_page { ··· 529 528 extern const struct e1000_info e1000_ich10_info; 530 529 extern const struct e1000_info e1000_pch_info; 531 530 extern const struct e1000_info e1000_pch2_info; 531 + extern const struct e1000_info e1000_pch_lpt_info; 532 532 extern const struct e1000_info e1000_es2_info; 533 533 534 534 extern s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num,
+15 -2
drivers/net/ethernet/intel/e1000e/ethtool.c
··· 773 773 u32 i; 774 774 u32 toggle; 775 775 u32 mask; 776 + u32 wlock_mac = 0; 776 777 777 778 /* 778 779 * The status register is Read Only, so a write should fail. ··· 839 838 case e1000_ich10lan: 840 839 case e1000_pchlan: 841 840 case e1000_pch2lan: 841 + case e1000_pch_lpt: 842 842 mask |= (1 << 18); 843 843 break; 844 844 default: 845 845 break; 846 846 } 847 - for (i = 0; i < mac->rar_entry_count; i++) 847 + 848 + if (mac->type == e1000_pch_lpt) 849 + wlock_mac = (er32(FWSM) & E1000_FWSM_WLOCK_MAC_MASK) >> 850 + E1000_FWSM_WLOCK_MAC_SHIFT; 851 + 852 + for (i = 0; i < mac->rar_entry_count; i++) { 853 + /* Cannot test write-protected SHRAL[n] registers */ 854 + if ((wlock_mac == 1) || (wlock_mac && (i > wlock_mac))) 855 + continue; 856 + 848 857 REG_PATTERN_TEST_ARRAY(E1000_RA, ((i << 1) + 1), 849 - mask, 0xFFFFFFFF); 858 + mask, 0xFFFFFFFF); 859 + } 850 860 851 861 for (i = 0; i < mac->mta_reg_count; i++) 852 862 REG_PATTERN_TEST_ARRAY(E1000_MTA, i, 0xFFFFFFFF, 0xFFFFFFFF); 853 863 854 864 *data = 0; 865 + 855 866 return 0; 856 867 } 857 868
+9
drivers/net/ethernet/intel/e1000e/hw.h
··· 200 200 #define E1000_RA (E1000_RAL(0)) 201 201 E1000_RAH_BASE = 0x05404, /* Receive Address High - RW */ 202 202 #define E1000_RAH(_n) (E1000_RAH_BASE + ((_n) * 8)) 203 + E1000_SHRAL_PCH_LPT_BASE = 0x05408, 204 + #define E1000_SHRAL_PCH_LPT(_n) (E1000_SHRAL_PCH_LPT_BASE + ((_n) * 8)) 205 + E1000_SHRAH_PCH_LTP_BASE = 0x0540C, 206 + #define E1000_SHRAH_PCH_LPT(_n) (E1000_SHRAH_PCH_LTP_BASE + ((_n) * 8)) 203 207 E1000_SHRAL_BASE = 0x05438, /* Shared Receive Address Low - RW */ 204 208 #define E1000_SHRAL(_n) (E1000_SHRAL_BASE + ((_n) * 8)) 205 209 E1000_SHRAH_BASE = 0x0543C, /* Shared Receive Address High - RW */ ··· 410 406 #define E1000_DEV_ID_PCH_D_HV_DC 0x10F0 411 407 #define E1000_DEV_ID_PCH2_LV_LM 0x1502 412 408 #define E1000_DEV_ID_PCH2_LV_V 0x1503 409 + #define E1000_DEV_ID_PCH_LPT_I217_LM 0x153A 410 + #define E1000_DEV_ID_PCH_LPT_I217_V 0x153B 413 411 414 412 #define E1000_REVISION_4 4 415 413 ··· 432 426 e1000_ich10lan, 433 427 e1000_pchlan, 434 428 e1000_pch2lan, 429 + e1000_pch_lpt, 435 430 }; 436 431 437 432 enum e1000_media_type { ··· 470 463 e1000_phy_82578, 471 464 e1000_phy_82577, 472 465 e1000_phy_82579, 466 + e1000_phy_i217, 473 467 }; 474 468 475 469 enum e1000_bus_width { ··· 979 971 struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS]; 980 972 bool nvm_k1_enabled; 981 973 bool eee_disable; 974 + u16 eee_lp_ability; 982 975 }; 983 976 984 977 struct e1000_hw {
+350 -20
drivers/net/ethernet/intel/e1000e/ich8lan.c
··· 116 116 117 117 #define E1000_ICH_RAR_ENTRIES 7 118 118 #define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */ 119 + #define E1000_PCH_LPT_RAR_ENTRIES 12 /* RAR[0], SHRA[0-10] */ 119 120 120 121 #define PHY_PAGE_SHIFT 5 121 122 #define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \ ··· 132 131 133 132 #define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in milliseconds */ 134 133 134 + /* SMBus Control Phy Register */ 135 + #define CV_SMB_CTRL PHY_REG(769, 23) 136 + #define CV_SMB_CTRL_FORCE_SMBUS 0x0001 137 + 135 138 /* SMBus Address Phy Register */ 136 139 #define HV_SMB_ADDR PHY_REG(768, 26) 137 140 #define HV_SMB_ADDR_MASK 0x007F 138 141 #define HV_SMB_ADDR_PEC_EN 0x0200 139 142 #define HV_SMB_ADDR_VALID 0x0080 143 + #define HV_SMB_ADDR_FREQ_MASK 0x1100 144 + #define HV_SMB_ADDR_FREQ_LOW_SHIFT 8 145 + #define HV_SMB_ADDR_FREQ_HIGH_SHIFT 12 140 146 141 147 /* PHY Power Management Control */ 142 148 #define HV_PM_CTRL PHY_REG(770, 17) ··· 160 152 #define I82579_LPI_UPDATE_TIMER 0x4805 /* in 40ns units + 40 ns base value */ 161 153 #define I82579_MSE_THRESHOLD 0x084F /* Mean Square Error Threshold */ 162 154 #define I82579_MSE_LINK_DOWN 0x2411 /* MSE count before dropping link */ 155 + #define I217_EEE_ADVERTISEMENT 0x8001 /* IEEE MMD Register 7.60 */ 156 + #define I217_EEE_LP_ABILITY 0x8002 /* IEEE MMD Register 7.61 */ 157 + #define I217_EEE_100_SUPPORTED (1 << 1) /* 100BaseTx EEE supported */ 158 + 159 + /* Intel Rapid Start Technology Support */ 160 + #define I217_PROXY_CTRL PHY_REG(BM_WUC_PAGE, 70) 161 + #define I217_PROXY_CTRL_AUTO_DISABLE 0x0080 162 + #define I217_SxCTRL PHY_REG(BM_PORT_CTRL_PAGE, 28) 163 + #define I217_SxCTRL_MASK 0x1000 164 + #define I217_CGFREG PHY_REG(772, 29) 165 + #define I217_CGFREG_MASK 0x0002 166 + #define I217_MEMPWR PHY_REG(772, 26) 167 + #define I217_MEMPWR_MASK 0x0010 163 168 164 169 /* Strapping Option Register - RO */ 165 170 #define E1000_STRAP 0x0000C 166 171 #define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000 167 172 #define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17 173 + #define E1000_STRAP_SMT_FREQ_MASK 0x00003000 174 + #define E1000_STRAP_SMT_FREQ_SHIFT 12 168 175 169 176 /* OEM Bits Phy Register */ 170 177 #define HV_OEM_BITS PHY_REG(768, 25) ··· 284 261 static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw); 285 262 static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw); 286 263 static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index); 264 + static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index); 287 265 static s32 e1000_k1_workaround_lv(struct e1000_hw *hw); 288 266 static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate); 289 267 ··· 356 332 { 357 333 u32 mac_reg, fwsm = er32(FWSM); 358 334 s32 ret_val; 335 + u16 phy_reg; 359 336 360 337 ret_val = hw->phy.ops.acquire(hw); 361 338 if (ret_val) { ··· 370 345 * LANPHYPC Value bit to force the interconnect to PCIe mode. 371 346 */ 372 347 switch (hw->mac.type) { 348 + case e1000_pch_lpt: 349 + if (e1000_phy_is_accessible_pchlan(hw)) 350 + break; 351 + 352 + /* 353 + * Before toggling LANPHYPC, see if PHY is accessible by 354 + * forcing MAC to SMBus mode first. 355 + */ 356 + mac_reg = er32(CTRL_EXT); 357 + mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS; 358 + ew32(CTRL_EXT, mac_reg); 359 + 360 + /* fall-through */ 373 361 case e1000_pch2lan: 374 362 /* 375 363 * Gate automatic PHY configuration by hardware on 376 364 * non-managed 82579 377 365 */ 378 - if (!(fwsm & E1000_ICH_FWSM_FW_VALID)) 366 + if ((hw->mac.type == e1000_pch2lan) && 367 + !(fwsm & E1000_ICH_FWSM_FW_VALID)) 379 368 e1000_gate_hw_phy_config_ich8lan(hw, true); 380 369 381 - if (e1000_phy_is_accessible_pchlan(hw)) 370 + if (e1000_phy_is_accessible_pchlan(hw)) { 371 + if (hw->mac.type == e1000_pch_lpt) { 372 + /* Unforce SMBus mode in PHY */ 373 + e1e_rphy_locked(hw, CV_SMB_CTRL, &phy_reg); 374 + phy_reg &= ~CV_SMB_CTRL_FORCE_SMBUS; 375 + e1e_wphy_locked(hw, CV_SMB_CTRL, phy_reg); 376 + 377 + /* Unforce SMBus mode in MAC */ 378 + mac_reg = er32(CTRL_EXT); 379 + mac_reg &= ~E1000_CTRL_EXT_FORCE_SMBUS; 380 + ew32(CTRL_EXT, mac_reg); 381 + } 382 382 break; 383 + } 383 384 384 385 /* fall-through */ 385 386 case e1000_pchlan: ··· 436 385 mac_reg &= ~E1000_CTRL_LANPHYPC_OVERRIDE; 437 386 ew32(CTRL, mac_reg); 438 387 e1e_flush(); 439 - msleep(50); 388 + if (hw->mac.type < e1000_pch_lpt) { 389 + msleep(50); 390 + } else { 391 + u16 count = 20; 392 + do { 393 + usleep_range(5000, 10000); 394 + } while (!(er32(CTRL_EXT) & 395 + E1000_CTRL_EXT_LPCD) && count--); 396 + } 440 397 break; 441 398 default: 442 399 break; ··· 513 454 break; 514 455 /* fall-through */ 515 456 case e1000_pch2lan: 457 + case e1000_pch_lpt: 516 458 /* 517 459 * In case the PHY needs to be in mdio slow mode, 518 460 * set slow mode and try to get the PHY id again. ··· 531 471 switch (phy->type) { 532 472 case e1000_phy_82577: 533 473 case e1000_phy_82579: 474 + case e1000_phy_i217: 534 475 phy->ops.check_polarity = e1000_check_polarity_82577; 535 476 phy->ops.force_speed_duplex = 536 477 e1000_phy_force_speed_duplex_82577; ··· 716 655 /* Adaptive IFS supported */ 717 656 mac->adaptive_ifs = true; 718 657 719 - /* LED operations */ 658 + /* LED and other operations */ 720 659 switch (mac->type) { 721 660 case e1000_ich8lan: 722 661 case e1000_ich9lan: ··· 739 678 mac->rar_entry_count = E1000_PCH2_RAR_ENTRIES; 740 679 mac->ops.rar_set = e1000_rar_set_pch2lan; 741 680 /* fall-through */ 681 + case e1000_pch_lpt: 742 682 case e1000_pchlan: 743 683 /* check management mode */ 744 684 mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan; ··· 757 695 break; 758 696 } 759 697 698 + if (mac->type == e1000_pch_lpt) { 699 + mac->rar_entry_count = E1000_PCH_LPT_RAR_ENTRIES; 700 + mac->ops.rar_set = e1000_rar_set_pch_lpt; 701 + } 702 + 760 703 /* Enable PCS Lock-loss workaround for ICH8 */ 761 704 if (mac->type == e1000_ich8lan) 762 705 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true); 763 706 764 - /* Gate automatic PHY configuration by hardware on managed 82579 */ 765 - if ((mac->type == e1000_pch2lan) && 707 + /* 708 + * Gate automatic PHY configuration by hardware on managed 709 + * 82579 and i217 710 + */ 711 + if ((mac->type == e1000_pch2lan || mac->type == e1000_pch_lpt) && 766 712 (er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) 767 713 e1000_gate_hw_phy_config_ich8lan(hw, true); 768 714 ··· 786 716 **/ 787 717 static s32 e1000_set_eee_pchlan(struct e1000_hw *hw) 788 718 { 719 + struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; 789 720 s32 ret_val = 0; 790 721 u16 phy_reg; 791 722 792 - if (hw->phy.type != e1000_phy_82579) 723 + if ((hw->phy.type != e1000_phy_82579) && 724 + (hw->phy.type != e1000_phy_i217)) 793 725 return 0; 794 726 795 727 ret_val = e1e_rphy(hw, I82579_LPI_CTRL, &phy_reg); 796 728 if (ret_val) 797 729 return ret_val; 798 730 799 - if (hw->dev_spec.ich8lan.eee_disable) 731 + if (dev_spec->eee_disable) 800 732 phy_reg &= ~I82579_LPI_CTRL_ENABLE_MASK; 801 733 else 802 734 phy_reg |= I82579_LPI_CTRL_ENABLE_MASK; 803 735 804 - return e1e_wphy(hw, I82579_LPI_CTRL, phy_reg); 736 + ret_val = e1e_wphy(hw, I82579_LPI_CTRL, phy_reg); 737 + if (ret_val) 738 + return ret_val; 739 + 740 + if ((hw->phy.type == e1000_phy_i217) && !dev_spec->eee_disable) { 741 + /* Save off link partner's EEE ability */ 742 + ret_val = hw->phy.ops.acquire(hw); 743 + if (ret_val) 744 + return ret_val; 745 + ret_val = e1e_wphy_locked(hw, I82579_EMI_ADDR, 746 + I217_EEE_LP_ABILITY); 747 + if (ret_val) 748 + goto release; 749 + e1e_rphy_locked(hw, I82579_EMI_DATA, &dev_spec->eee_lp_ability); 750 + 751 + /* 752 + * EEE is not supported in 100Half, so ignore partner's EEE 753 + * in 100 ability if full-duplex is not advertised. 754 + */ 755 + e1e_rphy_locked(hw, PHY_LP_ABILITY, &phy_reg); 756 + if (!(phy_reg & NWAY_LPAR_100TX_FD_CAPS)) 757 + dev_spec->eee_lp_ability &= ~I217_EEE_100_SUPPORTED; 758 + release: 759 + hw->phy.ops.release(hw); 760 + } 761 + 762 + return 0; 805 763 } 806 764 807 765 /** ··· 870 772 if (ret_val) 871 773 return ret_val; 872 774 } 775 + 776 + /* Clear link partner's EEE ability */ 777 + hw->dev_spec.ich8lan.eee_lp_ability = 0; 873 778 874 779 if (!link) 875 780 return 0; /* No link detected */ ··· 969 868 break; 970 869 case e1000_pchlan: 971 870 case e1000_pch2lan: 871 + case e1000_pch_lpt: 972 872 rc = e1000_init_phy_params_pchlan(hw); 973 873 break; 974 874 default: ··· 1219 1117 } 1220 1118 1221 1119 /** 1120 + * e1000_rar_set_pch_lpt - Set receive address registers 1121 + * @hw: pointer to the HW structure 1122 + * @addr: pointer to the receive address 1123 + * @index: receive address array register 1124 + * 1125 + * Sets the receive address register array at index to the address passed 1126 + * in by addr. For LPT, RAR[0] is the base address register that is to 1127 + * contain the MAC address. SHRA[0-10] are the shared receive address 1128 + * registers that are shared between the Host and manageability engine (ME). 1129 + **/ 1130 + static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index) 1131 + { 1132 + u32 rar_low, rar_high; 1133 + u32 wlock_mac; 1134 + 1135 + /* 1136 + * HW expects these in little endian so we reverse the byte order 1137 + * from network order (big endian) to little endian 1138 + */ 1139 + rar_low = ((u32)addr[0] | ((u32)addr[1] << 8) | 1140 + ((u32)addr[2] << 16) | ((u32)addr[3] << 24)); 1141 + 1142 + rar_high = ((u32)addr[4] | ((u32)addr[5] << 8)); 1143 + 1144 + /* If MAC address zero, no need to set the AV bit */ 1145 + if (rar_low || rar_high) 1146 + rar_high |= E1000_RAH_AV; 1147 + 1148 + if (index == 0) { 1149 + ew32(RAL(index), rar_low); 1150 + e1e_flush(); 1151 + ew32(RAH(index), rar_high); 1152 + e1e_flush(); 1153 + return; 1154 + } 1155 + 1156 + /* 1157 + * The manageability engine (ME) can lock certain SHRAR registers that 1158 + * it is using - those registers are unavailable for use. 1159 + */ 1160 + if (index < hw->mac.rar_entry_count) { 1161 + wlock_mac = er32(FWSM) & E1000_FWSM_WLOCK_MAC_MASK; 1162 + wlock_mac >>= E1000_FWSM_WLOCK_MAC_SHIFT; 1163 + 1164 + /* Check if all SHRAR registers are locked */ 1165 + if (wlock_mac == 1) 1166 + goto out; 1167 + 1168 + if ((wlock_mac == 0) || (index <= wlock_mac)) { 1169 + s32 ret_val; 1170 + 1171 + ret_val = e1000_acquire_swflag_ich8lan(hw); 1172 + 1173 + if (ret_val) 1174 + goto out; 1175 + 1176 + ew32(SHRAL_PCH_LPT(index - 1), rar_low); 1177 + e1e_flush(); 1178 + ew32(SHRAH_PCH_LPT(index - 1), rar_high); 1179 + e1e_flush(); 1180 + 1181 + e1000_release_swflag_ich8lan(hw); 1182 + 1183 + /* verify the register updates */ 1184 + if ((er32(SHRAL_PCH_LPT(index - 1)) == rar_low) && 1185 + (er32(SHRAH_PCH_LPT(index - 1)) == rar_high)) 1186 + return; 1187 + } 1188 + } 1189 + 1190 + out: 1191 + e_dbg("Failed to write receive address at index %d\n", index); 1192 + } 1193 + 1194 + /** 1222 1195 * e1000_check_reset_block_ich8lan - Check if PHY reset is blocked 1223 1196 * @hw: pointer to the HW structure 1224 1197 * ··· 1321 1144 { 1322 1145 u16 phy_data; 1323 1146 u32 strap = er32(STRAP); 1147 + u32 freq = (strap & E1000_STRAP_SMT_FREQ_MASK) >> 1148 + E1000_STRAP_SMT_FREQ_SHIFT; 1324 1149 s32 ret_val = 0; 1325 1150 1326 1151 strap &= E1000_STRAP_SMBUS_ADDRESS_MASK; ··· 1334 1155 phy_data &= ~HV_SMB_ADDR_MASK; 1335 1156 phy_data |= (strap >> E1000_STRAP_SMBUS_ADDRESS_SHIFT); 1336 1157 phy_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID; 1158 + 1159 + if (hw->phy.type == e1000_phy_i217) { 1160 + /* Restore SMBus frequency */ 1161 + if (freq--) { 1162 + phy_data &= ~HV_SMB_ADDR_FREQ_MASK; 1163 + phy_data |= (freq & (1 << 0)) << 1164 + HV_SMB_ADDR_FREQ_LOW_SHIFT; 1165 + phy_data |= (freq & (1 << 1)) << 1166 + (HV_SMB_ADDR_FREQ_HIGH_SHIFT - 1); 1167 + } else { 1168 + e_dbg("Unsupported SMB frequency in PHY\n"); 1169 + } 1170 + } 1337 1171 1338 1172 return e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR, phy_data); 1339 1173 } ··· 1385 1193 /* Fall-thru */ 1386 1194 case e1000_pchlan: 1387 1195 case e1000_pch2lan: 1196 + case e1000_pch_lpt: 1388 1197 sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; 1389 1198 break; 1390 1199 default: ··· 1405 1212 * extended configuration before SW configuration 1406 1213 */ 1407 1214 data = er32(EXTCNF_CTRL); 1408 - if (!(hw->mac.type == e1000_pch2lan)) { 1409 - if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) 1410 - goto release; 1411 - } 1215 + if ((hw->mac.type < e1000_pch2lan) && 1216 + (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE)) 1217 + goto release; 1412 1218 1413 1219 cnf_size = er32(EXTCNF_SIZE); 1414 1220 cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK; ··· 1418 1226 cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; 1419 1227 cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; 1420 1228 1421 - if ((!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) && 1422 - (hw->mac.type == e1000_pchlan)) || 1423 - (hw->mac.type == e1000_pch2lan)) { 1229 + if (((hw->mac.type == e1000_pchlan) && 1230 + !(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE)) || 1231 + (hw->mac.type > e1000_pchlan)) { 1424 1232 /* 1425 1233 * HW configures the SMBus address and LEDs when the 1426 1234 * OEM and LCD Write Enable bits are set in the NVM. ··· 1617 1425 u32 mac_reg; 1618 1426 u16 oem_reg; 1619 1427 1620 - if ((hw->mac.type != e1000_pch2lan) && (hw->mac.type != e1000_pchlan)) 1428 + if (hw->mac.type < e1000_pchlan) 1621 1429 return ret_val; 1622 1430 1623 1431 ret_val = hw->phy.ops.acquire(hw); 1624 1432 if (ret_val) 1625 1433 return ret_val; 1626 1434 1627 - if (!(hw->mac.type == e1000_pch2lan)) { 1435 + if (hw->mac.type == e1000_pchlan) { 1628 1436 mac_reg = er32(EXTCNF_CTRL); 1629 1437 if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) 1630 1438 goto release; ··· 1821 1629 u32 mac_reg; 1822 1630 u16 i; 1823 1631 1824 - if (hw->mac.type != e1000_pch2lan) 1632 + if (hw->mac.type < e1000_pch2lan) 1825 1633 return 0; 1826 1634 1827 1635 /* disable Rx path while enabling/disabling workaround */ ··· 2078 1886 { 2079 1887 u32 extcnf_ctrl; 2080 1888 2081 - if (hw->mac.type != e1000_pch2lan) 1889 + if (hw->mac.type < e1000_pch2lan) 2082 1890 return; 2083 1891 2084 1892 extcnf_ctrl = er32(EXTCNF_CTRL); ··· 3717 3525 ew32(FCTTV, hw->fc.pause_time); 3718 3526 if ((hw->phy.type == e1000_phy_82578) || 3719 3527 (hw->phy.type == e1000_phy_82579) || 3528 + (hw->phy.type == e1000_phy_i217) || 3720 3529 (hw->phy.type == e1000_phy_82577)) { 3721 3530 ew32(FCRTV_PCH, hw->fc.refresh_time); 3722 3531 ··· 3781 3588 break; 3782 3589 case e1000_phy_82577: 3783 3590 case e1000_phy_82579: 3591 + case e1000_phy_i217: 3784 3592 ret_val = e1000_copper_link_setup_82577(hw); 3785 3593 if (ret_val) 3786 3594 return ret_val; ··· 4028 3834 * the LPLU setting in the NVM or custom setting. For PCH and newer parts, 4029 3835 * the OEM bits PHY register (LED, GbE disable and LPLU configurations) also 4030 3836 * needs to be written. 3837 + * Parts that support (and are linked to a partner which support) EEE in 3838 + * 100Mbps should disable LPLU since 100Mbps w/ EEE requires less power 3839 + * than 10Mbps w/o EEE. 4031 3840 **/ 4032 3841 void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw) 4033 3842 { 3843 + struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; 4034 3844 u32 phy_ctrl; 4035 3845 s32 ret_val; 4036 3846 4037 3847 phy_ctrl = er32(PHY_CTRL); 4038 3848 phy_ctrl |= E1000_PHY_CTRL_GBE_DISABLE; 3849 + if (hw->phy.type == e1000_phy_i217) { 3850 + u16 phy_reg; 3851 + 3852 + ret_val = hw->phy.ops.acquire(hw); 3853 + if (ret_val) 3854 + goto out; 3855 + 3856 + if (!dev_spec->eee_disable) { 3857 + u16 eee_advert; 3858 + 3859 + ret_val = e1e_wphy_locked(hw, I82579_EMI_ADDR, 3860 + I217_EEE_ADVERTISEMENT); 3861 + if (ret_val) 3862 + goto release; 3863 + e1e_rphy_locked(hw, I82579_EMI_DATA, &eee_advert); 3864 + 3865 + /* 3866 + * Disable LPLU if both link partners support 100BaseT 3867 + * EEE and 100Full is advertised on both ends of the 3868 + * link. 3869 + */ 3870 + if ((eee_advert & I217_EEE_100_SUPPORTED) && 3871 + (dev_spec->eee_lp_ability & 3872 + I217_EEE_100_SUPPORTED) && 3873 + (hw->phy.autoneg_advertised & ADVERTISE_100_FULL)) 3874 + phy_ctrl &= ~(E1000_PHY_CTRL_D0A_LPLU | 3875 + E1000_PHY_CTRL_NOND0A_LPLU); 3876 + } 3877 + 3878 + /* 3879 + * For i217 Intel Rapid Start Technology support, 3880 + * when the system is going into Sx and no manageability engine 3881 + * is present, the driver must configure proxy to reset only on 3882 + * power good. LPI (Low Power Idle) state must also reset only 3883 + * on power good, as well as the MTA (Multicast table array). 3884 + * The SMBus release must also be disabled on LCD reset. 3885 + */ 3886 + if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { 3887 + 3888 + /* Enable proxy to reset only on power good. */ 3889 + e1e_rphy_locked(hw, I217_PROXY_CTRL, &phy_reg); 3890 + phy_reg |= I217_PROXY_CTRL_AUTO_DISABLE; 3891 + e1e_wphy_locked(hw, I217_PROXY_CTRL, phy_reg); 3892 + 3893 + /* 3894 + * Set bit enable LPI (EEE) to reset only on 3895 + * power good. 3896 + */ 3897 + e1e_rphy_locked(hw, I217_SxCTRL, &phy_reg); 3898 + phy_reg |= I217_SxCTRL_MASK; 3899 + e1e_wphy_locked(hw, I217_SxCTRL, phy_reg); 3900 + 3901 + /* Disable the SMB release on LCD reset. */ 3902 + e1e_rphy_locked(hw, I217_MEMPWR, &phy_reg); 3903 + phy_reg &= ~I217_MEMPWR; 3904 + e1e_wphy_locked(hw, I217_MEMPWR, phy_reg); 3905 + } 3906 + 3907 + /* 3908 + * Enable MTA to reset for Intel Rapid Start Technology 3909 + * Support 3910 + */ 3911 + e1e_rphy_locked(hw, I217_CGFREG, &phy_reg); 3912 + phy_reg |= I217_CGFREG_MASK; 3913 + e1e_wphy_locked(hw, I217_CGFREG, phy_reg); 3914 + 3915 + release: 3916 + hw->phy.ops.release(hw); 3917 + } 3918 + out: 4039 3919 ew32(PHY_CTRL, phy_ctrl); 4040 3920 4041 3921 if (hw->mac.type == e1000_ich8lan) ··· 4138 3870 * on which PHY resets are not blocked, if the PHY registers cannot be 4139 3871 * accessed properly by the s/w toggle the LANPHYPC value to power cycle 4140 3872 * the PHY. 3873 + * On i217, setup Intel Rapid Start Technology. 4141 3874 **/ 4142 3875 void e1000_resume_workarounds_pchlan(struct e1000_hw *hw) 4143 3876 { ··· 4151 3882 if (ret_val) { 4152 3883 e_dbg("Failed to init PHY flow ret_val=%d\n", ret_val); 4153 3884 return; 3885 + } 3886 + 3887 + /* 3888 + * For i217 Intel Rapid Start Technology support when the system 3889 + * is transitioning from Sx and no manageability engine is present 3890 + * configure SMBus to restore on reset, disable proxy, and enable 3891 + * the reset on MTA (Multicast table array). 3892 + */ 3893 + if (hw->phy.type == e1000_phy_i217) { 3894 + u16 phy_reg; 3895 + 3896 + ret_val = hw->phy.ops.acquire(hw); 3897 + if (ret_val) { 3898 + e_dbg("Failed to setup iRST\n"); 3899 + return; 3900 + } 3901 + 3902 + if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { 3903 + /* 3904 + * Restore clear on SMB if no manageability engine 3905 + * is present 3906 + */ 3907 + ret_val = e1e_rphy_locked(hw, I217_MEMPWR, &phy_reg); 3908 + if (ret_val) 3909 + goto release; 3910 + phy_reg |= I217_MEMPWR_MASK; 3911 + e1e_wphy_locked(hw, I217_MEMPWR, phy_reg); 3912 + 3913 + /* Disable Proxy */ 3914 + e1e_wphy_locked(hw, I217_PROXY_CTRL, 0); 3915 + } 3916 + /* Enable reset on MTA */ 3917 + ret_val = e1e_rphy_locked(hw, I217_CGFREG, &phy_reg); 3918 + if (ret_val) 3919 + goto release; 3920 + phy_reg &= ~I217_CGFREG_MASK; 3921 + e1e_wphy_locked(hw, I217_CGFREG, phy_reg); 3922 + release: 3923 + if (ret_val) 3924 + e_dbg("Error %d in resume workarounds\n", ret_val); 3925 + hw->phy.ops.release(hw); 4154 3926 } 4155 3927 } 4156 3928 ··· 4433 4123 /* Clear PHY statistics registers */ 4434 4124 if ((hw->phy.type == e1000_phy_82578) || 4435 4125 (hw->phy.type == e1000_phy_82579) || 4126 + (hw->phy.type == e1000_phy_i217) || 4436 4127 (hw->phy.type == e1000_phy_82577)) { 4437 4128 ret_val = hw->phy.ops.acquire(hw); 4438 4129 if (ret_val) ··· 4577 4266 4578 4267 const struct e1000_info e1000_pch2_info = { 4579 4268 .mac = e1000_pch2lan, 4269 + .flags = FLAG_IS_ICH 4270 + | FLAG_HAS_WOL 4271 + | FLAG_HAS_CTRLEXT_ON_LOAD 4272 + | FLAG_HAS_AMT 4273 + | FLAG_HAS_FLASH 4274 + | FLAG_HAS_JUMBO_FRAMES 4275 + | FLAG_APME_IN_WUC, 4276 + .flags2 = FLAG2_HAS_PHY_STATS 4277 + | FLAG2_HAS_EEE, 4278 + .pba = 26, 4279 + .max_hw_frame_size = DEFAULT_JUMBO, 4280 + .get_variants = e1000_get_variants_ich8lan, 4281 + .mac_ops = &ich8_mac_ops, 4282 + .phy_ops = &ich8_phy_ops, 4283 + .nvm_ops = &ich8_nvm_ops, 4284 + }; 4285 + 4286 + const struct e1000_info e1000_pch_lpt_info = { 4287 + .mac = e1000_pch_lpt, 4580 4288 .flags = FLAG_IS_ICH 4581 4289 | FLAG_HAS_WOL 4582 4290 | FLAG_HAS_CTRLEXT_ON_LOAD
+11 -6
drivers/net/ethernet/intel/e1000e/netdev.c
··· 79 79 [board_ich10lan] = &e1000_ich10_info, 80 80 [board_pchlan] = &e1000_pch_info, 81 81 [board_pch2lan] = &e1000_pch2_info, 82 + [board_pch_lpt] = &e1000_pch_lpt_info, 82 83 }; 83 84 84 85 struct e1000_reg_info { ··· 2864 2863 u32 rctl, rfctl; 2865 2864 u32 pages = 0; 2866 2865 2867 - /* Workaround Si errata on 82579 - configure jumbo frame flow */ 2868 - if (hw->mac.type == e1000_pch2lan) { 2866 + /* Workaround Si errata on PCHx - configure jumbo frame flow */ 2867 + if (hw->mac.type >= e1000_pch2lan) { 2869 2868 s32 ret_val; 2870 2869 2871 2870 if (adapter->netdev->mtu > ETH_DATA_LEN) ··· 3488 3487 fc->refresh_time = 0x1000; 3489 3488 break; 3490 3489 case e1000_pch2lan: 3490 + case e1000_pch_lpt: 3491 3491 fc->high_water = 0x05C20; 3492 3492 fc->low_water = 0x05048; 3493 3493 fc->pause_time = 0x0650; ··· 5266 5264 return -EINVAL; 5267 5265 } 5268 5266 5269 - /* Jumbo frame workaround on 82579 requires CRC be stripped */ 5270 - if ((adapter->hw.mac.type == e1000_pch2lan) && 5267 + /* Jumbo frame workaround on 82579 and newer requires CRC be stripped */ 5268 + if ((adapter->hw.mac.type >= e1000_pch2lan) && 5271 5269 !(adapter->flags2 & FLAG2_CRC_STRIPPING) && 5272 5270 (new_mtu > ETH_DATA_LEN)) { 5273 - e_err("Jumbo Frames not supported on 82579 when CRC stripping is disabled.\n"); 5271 + e_err("Jumbo Frames not supported on this device when CRC stripping is disabled.\n"); 5274 5272 return -EINVAL; 5275 5273 } 5276 5274 ··· 5667 5665 return err; 5668 5666 } 5669 5667 5670 - if (hw->mac.type == e1000_pch2lan) 5668 + if (hw->mac.type >= e1000_pch2lan) 5671 5669 e1000_resume_workarounds_pchlan(&adapter->hw); 5672 5670 5673 5671 e1000e_power_up_phy(adapter); ··· 6565 6563 6566 6564 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH2_LV_LM), board_pch2lan }, 6567 6565 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH2_LV_V), board_pch2lan }, 6566 + 6567 + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LPT_I217_LM), board_pch_lpt }, 6568 + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LPT_I217_V), board_pch_lpt }, 6568 6569 6569 6570 { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */ 6570 6571 };
+3
drivers/net/ethernet/intel/e1000e/phy.c
··· 2335 2335 case I82579_E_PHY_ID: 2336 2336 phy_type = e1000_phy_82579; 2337 2337 break; 2338 + case I217_E_PHY_ID: 2339 + phy_type = e1000_phy_i217; 2340 + break; 2338 2341 default: 2339 2342 phy_type = e1000_phy_unknown; 2340 2343 break;