Skip to content

Commit 8c9b226

Browse files
SuperHeroAbnerkartben
authored andcommitted
mcux: soc: rt1180 unmask reset event when rtwdog is using
RT1180 takes reset event mask feature which should be unmasked when watch dog is enabled. Signed-off-by: Ruijia Wang <ruijia.wang@nxp.com>
1 parent b1395ea commit 8c9b226

File tree

1 file changed

+24
-0
lines changed
  • soc/nxp/imxrt/imxrt118x

1 file changed

+24
-0
lines changed

soc/nxp/imxrt/imxrt118x/soc.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#include <fsl_dcdc.h>
1818
#include <fsl_ele_base_api.h>
1919
#include <fsl_trdc.h>
20+
#if defined(CONFIG_WDT_MCUX_RTWDOG)
21+
#include <fsl_soc_src.h>
22+
#endif
2023
#include <zephyr/dt-bindings/clock/imx_ccm_rev2.h>
2124
#include <cmsis_core.h>
2225

@@ -53,6 +56,14 @@ static const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = {
5356
};
5457
#endif
5558

59+
#if defined(CONFIG_WDT_MCUX_RTWDOG)
60+
#define RTWDOG_IF_SET_SRC(n, i) \
61+
if (IS_ENABLED(DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(rtwdog##n), nxp_rtwdog, okay))) { \
62+
SRC_SetGlobalSystemResetMode(SRC_GENERAL_REG, kSRC_Wdog##i##Reset, \
63+
kSRC_ResetSystem); \
64+
}
65+
#endif
66+
5667
const clock_sys_pll1_config_t sysPll1Config_BOARD_BootClockRUN = {
5768
/* Enable Sys Pll1 divide-by-2 clock or not */
5869
.pllDiv2En = 1,
@@ -625,6 +636,19 @@ void soc_early_init_hook(void)
625636
clock_init();
626637
/* Get trdc and enable all access modes for MBC and MRC of TRDCA and TRDCW */
627638
trdc_enable_all_access();
639+
#if defined(CONFIG_WDT_MCUX_RTWDOG)
640+
/* Unmask the watchdog reset channel */
641+
RTWDOG_IF_SET_SRC(0, 1)
642+
RTWDOG_IF_SET_SRC(1, 2)
643+
RTWDOG_IF_SET_SRC(2, 3)
644+
RTWDOG_IF_SET_SRC(3, 4)
645+
RTWDOG_IF_SET_SRC(4, 5)
646+
647+
/* Clear the reset status otherwise TCM memory will reload in next reset */
648+
uint32_t mask = SRC_GetResetStatusFlags(SRC_GENERAL_REG);
649+
650+
SRC_ClearGlobalSystemResetStatus(SRC_GENERAL_REG, mask);
651+
#endif
628652

629653
/* Enable data cache */
630654
sys_cache_data_enable();

0 commit comments

Comments
 (0)