soc: kinetis: add support for TPM PWM module

Some Kinetis SoCs have an instance of the the TPM module
that can be used for PWM control. As such, add the necessary
configurations to enable it on the SoCs that support it, as well as
enable the clock for the module to function.

In this case, the enablement is done only for the KW41Z SoCs,
but there are other SoCs that support it, f.i. KW38Z

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
This commit is contained in:
Alex Porosanu 2020-04-08 09:38:13 +03:00 committed by Maureen Helm
parent f4c36b7beb
commit 7187d624a7
4 changed files with 19 additions and 0 deletions

View file

@ -182,4 +182,10 @@ config HAS_MCUX_DAC32
bool
help
Set if the Digital-to-Analog (DAC32) module is present in the SoC.
config HAS_MCUX_TPM
bool
help
Set if the Timer/PWM Module is present in the SoC
endif # HAS_MCUX

View file

@ -51,6 +51,10 @@ config SOC_FLASH_MCUX
default y
depends on FLASH
config PWM_MCUX_TPM
default y
depends on PWM
if NETWORKING
config NET_L2_IEEE802154

View file

@ -53,6 +53,7 @@ config SOC_MKW41Z4
select HAS_MCUX_LPUART
select HAS_MCUX_RTC
select HAS_MCUX_SIM
select HAS_MCUX_TPM
select HAS_MCUX_TRNG
select HAS_OSC
select HAS_MCG

View file

@ -18,6 +18,7 @@
#define ER32KSEL_LPO1KHZ (3)
#define LPUART0SRC_OSCERCLK (1)
#define TPMSRC_MCGPLLCLK (1)
#define CLKDIV1_DIVBY2 (1)
@ -69,6 +70,13 @@ static ALWAYS_INLINE void clock_init(void)
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(lpuart0))
CLOCK_SetLpuartClock(LPUART0SRC_OSCERCLK);
#endif
#if defined(CONFIG_PWM) && \
(DT_HAS_NODE(DT_NODELABEL(pwm0)) || \
DT_HAS_NODE(DT_NODELABEL(pwm1)) || \
DT_HAS_NODE(DT_NODELABEL(pwm2)))
CLOCK_SetTpmClock(TPMSRC_MCGPLLCLK);
#endif
}
static int kwx_init(struct device *arg)