All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Lukas Wunner <lukas@wunner.de>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Eric Dumazet <edumazet@google.com>,
	kernel@pengutronix.de, Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next v1 1/1] net: phy: ax88772a: fix lost pause advertisement configuration
Date: Sun, 26 Jun 2022 14:15:49 +0200	[thread overview]
Message-ID: <20220626121549.GA8725@pengutronix.de> (raw)
In-Reply-To: <YrgfsPq4lrYnSStk@lunn.ch>

On Sun, Jun 26, 2022 at 10:58:24AM +0200, Andrew Lunn wrote:
> On Sat, Jun 25, 2022 at 09:17:31AM +0200, Lukas Wunner wrote:
> > On Fri, Jun 24, 2022 at 09:55:58AM +0200, Oleksij Rempel wrote:
> > > In case of asix_ax88772a_link_change_notify() workaround, we run soft
> > > reset which will automatically clear MII_ADVERTISE configuration. The
> > > PHYlib framework do not know about changed configuration state of the
> > > PHY, so we need to save and restore all needed configuration registers.
> > [...]
> > >  static void asix_ax88772a_link_change_notify(struct phy_device *phydev)
> > >  {
> > >  	/* Reset PHY, otherwise MII_LPA will provide outdated information.
> > >  	 * This issue is reproducible only with some link partner PHYs
> > >  	 */
> > > -	if (phydev->state == PHY_NOLINK && phydev->drv->soft_reset)
> > > +	if (phydev->state == PHY_NOLINK && phydev->drv->soft_reset) {
> > > +		struct asix_context context;
> > > +
> > > +		asix_context_save(phydev, &context);
> > > +
> > >  		phydev->drv->soft_reset(phydev);
> > > +
> > > +		asix_context_restore(phydev, &context);
> > > +	}
> > >  }
> > 
> > Hm, how about just calling phy_init_hw()?  That will perform a
> > ->soft_reset() and also restore the configuration, including
> > interrupts (which the above does not, but I guess that's
> > irrelevant as long as the driver uses polling).
> > 
> > Does phy_init_hw() do too much or too little compared to the above
> > and is hence not a viable solution?
> 
> 
> at803x.c has:
> 
>         /* After changing the smart speed settings, we need to perform a
>          * software reset, use phy_init_hw() to make sure we set the
>          * reapply any values which might got lost during software reset.
>          */
>         if (ret == 1)
>                 ret = phy_init_hw(phydev);
> 

Hm, this is not enough to restore/reconfigure advertisement register.
Should I change PHY state to UP and trigger the state machine?

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

      reply	other threads:[~2022-06-26 12:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24  7:55 [PATCH net-next v1 1/1] net: phy: ax88772a: fix lost pause advertisement configuration Oleksij Rempel
2022-06-24  9:11 ` Oleksij Rempel
2022-06-25  7:17 ` Lukas Wunner
2022-06-26  8:58   ` Andrew Lunn
2022-06-26 12:15     ` Oleksij Rempel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220626121549.GA8725@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.