From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
Bryan Whitehead <bryan.whitehead@microchip.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Marcin Wojtas <marcin.s.wojtas@gmail.com>,
netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
UNGLinuxDriver@microchip.com
Subject: [PATCH net-next 03/10] net: phy: add configuration of rx clock stop mode
Date: Mon, 09 Dec 2024 14:23:28 +0000 [thread overview]
Message-ID: <E1tKefY-006SMd-Af@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <Z1b9J-FihzJ4A6aQ@shell.armlinux.org.uk>
Add a function to allow configuration of the PCS's clock stop enable
bit, used to configure whether the xMII receive clock can be stopped
during LPI mode.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy.c | 27 ++++++++++++++++++++++-----
include/linux/phy.h | 1 +
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 8fb4224c7576..caf472b5d4e5 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1660,6 +1660,27 @@ int phy_eee_tx_clock_stop_capable(struct phy_device *phydev)
}
EXPORT_SYMBOL_GPL(phy_eee_tx_clock_stop_capable);
+/**
+ * phy_eee_rx_clock_stop() - configure PHY receive clock in LPI
+ * @phydev: target phy_device struct
+ * @clk_stop_enable: flag to indicate whether the clock can be stopped
+ *
+ * Configure whether the PHY can disable its receive clock during LPI mode,
+ * See IEEE 802.3 sections 22.2.2.2, 35.2.2.10, and 45.2.3.1.4.
+ *
+ * Returns: 0 or negative error.
+ */
+int phy_eee_rx_clock_stop(struct phy_device *phydev, bool clk_stop_enable)
+{
+ /* Configure the PHY to stop receiving xMII
+ * clock while it is signaling LPI.
+ */
+ return phy_modify_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1,
+ MDIO_PCS_CTRL1_CLKSTOP_EN,
+ clk_stop_enable ? MDIO_PCS_CTRL1_CLKSTOP_EN : 0);
+}
+EXPORT_SYMBOL_GPL(phy_eee_rx_clock_stop);
+
/**
* phy_init_eee - init and check the EEE feature
* @phydev: target phy_device struct
@@ -1684,11 +1705,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
return -EPROTONOSUPPORT;
if (clk_stop_enable)
- /* Configure the PHY to stop receiving xMII
- * clock while it is signaling LPI.
- */
- ret = phy_set_bits_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1,
- MDIO_PCS_CTRL1_CLKSTOP_EN);
+ ret = phy_eee_rx_clock_stop(phydev, true);
return ret < 0 ? ret : 0;
}
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 267de08c227c..f865a8fc56c3 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -2073,6 +2073,7 @@ int phy_unregister_fixup_for_id(const char *bus_id);
int phy_unregister_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask);
int phy_eee_tx_clock_stop_capable(struct phy_device *phydev);
+int phy_eee_rx_clock_stop(struct phy_device *phydev, bool clk_stop_enable);
int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable);
int phy_get_eee_err(struct phy_device *phydev);
int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_keee *data);
--
2.30.2
next prev parent reply other threads:[~2024-12-09 14:23 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 14:22 [PATCH net-next 00/10] net: add phylink managed EEE support Russell King (Oracle)
2024-12-09 14:23 ` [PATCH net-next 01/10] net: mdio: add definition for clock stop capable bit Russell King (Oracle)
2024-12-10 2:21 ` Andrew Lunn
2024-12-09 14:23 ` [PATCH net-next 02/10] net: phy: add support for querying PHY clock stop capability Russell King (Oracle)
2024-12-10 3:00 ` Andrew Lunn
2024-12-09 14:23 ` Russell King (Oracle) [this message]
2024-12-10 3:03 ` [PATCH net-next 03/10] net: phy: add configuration of rx clock stop mode Andrew Lunn
2024-12-10 3:11 ` Andrew Lunn
2024-12-10 9:51 ` Russell King (Oracle)
2024-12-10 23:15 ` Andrew Lunn
2024-12-09 14:23 ` [PATCH net-next 04/10] net: phylink: add phylink_link_is_up() helper Russell King (Oracle)
2024-12-10 3:03 ` Andrew Lunn
2024-12-09 14:23 ` [PATCH net-next 05/10] net: phylink: add EEE management Russell King (Oracle)
2024-12-10 3:18 ` Andrew Lunn
2024-12-13 9:37 ` Simon Horman
2024-12-14 23:38 ` Heiner Kallweit
2025-01-02 16:39 ` Russell King (Oracle)
2024-12-09 14:23 ` [PATCH net-next 06/10] net: phylink: allow MAC driver to validate eee params Russell King (Oracle)
2024-12-10 3:21 ` Andrew Lunn
2024-12-10 9:58 ` Russell King (Oracle)
2024-12-10 13:58 ` Russell King (Oracle)
2024-12-09 14:23 ` [PATCH net-next 07/10] net: mvneta: convert to phylink EEE implementation Russell King (Oracle)
2024-12-10 3:25 ` Andrew Lunn
2024-12-13 10:04 ` Simon Horman
2024-12-13 10:22 ` Simon Horman
2024-12-13 10:51 ` Russell King (Oracle)
2024-12-09 14:23 ` [PATCH net-next 08/10] net: mvpp2: add " Russell King (Oracle)
2024-12-10 3:27 ` Andrew Lunn
2024-12-09 14:23 ` [PATCH net-next 09/10] net: lan743x: use netdev in lan743x_phylink_mac_link_down() Russell King (Oracle)
2024-12-10 3:28 ` Andrew Lunn
2024-12-09 14:24 ` [PATCH net-next 10/10] net: lan743x: convert to phylink managed EEE Russell King (Oracle)
2024-12-10 3:37 ` Andrew Lunn
2024-12-10 10:07 ` Russell King (Oracle)
2024-12-10 14:57 ` kernel test robot
2024-12-12 1:31 ` kernel test robot
2024-12-09 18:35 ` [PATCH net-next 00/10] net: add phylink managed EEE support Christian Marangi
2024-12-09 18:59 ` Russell King (Oracle)
2024-12-11 12:07 ` Russell King (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1tKefY-006SMd-Af@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=bryan.whitehead@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=marcin.s.wojtas@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).