diff mbox series

[v4,2/7] arm: mach-k3: common: add helper to wait for TIFS initialization

Message ID 20261104-v2026-10-next-topic-am62-hs-se-fix-unlock-race-v4-2-e211cba9f3ea@baylibre.com
State New
Delegated to: Tom Rini
Headers show
Series K3: wait for TIFS init before CTRL_MMR unlock | expand

Commit Message

Markus Schneider-Pargmann Nov. 4, 2026, 10:58 a.m. UTC
Add a helper to wait for TIFS initialization to be finished. Effectively
this is just a call to get_ti_sci_handle() but I think a separate
function makes the purpose of this call better visible.

get_ti_sci_handle() internally leads to fetching the TIFS version with a
message and response. TIFS only responds once initialization finished.
If a response is not received get_ti_sci_handle() returns after a
timeout.

Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
Tested-by: Richard Genoud <richard.genoud@bootlin.com> # on j722s HS-FS
---
 arch/arm/mach-k3/common.c | 10 ++++++++++
 arch/arm/mach-k3/common.h |  1 +
 2 files changed, 11 insertions(+)

Comments

Neha Malcom Francis Nov. 4, 2026, 12:56 p.m. UTC | #1
On Wed, 04 Nov 2026 11:58:20 +0100, Markus Schneider-Pargmann <msp@baylibre.com> wrote:
> Add a helper to wait for TIFS initialization to be finished. Effectively
> this is just a call to get_ti_sci_handle() but I think a separate
> function makes the purpose of this call better visible.
> 
> get_ti_sci_handle() internally leads to fetching the TIFS version with a
> message and response. TIFS only responds once initialization finished.
> If a response is not received get_ti_sci_handle() returns after a
> timeout.
> 
> [...]

Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
diff mbox series

Patch

diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 6e382efdb3be..480c90cfa65f 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -54,6 +54,16 @@  struct ti_sci_handle *get_ti_sci_handle(void)
 	return (struct ti_sci_handle *)ti_sci_get_handle_from_sysfw(dev);
 }
 
+void k3_sysfw_wait_ready(void)
+{
+	/*
+	 * Wait for TIFS initialization to finish. This helper is used to make
+	 * sure TIFS removed the firewall before U-Boot tries to unlock CTRL_MMR
+	 * registers and continues the boot.
+	 */
+	get_ti_sci_handle();
+}
+
 void k3_sysfw_print_ver(void)
 {
 	struct ti_sci_handle *ti_sci = get_ti_sci_handle();
diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
index 37ff98d89924..146b986febc6 100644
--- a/arch/arm/mach-k3/common.h
+++ b/arch/arm/mach-k3/common.h
@@ -38,6 +38,7 @@  void disable_linefill_optimization(void);
 int remove_fwl_region(struct fwl_data *fwl);
 void remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);
 int load_firmware(char *name_fw, char *name_loadaddr, u32 *loadaddr);
+void k3_sysfw_wait_ready(void);
 void k3_sysfw_print_ver(void);
 void k3_dm_print_ver(void);
 void spl_enable_cache(void);