From: Bartosz Golaszewski Ahead of adding support for firmware driven power management, let's allow different ways of setting the PHY speed. To that end create a callback with a single implementation for now, that will be extended later. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 09f122062dec87aa11804af2769ddff4964e6596..446f06b591a0b70992c7a431b56cf88c1b6718fd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -120,6 +120,7 @@ struct qcom_ethqos { struct ethqos_emac_pm_ctx pm; phy_interface_t phy_mode; int serdes_speed; + int (*set_serdes_speed)(struct qcom_ethqos *ethqos); const struct ethqos_emac_por *por; unsigned int num_por; @@ -640,11 +641,16 @@ static int ethqos_configure_rgmii(struct qcom_ethqos *ethqos, int speed) return 0; } +static int ethqos_set_serdes_speed_phy(struct qcom_ethqos *ethqos) +{ + return phy_set_speed(ethqos->pm.serdes_phy, ethqos->serdes_speed); +} + static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed) { if (ethqos->serdes_speed != speed) { - phy_set_speed(ethqos->pm.serdes_phy, speed); ethqos->serdes_speed = speed; + ethqos->set_serdes_speed(ethqos); } } @@ -865,6 +871,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(ethqos->pm.serdes_phy), "Failed to get serdes phy\n"); + ethqos->set_serdes_speed = ethqos_set_serdes_speed_phy; ethqos->serdes_speed = SPEED_1000; ethqos_update_link_clk(ethqos, SPEED_1000); ethqos_set_func_clk_en(ethqos); -- 2.51.0