public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] cpufreq: ti: Fix probe ordering and add device link support for K3 SoCs
@ 2026-03-30 12:01 Akashdeep Kaur
  2026-03-30 12:01 ` [PATCH 1/5] cpufreq: ti: Add EPROBE_DEFER " Akashdeep Kaur
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Akashdeep Kaur @ 2026-03-30 12:01 UTC (permalink / raw)
  To: praneeth, nm, vigneshr, kristo, robh, krzk+dt, conor+dt, rafael,
	viresh.kumar, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm, d-gole
  Cc: vishalm, sebin.francis, k-willis, a-kaur

For K3 SoCs, ti-cpufreq depends on k3-socinfo to provide SoC revision
information via soc_device_match(). If ti-cpufreq probes before
k3-socinfo, soc_device_match() returns NULL, causing incorrect 
revision detection and OPP table initialization failures.

Add EPROBE_DEFER handling in ti-cpufreq when soc_device_match() fails
for K3 SoCs, ensuring k3-socinfo probes first.

Add device link support via a new DT property "ti,soc-info" in CPU
OPP tables. Device links prevent unbinding k3-socinfo while
ti-cpufreq is using it.

EPROBE_DEFER handles first-boot probe ordering, while device links
provide runtime dependency management.

For backward compatibility, the DT property is optional.

Signed-off-by: Akashdeep Kaur <a-kaur@ti.com>
---

Akashdeep Kaur (5):
  cpufreq: ti: Add EPROBE_DEFER for K3 SoCs
  arm64: dts: ti: k3-am625: Add ti,soc-info to OPP table
  arm64: dts: ti: k3-am62a7: Add ti,soc-info to OPP table
  arm64: dts: ti: k3-am62p5: Add ti,soc-info to OPP table
  cpufreq: ti: Add device link to k3-socinfo

 arch/arm64/boot/dts/ti/k3-am625.dtsi  |  1 +
 arch/arm64/boot/dts/ti/k3-am62a7.dtsi |  1 +
 arch/arm64/boot/dts/ti/k3-am62p5.dtsi |  1 +
 drivers/cpufreq/ti-cpufreq.c          | 57 +++++++++++++++++++++++++++
 4 files changed, 60 insertions(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] cpufreq: ti: Add EPROBE_DEFER for K3 SoCs
  2026-03-30 12:01 [PATCH 0/5] cpufreq: ti: Fix probe ordering and add device link support for K3 SoCs Akashdeep Kaur
@ 2026-03-30 12:01 ` Akashdeep Kaur
  2026-03-30 12:01 ` [PATCH 2/5] arm64: dts: ti: k3-am625: Add ti,soc-info to OPP table Akashdeep Kaur
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Akashdeep Kaur @ 2026-03-30 12:01 UTC (permalink / raw)
  To: praneeth, nm, vigneshr, kristo, robh, krzk+dt, conor+dt, rafael,
	viresh.kumar, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm, d-gole
  Cc: vishalm, sebin.francis, k-willis, a-kaur

Defer probe when k3-socinfo hasn't registered the SoC device yet.
Fixes incorrect revision detection when ti-cpufreq probes first.

Signed-off-by: Akashdeep Kaur <a-kaur@ti.com>
---
 drivers/cpufreq/ti-cpufreq.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index 3d1129aeed02..88f7912ef6a8 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -441,6 +441,15 @@ static int ti_cpufreq_get_rev(struct ti_cpufreq_data *opp_data,
 		 */
 		*revision_value = 0x1;
 		goto done;
+	} else if (opp_data->soc_data == &am625_soc_data ||
+		   opp_data->soc_data == &am62a7_soc_data ||
+		   opp_data->soc_data == &am62l3_soc_data ||
+		   opp_data->soc_data == &am62p5_soc_data) {
+		/*
+		 * For K3 SoCs, if soc_device_match fails, socinfo hasn't
+		 * probed yet. Defer probe to wait for it.
+		 */
+		return -EPROBE_DEFER;
 	}
 
 	ret = regmap_read(opp_data->syscon, opp_data->soc_data->rev_offset,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] arm64: dts: ti: k3-am625: Add ti,soc-info to OPP table
  2026-03-30 12:01 [PATCH 0/5] cpufreq: ti: Fix probe ordering and add device link support for K3 SoCs Akashdeep Kaur
  2026-03-30 12:01 ` [PATCH 1/5] cpufreq: ti: Add EPROBE_DEFER " Akashdeep Kaur
@ 2026-03-30 12:01 ` Akashdeep Kaur
  2026-03-30 12:01 ` [PATCH 3/5] arm64: dts: ti: k3-am62a7: " Akashdeep Kaur
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Akashdeep Kaur @ 2026-03-30 12:01 UTC (permalink / raw)
  To: praneeth, nm, vigneshr, kristo, robh, krzk+dt, conor+dt, rafael,
	viresh.kumar, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm, d-gole
  Cc: vishalm, sebin.francis, k-willis, a-kaur

