public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Claudiu <claudiu.beznea@tuxon.dev>,
	hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, yuiko.oshino@microchip.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH net] net: phy: micrel: populate .soft_reset for KSZ9131
Date: Fri, 5 Jan 2024 15:36:29 +0100	[thread overview]
Message-ID: <a2651f98-b598-4a05-9e05-d2912eeb55d2@lunn.ch> (raw)
In-Reply-To: <ZZfPOky2p/ZJMKCQ@shell.armlinux.org.uk>

On Fri, Jan 05, 2024 at 09:43:22AM +0000, Russell King (Oracle) wrote:
> On Fri, Jan 05, 2024 at 10:52:42AM +0200, Claudiu wrote:
> > The order of PHY-related operations in ravb_open() is as follows:
> > ravb_open() ->
> >   ravb_phy_start() ->
> >     ravb_phy_init() ->
> >       of_phy_connect() ->
> >         phy_connect_direct() ->
> > 	  phy_attach_direct() ->
> > 	    phy_init_hw() ->
> > 	      phydev->drv->soft_reset()
> > 	      phydev->drv->config_init()
> > 	      phydev->drv->config_intr()
> > 	    phy_resume()
> > 	      kszphy_resume()
> > 
> > The order of PHY-related operations in ravb_close is as follows:
> > ravb_close() ->
> >   phy_stop() ->
> >     phy_suspend() ->
> >       kszphy_suspend() ->
> >         genphy_suspend()
> > 	  // set BMCR_PDOWN bit in MII_BMCR
> 
> Andrew,
> 
> This looks wrong to me - shouldn't we be resuming the PHY before
> attempting to configure it?

Hummm. The opposite of phy_stop() is phy_start(). So it would be the
logical order to perform the resume as the first action of
phy_start(), not phy_attach_direct().

In phy_connect_direct(), we don't need the PHY to be operational
yet. That happens with phy_start().

The standard says:

  22.2.4.1.5 Power down

  The PHY may be placed in a low-power consumption state by setting
  bit 0.11 to a logic one. Clearing bit 0.11 to zero allows normal
  operation. The specific behavior of a PHY in the power-down state is
  implementation specific. While in the power-down state, the PHY
  shall respond to management transactions.

So i would say this PHY is broken, its not responding to all
management transactions. So in that respect, Claudiu fix is correct.

But i also somewhat agree with you, this looks wrong, but in a
different way to how you see it. However, moving the phy_resume() to
phy_start() seems a bit risky. So i'm not sure we should actually do
that.

	Andrew

  reply	other threads:[~2024-01-05 14:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05  8:52 [PATCH net] net: phy: micrel: populate .soft_reset for KSZ9131 Claudiu
2024-01-05  9:43 ` Russell King (Oracle)
2024-01-05 14:36   ` Andrew Lunn [this message]
2024-01-05 15:53     ` Maxime Chevallier
2024-01-10 13:20     ` claudiu beznea
2024-01-12  1:30       ` Andrew Lunn
2024-01-05  9:43 ` Maxime Chevallier
2024-01-12 11:10 ` patchwork-bot+netdevbpf

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=a2651f98-b598-4a05-9e05-d2912eeb55d2@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yuiko.oshino@microchip.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox