Skip to content

Commit 9119570

Browse files
limeng-linuxdavem330
authored andcommitted
net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform
According to upstream commit 5ec5582("net: stmmac: add clocks management for gmac driver"), it improve clocks management for stmmac driver. So, it is necessary to implement the runtime callback in dwmac-socfpga driver because it doesn't use the common stmmac_pltfr_pm_ops instance. Otherwise, clocks are not disabled when system enters suspend status. Fixes: 5ec5582 ("net: stmmac: add clocks management for gmac driver") Cc: [email protected] Signed-off-by: Meng Li <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b06cf78 commit 9119570

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,28 @@ static int socfpga_dwmac_resume(struct device *dev)
485485
}
486486
#endif /* CONFIG_PM_SLEEP */
487487

488-
static SIMPLE_DEV_PM_OPS(socfpga_dwmac_pm_ops, stmmac_suspend,
489-
socfpga_dwmac_resume);
488+
static int __maybe_unused socfpga_dwmac_runtime_suspend(struct device *dev)
489+
{
490+
struct net_device *ndev = dev_get_drvdata(dev);
491+
struct stmmac_priv *priv = netdev_priv(ndev);
492+
493+
stmmac_bus_clks_config(priv, false);
494+
495+
return 0;
496+
}
497+
498+
static int __maybe_unused socfpga_dwmac_runtime_resume(struct device *dev)
499+
{
500+
struct net_device *ndev = dev_get_drvdata(dev);
501+
struct stmmac_priv *priv = netdev_priv(ndev);
502+
503+
return stmmac_bus_clks_config(priv, true);
504+
}
505+
506+
static const struct dev_pm_ops socfpga_dwmac_pm_ops = {
507+
SET_SYSTEM_SLEEP_PM_OPS(stmmac_suspend, socfpga_dwmac_resume)
508+
SET_RUNTIME_PM_OPS(socfpga_dwmac_runtime_suspend, socfpga_dwmac_runtime_resume, NULL)
509+
};
490510

491511
static const struct socfpga_dwmac_ops socfpga_gen5_ops = {
492512
.set_phy_mode = socfpga_gen5_set_phy_mode,

0 commit comments

Comments
 (0)