Skip to content

Commit ee1da69

Browse files
Christophe RoullierADESTM
authored andcommitted
net: stmmac: fix DMA error when resume with specific PHY
When suspend is performed, "Power down" cmd (PWD) is send to PHY BMCR register. Some phy (RTL8211F) cut RXC clock. And when resume is called we perform firstly SWR reset (in stmmac_hw_setup) and after with resume PHY (phy_start), this sequence is wrong because SWR is failed due to RXC off. This patch consist to resume firstly PHY and after we perform SWR reset Signed-off-by: Christophe Roullier <christophe.roullier@st.com> Change-Id: Id7b0c552c34b4e4a407c016fbcbd6e3f7080634d Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/141914 Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com> Reviewed-by: Christophe ROULLIER <christophe.roullier@st.com> Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com> Reviewed-by: Alexandre TORGUE <alexandre.torgue@st.com> Tested-by: Christophe ROULLIER <christophe.roullier@st.com>
1 parent c6b63cb commit ee1da69

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4488,9 +4488,6 @@ int stmmac_suspend(struct device *dev)
44884488
/* call carrier off first to avoid false dev_watchdog timeouts */
44894489
netif_carrier_off(ndev);
44904490

4491-
if (ndev->phydev)
4492-
phy_stop(ndev->phydev);
4493-
44944491
mutex_lock(&priv->lock);
44954492

44964493
netif_device_detach(ndev);
@@ -4516,6 +4513,10 @@ int stmmac_suspend(struct device *dev)
45164513
priv->oldlink = false;
45174514
priv->speed = SPEED_UNKNOWN;
45184515
priv->oldduplex = DUPLEX_UNKNOWN;
4516+
4517+
if (ndev->phydev)
4518+
phy_stop(ndev->phydev);
4519+
45194520
return 0;
45204521
}
45214522
EXPORT_SYMBOL_GPL(stmmac_suspend);
@@ -4608,6 +4609,9 @@ int stmmac_resume(struct device *dev)
46084609
goto init_error;
46094610
}
46104611

4612+
if (ndev->phydev)
4613+
phy_start(ndev->phydev);
4614+
46114615
stmmac_hw_setup(ndev, false);
46124616
stmmac_init_tx_coalesce(priv);
46134617
stmmac_set_rx_mode(ndev);
@@ -4618,9 +4622,6 @@ int stmmac_resume(struct device *dev)
46184622

46194623
mutex_unlock(&priv->lock);
46204624

4621-
if (ndev->phydev)
4622-
phy_start(ndev->phydev);
4623-
46244625
return 0;
46254626
init_error:
46264627
free_dma_desc_resources(priv);

0 commit comments

Comments
 (0)