mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 06:46:35 +01: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 <[email protected]> Reviewed-by: Maxime Chevallier <[email protected]> Reviewed-by: Russell King (Oracle) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
This commit is contained in:
1 parent
d1d5df4691
commit
2c67301584
1 file changed
+11
-12
@@ -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