]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: dsa: remove redundant integrated phy attribute
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Mon, 30 Mar 2026 16:13:02 +0000 (18:13 +0200)
committerRobert Marko <robimarko@gmail.com>
Tue, 31 Mar 2026 10:56:24 +0000 (12:56 +0200)
The dsa driver currently has different attributes to denote what
hardware is around a port:

- phy_is_integrated: true if phy is not driven by a serdes
- phy: the type of the attached phy (e.g. 0=NONE, 2=RTL8218B, ....)
- pcs: link to a serdes pcs instance

This is somehow redundant and especially the phy type should be only
part of the phy driver and is not needed by the dsa driver at all.
Remove the redundancy by simply keeping a boolean attribute "phy" that
flags a phy driven port and can be used similar to the pcs (pointer)
attribute. With that the driver can check phy/pcs as follows:

- if (ports[i].pcs) -> port has a dedicated serdes
- if (ports[i].phy) -> port has a dedicated phy

That implemented, the "phy-is-integrated" attribute of a phy can be
removed from the dts. This will be a separate commit. As a side effect
the following (annoying) boot message for kernel 6.18 gets fixed.

OF: /switchcore@1b000000/mdio-controller/mdio-bus@0/ethernet-phy@24:
Read of boolean property 'sfp' with a value.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22698
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/common.c
target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/dsa.c
target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl838x.h
target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl931x.c

index 0c5e9f3f384a1dc77d2b4a481aac907203a25004..0414be41f2877abea477a6235e3f7d32897b70d3 100644 (file)
@@ -327,30 +327,7 @@ static int rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv)
                        }
                }
 
-               if (!phy_node) {
-                       if (priv->ports[pn].pcs)
-                               priv->ports[pn].phy_is_integrated = true;
-
-                       continue;
-               }
-
-               if (of_property_read_bool(phy_node, "phy-is-integrated") &&
-                   !of_property_read_bool(phy_node, "sfp")) {
-                       priv->ports[pn].phy = PHY_RTL8218B_INT;
-                       continue;
-               }
-
-               if (!of_property_read_bool(phy_node, "phy-is-integrated") &&
-                   of_property_read_bool(phy_node, "sfp")) {
-                       priv->ports[pn].phy = PHY_RTL8214FC;
-                       continue;
-               }
-
-               if (!of_property_read_bool(phy_node, "phy-is-integrated") &&
-                   !of_property_read_bool(phy_node, "sfp")) {
-                       priv->ports[pn].phy = PHY_RTL8218B_EXT;
-                       continue;
-               }
+               priv->ports[pn].phy = !!phy_node;
        }
 
        /* Disable MAC polling the PHY so that we can start configuration */
index 86a8fc52be9f6ff5a4e331f99a0fa62984340718..cc519422598ef7f066d323efa9a3289811ec84b6 100644 (file)
@@ -526,7 +526,7 @@ static void rtldsa_93xx_phylink_mac_link_up(struct phylink_config *config,
                        mcr |= RTL930X_RX_PAUSE_EN;
                if (duplex == DUPLEX_FULL || priv->lagmembers & BIT_ULL(port))
                        mcr |= RTL930X_DUPLEX_MODE;
-               if (dsa_port_is_cpu(dp) || !priv->ports[port].phy_is_integrated)
+               if (dsa_port_is_cpu(dp) || priv->ports[port].phy)
                        mcr |= RTL930X_FORCE_EN;
        }
 
index acdc40f0488567c8d470a104ac3159548ad9e292..5efcdc3c5677d7de4fbefca1a7efc99d1ca3a39d 100644 (file)
@@ -896,15 +896,6 @@ typedef enum {
  */
 #define RTLDSA_COUNTERS_FAST_POLL_INTERVAL     (3 * HZ)
 
-enum phy_type {
-       PHY_NONE = 0,
-       PHY_RTL838X_SDS = 1,
-       PHY_RTL8218B_INT = 2,
-       PHY_RTL8218B_EXT = 3,
-       PHY_RTL8214FC = 4,
-       PHY_RTL839X_SDS = 5,
-};
-
 enum pbvlan_type {
        PBVLAN_TYPE_INNER = 0,
        PBVLAN_TYPE_OUTER,
@@ -1003,14 +994,13 @@ struct rtldsa_93xx_lag_entry {
 
 struct rtldsa_port {
        bool enable:1;
-       bool phy_is_integrated:1;
+       bool phy:1;
        bool isolated:1;
        bool rate_police_egress:1;
        bool rate_police_ingress:1;
        u64 pm;
        u16 pvid;
        bool eee_enabled;
-       enum phy_type phy;
        struct phylink_pcs *pcs;
        int led_set;
        int leds_on_this_port;
index 2e31c10cdc108b186152cc9ac4055693af54336e..ea5a2391211e9eb8d1d27812d7bcfda9a084f9aa 100644 (file)
@@ -1688,10 +1688,10 @@ static void rtldsa_931x_led_init(struct rtl838x_switch_priv *priv)
                sw_w32_mask(0x3 << pos, (priv->ports[i].leds_on_this_port - 1) << pos,
                            RTL931X_LED_PORT_NUM_CTRL(i));
 
-               if (priv->ports[i].phy_is_integrated)
-                       pm_fiber |= BIT_ULL(i);
-               else
+               if (priv->ports[i].phy)
                        pm_copper |= BIT_ULL(i);
+               else
+                       pm_fiber |= BIT_ULL(i);
 
                set = priv->ports[i].led_set;
                sw_w32_mask(0, set << pos, RTL931X_LED_PORT_COPR_SET_SEL_CTRL(i));