Colibri iMX6ULL: Reading the reset cause

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>
 
 #ifdef CONFIG_TDX_CFG_BLOCK
 static char tdx_serial_str[9];
@@ -87,6 +88,8 @@ int show_board_info(void)
                       tdx_serial_str);
        }
 
+       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,
Jaski