* [PATCH net-next] r8169: facilitate adding new chip versions
@ 2020-12-15 16:15 Heiner Kallweit
2020-12-17 0:50 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2020-12-15 16:15 UTC (permalink / raw)
To: Jakub Kicinski, David Miller, Realtek linux nic maintainers; +Cc: netdev
Add a constant RTL_GIGA_MAC_MAX and use it if all new chip versions
handle a feature in a specific way. As result we have to touch less
places when adding support for a new chip version.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/ethernet/realtek/r8169.h | 3 ++-
drivers/net/ethernet/realtek/r8169_main.c | 14 +++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169.h b/drivers/net/ethernet/realtek/r8169.h
index 7be86ef5a..4a924920e 100644
--- a/drivers/net/ethernet/realtek/r8169.h
+++ b/drivers/net/ethernet/realtek/r8169.h
@@ -66,7 +66,8 @@ enum mac_version {
RTL_GIGA_MAC_VER_60,
RTL_GIGA_MAC_VER_61,
RTL_GIGA_MAC_VER_63,
- RTL_GIGA_MAC_NONE
+ RTL_GIGA_MAC_MAX,
+ RTL_GIGA_MAC_NONE = RTL_GIGA_MAC_MAX
};
struct rtl8169_private;
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 46d8510b2..01087d3c0 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -962,7 +962,7 @@ static void rtl_writephy(struct rtl8169_private *tp, int location, int val)
case RTL_GIGA_MAC_VER_31:
r8168dp_2_mdio_write(tp, location, val);
break;
- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_63:
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_MAX:
r8168g_mdio_write(tp, location, val);
break;
default:
@@ -979,7 +979,7 @@ static int rtl_readphy(struct rtl8169_private *tp, int location)
case RTL_GIGA_MAC_VER_28:
case RTL_GIGA_MAC_VER_31:
return r8168dp_2_mdio_read(tp, location);
- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_63:
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_MAX:
return r8168g_mdio_read(tp, location);
default:
return r8169_mdio_read(tp, location);
@@ -1383,7 +1383,7 @@ static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts)
break;
case RTL_GIGA_MAC_VER_34:
case RTL_GIGA_MAC_VER_37:
- case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_63:
+ case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_MAX:
options = RTL_R8(tp, Config2) & ~PME_SIGNAL;
if (wolopts)
options |= PME_SIGNAL;
@@ -2182,7 +2182,7 @@ static void rtl_wol_suspend_quirk(struct rtl8169_private *tp)
case RTL_GIGA_MAC_VER_32:
case RTL_GIGA_MAC_VER_33:
case RTL_GIGA_MAC_VER_34:
- case RTL_GIGA_MAC_VER_37 ... RTL_GIGA_MAC_VER_63:
+ case RTL_GIGA_MAC_VER_37 ... RTL_GIGA_MAC_MAX:
RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) |
AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
break;
@@ -2216,7 +2216,7 @@ static void rtl_pll_power_down(struct rtl8169_private *tp)
case RTL_GIGA_MAC_VER_46:
case RTL_GIGA_MAC_VER_47:
case RTL_GIGA_MAC_VER_48:
- case RTL_GIGA_MAC_VER_50 ... RTL_GIGA_MAC_VER_63:
+ case RTL_GIGA_MAC_VER_50 ... RTL_GIGA_MAC_MAX:
RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~0x80);
break;
case RTL_GIGA_MAC_VER_40:
@@ -2244,7 +2244,7 @@ static void rtl_pll_power_up(struct rtl8169_private *tp)
case RTL_GIGA_MAC_VER_46:
case RTL_GIGA_MAC_VER_47:
case RTL_GIGA_MAC_VER_48:
- case RTL_GIGA_MAC_VER_50 ... RTL_GIGA_MAC_VER_63:
+ case RTL_GIGA_MAC_VER_50 ... RTL_GIGA_MAC_MAX:
RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) | 0xc0);
break;
case RTL_GIGA_MAC_VER_40:
@@ -3950,7 +3950,7 @@ static void rtl8169_cleanup(struct rtl8169_private *tp, bool going_down)
RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq);
rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666);
break;
- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_63:
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_MAX:
rtl_enable_rxdvgate(tp);
fsleep(2000);
break;
--
2.29.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] r8169: facilitate adding new chip versions
2020-12-15 16:15 [PATCH net-next] r8169: facilitate adding new chip versions Heiner Kallweit
@ 2020-12-17 0:50 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-12-17 0:50 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: David Miller, Realtek linux nic maintainers, netdev
On Tue, 15 Dec 2020 17:15:05 +0100 Heiner Kallweit wrote:
> Add a constant RTL_GIGA_MAC_MAX and use it if all new chip versions
> handle a feature in a specific way. As result we have to touch less
> places when adding support for a new chip version.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Looks harmless, but also non-urgent so let's wait for net-next to open.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-17 0:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 16:15 [PATCH net-next] r8169: facilitate adding new chip versions Heiner Kallweit
2020-12-17 0:50 ` Jakub Kicinski
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).