netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francesco Dolcini <francesco.dolcini@toradex.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Francesco Dolcini <francesco.dolcini@toradex.com>,
	philippe.schenker@toradex.com, andrew@lunn.ch,
	qiangqing.zhang@nxp.com, davem@davemloft.net, festevam@gmail.com,
	kuba@kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next] net: phy: perform a PHY reset on resume
Date: Sat, 11 Dec 2021 15:57:54 +0100	[thread overview]
Message-ID: <20211211145754.GA360685@francesco-nb.int.toradex.com> (raw)
In-Reply-To: <YbSymkxlslW2DqLW@shell.armlinux.org.uk>

Hello,

On Sat, Dec 11, 2021 at 02:15:54PM +0000, Russell King (Oracle) wrote:
> I don't particularly like this - this impacts everyone who is using
> phylib at this point, whereas no reset was happening if the reset was
> already deasserted here.

I understand your concern, but I do not believe that this can create any
issue. The code should be able to handle the situation in which the PHY
is getting out of reset at that time.

> In the opening remarks to this series, it is stated:
> 
>   If a hardware-design is able to control power to the Ethernet PHY and
>   relying on software to do a reset, the PHY does no longer work after
>   resuming from suspend, given the PHY does need a hardware-reset.
> 
> This requirement is conditional on the hardware design, it isn't a
> universal requirement and won't apply everywhere. I think it needs to
> be described in firmware that this action is required. That said...
> 
> Please check the datasheet on the PHY regarding application of power and
> reset. You may find that the PHY datasheet requires the reset to be held
> active from power up until the clock input is stable - this could mean
> you need some other arrangement to assert the PHY reset signal after
> re-applying power sooner than would happen by the proposed point in the
> kernel.

I checked before sending this patch, the phy is a KSZ9131 [1] and
according to the power sequence timing  the reset should be toggled after
the power-up. No requirement on the clock or other signals.

The HW design is quite simple, we have a regulator controlling the PHY
power, and a GPIO controlling the reset. On suspend we remove the power
(FEC driver), on resume after enabling the power the PHY require a
reset, but nobody is doing it.

The issue here is that the phy regulator is handled by the FEC driver,
while the RESET_N GPIO can be controlled by both the FEC driver or the
phylib.
The initial proposal was to handle this into the FEC driver, but it was
not considered a good idea, therefore this new proposal.

One more comment about that, I do not believe that asserting the reset
in the suspend path is a good idea, in the general situation in which
the PHY is powered in suspend the power-consumption is likely to be
higher if the device is in reset compared to software power-down using
the BMCR register.

> universal requirement and won't apply everywhere. I think it needs to
> be described in firmware that this action is required. That said...
Are you thinking at a DTS property? Not sure to understand how do you
envision this. At the moment the regulator is not handled by the phylib,
and the property should be something like reset-on-resume, I guess ...

Francesco

[1] https://ww1.microchip.com/downloads/en/DeviceDoc/00002841C.pdf


  reply	other threads:[~2021-12-11 14:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 10:13 [RFC PATCH 0/2] Reset PHY in fec_resume if it got powered down Philippe Schenker
2021-12-06 10:13 ` [RFC PATCH 1/2] net: fec: make fec_reset_phy not only usable once Philippe Schenker
2021-12-06 13:13   ` Andrew Lunn
2021-12-06 10:13 ` [RFC PATCH 2/2] net: fec: reset phy in resume if it was powered down Philippe Schenker
2021-12-07  1:58 ` [RFC PATCH 0/2] Reset PHY in fec_resume if it got " Joakim Zhang
2021-12-10 13:51   ` Philippe Schenker
2021-12-11 13:01     ` [PATCH net-next] net: phy: perform a PHY reset on resume Francesco Dolcini
2021-12-11 14:15       ` Russell King (Oracle)
2021-12-11 14:57         ` Francesco Dolcini [this message]
2021-12-14 11:58         ` Francesco Dolcini
2021-12-13  4:40       ` Joakim Zhang
2021-12-13 10:57       ` Philippe Schenker
2021-12-13  4:39     ` [RFC PATCH 0/2] Reset PHY in fec_resume if it got powered down Joakim Zhang

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=20211211145754.GA360685@francesco-nb.int.toradex.com \
    --to=francesco.dolcini@toradex.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=festevam@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=philippe.schenker@toradex.com \
    --cc=qiangqing.zhang@nxp.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;
as well as URLs for NNTP newsgroup(s).