From 3570dee5f0409cc8bab6a95d716a76112106307e Mon Sep 17 00:00:00 2001 From: Jonas Jelonek Date: Mon, 27 Oct 2025 19:30:06 +0000 Subject: [PATCH] realtek: dsa: remove sds_num entirely After having moved RTL93XX SerDes configuration from PHY to PCS driver, the DSA driver doesn't need to know about SerDes explicitly anymore. Although RTL83XX SerDes is still partly managed within the DSA driver, it doesn't make use of the sds_num property/field. RTL93XX was the only user of this right now. Thus, we can just remove the remaining 'sds_num' code which doesn't serve any purpose anymore. Signed-off-by: Jonas Jelonek Link: https://github.com/openwrt/openwrt/pull/20577 Signed-off-by: Robert Marko --- .../drivers/net/dsa/rtl83xx/common.c | 13 --------- .../files-6.12/drivers/net/dsa/rtl83xx/dsa.c | 27 ------------------- .../drivers/net/dsa/rtl83xx/rtl838x.h | 1 - 3 files changed, 41 deletions(-) diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c index 3dceb93e35b..502c130d6fe 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c @@ -349,19 +349,6 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv) continue; } - /* - * TODO: phylink_pcs was completely converted to the standalone PCS driver - see - * rtpcs_create(). Nevertheless the DSA driver still relies on the info about the - * attached SerDes. As soon as the PCS driver can completely configure the SerDes - * this is no longer needed. - */ - - priv->ports[pn].sds_num = -1; - if (pcs_node) - of_property_read_u32(pcs_node, "reg", &priv->ports[pn].sds_num); - if (priv->ports[pn].sds_num >= 0) - dev_dbg(priv->dev, "port %d has SDS %d\n", pn, priv->ports[pn].sds_num); - if (of_get_phy_mode(dn, &interface)) interface = PHY_INTERFACE_MODE_NA; if (interface == PHY_INTERFACE_MODE_10G_QXGMII) diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c index 06909d205f7..0e341163760 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c @@ -548,26 +548,6 @@ static int rtl93xx_setup(struct dsa_switch *ds) return 0; } -static int rtl93xx_get_sds(struct phy_device *phydev) -{ - struct device *dev = &phydev->mdio.dev; - struct device_node *dn; - u32 sds_num; - - if (!dev) - return -1; - if (dev->of_node) { - dn = dev->of_node; - if (of_property_read_u32(dn, "sds", &sds_num)) - sds_num = -1; - } else { - dev_err(dev, "No DT node.\n"); - return -1; - } - - return sds_num; -} - static struct phylink_pcs *rtldsa_phylink_mac_select_pcs(struct dsa_switch *ds, int port, phy_interface_t interface) @@ -692,12 +672,8 @@ static void rtl931x_phylink_mac_config(struct dsa_switch *ds, int port, const struct phylink_link_state *state) { struct rtl838x_switch_priv *priv = ds->priv; - int sds_num; u32 reg; - sds_num = priv->ports[port].sds_num; - pr_info("%s: speed %d sds_num %d\n", __func__, state->speed, sds_num); - reg = sw_r32(priv->r->mac_force_mode_ctrl(port)); pr_info("%s reading FORCE_MODE_CTRL: %08x\n", __func__, reg); @@ -1416,9 +1392,6 @@ static int rtldsa_port_enable(struct dsa_switch *ds, int port, struct phy_device sw_w32_mask(0, BIT(port), RTL930X_L2_PORT_DABLK_CTRL); } - if (priv->ports[port].sds_num < 0) - priv->ports[port].sds_num = rtl93xx_get_sds(phydev); - return 0; } diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h index a361b8e9483..5dba9d5fef0 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h @@ -688,7 +688,6 @@ struct rtl838x_port { u16 pvid; bool eee_enabled; enum phy_type phy; - int sds_num; int led_set; int leds_on_this_port; struct rtldsa_counter_state counters; -- 2.47.3