Skip to contentSkip to conversation

Enable MCU ESM reset

PATCH In review Judith Mendez 2 participants 4 messages Jan 29, 2025 – Feb 10, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Enable MCU ESM reset

This patch series enables ESM reset configuration in board_init_f for am62x and am62px devices.

This is necessary in order for error events to reset the system.

This patches are tested using watchdog to reset the system via ESM.

Santhosh Kumar K (2):
arm: mach-k3: am62*_init: Probe ESM nodes
configs: am62*_evm_r5: Enable ESM and MISC configs

 arch/arm/mach-k3/am62ax/am62a7_init.c | 26 ++++++++++++++++++++++++++
 arch/arm/mach-k3/am62px/am62p5_init.c | 26 ++++++++++++++++++++++++++
 configs/am62ax_evm_r5_defconfig       |  3 +++
 configs/am62px_evm_r5_defconfig       |  3 +++
 4 files changed, 58 insertions(+)

base-commit: d6da3dbaef57fc1d319b6b552efa009e2489d7d9

Signature · 1 line
2.48.0
#1 lore raw

PATCH 1/2 arm: mach-k3: am62*_init: Probe ESM nodes

From: Santhosh Kumar K <[email protected]>

On AM62A and AM62P devices, it is possible to route Main ESM error events to MCU ESM. MCU ESM high error output can trigger the reset logic to reset the device. So, for these devices we have Main ESM and MCU ESM nodes in the device tree. Add functions to probe these nodes if CONFIG_ESM_K3 is enabled.

---
 arch/arm/mach-k3/am62ax/am62a7_init.c | 26 ++++++++++++++++++++++++++
 arch/arm/mach-k3/am62px/am62p5_init.c | 26 ++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
arch/arm/mach-k3/am62ax/am62a7_init.c +26 -0
index 78153c97a58..698e6d5c587 100644
@@ -15,6 +15,9 @@
 #include "../sysfw-loader.h"
 #include "../common.h"
 
+#define CTRLMMR_MCU_RST_CTRL             0x04518170
+#define RST_CTRL_ESM_ERROR_RST_EN_Z_MASK 0xFFFDFFFF
+
 struct fwl_data cbass_main_fwls[] = {
        { "FSS_DAT_REG3", 7, 8 },
 };
@@ -70,6 +73,15 @@ static void ctrl_mmr_unlock(void)
 	mmr_unlock(PADCFG_MMR1_BASE, 1);
 }
 
+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)
 {
 	struct udevice *dev;
@@ -160,6 +172,20 @@ void board_init_f(ulong dummy)
 	/* Output System Firmware version info */
 	k3_sysfw_print_ver();
 
+	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);
+
+		/* Probe/configure MCUESM */
+		ret = uclass_get_device_by_name(UCLASS_MISC, "esm@4100000", &dev);
+		if (ret)
+			printf("esm mcu init failed: %d\n", ret);
+
+		enable_mcu_esm_reset();
+	}
+
 #if defined(CONFIG_K3_AM62A_DDRSS)
 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (ret)
arch/arm/mach-k3/am62px/am62p5_init.c +26 -0
index 2d35a7ce77e..36216aac90c 100644
@@ -15,6 +15,9 @@
 #include "../sysfw-loader.h"
 #include "../common.h"
 
+#define CTRLMMR_MCU_RST_CTRL             0x04518170
+#define RST_CTRL_ESM_ERROR_RST_EN_Z_MASK 0xFFFDFFFF
+
 struct fwl_data cbass_main_fwls[] = {
 	{ "FSS_DAT_REG3", 7, 8 },
 };
@@ -67,6 +70,15 @@ static void ctrl_mmr_unlock(void)
 	mmr_unlock(PADCFG_MMR1_BASE, 1);
 }
 
+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)
 {
 	struct udevice *dev;
@@ -158,6 +170,20 @@ void board_init_f(ulong dummy)
 			panic("DRAM init failed: %d\n", ret);
 	}
 
+	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);
+
+		/* Probe/configure MCUESM */
+		ret = uclass_get_device_by_name(UCLASS_MISC, "esm@4100000", &dev);
+		if (ret)
+			printf("esm mcu init failed: %d\n", ret);
+
+		enable_mcu_esm_reset();
+	}
+
 	spl_enable_cache();
 
 	setup_qos();
Signature · 1 line
2.48.0
#2 lore raw

PATCH 2/2 configs: am62*_evm_r5: Enable ESM and MISC configs

In reply to Judith Mendez

From: Santhosh Kumar K <[email protected]>

Enable CONFIG_SPL_DRIVERS_MISC, CONFIG_SPL_MISC, CONFIG_ESM_K3 to probe the Main ESM and MCU ESM nodes.

---
 configs/am62ax_evm_r5_defconfig | 3 +++
 configs/am62px_evm_r5_defconfig | 3 +++
 2 files changed, 6 insertions(+)
configs/am62ax_evm_r5_defconfig +3 -0
index 274cd20e1c1..85a821eee51 100644
@@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="k3-am62a7-r5-sk"
 CONFIG_DM_RESET=y
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_STACK_R_ADDR=0x82000000
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x7145
 CONFIG_SPL_TEXT_BASE=0x43c00000
@@ -83,6 +84,8 @@ CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_OMAP24XX=y
 CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
+CONFIG_SPL_MISC=y
+CONFIG_ESM_K3=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
configs/am62px_evm_r5_defconfig +3 -0
index 9df90e05d36..71e49b11650 100644
@@ -15,6 +15,7 @@ CONFIG_DEFAULT_DEVICE_TREE="k3-am62p5-r5-sk"
 CONFIG_DM_RESET=y
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
+CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_STACK_R_ADDR=0x82000000
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000
 CONFIG_SPL_TEXT_BASE=0x43c00000
@@ -88,6 +89,8 @@ CONFIG_SYS_I2C_OMAP24XX=y
 CONFIG_DM_MAILBOX=y
 CONFIG_K3_QOS=y
 CONFIG_K3_SEC_PROXY=y
+CONFIG_SPL_MISC=y
+CONFIG_ESM_K3=y
 CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
Signature · 1 line
2.48.0
#3 lore raw
In reply to Judith Mendez
Quoted 8 lines · Judith Mendez

This patch series enables ESM reset configuration in board_init_f for am62x and am62px devices.

This is necessary in order for error events to reset the system.

This patches are tested using watchdog to reset the system via ESM.

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom