From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Jie Gu <jie.gu@leica-geosystems.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, Jie Gu <jie.gu@leica-geosystems.com.cn>
Subject: Re: [PATCH net-next] net: phy: dp83822: add EDPD support for DP83826
Date: Tue, 1 Dec 2026 09:24:12 +0100 [thread overview]
Message-ID: <96d79cf6-6451-4c36-942b-f1c424724fa2@bootlin.com> (raw)
In-Reply-To: <20261201064909.2698827-1-jie.gu@leica-geosystems.com>
Hi,
On 12/1/26 07:49, Jie Gu wrote:
> From: Jie Gu <jie.gu@leica-geosystems.com.cn>
>
I have a few questions about the technology itself, to see if this is
the right API for that.
> The DP83826 supports Active Sleep, a link-down power-saving mode that
> periodically transmits normal link pulses to detect a link partner.
> Expose this mode through the ethtool energy-detect power-down tunable.
Is this something standard that other PHYs could potentially implement
too ? What does this do exactly and what's the use-case for that ?
What happens if this is enabled and the link-partner doesn't support it ?
Maxime
>
> Program PHYSCR bits [14:12] to select Active Sleep while preserving
> unrelated register fields. The transmit interval is fixed at 1400 ms,
> so accept either that value or the default interval when enabling
> EDPD. Reject other intervals and requests to disable pulse transmission.
>
> Read the configured mode from hardware when querying the tunable.
> Cache successful setting changes and restore them during PHY
> initialization so they survive PHY resets and interface down/up cycles.
>
> Leave EDPD disabled by default and register the tunable callbacks only
> for DP83826 variants, leaving DP83822 and DP83825 unchanged.
>
> Signed-off-by: Jie Gu <jie.gu@leica-geosystems.com.cn>
> ---
> Tested with a TI DP83826 PHY on a downstream Linux 6.16-based kernel.
>
> With the cable disconnected, measured board input power decreased by
> approximately 0.11 W. With Active Sleep enabled on both endpoints,
> link establishment and ping succeeded after cable insertion. The
> observed link-up time was approximately 0.8 s.
>
> Link recovery was also verified with a router with EEE enabled and
> a switch with Green Ethernet or EEE enabled.
>
> drivers/net/phy/dp83822.c | 71 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 71 insertions(+)
>
> diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
> index d67ca7e4a7e7..d01221e74b0b 100644
> --- a/drivers/net/phy/dp83822.c
> +++ b/drivers/net/phy/dp83822.c
> @@ -62,6 +62,9 @@
> /* PHYSCR Register Fields */
> #define DP83822_PHYSCR_INT_OE BIT(0) /* Interrupt Output Enable */
> #define DP83822_PHYSCR_INTEN BIT(1) /* Interrupt Enable */
> +#define DP83826_PHYSCR_POWER_SAVE_MASK GENMASK(14, 12)
> +#define DP83826_PHYSCR_ACTIVE_SLEEP (BIT(14) | BIT(13))
> +#define DP83826_EDPD_TX_MSECS 1400
>
> /* MISR1 bits */
> #define DP83822_RX_ERR_HF_INT_EN BIT(0)
> @@ -203,6 +206,7 @@ struct dp83822_private {
> u16 fx_sd_enable;
> u8 cfg_dac_minus;
> u8 cfg_dac_plus;
> + bool edpd_enabled;
> struct ethtool_wolinfo wol;
> bool set_gpio2_clk_out;
> u32 gpio2_clk_out;
> @@ -664,6 +668,67 @@ static int dp8382x_config_rmii_mode(struct phy_device *phydev)
> return 0;
> }
>
> +static int dp83826_config_edpd(struct phy_device *phydev, bool enable)
> +{
> + return phy_modify(phydev, MII_DP83822_PHYSCR,
> + DP83826_PHYSCR_POWER_SAVE_MASK,
> + enable ? DP83826_PHYSCR_ACTIVE_SLEEP : 0);
> +}
> +
> +static int dp83826_get_tunable(struct phy_device *phydev,
> + struct ethtool_tunable *tuna, void *data)
> +{
> + int val;
> +
> + switch (tuna->id) {
> + case ETHTOOL_PHY_EDPD:
> + val = phy_read(phydev, MII_DP83822_PHYSCR);
> + if (val < 0)
> + return val;
> +
> + if ((val & DP83826_PHYSCR_POWER_SAVE_MASK) ==
> + DP83826_PHYSCR_ACTIVE_SLEEP)
> + *(u16 *)data = DP83826_EDPD_TX_MSECS;
> + else
> + *(u16 *)data = ETHTOOL_PHY_EDPD_DISABLE;
> + return 0;
> + default:
> + return -EOPNOTSUPP;
> + }
> +}
> +
> +static int dp83826_set_tunable(struct phy_device *phydev,
> + struct ethtool_tunable *tuna, const void *data)
> +{
> + struct dp83822_private *dp83822 = phydev->priv;
> + bool enable;
> + int ret;
> +
> + switch (tuna->id) {
> + case ETHTOOL_PHY_EDPD:
> + switch (*(const u16 *)data) {
> + case ETHTOOL_PHY_EDPD_DISABLE:
> + enable = false;
> + break;
> + case ETHTOOL_PHY_EDPD_DFLT_TX_MSECS:
> + case DP83826_EDPD_TX_MSECS:
> + enable = true;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + ret = dp83826_config_edpd(phydev, enable);
> + if (ret)
> + return ret;
> +
> + dp83822->edpd_enabled = enable;
> + return 0;
> + default:
> + return -EOPNOTSUPP;
> + }
> +}
> +
> static int dp83826_config_init(struct phy_device *phydev)
> {
> struct dp83822_private *dp83822 = phydev->priv;
> @@ -714,6 +779,10 @@ static int dp83826_config_init(struct phy_device *phydev)
> return ret;
> }
>
> + ret = dp83826_config_edpd(phydev, dp83822->edpd_enabled);
> + if (ret)
> + return ret;
> +
> return dp83822_config_wol(phydev, &dp83822->wol);
> }
>
> @@ -1225,6 +1294,8 @@ static int dp83822_led_hw_control_get(struct phy_device *phydev, u8 index,
> .probe = dp83826_probe, \
> .soft_reset = dp83822_phy_reset, \
> .config_init = dp83826_config_init, \
> + .get_tunable = dp83826_get_tunable, \
> + .set_tunable = dp83826_set_tunable, \
> .get_wol = dp83822_get_wol, \
> .set_wol = dp83822_set_wol, \
> .config_intr = dp83822_config_intr, \
next prev parent reply other threads:[~2026-12-01 8:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 6:49 [PATCH net-next] net: phy: dp83822: add EDPD support for DP83826 Jie Gu
2026-12-01 8:24 ` Maxime Chevallier [this message]
2026-12-01 13:47 ` Andrew Lunn
2026-12-01 14:21 ` Maxime Chevallier
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=96d79cf6-6451-4c36-942b-f1c424724fa2@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=jie.gu@leica-geosystems.com \
--cc=jie.gu@leica-geosystems.com.cn \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--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