drivers: ethernet: phy: vsc8541: allow disabling autonegotiation
Add support for disabling autonegotiation to the cfg_link callback, as
with the phy_mii driver.
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
(cherry picked from commit 45eedaa614014cd287e4c618e7643abe35c23abb)
diff --git a/drivers/ethernet/phy/phy_microchip_vsc8541.c b/drivers/ethernet/phy/phy_microchip_vsc8541.c
index afe484a..ef7eb3a 100644
--- a/drivers/ethernet/phy/phy_microchip_vsc8541.c
+++ b/drivers/ethernet/phy/phy_microchip_vsc8541.c
@@ -277,12 +277,15 @@
static int phy_mc_vsc8541_cfg_link(const struct device *dev, enum phy_link_speed adv_speeds,
enum phy_cfg_link_flag flags)
{
+ int ret;
+
if ((flags & PHY_FLAG_AUTO_NEGOTIATION_DISABLED) != 0U) {
- LOG_ERR("Disabling auto-negotiation is not supported by this driver");
- return -ENOTSUP;
+ ret = phy_mii_set_bmcr_reg_autoneg_disabled(dev, adv_speeds);
+ } else {
+ ret = phy_mii_cfg_link_autoneg(dev, adv_speeds, true);
}
- return phy_mii_cfg_link_autoneg(dev, adv_speeds, true);
+ return ret;
}
/**