Devicetree
 help / color / mirror / Atom feed
From: Daniel Thompson <daniel@riscstar.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	Alex Elder <elder@riscstar.com>,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com,
	maxime.chevallier@bootlin.com, rmk+kernel@armlinux.org.uk,
	andersson@kernel.org, konradybcio@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, linusw@kernel.org,
	brgl@kernel.org, arnd@arndb.de, gregkh@linuxfoundation.org,
	mohd.anwar@oss.qualcomm.com, a0987203069@gmail.com,
	alexandre.torgue@foss.st.com, ast@kernel.org,
	boon.khai.ng@altera.com, chenchuangyu@xiaomi.com,
	chenhuacai@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
	hkallweit1@gmail.com, inochiama@gmail.com,
	john.fastabend@gmail.com, julianbraha@gmail.com,
	livelycarpet87@gmail.com, matthew.gerlach@altera.com,
	mcoquelin.stm32@gmail.com, me@ziyao.cc,
	prabhakar.mahadev-lad.rj@bp.renesas.com,
	richardcochran@gmail.com, rohan.g.thomas@altera.com,
	sdf@fomichev.me, siyanteng@cqsoftware.com.cn,
	weishangjuan@eswincomputing.com, wens@kernel.org,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-gpio@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 12/12] arm64: dts: qcom: qcs6490-rb3gen2: enable TC9564 with a single QCS8081 phy
Date: Fri, 15 May 2026 15:42:09 +0100	[thread overview]
Message-ID: <agcwwRhXqKljob0m@aspen.lan> (raw)
In-Reply-To: <f113752b-b351-4a14-af6d-1e2751f0913d@lunn.ch>

On Thu, May 14, 2026 at 06:14:07PM +0200, Andrew Lunn wrote:
> > I’m afraid this must be necessarily long but to help navigate the
> > general structure is:
>
> Thanks for the long email.
>
> > Let’s turn our attention to MDIO.
> >
> > Following the pattern above where all the links related to power come
> > from the main device node, then the phy node for the qca8081 in an
> > rb3gen2 would look like something like this:
> >
> >     tc956x_emac1_phy: ethernet-phy@1c {
> >         compatible = "ethernet-phy-id004d.d101";
> >         reg = <0x1c>;
> >
> >         reset-gpios = <&tc956x_emac0 1 GPIO_ACTIVE_LOW>;
> >         # On RB3gen2 all supplies are controlled by a single GPIO
> >         # so we link all supplies to that single regulator
> >         avdd-supply = <&qep_1p8>;
> >         avdd18-supply = <&qep_1p8>;
> >         vdd-supply = <&qep_1p8>;
> >         vddldo-supply = <&qep_1p8>;
> >         vdd18-supply = <&qep_1p8>;
> >         vdd125-supply = <&qep_1p8>;
> >
> >         pinctrl-names = "default";
> >         pinctrl-0 = <&qep_irq_pin>;
> >         interrupts-extended = <&tlmm 101 IRQ_TYPE_LEVEL_LOW>;
> >     };

I nearly snipped this... but I referring to *-supplies so often below
I decided it was useful to keep it!


> > Once we have established what the DT looks like then the question
> > becomes where to put "something, written in C [or Rust], that contains
> > burned in knowledge of how to turn on a wcn6855^H^H^H^H^H^H^Hqca8081"?
> >
> > The qca8081 on rb3gen2 just gets a bunch of individual regulators and a
> > reset. As in the pci-pwrctrl-tc9563 example above, this means there is
> > nothing in the DT for a pwrseq driver to bind to.
>
> I don't understand that. We have a node in device tree for the PHY. We
> can put the needed properties there somehow.  Maybe similar to how
> pinctrl works. Before probing the device, the driver core looks for
> the pinctrl- properties, and activates them. We could have similar
> properties for power sequencing, before enumerating an address, do
> whatever the pwrseq-names requests? It might need help for the driver
> actually enumerating the bus, to point to core at the node.

