Skip to content

Commit

Permalink
net: phy: dp83tg720: get master/slave configuration in link down state
Browse files Browse the repository at this point in the history
commit 40a64cc upstream.

Get master/slave configuration for initial system start with the link in
down state. This ensures ethtool shows current configuration.  Also
fixes link reconfiguration with ethtool while in down state, preventing
ethtool from displaying outdated configuration.

Even though dp83tg720_config_init() is executed periodically as long as
the link is in admin up state but no carrier is detected, this is not
sufficient for the link in admin down state where
dp83tg720_read_status() is not periodically executed. To cover this
case, we need an extra read role configuration in
dp83tg720_config_aneg().

Fixes: cb80ee2 ("net: phy: Add support for the DP83TG720S Ethernet PHY")
Cc: stable@vger.kernel.org
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20240614094516.1481231-2-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
olerem authored and gregkh committed Jun 27, 2024
1 parent 4290228 commit 771c505
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions drivers/net/phy/dp83tg720.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,20 @@

static int dp83tg720_config_aneg(struct phy_device *phydev)
{
int ret;

/* Autoneg is not supported and this PHY supports only one speed.
* We need to care only about master/slave configuration if it was
* changed by user.
*/
return genphy_c45_pma_baset1_setup_master_slave(phydev);
ret = genphy_c45_pma_baset1_setup_master_slave(phydev);
if (ret)
return ret;

/* Re-read role configuration to make changes visible even if
* the link is in administrative down state.
*/
return genphy_c45_pma_baset1_read_master_slave(phydev);
}

static int dp83tg720_read_status(struct phy_device *phydev)
Expand Down Expand Up @@ -69,6 +78,8 @@ static int dp83tg720_read_status(struct phy_device *phydev)
return ret;

/* After HW reset we need to restore master/slave configuration.
* genphy_c45_pma_baset1_read_master_slave() call will be done
* by the dp83tg720_config_aneg() function.
*/
ret = dp83tg720_config_aneg(phydev);
if (ret)
Expand Down Expand Up @@ -168,8 +179,15 @@ static int dp83tg720_config_init(struct phy_device *phydev)
/* In case the PHY is bootstrapped in managed mode, we need to
* wake it.
*/
return phy_write_mmd(phydev, MDIO_MMD_VEND2, DP83TG720S_LPS_CFG3,
DP83TG720S_LPS_CFG3_PWR_MODE_0);
ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, DP83TG720S_LPS_CFG3,
DP83TG720S_LPS_CFG3_PWR_MODE_0);
if (ret)
return ret;

/* Make role configuration visible for ethtool on init and after
* rest.
*/
return genphy_c45_pma_baset1_read_master_slave(phydev);
}

static struct phy_driver dp83tg720_driver[] = {
Expand Down

0 comments on commit 771c505

Please sign in to comment.