diff mbox series

[net-next,v2,1/2] net: phy: Use genphy_loopback() by default

Message ID 20191017214453.18934-2-f.fainelli@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series net: phy: Add ability to debug RGMII | expand

Commit Message

Florian Fainelli Oct. 17, 2019, 9:44 p.m. UTC
The standard way of putting a PHY device into loopback is most often
suitable for testing. This is going to be necessary in a subsequent
patch that adds RGII debugging capability using the loopback feature.

Clause 45 PHYs are not supported through a generic method yet.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/phy_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Andrew Lunn Oct. 17, 2019, 9:59 p.m. UTC | #1
On Thu, Oct 17, 2019 at 02:44:52PM -0700, Florian Fainelli wrote:
> The standard way of putting a PHY device into loopback is most often
> suitable for testing. This is going to be necessary in a subsequent
> patch that adds RGII debugging capability using the loopback feature.
> 
> Clause 45 PHYs are not supported through a generic method yet.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 9d2bbb13293e..7fa728c44632 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1513,8 +1513,10 @@  int phy_loopback(struct phy_device *phydev, bool enable)
 
 	if (phydev->drv && phydrv->set_loopback)
 		ret = phydrv->set_loopback(phydev, enable);
-	else
+	else if (phydev->is_c45)
 		ret = -EOPNOTSUPP;
+	else
+		ret = genphy_loopback(phydev, enable);
 
 	if (ret)
 		goto out;