From: Fabio Estevam <festevam@gmail.com>
To: kuba@kernel.org
Cc: andrew@lunn.ch, hkallweit1@gmail.com,
manfred.schlaegl@ginzinger.com, netdev@vger.kernel.org,
edumazet@google.com, pabeni@redhat.com, linux@armlinux.org.uk,
f.fainelli@gmail.com, Fabio Estevam <festevam@gmail.com>
Subject: [PATCH net] net: phy: smsc: Skip soft reset when a hardware reset GPIO is provided
Date: Sun, 16 Nov 2025 12:48:24 -0300 [thread overview]
Message-ID: <20251116154824.3799310-1-festevam@gmail.com> (raw)
On platforms using the LAN8720 in RMII mode, issuing a soft reset through
genphy_soft_reset() can temporarily disrupt the PHY output clock (REF_CLK).
Boards that source ENET_REF_CLK from the LAN8720 are therefore sensitive
to PHY soft resets, as the MAC receives an unstable or missing RMII clock
during the transition.
When a "reset-gpios" property is present, the MDIO core already performs a
hardware reset using this GPIO before calling the driver's ->reset() hook.
Issuing an additional soft reset in smsc_phy_reset() is redundant and may
result in RX CRC/frame errors, packet loss, and general link instability at
100 Mbps.
Change smsc_phy_reset() so that:
- If reset-gpios is present: rely solely on the hardware reset and skip
the soft reset.
- If reset-gpios is absent: fall back to genphy_soft_reset(), preserving
the existing behavior.
The soft reset to remove the PHY from power down is kept, as this is
a requirement mentioned in the LAN8720 datasheet.
This fixes packet loss observed on i.MX6 platforms using LAN8720 without
breaking boards that rely on the existing soft reset path.
Fixes: fc0f7e3317c5 ("net: phy: smsc: reintroduced unconditional soft reset")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
drivers/net/phy/smsc.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index 48487149c225..3840b658a996 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -54,6 +54,7 @@ struct smsc_phy_priv {
unsigned int edpd_mode_set_by_user:1;
unsigned int edpd_max_wait_ms;
bool wol_arp;
+ bool reset_gpio;
};
static int smsc_phy_ack_interrupt(struct phy_device *phydev)
@@ -136,6 +137,7 @@ EXPORT_SYMBOL_GPL(smsc_phy_config_init);
static int smsc_phy_reset(struct phy_device *phydev)
{
+ struct smsc_phy_priv *priv = phydev->priv;
int rc = phy_read(phydev, MII_LAN83C185_SPECIAL_MODES);
if (rc < 0)
return rc;
@@ -147,9 +149,17 @@ static int smsc_phy_reset(struct phy_device *phydev)
/* set "all capable" mode */
rc |= MII_LAN83C185_MODE_ALL;
phy_write(phydev, MII_LAN83C185_SPECIAL_MODES, rc);
+ /* reset the phy */
+ return genphy_soft_reset(phydev);
}
- /* reset the phy */
+ /* If the reset-gpios property exists, hardware reset will be
+ * performed by the MDIO core, so do NOT issue a soft reset here.
+ */
+ if (priv->reset_gpio)
+ return 0;
+
+ /* No reset GPIO found: fall back to soft reset */
return genphy_soft_reset(phydev);
}
@@ -671,6 +681,9 @@ int smsc_phy_probe(struct phy_device *phydev)
if (device_property_present(dev, "smsc,disable-energy-detect"))
priv->edpd_enable = false;
+ if (device_property_present(dev, "reset-gpios"))
+ priv->reset_gpio = true;
+
phydev->priv = priv;
/* Make clk optional to keep DTB backward compatibility. */
--
2.34.1
next reply other threads:[~2025-11-16 15:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-16 15:48 Fabio Estevam [this message]
2025-11-16 17:08 ` [PATCH net] net: phy: smsc: Skip soft reset when a hardware reset GPIO is provided Russell King (Oracle)
2025-11-16 22:11 ` Fabio Estevam
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=20251116154824.3799310-1-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=andrew@lunn.ch \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=manfred.schlaegl@ginzinger.com \
--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.