Colibri iMX6ULL: Reading the reset cause

Hi team,

A customer wants to check the reset cause at kernel level to see if it was an expected shutdown or if it was the watchdog.

I believe this is easily accessible through U-boot, but couldn’t see it at kernel level in dmesg. Is there any file/register/kernel module where this is logged for easy check?

Or would the customer have to develop its own solution to read this from the SoC register?

Thanks and regards,

Hi @alvaro.tx

The Reset Cause is shown in U-Boot (Bsp 2.8), the customer would need to pass this to kernel. Unfortunately there is no driver which can do that.

Regarding reading the SoC Register, I don’t have Information about iMX6ULL, but some SOC has a read clear register, this means if the register containing Reset Cause is read, the content of the register is cleared. You would need to check this in Reference Manual.

Best regards,

Thanks @jaski.tx . That is what I feared. Do you know any reference example where we:

  1. Read a value in U-Boot (This is shown in the code)
  2. Pass this to the kernel
  3. Read at kernel level the passed value

With this I could let the customer know to build their own solution, but I don’t know this information myself. Thanks, Alvaro.

No, I don’t know an example but let me check on this and i will come back to you tomorrow.

HI @alvaro.tx

I found a solution. This code will set a U-Boot variable and save the reset cause in hexadecimal number.

diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
index b48d0df605..98e045cfb6 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -10,6 +10,7 @@
 #include "tdx-cfg-block.h"
 #include "tdx-common.h"
+#include <asm/arch-imx/cpu.h>
 static char tdx_serial_str[9];
@@ -87,6 +88,8 @@ int show_board_info(void)
+       setenv_hex("reset_cause", get_imx_reset_cause());
         * Check if environment contains a valid MAC address,
         * set the one from config block if not

To decode the hexadecimal number, you need to look in arch/arm/imx-common/cpu.c.

Best regards,

Thanks Jaski!