[openwrt/openwrt] realtek: pcs: move polarity into SerDes struct
LEDE Commits
lede-commits at lists.infradead.org
Tue Dec 16 04:38:28 PST 2025
robimarko pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/c870f163504a2c91f81cb5de68ddbb10bac03b55
commit c870f163504a2c91f81cb5de68ddbb10bac03b55
Author: Jonas Jelonek <jelonek.jonas at gmail.com>
AuthorDate: Thu Dec 11 23:33:59 2025 +0000
realtek: pcs: move polarity into SerDes struct
As a first real usage of the new SerDes struct, move the polarity
configuration there. It was previously located in the global rtpcs_ctrl
struct as an array, indexed by SerDes id. Because this is per-SerDes
information, the new SerDes struct is the correct place to live in.
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 56a71f3c82a5d2f39e7db1c1f76a64d2f04b8d87)
---
.../realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 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 7c0f737a67..0a1d994da7 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
@@ -135,6 +135,9 @@ struct rtpcs_serdes {
struct rtpcs_ctrl *ctrl;
u8 id;
enum rtpcs_sds_mode mode;
+
+ bool rx_pol_inv;
+ bool tx_pol_inv;
};
struct rtpcs_ctrl {
@@ -144,8 +147,6 @@ struct rtpcs_ctrl {
const struct rtpcs_config *cfg;
struct rtpcs_serdes serdes[RTPCS_SDS_CNT];
struct rtpcs_link *link[RTPCS_PORT_CNT];
- bool rx_pol_inv[RTPCS_SDS_CNT];
- bool tx_pol_inv[RTPCS_SDS_CNT];
struct mutex lock;
};
@@ -2242,8 +2243,7 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
pr_info("%s: Configuring RTL9300 SERDES %d\n", __func__, sds->id);
/* Set SDS polarity */
- rtpcs_930x_sds_set_polarity(sds, sds->ctrl->tx_pol_inv[sds->id],
- sds->ctrl->rx_pol_inv[sds->id]);
+ 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);
@@ -2831,8 +2831,7 @@ static int rtpcs_931x_setup_serdes(struct rtpcs_serdes *sds,
}
}
- rtpcs_931x_sds_set_polarity(sds, ctrl->tx_pol_inv[sds_id],
- ctrl->rx_pol_inv[sds_id]);
+ rtpcs_931x_sds_set_polarity(sds, sds->tx_pol_inv, sds->rx_pol_inv);
val = ori & ~BIT(sds_id);
regmap_write(ctrl->map, RTL931X_PS_SERDES_OFF_MODE_CTRL_ADDR, val);
@@ -3090,8 +3089,9 @@ static int rtpcs_probe(struct platform_device *pdev)
if (sds_id >= ctrl->cfg->serdes_count)
return -EINVAL;
- ctrl->rx_pol_inv[sds_id] = of_property_read_bool(child, "realtek,pnswap-rx");
- ctrl->tx_pol_inv[sds_id] = of_property_read_bool(child, "realtek,pnswap-tx");
+ sds = &ctrl->serdes[sds_id];
+ sds->rx_pol_inv = of_property_read_bool(child, "realtek,pnswap-rx");
+ sds->tx_pol_inv = of_property_read_bool(child, "realtek,pnswap-tx");
}
if (ctrl->cfg->init_serdes_common) {
More information about the lede-commits
mailing list