From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Christian Marangi <ansuelsmth@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH v2 08/12] net: phy: at803x: move specific at8031 WOL bits to dedicated function
Date: Tue, 5 Dec 2023 14:58:13 +0000 [thread overview]
Message-ID: <ZW86hcgt8nhbSpfq@shell.armlinux.org.uk> (raw)
In-Reply-To: <bdbe618d4fd38469e4e139ce4ebd161766f2e4d5.camel@redhat.com>
On Tue, Dec 05, 2023 at 10:32:55AM +0100, Paolo Abeni wrote:
> On Fri, 2023-12-01 at 01:14 +0100, Christian Marangi wrote:
> > Move specific at8031 WOL enable/disable to dedicated function to make
> > at803x_set_wol more generic.
> >
> > This is needed in preparation for PHY driver split as qca8081 share the
> > same function to toggle WOL settings.
> >
> > In this new implementation WOL module in at8031 is enabled after the
> > generic interrupt is setup. This should not cause any problem as the
> > WOL_INT has a separate implementation and only relay on MAC bits.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> > drivers/net/phy/at803x.c | 42 ++++++++++++++++++++++++----------------
> > 1 file changed, 25 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> > index 02ac71f98466..2de7a59c0faa 100644
> > --- a/drivers/net/phy/at803x.c
> > +++ b/drivers/net/phy/at803x.c
> > @@ -466,27 +466,11 @@ static int at803x_set_wol(struct phy_device *phydev,
> > phy_write_mmd(phydev, MDIO_MMD_PCS, offsets[i],
> > mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
> >
> > - /* Enable WOL function for 1588 */
> > - if (phydev->drv->phy_id == ATH8031_PHY_ID) {
> > - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
> > - AT803X_PHY_MMD3_WOL_CTRL,
> > - 0, AT803X_WOL_EN);
> > - if (ret)
> > - return ret;
> > - }
> > /* Enable WOL interrupt */
> > ret = phy_modify(phydev, AT803X_INTR_ENABLE, 0, AT803X_INTR_ENABLE_WOL);
> > if (ret)
> > return ret;
> > } else {
> > - /* Disable WoL function for 1588 */
> > - if (phydev->drv->phy_id == ATH8031_PHY_ID) {
> > - ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
> > - AT803X_PHY_MMD3_WOL_CTRL,
> > - AT803X_WOL_EN, 0);
> > - if (ret)
> > - return ret;
> > - }
> > /* Disable WOL interrupt */
> > ret = phy_modify(phydev, AT803X_INTR_ENABLE, AT803X_INTR_ENABLE_WOL, 0);
> > if (ret)
> > @@ -1611,6 +1595,30 @@ static int at8031_config_init(struct phy_device *phydev)
> > return at803x_config_init(phydev);
> > }
> >
> > +static int at8031_set_wol(struct phy_device *phydev,
> > + struct ethtool_wolinfo *wol)
> > +{
> > + int ret;
> > +
> > + /* First setup MAC address and enable WOL interrupt */
> > + ret = at803x_set_wol(phydev, wol);
> > + if (ret)
> > + return ret;
> > +
> > + if (wol->wolopts & WAKE_MAGIC)
> > + /* Enable WOL function for 1588 */
> > + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
> > + AT803X_PHY_MMD3_WOL_CTRL,
> > + 0, AT803X_WOL_EN);
> > + else
> > + /* Disable WoL function for 1588 */
> > + ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
> > + AT803X_PHY_MMD3_WOL_CTRL,
> > + AT803X_WOL_EN, 0);
> > +
> > + return ret;
>
> If I read correctly, the above changes the order of some WoL
> initialization steps: now WOL_CTRL is touched after
> AT803X_INTR_ENABLE_WOL. Is that correct?
It is fine.
AT803X_INTR_ENABLE_WOL enables or disables whether the INT pin (which
is used for any interrupt from the PHY) is used to signal WOL - it's
the interrupt enable for the WoL function.
The MMD3 WOL_EN bit controls whether the WoL function is enabled, and
thus whether the WOL_INT pin will signal WoL. WOL_EN should not be
set until we have initialised the WoL function, and thus that needs
to happen _after_ the MAC address has been programmed.
Clearing WOL_EN afterwards is not a problem because it will already
have been setup, or is in its power-on default state.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2023-12-05 14:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 0:14 [net-next PATCH v2 00/12] net: phy: at803x: cleanup Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 01/12] net: phy: at803x: fix passing the wrong reference for config_intr Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 02/12] net: phy: at803x: move disable WOL to specific at8031 probe Christian Marangi
2023-12-06 17:09 ` Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 03/12] net: phy: at803x: raname hw_stats functions to qca83xx specific name Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 04/12] net: phy: at803x: move qca83xx specific check in dedicated functions Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 05/12] net: phy: at803x: move specific DT option for at8031 to specific probe Christian Marangi
2023-12-06 17:11 ` Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 06/12] net: phy: at803x: move specific at8031 probe mode check to dedicated probe Christian Marangi
2023-12-06 17:15 ` Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 07/12] net: phy: at803x: move specific at8031 config_init to dedicated function Christian Marangi
2023-12-06 17:16 ` Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 08/12] net: phy: at803x: move specific at8031 WOL bits " Christian Marangi
2023-12-05 9:32 ` Paolo Abeni
2023-12-05 14:43 ` Christian Marangi
2023-12-05 14:58 ` Russell King (Oracle) [this message]
2023-12-01 0:14 ` [net-next PATCH v2 09/12] net: phy: at803x: move specific at8031 config_intr " Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 10/12] net: phy: at803x: make at8031 related DT functions name more specific Christian Marangi
2023-12-06 17:23 ` Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 11/12] net: phy: at803x: move at8035 specific DT parse to dedicated probe Christian Marangi
2023-12-06 17:25 ` Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 12/12] net: phy: at803x: drop specific PHY ID check from cable test functions Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 12/12] net: phy: at803x: drop specific PHY id " Christian Marangi
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=ZW86hcgt8nhbSpfq@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.