From: Xu Liang <lxu@maxlinear.com>
To: <andrew@lunn.ch>, <hkallweit1@gmail.com>,
<netdev@vger.kernel.org>, <davem@davemloft.net>,
<kuba@kernel.org>, <vee.khee.wong@linux.intel.com>
Cc: <linux@armlinux.org.uk>, <hmehrtens@maxlinear.com>,
<tmohren@maxlinear.com>, <mohammad.athari.ismail@intel.com>,
Xu Liang <lxu@maxlinear.com>
Subject: [PATCH v2] net: phy: enhance GPY115 loopback disable function
Date: Mon, 27 Sep 2021 15:03:02 +0800 [thread overview]
Message-ID: <20210927070302.27956-1-lxu@maxlinear.com> (raw)
GPY115 need reset PHY when it comes out from loopback mode if the firmware
version number (lower 8 bits) is equal to or below 0x76.
Fixes: 7d901a1e878a ("net: phy: add Maxlinear GPY115/21x/24x driver")
Signed-off-by: Xu Liang <lxu@maxlinear.com>
---
v2 changes:
Remove wrong comment.
Use genphy_soft_reset instead of modifying MII_BMCR register to trigger PHY reset.
drivers/net/phy/mxl-gpy.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/mxl-gpy.c b/drivers/net/phy/mxl-gpy.c
index 2d5d5081c3b6..5ce1bf03bbd7 100644
--- a/drivers/net/phy/mxl-gpy.c
+++ b/drivers/net/phy/mxl-gpy.c
@@ -493,6 +493,25 @@ static int gpy_loopback(struct phy_device *phydev, bool enable)
return ret;
}
+static int gpy115_loopback(struct phy_device *phydev, bool enable)
+{
+ int ret;
+ int fw_minor;
+
+ if (enable)
+ return gpy_loopback(phydev, enable);
+
+ ret = phy_read(phydev, PHY_FWV);
+ if (ret < 0)
+ return ret;
+
+ fw_minor = FIELD_GET(PHY_FWV_MINOR_MASK, ret);
+ if (fw_minor > 0x0076)
+ return gpy_loopback(phydev, 0);
+
+ return genphy_soft_reset(phydev);
+}
+
static struct phy_driver gpy_drivers[] = {
{
PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx),
@@ -527,7 +546,7 @@ static struct phy_driver gpy_drivers[] = {
.handle_interrupt = gpy_handle_interrupt,
.set_wol = gpy_set_wol,
.get_wol = gpy_get_wol,
- .set_loopback = gpy_loopback,
+ .set_loopback = gpy115_loopback,
},
{
PHY_ID_MATCH_MODEL(PHY_ID_GPY115C),
@@ -544,7 +563,7 @@ static struct phy_driver gpy_drivers[] = {
.handle_interrupt = gpy_handle_interrupt,
.set_wol = gpy_set_wol,
.get_wol = gpy_get_wol,
- .set_loopback = gpy_loopback,
+ .set_loopback = gpy115_loopback,
},
{
.phy_id = PHY_ID_GPY211B,
--
2.17.1
next reply other threads:[~2021-09-27 7:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 7:03 Xu Liang [this message]
2021-09-27 12:42 ` [PATCH v2] net: phy: enhance GPY115 loopback disable function Andrew Lunn
2021-09-27 12:50 ` patchwork-bot+netdevbpf
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=20210927070302.27956-1-lxu@maxlinear.com \
--to=lxu@maxlinear.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=hmehrtens@maxlinear.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mohammad.athari.ismail@intel.com \
--cc=netdev@vger.kernel.org \
--cc=tmohren@maxlinear.com \
--cc=vee.khee.wong@linux.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).