From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Andrew Lunn <andrew@lunn.ch>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
devicetree <devicetree@vger.kernel.org>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Fabien Parent <fparent@baylibre.com>,
Iyappan Subramanian <iyappan@os.amperecomputing.com>,
Quan Nguyen <quan@os.amperecomputing.com>,
Frank Rowand <frowand.list@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Jakub Kicinski <kuba@kernel.org>,
Vivien Didelot <vivien.didelot@gmail.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Andrew Perepech <andrew.perepech@mediatek.com>,
Stephane Le Provost <stephane.leprovost@mediatek.com>,
Keyur Chudgar <keyur@os.amperecomputing.com>,
Jassi Brar <jaswinder.singh@linaro.org>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Mark Brown <broonie@kernel.org>,
"moderated list:ARM/Mediatek SoC..."
<linux-mediatek@lists.infradead.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
netdev <netdev@vger.kernel.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Pedro Tsai <pedro.tsai@mediatek.com>,
"David S . Miller" <davem@davemloft.net>,
Heiner Kallweit <hkallweit1@gmail.com>
Subject: Re: [PATCH 14/15] net: phy: add PHY regulator support
Date: Wed, 24 Jun 2020 19:12:19 +0100 [thread overview]
Message-ID: <20200624181218.GC1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200624165719.GB1551@shell.armlinux.org.uk>
On Wed, Jun 24, 2020 at 05:57:19PM +0100, Russell King - ARM Linux admin wrote:
> On Tue, Jun 23, 2020 at 06:27:06PM +0200, Bartosz Golaszewski wrote:
> > wt., 23 cze 2020 o 11:56 Russell King - ARM Linux admin
> > <linux@armlinux.org.uk> napisał(a):
> > >
> > > On Tue, Jun 23, 2020 at 11:46:15AM +0200, Bartosz Golaszewski wrote:
> > > > wt., 23 cze 2020 o 11:43 Russell King - ARM Linux admin
> > > > <linux@armlinux.org.uk> napisał(a):
> > > > >
> > > > > On Tue, Jun 23, 2020 at 11:41:11AM +0200, Bartosz Golaszewski wrote:
> > > > > > pon., 22 cze 2020 o 15:29 Russell King - ARM Linux admin
> > > > > > <linux@armlinux.org.uk> napisał(a):
> > > > > > >
> > > > > >
> > > > > > [snip!]
> > > > > >
> > > > > > >
> > > > > > > This is likely to cause issues for some PHY drivers. Note that we have
> > > > > > > some PHY drivers which register a temperature sensor in the probe
> > > > > > > function, which means they can be accessed independently of the lifetime
> > > > > > > of the PHY bound to the network driver (which may only be while the
> > > > > > > network device is "up".) We certainly do not want hwmon failing just
> > > > > > > because the network device is down.
> > > > > > >
> > > > > > > That's kind of worked around for the reset stuff, because there are two
> > > > > > > layers to that: the mdio device layer reset support which knows nothing
> > > > > > > of the PHY binding state to the network driver, and the phylib reset
> > > > > > > support, but it is not nice.
> > > > > > >
> > > > > >
> > > > > > Regulators are reference counted so if the hwmon driver enables it
> > > > > > using mdio_device_power_on() it will stay on even after the PHY driver
> > > > > > calls phy_device_power_off(), right? Am I missing something?
> > > > >
> > > > > If that is true, you will need to audit the PHY drivers to add that.
> > > > >
> > > >
> > > > This change doesn't have any effect on devices which don't have a
> > > > regulator assigned in DT though. The one I'm adding in the last patch
> > > > is the first to use this.
> > >
> > > It's quality of implementation.
> > >
> > > Should we wait for someone else to make use of the new regulator
> > > support that has been added with a PHY that uses hwmon, and they
> > > don't realise that it breaks hwmon on it, and several kernel versions
> > > go by without it being noticed. It will only be a noticable issue
> > > when the associated network device is down, and that network device
> > > driver detaches from the PHY, so _is_ likely not to be noticed.
> > >
> > > Or should we do a small amount of work now to properly implement
> > > regulator support, which includes a trivial grep for "hwmon" amongst
> > > the PHY drivers, and add the necessary call to avoid the regulator
> > > being shut off.
> > >
> >
> > I'm not sure what the correct approach is here. Provide some helper
> > that, when called, would increase the regulator's reference count even
> > more to keep it enabled from the moment hwmon is registered to when
> > the driver is detached?
>
> I think a PHY driver needs the utility to control this. We need to be
> careful here with naming, because phylib is not the only code in the
> kernel that uses the phy_ prefix.
>
> If we had runtime PM support for PHYs, with regulator support hooked
> into runtime PM, then we already have standard interfaces that drivers
> can use to control whether the device gets powered down.
Other ideas:
- using genpd outside of the SoC to provide power domain management.
This is already hooked into runtime PM, but would need their
agreement, a genpd provider written, and runtime PM added to phylib.
- if we're going for some core driver model approach, then the driver
model only knows when devices are bound and unbound to their driver,
it knows nothing of phylib's attach/detach from the network
interface. If we want to shut off power when a PHY is not attached,
we would likely need some kind of interface to do that.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-06-24 18:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200622093744.13685-1-brgl@bgdev.pl>
[not found] ` <20200622093744.13685-15-brgl@bgdev.pl>
[not found] ` <20200622132921.GI1551@shell.armlinux.org.uk>
[not found] ` <CAMRc=Me1r3Mzfg3-gTsGk4rEtvB=P9ESkn9q=c7z0Q=YQDsw2A@mail.gmail.com>
[not found] ` <20200623094252.GS1551@shell.armlinux.org.uk>
[not found] ` <CAMpxmJVP9db-4-AA4e1JkEfrajvJ4s0T6zo5+oFzpJHRBcuSsg@mail.gmail.com>
[not found] ` <20200623095646.GT1551@shell.armlinux.org.uk>
2020-06-23 16:27 ` [PATCH 14/15] net: phy: add PHY regulator support Bartosz Golaszewski
2020-06-24 16:57 ` Russell King - ARM Linux admin
2020-06-24 18:12 ` Russell King - ARM Linux admin [this message]
[not found] ` <20200622093744.13685-2-brgl@bgdev.pl>
2020-06-23 18:54 ` [PATCH 01/15] net: phy: arrange headers in mdio_bus.c alphabetically Florian Fainelli
[not found] ` <20200622093744.13685-3-brgl@bgdev.pl>
2020-06-23 18:56 ` [PATCH 02/15] net: phy: arrange headers in mdio_device.c alphabetically Florian Fainelli
[not found] ` <20200622093744.13685-4-brgl@bgdev.pl>
2020-06-23 18:57 ` [PATCH 03/15] net: phy: arrange headers in phy_device.c alphabetically Florian Fainelli
[not found] ` <20200622093744.13685-5-brgl@bgdev.pl>
2020-06-23 18:59 ` [PATCH 04/15] net: mdio: add a forward declaration for reset_control to mdio.h Florian Fainelli
[not found] ` <20200622093744.13685-6-brgl@bgdev.pl>
2020-06-23 19:14 ` [PATCH 05/15] net: phy: reset the PHY even if probe() is not implemented Florian Fainelli
2020-06-24 16:22 ` Bartosz Golaszewski
[not found] ` <20200622093744.13685-7-brgl@bgdev.pl>
2020-06-23 19:16 ` [PATCH 06/15] net: phy: mdio: reset MDIO devices " Florian Fainelli
[not found] ` <20200622093744.13685-13-brgl@bgdev.pl>
2020-06-23 19:39 ` [PATCH 12/15] dt-bindings: mdio: add phy-supply property to ethernet phy node Florian Fainelli
[not found] ` <20200622093744.13685-10-brgl@bgdev.pl>
[not found] ` <20200622133940.GL338481@lunn.ch>
[not found] ` <20200622135106.GK4560@sirena.org.uk>
2020-06-23 19:49 ` [PATCH 09/15] net: phy: delay PHY driver probe until PHY registration Florian Fainelli
2020-06-24 9:43 ` Mark Brown
2020-06-24 13:48 ` Bartosz Golaszewski
2020-06-24 16:06 ` Florian Fainelli
2020-06-24 16:35 ` Bartosz Golaszewski
2020-06-24 16:50 ` Russell King - ARM Linux admin
2020-06-24 18:59 ` Robin Murphy
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=20200624181218.GC1551@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew.perepech@mediatek.com \
--cc=andrew@lunn.ch \
--cc=bgolaszewski@baylibre.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=fparent@baylibre.com \
--cc=frowand.list@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=ilias.apalodimas@linaro.org \
--cc=iyappan@os.amperecomputing.com \
--cc=jaswinder.singh@linaro.org \
--cc=keyur@os.amperecomputing.com \
--cc=kuba@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pedro.tsai@mediatek.com \
--cc=quan@os.amperecomputing.com \
--cc=robh+dt@kernel.org \
--cc=stephane.leprovost@mediatek.com \
--cc=thomas.lendacky@amd.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@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).