diff options
| author | Jonas Jelonek | 2025-12-20 23:53:20 +0000 |
|---|---|---|
| committer | Robert Marko | 2025-12-29 16:06:19 +0000 |
| commit | a0805af66c6aa6106ff04ffdd6b190623fd80a7e (patch) | |
| tree | d292a678d74d1ff6d51f91347914a84e70e4f1ee | |
| parent | 9efcc52a7bf61a3728ffb87f54c03ca1e8840c66 (diff) | |
| download | openwrt-a0805af66c6aa6106ff04ffdd6b190623fd80a7e.tar.gz | |
realtek: pcs: rtl931x: fix SerDes mode application
The SerDes mode setting at the end of rtpcs_931x_setup_serdes is
currently broken although it is mostly similar to what the SDK does [1].
It prevents several modes from being set, especially fiber modes. This
seems to be one (if not the only) issue for currently missing SFP
support.
Add a small helper function which takes cares of setting the mode, to
keep the still valid different procedure when using XSGMII mode. Only
this helper is called in rtpcs_931x_setup_serdes to keep it clean there.
As a functional change, call mode application in every case, not just
for SGMII, QSGMII and USXGMII. We can assume the SDK is misleading in
this case, either accidentially or on purpose. This makes SFP modules
work in theory. In practice, there still seem to be device-specific
issues which need to be fixed later. These issues may include no link
detection or link flapping.
[1] https://github.com/plappermaul/realtek-doc/blob/f7f85ffc14c6e575ad94f2b427106de533b888fe/sources/rtk-dms1250/src/dal/mango/dal_mango_construct.c#L2266
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/20736
Signed-off-by: Robert Marko <robimarko@gmail.com>
| -rw-r--r-- | target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c | 20 |
1 files changed, 10 insertions, 10 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 a28b01d59f..e00e19b1f3 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 @@ -2476,6 +2476,15 @@ static int rtpcs_931x_sds_set_ip_mode(struct rtpcs_serdes *sds, return rtpcs_sds_write_bits(sds, 0x1f, 0x9, 11, 6, mode_val); } +static int rtpcs_931x_sds_set_mode(struct rtpcs_serdes *sds, + enum rtpcs_sds_mode hw_mode) +{ + if (hw_mode == RTPCS_SDS_MODE_XSGMII) + return rtpcs_931x_sds_set_mac_mode(sds, hw_mode); + else + return rtpcs_931x_sds_set_ip_mode(sds, hw_mode); +} + static void rtpcs_931x_sds_reset(struct rtpcs_serdes *sds) { struct rtpcs_ctrl *ctrl = sds->ctrl; @@ -2951,16 +2960,7 @@ static int rtpcs_931x_setup_serdes(struct rtpcs_serdes *sds, rtpcs_931x_sds_power(sds, true); - if (mode == PHY_INTERFACE_MODE_XGMII || - mode == PHY_INTERFACE_MODE_QSGMII || - mode == PHY_INTERFACE_MODE_SGMII || - mode == PHY_INTERFACE_MODE_USXGMII) { - if (mode == PHY_INTERFACE_MODE_XGMII) - ret = rtpcs_931x_sds_set_mac_mode(sds, hw_mode); - else - ret = rtpcs_931x_sds_set_ip_mode(sds, hw_mode); - } - + ret = rtpcs_931x_sds_set_mode(sds, hw_mode); if (ret < 0) return ret; |