[openwrt/openwrt] realtek: pcs: rtl931x: map interface mode to hardware mode
LEDE Commits
lede-commits at lists.infradead.org
Tue Dec 23 09:56:41 PST 2025
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/d7a184e3b1fbb7b6c039bfd6ff88be7c581409cd
commit d7a184e3b1fbb7b6c039bfd6ff88be7c581409cd
Author: Jonas Jelonek <jelonek.jonas at gmail.com>
AuthorDate: Mon Dec 15 17:37:01 2025 +0000
realtek: pcs: rtl931x: map interface mode to hardware mode
The PCS driver is intended to use a dedicated hardware mode in the
future because the hardware capabilities and modes of the SerDes do not
align with the PHY_INTERFACE_MODE_* modes.
For the beginning, use the previously introduced generic mode mapping
in the SerDes setup and assign the determined hardware mode to the
corresponding field of a SerDes instance. This allows parallel usage of
both mode representations for the time being, until the phy_interface_t
modes can be dropped from internal functions completely.
Signed-off-by: Jonas Jelonek <jelonek.jonas at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21184
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
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 535bded4c3..381d205d0d 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
@@ -278,7 +278,6 @@ static struct rtpcs_link *rtpcs_phylink_pcs_to_link(struct phylink_pcs *pcs)
return container_of(pcs, struct rtpcs_link, pcs);
}
-__maybe_unused
static int rtpcs_sds_determine_hw_mode(struct rtpcs_serdes *sds,
phy_interface_t if_mode,
enum rtpcs_sds_mode *hw_mode)
@@ -2805,6 +2804,7 @@ static int rtpcs_931x_setup_serdes(struct rtpcs_serdes *sds,
struct rtpcs_serdes *even_sds = rtpcs_sds_get_even(sds);
struct rtpcs_ctrl *ctrl = sds->ctrl;
u32 band, ori, model_info, val;
+ enum rtpcs_sds_mode hw_mode;
u32 sds_id = sds->id;
int ret, chiptype = 0;
@@ -2854,6 +2854,13 @@ static int rtpcs_931x_setup_serdes(struct rtpcs_serdes *sds,
/* this was in rtl931x_phylink_mac_config in dsa/rtl83xx/dsa.c before */
band = rtpcs_931x_sds_cmu_band_get(sds, mode);
+ ret = rtpcs_sds_determine_hw_mode(sds, mode, &hw_mode);
+ if (ret < 0) {
+ dev_err(ctrl->dev, "SerDes %u doesn't support %s mode\n", sds_id,
+ phy_modes(mode));
+ return -ENOTSUPP;
+ }
+
ret = rtpcs_931x_sds_config_mode(sds, mode, chiptype);
if (ret < 0)
return ret;
@@ -2894,6 +2901,7 @@ static int rtpcs_931x_setup_serdes(struct rtpcs_serdes *sds,
else
rtpcs_931x_sds_fiber_mode_set(sds, mode);
}
+ sds->hw_mode = hw_mode;
return 0;
}
More information about the lede-commits
mailing list