mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Lukasz Majewski <lukma@denx.de>
Subject: [PATCH] phy: smsc: Implement .aneg_done callback for LAN8720Ai
Date: Thu,  6 Apr 2023 15:11:27 +0200	[thread overview]
Message-ID: <20230406131127.383006-1-lukma@denx.de> (raw)

The LAN8720Ai has special bit (12) in the PHY SPECIAL
CONTROL/STATUS REGISTER (dec 31) to indicate if the
AutoNeg is finished.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 drivers/net/phy/smsc.c  | 8 ++++++++
 include/linux/smscphy.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index ac7481ce2fc1..58e5f06ef453 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -83,6 +83,13 @@ static int smsc_phy_config_intr(struct phy_device *phydev)
 	return rc < 0 ? rc : 0;
 }
 
+static int smsc_phy_aneg_done(struct phy_device *phydev)
+{
+	int rc = phy_read(phydev, MII_LAN83C185_PHY_CTRL_STS);
+
+	return rc & MII_LAN87XX_AUTODONE;
+}
+
 static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)
 {
 	struct smsc_phy_priv *priv = phydev->priv;
@@ -416,6 +423,7 @@ static struct phy_driver smsc_phy_driver[] = {
 	.config_init	= smsc_phy_config_init,
 	.soft_reset	= smsc_phy_reset,
 	.config_aneg	= lan95xx_config_aneg_ext,
+	.aneg_done      = smsc_phy_aneg_done,
 
 	/* IRQ related */
 	.config_intr	= smsc_phy_config_intr,
diff --git a/include/linux/smscphy.h b/include/linux/smscphy.h
index 1a136271ba6a..0debebe999d6 100644
--- a/include/linux/smscphy.h
+++ b/include/linux/smscphy.h
@@ -4,6 +4,7 @@
 
 #define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */
 #define MII_LAN83C185_IM  30 /* Interrupt Mask */
+#define MII_LAN83C185_PHY_CTRL_STS  31 /* PHY Special Control/Status Register */
 #define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */
 #define MII_LAN83C185_SPECIAL_MODES 18 /* Special Modes Register */
 
@@ -22,6 +23,7 @@
 	 MII_LAN83C185_ISF_INT7)
 
 #define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */
+#define MII_LAN87XX_AUTODONE    (1 << 12) /* AUTODONE */
 #define MII_LAN83C185_ENERGYON  (1 << 1)  /* ENERGYON */
 
 #define MII_LAN83C185_MODE_MASK      0xE0
-- 
2.20.1


             reply	other threads:[~2023-04-06 13:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 13:11 Lukasz Majewski [this message]
2023-04-06 13:48 ` Simon Horman
2023-04-06 14:19   ` Andrew Lunn
2023-04-12 11:25     ` Lukasz Majewski
2023-04-12 13:34       ` Andrew Lunn
2023-04-12 14:12         ` Lukasz Majewski
2023-04-12 13:47 ` 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=20230406131127.383006-1-lukma@denx.de \
    --to=lukma@denx.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®