net: phy: smsc: skip ENERGYON interrupt if disabled
authorMarco Felsch <m.felsch@pengutronix.de>
Wed, 9 Sep 2020 13:44:57 +0000 (15:44 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Sep 2020 21:15:02 +0000 (14:15 -0700)
Don't enable the interrupt if the platform disable the energy detection
by "smsc,disable-energy-detect".

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/smsc.c

index 638e8c3d1f4a7fa639d5ef134f2c01b1607ecac7..19ab2821cff028c1819ae06d4a79a6c884a94baa 100644 (file)
@@ -48,10 +48,17 @@ struct smsc_phy_priv {
 
 static int smsc_phy_config_intr(struct phy_device *phydev)
 {
-       int rc = phy_write (phydev, MII_LAN83C185_IM,
-                       ((PHY_INTERRUPT_ENABLED == phydev->interrupts)
-                       ? MII_LAN83C185_ISF_INT_PHYLIB_EVENTS
-                       : 0));
+       struct smsc_phy_priv *priv = phydev->priv;
+       u16 intmask = 0;
+       int rc;
+
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               intmask = MII_LAN83C185_ISF_INT4 | MII_LAN83C185_ISF_INT6;
+               if (priv->energy_enable)
+                       intmask |= MII_LAN83C185_ISF_INT7;
+       }
+
+       rc = phy_write(phydev, MII_LAN83C185_IM, intmask);
 
        return rc < 0 ? rc : 0;
 }