linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org (open list),
	hkallweit1@gmail.com, bcm-kernel-feedback-list@broadcom.com,
	olteanv@gmail.com, rmk+kernel@armlinux.org.uk, cphealy@gmail.com,
	Jose Abreu <joabreu@synopsys.com>
Subject: [PATCH net-next v2 1/2] net: phy: Use genphy_loopback() by default
Date: Thu, 17 Oct 2019 14:44:52 -0700	[thread overview]
Message-ID: <20191017214453.18934-2-f.fainelli@gmail.com> (raw)
In-Reply-To: <20191017214453.18934-1-f.fainelli@gmail.com>

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(-)

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;
-- 
2.17.1


  reply	other threads:[~2019-10-17 21:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 21:44 [PATCH net-next v2 0/2] net: phy: Add ability to debug RGMII Florian Fainelli
2019-10-17 21:44 ` Florian Fainelli [this message]
2019-10-17 21:59   ` [PATCH net-next v2 1/2] net: phy: Use genphy_loopback() by default Andrew Lunn
2019-10-17 21:44 ` [PATCH net-next v2 2/2] net: phy: Add ability to debug RGMII connections Florian Fainelli
2019-10-17 22:11   ` Andrew Lunn
2019-10-17 22:14   ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191017214453.18934-2-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=cphealy@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).