From 67099d2bbade01106383e444964f5a7879f6f9fe Mon Sep 17 00:00:00 2001 From: Bryan Zhu Date: Thu, 7 Dec 2023 22:43:28 +0800 Subject: [PATCH] timer: ambiq_stimer: fixing disabling tickless not working issue In init function, start timer with period CYC_PER_TICK if tickless is not enabled, This change is for fixing the issue that disabling CONFIG_TICKLESS_KERNEL the OS tick is not work issue, this causes the OS not starting scheduling correctly. Signed-off-by: Bryan Zhu --- drivers/timer/ambiq_stimer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/timer/ambiq_stimer.c b/drivers/timer/ambiq_stimer.c index 5db803fb12..bcef78dd1a 100644 --- a/drivers/timer/ambiq_stimer.c +++ b/drivers/timer/ambiq_stimer.c @@ -142,7 +142,10 @@ static int stimer_init(void) irq_enable(TIMER_IRQ); am_hal_stimer_int_enable(AM_HAL_STIMER_INT_COMPAREA); - + /* Start timer with period CYC_PER_TICK if tickless is not enabled */ + if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { + am_hal_stimer_compare_delta_set(0, CYC_PER_TICK); + } return 0; }