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>
}
}
- 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 */
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;
}
*/
#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,
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;
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));