From c2f129599e9376638451d3ba89ec861f668534f8 Mon Sep 17 00:00:00 2001 From: Jonas Jelonek Date: Wed, 22 Apr 2026 13:44:06 +0000 Subject: [PATCH] realtek: pcs: introduce per-variant SerDes activate helpers Mirror of the previous sds_deactivate commit: add rtpcs_{838x,931x}_sds_activate() helpers that each wrap the variant-specific "bring the SerDes back to operational" block-power call at the end of setup_serdes, and replace the inline call. - 838x: wraps rtpcs_838x_sds_power(sds, true) - 931x: wraps rtpcs_931x_sds_power(sds, true) RTL839x and RTL930x are intentionally not given an activate helper in this commit: - RTL839x calls rtpcs_839x_sds_reset() at the end of setup_serdes. That is a reset pulse whose internals (per-type 10G/5G analog sequences, internal REG3 0x7146 -> 0x7106 dance) are not yet fully characterized. Aliasing it as _activate would misrepresent the function. - RTL930x has no separate activation step: rtpcs_930x_sds_set_mode(sds, hw_mode) is what commits the new mode and is intended to be surfaced as its own "set mode" phase in a later commit rather than hidden inside a variant-specific _activate wrapper. Both variants will be revisited when their respective phases are clarified. This commit is a pure refactor, no behavioural change. Link: https://github.com/openwrt/openwrt/pull/23513 Signed-off-by: Jonas Jelonek --- .../files-6.18/drivers/net/pcs/pcs-rtl-otto.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c b/target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c index d1850001a6..b19be93d2a 100644 --- a/target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c +++ b/target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c @@ -826,6 +826,11 @@ static int rtpcs_838x_sds_deactivate(struct rtpcs_serdes *sds) return rtpcs_838x_sds_power(sds, false); } +static int rtpcs_838x_sds_activate(struct rtpcs_serdes *sds) +{ + return rtpcs_838x_sds_power(sds, true); +} + /* * RTL838X wrapper: after setting the MAC mode, SerDes 4-5 also need the * companion INT_MODE_CTRL field written. @@ -953,7 +958,7 @@ static int rtpcs_838x_setup_serdes(struct rtpcs_serdes *sds, /* release reset */ rtpcs_sds_write(sds, 0, 3, 0x7106); - rtpcs_838x_sds_power(sds, true); + rtpcs_838x_sds_activate(sds); /* * Run a switch queue reset after the first start of a SerDes. This recovers ports that @@ -3258,6 +3263,11 @@ static int rtpcs_931x_sds_deactivate(struct rtpcs_serdes *sds) return rtpcs_931x_sds_set_mode(sds, RTPCS_SDS_MODE_OFF); } +static int rtpcs_931x_sds_activate(struct rtpcs_serdes *sds) +{ + return rtpcs_931x_sds_power(sds, true); +} + static void rtpcs_931x_sds_reset(struct rtpcs_serdes *sds) { u32 o_mode, f_bit; @@ -3832,7 +3842,7 @@ static int rtpcs_931x_setup_serdes(struct rtpcs_serdes *sds, return ret; } - rtpcs_931x_sds_power(sds, true); + rtpcs_931x_sds_activate(sds); ret = rtpcs_931x_sds_set_mode(sds, hw_mode); if (ret < 0)