[openwrt/openwrt] realtek: pcs: rtl930x: use SerDes hw mode in setup entry
LEDE Commits
lede-commits at lists.infradead.org
Sun Jan 18 02:19:12 PST 2026
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/4406f96e3b9d854616ccc2b7040a78c79f62ec8d
commit 4406f96e3b9d854616ccc2b7040a78c79f62ec8d
Author: Jonas Jelonek <jelonek.jonas at gmail.com>
AuthorDate: Thu Jan 8 12:21:47 2026 +0000
realtek: pcs: rtl930x: use SerDes hw mode in setup entry
Start using the SerDes hardware in the RTL930x SerDes setup entrypoint.
Use the generic mapper (which will be moved out later to pcs_config) to
determine the mode. In the next steps, switch to solely using that
step-by-step.
Signed-off-by: Jonas Jelonek <jelonek.jonas at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21565
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
.../files-6.12/drivers/net/pcs/pcs-rtl-otto.c | 31 +++++++++++++---------
1 file changed, 18 insertions(+), 13 deletions(-)
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 281bcb94b1..f82a04ef24 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
@@ -2524,17 +2524,22 @@ static int rtpcs_930x_sds_cmu_band_get(struct rtpcs_serdes *sds)
}
static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
- phy_interface_t phy_mode)
+ phy_interface_t if_mode)
{
- int calib_tries = 0;
+ enum rtpcs_sds_mode hw_mode;
+ int calib_tries = 0, ret;
+
+ ret = rtpcs_sds_determine_hw_mode(sds, if_mode, &hw_mode);
+ if (ret < 0)
+ return -ENOTSUPP;
/* Rely on setup from U-boot for some modes, e.g. USXGMII */
- switch (phy_mode) {
- case PHY_INTERFACE_MODE_1000BASEX:
- case PHY_INTERFACE_MODE_SGMII:
- case PHY_INTERFACE_MODE_2500BASEX:
- case PHY_INTERFACE_MODE_10GBASER:
- case PHY_INTERFACE_MODE_10G_QXGMII:
+ switch (hw_mode) {
+ case RTPCS_SDS_MODE_1000BASEX:
+ case RTPCS_SDS_MODE_SGMII:
+ case RTPCS_SDS_MODE_2500BASEX:
+ case RTPCS_SDS_MODE_10GBASER:
+ case RTPCS_SDS_MODE_USXGMII_10GQXGMII:
break;
default:
return 0;
@@ -2544,7 +2549,7 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
rtpcs_930x_sds_set(sds, RTL930X_SDS_OFF);
/* Apply serdes patches */
- rtpcs_930x_sds_patch(sds, phy_mode);
+ rtpcs_930x_sds_patch(sds, if_mode);
/* Maybe use dal_longan_sds_init */
@@ -2558,7 +2563,7 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
rtpcs_930x_sds_set_polarity(sds, sds->tx_pol_inv, sds->rx_pol_inv);
/* Enable SDS in desired mode */
- rtpcs_930x_sds_mode_set(sds, phy_mode);
+ rtpcs_930x_sds_mode_set(sds, if_mode);
/* Enable Fiber RX */
rtpcs_sds_write_bits(sds, 0x20, 2, 12, 12, 0);
@@ -2566,15 +2571,15 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
/* Calibrate SerDes receiver in loopback mode */
rtpcs_930x_sds_10g_idle(sds);
do {
- rtpcs_930x_sds_do_rx_calibration(sds, phy_mode);
+ rtpcs_930x_sds_do_rx_calibration(sds, if_mode);
calib_tries++;
mdelay(50);
- } while (rtpcs_930x_sds_check_calibration(sds, phy_mode) && calib_tries < 3);
+ } while (rtpcs_930x_sds_check_calibration(sds, if_mode) && calib_tries < 3);
if (calib_tries >= 3)
pr_warn("%s: SerDes RX calibration failed\n", __func__);
/* Leave loopback mode */
- rtpcs_930x_sds_tx_config(sds, phy_mode);
+ rtpcs_930x_sds_tx_config(sds, if_mode);
return 0;
}
More information about the lede-commits
mailing list