Skip to contentSkip to conversation

arm: mach-k3: j722s: Enable ESM to support watchdogs

PATCH In review Keerthy 3 participants 5 messages Feb 17, 2025 – Mar 4, 2025

Subsystems (2)
lore
Share & tools
lore

Keerthy

author
#0 lore raw

cover arm: mach-k3: j722s: Enable ESM to support watchdogs

The series enables watchdog support on J722S. It adds ESM initialization to enable routing the watchdog events to trigger a SOC reset.

Tested on J722S-EVM.

Keerthy (2):
arm: mach-k3: j722s: Initialize MCU & MAIN Domain ESMs
configs: j722s_evm_r5_defconfig: Enable the ESM Configs to support
watchdog

 arch/arm/mach-k3/j722s/j722s_init.c | 32 +++++++++++++++++++++++++++++
 configs/j722s_evm_r5_defconfig      |  3 +++
 2 files changed, 35 insertions(+)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 arm: mach-k3: j722s: Initialize MCU & MAIN Domain ESMs

Initialize MCU & MAIN Domain ESMs as a prerequisite to enable watchdog reset functionality. The ESM aka error signalling module is primarily responsible for sensing the watchdog reset event.

---
 arch/arm/mach-k3/j722s/j722s_init.c | 32 +++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm/mach-k3/j722s/j722s_init.c +32 -0
index f8c5c2a5edc..af211377e7c 100644
@@ -27,6 +27,9 @@ struct fwl_data cbass_main_fwls[] = {
 u32 bootindex __section(".data");
 static struct rom_extended_boot_data bootdata __section(".data");
 
+#define CTRLMMR_MCU_RST_CTRL	(MCU_CTRL_MMR0_BASE + 0x18170)
+#define RST_CTRL_ESM_ERROR_RST_EN_Z_MASK  (~BIT(17))
+
 static void store_boot_info_from_rom(void)
 {
 	bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
@@ -161,11 +164,40 @@ static void k3_mem_init(void)
 	}
 }
 
+static __maybe_unused void enable_mcu_esm_reset(void)
+{
+	/* Set CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RST_EN_Z  to '0' (low active) */
+	u32 stat = readl(CTRLMMR_MCU_RST_CTRL);
+
+	stat &= RST_CTRL_ESM_ERROR_RST_EN_Z_MASK;
+	writel(stat, CTRLMMR_MCU_RST_CTRL);
+}
+
 void board_init_f(ulong dummy)
 {
+	int ret;
+	struct udevice *dev;
+
 	k3_spl_init();
 	k3_mem_init();
 	setup_qos();
+
+	if (IS_ENABLED(CONFIG_ESM_K3)) {
+		/* Probe/configure ESM0 */
+		ret = uclass_get_device_by_name(UCLASS_MISC, "esm@420000", &dev);
+		if (ret) {
+			printf("esm main init failed: %d\n", ret);
+			return;
+		}
+
+		/* Probe/configure MCUESM */
+		ret = uclass_get_device_by_name(UCLASS_MISC, "esm@4100000", &dev);
+		if (ret) {
+			printf("esm mcu init failed: %d\n", ret);
+			return;
+		}
+		enable_mcu_esm_reset();
+	}
 }
 
 static u32 __get_backup_bootmedia(u32 devstat)
Signature · 1 line
2.17.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] arm: mach-k3: j722s: Initialize MCU & MAIN Domain ESMs

Quoted 8 lines · Keerthy

Initialize MCU & MAIN Domain ESMs as a prerequisite to enable watchdog reset functionality. The ESM aka error signalling module is primarily responsible for sensing the watchdog reset event.

---
  arch/arm/mach-k3/j722s/j722s_init.c | 32 +++++++++++++++++++++++++++++
  1 file changed, 32 insertions(+)
Quoted 55 lines
arch/arm/mach-k3/j722s/j722s_init.c +32 -0
index f8c5c2a5edc..af211377e7c 100644
@@ -27,6 +27,9 @@ struct fwl_data cbass_main_fwls[] = {
  u32 bootindex __section(".data");
  static struct rom_extended_boot_data bootdata __section(".data");
 
+#define CTRLMMR_MCU_RST_CTRL	(MCU_CTRL_MMR0_BASE + 0x18170)
+#define RST_CTRL_ESM_ERROR_RST_EN_Z_MASK  (~BIT(17))
+
  static void store_boot_info_from_rom(void)
  {
  	bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
@@ -161,11 +164,40 @@ static void k3_mem_init(void)
  	}
  }
 
+static __maybe_unused void enable_mcu_esm_reset(void)
+{
+	/* Set CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RST_EN_Z  to '0' (low active) */
+	u32 stat = readl(CTRLMMR_MCU_RST_CTRL);
+
+	stat &= RST_CTRL_ESM_ERROR_RST_EN_Z_MASK;
+	writel(stat, CTRLMMR_MCU_RST_CTRL);
+}
+
  void board_init_f(ulong dummy)
  {
+	int ret;
+	struct udevice *dev;
+
  	k3_spl_init();
  	k3_mem_init();
  	setup_qos();
+
+	if (IS_ENABLED(CONFIG_ESM_K3)) {
+		/* Probe/configure ESM0 */
+		ret = uclass_get_device_by_name(UCLASS_MISC, "esm@420000", &dev);
+		if (ret) {
+			printf("esm main init failed: %d\n", ret);
+			return;
+		}
+
+		/* Probe/configure MCUESM */
+		ret = uclass_get_device_by_name(UCLASS_MISC, "esm@4100000", &dev);
+		if (ret) {
+			printf("esm mcu init failed: %d\n", ret);
+			return;
+		}
+		enable_mcu_esm_reset();
+	}
  }
 
  static u32 __get_backup_bootmedia(u32 devstat)
author
#3 lore raw

PATCH 2/2 configs: j722s_evm_r5_defconfig: Enable the ESM Configs to support watchdog

In reply to Keerthy

Enable ESM configs. ESMs are a prerequisite to enable watchdog reset functionality. The ESM aka error signalling module is primarily responsible for sensing the watchdog reset event.

---
 configs/j722s_evm_r5_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/j722s_evm_r5_defconfig +3 -0
index a78a66d33a7..3bf2a74b3d2 100644
@@ -127,4 +127,7 @@ CONFIG_TIMER=y
 CONFIG_SPL_TIMER=y
 CONFIG_OMAP_TIMER=y
 CONFIG_LIB_RATIONAL=y
+CONFIG_ESM_K3=y
+CONFIG_SPL_DRIVERS_MISC=y
+CONFIG_SPL_MISC=y
 CONFIG_SPL_LIB_RATIONAL=y
Signature · 1 line
2.17.1
#4 lore raw
In reply to Keerthy
Quoted 11 lines · Keerthy

The series enables watchdog support on J722S. It adds ESM initialization to enable routing the watchdog events to trigger a SOC reset.

Tested on J722S-EVM.

Keerthy (2):
arm: mach-k3: j722s: Initialize MCU & MAIN Domain ESMs
configs: j722s_evm_r5_defconfig: Enable the ESM Configs to support
watchdog

[...]

Applied to u-boot/next, thanks!

Signature · 1 line
Tom