soc: mcxw71: Add TPM support

Add DT node and clocking of TPM peripherals, which are used for PWM.

Also change the soc clock enable code to not use preprocessor
conditionals.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
This commit is contained in:
Declan Snyder 2024-09-24 13:25:12 -05:00 committed by Henrik Brix Andersen
commit b74a7c4176
2 changed files with 33 additions and 6 deletions

View file

@ -121,12 +121,21 @@ static ALWAYS_INLINE void clock_init(void)
CLOCK_SetIpSrcDiv(kCLOCK_Lpi2c1, kSCG_SysClkDivBy16);
/* Ungate clocks if the peripheral is enabled in devicetree */
#if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart0), nxp_lpc_lpuart, okay))
CLOCK_EnableClock(kCLOCK_Lpuart0);
#endif
#if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart1), nxp_lpc_lpuart, okay))
CLOCK_EnableClock(kCLOCK_Lpuart1);
#endif
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart0), nxp_lpc_lpuart, okay)) {
CLOCK_EnableClock(kCLOCK_Lpuart0);
}
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart1), nxp_lpc_lpuart, okay)) {
CLOCK_EnableClock(kCLOCK_Lpuart1);
}
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(tpm0), nxp_kinetis_tpm, okay)) {
CLOCK_EnableClock(kCLOCK_Tpm0);
}
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(tpm1), nxp_kinetis_tpm, okay)) {
CLOCK_EnableClock(kCLOCK_Tpm1);
}
}
static void vbat_init(void)