Skip to content

Commit

Permalink
net: phy: enhance GPY115 loopback disable function
Browse files Browse the repository at this point in the history
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: 7d901a1 ("net: phy: add Maxlinear GPY115/21x/24x driver")
Signed-off-by: Xu Liang <lxu@maxlinear.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Xu Liang authored and David S. Miller committed Sep 27, 2021
1 parent ca48aa4 commit 3b1b6e8
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions drivers/net/phy/mxl-gpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand All @@ -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,
Expand Down

0 comments on commit 3b1b6e8

Please sign in to comment.