From nobody Sun Jul 26 00:20:45 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 113283793C1; Fri, 10 Jul 2026 18:22:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707740; cv=none; b=Wxpho64XFoDXdvkfeQN911Qmp9ChYJbfAtKjkDRAQAOw9acuoaWWg8qnqRBAfQDzzCAWonKILM83oJ2tE4uD2kPrJ2KHUywnuWSuYrfSA2FOuJwNuISOuioMJ/FFl8etPzMJMxQmj9uBqEYeWXRumMV6VjQwlExSkIxkeNZs9ik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707740; c=relaxed/simple; bh=fvKp3muxqLO3ZXsRvobuXHT61jNJWSsEw3PxHdgAIVI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AEoaIwl6gjxLkHXPHvpHgfSu5oqfj4sZFILthWlHuUq6DdEsxzB0QoLjcDj0Xx6zJwoyNb/uzsbHiYPgc2b/wrtRMYjBChXAqmqJBwQS3xaUsSFNFcmbVKj1RUR5U0mkOi50L5oUxmAu97mnaigE60RY41U/AvWbeGxVlh/55zs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=KMyH/a4T; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="KMyH/a4T" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id D74021A0F47; Fri, 10 Jul 2026 18:22:16 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A466060345; Fri, 10 Jul 2026 18:22:16 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6D97C11BD2C1D; Fri, 10 Jul 2026 20:22:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1783707735; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=R5Jti0bTgzxOr6073sChkcLCtqN2FPsmeK2o9HwQWUI=; b=KMyH/a4To9HPUEriDlXstepHJyiDLbLbp5K5Tk3cZprImc60Xi1PBkrfmp5SuZODiscSoR 00jQoeNCHCQxMq3f+tPjlk66n+/UKkVyw3BDbGfRdFqpuo4qBBI5/43/aIov3mxbd8dGO7 tXjSffZDQLVePQXJoO3B55cLD3IyDAzPREafInkcRWHyNYGPKN2YWi3cz5rMtxJJEBZK2V DHmgSKdE1kwBzrKQab8SRI7GGMlVB5fT7IwoAXt1ZA8lZP/+dMQl5VlVAERQKxV5wldnAw nnP9iy0PALDRRuvIJ9pL/ujiMxzlwmABYp8DRyIHsEUOhpv5uTSmYzlig8MRPA== From: "Miquel Raynal (Schneider Electric)" Date: Fri, 10 Jul 2026 20:21:56 +0200 Subject: [PATCH v2 1/7] dt-bindings: clock: Introduce nexus nodes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-1-b4680787377e@bootlin.com> References: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> In-Reply-To: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> To: Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Brendan Higgins , David Gow , Rae Moar Cc: Thomas Petazzoni , Pascal EBERHARD , Wolfram Sang , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, "Miquel Raynal (Schneider Electric)" X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 Hardware containers can just decouple external resources like clock without any more control. Nexus nodes already exist for PWM and GPIOs, add a binding to allow them for clocks as well. No examples are given, the file is litteraly a copy-paste from Herv=C3=A9 Codina's work on PWM Nexus nodes, hence we just point to the examples there which already illustrate very clearly the concept of the various properties. Signed-off-by: Miquel Raynal (Schneider Electric) --- .../bindings/clock/clock-nexus-node.yaml | 30 ++++++++++++++++++= ++++ 1 file changed, 30 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/clock-nexus-node.yaml = b/Documentation/devicetree/bindings/clock/clock-nexus-node.yaml new file mode 100644 index 000000000000..ff3283bd5fb1 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/clock-nexus-node.yaml @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/clock-nexus-node.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Clock Nexus + +description: > + A nexus node allows to remap a clock specifier list in a consumer node + through a container or a connector node in a generic way. With this + remapping, the consumer node needs to know only about the nexus + node. Resources behind the nexus node are decoupled by the nexus node + itself. + +maintainers: + - Miquel Raynal + +select: true + +properties: + clock-map: + $ref: /schemas/types.yaml#/definitions/uint32-matrix + +dependentRequired: + clock-map: ['#clock-cells'] + +additionalProperties: true + +# See the original pwm-nexus-node.yaml description for examples --=20 2.54.0 From nobody Sun Jul 26 00:20:45 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF7BD379C38; Fri, 10 Jul 2026 18:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707743; cv=none; b=c6tVyD4C5YRkyVY8UWQfvD+oHFH5CadmxUzQoVTPeJYzdISUfjKJA8EKpMA0FPtZ1NT+fTGFLMfmyngStcaIe3wJfrDYIac9Z46b+UW1pA9YjvTf+HyXoX647bg1q7nzg2CbvTXZsFbE0J1RXnmmWVpOy0uXsCZHASpZK64jJsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707743; c=relaxed/simple; bh=BftAQ4d/iZFW8LlEWOjZYzTJKwuq8e6Tg64d926D7hs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CJI9RTNc2I8FfzNbNeVWcQpmTvWuKP3erLIa2WpWo+fwazrEjYKrIZ6Gly3ZbRZ3u62Q+79Mh951ScZ61WXi7Tj7vUx+nlJoTHAXsKdV8Wumnl7jwYBIYW5dH4TKw6m0tWxLwrnPR+of+d9fPpfhPq3vFwnNCk0/7G8NP1nQKeM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=naP2iMxf; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="naP2iMxf" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 583BD4E40D4A; Fri, 10 Jul 2026 18:22:19 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2C4A560342; Fri, 10 Jul 2026 18:22:19 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E65CA11BD2C1F; Fri, 10 Jul 2026 20:22:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1783707738; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=M5ONPK0FldTaZ0gyW+2a82proN3HkRbf2BKdgJRba8A=; b=naP2iMxfOZH1C5pIVPhisLYqCr4G4xOLjpDjFeMpUwKODbh2MDGrIiHz5QIluHNHK9t5a9 JQzcnwG46rpsmV1360VfkqqvUbMNRYtlUQTVX2EGS/47t2RLZ/RpDbCRJf40rmJMpaZVUu QwS0/BNieuvHIS6mwwljYtEWWA25B4a1AAR5UN3mR6isnRbtzCp7iQnZE44OU9m4aRFmLw YHkH1SSG8qAmaK1+lX3czSifYOfh3sCwUznDwxi8kqtPmgtQ7z+8kQLorkj61Od33jac6Z oIVbKkMtFo006P3K/LtK4Q2LHLLzaU+GkVJ5naikDOJiMpRhE05bNvStK9RIHg== From: "Miquel Raynal (Schneider Electric)" Date: Fri, 10 Jul 2026 20:21:57 +0200 Subject: [PATCH v2 2/7] clk: tests: Add clk_parse_clkspec() Kunit testing Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-2-b4680787377e@bootlin.com> References: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> In-Reply-To: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> To: Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Brendan Higgins , David Gow , Rae Moar Cc: Thomas Petazzoni , Pascal EBERHARD , Wolfram Sang , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, "Miquel Raynal (Schneider Electric)" X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 Create a new set of kunit tests to make sure clk_parse_clkspec() is working as expected. We currently verify if we get a proper device when using indexes and names. If we make an out of bounds request we expect an error. For testing purposes, we must ensure of_clk_get_hw()'s symbol is exported. Suggested-by: Stephen Boyd Signed-off-by: Miquel Raynal (Schneider Electric) --- drivers/clk/Makefile | 1 + drivers/clk/clk.c | 2 + drivers/clk/clk_test.c | 117 +++++++++++++++++++++++++++= ++++ drivers/clk/kunit_clk_parse_clkspec.dtso | 21 ++++++ 4 files changed, 141 insertions(+) diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index cc108a75a900..035b984db70d 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -19,6 +19,7 @@ clk-test-y :=3D clk_test.o \ kunit_clk_assigned_rates_zero.dtbo.o \ kunit_clk_assigned_rates_zero_consumer.dtbo.o \ kunit_clk_hw_get_dev_of_node.dtbo.o \ + kunit_clk_parse_clkspec.dtbo.o \ kunit_clk_parent_data_test.dtbo.o obj-$(CONFIG_COMMON_CLK) +=3D clk-divider.o obj-$(CONFIG_COMMON_CLK) +=3D clk-fixed-factor.o diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 048adfa86a5d..08874cf9b561 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -24,6 +24,7 @@ #include #include #include +#include =20 #include "clk.h" =20 @@ -5300,6 +5301,7 @@ struct clk_hw *of_clk_get_hw(struct device_node *np, = int index, =20 return hw; } +EXPORT_SYMBOL_IF_KUNIT(of_clk_get_hw); =20 static struct clk *__of_clk_get(struct device_node *np, int index, const char *dev_id, diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c index b1961daac5e2..fddb2bb9618f 100644 --- a/drivers/clk/clk_test.c +++ b/drivers/clk/clk_test.c @@ -3541,10 +3541,126 @@ static struct kunit_suite clk_hw_get_dev_of_node_t= est_suite =3D { .test_cases =3D clk_hw_get_dev_of_node_test_cases, }; =20 +static const struct clk_init_data clk_parse_clkspec_1_init_data =3D { + .name =3D "clk_parse_clkspec_1", + .ops =3D &empty_clk_ops, +}; + +static const struct clk_init_data clk_parse_clkspec_2_init_data =3D { + .name =3D "clk_parse_clkspec_2", + .ops =3D &empty_clk_ops, +}; + +struct clk_parse_clkspec_ctx { + struct device_node *cons_np; +}; + +static int clk_parse_clkspec_init(struct kunit *test) +{ + struct device_node *prov1_np, *prov2_np; + struct clk_parse_clkspec_ctx *ctx; + struct clk_hw *hw1, *hw2; + + ctx =3D kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); + test->priv =3D ctx; + + KUNIT_ASSERT_EQ(test, 0, of_overlay_apply_kunit(test, kunit_clk_parse_clk= spec)); + + /* Register provider 1 */ + hw1 =3D kunit_kzalloc(test, sizeof(*hw1), GFP_KERNEL); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw1); + hw1->init =3D &clk_parse_clkspec_1_init_data; + + prov1_np =3D of_find_compatible_node(NULL, NULL, "test,clock-provider1"); + KUNIT_ASSERT_NOT_NULL(test, prov1_np); + + KUNIT_ASSERT_EQ(test, 0, of_clk_hw_register_kunit(test, prov1_np, hw1)); + of_clk_add_hw_provider_kunit(test, prov1_np, of_clk_hw_simple_get, hw1); + of_node_put(prov1_np); + + /* Register provider 2 */ + hw2 =3D kunit_kzalloc(test, sizeof(*hw2), GFP_KERNEL); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hw2); + hw2->init =3D &clk_parse_clkspec_2_init_data; + + prov2_np =3D of_find_compatible_node(NULL, NULL, "test,clock-provider2"); + KUNIT_ASSERT_NOT_NULL(test, prov2_np); + + KUNIT_ASSERT_EQ(test, 0, of_clk_hw_register_kunit(test, prov2_np, hw2)); + of_clk_add_hw_provider_kunit(test, prov2_np, of_clk_hw_simple_get, hw2); + of_node_put(prov2_np); + + ctx->cons_np =3D of_find_compatible_node(NULL, NULL, "test,clock-consumer= "); + KUNIT_ASSERT_NOT_NULL(test, ctx->cons_np); + + return 0; +} + +static void clk_parse_clkspec_exit(struct kunit *test) +{ + struct clk_parse_clkspec_ctx *ctx =3D test->priv; + + of_node_put(ctx->cons_np); +} + +/* Test DT phandle lookups using correct index or name succeed */ +static void clk_parse_clkspec_with_correct_index_and_name(struct kunit *te= st) +{ + struct clk_parse_clkspec_ctx *ctx =3D test->priv; + struct clk_hw *hw1, *hw2, *hw3, *hw4; + + /* Get clocks by index */ + hw1 =3D of_clk_get_hw(ctx->cons_np, 0, NULL); + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, hw1); + + hw2 =3D of_clk_get_hw(ctx->cons_np, 1, NULL); + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, hw2); + KUNIT_EXPECT_PTR_NE(test, hw1, hw2); + + /* Get clocks by name */ + hw3 =3D of_clk_get_hw(ctx->cons_np, 0, "first_clock"); + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, hw3); + KUNIT_EXPECT_PTR_EQ(test, hw1, hw3); + + hw4 =3D of_clk_get_hw(ctx->cons_np, 0, "second_clock"); + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, hw4); + KUNIT_EXPECT_PTR_EQ(test, hw2, hw4); +} + +/* Test DT phandle lookups using wrong index or name fail */ +static void clk_parse_clkspec_with_incorrect_index_and_name(struct kunit *= test) +{ + struct clk_parse_clkspec_ctx *ctx =3D test->priv; + struct clk_hw *hw; + + /* Get clock by index */ + hw =3D of_clk_get_hw(ctx->cons_np, 2, NULL); + KUNIT_EXPECT_TRUE(test, IS_ERR(hw)); + + /* Get clock by name */ + hw =3D of_clk_get_hw(ctx->cons_np, 0, "third_clock"); + KUNIT_EXPECT_TRUE(test, IS_ERR(hw)); +} + +static struct kunit_case clk_parse_clkspec_test_cases[] =3D { + KUNIT_CASE(clk_parse_clkspec_with_correct_index_and_name), + KUNIT_CASE(clk_parse_clkspec_with_incorrect_index_and_name), + {} +}; + +/* Test suite to verify clk_parse_clkspec() */ +static struct kunit_suite clk_parse_clkspec_test_suite =3D { + .name =3D "clk_parse_clkspec", + .init =3D clk_parse_clkspec_init, + .exit =3D clk_parse_clkspec_exit, + .test_cases =3D clk_parse_clkspec_test_cases, +}; =20 kunit_test_suites( &clk_assigned_rates_suite, &clk_hw_get_dev_of_node_test_suite, + &clk_parse_clkspec_test_suite, &clk_leaf_mux_set_rate_parent_test_suite, &clk_test_suite, &clk_multiple_parents_mux_test_suite, @@ -3562,4 +3678,5 @@ kunit_test_suites( &clk_uncached_test_suite, ); MODULE_DESCRIPTION("Kunit tests for clk framework"); +MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/clk/kunit_clk_parse_clkspec.dtso b/drivers/clk/kunit_c= lk_parse_clkspec.dtso new file mode 100644 index 000000000000..c93feb93e101 --- /dev/null +++ b/drivers/clk/kunit_clk_parse_clkspec.dtso @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +/plugin/; + +&{/} { + kunit_clock_provider1: kunit-clock-provider1 { + compatible =3D "test,clock-provider1"; + #clock-cells =3D <1>; + }; + + kunit_clock_provider2: kunit-clock-provider2 { + compatible =3D "test,clock-provider2"; + #clock-cells =3D <1>; + }; + + kunit-clock-consumer { + compatible =3D "test,clock-consumer"; + clocks =3D <&kunit_clock_provider1 0>, <&kunit_clock_provider2 0>; + clock-names =3D "first_clock", "second_clock"; + }; +}; --=20 2.54.0 From nobody Sun Jul 26 00:20:45 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 793AC377EAC; Fri, 10 Jul 2026 18:22:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707746; cv=none; b=ZkaHhmb+JkE50TT/Ba7UuPRddySkM4yLuczrWP3pc8EuOk0rRiOkHieh+TO7VT1gnNSpQzMuJKGx0VuxJbCPcVFeG1Eq+EruQCe3aIP4omlnIp1wrq53QTi3PHpkodnJshWg4aANEUrz/omm0/PPC+Dve9iHEKkRQKVHTpbz9Rs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707746; c=relaxed/simple; bh=1hxI8IPp7+qUHOwC1pZ378X8AOhxlzUL/nxF5tit2HM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K1FqOyiREys8B+RAoshU5NMsl79fZritfT8XG1mf7AiPeNi4kmI3ZGzKJguIglthjvE1+kn6SCNkdZvnPJkf6XF/TzseAin8ZiVKGaDyx8vLLKo5gW7nwMKiRKx4EPwKXqxus9OoXvwpuYZ4d+mLJUApfphw8cYNQ7obpohueeg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=BotI4WXU; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="BotI4WXU" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id DE1C31A0F46; Fri, 10 Jul 2026 18:22:21 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B308160342; Fri, 10 Jul 2026 18:22:21 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6DBDB11BD2BB8; Fri, 10 Jul 2026 20:22:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1783707740; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=y4d0+A/oCA9z4CTriljWhVa/qSWjf+3UGfLM+Z2+ZyU=; b=BotI4WXUol7aIZ4Cmw3x1ZEc+yn2YidBDr1Hrh7LINyfyl80rNRJ7CMLJgrx6Nu0rlU8za Lw68DVU1fL0pBkwNBG1NH64soUhimFSH+eDmKYlHOUX6A3WvZZX/WUPkkM1JQreNH7eVD8 TM/dtm3xbnLqCK3lxjRnA3kvXkxinYWnxfNl7T7nirwrKBZuUDAh6QthLfCief/gH5b+se rzv/3L5zpNRoWe9+j7qG4hzjBMqTDymhH51fHSwFkQAm33REzeuw5WeHGEfdeLKpHoyIGz d42YiuBOVZBGAqsalKRVZeaqFJWtzOGsdbnGngKCjx1DqlBzky1+gaAjaJt6Ew== From: "Miquel Raynal (Schneider Electric)" Date: Fri, 10 Jul 2026 20:21:58 +0200 Subject: [PATCH v2 3/7] clk: tests: Add Kunit testing for of_clk_get_parent_name() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-3-b4680787377e@bootlin.com> References: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> In-Reply-To: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> To: Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Brendan Higgins , David Gow , Rae Moar Cc: Thomas Petazzoni , Pascal EBERHARD , Wolfram Sang , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, "Miquel Raynal (Schneider Electric)" X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 Make sure this helper is never broken, especially since we will soon make some changes in it. Signed-off-by: Miquel Raynal (Schneider Electric) --- drivers/clk/clk_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c index fddb2bb9618f..5f3ffda033c3 100644 --- a/drivers/clk/clk_test.c +++ b/drivers/clk/clk_test.c @@ -3643,9 +3643,23 @@ static void clk_parse_clkspec_with_incorrect_index_a= nd_name(struct kunit *test) KUNIT_EXPECT_TRUE(test, IS_ERR(hw)); } =20 +/* + * Verify that of_clk_get_parent_name() returns the correct clock name when + * looking up by index through the consumer's clocks property. + */ +static void of_clk_get_parent_name_gets_parent_name(struct kunit *test) +{ + struct clk_parse_clkspec_ctx *ctx =3D test->priv; + const char *expected_name =3D "clk_parse_clkspec_1"; + + KUNIT_EXPECT_STREQ(test, expected_name, + of_clk_get_parent_name(ctx->cons_np, 0)); +} + static struct kunit_case clk_parse_clkspec_test_cases[] =3D { KUNIT_CASE(clk_parse_clkspec_with_correct_index_and_name), KUNIT_CASE(clk_parse_clkspec_with_incorrect_index_and_name), + KUNIT_CASE(of_clk_get_parent_name_gets_parent_name), {} }; =20 --=20 2.54.0 From nobody Sun Jul 26 00:20:45 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFF9E2DAFAF; Fri, 10 Jul 2026 18:22:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707753; cv=none; b=lKqC9JC1Ml4CCGR8F3IjIvDT02D6RuuDANA+YAxPR4JjUO5r+SCcIeCIhRYFCcpV1DwcXVGG6KAjtARer3/EnGjWgfe2vhu5QALemVbLfBZngVygGPUZU4BZ1kNlBx8D1VY837nVEBK1k1kYwouB0qR4LNi9C8e3K3Rq5+ZQHAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707753; c=relaxed/simple; bh=MKXF36B/N58wgTDVUubwpPnEsfYr+reCs2pY25QG5rc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=USrCFSt0zGrC/C5FBmQ1Z/e5LrrvtNTjyma4j9B/6aTkrrI5miZWQzy6xeTmmoad+D+vxuiup03zOnFE0FTALLQGPN8kmcQUzXNcLHCyLUHR57j4beTsV/u+331TC5VtrEQADyxH0bpexGrHPJuHuo85T5/TzW3HJ+jwsGRtKnk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=pMWqIQ+c; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="pMWqIQ+c" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 8EF524E40D4A; Fri, 10 Jul 2026 18:22:24 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 62EB060342; Fri, 10 Jul 2026 18:22:24 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 106B911BD2C1D; Fri, 10 Jul 2026 20:22:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1783707743; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=nTJU2NJ54O6LZ0hZrhPZm1F5PCgRji3kSdkWz/GfYyE=; b=pMWqIQ+c50m52BAJ/GRQWIaZv2TC4ZRKnxCsWXAgm8gvUNEgzkiNvGzrjKXwl+4W/L2Nxf TMZ3yMLG24PXlbRK/ydtIprFB7VyhQyGkn5AcLzXHWj1yLLgig6hUqfNmkavz78GqIJqqJ e9wd49Jg0stNfo+YOJCbi/JQU2SuZA1Sh+tf/P1EaRPh3cFfYSCp3oKzZl45UQLDMJzkjM FkK3ddsCU7ETXcL1wOv7CC5HgStWrSChM3H/jYWTOy9jGBBkB2Acm22c+rB/2cPExVzTq1 A7/Z+4coJgYRnR2FwHYbFTm3gfx+5n7K35r9F60spODV6NkbW82rpSoUSWo8eg== From: "Miquel Raynal (Schneider Electric)" Date: Fri, 10 Jul 2026 20:21:59 +0200 Subject: [PATCH v2 4/7] clk: Improve a couple of comments Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-4-b4680787377e@bootlin.com> References: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> In-Reply-To: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> To: Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Brendan Higgins , David Gow , Rae Moar Cc: Thomas Petazzoni , Pascal EBERHARD , Wolfram Sang , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, "Miquel Raynal (Schneider Electric)" X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 Avoid mentioning the function names directly in the comments, it makes them easily out of sync with the rest of the code. Use a more generic wording. Suggested-by: Stephen Boyd Signed-off-by: Miquel Raynal (Schneider Electric) Reviewed-by: Brian Masney --- drivers/clk/clk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 08874cf9b561..7d63d81ebc09 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -5202,7 +5202,7 @@ static int of_parse_clkspec(const struct device_node = *np, int index, /* * For named clocks, first look up the name in the * "clock-names" property. If it cannot be found, then index - * will be an error code and of_parse_phandle_with_args() will + * will be an error code and the OF phandle parser will * return -EINVAL. */ if (name) @@ -5275,7 +5275,7 @@ of_clk_get_hw_from_clkspec(struct of_phandle_args *cl= kspec) * * This function looks up a struct clk from the registered list of clock * providers, an input is a clock specifier data structure as returned - * from the of_parse_phandle_with_args() function call. + * from the OF phandle parser. */ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec) { --=20 2.54.0 From nobody Sun Jul 26 00:20:45 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1485737C936 for ; Fri, 10 Jul 2026 18:22:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707755; cv=none; b=sEz1M7vgn8wyGULFHBzpS19vM3b5ylrkT6UJ4vdjjJKTBTzNu43qDoOXhSgxYDQNMjKfNxHRNO9WYuO1Mfl8wcM1hPwLiB0KQdK30MP2HOk4MA+UAaM9UfXI2O3L+CJ1uTMNBUSREzq/UVB9ZYhamoZon43w5/Y07n+vYSg41c0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707755; c=relaxed/simple; bh=jLPNQMlx2tycltIOs26Drt1Q255C5g3gqKVQI6vBK6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q/HVNUlR7EwpwQJdaKxQOntk2kTzgjMcehdI8upr1v8A06NqnV7T5211XHixEoBMlP+fow/IHpOGQ7a5ZOAHUgGkpLMifzDIMPrcg4SOCCI5ObBrw9PglsrH8mmuiKIQokOzFFysYl5e2bbG5iSUzAd08MUZkXm/8UZZhC3ce7o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=lPVmfrly; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="lPVmfrly" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id D9C35C2C64F; Fri, 10 Jul 2026 18:22:41 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 024C760342; Fri, 10 Jul 2026 18:22:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9627111BD2C22; Fri, 10 Jul 2026 20:22:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1783707745; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=1wrqvhMu2YpcC+p27L70W26av2AD4YrTW4sHtW1nCnY=; b=lPVmfrlyQy0LStODYFFPnPc6ckxVpn7OsqcTtaOmJOHTTsbrkvrYs/5vOd8DvW6vnVXexf HiO56fdJVB9b4bImLVzfbfX0VwfIgljzCp87/dLHOd2Cx5tb54zXZB9tAe5xWCbryM4Rw4 qzPJTMtukZYHvFhTODhJyqQJ9sSLihi/prN1CXejNW8VpgQsVOI6b1VqvTmgnoQTBjyIrn YLo6ODzj0VkYdKfyPsty86KPO9i+M7yO9xfDEZi1ItYMlDfcWgRAiyAqo6NibS/LLdAAMA szPwe1pEQpclz9LNi2x5/lRvYDX6abAxwPUqz34JQzeeJNVRk/Dt+Zxq/4pcHA== From: "Miquel Raynal (Schneider Electric)" Date: Fri, 10 Jul 2026 20:22:00 +0200 Subject: [PATCH v2 5/7] clk: Use the generic OF phandle parsing in only one place Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-5-b4680787377e@bootlin.com> References: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> In-Reply-To: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> To: Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Brendan Higgins , David Gow , Rae Moar Cc: Thomas Petazzoni , Pascal EBERHARD , Wolfram Sang , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, "Miquel Raynal (Schneider Electric)" X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 There should be one single entry in the OF world, so that the way we parse the DT is always the same. make sure this is the case by avoid calling of_parse_phandle_with_args() from of_clk_get_parent_name(). This is even more relevant as we currently fail to parse clock-ranges. As a result, it seems to be safer to directly call of_parse_clkspec() there. Suggested-by: Stephen Boyd Fixes: 4472287a3b2f5 ("clk: Introduce of_clk_get_hw_from_clkspec()") Signed-off-by: Miquel Raynal (Schneider Electric) Reviewed-by: Brian Masney --- drivers/clk/clk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 7d63d81ebc09..dad4bac10ad4 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -5364,8 +5364,7 @@ const char *of_clk_get_parent_name(const struct devic= e_node *np, int index) int count; struct clk *clk; =20 - rc =3D of_parse_phandle_with_args(np, "clocks", "#clock-cells", index, - &clkspec); + rc =3D of_parse_clkspec(np, index, NULL, &clkspec); if (rc) return NULL; =20 --=20 2.54.0 From nobody Sun Jul 26 00:20:45 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEB8637BE93; Fri, 10 Jul 2026 18:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707757; cv=none; b=bEUwsBStApWCsasguTzqFHN4JUVGmUJNrx+KcPbS48gMIU/d37SUDzwQhaYevilzlmpG+YaD3Qhut3VDJqnwpNkePbwDUVXOGURm/eHICrF8KABpI0uNmkzBPHZiCKLxuA9vz+Zs+wlK09NGtIavPUSGapY8lKTQirWplQxw1aA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707757; c=relaxed/simple; bh=9BD0frHIllOdYuYH6t1kkSctrb7RdeGSymmOSsqpKhU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nHvhbpdO3vwJqQsarmSySpN8JiNDIAQBeyM4M4GqNtaQCjchLJawz1bzDkZnGYZz5rCM9DettriUlZbiBhF5ja3yi3GLaieYESHWeEL9IdJ5kG0g0TAsf5wwtpVXBbfPhKShq2vgYrEqPpg87OCamGxAH1TaLLZjo3RJRSVFUlw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ofdl18DB; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ofdl18DB" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id D2E5DC2C64E; Fri, 10 Jul 2026 18:22:44 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id EFA4A60342; Fri, 10 Jul 2026 18:22:29 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3FAB711BD2C24; Fri, 10 Jul 2026 20:22:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1783707748; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Z4iMMdJhqEJQ6QA/P5+O9pqvjmWc5U1l7gvdD0BYF6o=; b=ofdl18DBYwlZmpFxpHUXEBogYh+20Q1xgpbDsSLtbS+ORZehcnwURbhUEtZCbfJ1xSe6bL BIsjJRe1JSyssr97hQIBNc8aAzNiG4e3zyRYBF9ovA9o1KVlfQM5aSjx1hC1KcSY4iIYhr J2WEbmlpmSk0xwnr7QhZ8WouCwzx4vlCzaf8o3/tBHtTVcYNuoAyvlVqHY7gBfmmWL/ZL1 YFcnER1B+nSsJgW188PXHm4YZ5PcSCdBUuAo5+zF5kJsHxTBqExBSNVjBrcbAN1pOMEjeO 4KqHFvHuqyOCwZmTbdF81MiDV31OgtVhQy1v9bpLR+hYiX027IQH8bMnpSNBsQ== From: "Miquel Raynal (Schneider Electric)" Date: Fri, 10 Jul 2026 20:22:01 +0200 Subject: [PATCH v2 6/7] clk: Add support for clock nexus dt bindings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-6-b4680787377e@bootlin.com> References: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> In-Reply-To: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> To: Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Brendan Higgins , David Gow , Rae Moar Cc: Thomas Petazzoni , Pascal EBERHARD , Wolfram Sang , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, "Miquel Raynal (Schneider Electric)" , Herve Codina X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 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 =3D <1>; }; container: container { #clock-cells =3D <1>; clock-map =3D <0 &soc_clk 2>, <1 &soc_clk 6>; child-device { clocks =3D <&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) Reviewed-by: Herve Codina Reviewed-by: Brian Masney --- 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, bo= ol clk_supplier) node); =20 for (index =3D 0; index < num_parents; index++) { - rc =3D of_parse_phandle_with_args(node, "assigned-clock-parents", - "#clock-cells", index, &clkspec); + rc =3D of_parse_phandle_with_args_map(node, "assigned-clock-parents", + "clock", index, &clkspec); if (rc < 0) { /* skip empty (null) phandles */ if (rc =3D=3D -ENOENT) @@ -47,8 +47,8 @@ static int __set_clk_parents(struct device_node *node, bo= ol clk_supplier) return PTR_ERR(pclk); } =20 - rc =3D of_parse_phandle_with_args(node, "assigned-clocks", - "#clock-cells", index, &clkspec); + rc =3D of_parse_phandle_with_args_map(node, "assigned-clocks", + "clock", index, &clkspec); if (rc < 0) goto err; if (clkspec.np =3D=3D node && !clk_supplier) { @@ -121,8 +121,8 @@ static int __set_clk_rates(struct device_node *node, bo= ol clk_supplier) rate =3D rates[index]; =20 if (rate) { - rc =3D of_parse_phandle_with_args(node, "assigned-clocks", - "#clock-cells", index, &clkspec); + rc =3D of_parse_phandle_with_args_map(node, "assigned-clocks", + "clock", index, &clkspec); if (rc < 0) { /* skip empty (null) phandles */ if (rc =3D=3D -ENOENT) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index dad4bac10ad4..73ddd9a6aa2e 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 =3D of_property_match_string(np, "clock-names", name); - ret =3D of_parse_phandle_with_args(np, "clocks", "#clock-cells", - index, out_args); + ret =3D of_parse_phandle_with_args_map(np, "clocks", "clock", + index, out_args); if (!ret) break; if (name && index >=3D 0) --=20 2.54.0 From nobody Sun Jul 26 00:20:45 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED94837C925 for ; Fri, 10 Jul 2026 18:22:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707757; cv=none; b=r9XP3uD8MGCaC820pp/IJ0MfqwPB3wGB9X7NxZWv7RAxcc3SFhWSpswN0nfb+8aWnokAPFwH3/vR1zGgvW2lZncbSz5G73WMxsvReCTFyIn5mp9aDGK5CXyfFF6emzqME8p9YgtUyREuJa9ra2V6Fjlb1cSPdBjgMQvecGcW+0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783707757; c=relaxed/simple; bh=aL5KpwDXKi8VU01kD3qwRMt9USXGuVQTzWDGskskP9o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E1BMPV7G763e7+w1+yE/ahyx1Ia10t2KcWv0FmM/uaaGK9vfLUFPpCdD5phPsXWbesp7OZz/droJ5Di/ZZ7XVUD1dTXU4rvDd0W56Bb4Mi1EFrPcngUZjoa4bVVzXx5jbpKsTJ/sIHnxmJLDnbgRLKOim++C3q9nfaQ+fznN18w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=sOHuIbBX; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="sOHuIbBX" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id CE74E4E40D4C; Fri, 10 Jul 2026 18:22:32 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id A261560342; Fri, 10 Jul 2026 18:22:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2477211BD2C25; Fri, 10 Jul 2026 20:22:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1783707751; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=5VAwh3lyqUj5Vaw5u3vKlNvlRD6QqBhxQWsMOqs917s=; b=sOHuIbBXCBaipjDv/q8zAe+W6BjjedimEYmrh5bBwww7ODcyXWhROdlp1SH+Njcucd3i3q 5H0u8yID9sIQH8tgI8aK9MsZRj3yPZCaBPo03JDPAm4k7amDWtt5KO9S+TN+Epd9YnvukI u1LlVTxWGMY/ZPbvQIsAos0dmfe2KoDre9lTs9r4FJBHLUksZRvnMH9w/kH98gFuY9m4Jn J4fY/hfDQHsiilw3du89pQR97zrlE4FjJbv3bvsovJJX1ZrN3fEChkBIZGCoa66P/qjkqA VKHuVqcz83/Avw6DPFLeZ7614OV4Z8iqwdw/SNjQBD8cdg+f6LFK5kyE4SbpIA== From: "Miquel Raynal (Schneider Electric)" Date: Fri, 10 Jul 2026 20:22:02 +0200 Subject: [PATCH v2 7/7] clk: tests: Add Kunit testing for nexus nodes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-7-b4680787377e@bootlin.com> References: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> In-Reply-To: <20260710-schneider-v7-2-rc1-eip201-upstream-v2-0-b4680787377e@bootlin.com> To: Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Brendan Higgins , David Gow , Rae Moar Cc: Thomas Petazzoni , Pascal EBERHARD , Wolfram Sang , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, "Miquel Raynal (Schneider Electric)" X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 Add a nexus node with a child requesting a mapped clock in the fake DT overlay to verify that the parsing is also correctly working. Suggested-by: Stephen Boyd Signed-off-by: Miquel Raynal (Schneider Electric) --- drivers/clk/clk_kunit_helpers.c | 31 ++++++++++++++++++++++++++++= +++ drivers/clk/clk_test.c | 15 +++++++++++++++ drivers/clk/kunit_clk_parse_clkspec.dtso | 10 ++++++++++ include/kunit/clk.h | 2 ++ 4 files changed, 58 insertions(+) diff --git a/drivers/clk/clk_kunit_helpers.c b/drivers/clk/clk_kunit_helper= s.c index 68a28e70bb61..151f62ab57c1 100644 --- a/drivers/clk/clk_kunit_helpers.c +++ b/drivers/clk/clk_kunit_helpers.c @@ -233,5 +233,36 @@ int of_clk_add_hw_provider_kunit(struct kunit *test, s= truct device_node *np, } EXPORT_SYMBOL_GPL(of_clk_add_hw_provider_kunit); =20 +KUNIT_DEFINE_ACTION_WRAPPER(of_node_put_wrapper, of_node_put, struct devic= e_node *); + +/** + * of_find_node_by_name_kunit() - Test managed of_find_node_by_name() + * @test: The test context + * @from: Parent device node to start searching from, or NULL to search fr= om root + * @name: The name string to match against + * + * Just like of_find_node_by_name(), except the device_noded is managed by + * the test case and is automatically put after the test case concludes. + * + * Return: the device_node on success or a negative errno value on failure. + */ +struct device_node *of_find_node_by_name_kunit(struct kunit *test, struct = device_node *from, + const char *name) +{ + struct device_node *np; + int ret; + + np =3D of_find_node_by_name(from, name); + if (!np) + return NULL; + + ret =3D kunit_add_action_or_reset(test, of_node_put_wrapper, np); + if (ret) + return ERR_PTR(ret); + + return np; +} +EXPORT_SYMBOL_GPL(of_find_node_by_name_kunit); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("KUnit helpers for clk providers and consumers"); diff --git a/drivers/clk/clk_test.c b/drivers/clk/clk_test.c index 5f3ffda033c3..bebfd928ab36 100644 --- a/drivers/clk/clk_test.c +++ b/drivers/clk/clk_test.c @@ -3656,10 +3656,25 @@ static void of_clk_get_parent_name_gets_parent_name= (struct kunit *test) of_clk_get_parent_name(ctx->cons_np, 0)); } =20 +static void of_clk_get_hw_maps_thru_nexus(struct kunit *test) +{ + struct clk_parse_clkspec_ctx *ctx =3D test->priv; + struct clk_hw *expected; + struct device_node *np; + + np =3D of_find_node_by_name_kunit(test, NULL, "kunit-clock-nexus-child"); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, np); + expected =3D of_clk_get_hw(ctx->cons_np, 1, NULL); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, expected); + + KUNIT_EXPECT_PTR_EQ(test, expected, of_clk_get_hw(np, 0, NULL)); +} + static struct kunit_case clk_parse_clkspec_test_cases[] =3D { KUNIT_CASE(clk_parse_clkspec_with_correct_index_and_name), KUNIT_CASE(clk_parse_clkspec_with_incorrect_index_and_name), KUNIT_CASE(of_clk_get_parent_name_gets_parent_name), + KUNIT_CASE(of_clk_get_hw_maps_thru_nexus), {} }; =20 diff --git a/drivers/clk/kunit_clk_parse_clkspec.dtso b/drivers/clk/kunit_c= lk_parse_clkspec.dtso index c93feb93e101..a4115216d2aa 100644 --- a/drivers/clk/kunit_clk_parse_clkspec.dtso +++ b/drivers/clk/kunit_clk_parse_clkspec.dtso @@ -18,4 +18,14 @@ kunit-clock-consumer { clocks =3D <&kunit_clock_provider1 0>, <&kunit_clock_provider2 0>; clock-names =3D "first_clock", "second_clock"; }; + + kunit_clock_nexus: kunit-clock-nexus { + clocks =3D <&kunit_clock_provider2 0>; + clock-map =3D <&kunit_clock_provider2 0>; + #clock-cells =3D <0>; + + kunit-clock-nexus-child { + clocks =3D <&kunit_clock_nexus>; + }; + }; }; diff --git a/include/kunit/clk.h b/include/kunit/clk.h index f226044cc78d..ab24f7747516 100644 --- a/include/kunit/clk.h +++ b/include/kunit/clk.h @@ -29,5 +29,7 @@ int of_clk_hw_register_kunit(struct kunit *test, struct d= evice_node *node, int of_clk_add_hw_provider_kunit(struct kunit *test, struct device_node *n= p, struct clk_hw *(*get)(struct of_phandle_args *clkspec, void *data), void *data); +struct device_node *of_find_node_by_name_kunit(struct kunit *test, struct = device_node *from, + const char *name); =20 #endif --=20 2.54.0