[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230718083841.p67wflhjlwnu56j4@pengutronix.de>
Date: Tue, 18 Jul 2023 10:38:41 +0200
From: Marco Felsch <m.felsch@...gutronix.de>
To: Andrew Lunn <andrew@...n.ch>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
peppe.cavallaro@...com, alexandre.torgue@...s.st.com,
joabreu@...opsys.com, mcoquelin.stm32@...il.com,
netdev@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, kernel@...gutronix.de
Subject: Re: [PATCH net-next 2/2] net: stmmac: platform: add support for
phy-supply
On 23-07-18, Andrew Lunn wrote:
> > +static int stmmac_phy_power(struct platform_device *pdev,
> > + struct plat_stmmacenet_data *plat,
> > + bool enable)
> > +{
> > + struct regulator *regulator = plat->phy_regulator;
> > + int ret = 0;
> > +
> > + if (regulator) {
> > + if (enable)
> > + ret = regulator_enable(regulator);
> > + else
> > + regulator_disable(regulator);
> > + }
> > +
> > + if (ret)
> > + dev_err(&pdev->dev, "Fail to enable regulator\n");
>
> 'enable' is only correct 50% of the time.
You mean to move it under the enable path.
> > @@ -742,6 +786,8 @@ static int __maybe_unused stmmac_pltfr_suspend(struct device *dev)
> > if (priv->plat->exit)
> > priv->plat->exit(pdev, priv->plat->bsp_priv);
> >
> > + stmmac_phy_power_off(pdev, priv->plat);
> > +
>
> What about WOL? You probably want to leave the PHY with power in that
> case.
Good point didn't consider WOL. Is there a way to check if WOL is
enabled?
Regards,
Marco
>
> > @@ -757,6 +803,11 @@ static int __maybe_unused stmmac_pltfr_resume(struct device *dev)
> > struct net_device *ndev = dev_get_drvdata(dev);
> > struct stmmac_priv *priv = netdev_priv(ndev);
> > struct platform_device *pdev = to_platform_device(dev);
> > + int ret;
> > +
> > + ret = stmmac_phy_power_on(pdev, priv->plat);
> > + if (ret)
> > + return ret;
>
> And this needs to balance with _suspend when WOL is being used.
>
> Andrew
>
Powered by blists - more mailing lists