Link CPU OPP table to k3-socinfo driver for dependency tracking.

Signed-off-by: Akashdeep Kaur <a-kaur@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am625.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am625.dtsi b/arch/arm64/boot/dts/ti/k3-am625.dtsi
index c249883a8a8d..b0020e667882 100644
--- a/arch/arm64/boot/dts/ti/k3-am625.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am625.dtsi
@@ -109,6 +109,7 @@ a53_opp_table: opp-table {
 		compatible = "operating-points-v2-ti-cpu";
 		opp-shared;
 		syscon = <&opp_efuse_table>;
+		ti,soc-info = <&chipid>;
 
 		opp-200000000 {
 			opp-hz = /bits/ 64 <200000000>;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] arm64: dts: ti: k3-am62a7: Add ti,soc-info to OPP table
  2026-03-30 12:01 [PATCH 0/5] cpufreq: ti: Fix probe ordering and add device link support for K3 SoCs Akashdeep Kaur
  2026-03-30 12:01 ` [PATCH 1/5] cpufreq: ti: Add EPROBE_DEFER " Akashdeep Kaur
  2026-03-30 12:01 ` [PATCH 2/5] arm64: dts: ti: k3-am625: Add ti,soc-info to OPP table Akashdeep Kaur
@ 2026-03-30 12:01 ` Akashdeep Kaur
  2026-03-30 12:01 ` [PATCH 4/5] arm64: dts: ti: k3-am62p5: " Akashdeep Kaur
  2026-03-30 12:01 ` [PATCH 5/5] cpufreq: ti: Add device link to k3-socinfo Akashdeep Kaur
  4 siblings, 0 replies; 6+ messages in thread
From: Akashdeep Kaur @ 2026-03-30 12:01 UTC (permalink / raw)
  To: praneeth, nm, vigneshr, kristo, robh, krzk+dt, conor+dt, rafael,
	viresh.kumar, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm, d-gole
  Cc: vishalm, sebin.francis, k-willis, a-kaur

Link CPU OPP table to k3-socinfo driver for dependency tracking.

Signed-off-by: Akashdeep Kaur <a-kaur@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62a7.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62a7.dtsi b/arch/arm64/boot/dts/ti/k3-am62a7.dtsi
index b6e5eee99370..6d1459e9ea71 100644
--- a/arch/arm64/boot/dts/ti/k3-am62a7.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62a7.dtsi
@@ -109,6 +109,7 @@ a53_opp_table: opp-table {
 		compatible = "operating-points-v2-ti-cpu";
 		opp-shared;
 		syscon = <&opp_efuse_table>;
+		ti,soc-info = <&chipid>;
 
 		opp-200000000 {
 			opp-hz = /bits/ 64 <200000000>;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] arm64: dts: ti: k3-am62p5: Add ti,soc-info to OPP table
  2026-03-30 12:01 [PATCH 0/5] cpufreq: ti: Fix probe ordering and add device link support for K3 SoCs Akashdeep Kaur
                   ` (2 preceding siblings ...)
  2026-03-30 12:01 ` [PATCH 3/5] arm64: dts: ti: k3-am62a7: " Akashdeep Kaur
@ 2026-03-30 12:01 ` Akashdeep Kaur
  2026-03-30 12:01 ` [PATCH 5/5] cpufreq: ti: Add device link to k3-socinfo Akashdeep Kaur
  4 siblings, 0 replies; 6+ messages in thread
From: Akashdeep Kaur @ 2026-03-30 12:01 UTC (permalink / raw)
  To: praneeth, nm, vigneshr, kristo, robh, krzk+dt, conor+dt, rafael,
	viresh.kumar, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm, d-gole
  Cc: vishalm, sebin.francis, k-willis, a-kaur

Link CPU OPP table to k3-socinfo driver for dependency tracking.

Signed-off-by: Akashdeep Kaur <a-kaur@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am62p5.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62p5.dtsi b/arch/arm64/boot/dts/ti/k3-am62p5.dtsi
index 8982a7b9f1a6..1a498c5eb3d1 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p5.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62p5.dtsi
@@ -108,6 +108,7 @@ a53_opp_table: opp-table {
 		compatible = "operating-points-v2-ti-cpu";
 		opp-shared;
 		syscon = <&opp_efuse_table>;
+		ti,soc-info = <&chipid>;
 
 		opp-200000000 {
 			opp-hz = /bits/ 64 <200000000>;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] cpufreq: ti: Add device link to k3-socinfo
  2026-03-30 12:01 [PATCH 0/5] cpufreq: ti: Fix probe ordering and add device link support for K3 SoCs Akashdeep Kaur
                   ` (3 preceding siblings ...)
  2026-03-30 12:01 ` [PATCH 4/5] arm64: dts: ti: k3-am62p5: " Akashdeep Kaur
@ 2026-03-30 12:01 ` Akashdeep Kaur
  4 siblings, 0 replies; 6+ messages in thread
From: Akashdeep Kaur @ 2026-03-30 12:01 UTC (permalink / raw)
  To: praneeth, nm, vigneshr, kristo, robh, krzk+dt, conor+dt, rafael,
	viresh.kumar, linux-arm-kernel, devicetree, linux-kernel,
	linux-pm, d-gole
  Cc: vishalm, sebin.francis, k-willis, a-kaur

Create explicit device link when OPP table has ti,soc-info property.
Prevents unbinding k3-socinfo while ti-cpufreq is using it.

Signed-off-by: Akashdeep Kaur <a-kaur@ti.com>
---
 drivers/cpufreq/ti-cpufreq.c | 48 ++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index 88f7912ef6a8..60c34b0da0c5 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/of.h>
+#include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/pm_opp.h>
 #include <linux/regmap.h>
@@ -111,6 +112,7 @@ struct ti_cpufreq_data {
 	struct device_node *opp_node;
 	struct regmap *syscon;
 	const struct ti_cpufreq_soc_data *soc_data;
+	struct device_link *soc_link;
 };
 
 static unsigned long amx3_efuse_xlate(struct ti_cpufreq_data *opp_data,
@@ -542,6 +544,7 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	opp_data->soc_data = match->data;
+	platform_set_drvdata(pdev, opp_data);
 
 	opp_data->cpu_dev = get_cpu_device(0);
 	if (!opp_data->cpu_dev) {
@@ -560,6 +563,42 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
 	if (ret)
 		goto fail_put_node;
 
+	/* Create device link to k3-socinfo if specified in DT */
+	if (opp_data->soc_data == &am625_soc_data ||
+	    opp_data->soc_data == &am62a7_soc_data ||
+	    opp_data->soc_data == &am62l3_soc_data ||
+	    opp_data->soc_data == &am62p5_soc_data) {
+		struct device_node *socinfo_np;
+
+		socinfo_np = of_parse_phandle(opp_data->opp_node, "ti,soc-info", 0);
+		if (socinfo_np) {
+			struct platform_device *socinfo_pdev;
+			struct device_link *link;
+
+			socinfo_pdev = of_find_device_by_node(socinfo_np);
+			of_node_put(socinfo_np);
+
+			if (!socinfo_pdev) {
+				ret = -EPROBE_DEFER;
+				goto fail_put_node;
+			}
+
+			if (!socinfo_pdev->dev.driver) {
+				put_device(&socinfo_pdev->dev);
+				ret = -EPROBE_DEFER;
+				goto fail_put_node;
+			}
+
+			link = device_link_add(opp_data->cpu_dev,
+					       &socinfo_pdev->dev,
+					       DL_FLAG_STATELESS);
+			if (link)
+				opp_data->soc_link = link;
+
+			put_device(&socinfo_pdev->dev);
+		}
+	}
+
 	/*
 	 * OPPs determine whether or not they are supported based on
 	 * two metrics:
@@ -600,6 +639,14 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
 	return ret;
 }
 
+static void ti_cpufreq_remove(struct platform_device *pdev)
+{
+	struct ti_cpufreq_data *opp_data = platform_get_drvdata(pdev);
+
+	if (opp_data && opp_data->soc_link)
+		device_link_del(opp_data->soc_link);
+}
+
 static int __init ti_cpufreq_init(void)
 {
 	const struct of_device_id *match;
@@ -616,6 +663,7 @@ module_init(ti_cpufreq_init);
 
 static struct platform_driver ti_cpufreq_driver = {
 	.probe = ti_cpufreq_probe,
+	.remove = ti_cpufreq_remove,
 	.driver = {
 		.name = "ti-cpufreq",
 	},
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-30 12:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 12:01 [PATCH 0/5] cpufreq: ti: Fix probe ordering and add device link support for K3 SoCs Akashdeep Kaur
2026-03-30 12:01 ` [PATCH 1/5] cpufreq: ti: Add EPROBE_DEFER " Akashdeep Kaur
2026-03-30 12:01 ` [PATCH 2/5] arm64: dts: ti: k3-am625: Add ti,soc-info to OPP table Akashdeep Kaur
2026-03-30 12:01 ` [PATCH 3/5] arm64: dts: ti: k3-am62a7: " Akashdeep Kaur
2026-03-30 12:01 ` [PATCH 4/5] arm64: dts: ti: k3-am62p5: " Akashdeep Kaur
2026-03-30 12:01 ` [PATCH 5/5] cpufreq: ti: Add device link to k3-socinfo Akashdeep Kaur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox