lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231220155518.15692-13-kabel@kernel.org>
Date: Wed, 20 Dec 2023 16:55:15 +0100
From: Marek Behún <kabel@...nel.org>
To: netdev@...r.kernel.org,
	Andrew Lunn <andrew@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>
Cc: Russell King <rmk+kernel@...linux.org.uk>,
	Alexander Couzens <lynxis@...0.eu>,
	Daniel Golle <daniel@...rotopia.org>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Willy Liu <willy.liu@...ltek.com>,
	Ioana Ciornei <ioana.ciornei@....com>,
	Marek Mojík <marek.mojik@....cz>,
	Maximilián Maliar <maximilian.maliar@....cz>,
	Marek Behún <kabel@...nel.org>
Subject: [PATCH net-next 12/15] net: phy: realtek: use generic c45 suspend/resume for rtl822x

Now that rtl822x PHYs .read_mmd() and .write_mmd() methods support
accessing all MMD registers, use the generic clause 45 functions
genphy_c45_pma_suspend() and genphy_c45_pma_resume() for the rtl822x
series of Realtek transceivers.

Add a 20ms delay after resume, as done in the current resume
implementation.

Signed-off-by: Marek Behún <kabel@...nel.org>
---
 drivers/net/phy/realtek.c | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index f36b2bfabe57..cf608d390aa5 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -651,6 +651,18 @@ static int rtl822x_probe(struct phy_device *phydev)
 	return 0;
 }
 
+static int rtl822x_resume(struct phy_device *phydev)
+{
+	int ret = genphy_c45_pma_resume(phydev);
+
+	if (ret < 0)
+		return ret;
+
+	msleep(20);
+
+	return 0;
+}
+
 static int rtl822x_config_aneg(struct phy_device *phydev)
 {
 	bool changed = false;
@@ -949,8 +961,8 @@ static struct phy_driver realtek_drvs[] = {
 		.probe		= rtl822x_probe,
 		.config_aneg	= rtl822x_config_aneg,
 		.read_status	= rtl822x_read_status,
-		.suspend	= genphy_suspend,
-		.resume		= rtlgen_resume,
+		.suspend	= genphy_c45_pma_suspend,
+		.resume		= rtl822x_resume,
 		.read_page	= rtl821x_read_page,
 		.write_page	= rtl821x_write_page,
 		.read_mmd	= rtlgen_read_mmd,
@@ -961,8 +973,8 @@ static struct phy_driver realtek_drvs[] = {
 		.probe		= rtl822x_probe,
 		.config_aneg	= rtl822x_config_aneg,
 		.read_status	= rtl822x_read_status,
-		.suspend	= genphy_suspend,
-		.resume		= rtlgen_resume,
+		.suspend	= genphy_c45_pma_suspend,
+		.resume		= rtl822x_resume,
 		.read_page	= rtl821x_read_page,
 		.write_page	= rtl821x_write_page,
 		.read_mmd	= rtlgen_read_mmd,
@@ -973,8 +985,8 @@ static struct phy_driver realtek_drvs[] = {
 		.probe		= rtl822x_probe,
 		.config_aneg    = rtl822x_config_aneg,
 		.read_status    = rtl822x_read_status,
-		.suspend        = genphy_suspend,
-		.resume         = rtlgen_resume,
+		.suspend	= genphy_c45_pma_suspend,
+		.resume		= rtl822x_resume,
 		.read_page      = rtl821x_read_page,
 		.write_page     = rtl821x_write_page,
 		.read_mmd	= rtlgen_read_mmd,
@@ -985,8 +997,8 @@ static struct phy_driver realtek_drvs[] = {
 		.probe		= rtl822x_probe,
 		.config_aneg    = rtl822x_config_aneg,
 		.read_status    = rtl822x_read_status,
-		.suspend        = genphy_suspend,
-		.resume         = rtlgen_resume,
+		.suspend	= genphy_c45_pma_suspend,
+		.resume		= rtl822x_resume,
 		.read_page      = rtl821x_read_page,
 		.write_page     = rtl821x_write_page,
 		.read_mmd	= rtlgen_read_mmd,
@@ -997,8 +1009,8 @@ static struct phy_driver realtek_drvs[] = {
 		.probe		= rtl822x_probe,
 		.config_aneg    = rtl822x_config_aneg,
 		.read_status    = rtl822x_read_status,
-		.suspend        = genphy_suspend,
-		.resume         = rtlgen_resume,
+		.suspend	= genphy_c45_pma_suspend,
+		.resume		= rtl822x_resume,
 		.read_page      = rtl821x_read_page,
 		.write_page     = rtl821x_write_page,
 		.read_mmd	= rtlgen_read_mmd,
@@ -1009,8 +1021,8 @@ static struct phy_driver realtek_drvs[] = {
 		.probe		= rtl822x_probe,
 		.config_aneg    = rtl822x_config_aneg,
 		.read_status    = rtl822x_read_status,
-		.suspend        = genphy_suspend,
-		.resume         = rtlgen_resume,
+		.suspend	= genphy_c45_pma_suspend,
+		.resume		= rtl822x_resume,
 		.read_page      = rtl821x_read_page,
 		.write_page     = rtl821x_write_page,
 		.read_mmd	= rtlgen_read_mmd,
-- 
2.41.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