From 7a75842a186967cf0cf512b034136401e8fdafba Mon Sep 17 00:00:00 2001 From: Tero Salminen Date: Thu, 30 Jan 2025 13:47:07 +0200 Subject: [PATCH] imx9 board_reset: boot reason from PX4 to bootloader WDOG_B pin is unused in current HW design. Related configuration bits (WDOG_B_CFG) from PMIC RESET_CTRL register are borrowed for stay in bootloader boot reason delivery. -stay in bootloader: WDOG_B_CFG value 11b -boot normally: PMIC register power on value Signed-off-by: Tero Salminen --- .../px4/nxp/imx9/board_reset/board_reset.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/platforms/nuttx/src/px4/nxp/imx9/board_reset/board_reset.cpp b/platforms/nuttx/src/px4/nxp/imx9/board_reset/board_reset.cpp index 32b90f23c926..a4559e5941fc 100644 --- a/platforms/nuttx/src/px4/nxp/imx9/board_reset/board_reset.cpp +++ b/platforms/nuttx/src/px4/nxp/imx9/board_reset/board_reset.cpp @@ -41,11 +41,22 @@ #include #include #include +#include "imx9_pmic.h" extern "C" void __start(void); static void board_reset_enter_bootloader() { + /* WDOG_B pin is unused in current HW design. + * Related configuration bits (WDOG_B_CFG) from PMIC RESET_CTRL + * register are borrowed for stay in bootloader reason delivery. + * + * stay in bootloader: WDOG_B_CFG 11b + */ + + imx9_pmic_set_reset_ctrl(IMX9_PMIC_RESET_CTRL_DEFAULT | + IMX9_PMIC_RESET_CTRL_WDOG_COLD_RESET_MASK); + /* Reset the whole SoC */ up_systemreset(); @@ -53,6 +64,15 @@ static void board_reset_enter_bootloader() static void board_reset_enter_bootloader_and_continue_boot() { + /* WDOG_B pin is unused in current HW design. + * Related configuration bits (WDOG_B_CFG) from PMIC RESET_CTRL + * register are borrowed for stay in bootloader reason delivery. + * + * With PMIC register power on value system will boot normally. + */ + + imx9_pmic_set_reset_ctrl(IMX9_PMIC_RESET_CTRL_DEFAULT); + /* Reset the whole SoC */ up_systemreset();