mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
net: phy: realtek: Avoid PHYCR2 access if PHYCR2 not present
The driver is currently checking for PHYCR2 register presence in rtl8211f_config_init(), but it does so after accessing PHYCR2 to disable EEE. This was introduced in commitbfc17c1658("net: phy: realtek: disable PHY-mode EEE"). Move the PHYCR2 presence test before the EEE disablement and simplify the code. Fixes:bfc17c1658("net: phy: realtek: disable PHY-mode EEE") Signed-off-by: Marek Vasut <marek.vasut@mailbox.org> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/20251011110309.12664-1-marek.vasut@mailbox.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
d1d5df4691
commit
2c67301584
@@ -633,26 +633,25 @@ static int rtl8211f_config_init(struct phy_device *phydev)
|
||||
str_enabled_disabled(val_rxdly));
|
||||
}
|
||||
|
||||
if (!priv->has_phycr2)
|
||||
return 0;
|
||||
|
||||
/* Disable PHY-mode EEE so LPI is passed to the MAC */
|
||||
ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE, RTL8211F_PHYCR2,
|
||||
RTL8211F_PHYCR2_PHY_EEE_ENABLE, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (priv->has_phycr2) {
|
||||
ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE,
|
||||
RTL8211F_PHYCR2, RTL8211F_CLKOUT_EN,
|
||||
priv->phycr2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "clkout configuration failed: %pe\n",
|
||||
ERR_PTR(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return genphy_soft_reset(phydev);
|
||||
ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE,
|
||||
RTL8211F_PHYCR2, RTL8211F_CLKOUT_EN,
|
||||
priv->phycr2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "clkout configuration failed: %pe\n",
|
||||
ERR_PTR(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return genphy_soft_reset(phydev);
|
||||
}
|
||||
|
||||
static int rtl821x_suspend(struct phy_device *phydev)
|
||||
|
||||
Reference in New Issue
Block a user