Skip to content

Commit dd1bc24

Browse files
peterwangszkartben
authored andcommitted
boards: frdm_mcxa166, frdm_mcxa276: add hwinfo reset_cause support
1. enable hwinfo support - get_reset_cause - get_supported_reset_cause - clear_reset_cause 2. verified tests/drivers/hwinfo Signed-off-by: Peter Wang <chaoyi.wang@nxp.com>
1 parent 1312dc7 commit dd1bc24

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

drivers/hwinfo/hwinfo_mcux_mcx_cmc.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@
1111

1212
LOG_MODULE_REGISTER(hwinfo_cmc, CONFIG_HWINFO_LOG_LEVEL);
1313

14+
#ifndef CMC0
15+
#define CMC0 CMC
16+
#endif
17+
18+
#ifdef CMC_SRS_VBAT_MASK
19+
#define CMC_RESET_MASK_POR (CMC_SRS_POR_MASK | CMC_SRS_VBAT_MASK)
20+
#else
21+
#define CMC_RESET_MASK_POR CMC_SRS_POR_MASK
22+
#endif
23+
24+
#ifdef CMC_SRS_WWDT1_MASK
25+
#define CMC_RESET_MASK_WATCHDOG (CMC_SRS_WWDT0_MASK | CMC_SRS_WWDT1_MASK)
26+
#else
27+
#define CMC_RESET_MASK_WATCHDOG CMC_SRS_WWDT0_MASK
28+
#endif
29+
1430
/**
1531
* @brief Translate from CMC reset source mask to Zephyr hwinfo sources mask.
1632
*
@@ -29,7 +45,7 @@ static uint32_t hwinfo_mcux_cmc_xlate_reset_sources(uint32_t sources)
2945
mask |= RESET_LOW_POWER_WAKE;
3046
}
3147

32-
if (sources & (CMC_SRS_POR_MASK | CMC_SRS_VBAT_MASK)) {
48+
if (sources & CMC_RESET_MASK_POR) {
3349
mask |= RESET_POR;
3450
}
3551

@@ -49,7 +65,7 @@ static uint32_t hwinfo_mcux_cmc_xlate_reset_sources(uint32_t sources)
4965
mask |= RESET_CLOCK;
5066
}
5167

52-
if (sources & (CMC_SRS_WWDT0_MASK | CMC_SRS_WWDT1_MASK)) {
68+
if (sources & CMC_RESET_MASK_WATCHDOG) {
5369
mask |= RESET_WATCHDOG;
5470
}
5571

@@ -65,9 +81,11 @@ static uint32_t hwinfo_mcux_cmc_xlate_reset_sources(uint32_t sources)
6581
mask |= RESET_WATCHDOG;
6682
}
6783

84+
#ifdef CMC_SRS_SECVIO_MASK
6885
if (sources & CMC_SRS_SECVIO_MASK) {
6986
mask |= RESET_SECURITY;
7087
}
88+
#endif
7189

7290
return mask;
7391
}

soc/nxp/mcx/mcxa/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ config SOC_MCXA166
2626
select CPU_HAS_FPU
2727
select ARMV8_M_DSP
2828
select HAS_MCUX_CACHE
29+
select HAS_MCUX_MCX_CMC
2930

3031
config SOC_MCXA276
3132
select CPU_CORTEX_M33
3233
select CPU_HAS_ARM_MPU
3334
select CPU_HAS_FPU
3435
select ARMV8_M_DSP
3536
select HAS_MCUX_CACHE
37+
select HAS_MCUX_MCX_CMC

0 commit comments

Comments
 (0)