MDIO/MIB Ethernet require the master port and the tagger availabale to correctly work. Use the new api master_state_change to track when master is operational or not and set a bool in qca8k_priv. This bool will later be used by mdio read/write and mib request to correctly use the working function. Signed-off-by: Ansuel Smith <ansuelsmth@xxxxxxxxx> --- drivers/net/dsa/qca8k.c | 13 +++++++++++++ drivers/net/dsa/qca8k.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index 039694518788..905fae26e05b 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -2383,6 +2383,18 @@ qca8k_port_lag_leave(struct dsa_switch *ds, int port, return qca8k_lag_refresh_portmap(ds, port, lag, true); } +static void +qca8k_master_change(struct dsa_switch *ds, const struct net_device *master, + bool operational) +{ + struct qca8k_priv *priv = ds->priv; + + if (operational) + priv->master_oper = true; + else + priv->master_oper = false; +} + static const struct dsa_switch_ops qca8k_switch_ops = { .get_tag_protocol = qca8k_get_tag_protocol, .setup = qca8k_setup, @@ -2418,6 +2430,7 @@ static const struct dsa_switch_ops qca8k_switch_ops = { .get_phy_flags = qca8k_get_phy_flags, .port_lag_join = qca8k_port_lag_join, .port_lag_leave = qca8k_port_lag_leave, + .master_state_change = qca8k_master_change, }; static int qca8k_read_switch_id(struct qca8k_priv *priv) diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h index ab4a417b25a9..fb98536bf3e8 100644 --- a/drivers/net/dsa/qca8k.h +++ b/drivers/net/dsa/qca8k.h @@ -342,6 +342,7 @@ struct qca8k_priv { u8 mirror_rx; u8 mirror_tx; u8 lag_hash_mode; + bool master_oper; /* Track if mdio/mib Ethernet is available */ bool legacy_phy_port_mapping; struct qca8k_ports_config ports_config; struct regmap *regmap; -- 2.32.0