[openwrt/openwrt] realtek: pcs: add helpers for even, odd, neighbor SerDes

LEDE Commits lede-commits at lists.infradead.org
Tue Dec 16 04:38:22 PST 2025


robimarko pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/01cfdb16103ae14e0525636ce4dfd062245cfb0b

commit 01cfdb16103ae14e0525636ce4dfd062245cfb0b
Author: Jonas Jelonek <jelonek.jonas at gmail.com>
AuthorDate: Sat Dec 13 10:16:21 2025 +0000

    realtek: pcs: add helpers for even, odd, neighbor SerDes
    
    Add dedicated helpers to get references to even, odd and neigbor SerDes
    if needed. This should replace the various calculations scattered
    throughout the code, providing a unified way to work with adjacent
    SerDes.
    
    Signed-off-by: Jonas Jelonek <jelonek.jonas at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/21146
    Signed-off-by: Robert Marko <robimarko at gmail.com>
    (cherry picked from commit 232c1fb14a072ee5c3c96ead43919ab5add526dd)
---
 .../files-6.12/drivers/net/pcs/pcs-rtl-otto.c       | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c
index 566e79962c..435a74af7c 100644
--- a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c
+++ b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c
@@ -239,6 +239,27 @@ static int rtpcs_sds_modify(struct rtpcs_ctrl *ctrl, int sds, int page, int regn
 				  mask, set);
 }
 
+__maybe_unused
+static struct rtpcs_serdes *rtpcs_sds_get_even(struct rtpcs_serdes *sds)
+{
+	u32 even_sds = sds->id & ~1;
+	return &sds->ctrl->serdes[even_sds];
+}
+
+__maybe_unused
+static struct rtpcs_serdes *rtpcs_sds_get_odd(struct rtpcs_serdes *sds)
+{
+	u32 odd_sds = sds->id | 1;
+	return &sds->ctrl->serdes[odd_sds];
+}
+
+__maybe_unused
+static struct rtpcs_serdes *rtpcs_sds_get_neighbor(struct rtpcs_serdes *sds)
+{
+	u32 nb_sds = sds->id ^ 1;
+	return &sds->ctrl->serdes[nb_sds];
+}
+
 static int rtpcs_regmap_read_bits(struct rtpcs_ctrl *ctrl, int base, int bithigh, int bitlow)
 {
 	int offset = base + (bitlow / 32) * 4;




More information about the lede-commits mailing list