From: Andrew Lunn <andrew@lunn.ch>
To: "Ismail, Mohammad Athari" <mohammad.athari.ismail@intel.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Voon, Weifeng" <weifeng.voon@intel.com>,
"Wong, Vee Khee" <vee.khee.wong@intel.com>
Subject: Re: [BUG] net: phy: genphy_loopback: add link speed configuration
Date: Tue, 14 Dec 2021 10:39:25 +0100 [thread overview]
Message-ID: <YbhmTcFITSD1dOts@lunn.ch> (raw)
In-Reply-To: <CO1PR11MB4771251E6D2E59B1B413211FD5759@CO1PR11MB4771.namprd11.prod.outlook.com>
On Tue, Dec 14, 2021 at 07:00:37AM +0000, Ismail, Mohammad Athari wrote:
> Hi Oleksij,
>
> "net: phy: genphy_loopback: add link speed configuration" patch causes Marvell 88E1510 PHY not able to perform PHY loopback using ethtool command (ethtool -t eth0 offline). Below is the error message:
>
> "Marvell 88E1510 stmmac-3:01: genphy_loopback failed: -110"
-110 is ETIMEDOUT. So that points to the phy_read_poll_timeout().
Ah, that points to the fact the Marvell PHYs are odd. You need to
perform a software reset after changing some registers to actually
execute the change.
As a quick test, please could you try:
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 74d8e1dc125f..b45f3ffc7c7f 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2625,6 +2625,10 @@ int genphy_loopback(struct phy_device *phydev, bool enable)
phy_modify(phydev, MII_BMCR, ~0, ctl);
+ ret = genphy_soft_reset(phydev);
+ if (ret < 0)
+ return ret;
+
ret = phy_read_poll_timeout(phydev, MII_BMSR, val,
val & BMSR_LSTATUS,
5000, 500000, true);
If this fixes it for you, the actual fix will be more complex, Marvell
cannot use genphy_loopback, it will need its own implementation.
Andrew
next prev parent reply other threads:[~2021-12-14 9:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 7:00 [BUG] net: phy: genphy_loopback: add link speed configuration Ismail, Mohammad Athari
2021-12-14 9:39 ` Andrew Lunn [this message]
2021-12-15 8:36 ` Ismail, Mohammad Athari
2021-12-15 9:23 ` Andrew Lunn
2021-12-15 9:35 ` Ismail, Mohammad Athari
2021-12-15 9:55 ` Andrew Lunn
2021-12-15 15:03 ` Ismail, Mohammad Athari
2021-12-20 11:11 ` Ismail, Mohammad Athari
2021-12-20 15:13 ` 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=YbhmTcFITSD1dOts@lunn.ch \
--to=andrew@lunn.ch \
--cc=linux-kernel@vger.kernel.org \
--cc=mohammad.athari.ismail@intel.com \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=vee.khee.wong@intel.com \
--cc=weifeng.voon@intel.com \
/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).