pinctrl properties describe the relationship between the device and the
pin controller of its host. In the case above &qep_irq_pin it leads back
to something belonging to the pin controller.

Devicetree does have power domains and these are actually pretty similar
to pinctrl. power-domains properties are used to essentially used to
describe the relationship between the device and a power domain
controller.

However in this case power domains don't really fit. There is no power
domain controller to link to. Thus I'd still expect the phy power
supplies to be modelled in devicetree as I showed above.  pwrseq, PCI
and USB all adopt this approach for modelling onboard devices in DT.


> > Even if we could find
> > a way to do that, it is not obviously useful to decouple how to turn on
> > an MDIO device from how to drive it. Thus I think the right answer to
> > that is to put the code to fire up the regulators into the qca808x.c
> > driver and it looks to me like the existing probe/remove methods would
> > already work perfectly well as the place to put it.
>
> But you have a chicken/egg. Same as with PCI, with Ethernet PHYs, you
> ask the device what it is, and then find a driver to drive it, and
> then call the probe function. However, if its clock is off, its GPIO
> reset is held in reset, its power regulators are switch off, it never
> answers when you ask it, what are you? If you have no idea what it is,
> you cannot probe it. And if you cannot probe it, the probe function
> cannot turn all these things on.
>
> The standard reply we have is, ignore the fact the device can be
> enumerated, hard code in DT what its ID is. And that is what you have
> above in your DT fragment.

My comment above about it not being useful to decouple was very much
based on this "standard reply".

The *-supply properties will differ from phy to phy so we need the DT
to know what device is in order to supply the right properties. In other
words de-coupling the parsing of those supply properties (and anything
else) does not help MDIO with the chicken/egg problem.

However perhaps I was being a little shortsighted to say there are no
benefits (below).


> But you also need to live with the
> consequences of it being wrong, since that driver is going to be
> loaded, no questions asked. And don't think about having a rev A board
> and a rev B board which have different pin compatible PHYs, and want
> to use the enumeration to get the correct driver loaded.

Typically embedded platforms "solve" this by having a bootloader
retrieve the board revision (usually from whatever non-volatile storage
it keeps the mac address) and swap a status = "okay"/status =
"disabled" pair in the DT.

This is not great (hence quoting "solve") but it must also be added
that this approach does also work when the PHY isn't pin compatible and
needs to be powered up differently.


> DT developers continually want to make use of the enumeration feature,
> since it is there, part of 802.3, it is how it was done for the first
> 20 years of networking, etc. And they keep trying to extend the
> current code to get the PHY running to allow it to be enumerated.  And
> i keep rejecting it.

Has someone already tried to "sell" you on approach somewhat similar to
the onboard_usb_dev code?

onboard_usb_dev centralizes *all* knowledge of how to turn the regulators,
clocks, resets for all soldered down USB devices that need help to be
turned on. In the case of USB then it literally examines the list of
VID/PID pairs supported by onboard_usb_dev to decide whether to create
the platform device used to lubricate things.

This still relies on the "standard reply" meaning it doesn't solve the
chicken/egg and it doesn't avoid there being something written in C (or
Rust) that knows how to turn on devices. However it does do is move
the churn associated with enabling a new USB on an embedded platform
out of the USB drivers and into a single centralized place.

With the embedded churn on one place stops "embedded crap" from creeping
through the all the drivers. I suspect is also much easier to divide
review/maintenance responsibilities.

FWIW I think the relatively simple structure of the MDIO bus means we
don't actually have to mess about with platform devices. I think one
might be able to get it down to four function calls (which could easily
be stubbed out on !CONFIG_OF systems).


> Ideally, i would like some generic core code which can be given a list
> of resources, probably phandles, and timing information. And it will
> walk the list and turn them on, inserting the requested delays. And
> then we can enumerate the device.
>
> Until such code exists, i agree, forget the device is enumerable, hard
> code the ID, and get the probe function to enable the regulators, take
> the device out of reset, enable the clocks, etc. And repeat that in
> every PHY driver.

