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

@ -181,6 +181,24 @@
reg = <0x2b000 0x400>;
interrupts = <74 0>;
};
tpm0: pwm@31000 {
compatible = "nxp,kinetis-tpm";
reg = <0x31000 0x100>;
interrupts = <37 0>;
clocks = <&scg SCG_K4_FIRC_CLK 0xc4>;
status = "disabled";
#pwm-cells = <3>;
};
tpm1: pwm@32000 {
compatible = "nxp,kinetis-tpm";
reg = <0x32000 0x100>;
interrupts = <38 0>;
clocks = <&scg SCG_K4_FIRC_CLK 0xc8>;
status = "disabled";
#pwm-cells = <3>;
};
};
&fast_peripheral0 {

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))
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))
}
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(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)