|
17 | 17 | #include <fsl_dcdc.h>
|
18 | 18 | #include <fsl_ele_base_api.h>
|
19 | 19 | #include <fsl_trdc.h>
|
| 20 | +#if defined(CONFIG_WDT_MCUX_RTWDOG) |
| 21 | +#include <fsl_soc_src.h> |
| 22 | +#endif |
20 | 23 | #include <zephyr/dt-bindings/clock/imx_ccm_rev2.h>
|
21 | 24 | #include <cmsis_core.h>
|
22 | 25 |
|
@@ -53,6 +56,14 @@ static const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = {
|
53 | 56 | };
|
54 | 57 | #endif
|
55 | 58 |
|
| 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 | + |
56 | 67 | const clock_sys_pll1_config_t sysPll1Config_BOARD_BootClockRUN = {
|
57 | 68 | /* Enable Sys Pll1 divide-by-2 clock or not */
|
58 | 69 | .pllDiv2En = 1,
|
@@ -625,6 +636,19 @@ void soc_early_init_hook(void)
|
625 | 636 | clock_init();
|
626 | 637 | /* Get trdc and enable all access modes for MBC and MRC of TRDCA and TRDCW */
|
627 | 638 | 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 |
628 | 652 |
|
629 | 653 | /* Enable data cache */
|
630 | 654 | sys_cache_data_enable();
|
|
0 commit comments