All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mach-snapdragon: of_fixup: enable APSS watchdog at EL2
@ 2026-11-30 10:56 Balaji Selvanathan
  2026-12-01 18:26 ` Stephan Gerhold
  0 siblings, 1 reply; 2+ messages in thread
From: Balaji Selvanathan @ 2026-11-30 10:56 UTC (permalink / raw)
  To: Sumit Garg, u-boot-qcom, u-boot
  Cc: Tom Rini, Ilias Apalodimas, Casey Connolly, Neil Armstrong,
	Michael Srba, Balaji Selvanathan

On Qualcomm SoCs where Gunyah Hypervisor owns the APSS watchdog, such as
SC7280/QCM6490, the node is marked status = "reserved", so U-Boot
never binds qcom_wdt and "wdt list" is empty.

With QCOM_EL2_GUNYAH_EXIT_SUPPORT, U-Boot exits Gunyah early and runs
at EL2 (from EL1), and the watchdog is free to use. In that case set
any reserved "qcom,kpss-wdt" node to "okay" in the live tree. SoCs
whose watchdog is not reserved are left untouched.

Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
---
 arch/arm/mach-snapdragon/of_fixup.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c
index 586a5f4d553..5bc3b8ed4b6 100644
--- a/arch/arm/mach-snapdragon/of_fixup.c
+++ b/arch/arm/mach-snapdragon/of_fixup.c
@@ -18,6 +18,7 @@
 
 #define pr_fmt(fmt) "of_fixup: " fmt
 
+#include <asm/system.h>
 #include <dt-bindings/input/linux-event-codes.h>
 #include <dm/of_access.h>
 #include <dm/of.h>
@@ -260,6 +261,38 @@ static void add_optee_node(struct device_node *root)
 	}
 }
 
+/*
+ * The APSS watchdog is marked "reserved" on SoCs where Gunyah hypervisor owns it.
+ * Once Gunyah has been exited it is free for U-Boot to use.
+ */
+static void fixup_wdt_node(struct device_node *root)
+{
+	struct device_node *np = NULL;
+	const char *status;
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_QCOM_EL2_GUNYAH_EXIT_SUPPORT))
+		return;
+
+	while ((np = of_find_compatible_node(np, NULL, "qcom,kpss-wdt"))) {
+		status = of_get_property(np, "status", NULL);
+		if (!status || strcmp(status, "reserved"))
+			continue;
+
+		if (current_el() != 2) {
+			log_warning("Gunyah exit failed, %s left reserved\n",
+				    np->name);
+			return;
+		}
+
+		ret = of_write_prop(np, "status", strlen("okay") + 1, "okay");
+		if (ret)
+			log_warning("Failed to enable %s: %d\n", np->name, ret);
+		else
+			debug("Enabled %s (running at EL2)\n", np->full_name);
+	}
+}
+
 #define time_call(func, ...) \
 	do { \
 		u64 start = timer_get_us(); \
@@ -272,6 +305,7 @@ static int qcom_of_fixup_nodes(void * __maybe_unused ctx, struct event *event)
 	struct device_node *root = event->data.of_live_built.root;
 
 	time_call(fixup_usb_nodes, root);
+	time_call(fixup_wdt_node, root);
 
 	if (IS_ENABLED(CONFIG_OPTEE) && is_optee_smc_api())
 		time_call(add_optee_node, root);

---
base-commit: 9d67454e920b3908529c9fc642a8c911db040896
change-id: 20261127-qcom-enable-apss-wdt-el2-f7060cf42393

Best regards,
-- 
Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 10:56 [PATCH] mach-snapdragon: of_fixup: enable APSS watchdog at EL2 Balaji Selvanathan
2026-12-01 18:26 ` Stephan Gerhold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.