Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: counter: Add support for NXP Multirate Timer Peripheral #64801

Merged
merged 7 commits into from Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions boards/arm/lpcxpresso55s69/lpcxpresso55s69_cpu0.dts
Expand Up @@ -204,3 +204,7 @@ i2s1: &flexcomm7 {
&dma1 {
status = "okay";
};

&mrt_channel0 {
status = "okay";
};
4 changes: 4 additions & 0 deletions boards/arm/mimxrt595_evk/mimxrt595_evk_cm33.dts
Expand Up @@ -478,3 +478,7 @@ zephyr_udc0: &usbhs {
dmas = <&smartdma>;
dma-names = "smartdma";
};

&mrt_channel0 {
status = "okay";
};
16 changes: 13 additions & 3 deletions drivers/clock_control/clock_control_mcux_syscon.c
Expand Up @@ -19,12 +19,19 @@ static int mcux_lpc_syscon_clock_control_on(const struct device *dev,
clock_control_subsys_t sub_system)
{
#if defined(CONFIG_CAN_MCUX_MCAN)
uint32_t clock_name = (uint32_t)sub_system;

if (clock_name == MCUX_MCAN_CLK) {
if ((uint32_t)sub_system == MCUX_MCAN_CLK) {
CLOCK_EnableClock(kCLOCK_Mcan);
}
#endif /* defined(CONFIG_CAN_MCUX_MCAN) */
#if defined(CONFIG_COUNTER_NXP_MRT)
if ((uint32_t)sub_system == MCUX_MRT_CLK) {
#if defined(CONFIG_SOC_FAMILY_LPC)
CLOCK_EnableClock(kCLOCK_Mrt);
#elif defined(CONFIG_SOC_FAMILY_IMX)
CLOCK_EnableClock(kCLOCK_Mrt0);
#endif
}
#endif /* defined(CONFIG_COUNTER_NXP_MRT) */

return 0;
}
Expand Down Expand Up @@ -145,6 +152,9 @@ static int mcux_lpc_syscon_clock_control_get_subsys_rate(
break;
#endif

#if defined(CONFIG_COUNTER_NXP_MRT)
case MCUX_MRT_CLK:
#endif
#if defined(CONFIG_PWM_MCUX_SCTIMER)
case MCUX_SCTIMER_CLK:
#endif
Expand Down
5 changes: 3 additions & 2 deletions drivers/counter/CMakeLists.txt
Expand Up @@ -44,7 +44,8 @@ zephyr_library_sources_ifdef(CONFIG_COUNTER_INFINEON_CAT1 counter_ifx_cat1
zephyr_library_sources_ifdef(CONFIG_ACE_V1X_ART_COUNTER counter_ace_v1x_art.c)
zephyr_library_sources_ifdef(CONFIG_ACE_V1X_RTC_COUNTER counter_ace_v1x_rtc.c)
zephyr_library_sources_ifdef(CONFIG_COUNTER_NXP_S32_SYS_TIMER counter_nxp_s32_sys_timer.c)
zephyr_library_sources_ifdef(CONFIG_COUNTER_TIMER_GD32 counter_gd32_timer.c)
zephyr_library_sources_ifdef(CONFIG_COUNTER_TIMER_GD32 counter_gd32_timer.c)
zephyr_library_sources_ifdef(CONFIG_COUNTER_SNPS_DW counter_dw_timer.c)
zephyr_library_sources_ifdef(CONFIG_COUNTER_SHELL counter_timer_shell.c)
zephyr_library_sources_ifdef(CONFIG_COUNTER_TIMER_RPI_PICO counter_rpi_pico_timer.c)
zephyr_library_sources_ifdef(CONFIG_COUNTER_TIMER_RPI_PICO counter_rpi_pico_timer.c)
zephyr_library_sources_ifdef(CONFIG_COUNTER_NXP_MRT counter_nxp_mrt.c)
2 changes: 2 additions & 0 deletions drivers/counter/Kconfig
Expand Up @@ -94,4 +94,6 @@ source "drivers/counter/Kconfig.dw"

source "drivers/counter/Kconfig.rpi_pico"

source "drivers/counter/Kconfig.nxp_mrt"

endif # COUNTER
9 changes: 9 additions & 0 deletions drivers/counter/Kconfig.nxp_mrt
@@ -0,0 +1,9 @@
# Copyright 2023 NXP
# SPDX-License-Identifier: Apache-2.0

config COUNTER_NXP_MRT
bool "NXP MRT driver"
default y if DT_HAS_NXP_MRT_CHANNEL_ENABLED && \
DT_HAS_NXP_MRT_ENABLED
help
Enable driver for the NXP Multirate Timer (MRT).