]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.6/e1000e-move-force-smbus-from-enable-ulp-function-to-.patch
Fixes for 6.6
[thirdparty/kernel/stable-queue.git] / queue-6.6 / e1000e-move-force-smbus-from-enable-ulp-function-to-.patch
1 From a23984c241b41b956c1f8aacf0b3649e0caafe31 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Sun, 3 Mar 2024 12:51:32 +0200
4 Subject: e1000e: move force SMBUS from enable ulp function to avoid PHY loss
5 issue
6
7 From: Vitaly Lifshits <vitaly.lifshits@intel.com>
8
9 [ Upstream commit 861e8086029e003305750b4126ecd6617465f5c7 ]
10
11 Forcing SMBUS inside the ULP enabling flow leads to sporadic PHY loss on
12 some systems. It is suspected to be caused by initiating PHY transactions
13 before the interface settles.
14
15 Separating this configuration from the ULP enabling flow and moving it to
16 the shutdown function allows enough time for the interface to settle and
17 avoids adding a delay.
18
19 Fixes: 6607c99e7034 ("e1000e: i219 - fix to enable both ULP and EEE in Sx state")
20 Co-developed-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
21 Signed-off-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
22 Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
23 Tested-by: Naama Meir <naamax.meir@linux.intel.com>
24 Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
25 Signed-off-by: Sasha Levin <sashal@kernel.org>
26 ---
27 drivers/net/ethernet/intel/e1000e/ich8lan.c | 19 -------------------
28 drivers/net/ethernet/intel/e1000e/netdev.c | 18 ++++++++++++++++++
29 2 files changed, 18 insertions(+), 19 deletions(-)
30
31 diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
32 index 717c52913e84b..4d83c9a0c023a 100644
33 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
34 +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
35 @@ -1165,25 +1165,6 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx)
36 if (ret_val)
37 goto out;
38
39 - /* Switching PHY interface always returns MDI error
40 - * so disable retry mechanism to avoid wasting time
41 - */
42 - e1000e_disable_phy_retry(hw);
43 -
44 - /* Force SMBus mode in PHY */
45 - ret_val = e1000_read_phy_reg_hv_locked(hw, CV_SMB_CTRL, &phy_reg);
46 - if (ret_val)
47 - goto release;
48 - phy_reg |= CV_SMB_CTRL_FORCE_SMBUS;
49 - e1000_write_phy_reg_hv_locked(hw, CV_SMB_CTRL, phy_reg);
50 -
51 - e1000e_enable_phy_retry(hw);
52 -
53 - /* Force SMBus mode in MAC */
54 - mac_reg = er32(CTRL_EXT);
55 - mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS;
56 - ew32(CTRL_EXT, mac_reg);
57 -
58 /* Si workaround for ULP entry flow on i127/rev6 h/w. Enable
59 * LPLU and disable Gig speed when entering ULP
60 */
61 diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
62 index cc8c531ec3dff..3692fce201959 100644
63 --- a/drivers/net/ethernet/intel/e1000e/netdev.c
64 +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
65 @@ -6623,6 +6623,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
66 struct e1000_hw *hw = &adapter->hw;
67 u32 ctrl, ctrl_ext, rctl, status, wufc;
68 int retval = 0;
69 + u16 smb_ctrl;
70
71 /* Runtime suspend should only enable wakeup for link changes */
72 if (runtime)
73 @@ -6696,6 +6697,23 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
74 if (retval)
75 return retval;
76 }
77 +
78 + /* Force SMBUS to allow WOL */
79 + /* Switching PHY interface always returns MDI error
80 + * so disable retry mechanism to avoid wasting time
81 + */
82 + e1000e_disable_phy_retry(hw);
83 +
84 + e1e_rphy(hw, CV_SMB_CTRL, &smb_ctrl);
85 + smb_ctrl |= CV_SMB_CTRL_FORCE_SMBUS;
86 + e1e_wphy(hw, CV_SMB_CTRL, smb_ctrl);
87 +
88 + e1000e_enable_phy_retry(hw);
89 +
90 + /* Force SMBus mode in MAC */
91 + ctrl_ext = er32(CTRL_EXT);
92 + ctrl_ext |= E1000_CTRL_EXT_FORCE_SMBUS;
93 + ew32(CTRL_EXT, ctrl_ext);
94 }
95
96 /* Ensure that the appropriate bits are set in LPI_CTRL
97 --
98 2.43.0
99