Skip to content

Commit

Permalink
net: phy: smsc: fix link up detection in forced irq mode
Browse files Browse the repository at this point in the history
[ Upstream commit 58aac3a ]

Currently link up can't be detected in forced mode if polling
isn't used. Only link up interrupt source we have is aneg
complete which isn't applicable in forced mode. Therefore we
have to use energy-on as link up indicator.

Fixes: 7365494 ("net: phy: smsc: skip ENERGYON interrupt if disabled")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
hkallweit authored and gregkh committed Mar 17, 2023
1 parent 1f11641 commit 581aad9
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions drivers/net/phy/smsc.c
Expand Up @@ -44,7 +44,6 @@ static struct smsc_hw_stat smsc_hw_stats[] = {
};

struct smsc_phy_priv {
u16 intmask;
bool energy_enable;
};

Expand All @@ -57,22 +56,16 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev)

static int smsc_phy_config_intr(struct phy_device *phydev)
{
struct smsc_phy_priv *priv = phydev->priv;
int rc;

if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
rc = smsc_phy_ack_interrupt(phydev);
if (rc)
return rc;

priv->intmask = MII_LAN83C185_ISF_INT4 | MII_LAN83C185_ISF_INT6;
if (priv->energy_enable)
priv->intmask |= MII_LAN83C185_ISF_INT7;

rc = phy_write(phydev, MII_LAN83C185_IM, priv->intmask);
rc = phy_write(phydev, MII_LAN83C185_IM,
MII_LAN83C185_ISF_INT_PHYLIB_EVENTS);
} else {
priv->intmask = 0;

rc = phy_write(phydev, MII_LAN83C185_IM, 0);
if (rc)
return rc;
Expand All @@ -85,7 +78,6 @@ static int smsc_phy_config_intr(struct phy_device *phydev)

static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)
{
struct smsc_phy_priv *priv = phydev->priv;
int irq_status;

irq_status = phy_read(phydev, MII_LAN83C185_ISF);
Expand All @@ -96,7 +88,7 @@ static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)
return IRQ_NONE;
}

if (!(irq_status & priv->intmask))
if (!(irq_status & MII_LAN83C185_ISF_INT_PHYLIB_EVENTS))
return IRQ_NONE;

phy_trigger_machine(phydev);
Expand Down

0 comments on commit 581aad9

Please sign in to comment.