mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2025-05-20 13:17:55 +00:00
Upstream e2015942e90a couldn't be backported to 6.6 because the following symbols were missing: - disable_work - disable_work_sync - enable_work Seee2015942e9
Upstream 34e5ededf4b8 couldn't be backported to 6.6 because the following symbol was missing: - pcim_iomap_region See34e5ededf4
Reorganize patch numbers now that < 6.12 patches are no longer needed. The following patches still differ from upstream: - e340bff27e63 phy_set_eee_broken symbol is missing in 6.12 https://github.com/torvalds/linux/commit/e340bff27e63 The following patches can't be backported to 6.12 due to missing symbols: - 5e7a74b6a357 phy_disable_eee_mode symbol is missing in 6.12 https://github.com/torvalds/linux/commit/5e7a74b6a357 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
109 lines
3.2 KiB
Diff
109 lines
3.2 KiB
Diff
From c507e96b5763b36b63ad50ad804341f72ea000e4 Mon Sep 17 00:00:00 2001
|
|
From: Heiner Kallweit <hkallweit1@gmail.com>
|
|
Date: Wed, 6 Nov 2024 17:55:45 +0100
|
|
Subject: [PATCH] r8169: improve __rtl8169_set_wol
|
|
|
|
Add helper r8169_mod_reg8_cond() what allows to significantly simplify
|
|
__rtl8169_set_wol().
|
|
|
|
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
|
Reviewed-by: Simon Horman <horms@kernel.org>
|
|
Link: https://patch.msgid.link/697b197a-8eac-40c6-8847-27093cacec36@gmail.com
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
drivers/net/ethernet/realtek/r8169_main.c | 55 ++++++++++-------------
|
|
1 file changed, 24 insertions(+), 31 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
|
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
|
@@ -747,6 +747,20 @@ static void rtl_mod_config5(struct rtl81
|
|
RTL_W8(tp, Config5, (val & ~clear) | set);
|
|
}
|
|
|
|
+static void r8169_mod_reg8_cond(struct rtl8169_private *tp, int reg,
|
|
+ u8 bits, bool cond)
|
|
+{
|
|
+ u8 val, old_val;
|
|
+
|
|
+ old_val = RTL_R8(tp, reg);
|
|
+ if (cond)
|
|
+ val = old_val | bits;
|
|
+ else
|
|
+ val = old_val & ~bits;
|
|
+ if (val != old_val)
|
|
+ RTL_W8(tp, reg, val);
|
|
+}
|
|
+
|
|
static bool rtl_is_8125(struct rtl8169_private *tp)
|
|
{
|
|
return tp->mac_version >= RTL_GIGA_MAC_VER_61;
|
|
@@ -1537,58 +1551,37 @@ static void rtl8169_get_wol(struct net_d
|
|
|
|
static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts)
|
|
{
|
|
- static const struct {
|
|
- u32 opt;
|
|
- u16 reg;
|
|
- u8 mask;
|
|
- } cfg[] = {
|
|
- { WAKE_PHY, Config3, LinkUp },
|
|
- { WAKE_UCAST, Config5, UWF },
|
|
- { WAKE_BCAST, Config5, BWF },
|
|
- { WAKE_MCAST, Config5, MWF },
|
|
- { WAKE_ANY, Config5, LanWake },
|
|
- { WAKE_MAGIC, Config3, MagicPacket }
|
|
- };
|
|
- unsigned int i, tmp = ARRAY_SIZE(cfg);
|
|
- u8 options;
|
|
-
|
|
rtl_unlock_config_regs(tp);
|
|
|
|
if (rtl_is_8168evl_up(tp)) {
|
|
- tmp--;
|
|
if (wolopts & WAKE_MAGIC)
|
|
rtl_eri_set_bits(tp, 0x0dc, MagicPacket_v2);
|
|
else
|
|
rtl_eri_clear_bits(tp, 0x0dc, MagicPacket_v2);
|
|
} else if (rtl_is_8125(tp)) {
|
|
- tmp--;
|
|
if (wolopts & WAKE_MAGIC)
|
|
r8168_mac_ocp_modify(tp, 0xc0b6, 0, BIT(0));
|
|
else
|
|
r8168_mac_ocp_modify(tp, 0xc0b6, BIT(0), 0);
|
|
+ } else {
|
|
+ r8169_mod_reg8_cond(tp, Config3, MagicPacket,
|
|
+ wolopts & WAKE_MAGIC);
|
|
}
|
|
|
|
- for (i = 0; i < tmp; i++) {
|
|
- options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask;
|
|
- if (wolopts & cfg[i].opt)
|
|
- options |= cfg[i].mask;
|
|
- RTL_W8(tp, cfg[i].reg, options);
|
|
- }
|
|
+ r8169_mod_reg8_cond(tp, Config3, LinkUp, wolopts & WAKE_PHY);
|
|
+ r8169_mod_reg8_cond(tp, Config5, UWF, wolopts & WAKE_UCAST);
|
|
+ r8169_mod_reg8_cond(tp, Config5, BWF, wolopts & WAKE_BCAST);
|
|
+ r8169_mod_reg8_cond(tp, Config5, MWF, wolopts & WAKE_MCAST);
|
|
+ r8169_mod_reg8_cond(tp, Config5, LanWake, wolopts);
|
|
|
|
switch (tp->mac_version) {
|
|
case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06:
|
|
- options = RTL_R8(tp, Config1) & ~PMEnable;
|
|
- if (wolopts)
|
|
- options |= PMEnable;
|
|
- RTL_W8(tp, Config1, options);
|
|
+ r8169_mod_reg8_cond(tp, Config1, PMEnable, wolopts);
|
|
break;
|
|
case RTL_GIGA_MAC_VER_34:
|
|
case RTL_GIGA_MAC_VER_37:
|
|
case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66:
|
|
- if (wolopts)
|
|
- rtl_mod_config2(tp, 0, PME_SIGNAL);
|
|
- else
|
|
- rtl_mod_config2(tp, PME_SIGNAL, 0);
|
|
+ r8169_mod_reg8_cond(tp, Config2, PME_SIGNAL, wolopts);
|
|
break;
|
|
default:
|
|
break;
|