So, having spent a bit of time thinking about it I do wonder if creating
some kind of onboard_mdio.c to collect knowledge of how to turn specific
mdio devices on might be better than putting the same knowledge
directly into probe functions.

Should generic core code (or library functons) ever arrive then having
this code centralized between phys would make adopting the generic code
code easier.

I'm not overly attached to either idea but if you'd like me to sketch
out a prototype then let me know!


Daniel.

  reply	other threads:[~2026-05-15 14:42 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01 15:54 [PATCH net-next 00/12] net: enable TC956x support Alex Elder
2026-05-01 15:54 ` [PATCH net-next 01/12] net: pcs: pcs-xpcs-regmap: support XPCS memory-mapped MDIO bus via regmap Alex Elder
2026-05-01 15:54 ` [PATCH net-next 02/12] net: pcs: pcs-xpcs: select operating mode for 10G-baseR capable PCS Alex Elder
2026-05-01 16:50   ` Andrew Lunn
2026-05-01 18:07     ` Alex Elder
2026-05-05 15:58     ` Daniel Thompson
2026-05-01 15:54 ` [PATCH net-next 03/12] net: pcs: pcs-xpcs: Preserve BMCR_ANENBLE during link up Alex Elder
2026-05-01 17:06   ` Andrew Lunn
2026-05-06  9:46     ` Daniel Thompson
2026-05-01 15:54 ` [PATCH net-next 04/12] net: stmmac: dma: create a separate dma_device pointer Alex Elder
2026-05-01 17:13   ` Andrew Lunn
2026-05-01 18:06     ` Alex Elder
2026-05-01 20:55       ` Andrew Lunn
2026-05-04 13:36         ` Alex Elder
2026-05-01 15:54 ` [PATCH net-next 05/12] net: stmmac: dwxgmac2: Add multi MSI interrupt mode Alex Elder
2026-05-01 17:21   ` Andrew Lunn
2026-05-01 15:54 ` [PATCH net-next 06/12] net: stmmac: dwxgmac2: Add XGMAC 3.01a support Alex Elder
2026-05-01 15:54 ` [PATCH net-next 07/12] net: stmmac: dwxgmac2: export symbols for XGMAC 3.01a DMA Alex Elder
2026-05-01 15:54 ` [PATCH net-next 08/12] dt-bindings: net: toshiba,tc965x-dwmac: add TC956x Ethernet bridge Alex Elder
2026-05-01 17:38   ` Andrew Lunn
2026-05-03  2:22     ` Alex Elder
2026-05-07 22:17     ` Alex Elder
2026-05-07 23:39       ` Rob Herring
2026-05-04 11:00   ` Krzysztof Kozlowski
2026-05-04 13:34     ` Alex Elder
2026-05-07 14:47     ` Daniel Thompson
2026-05-07 14:12   ` Bjorn Andersson
2026-05-07 14:19     ` Andrew Lunn
2026-05-07 16:12       ` Bjorn Andersson
2026-05-07 18:37     ` Alex Elder
2026-05-10  2:25       ` Bjorn Andersson
2026-05-07 23:41   ` Rob Herring
2026-05-01 15:54 ` [PATCH net-next 09/12] gpio: tc956x: add TC956x/QPS615 support Alex Elder
2026-05-01 18:36   ` Andrew Lunn
2026-05-03  1:45     ` Alex Elder
2026-05-03  2:48       ` Andrew Lunn
2026-05-07 18:39         ` Alex Elder
2026-05-03  3:05       ` Andrew Lunn
2026-05-06 18:21         ` Alex Elder
2026-05-06 19:43           ` Andrew Lunn
2026-05-06 20:25             ` Alex Elder
2026-05-06 21:43               ` Andrew Lunn
2026-05-06 22:41                 ` Alex Elder
2026-05-03  3:42   ` Julian Braha
2026-05-06 18:51     ` Alex Elder
2026-05-04 12:46   ` Bartosz Golaszewski
2026-05-04 13:07     ` Alex Elder
2026-05-07 12:15   ` Linus Walleij
2026-05-07 12:20     ` Alex Elder
2026-05-01 15:54 ` [PATCH net-next 10/12] net: stmmac: " Alex Elder
2026-05-01 19:04   ` Andrew Lunn
2026-05-07 16:03     ` Daniel Thompson
2026-05-07 16:29       ` Andrew Lunn
2026-05-08 11:25         ` Daniel Thompson
2026-05-08 13:34           ` Andrew Lunn
2026-05-08 15:54             ` Daniel Thompson
2026-05-05 16:38   ` Mohd Ayaan Anwar
2026-05-05 16:46     ` Alex Elder
2026-05-06  2:30   ` Xilin Wu
2026-05-06 17:44     ` Alex Elder
2026-05-07 13:57       ` Xilin Wu
2026-05-07 14:14         ` Andrew Lunn
2026-05-11 15:41         ` Daniel Thompson
2026-05-06 12:59   ` Xilin Wu
2026-05-06 14:19     ` Andrew Lunn
2026-05-06 14:35       ` Xilin Wu
2026-05-06 14:45         ` Andrew Lunn
2026-05-06 15:38           ` Xilin Wu
2026-05-06 15:39         ` Daniel Thompson
2026-05-06 15:44           ` Xilin Wu
2026-05-06 15:56             ` Andrew Lunn
2026-05-06 16:00               ` Xilin Wu
2026-05-06 15:28       ` Daniel Thompson
2026-05-06 19:52         ` Andrew Lunn
2026-05-07 18:44     ` Alex Elder
2026-05-08 13:09       ` Xilin Wu
2026-05-08 13:36         ` Andrew Lunn
2026-05-08 13:41           ` Xilin Wu
2026-05-01 15:54 ` [PATCH net-next 11/12] misc: tc956x_pci: " Alex Elder
2026-05-01 21:07   ` Andrew Lunn
2026-05-03  2:06     ` Alex Elder
2026-05-02 16:45   ` Jakub Kicinski
2026-05-03  2:06     ` Alex Elder
2026-05-03  2:14       ` Jakub Kicinski
2026-05-03  2:23         ` Alex Elder
2026-05-01 15:54 ` [PATCH net-next 12/12] arm64: dts: qcom: qcs6490-rb3gen2: enable TC9564 with a single QCS8081 phy Alex Elder
2026-05-01 21:09   ` Andrew Lunn
2026-05-05 16:25     ` Daniel Thompson
2026-05-05 16:42   ` Mohd Ayaan Anwar
2026-05-05 16:46     ` Alex Elder
2026-05-08 14:03   ` Konrad Dybcio
2026-05-13 12:49     ` Daniel Thompson
2026-05-13 14:35       ` Andrew Lunn
2026-05-14 15:23         ` Daniel Thompson
2026-05-14 16:14           ` Andrew Lunn
2026-05-15 14:42             ` Daniel Thompson [this message]
2026-05-02 16:47 ` [PATCH net-next 00/12] net: enable TC956x support Jakub Kicinski
2026-05-03  2:07   ` Alex Elder
2026-05-15 17:59 ` Alex Elder

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=agcwwRhXqKljob0m@aspen.lan \
    --to=daniel@riscstar.com \
    --cc=a0987203069@gmail.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=ast@kernel.org \
    --cc=boon.khai.ng@altera.com \
    --cc=bpf@vger.kernel.org \
    --cc=brgl@kernel.org \
    --cc=chenchuangyu@xiaomi.com \
    --cc=chenhuacai@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=elder@riscstar.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hawk@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=inochiama@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=julianbraha@gmail.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=livelycarpet87@gmail.com \
    --cc=matthew.gerlach@altera.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=me@ziyao.cc \
    --cc=mohd.anwar@oss.qualcomm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=richardcochran@gmail.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=robh@kernel.org \
    --cc=rohan.g.thomas@altera.com \
    --cc=sdf@fomichev.me \
    --cc=siyanteng@cqsoftware.com.cn \
    --cc=weishangjuan@eswincomputing.com \
    --cc=wens@kernel.org \
    /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