Skip to content

Commit

Permalink
mcux: soc: rt1180 unmask reset event when rtwdog is using
Browse files Browse the repository at this point in the history
RT1180 takes reset event mask feature which should be unmasked when
watch dog is enabled.

Signed-off-by: Ruijia Wang <[email protected]>
  • Loading branch information
SuperHeroAbner authored and kartben committed Jan 25, 2025
1 parent b1395ea commit 8c9b226
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions soc/nxp/imxrt/imxrt118x/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#include <fsl_dcdc.h>
#include <fsl_ele_base_api.h>
#include <fsl_trdc.h>
#if defined(CONFIG_WDT_MCUX_RTWDOG)
#include <fsl_soc_src.h>
#endif
#include <zephyr/dt-bindings/clock/imx_ccm_rev2.h>
#include <cmsis_core.h>

Expand Down Expand Up @@ -53,6 +56,14 @@ static const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = {
};
#endif

#if defined(CONFIG_WDT_MCUX_RTWDOG)
#define RTWDOG_IF_SET_SRC(n, i) \
if (IS_ENABLED(DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(rtwdog##n), nxp_rtwdog, okay))) { \
SRC_SetGlobalSystemResetMode(SRC_GENERAL_REG, kSRC_Wdog##i##Reset, \
kSRC_ResetSystem); \
}
#endif

const clock_sys_pll1_config_t sysPll1Config_BOARD_BootClockRUN = {
/* Enable Sys Pll1 divide-by-2 clock or not */
.pllDiv2En = 1,
Expand Down Expand Up @@ -625,6 +636,19 @@ void soc_early_init_hook(void)
clock_init();
/* Get trdc and enable all access modes for MBC and MRC of TRDCA and TRDCW */
trdc_enable_all_access();
#if defined(CONFIG_WDT_MCUX_RTWDOG)
/* Unmask the watchdog reset channel */
RTWDOG_IF_SET_SRC(0, 1)
RTWDOG_IF_SET_SRC(1, 2)
RTWDOG_IF_SET_SRC(2, 3)
RTWDOG_IF_SET_SRC(3, 4)
RTWDOG_IF_SET_SRC(4, 5)

/* Clear the reset status otherwise TCM memory will reload in next reset */
uint32_t mask = SRC_GetResetStatusFlags(SRC_GENERAL_REG);

SRC_ClearGlobalSystemResetStatus(SRC_GENERAL_REG, mask);
#endif

/* Enable data cache */
sys_cache_data_enable();
Expand Down

0 comments on commit 8c9b226

Please sign in to comment.