diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 31cd6f41df93..1c325e0a895d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -1741,8 +1741,6 @@ static int ethqos_set_early_eth_param(struct stmmac_priv *priv, priv->plat->mdio_bus_data->phy_mask = priv->plat->mdio_bus_data->phy_mask | DUPLEX_FULL | SPEED_100; - priv->plat->max_speed = SPEED_100; - if (pparams.is_valid_ipv4_addr) { INIT_DELAYED_WORK(ðqos->ipv4_addr_assign_wq, ethqos_is_ipv4_NW_stack_ready); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 55455f240a85..c594c7e8da43 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -328,6 +328,7 @@ struct stmmac_priv { bool phy_irq_enabled; bool boot_kpi; bool early_eth; + bool early_eth_config_set; }; enum stmmac_state { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 47c5d13defb1..3b8a2c43fe8f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1040,37 +1040,36 @@ static void stmmac_validate(struct phylink_config *config, phylink_set(mask, 1000baseT_Half); } + linkmode_and(supported, supported, mac_supported); + linkmode_andnot(supported, supported, mask); + linkmode_and(state->advertising, + state->advertising, mac_supported); + linkmode_andnot(state->advertising, + state->advertising, mask); + /* Early ethernet settings to bring up link in 100M, * Auto neg Off with full duplex link. */ - if (max_speed == SPEED_100 && priv->early_eth) { + if (priv->early_eth && !priv->early_eth_config_set) { priv->phydev->autoneg = AUTONEG_DISABLE; priv->phydev->speed = SPEED_100; priv->phydev->duplex = DUPLEX_FULL; - phylink_set(mac_supported, 100baseT_Full); - phylink_set(mac_supported, TP); - phylink_set(mac_supported, MII); - phylink_set(mac_supported, 10baseT_Full); - phylink_clear(mac_supported, Autoneg); - linkmode_and(supported, supported, mac_supported); - linkmode_andnot(supported, supported, mask); - - phylink_clear(mac_supported, Autoneg); - linkmode_and(state->advertising, state->advertising, mac_supported); - linkmode_andnot(state->advertising, state->advertising, mask); - - pr_info(" qcom-ethqos: %s early eth setting successful\n", - __func__); - - stmmac_set_speed100(priv->phydev); - } else { - linkmode_and(supported, supported, mac_supported); - linkmode_andnot(supported, supported, mask); + phylink_clear(mac_supported, 1000baseT_Full); linkmode_and(state->advertising, state->advertising, mac_supported); linkmode_andnot(state->advertising, state->advertising, mask); + + pr_info("qcom-ethqos: %s early eth setting successful\n", + __func__); + + stmmac_set_speed100(priv->phydev); + /* Validate method will also be called + * when we change speed using ethtool. + * Add check to avoid multiple calls + */ + priv->early_eth_config_set = 1; } }