realtek: dsa: remove redundant integrated phy attribute

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>
This commit is contained in:
Markus Stockhausen 2026-03-30 18:13:02 +02:00 committed by Robert Marko
parent 78ffee0ed2
commit f1f0572d1f
4 changed files with 6 additions and 39 deletions

View File

@ -327,30 +327,7 @@ static int rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv)
} }
} }
if (!phy_node) { priv->ports[pn].phy = !!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;
}
} }
/* Disable MAC polling the PHY so that we can start configuration */ /* Disable MAC polling the PHY so that we can start configuration */

View File

@ -526,7 +526,7 @@ static void rtldsa_93xx_phylink_mac_link_up(struct phylink_config *config,
mcr |= RTL930X_RX_PAUSE_EN; mcr |= RTL930X_RX_PAUSE_EN;
if (duplex == DUPLEX_FULL || priv->lagmembers & BIT_ULL(port)) if (duplex == DUPLEX_FULL || priv->lagmembers & BIT_ULL(port))
mcr |= RTL930X_DUPLEX_MODE; 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; mcr |= RTL930X_FORCE_EN;
} }

View File

@ -896,15 +896,6 @@ typedef enum {
*/ */
#define RTLDSA_COUNTERS_FAST_POLL_INTERVAL (3 * HZ) #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 { enum pbvlan_type {
PBVLAN_TYPE_INNER = 0, PBVLAN_TYPE_INNER = 0,
PBVLAN_TYPE_OUTER, PBVLAN_TYPE_OUTER,
@ -1003,14 +994,13 @@ struct rtldsa_93xx_lag_entry {
struct rtldsa_port { struct rtldsa_port {
bool enable:1; bool enable:1;
bool phy_is_integrated:1; bool phy:1;
bool isolated:1; bool isolated:1;
bool rate_police_egress:1; bool rate_police_egress:1;
bool rate_police_ingress:1; bool rate_police_ingress:1;
u64 pm; u64 pm;
u16 pvid; u16 pvid;
bool eee_enabled; bool eee_enabled;
enum phy_type phy;
struct phylink_pcs *pcs; struct phylink_pcs *pcs;
int led_set; int led_set;
int leds_on_this_port; int leds_on_this_port;

View 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, sw_w32_mask(0x3 << pos, (priv->ports[i].leds_on_this_port - 1) << pos,
RTL931X_LED_PORT_NUM_CTRL(i)); RTL931X_LED_PORT_NUM_CTRL(i));
if (priv->ports[i].phy_is_integrated) if (priv->ports[i].phy)
pm_fiber |= BIT_ULL(i);
else
pm_copper |= BIT_ULL(i); pm_copper |= BIT_ULL(i);
else
pm_fiber |= BIT_ULL(i);
set = priv->ports[i].led_set; set = priv->ports[i].led_set;
sw_w32_mask(0, set << pos, RTL931X_LED_PORT_COPR_SET_SEL_CTRL(i)); sw_w32_mask(0, set << pos, RTL931X_LED_PORT_COPR_SET_SEL_CTRL(i));