Thanks for the pointers. Here is my patch (I tested it by dropping it into the right userpatches directory, compiling the kernel and then booting):
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Steinar H. Gunderson <steinar+kernel@gunderson.no>
Date: Mon, 4 Nov 2024 15:35:38 +0000
Subject: Fix broken allwinner,sram dependency on CB1
On BigTreeTech CB1, the thermal sensor has an allwinner,sram
property pointing to <&syscon>. However, Armbian has an out-of-tree
kernel patch that creates dependencies based on allwinner,sram
properties, which assumes that they point to sram nodes exactly
two levels below the syscon node (instead of the syscon itself).
This manifests itself as the thermal sensor refusing to load with
a nonsensical error message:
[ 23.775976] platform 5070400.thermal-sensor: deferred probe pending: platform: wait for supplier
Note that it does not say _which_ supplier it is waiting for
(the message ends in a space and then no supplier). The patch
was unproblematic in the 5.6 megous patch set, where it was
introduced, and in 6.6, which is current for Armbian, but in
6.8, the sun8i-thermal driver got mainlined, with this extra
property compared to the out-of-tree version we used before
(since it wants to clear a special bit at 0x300000 instead of
relying on the firmware to do so before kernel boot).
Fix by being a bit more flexible when we walk up the tree,
so that we always stop at the syscon node.
Tested on a Sovol SV08, which is CB1-based.
Signed-off-by: Steinar H. Gunderson <steinar+kernel@gunderson.no>
---
drivers/of/property.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 6fcfcda9d..f00f2b129 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1368,12 +1368,13 @@ static struct device_node *parse_allwinner_sram(struct device_node *np,
if (index > 0)
return NULL;
sram_node = of_parse_phandle(np, prop_name, 0);
- sram_node = of_get_parent(sram_node);
- sram_node = of_get_parent(sram_node);
+ while (sram_node && !of_node_is_type(sram_node, "syscon")) {
+ sram_node = of_get_parent(sram_node);
+ }
return sram_node;
}
static const struct supplier_bindings of_supplier_bindings[] = {
--
Created with Armbian build tools https://github.com/armbian/build
I'm going to mark this as solved; I hope it can go upstream at some point.
Note that I think the most sensible thing to do is still just to delete the patch in question, not to patch it further. But I don't understand 100% why it was added in the first place; maybe there is some reason that is still valid for some platform.
I removed the patch, and the resulting kernel booted and found its thermal zones. So I think the basic issue is that the patch just is doing of_get_parent() twice without checking that this makes sense.
sesse@amalie:~$ uname -a
Linux amalie 6.11.2-edge-sunxi64 #2 SMP Fri Oct 4 14:38:57 UTC 2024 aarch64 GNU/Linux
sesse@amalie:~$ ls -l /sys/class/thermal/
total 0
lrwxrwxrwx 1 root root 0 Nov 3 20:28 cooling_device0 -> ../../devices/virtual/thermal/cooling_device0
lrwxrwxrwx 1 root root 0 Nov 3 20:25 thermal_zone0 -> ../../devices/virtual/thermal/thermal_zone0
lrwxrwxrwx 1 root root 0 Nov 3 20:25 thermal_zone1 -> ../../devices/virtual/thermal/thermal_zone1
lrwxrwxrwx 1 root root 0 Nov 3 20:25 thermal_zone2 -> ../../devices/virtual/thermal/thermal_zone2
lrwxrwxrwx 1 root root 0 Nov 3 20:25 thermal_zone3 -> ../../devices/virtual/thermal/thermal_zone3