devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>, Rob Herring <robh+dt@kernel.org>
Cc: netdev <netdev@vger.kernel.org>,
	adam.rudzinski@arf.net.pl, Marco Felsch <m.felsch@pengutronix.de>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Richard Leitner <richard.leitner@skidata.com>,
	Dejin Zheng <zhengdejin5@gmail.com>,
	devicetree@vger.kernel.org, Sascha Hauer <kernel@pengutronix.de>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net-next 1/3] net: phy: Support enabling clocks prior to bus probe
Date: Thu, 3 Sep 2020 14:50:05 -0700	[thread overview]
Message-ID: <885abb40-cf1c-b464-bf09-08c7235410ef@gmail.com> (raw)
In-Reply-To: <20200903214238.GF3112546@lunn.ch>



On 9/3/2020 2:42 PM, Andrew Lunn wrote:
> On Thu, Sep 03, 2020 at 03:28:22PM -0600, Rob Herring wrote:
>> What if a device requires clocks enabled in a certain order or timing?
>> It's not just clocks, you could have some GPIOs or a regulator that
>> need enabling first. It's device specific, so really needs a per
>> device solution. This is not just an issue with MDIO. I think we
>> really need some sort of pre-probe hook in the driver model in order
>> to do any non-discoverable init for discoverable buses.
> 
> Hi Rob
> 
> How do you solve the chicken/egg of knowing what device specific init
> is needed before you can discover what device you have on the bus?

For MDIO since we have a fixed number of devices on the bus, we could 
pre-populate the MDIO map for all addresses, and free up the devices 
that we did not probe.

When using DT we can first parse the address, create a mdio_device 
there, and then turn on clocks/regulators/GPIOs whatever since we now 
have a device reference. Only then do we bind the device with its driver.

If we are using the DT scanning loop because the node did not provide a 
"reg" property, then the PHY must be in a functional state to be probed, 
we cannot guess what we do not know.

All of this uses MDIO implementation knowledge though.

> 
>> Or perhaps forcing probe when there are devices defined in DT if
>> they're not discovered by normal means.
> 
> The PHY subsystem has this. You came specify in DT the ID of the
> device which we would normally read during bus discovery. The correct
> driver is then loaded and probed. But it is good practice to avoid
> this. OEMs are known to change the PHY in order to perform cost
> optimisation. So we prefer to do discover and do the right thing if
> the PHY has changed.
> 
> As for GPIOS and regulators, i expect this code will expand pretty
> soon after being merged to handle those. There are users wanting
> it. We already have some standard properties defined, in terms of
> gpios, delay while off, delay after turning it on. As for ordering, i
> guess it would make sense to enable the clocks and then hit it with a
> reset? If there is a device which cannot be handled like this, it can
> always hard code its ID in device tree, and fully control its
> resources in the driver.
> 
> 	  Andrew
> 

-- 
Florian

  reply	other threads:[~2020-09-03 21:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  4:39 [PATCH net-next 0/3] net: phy: Support enabling clocks prior to bus probe Florian Fainelli
2020-09-03  4:39 ` [PATCH net-next 1/3] " Florian Fainelli
2020-09-03 20:39   ` Andrew Lunn
2020-09-03 21:25   ` Andrew Lunn
2020-09-03 21:28   ` Rob Herring
2020-09-03 21:42     ` Andrew Lunn
2020-09-03 21:50       ` Florian Fainelli [this message]
2020-09-03 21:43     ` Florian Fainelli
2020-09-03  4:39 ` [PATCH net-next 2/3] net: phy: mdio-bcm-unimac: Enable GPHY resources during bus reset Florian Fainelli
2020-09-03  4:39 ` [PATCH net-next 3/3] net: phy: bcm7xxx: request and manage GPHY clock Florian Fainelli
2020-09-04  6:15   ` Marco Felsch
2020-09-04 15:37     ` Florian Fainelli
2020-09-07  7:34       ` Marco Felsch
2020-09-07 19:07       ` Marco Felsch
2020-09-04  6:18   ` Marco Felsch
2020-09-04 15:38     ` Florian Fainelli
2020-09-07  7:37       ` Marco Felsch
2020-09-04  4:04 ` [PATCH net-next 0/3] net: phy: Support enabling clocks prior to bus probe Florian Fainelli
2020-09-04  6:19   ` Adam Rudziński
2020-09-04 13:45     ` Andrew Lunn
2020-09-04 14:00       ` Adam Rudziński
2020-09-04 14:23         ` Andrew Lunn
2020-09-04 17:21           ` Adam Rudziński
2020-09-04 13:58   ` Andrew Lunn

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=885abb40-cf1c-b464-bf09-08c7235410ef@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=adam.rudzinski@arf.net.pl \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=richard.leitner@skidata.com \
    --cc=robh+dt@kernel.org \
    --cc=zhengdejin5@gmail.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).