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

e1000e: Fix HW Error on es2lan, ARP capture issue by BMC

Several components to this complex fix. The es2lan cards occasionally
gave a "HW Error" especially when forcing speed. Some users also
reported that the BMC stole ARP packets.

The fixes include setting the proper SW_FW bits to tell the BMC
that we're active and not do any un-initialization at all, so the
setup routine is largely changed.

Signed-off-by: David Graham <david.graham@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

authored by

David Graham and committed by
Jeff Garzik
2d9498f3 de5b3077

+137 -66
+1
drivers/net/e1000e/defines.h
··· 184 184 #define E1000_SWFW_EEP_SM 0x1 185 185 #define E1000_SWFW_PHY0_SM 0x2 186 186 #define E1000_SWFW_PHY1_SM 0x4 187 + #define E1000_SWFW_CSR_SM 0x8 187 188 188 189 /* Device Control */ 189 190 #define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */
+2
drivers/net/e1000e/e1000.h
··· 449 449 extern s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, 450 450 u32 usec_interval, bool *success); 451 451 extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw); 452 + extern s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data); 453 + extern s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); 452 454 extern s32 e1000e_check_downshift(struct e1000_hw *hw); 453 455 454 456 static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw)
+94 -33
drivers/net/e1000e/es2lan.c
··· 41 41 #define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 42 42 #define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02 43 43 #define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10 44 + #define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F 44 45 45 46 #define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008 46 47 #define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800 ··· 49 48 50 49 #define E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT 0x0004 51 50 #define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 51 + #define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 52 52 53 53 #define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */ 54 54 #define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 ··· 86 84 87 85 /* Kumeran Mode Control Register (Page 193, Register 16) */ 88 86 #define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800 87 + 88 + /* Max number of times Kumeran read/write should be validated */ 89 + #define GG82563_MAX_KMRN_RETRY 0x5 89 90 90 91 /* Power Management Control Register (Page 193, Register 20) */ 91 92 #define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001 ··· 275 270 u16 mask; 276 271 277 272 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; 273 + mask |= E1000_SWFW_CSR_SM; 278 274 279 275 return e1000_acquire_swfw_sync_80003es2lan(hw, mask); 280 276 } ··· 292 286 u16 mask; 293 287 294 288 mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; 289 + mask |= E1000_SWFW_CSR_SM; 290 + 295 291 e1000_release_swfw_sync_80003es2lan(hw, mask); 296 292 } 297 293 ··· 418 410 u32 page_select; 419 411 u16 temp; 420 412 413 + ret_val = e1000_acquire_phy_80003es2lan(hw); 414 + if (ret_val) 415 + return ret_val; 416 + 421 417 /* Select Configuration Page */ 422 - if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) 418 + if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) { 423 419 page_select = GG82563_PHY_PAGE_SELECT; 424 - else 420 + } else { 425 421 /* 426 422 * Use Alternative Page Select register to access 427 423 * registers 30 and 31 428 424 */ 429 425 page_select = GG82563_PHY_PAGE_SELECT_ALT; 426 + } 430 427 431 428 temp = (u16)((u16)offset >> GG82563_PAGE_SHIFT); 432 - ret_val = e1000e_write_phy_reg_m88(hw, page_select, temp); 433 - if (ret_val) 429 + ret_val = e1000e_write_phy_reg_mdic(hw, page_select, temp); 430 + if (ret_val) { 431 + e1000_release_phy_80003es2lan(hw); 434 432 return ret_val; 433 + } 435 434 436 435 /* 437 436 * The "ready" bit in the MDIC register may be incorrectly set ··· 448 433 udelay(200); 449 434 450 435 /* ...and verify the command was successful. */ 451 - ret_val = e1000e_read_phy_reg_m88(hw, page_select, &temp); 436 + ret_val = e1000e_read_phy_reg_mdic(hw, page_select, &temp); 452 437 453 438 if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) { 454 439 ret_val = -E1000_ERR_PHY; 440 + e1000_release_phy_80003es2lan(hw); 455 441 return ret_val; 456 442 } 457 443 458 444 udelay(200); 459 445 460 - ret_val = e1000e_read_phy_reg_m88(hw, 461 - MAX_PHY_REG_ADDRESS & offset, 462 - data); 446 + ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 447 + data); 463 448 464 449 udelay(200); 450 + e1000_release_phy_80003es2lan(hw); 465 451 466 452 return ret_val; 467 453 } ··· 483 467 u32 page_select; 484 468 u16 temp; 485 469 470 + ret_val = e1000_acquire_phy_80003es2lan(hw); 471 + if (ret_val) 472 + return ret_val; 473 + 486 474 /* Select Configuration Page */ 487 - if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) 475 + if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) { 488 476 page_select = GG82563_PHY_PAGE_SELECT; 489 - else 477 + } else { 490 478 /* 491 479 * Use Alternative Page Select register to access 492 480 * registers 30 and 31 493 481 */ 494 482 page_select = GG82563_PHY_PAGE_SELECT_ALT; 483 + } 495 484 496 485 temp = (u16)((u16)offset >> GG82563_PAGE_SHIFT); 497 - ret_val = e1000e_write_phy_reg_m88(hw, page_select, temp); 498 - if (ret_val) 486 + ret_val = e1000e_write_phy_reg_mdic(hw, page_select, temp); 487 + if (ret_val) { 488 + e1000_release_phy_80003es2lan(hw); 499 489 return ret_val; 490 + } 500 491 501 492 502 493 /* ··· 514 491 udelay(200); 515 492 516 493 /* ...and verify the command was successful. */ 517 - ret_val = e1000e_read_phy_reg_m88(hw, page_select, &temp); 494 + ret_val = e1000e_read_phy_reg_mdic(hw, page_select, &temp); 518 495 519 - if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) 496 + if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) { 497 + e1000_release_phy_80003es2lan(hw); 520 498 return -E1000_ERR_PHY; 499 + } 521 500 522 501 udelay(200); 523 502 524 - ret_val = e1000e_write_phy_reg_m88(hw, 525 - MAX_PHY_REG_ADDRESS & offset, 526 - data); 503 + ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 504 + data); 527 505 528 506 udelay(200); 507 + e1000_release_phy_80003es2lan(hw); 529 508 530 509 return ret_val; 531 510 } ··· 907 882 struct e1000_phy_info *phy = &hw->phy; 908 883 s32 ret_val; 909 884 u32 ctrl_ext; 910 - u16 data; 885 + u32 i = 0; 886 + u16 data, data2; 911 887 912 - ret_val = e1e_rphy(hw, GG82563_PHY_MAC_SPEC_CTRL, 913 - &data); 888 + ret_val = e1e_rphy(hw, GG82563_PHY_MAC_SPEC_CTRL, &data); 914 889 if (ret_val) 915 890 return ret_val; 916 891 ··· 918 893 /* Use 25MHz for both link down and 1000Base-T for Tx clock. */ 919 894 data |= GG82563_MSCR_TX_CLK_1000MBPS_25; 920 895 921 - ret_val = e1e_wphy(hw, GG82563_PHY_MAC_SPEC_CTRL, 922 - data); 896 + ret_val = e1e_wphy(hw, GG82563_PHY_MAC_SPEC_CTRL, data); 923 897 if (ret_val) 924 898 return ret_val; 925 899 ··· 978 954 if (ret_val) 979 955 return ret_val; 980 956 957 + ret_val = e1000e_read_kmrn_reg(hw, 958 + E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, 959 + &data); 960 + if (ret_val) 961 + return ret_val; 962 + data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE; 963 + ret_val = e1000e_write_kmrn_reg(hw, 964 + E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, 965 + data); 966 + if (ret_val) 967 + return ret_val; 968 + 981 969 ret_val = e1e_rphy(hw, GG82563_PHY_SPEC_CTRL_2, &data); 982 970 if (ret_val) 983 971 return ret_val; ··· 1019 983 if (ret_val) 1020 984 return ret_val; 1021 985 1022 - ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, &data); 1023 - if (ret_val) 1024 - return ret_val; 986 + do { 987 + ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 988 + &data); 989 + if (ret_val) 990 + return ret_val; 991 + 992 + ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 993 + &data2); 994 + if (ret_val) 995 + return ret_val; 996 + i++; 997 + } while ((data != data2) && (i < GG82563_MAX_KMRN_RETRY)); 1025 998 1026 999 data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; 1027 1000 ret_val = e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, data); ··· 1119 1074 { 1120 1075 s32 ret_val; 1121 1076 u32 tipg; 1122 - u16 reg_data; 1077 + u32 i = 0; 1078 + u16 reg_data, reg_data2; 1123 1079 1124 1080 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; 1125 1081 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, ··· 1134 1088 tipg |= DEFAULT_TIPG_IPGT_10_100_80003ES2LAN; 1135 1089 ew32(TIPG, tipg); 1136 1090 1137 - ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, &reg_data); 1138 - if (ret_val) 1139 - return ret_val; 1091 + do { 1092 + ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, &reg_data); 1093 + if (ret_val) 1094 + return ret_val; 1095 + 1096 + ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, &reg_data2); 1097 + if (ret_val) 1098 + return ret_val; 1099 + i++; 1100 + } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY)); 1140 1101 1141 1102 if (duplex == HALF_DUPLEX) 1142 1103 reg_data |= GG82563_KMCR_PASS_FALSE_CARRIER; ··· 1165 1112 static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw) 1166 1113 { 1167 1114 s32 ret_val; 1168 - u16 reg_data; 1115 + u16 reg_data, reg_data2; 1169 1116 u32 tipg; 1117 + u32 i = 0; 1170 1118 1171 1119 reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; 1172 1120 ret_val = e1000e_write_kmrn_reg(hw, E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, ··· 1181 1127 tipg |= DEFAULT_TIPG_IPGT_1000_80003ES2LAN; 1182 1128 ew32(TIPG, tipg); 1183 1129 1184 - ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, &reg_data); 1185 - if (ret_val) 1186 - return ret_val; 1130 + do { 1131 + ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, &reg_data); 1132 + if (ret_val) 1133 + return ret_val; 1134 + 1135 + ret_val = e1e_rphy(hw, GG82563_PHY_KMRN_MODE_CTRL, &reg_data2); 1136 + if (ret_val) 1137 + return ret_val; 1138 + i++; 1139 + } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY)); 1187 1140 1188 1141 reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; 1189 1142 ret_val = e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data);
+40 -33
drivers/net/e1000e/phy.c
··· 116 116 } 117 117 118 118 /** 119 - * e1000_read_phy_reg_mdic - Read MDI control register 119 + * e1000e_read_phy_reg_mdic - Read MDI control register 120 120 * @hw: pointer to the HW structure 121 121 * @offset: register offset to be read 122 122 * @data: pointer to the read data ··· 124 124 * Reads the MDI control register in the PHY at offset and stores the 125 125 * information read to data. 126 126 **/ 127 - static s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) 127 + s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data) 128 128 { 129 129 struct e1000_phy_info *phy = &hw->phy; 130 130 u32 i, mdic = 0; ··· 150 150 * Increasing the time out as testing showed failures with 151 151 * the lower time out 152 152 */ 153 - for (i = 0; i < 64; i++) { 153 + for (i = 0; i < (E1000_GEN_POLL_TIMEOUT * 3); i++) { 154 154 udelay(50); 155 155 mdic = er32(MDIC); 156 156 if (mdic & E1000_MDIC_READY) ··· 170 170 } 171 171 172 172 /** 173 - * e1000_write_phy_reg_mdic - Write MDI control register 173 + * e1000e_write_phy_reg_mdic - Write MDI control register 174 174 * @hw: pointer to the HW structure 175 175 * @offset: register offset to write to 176 176 * @data: data to write to register at offset 177 177 * 178 178 * Writes data to MDI control register in the PHY at offset. 179 179 **/ 180 - static s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) 180 + s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data) 181 181 { 182 182 struct e1000_phy_info *phy = &hw->phy; 183 183 u32 i, mdic = 0; ··· 199 199 200 200 ew32(MDIC, mdic); 201 201 202 - /* Poll the ready bit to see if the MDI read completed */ 203 - for (i = 0; i < E1000_GEN_POLL_TIMEOUT; i++) { 204 - udelay(5); 202 + /* 203 + * Poll the ready bit to see if the MDI read completed 204 + * Increasing the time out as testing showed failures with 205 + * the lower time out 206 + */ 207 + for (i = 0; i < (E1000_GEN_POLL_TIMEOUT * 3); i++) { 208 + udelay(50); 205 209 mdic = er32(MDIC); 206 210 if (mdic & E1000_MDIC_READY) 207 211 break; 208 212 } 209 213 if (!(mdic & E1000_MDIC_READY)) { 210 214 hw_dbg(hw, "MDI Write did not complete\n"); 215 + return -E1000_ERR_PHY; 216 + } 217 + if (mdic & E1000_MDIC_ERROR) { 218 + hw_dbg(hw, "MDI Error\n"); 211 219 return -E1000_ERR_PHY; 212 220 } 213 221 ··· 240 232 if (ret_val) 241 233 return ret_val; 242 234 243 - ret_val = e1000_read_phy_reg_mdic(hw, 244 - MAX_PHY_REG_ADDRESS & offset, 245 - data); 235 + ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 236 + data); 246 237 247 238 hw->phy.ops.release_phy(hw); 248 239 ··· 265 258 if (ret_val) 266 259 return ret_val; 267 260 268 - ret_val = e1000_write_phy_reg_mdic(hw, 269 - MAX_PHY_REG_ADDRESS & offset, 270 - data); 261 + ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 262 + data); 271 263 272 264 hw->phy.ops.release_phy(hw); 273 265 ··· 292 286 return ret_val; 293 287 294 288 if (offset > MAX_PHY_MULTI_PAGE_REG) { 295 - ret_val = e1000_write_phy_reg_mdic(hw, 296 - IGP01E1000_PHY_PAGE_SELECT, 297 - (u16)offset); 289 + ret_val = e1000e_write_phy_reg_mdic(hw, 290 + IGP01E1000_PHY_PAGE_SELECT, 291 + (u16)offset); 298 292 if (ret_val) { 299 293 hw->phy.ops.release_phy(hw); 300 294 return ret_val; 301 295 } 302 296 } 303 297 304 - ret_val = e1000_read_phy_reg_mdic(hw, 305 - MAX_PHY_REG_ADDRESS & offset, 306 - data); 298 + ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 299 + data); 307 300 308 301 hw->phy.ops.release_phy(hw); 309 302 ··· 327 322 return ret_val; 328 323 329 324 if (offset > MAX_PHY_MULTI_PAGE_REG) { 330 - ret_val = e1000_write_phy_reg_mdic(hw, 331 - IGP01E1000_PHY_PAGE_SELECT, 332 - (u16)offset); 325 + ret_val = e1000e_write_phy_reg_mdic(hw, 326 + IGP01E1000_PHY_PAGE_SELECT, 327 + (u16)offset); 333 328 if (ret_val) { 334 329 hw->phy.ops.release_phy(hw); 335 330 return ret_val; 336 331 } 337 332 } 338 333 339 - ret_val = e1000_write_phy_reg_mdic(hw, 340 - MAX_PHY_REG_ADDRESS & offset, 341 - data); 334 + ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, 335 + data); 342 336 343 337 hw->phy.ops.release_phy(hw); 344 338 ··· 424 420 if (ret_val) 425 421 return ret_val; 426 422 427 - phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; 423 + /* For newer PHYs this bit is downshift enable */ 424 + if (phy->type == e1000_phy_m88) 425 + phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; 428 426 429 427 /* 430 428 * Options: ··· 469 463 if (ret_val) 470 464 return ret_val; 471 465 472 - if (phy->revision < 4) { 466 + if ((phy->type == e1000_phy_m88) && (phy->revision < 4)) { 473 467 /* 474 468 * Force TX_CLK in the Extended PHY Specific Control Register 475 469 * to 25MHz clock. ··· 524 518 return ret_val; 525 519 } 526 520 527 - /* Wait 15ms for MAC to configure PHY from NVM settings. */ 528 - msleep(15); 521 + /* 522 + * Wait 100ms for MAC to configure PHY from NVM settings, to avoid 523 + * timeout issues when LFS is enabled. 524 + */ 525 + msleep(100); 529 526 530 527 /* disable lplu d0 during driver init */ 531 528 ret_val = e1000_set_d0_lplu_state(hw, 0); ··· 1161 1152 1162 1153 if (!active) { 1163 1154 data &= ~IGP02E1000_PM_D3_LPLU; 1164 - ret_val = e1e_wphy(hw, 1165 - IGP02E1000_PHY_POWER_MGMT, 1166 - data); 1155 + ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data); 1167 1156 if (ret_val) 1168 1157 return ret_val; 1169 1158 /*