From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Subject: Re: [net-next PATCH 02/14] net: phy: at803x: move disable WOL for 8031 from probe to config
Date: Wed, 29 Nov 2023 11:09:55 +0000 [thread overview]
Message-ID: <ZWccA6Kjiz7/3F6R@shell.armlinux.org.uk> (raw)
In-Reply-To: <65671a75.050a0220.53874.4dd1@mx.google.com>
On Wed, Nov 29, 2023 at 12:03:14PM +0100, Christian Marangi wrote:
> On Wed, Nov 29, 2023 at 10:45:11AM +0000, Russell King (Oracle) wrote:
> > On Wed, Nov 29, 2023 at 10:36:31AM +0100, Christian Marangi wrote:
> > > On Wed, Nov 29, 2023 at 09:24:32AM +0000, Russell King (Oracle) wrote:
> > > > On Wed, Nov 29, 2023 at 03:12:07AM +0100, Christian Marangi wrote:
> > > > > Probe should be used only for DT parsing and allocate required priv, it
> > > > > shouldn't touch regs, there is config_init for that.
> > > >
> > > > I'm not sure where you get that idea from. PHY driver probe() functions
> > > > are permitted to access registers to do any setup that they wish to.
> > > >
> > > > config_init() is to configure the PHY for use with the network
> > > > interface.
> > > >
> > > > I think this patch is just noise rather than a cleanup.
> > > >
> > >
> > > I got it from here [1]
> > >
> > > Also on every other driver probe was always used for allocation and
> > > parsing so why deviates from this pattern here?
> >
> > Untrue.
> >
> > bcm54140_enable_monitoring() is called from bcm54140_probe_once()
> > which in turn is called from bcm54140_probe().
> >
> > dp83869_probe() calls dp83869_config_init(), rightly or wrongly.
> >
> > lxt973_probe() fixes up the BMCR.
> >
> > mv3310_probe() configures power-down modes, modifying registers.
> >
> > mt7988_phy_probe() calls mt7988_phy_fix_leds_polarities() which
> > modifies registers.
> >
> > lan8814_probe() calls lan8814_ptp_init() which does a whole load of
> > register writes.
> >
> > lan88xx_probe() configures LEDs via register writes.
> >
> > yt8521_probe() configures clocks via register modification.
> >
> > I'm afraid this means your comment is demonstrably false.
> >
>
> Don't want to start a discussion and thanks a lot for pointing this
> out. This is really to talk about this and not contradict you.
>
> Yes it's not true, and I was wrong but still I watch other driver
> outside PHY and normally probe should not do that kind of stuff.
> (even the comments describing the use in phy.h doesn't say that it
> should be used for configuring the PHY only once on discovery)
>
> Watching some of the thing, I feel all of this is done in probe as it's
> not called again on software reset (as it will call config_init again).
>
> This looks like there is a missing feature here and maybe a chance to
> improve this?
>
> Wonder if adding an additional OP would be beneficial to this?
> Was thinking to something like
>
> .config_once ?
>
> And add some comments that it's called only on PHY discovery?
> It would be put right after the probe call in phy_core.
>
> > > Also I think it was wrong from the start as on reset I think WoL is
> > > not disabled again. (probe is not called)
> >
> > On hardware reset, the 1588 register will re-enable the WoL pin, but
> > that needs a hardware reset of the PHY to happen after probe() is
> > called.
> >
> > However, phy_probe() will only assert the reset signal _if_ an error
> > occured during probing, not if probing was successful. So, a successful
> > probe of this driver will not cause a hardware reset.
> >
> > Also, hardware reset is optional. Do you know whether the platforms
> > that use the separate WoL pin which this 1588 register controls also
> > wire the reset signal such that it can be controlled by Linux?
> > Probably not.
> >
> > So, this register write will not be cleared by a hardware reset after
> > a successful probe.
> >
>
> I just checked Datasheet, on HW reset it's enabled again and on SW reset
> value is retained. So yes it must stay in probe as it will cause side
> effect if WoL get enabled after... Really hope the config_once thing is
> OK since it will make things much cleaner.
The phylib comment deviates from standard practice elsewhere in the
kernel, where it is totally fine to do hardware setup in the probe()
function. So I would suggest just updating the comment on probe() to
remove the idea that one shouldn't be doing this. I think it's totally
fine to be doing setup in probe().
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2023-11-29 11:10 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 2:12 [net-next PATCH 00/14] net: phy: at803x: cleanup + split Christian Marangi
2023-11-29 2:12 ` [net-next PATCH 01/14] net: phy: at803x: fix passing the wrong reference for config_intr Christian Marangi
2023-11-30 14:50 ` Andrew Lunn
2023-11-29 2:12 ` [net-next PATCH 02/14] net: phy: at803x: move disable WOL for 8031 from probe to config Christian Marangi
2023-11-29 9:24 ` Russell King (Oracle)
2023-11-29 9:36 ` Christian Marangi
2023-11-29 10:45 ` Russell King (Oracle)
2023-11-29 11:03 ` Christian Marangi
2023-11-29 11:09 ` Russell King (Oracle) [this message]
2023-11-30 14:58 ` Andrew Lunn
2023-11-29 2:12 ` [net-next PATCH 03/14] net: phy: at803x: raname hw_stats functions to qca83xx specific name Christian Marangi
2023-11-30 14:59 ` Andrew Lunn
2023-11-29 2:12 ` [net-next PATCH 04/14] net: phy: at803x: move qca83xx stats out of generic at803x_priv struct Christian Marangi
2023-11-29 9:29 ` Russell King (Oracle)
2023-11-29 9:38 ` Christian Marangi
2023-11-30 15:09 ` Andrew Lunn
2023-11-29 2:12 ` [net-next PATCH 05/14] net: phy: at803x: move qca83xx specific check in dedicated functions Christian Marangi
2023-11-30 15:14 ` Andrew Lunn
2023-11-29 2:12 ` [net-next PATCH 06/14] net: phy: at803x: move at8031 specific data out of generic at803x_priv Christian Marangi
2023-11-29 9:35 ` Russell King (Oracle)
2023-11-29 11:08 ` Christian Marangi
2023-11-29 11:31 ` Russell King (Oracle)
2023-11-30 15:21 ` Andrew Lunn
2023-11-30 19:38 ` Christian Marangi
2023-11-30 20:14 ` Andrew Lunn
2023-11-30 20:24 ` Christian Marangi
2023-11-29 2:12 ` [net-next PATCH 07/14] net: phy: at803x: move at8035 specific DT parse to dedicated probe Christian Marangi
2023-11-30 15:29 ` Andrew Lunn
2023-11-29 2:12 ` [net-next PATCH 08/14] net: phy: at803x: drop specific PHY id check from cable test functions Christian Marangi
2023-11-29 9:38 ` Russell King (Oracle)
2023-11-29 9:47 ` Christian Marangi
2023-11-29 10:57 ` Russell King (Oracle)
2023-11-29 11:04 ` Christian Marangi
2023-11-29 11:07 ` Russell King (Oracle)
2023-11-29 2:12 ` [net-next PATCH 09/14] net: phy: at803x: remove specific qca808x check from at803x functions Christian Marangi
2023-11-29 9:43 ` Russell King (Oracle)
2023-11-29 9:49 ` Christian Marangi
2023-11-29 2:12 ` [net-next PATCH 10/14] net: phy: at803x: drop usless probe for qca8081 PHY Christian Marangi
2023-11-29 9:44 ` Russell King (Oracle)
2023-11-29 9:51 ` Christian Marangi
2023-11-29 2:12 ` [net-next PATCH 11/14] net: phy: at803x: make specific status mask more generic Christian Marangi
2023-11-29 2:12 ` [net-next PATCH 12/14] net: phy: move at803x PHY driver to dedicated directory Christian Marangi
2023-11-29 2:12 ` [net-next PATCH 13/14] net: phy: qcom: deatch qca83xx PHY driver from at803x Christian Marangi
2023-11-29 9:53 ` Russell King (Oracle)
2023-11-29 10:37 ` Christian Marangi
2023-11-29 11:20 ` Russell King (Oracle)
2023-11-29 11:21 ` Christian Marangi
2023-11-29 2:12 ` [net-next PATCH 14/14] net: phy: qcom: detach qca808x " Christian Marangi
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=ZWccA6Kjiz7/3F6R@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=konrad.dybcio@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 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).