@@ -2127,6 +2127,14 @@ int phy_loopback(struct phy_device *phydev, bool enable)
}
EXPORT_SYMBOL(phy_loopback);
+static bool phy_can_isolate(struct phy_device *phydev)
+{
+ if (phydev->drv)
+ return !(phydev->drv->flags & PHY_NO_ISOLATE);
+
+ return true;
+}
+
int phy_isolate(struct phy_device *phydev, bool enable)
{
int ret = 0;
@@ -2134,6 +2142,9 @@ int phy_isolate(struct phy_device *phydev, bool enable)
if (!phydev->drv)
return -EIO;
+ if (!phy_can_isolate(phydev))
+ return -EOPNOTSUPP;
+
mutex_lock(&phydev->lock);
if (enable && phydev->isolated) {
@@ -90,6 +90,7 @@ extern const int phy_10gbit_features_array[1];
#define PHY_RST_AFTER_CLK_EN 0x00000002
#define PHY_POLL_CABLE_TEST 0x00000004
#define PHY_ALWAYS_CALL_SUSPEND 0x00000008
+#define PHY_NO_ISOLATE 0x00000010
#define MDIO_DEVICE_IS_PHY 0x80000000
/**
Some PHYs have malfunctionning isolation modes, where the MII lines aren't correctly set in high-impedance, potentially interfering with the MII bus in unexpected ways. Some other PHYs simply don't support it. Allow flagging these PHYs, and prevent isolating them altogether. Assume the PHY can isolate by default. Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> --- drivers/net/phy/phy_device.c | 11 +++++++++++ include/linux/phy.h | 1 + 2 files changed, 12 insertions(+)