public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix•de>
To: Andrew Lunn <andrew@lunn•ch>
Cc: netdev <netdev@vger•kernel.org>,
	Florian Fainelli <f.fainelli@gmail•com>,
	Heiner Kallweit <hkallweit1@gmail•com>,
	Russell King <rmk+kernel@armlinux•org.uk>
Subject: Re: [RFC/RFT 03/23] net: phy: Add helper to set EEE Clock stop enable bit
Date: Tue, 28 Mar 2023 07:13:37 +0200	[thread overview]
Message-ID: <20230328051337.GC15196@pengutronix.de> (raw)
In-Reply-To: <20230328050327.GB15196@pengutronix.de>

On Tue, Mar 28, 2023 at 07:03:27AM +0200, Oleksij Rempel wrote:
> On Mon, Mar 27, 2023 at 07:01:41PM +0200, Andrew Lunn wrote:
> > The MAC driver can request that the PHY stops the clock during EEE
> > LPI. This has normally been does as part of phy_init_eee(), however
> > that function is overly complex and often wrongly used. Add a
> > standalone helper, to aid removing phy_init_eee().
> > 
> > Signed-off-by: Andrew Lunn <andrew@lunn•ch>
> > ---
> > v2: Add missing EXPORT_SYMBOL_GPL
> > ---
> >  drivers/net/phy/phy.c | 20 ++++++++++++++++++++
> >  include/linux/phy.h   |  1 +
> >  2 files changed, 21 insertions(+)
> > 
> > diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> > index 68e1ce942dd6..d3d6ff4ed488 100644
> > --- a/drivers/net/phy/phy.c
> > +++ b/drivers/net/phy/phy.c
> > @@ -1503,6 +1503,26 @@ void phy_mac_interrupt(struct phy_device *phydev)
> >  }
> >  EXPORT_SYMBOL(phy_mac_interrupt);
> >  
> > +/**
> > + * phy_eee_clk_stop_enable - Clock should stop during LIP
> > + * @phydev: target phy_device struct
> > + *
> > + * Description: Program the MMD register 3.0 setting the "Clock stop enable"
> > + * bit.
> 
> 
> > + */
> > +int phy_eee_clk_stop_enable(struct phy_device *phydev)
> 
> this function should go to drivers/net/phy/phy-c45.c
> and renamed to genphy_c45_eee_clk_stop_enable()
> > +{
> > +	int ret;
> > +
> > +	mutex_lock(&phydev->lock);
> 
> 	/* IEEE 802.3-2018 45.2.3.1.4 Clock stop enable (3.0.10) */
> 
> > +	ret = phy_set_bits_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1,
> > +			       MDIO_PCS_CTRL1_CLKSTOP_EN);
> 
> It would be better to write it conditionally. Only if EEE is supported
> and only if this bit is supported as well. Support is indicated by the
> IEEE 802.3:2018 - 45.2.3.2.6 Clock stop capable (3.1.6)
> 
> It looks like there are other registers for same functionality too but
> other types of PHYs:
> 45.2.4.1.4 Clock stop enable (4.0.10)
> 45.2.4.2.6 Clock stop capable (4.1.6)
> 45.2.5.1.4 Clock stop enable (5.0.10)
> 45.2.5.2.6 Clock stop capable (5.1.6)
> 
> If I see it correctly, Clock-stop is possible only for GMII/RGMII.
> Integrated PHYs or EEE capable PHYs with RMII do not support it.
> For example KSZ8091RNA with RMII:
> https://ww1.microchip.com/downloads/en/DeviceDoc/KSZ8091RNA-RND-10BASE-T-100BASE-TX-PHY-with-RMII-and-EEE-Support-DS00002298B.pdf
> KSZ9477 switch with integrated PHYs:
> https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/KSZ9477S-Data-Sheet-DS00002392C.pdf

One more PHY, with RGMII support, but without clock-stop, which is
probably indicated by 3.1.6 bit.
https://ww1.microchip.com/downloads/aemDocuments/documents/AERO/ProductDocuments/DataSheets/VSC8540ET_Extended_Temperature_Single_Port_Fast_Ethernet_Copper_PHY_DS60001648.pdf

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2023-03-28  5:13 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 17:01 [RFC/RFT 00/23] net: ethernet: Rework EEE Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 01/23] net: phy: Add phydev->eee_active to simplify adjust link callbacks Andrew Lunn
2023-03-27 17:54   ` Russell King (Oracle)
2023-03-27 17:01 ` [RFC/RFT 02/23] net: phylink: Plumb eee_active in mac_link_up call Andrew Lunn
2023-03-27 17:57   ` Russell King (Oracle)
2023-03-27 21:53   ` Russell King (Oracle)
2023-03-27 22:45     ` Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 03/23] net: phy: Add helper to set EEE Clock stop enable bit Andrew Lunn
2023-03-27 17:58   ` Russell King (Oracle)
2023-03-28  5:03   ` Oleksij Rempel
2023-03-28  5:13     ` Oleksij Rempel [this message]
2023-03-28 12:09     ` Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 04/23] net: phy: Keep track of EEE tx_lpi_enabled Andrew Lunn
2023-03-27 17:58   ` Russell King (Oracle)
2023-03-27 17:01 ` [RFC/RFT 05/23] net: phy: Immediately call adjust_link if only tx_lpi_enabled changes Andrew Lunn
2023-03-27 18:02   ` Russell King (Oracle)
2023-03-27 22:13     ` Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 06/23] net: marvell: mvneta: Simplify EEE configuration Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 07/23] net: stmmac: Drop usage of phy_init_eee() Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 08/23] net: stmmac: Simplify ethtool get eee Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 09/23] net: lan743x: Fixup EEE Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 10/23] net: fec: Move fec_enet_eee_mode_set() and helper earlier Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 11/23] net: FEC: Fixup EEE Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 12/23] net: genet: " Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 13/23] net: sxgdb: " Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 14/23] net: dsa: mt7530: Swap to using phydev->eee_active Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 15/23] net: dsa: b53: " Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 16/23] net: phylink: Remove unused phylink_init_eee() Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 17/23] net: phy: remove unused phy_init_eee() Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 18/23] net: usb: lan78xx: Fixup EEE Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 19/23] net: phy: Add phy_support_eee() indicating MAC support EEE Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 20/23] net: phylink: Add MAC_EEE to mac_capabilites Andrew Lunn
2023-03-27 21:59   ` Russell King (Oracle)
2023-03-27 22:15     ` Andrew Lunn
2023-03-27 17:01 ` [RFC/RFT 21/23] net: phylink: Extend mac_capabilities in MAC drivers which support EEE Andrew Lunn
2023-03-27 17:02 ` [RFC/RFT 22/23] net: phylib: call phy_support_eee() " Andrew Lunn
2023-03-27 17:02 ` [RFC/RFT 23/23] net: phy: Disable EEE advertisement by default Andrew Lunn

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=20230328051337.GC15196@pengutronix.de \
    --to=o.rempel@pengutronix$(echo .)de \
    --cc=andrew@lunn$(echo .)ch \
    --cc=f.fainelli@gmail$(echo .)com \
    --cc=hkallweit1@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rmk+kernel@armlinux$(echo .)org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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