Skip to content

Commit 40a64cc

Browse files
oleremkuba-moo
authored andcommitted
net: phy: dp83tg720: get master/slave configuration in link down state
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: [email protected] Signed-off-by: Oleksij Rempel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent cd6f12e commit 40a64cc

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

drivers/net/phy/dp83tg720.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,20 @@
3636

3737
static int dp83tg720_config_aneg(struct phy_device *phydev)
3838
{
39+
int ret;
40+
3941
/* Autoneg is not supported and this PHY supports only one speed.
4042
* We need to care only about master/slave configuration if it was
4143
* changed by user.
4244
*/
43-
return genphy_c45_pma_baset1_setup_master_slave(phydev);
45+
ret = genphy_c45_pma_baset1_setup_master_slave(phydev);
46+
if (ret)
47+
return ret;
48+
49+
/* Re-read role configuration to make changes visible even if
50+
* the link is in administrative down state.
51+
*/
52+
return genphy_c45_pma_baset1_read_master_slave(phydev);
4453
}
4554

4655
static int dp83tg720_read_status(struct phy_device *phydev)
@@ -69,6 +78,8 @@ static int dp83tg720_read_status(struct phy_device *phydev)
6978
return ret;
7079

7180
/* After HW reset we need to restore master/slave configuration.
81+
* genphy_c45_pma_baset1_read_master_slave() call will be done
82+
* by the dp83tg720_config_aneg() function.
7283
*/
7384
ret = dp83tg720_config_aneg(phydev);
7485
if (ret)
@@ -168,8 +179,15 @@ static int dp83tg720_config_init(struct phy_device *phydev)
168179
/* In case the PHY is bootstrapped in managed mode, we need to
169180
* wake it.
170181
*/
171-
return phy_write_mmd(phydev, MDIO_MMD_VEND2, DP83TG720S_LPS_CFG3,
172-
DP83TG720S_LPS_CFG3_PWR_MODE_0);
182+
ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, DP83TG720S_LPS_CFG3,
183+
DP83TG720S_LPS_CFG3_PWR_MODE_0);
184+
if (ret)
185+
return ret;
186+
187+
/* Make role configuration visible for ethtool on init and after
188+
* rest.
189+
*/
190+
return genphy_c45_pma_baset1_read_master_slave(phydev);
173191
}
174192

175193
static struct phy_driver dp83tg720_driver[] = {

0 commit comments

Comments
 (0)