{
struct stmmac_priv *priv = netdev_priv(ndev);
unsigned long flags;
+ bool pwr_off_phy = false;
+ struct bsp_priv * bsp_priv = NULL;
if (!ndev || !netif_running(ndev))
return 0;
stmmac_set_mac(priv->ioaddr, false);
/* Disable clock in case of PWM is off */
if ((priv->plat) && (priv->plat->bsp_priv)) {
- struct bsp_priv * bsp_priv = priv->plat->bsp_priv;
- if (bsp_priv) {
- if (bsp_priv->gmac_clk_enable) {
- bsp_priv->gmac_clk_enable(false);
- }
- if (bsp_priv->phy_power_on) {
- bsp_priv->phy_power_on(false);
- }
+ bsp_priv = priv->plat->bsp_priv;
+ pwr_off_phy = true;
+ if (bsp_priv && bsp_priv->gmac_clk_enable) {
+ bsp_priv->gmac_clk_enable(false);
}
}
}
spin_unlock_irqrestore(&priv->lock, flags);
+
+ if (pwr_off_phy && bsp_priv) {
+ if (bsp_priv->phy_power_on) {
+ bsp_priv->phy_power_on(false);
+ }
+ }
+
return 0;
}
{
struct stmmac_priv *priv = netdev_priv(ndev);
unsigned long flags;
+ bool pwr_on_phy = false;
+ struct bsp_priv * bsp_priv = NULL;
if (!netif_running(ndev))
return 0;
priv->hw->mac->pmt(priv->ioaddr, 0);
else {
/* enable the clk prevously disabled */
- if ((priv->plat) && (priv->plat->bsp_priv)) {
- struct bsp_priv * bsp_priv = priv->plat->bsp_priv;
- if (bsp_priv) {
- if (bsp_priv->gmac_clk_enable) {
- bsp_priv->gmac_clk_enable(true);
- }
- if (bsp_priv->phy_power_on) {
- bsp_priv->phy_power_on(true);
- }
+ if (priv->plat && (priv->plat->bsp_priv)) {
+ bsp_priv = priv->plat->bsp_priv;
+ if (bsp_priv && bsp_priv->gmac_clk_enable) {
+ bsp_priv->gmac_clk_enable(true);
}
+
+ pwr_on_phy = true;
}
}
spin_unlock_irqrestore(&priv->lock, flags);
+ if (pwr_on_phy && bsp_priv) {
+ if (bsp_priv->phy_power_on) {
+ bsp_priv->phy_power_on(true);
+ }
+ }
+
if (priv->phydev)
phy_start(priv->phydev);