arch/timer: frequency 0 should not be set

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2023-08-04 10:18:50 +08:00 committed by Xiang Xiao
parent d8e1022b6f
commit b82ccd6621

View File

@ -264,10 +264,13 @@ struct oneshot_lowerhalf_s *arm_timer_initialize(unsigned int freq)
{ {
freq = arm_timer_get_freq(); freq = arm_timer_get_freq();
} }
else
{
arm_timer_set_freq(freq);
}
lower->lh.ops = &g_arm_timer_ops; lower->lh.ops = &g_arm_timer_ops;
lower->freq = freq; lower->freq = freq;
arm_timer_set_freq(freq);
/* Enable timer, but disable interrupt */ /* Enable timer, but disable interrupt */
@ -275,7 +278,7 @@ struct oneshot_lowerhalf_s *arm_timer_initialize(unsigned int freq)
ctrl |= ARM_TIMER_CTRL_ENABLE | ARM_TIMER_CTRL_INT_MASK; ctrl |= ARM_TIMER_CTRL_ENABLE | ARM_TIMER_CTRL_INT_MASK;
arm_timer_set_ctrl(ctrl); arm_timer_set_ctrl(ctrl);
#ifdef CONFIG_ARCH_TRUSTZONE_SECURE #if defined(CONFIG_ARCH_TRUSTZONE_SECURE) || defined(CONFIG_ARCH_TRUSTZONE_BOTH)
irq_attach(GIC_IRQ_SEPTM, arm_timer_interrupt, lower); irq_attach(GIC_IRQ_SEPTM, arm_timer_interrupt, lower);
up_enable_irq(GIC_IRQ_SEPTM); up_enable_irq(GIC_IRQ_SEPTM);
#else #else