Subject: Re: [PATCH net] net: phy: smsc: Disable Energy Detect Power-Down in interrupt mode

From: Lukas Wunner <[email-masked]>
Date: Mon, 20 Jun 2022 21:33:18 +0200

On Mon, Jun 20, 2022 at 10:03:26AM -0700, Florian Fainelli wrote:
> On 6/20/22 04:04, Lukas Wunner wrote:
> > --- a/drivers/net/phy/smsc.c
> > +++ b/drivers/net/phy/smsc.c
> > @@ -110,7 +110,7 @@ static int smsc_phy_config_init(struct phy_device *phydev)
> >   	struct smsc_phy_priv *priv = phydev->priv;
> >   	int rc;
> > -	if (!priv->energy_enable)
> > +	if (!priv->energy_enable || phydev->irq != PHY_POLL)
> 
> phy_interrupt_is_valid() may be more appropriate, since you are assuming
> that you either have PHY_POLL or valid "external" PHY interrupt but there is
> also the special case of PHY_MAC_INTERRUPT that is not dealt with.

I deliberately disable EDPD for PHY_MAC_INTERRUPT as well.

That's a proper interrupt, i.e. the PHY signals interrupts
to the MAC (e.g. through an interrupt pin on the MAC),
which forwards the interrupts to phylib.  EDPD cannot
be used in that situation either.

> > @@ -217,7 +219,7 @@ static int lan87xx_read_status(struct phy_device *phydev)
> >   	int err = genphy_read_status(phydev);
> > -	if (!phydev->link && priv->energy_enable) {
> > +	if (!phydev->link && priv->energy_enable && phydev->irq == PHY_POLL) {
> 
> phy_polling_mode()?

Personally I think checking for PHY_POLL is succinct,
but if you or anyone else feels strongly about it
I'll be happy to add such a static inline to
include/linux/phy.h.

Thanks,

Lukas