net: phy: realtek: Avoid PHYCR2 access if PHYCR2 not present
Subsystems (3)
PATCH 1/1 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 commit bfc17c165835 ("net:
phy: realtek: disable PHY-mode EEE"). Move the PHYCR2 presence test before the EEE disablement and simplify the code.
---
Cc: "David S. Miller" <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Daniel Golle <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Heiner Kallweit <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Markus Stockhausen <[email protected]>
Cc: Michael Klein <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
--- drivers/net/phy/realtek/realtek_main.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/net/phy/realtek/realtek_main.c +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)
Signature · 1 line
2.51.0
Hi Marek,
Quoted 8 lines · Marek Vasut
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 commitbfc17c165835("net:
phy: realtek: disable PHY-mode EEE"). Move the PHYCR2 presence test before the EEE disablement and simplify the code.Fixes bfc17c165835 ("net: phy: realtek: disable PHY-mode EEE")Signed-off-by Marek Vasut <[email protected]>
Thanks,
Maxime
Quoted 8 lines · Marek Vasut
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 commitbfc17c165835("net:
phy: realtek: disable PHY-mode EEE"). Move the PHYCR2 presence test before the EEE disablement and simplify the code.Fixes bfc17c165835 ("net: phy: realtek: disable PHY-mode EEE")Signed-off-by Marek Vasut <[email protected]>
This looks obvious.
Thanks!
Quoted 10 lines
Cc "David S. Miller" <[email protected]>Cc Andrew Lunn <[email protected]>Cc Daniel Golle <[email protected]>Cc Eric Dumazet <[email protected]>Cc Heiner Kallweit <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Markus Stockhausen <[email protected]>Cc Michael Klein <[email protected]>Cc Paolo Abeni <[email protected]>Cc Russell King <[email protected]>
Please drop this line.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Sat, 11 Oct 2025 13:02:49 +0200 you wrote:
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 commitbfc17c165835("net:
phy: realtek: disable PHY-mode EEE"). Move the PHYCR2 presence test before the EEE disablement and simplify the code.Fixes bfc17c165835 ("net: phy: realtek: disable PHY-mode EEE")Signed-off-by Marek Vasut <[email protected]>[...]
Here is the summary with links:
- [net] net: phy: realtek: Avoid PHYCR2 access if PHYCR2 not present
https://git.kernel.org/netdev/net/c/2c67301584f2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html