static int socfpga_dwmac_resume(struct device *dev) { struct net_device *ndev = dev_get_drvdata(dev); struct stmmac_priv *priv = netdev_priv(ndev); socfpga_dwmac_set_phy_mode(priv->plat->bsp_priv); /* Before the enet controller is suspended, the phy is suspended. * This causes the phy clock to be gated. The enet controller is * resumed before the phy, so the clock is still gated "off" when * the enet controller is resumed. This code makes sure the phy * is "resumed" before reinitializing the enet controller since * the enet controller depends on an active phy clock to complete * a DMA reset. A DMA reset will "time out" if executed * with no phy clock input on the Synopsys enet controller. * Verified through Synopsys Case #8000711656. * * Note that the phy clock is also gated when the phy is isolated. * Phy "suspend" and "isolate" controls are located in phy basic * control register 0, and can be modified by the phy driver * framework. */ if (priv->phydev) phy_resume(priv->phydev); return stmmac_resume(dev); }
int dsa_slave_resume(struct net_device *slave_dev) { struct dsa_slave_priv *p = netdev_priv(slave_dev); netif_device_attach(slave_dev); if (p->phy) { phy_resume(p->phy); phy_start(p->phy); } return 0; }
static int socfpga_dwmac_init(struct platform_device *pdev, void *priv) { struct socfpga_dwmac *dwmac = priv; struct net_device *ndev = platform_get_drvdata(pdev); struct stmmac_priv *stpriv = NULL; int ret = 0; if (ndev) stpriv = netdev_priv(ndev); /* Assert reset to the enet controller before changing the phy mode */ if (dwmac->stmmac_rst) reset_control_assert(dwmac->stmmac_rst); /* Setup the phy mode in the system manager registers according to * devicetree configuration */ ret = socfpga_dwmac_setup(dwmac); /* Deassert reset for the phy configuration to be sampled by * the enet controller, and operation to start in requested mode */ if (dwmac->stmmac_rst) reset_control_deassert(dwmac->stmmac_rst); /* Before the enet controller is suspended, the phy is suspended. * This causes the phy clock to be gated. The enet controller is * resumed before the phy, so the clock is still gated "off" when * the enet controller is resumed. This code makes sure the phy * is "resumed" before reinitializing the enet controller since * the enet controller depends on an active phy clock to complete * a DMA reset. A DMA reset will "time out" if executed * with no phy clock input on the Synopsys enet controller. * Verified through Synopsys Case #8000711656. * * Note that the phy clock is also gated when the phy is isolated. * Phy "suspend" and "isolate" controls are located in phy basic * control register 0, and can be modified by the phy driver * framework. */ if (stpriv && stpriv->phydev) phy_resume(stpriv->phydev); return ret; }
static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en) { int err; if (en) { /* Doing phy loopback in offline state, phy resuming is * needed to power up the device. */ err = phy_resume(phy_dev); if (err) goto out; err = phy_loopback(phy_dev, true); } else { err = phy_loopback(phy_dev, false); if (err) goto out; err = phy_suspend(phy_dev); } out: return err; }