All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next 2/7] net: phy: smsc: add helper smsc_phy_config_edpd
Date: Sun, 2 Apr 2023 11:45:16 +0200	[thread overview]
Message-ID: <eaf837a8-20f2-6ed9-6819-e149097568e8@gmail.com> (raw)
In-Reply-To: <17fcccf5-8d81-298e-0671-d543340da105@gmail.com>

Add helper smsc_phy_config_edpd() and explicitly clear bit
MII_LAN83C185_EDPWRDOWN is edpd_enable isn't set.
Boot loader may have left whatever value.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/smsc.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index 928cf6d8b..1b588366e 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -77,6 +77,18 @@ int smsc_phy_config_intr(struct phy_device *phydev)
 }
 EXPORT_SYMBOL_GPL(smsc_phy_config_intr);
 
+static int smsc_phy_config_edpd(struct phy_device *phydev)
+{
+	struct smsc_phy_priv *priv = phydev->priv;
+
+	if (priv->edpd_enable)
+		return phy_set_bits(phydev, MII_LAN83C185_CTRL_STATUS,
+				    MII_LAN83C185_EDPWRDOWN);
+	else
+		return phy_clear_bits(phydev, MII_LAN83C185_CTRL_STATUS,
+				      MII_LAN83C185_EDPWRDOWN);
+}
+
 irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)
 {
 	int irq_status;
@@ -105,9 +117,7 @@ int smsc_phy_config_init(struct phy_device *phydev)
 	if (!priv || !priv->edpd_enable || phydev->irq != PHY_POLL)
 		return 0;
 
-	/* Enable energy detect power down mode */
-	return phy_set_bits(phydev, MII_LAN83C185_CTRL_STATUS,
-			    MII_LAN83C185_EDPWRDOWN);
+	return smsc_phy_config_edpd(phydev);
 }
 EXPORT_SYMBOL_GPL(smsc_phy_config_init);
 
-- 
2.40.0



  parent reply	other threads:[~2023-04-02  9:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-02  9:43 [PATCH net-next 0/7] net: phy: smsc: add support for edpd tunable Heiner Kallweit
2023-04-02  9:44 ` [PATCH net-next 1/7] net: phy: smsc: rename flag energy_enable Heiner Kallweit
2023-04-02  9:45 ` Heiner Kallweit [this message]
2023-04-02  9:45 ` [PATCH net-next 3/7] net: phy: smsc: clear edpd_enable if interrupt mode is used Heiner Kallweit
2023-04-02  9:46 ` [PATCH net-next 4/7] net: phy: smsc: add flag edpd_mode_set_by_user Heiner Kallweit
2023-04-02  9:47 ` [PATCH net-next 5/7] net: phy: smss: prepare for making edpd wait period configurable Heiner Kallweit
2023-04-02  9:47 ` [PATCH net-next 6/7] net: phy: smsc: add edpd tunable support Heiner Kallweit
2023-04-02 12:08   ` Simon Horman
2023-04-02 13:52     ` Heiner Kallweit
2023-04-02  9:48 ` [PATCH net-next 7/7] net: phy: smsc: enable " Heiner Kallweit
2023-04-02 14:00 ` [PATCH net-next 0/7] net: phy: smsc: add support for edpd tunable Florian Fainelli
2023-04-02 14:58   ` Heiner Kallweit
2023-04-02 23:33     ` Chris Healy

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=eaf837a8-20f2-6ed9-6819-e149097568e8@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --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 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.