Skip to content

Commit b74a7c4

Browse files
decsnyhenrikbrixandersen
authored andcommitted
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 <[email protected]>
1 parent bfa4a7b commit b74a7c4

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

dts/arm/nxp/nxp_mcxw71.dtsi

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,24 @@
181181
reg = <0x2b000 0x400>;
182182
interrupts = <74 0>;
183183
};
184+
185+
tpm0: pwm@31000 {
186+
compatible = "nxp,kinetis-tpm";
187+
reg = <0x31000 0x100>;
188+
interrupts = <37 0>;
189+
clocks = <&scg SCG_K4_FIRC_CLK 0xc4>;
190+
status = "disabled";
191+
#pwm-cells = <3>;
192+
};
193+
194+
tpm1: pwm@32000 {
195+
compatible = "nxp,kinetis-tpm";
196+
reg = <0x32000 0x100>;
197+
interrupts = <38 0>;
198+
clocks = <&scg SCG_K4_FIRC_CLK 0xc8>;
199+
status = "disabled";
200+
#pwm-cells = <3>;
201+
};
184202
};
185203

186204
&fast_peripheral0 {

soc/nxp/mcx/mcxw/soc.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,21 @@ static ALWAYS_INLINE void clock_init(void)
121121
CLOCK_SetIpSrcDiv(kCLOCK_Lpi2c1, kSCG_SysClkDivBy16);
122122

123123
/* Ungate clocks if the peripheral is enabled in devicetree */
124-
#if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart0), nxp_lpc_lpuart, okay))
125-
CLOCK_EnableClock(kCLOCK_Lpuart0);
126-
#endif
127-
#if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart1), nxp_lpc_lpuart, okay))
128-
CLOCK_EnableClock(kCLOCK_Lpuart1);
129-
#endif
124+
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart0), nxp_lpc_lpuart, okay)) {
125+
CLOCK_EnableClock(kCLOCK_Lpuart0);
126+
}
127+
128+
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart1), nxp_lpc_lpuart, okay)) {
129+
CLOCK_EnableClock(kCLOCK_Lpuart1);
130+
}
131+
132+
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(tpm0), nxp_kinetis_tpm, okay)) {
133+
CLOCK_EnableClock(kCLOCK_Tpm0);
134+
}
135+
136+
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(tpm1), nxp_kinetis_tpm, okay)) {
137+
CLOCK_EnableClock(kCLOCK_Tpm1);
138+
}
130139
}
131140

132141
static void vbat_init(void)

0 commit comments

Comments
 (0)