armbian_build/patch/kernel/archive/sunxi-6.13/patches.megous/Fix-broken-allwinner-sram-dependency-on-h616-h618.patch
2025-03-21 10:24:35 +01:00

54 lines
2.0 KiB
Diff

From 0e540e11a2dbc6d669856c46101edeb3010bcdaa 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 h616, h618
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 551bbba1453e..4527bb1bbdef 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1438,8 +1438,9 @@ static struct device_node *parse_allwinner_sram(struct device_node *np,
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;
}
--
2.35.3