Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions drivers/timer/Kconfig.mcux_os
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ config MCUX_OS_TIMER
depends on DT_HAS_NXP_OS_TIMER_ENABLED
select TICKLESS_CAPABLE
select TIMER_HAS_64BIT_CYCLE_COUNTER
select RESET
help
This module implements a kernel device driver for the NXP OS
event timer and provides the standard "system clock driver" interfaces.
Expand Down
10 changes: 8 additions & 2 deletions drivers/timer/mcux_os_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <zephyr/spinlock.h>
#include <zephyr/drivers/counter.h>
#include <zephyr/pm/pm.h>
#include <zephyr/drivers/reset.h>
#include "fsl_ostimer.h"
#if !defined(CONFIG_SOC_FAMILY_MCXN) && !defined(CONFIG_SOC_FAMILY_MCXA)
#include "fsl_power.h"
Expand Down Expand Up @@ -179,9 +180,12 @@ static uint32_t mcux_lpc_ostick_compensate_system_timer(void)
}
slept_time_us = counter_ticks_to_us(counter_dev, slept_time_ticks);
cyc_sys_compensated += CYC_PER_US * slept_time_us;

if (IS_ENABLED(CONFIG_MCUX_OS_TIMER_PM_POWERED_OFF)) {
/* Reset the OS Timer to a known state */
RESET_PeripheralReset(kOSEVENT_TIMER_RST_SHIFT_RSTn);
const struct reset_dt_spec reset = RESET_DT_SPEC_GET(DT_DRV_INST(0));

reset_line_toggle_dt(&reset);
/* Reactivate os_timer for cases where it loses its state */
OSTIMER_Init(base);
}
Expand Down Expand Up @@ -337,7 +341,9 @@ static int sys_clock_driver_init(void)
/* On some SoC's, OS Timer cannot wakeup from low power mode in standby modes */
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM
counter_dev = DEVICE_DT_GET_OR_NULL(DT_INST_PHANDLE(0, deep_sleep_counter));
counter_max_val = counter_get_max_top_value(counter_dev);
if (NULL != counter_dev) {
counter_max_val = counter_get_max_top_value(counter_dev);
}
#endif

#if (DT_INST_PROP(0, wakeup_source))
Expand Down
1 change: 1 addition & 0 deletions dts/arm/nxp/nxp_mcxn23x_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@
compatible = "nxp,os-timer";
reg = <0x49000 0x1000>;
interrupts = <57 0>;
resets = <&reset NXP_SYSCON_RESET(1, 1)>;
status = "disabled";
};

Expand Down
1 change: 1 addition & 0 deletions dts/arm/nxp/nxp_rt5xx_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@
compatible = "nxp,os-timer";
reg = <0x113000 0x1000>;
interrupts = <41 0>;
resets = <&rstctl1 NXP_SYSCON_RESET(0, 27)>;
status = "disabled";
};

Expand Down
1 change: 1 addition & 0 deletions dts/arm/nxp/nxp_rt6xx_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@
compatible = "nxp,os-timer";
reg = <0x113000 0x1000>;
interrupts = <41 0>;
resets = <&rstctl1 NXP_SYSCON_RESET(0, 27)>;
status = "disabled";
};

Expand Down
1 change: 1 addition & 0 deletions dts/arm/nxp/nxp_rw6xx_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@
compatible = "nxp,os-timer";
reg = <0x13b000 0x1000>;
interrupts = <41 0>;
resets = <&rstctl1 NXP_SYSCON_RESET(0, 27)>;
status = "disabled";
};

Expand Down
4 changes: 4 additions & 0 deletions dts/bindings/timer/nxp,os-timer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ properties:
Instance of a counter peripheral. The OS Timer maybe powered off in
certain deep power down modes. The OS Timer driver will use this
counter to wakeup and also to keep track of system time.

resets:
type: phandle-array
description: reset line