Skip to content

Commit

Permalink
imx9 board_reset: boot reason from PX4 to bootloader
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
t-salminen committed Jan 31, 2025
1 parent d011811 commit 2fdb28f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions platforms/nuttx/src/px4/nxp/imx9/board_reset/board_reset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,38 @@
#include <errno.h>
#include <nuttx/board.h>
#include <debug.h>
#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();
}

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();
Expand Down

0 comments on commit 2fdb28f

Please sign in to comment.