Skip to content

Commit efaaf34

Browse files
vlifshtsanguy11
authored andcommitted
e1000e: change k1 configuration on MTP and later platforms
Starting from Meteor Lake, the Kumeran interface between the integrated MAC and the I219 PHY works at a different frequency. This causes sporadic MDI errors when accessing the PHY, and in rare circumstances could lead to packet corruption. To overcome this, introduce minor changes to the Kumeran idle state (K1) parameters during device initialization. Hardware reset reverts this configuration, therefore it needs to be applied in a few places. Fixes: cc23f4f ("e1000e: Add support for Meteor Lake") Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com> Tested-by: Avigail Dahan <avigailx.dahan@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent d931cf9 commit efaaf34

File tree

3 files changed

+82
-5
lines changed

3 files changed

+82
-5
lines changed

drivers/net/ethernet/intel/e1000e/defines.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,4 +803,7 @@
803803
/* SerDes Control */
804804
#define E1000_GEN_POLL_TIMEOUT 640
805805

806+
#define E1000_FEXTNVM12_PHYPD_CTRL_MASK 0x00C00000
807+
#define E1000_FEXTNVM12_PHYPD_CTRL_P1 0x00800000
808+
806809
#endif /* _E1000_DEFINES_H_ */

drivers/net/ethernet/intel/e1000e/ich8lan.c

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,45 @@ static void e1000_toggle_lanphypc_pch_lpt(struct e1000_hw *hw)
285285
}
286286
}
287287

288+
/**
289+
* e1000_reconfigure_k1_exit_timeout - reconfigure K1 exit timeout to
290+
* align to MTP and later platform requirements.
291+
* @hw: pointer to the HW structure
292+
*
293+
* Context: PHY semaphore must be held by caller.
294+
* Return: 0 on success, negative on failure
295+
*/
296+
static s32 e1000_reconfigure_k1_exit_timeout(struct e1000_hw *hw)
297+
{
298+
u16 phy_timeout;
299+
u32 fextnvm12;
300+
s32 ret_val;
301+
302+
if (hw->mac.type < e1000_pch_mtp)
303+
return 0;
304+
305+
/* Change Kumeran K1 power down state from P0s to P1 */
306+
fextnvm12 = er32(FEXTNVM12);
307+
fextnvm12 &= ~E1000_FEXTNVM12_PHYPD_CTRL_MASK;
308+
fextnvm12 |= E1000_FEXTNVM12_PHYPD_CTRL_P1;
309+
ew32(FEXTNVM12, fextnvm12);
310+
311+
/* Wait for the interface the settle */
312+
usleep_range(1000, 1100);
313+
314+
/* Change K1 exit timeout */
315+
ret_val = e1e_rphy_locked(hw, I217_PHY_TIMEOUTS_REG,
316+
&phy_timeout);
317+
if (ret_val)
318+
return ret_val;
319+
320+
phy_timeout &= ~I217_PHY_TIMEOUTS_K1_EXIT_TO_MASK;
321+
phy_timeout |= 0xF00;
322+
323+
return e1e_wphy_locked(hw, I217_PHY_TIMEOUTS_REG,
324+
phy_timeout);
325+
}
326+
288327
/**
289328
* e1000_init_phy_workarounds_pchlan - PHY initialization workarounds
290329
* @hw: pointer to the HW structure
@@ -327,15 +366,22 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)
327366
* LANPHYPC Value bit to force the interconnect to PCIe mode.
328367
*/
329368
switch (hw->mac.type) {
369+
case e1000_pch_mtp:
370+
case e1000_pch_lnp:
371+
case e1000_pch_ptp:
372+
case e1000_pch_nvp:
373+
/* At this point the PHY might be inaccessible so don't
374+
* propagate the failure
375+
*/
376+
if (e1000_reconfigure_k1_exit_timeout(hw))
377+
e_dbg("Failed to reconfigure K1 exit timeout\n");
378+
379+
fallthrough;
330380
case e1000_pch_lpt:
331381
case e1000_pch_spt:
332382
case e1000_pch_cnp:
333383
case e1000_pch_tgp:
334384
case e1000_pch_adp:
335-
case e1000_pch_mtp:
336-
case e1000_pch_lnp:
337-
case e1000_pch_ptp:
338-
case e1000_pch_nvp:
339385
if (e1000_phy_is_accessible_pchlan(hw))
340386
break;
341387

@@ -419,8 +465,20 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw)
419465
* the PHY is in.
420466
*/
421467
ret_val = hw->phy.ops.check_reset_block(hw);
422-
if (ret_val)
468+
if (ret_val) {
423469
e_err("ME blocked access to PHY after reset\n");
470+
goto out;
471+
}
472+
473+
if (hw->mac.type >= e1000_pch_mtp) {
474+
ret_val = hw->phy.ops.acquire(hw);
475+
if (ret_val) {
476+
e_err("Failed to reconfigure K1 exit timeout\n");
477+
goto out;
478+
}
479+
ret_val = e1000_reconfigure_k1_exit_timeout(hw);
480+
hw->phy.ops.release(hw);
481+
}
424482
}
425483

426484
out:
@@ -4888,6 +4946,18 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw)
48884946
u16 i;
48894947

48904948
e1000_initialize_hw_bits_ich8lan(hw);
4949+
if (hw->mac.type >= e1000_pch_mtp) {
4950+
ret_val = hw->phy.ops.acquire(hw);
4951+
if (ret_val)
4952+
return ret_val;
4953+
4954+
ret_val = e1000_reconfigure_k1_exit_timeout(hw);
4955+
hw->phy.ops.release(hw);
4956+
if (ret_val) {
4957+
e_dbg("Error failed to reconfigure K1 exit timeout\n");
4958+
return ret_val;
4959+
}
4960+
}
48914961

48924962
/* Initialize identification LED */
48934963
ret_val = mac->ops.id_led_init(hw);

drivers/net/ethernet/intel/e1000e/ich8lan.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@
219219
#define I217_PLL_CLOCK_GATE_REG PHY_REG(772, 28)
220220
#define I217_PLL_CLOCK_GATE_MASK 0x07FF
221221

222+
/* PHY Timeouts */
223+
#define I217_PHY_TIMEOUTS_REG PHY_REG(770, 21)
224+
#define I217_PHY_TIMEOUTS_K1_EXIT_TO_MASK 0x0FC0
225+
222226
#define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in ms */
223227

224228
/* Inband Control */

0 commit comments

Comments
 (0)