jlaitine commented on code in PR #15938:
URL: https://github.com/apache/nuttx/pull/15938#discussion_r1984624911


##########
arch/arm64/src/common/arm64_arch_timer.c:
##########
@@ -265,34 +269,20 @@ static int arm64_tick_start(struct oneshot_lowerhalf_s 
*lower,
 {
   struct arm64_oneshot_lowerhalf_s *priv =
     (struct arm64_oneshot_lowerhalf_s *)lower;
-  uint64_t next_cycle;
-
   DEBUGASSERT(priv != NULL && callback != NULL);
 
   /* Save the new handler and its argument */
 
   priv->callback = callback;
   priv->arg = arg;
 
-  if (!priv->init[this_cpu()])
-    {
-      /* Enable int */
-
-      up_enable_irq(ARM_ARCH_TIMER_IRQ);
-
-      /* Start timer */
-
-      arm64_arch_timer_enable(true);
-      priv->init[this_cpu()] = true;
-    }
-
   priv->running = this_cpu();
 
-  next_cycle =
-    arm64_arch_timer_count() / priv->cycle_per_tick * priv->cycle_per_tick +
-    ticks * priv->cycle_per_tick;
+  /* Be careful of the multiply overflow */
+
+  DEBUGASSERT(ticks <= UINT64_MAX / priv->frequency);
 
-  arm64_arch_timer_set_compare(next_cycle);
+  arm64_arch_timer_set_relative(ticks * priv->frequency / TICK_PER_SEC);

Review Comment:
   Tested that the above addition to the patches introduced in this PR fixes 
the issues on i.MX93
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to