Skip to content

Commit 2642cc6

Browse files
l1kkuba-moo
authored andcommitted
net: phy: smsc: Disable Energy Detect Power-Down in interrupt mode
Simon reports that if two LAN9514 USB adapters are directly connected without an intermediate switch, the link fails to come up and link LEDs remain dark. The issue was introduced by commit 1ce8b37 ("usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling"). The PHY suffers from a known erratum wherein link detection becomes unreliable if Energy Detect Power-Down is used. In poll mode, the driver works around the erratum by briefly disabling EDPD for 640 msec to detect a neighbor, then re-enabling it to save power. In interrupt mode, no interrupt is signaled if EDPD is used by both link partners, so it must not be enabled at all. We'll recoup the power savings by enabling SUSPEND1 mode on affected LAN95xx chips in a forthcoming commit. Fixes: 1ce8b37 ("usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling") Reported-by: Simon Han <[email protected]> Signed-off-by: Lukas Wunner <[email protected]> Link: https://lore.kernel.org/r/439a3f3168c2f9d44b5fd9bb8d2b551711316be6.1655714438.git.lukas@wunner.de Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 69135c5 commit 2642cc6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/net/phy/smsc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static int smsc_phy_config_init(struct phy_device *phydev)
110110
struct smsc_phy_priv *priv = phydev->priv;
111111
int rc;
112112

113-
if (!priv->energy_enable)
113+
if (!priv->energy_enable || phydev->irq != PHY_POLL)
114114
return 0;
115115

116116
rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
@@ -210,14 +210,16 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev)
210210
* response on link pulses to detect presence of plugged Ethernet cable.
211211
* The Energy Detect Power-Down mode is enabled again in the end of procedure to
212212
* save approximately 220 mW of power if cable is unplugged.
213+
* The workaround is only applicable to poll mode. Energy Detect Power-Down may
214+
* not be used in interrupt mode lest link change detection becomes unreliable.
213215
*/
214216
static int lan87xx_read_status(struct phy_device *phydev)
215217
{
216218
struct smsc_phy_priv *priv = phydev->priv;
217219

218220
int err = genphy_read_status(phydev);
219221

220-
if (!phydev->link && priv->energy_enable) {
222+
if (!phydev->link && priv->energy_enable && phydev->irq == PHY_POLL) {
221223
/* Disable EDPD to wake up PHY */
222224
int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
223225
if (rc < 0)

0 commit comments

Comments
 (0)