devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: "Miquel Raynal (Schneider Electric)" <miquel.raynal@bootlin.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney@redhat.com>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Brendan Higgins <brendan.higgins@linux.dev>,
	David Gow <david@davidgow.net>, Rae Moar <raemoar63@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Pascal EBERHARD <pascal.eberhard@se.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kunit-dev@googlegroups.com,
	Herve Codina <herve.codina@bootlin.com>
Subject: Re: [PATCH v4 6/7] clk: Add support for clock nexus dt bindings
Date: Fri, 24 Jul 2026 14:30:22 -0400	[thread overview]
Message-ID: <amOvPicAZconUwQe@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260717-schneider-v7-2-rc1-eip201-upstream-v4-6-751547e160e5@bootlin.com>

On Fri, Jul 17, 2026 at 05:59:22PM +0200, Miquel Raynal (Schneider Electric) wrote:
> A nexus node is some kind of parent device abstracting the outer
> connections. They are particularly useful for describing connectors-like
> interfaces but not only. Certain IP blocks will typically include inner
> blocks and distribute resources to them.
>
> In the case of clocks, there is already the concept of clock controller,
> but this usually indicates some kind of control over the said clock,
> ie. gate or rate control. When there is none of this, an existing
> approach is to reference the upper clock, which is wrong from a hardware
> point of view.
>
> Nexus nodes are already part of the device-tree specification and clocks
> are already mentioned:
> https://github.com/devicetree-org/devicetree-specification/blob/v0.4/source/chapter2-devicetree-basics.rst#nexus-nodes-and-specifier-mapping
>
> Following the introductions of nexus nodes support for interrupts, gpios
> and pwms, here is the same logic applied again to the clk subsystem,
> just by transitioning from of_parse_phandle_with_args() to
> of_parse_phandle_with_args_map():
>
> * Nexus OF support:
> commit bd6f2fd5a1d5 ("of: Support parsing phandle argument lists through a nexus node")
> * GPIO adoption:
> commit c11e6f0f04db ("gpio: Support gpio nexus dt bindings")
> * PWM adoption:
> commit e71e46a6f19c ("pwm: Add support for pwm nexus dt bindings")
>
> Only expected Nexus property:
> - clock-map: maps inner clocks to inlet clocks
> (the other properties have been judged not relevant for clocks)
>
> Here is an example:
>
> Example:
>     soc_clk: clock-controller {
>         #clock-cells = <1>;
>     };
>
>     container: container {
>         #clock-cells = <1>;
>         clock-map = <0 &soc_clk 2>,
>                     <1 &soc_clk 6>;
>
>         child-device {
>             clocks = <&container 1>;
> 	    /* This is equivalent to <&soc_clk 6> */
>         };
>     };
>
> The child device does not need to know about the outer implementation,
> and only knows about what the nexus provides. The nexus acts as a
> pass-through, with no extra control.
>
> Signed-off-by: Miquel Raynal (Schneider Electric) <miquel.raynal@bootlin.com>
> Reviewed-by: Herve Codina <herve.codina@bootlin.com>
> Reviewed-by: Brian Masney <bmasney@redhat.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/clk/clk-conf.c | 12 ++++++------
>  drivers/clk/clk.c      |  4 ++--
>  2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/clk-conf.c b/drivers/clk/clk-conf.c
> index 303a0bb26e54..5380d43b56a4 100644
> --- a/drivers/clk/clk-conf.c
> +++ b/drivers/clk/clk-conf.c
> @@ -25,8 +25,8 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier)
>  		       node);
>
>  	for (index = 0; index < num_parents; index++) {
> -		rc = of_parse_phandle_with_args(node, "assigned-clock-parents",
> -					"#clock-cells",	index, &clkspec);
> +		rc = of_parse_phandle_with_args_map(node, "assigned-clock-parents",
> +						    "clock", index, &clkspec);
>  		if (rc < 0) {
>  			/* skip empty (null) phandles */
>  			if (rc == -ENOENT)
> @@ -47,8 +47,8 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier)
>  			return PTR_ERR(pclk);
>  		}
>
> -		rc = of_parse_phandle_with_args(node, "assigned-clocks",
> -					"#clock-cells", index, &clkspec);
> +		rc = of_parse_phandle_with_args_map(node, "assigned-clocks",
> +						    "clock", index, &clkspec);
>  		if (rc < 0)
>  			goto err;
>  		if (clkspec.np == node && !clk_supplier) {
> @@ -121,8 +121,8 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier)
>  			rate = rates[index];
>
>  		if (rate) {
> -			rc = of_parse_phandle_with_args(node, "assigned-clocks",
> -					"#clock-cells",	index, &clkspec);
> +			rc = of_parse_phandle_with_args_map(node, "assigned-clocks",
> +							    "clock", index, &clkspec);
>  			if (rc < 0) {
>  				/* skip empty (null) phandles */
>  				if (rc == -ENOENT)
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 45f5d7a4ccc1..6acf042673c3 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -5207,8 +5207,8 @@ static int of_parse_clkspec(const struct device_node *np, int index,
>  		 */
>  		if (name)
>  			index = of_property_match_string(np, "clock-names", name);
> -		ret = of_parse_phandle_with_args(np, "clocks", "#clock-cells",
> -						 index, out_args);
> +		ret = of_parse_phandle_with_args_map(np, "clocks", "clock",
> +						     index, out_args);
>  		if (!ret)
>  			break;
>  		if (name && index >= 0)
>
> --
> 2.54.0
>

  reply	other threads:[~2026-07-24 18:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 15:59 [PATCH v4 0/7] clk: Add support for clock nexus Miquel Raynal (Schneider Electric)
2026-07-17 15:59 ` [PATCH v4 1/7] dt-bindings: clock: Introduce nexus nodes Miquel Raynal (Schneider Electric)
2026-07-17 16:51   ` sashiko-bot
2026-07-22 19:34   ` Rob Herring (Arm)
2026-07-24 18:14   ` Frank Li
2026-07-17 15:59 ` [PATCH v4 2/7] clk: tests: Add clk_parse_clkspec() Kunit testing Miquel Raynal (Schneider Electric)
2026-07-21 22:27   ` Brian Masney
2026-07-24 18:16   ` Frank Li
2026-07-17 15:59 ` [PATCH v4 3/7] clk: tests: Add Kunit testing for of_clk_get_parent_name() Miquel Raynal (Schneider Electric)
2026-07-17 17:11   ` sashiko-bot
2026-07-21 22:28   ` Brian Masney
2026-07-24 18:19   ` Frank Li
2026-08-07 12:23     ` Miquel Raynal
2026-07-17 15:59 ` [PATCH v4 4/7] clk: Improve a couple of comments Miquel Raynal (Schneider Electric)
2026-07-17 15:59 ` [PATCH v4 5/7] clk: Use the generic OF phandle parsing in only one place Miquel Raynal (Schneider Electric)
2026-07-17 17:28   ` sashiko-bot
2026-07-24 18:35   ` Frank Li
2026-08-07 13:08     ` Miquel Raynal
2026-07-17 15:59 ` [PATCH v4 6/7] clk: Add support for clock nexus dt bindings Miquel Raynal (Schneider Electric)
2026-07-24 18:30   ` Frank Li [this message]
2026-07-17 15:59 ` [PATCH v4 7/7] clk: tests: Add Kunit testing for nexus nodes Miquel Raynal (Schneider Electric)
2026-07-17 17:41   ` sashiko-bot
2026-07-21 22:32   ` Brian Masney
2026-08-07 12:50     ` Miquel Raynal
2026-07-24 18:31   ` Frank Li
2026-07-24 18:26 ` [PATCH v4 0/7] clk: Add support for clock nexus Frank Li

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=amOvPicAZconUwQe@lizhi-Precision-Tower-5810 \
    --to=frank.li@oss.nxp.com \
    --cc=bmasney@redhat.com \
    --cc=brendan.higgins@linux.dev \
    --cc=conor+dt@kernel.org \
    --cc=david@davidgow.net \
    --cc=devicetree@vger.kernel.org \
    --cc=herve.codina@bootlin.com \
    --cc=krzk+dt@kernel.org \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mturquette@baylibre.com \
    --cc=pascal.eberhard@se.com \
    --cc=raemoar63@gmail.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wsa+renesas@sang-engineering.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).