diff options
| author | Jonas Jelonek | 2025-12-15 17:37:01 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2025-12-23 17:53:33 +0000 |
| commit | d7a184e3b1fbb7b6c039bfd6ff88be7c581409cd (patch) | |
| tree | be2033e0b81dc4e9141f00d8da4ed3a60b022eb2 | |
| parent | 9856f6b0aa3250f83818d0860abe201de3f658fa (diff) | |
| download | openwrt-d7a184e3b1fbb7b6c039bfd6ff88be7c581409cd.tar.gz | |
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@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21184
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
| -rw-r--r-- | target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c | 10 |
1 files changed, 9 insertions, 1 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 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; } |