|
52 | 52 | (ID_LED_DEF1_DEF2)) |
53 | 53 |
|
54 | 54 | #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 |
| 55 | +#define E1000_BASE1000T_STATUS 10 |
| 56 | +#define E1000_IDLE_ERROR_COUNT_MASK 0xFF |
| 57 | +#define E1000_RECEIVE_ERROR_COUNTER 21 |
| 58 | +#define E1000_RECEIVE_ERROR_MAX 0xFFFF |
55 | 59 |
|
56 | 60 | #define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */ |
57 | 61 |
|
@@ -1242,6 +1246,39 @@ static s32 e1000_led_on_82574(struct e1000_hw *hw) |
1242 | 1246 | return 0; |
1243 | 1247 | } |
1244 | 1248 |
|
| 1249 | +/** |
| 1250 | + * e1000_check_phy_82574 - check 82574 phy hung state |
| 1251 | + * @hw: pointer to the HW structure |
| 1252 | + * |
| 1253 | + * Returns whether phy is hung or not |
| 1254 | + **/ |
| 1255 | +bool e1000_check_phy_82574(struct e1000_hw *hw) |
| 1256 | +{ |
| 1257 | + u16 status_1kbt = 0; |
| 1258 | + u16 receive_errors = 0; |
| 1259 | + bool phy_hung = false; |
| 1260 | + s32 ret_val = 0; |
| 1261 | + |
| 1262 | + /* |
| 1263 | + * Read PHY Receive Error counter first, if its is max - all F's then |
| 1264 | + * read the Base1000T status register If both are max then PHY is hung. |
| 1265 | + */ |
| 1266 | + ret_val = e1e_rphy(hw, E1000_RECEIVE_ERROR_COUNTER, &receive_errors); |
| 1267 | + |
| 1268 | + if (ret_val) |
| 1269 | + goto out; |
| 1270 | + if (receive_errors == E1000_RECEIVE_ERROR_MAX) { |
| 1271 | + ret_val = e1e_rphy(hw, E1000_BASE1000T_STATUS, &status_1kbt); |
| 1272 | + if (ret_val) |
| 1273 | + goto out; |
| 1274 | + if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) == |
| 1275 | + E1000_IDLE_ERROR_COUNT_MASK) |
| 1276 | + phy_hung = true; |
| 1277 | + } |
| 1278 | +out: |
| 1279 | + return phy_hung; |
| 1280 | +} |
| 1281 | + |
1245 | 1282 | /** |
1246 | 1283 | * e1000_setup_link_82571 - Setup flow control and link settings |
1247 | 1284 | * @hw: pointer to the HW structure |
@@ -1859,6 +1896,7 @@ struct e1000_info e1000_82574_info = { |
1859 | 1896 | | FLAG_HAS_SMART_POWER_DOWN |
1860 | 1897 | | FLAG_HAS_AMT |
1861 | 1898 | | FLAG_HAS_CTRLEXT_ON_LOAD, |
| 1899 | + .flags2 = FLAG2_CHECK_PHY_HANG, |
1862 | 1900 | .pba = 36, |
1863 | 1901 | .max_hw_frame_size = DEFAULT_JUMBO, |
1864 | 1902 | .get_variants = e1000_get_variants_82571, |
|
0 commit comments