Add support for PHYs which only supported auto-negotiated speed modes. This prevents a kernel warning and stack-trace within the phy_state_machine when PHYs return -EOPNOTSUPP from config_aneg() because they do not support forced modes. Signed-off-by: Birger Koblitz Reviewed-by: Andrew Lunn Reviewed-by: Nicolai Buchwitz --- drivers/net/phy/phy.c | 4 ++++ include/linux/phy.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index fce9bc7be3304b408c9f3ec9b5b95c76d3680a88..b83f938fe7c3bd619ae453434fd9582c0a055a57 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1190,6 +1190,10 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev, duplex != DUPLEX_FULL))) return -EINVAL; + if (autoneg == AUTONEG_DISABLE && + (phydev->drv->flags & PHY_BROKEN_FORCED)) + return -EOPNOTSUPP; + mutex_lock(&phydev->lock); phydev->autoneg = autoneg; diff --git a/include/linux/phy.h b/include/linux/phy.h index 5f8d65868e0ff558c163421cfea5a6f3bd73a53e..d5f8e527ce8dfefd40a8b34e7c2f9adbcd6c87c1 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -64,6 +64,7 @@ extern const int phy_basic_ports_array[3]; #define PHY_RST_AFTER_CLK_EN 0x00000002 #define PHY_POLL_CABLE_TEST 0x00000004 #define PHY_ALWAYS_CALL_SUSPEND 0x00000008 +#define PHY_BROKEN_FORCED 0x00000010 #define MDIO_DEVICE_IS_PHY 0x80000000 /** -- 2.47.3