* [PATCH v2 net-next] r8169: add rtl_disable_exit_l1()
@ 2022-01-28 20:41 Heiner Kallweit
2022-01-31 11:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2022-01-28 20:41 UTC (permalink / raw)
To: Jakub Kicinski, David Miller, Realtek linux nic maintainers
Cc: netdev@vger.kernel.org, Chun-Hao Lin
Add rtl_disable_exit_l1() for ensuring that the chip doesn't
inadvertently exit ASPM L1 when being in a low-power mode.
The new function is called from rtl_prepare_power_down() which
has to be moved in the code to avoid a forward declaration.
According to Realtek OCP register 0xc0ac shadows ERI register 0xd4
on RTL8168 versions from RTL8168g. This allows to simplify the
code a little.
v2:
- call rtl_disable_exit_l1() also if DASH or WoL are enabled
Suggested-by: Chun-Hao Lin <hau@realtek.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/ethernet/realtek/r8169_main.c | 65 +++++++++++++----------
1 file changed, 38 insertions(+), 27 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 3c3d1506b..126d7322d 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -2667,10 +2645,7 @@ static void rtl_enable_exit_l1(struct rtl8169_private *tp)
case RTL_GIGA_MAC_VER_37 ... RTL_GIGA_MAC_VER_38:
rtl_eri_set_bits(tp, 0xd4, 0x0c00);
break;
- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_53:
- rtl_eri_set_bits(tp, 0xd4, 0x1f80);
- break;
- case RTL_GIGA_MAC_VER_60 ... RTL_GIGA_MAC_VER_63:
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_63:
r8168_mac_ocp_modify(tp, 0xc0ac, 0, 0x1f80);
break;
default:
@@ -2678,6 +2653,20 @@ static void rtl_enable_exit_l1(struct rtl8169_private *tp)
}
}
+static void rtl_disable_exit_l1(struct rtl8169_private *tp)
+{
+ switch (tp->mac_version) {
+ case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_38:
+ rtl_eri_clear_bits(tp, 0xd4, 0x1f00);
+ break;
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_63:
+ r8168_mac_ocp_modify(tp, 0xc0ac, 0x1f80, 0);
+ break;
+ default:
+ break;
+ }
+}
+
static void rtl_hw_aspm_clkreq_enable(struct rtl8169_private *tp, bool enable)
{
/* Don't enable ASPM in the chip if OS can't control ASPM */
@@ -4702,7 +4713,7 @@ static void rtl8169_down(struct rtl8169_private *tp)
rtl_pci_commit(tp);
rtl8169_cleanup(tp, true);
-
+ rtl_disable_exit_l1(tp);
rtl_prepare_power_down(tp);
}
--
2.35.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 net-next] r8169: add rtl_disable_exit_l1()
2022-01-28 20:41 [PATCH v2 net-next] r8169: add rtl_disable_exit_l1() Heiner Kallweit
@ 2022-01-31 11:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-31 11:40 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: kuba, davem, nic_swsd, netdev, hau
Hello:
This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Fri, 28 Jan 2022 21:41:42 +0100 you wrote:
> Add rtl_disable_exit_l1() for ensuring that the chip doesn't
> inadvertently exit ASPM L1 when being in a low-power mode.
> The new function is called from rtl_prepare_power_down() which
> has to be moved in the code to avoid a forward declaration.
>
> According to Realtek OCP register 0xc0ac shadows ERI register 0xd4
> on RTL8168 versions from RTL8168g. This allows to simplify the
> code a little.
>
> [...]
Here is the summary with links:
- [v2,net-next] r8169: add rtl_disable_exit_l1()
https://git.kernel.org/netdev/net-next/c/d192181c2ccb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-31 11:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-28 20:41 [PATCH v2 net-next] r8169: add rtl_disable_exit_l1() Heiner Kallweit
2022-01-31 11:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).