aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c83
1 files changed, 50 insertions, 33 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 78d03d315421..af08188d7e62 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -185,6 +185,7 @@ static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw)
185 u32 phy_id = 0; 185 u32 phy_id = 0;
186 s32 ret_val; 186 s32 ret_val;
187 u16 retry_count; 187 u16 retry_count;
188 u32 mac_reg = 0;
188 189
189 for (retry_count = 0; retry_count < 2; retry_count++) { 190 for (retry_count = 0; retry_count < 2; retry_count++) {
190 ret_val = e1e_rphy_locked(hw, MII_PHYSID1, &phy_reg); 191 ret_val = e1e_rphy_locked(hw, MII_PHYSID1, &phy_reg);
@@ -203,11 +204,11 @@ static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw)
203 204
204 if (hw->phy.id) { 205 if (hw->phy.id) {
205 if (hw->phy.id == phy_id) 206 if (hw->phy.id == phy_id)
206 return true; 207 goto out;
207 } else if (phy_id) { 208 } else if (phy_id) {
208 hw->phy.id = phy_id; 209 hw->phy.id = phy_id;
209 hw->phy.revision = (u32)(phy_reg & ~PHY_REVISION_MASK); 210 hw->phy.revision = (u32)(phy_reg & ~PHY_REVISION_MASK);
210 return true; 211 goto out;
211 } 212 }
212 213
213 /* In case the PHY needs to be in mdio slow mode, 214 /* In case the PHY needs to be in mdio slow mode,
@@ -219,7 +220,22 @@ static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw)
219 ret_val = e1000e_get_phy_id(hw); 220 ret_val = e1000e_get_phy_id(hw);
220 hw->phy.ops.acquire(hw); 221 hw->phy.ops.acquire(hw);
221 222
222 return !ret_val; 223 if (ret_val)
224 return false;
225out:
226 if (hw->mac.type == e1000_pch_lpt) {
227 /* Unforce SMBus mode in PHY */
228 e1e_rphy_locked(hw, CV_SMB_CTRL, &phy_reg);
229 phy_reg &= ~CV_SMB_CTRL_FORCE_SMBUS;
230 e1e_wphy_locked(hw, CV_SMB_CTRL, phy_reg);
231
232 /* Unforce SMBus mode in MAC */
233 mac_reg = er32(CTRL_EXT);
234 mac_reg &= ~E1000_CTRL_EXT_FORCE_SMBUS;
235 ew32(CTRL_EXT, mac_reg);
236 }
237
238 return true;
223} 239}
224 240
225/** 241/**
@@ -233,7 +249,6 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)
233{ 249{
234 u32 mac_reg, fwsm = er32(FWSM); 250 u32 mac_reg, fwsm = er32(FWSM);
235 s32 ret_val; 251 s32 ret_val;
236 u16 phy_reg;
237 252
238 /* Gate automatic PHY configuration by hardware on managed and 253 /* Gate automatic PHY configuration by hardware on managed and
239 * non-managed 82579 and newer adapters. 254 * non-managed 82579 and newer adapters.
@@ -262,22 +277,16 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)
262 mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS; 277 mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS;
263 ew32(CTRL_EXT, mac_reg); 278 ew32(CTRL_EXT, mac_reg);
264 279
280 /* Wait 50 milliseconds for MAC to finish any retries
281 * that it might be trying to perform from previous
282 * attempts to acknowledge any phy read requests.
283 */
284 msleep(50);
285
265 /* fall-through */ 286 /* fall-through */
266 case e1000_pch2lan: 287 case e1000_pch2lan:
267 if (e1000_phy_is_accessible_pchlan(hw)) { 288 if (e1000_phy_is_accessible_pchlan(hw))
268 if (hw->mac.type == e1000_pch_lpt) {
269 /* Unforce SMBus mode in PHY */
270 e1e_rphy_locked(hw, CV_SMB_CTRL, &phy_reg);
271 phy_reg &= ~CV_SMB_CTRL_FORCE_SMBUS;
272 e1e_wphy_locked(hw, CV_SMB_CTRL, phy_reg);
273
274 /* Unforce SMBus mode in MAC */
275 mac_reg = er32(CTRL_EXT);
276 mac_reg &= ~E1000_CTRL_EXT_FORCE_SMBUS;
277 ew32(CTRL_EXT, mac_reg);
278 }
279 break; 289 break;
280 }
281 290
282 /* fall-through */ 291 /* fall-through */
283 case e1000_pchlan: 292 case e1000_pchlan:
@@ -287,6 +296,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)
287 296
288 if (hw->phy.ops.check_reset_block(hw)) { 297 if (hw->phy.ops.check_reset_block(hw)) {
289 e_dbg("Required LANPHYPC toggle blocked by ME\n"); 298 e_dbg("Required LANPHYPC toggle blocked by ME\n");
299 ret_val = -E1000_ERR_PHY;
290 break; 300 break;
291 } 301 }
292 302
@@ -298,15 +308,6 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)
298 mac_reg |= E1000_FEXTNVM3_PHY_CFG_COUNTER_50MSEC; 308 mac_reg |= E1000_FEXTNVM3_PHY_CFG_COUNTER_50MSEC;
299 ew32(FEXTNVM3, mac_reg); 309 ew32(FEXTNVM3, mac_reg);
300 310
301 if (hw->mac.type == e1000_pch_lpt) {
302 /* Toggling LANPHYPC brings the PHY out of SMBus mode
303 * So ensure that the MAC is also out of SMBus mode
304 */
305 mac_reg = er32(CTRL_EXT);
306 mac_reg &= ~E1000_CTRL_EXT_FORCE_SMBUS;
307 ew32(CTRL_EXT, mac_reg);
308 }
309
310 /* Toggle LANPHYPC Value bit */ 311 /* Toggle LANPHYPC Value bit */
311 mac_reg = er32(CTRL); 312 mac_reg = er32(CTRL);
312 mac_reg |= E1000_CTRL_LANPHYPC_OVERRIDE; 313 mac_reg |= E1000_CTRL_LANPHYPC_OVERRIDE;
@@ -325,6 +326,21 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)
325 usleep_range(5000, 10000); 326 usleep_range(5000, 10000);
326 } while (!(er32(CTRL_EXT) & 327 } while (!(er32(CTRL_EXT) &
327 E1000_CTRL_EXT_LPCD) && count--); 328 E1000_CTRL_EXT_LPCD) && count--);
329 usleep_range(30000, 60000);
330 if (e1000_phy_is_accessible_pchlan(hw))
331 break;
332
333 /* Toggling LANPHYPC brings the PHY out of SMBus mode
334 * so ensure that the MAC is also out of SMBus mode
335 */
336 mac_reg = er32(CTRL_EXT);
337 mac_reg &= ~E1000_CTRL_EXT_FORCE_SMBUS;
338 ew32(CTRL_EXT, mac_reg);
339
340 if (e1000_phy_is_accessible_pchlan(hw))
341 break;
342
343 ret_val = -E1000_ERR_PHY;
328 } 344 }
329 break; 345 break;
330 default: 346 default:
@@ -332,13 +348,14 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)
332 } 348 }
333 349
334 hw->phy.ops.release(hw); 350 hw->phy.ops.release(hw);
335 351 if (!ret_val) {
336 /* Reset the PHY before any access to it. Doing so, ensures 352 /* Reset the PHY before any access to it. Doing so, ensures
337 * that the PHY is in a known good state before we read/write 353 * that the PHY is in a known good state before we read/write
338 * PHY registers. The generic reset is sufficient here, 354 * PHY registers. The generic reset is sufficient here,
339 * because we haven't determined the PHY type yet. 355 * because we haven't determined the PHY type yet.
340 */ 356 */
341 ret_val = e1000e_phy_hw_reset_generic(hw); 357 ret_val = e1000e_phy_hw_reset_generic(hw);
358 }
342 359
343out: 360out:
344 /* Ungate automatic PHY configuration on non-managed 82579 */ 361 /* Ungate automatic PHY configuration on non-managed 82579 */