git: 4840558e5219 - main - OFW: Improve OFW_CPU.

From: Michal Meloun <mmel_at_FreeBSD.org>
Date: Sun, 22 Feb 2026 17:53:49 UTC
The branch main has been updated by mmel:

URL: https://cgit.FreeBSD.org/src/commit/?id=4840558e521934345793ef83b0d45a72fd615a7b

commit 4840558e521934345793ef83b0d45a72fd615a7b
Author:     Michal Meloun <mmel@FreeBSD.org>
AuthorDate: 2025-11-06 19:01:18 +0000
Commit:     Michal Meloun <mmel@FreeBSD.org>
CommitDate: 2026-02-22 17:53:27 +0000

    OFW: Improve OFW_CPU.
    
    Accept the assigned clock on the CPU node.
    Don't report a missing "clock-frequency" property if the CPU node has
    a "clocks" property.
    
    MFC after:      3 weeks
---
 sys/dev/ofw/ofw_cpu.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sys/dev/ofw/ofw_cpu.c b/sys/dev/ofw/ofw_cpu.c
index 852ce6ea3759..7da34af6592a 100644
--- a/sys/dev/ofw/ofw_cpu.c
+++ b/sys/dev/ofw/ofw_cpu.c
@@ -43,7 +43,7 @@
 #include <dev/ofw/ofw_bus_subr.h>
 #include <dev/ofw/ofw_cpu.h>
 
-#if defined(__arm__) || defined(__arm64__) || defined(__riscv)
+#if defined(__arm__) || defined(__aarch64__) || defined(__riscv)
 #include <dev/clk/clk.h>
 #define	HAS_CLK
 #endif
@@ -343,6 +343,11 @@ ofw_cpu_attach(device_t dev)
 	if (sc->sc_cpu_pcpu == NULL)
 		sc->sc_cpu_pcpu = pcpu_find(device_get_unit(dev));
 
+#ifdef HAS_CLK
+	clk_set_assigned(dev, node);
+	if (!OF_hasprop(node, "clocks")) {
+#endif
+
 	if (OF_getencprop(node, "clock-frequency", &cell, sizeof(cell)) < 0) {
 		if (get_freq_from_clk(dev, sc) != 0) {
 			if (bootverbose)
@@ -357,6 +362,10 @@ ofw_cpu_attach(device_t dev)
 		    sc->sc_nominal_mhz);
 
 	OF_device_register_xref(OF_xref_from_node(node), dev);
+
+#ifdef HAS_CLK
+	}
+#endif
 	bus_identify_children(dev);
 	bus_attach_children(dev);
 	return (0);