Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52f95bbf authored by Giuseppe CAVALLARO's avatar Giuseppe CAVALLARO Committed by David S. Miller
Browse files

stmmac: fix adjust link call in case of a switch is attached



While initializing the phy, the stmmac driver sets the
PHY_IGNORE_INTERRUPT so the PAL won't call the adjust hook
that is needed, on some platforms, e.g. STi, to invoke the glue.

The patch allows the PAL to poll the stmmac_adjust_link just one time
in case of a switch is attached, setting later the PHY_IGNORE_INTERRUPT
flag.
Moving this kind of logic inside the adjust_link it makes sense to
anticipate the check for EEE that will never initialized in this
scenario.

Reported-by: default avatarGabriel Fernandez <gabriel.fernandez@linaro.org>
Signed-off-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
Tested-by: default avatarGabriel Fernandez <gabriel.fernandez@linaro.org>
Cc: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6ae81ced
Loading
Loading
Loading
Loading
+10 −12
Original line number Original line Diff line number Diff line
@@ -288,10 +288,6 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
	    (priv->pcs == STMMAC_PCS_RTBI))
	    (priv->pcs == STMMAC_PCS_RTBI))
		goto out;
		goto out;


	/* Never init EEE in case of a switch is attached */
	if (priv->phydev->is_pseudo_fixed_link)
		goto out;

	/* MAC core supports the EEE feature. */
	/* MAC core supports the EEE feature. */
	if (priv->dma_cap.eee) {
	if (priv->dma_cap.eee) {
		int tx_lpi_timer = priv->tx_lpi_timer;
		int tx_lpi_timer = priv->tx_lpi_timer;
@@ -771,8 +767,14 @@ static void stmmac_adjust_link(struct net_device *dev)


	spin_unlock_irqrestore(&priv->lock, flags);
	spin_unlock_irqrestore(&priv->lock, flags);


	/* At this stage, it could be needed to setup the EEE or adjust some
	if (phydev->is_pseudo_fixed_link)
	 * MAC related HW registers.
		/* Stop PHY layer to call the hook to adjust the link in case
		 * of a switch is attached to the stmmac driver.
		 */
		phydev->irq = PHY_IGNORE_INTERRUPT;
	else
		/* At this stage, init the EEE if supported.
		 * Never called in case of fixed_link.
		 */
		 */
		priv->eee_enabled = stmmac_eee_init(priv);
		priv->eee_enabled = stmmac_eee_init(priv);
}
}
@@ -865,10 +867,6 @@ static int stmmac_init_phy(struct net_device *dev)
		return -ENODEV;
		return -ENODEV;
	}
	}


	/* If attached to a switch, there is no reason to poll phy handler */
	if (phydev->is_pseudo_fixed_link)
		phydev->irq = PHY_IGNORE_INTERRUPT;

	pr_debug("stmmac_init_phy:  %s: attached to PHY (UID 0x%x)"
	pr_debug("stmmac_init_phy:  %s: attached to PHY (UID 0x%x)"
		 " Link = %d\n", dev->name, phydev->phy_id, phydev->link);
		 " Link = %d\n", dev->name, phydev->phy_id, phydev->link);