[Letux-kernel] Timers (was Re: [PATCH 00/20] A bunch of JZ4730 fixups for letux-kernel)
H. Nikolaus Schaller
hns at goldelico.com
Tue Jan 19 10:45:10 CET 2021
> Am 19.01.2021 um 10:15 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>
> So we have learned that sleep 10 indeed calls hrtimer_nanosleep() resp.
> do_nanosleep() and there we somehow get the factor 2 compared to what
> user-space assumes.
>
> We are getting closer...
ok, starting a hrtimer goes down to clockevents_program_event()
This uses a struct clock_event_device which controls the real
hardware.
Do we have an idea which one we use on the jz4730?
Seems to be
https://elixir.bootlin.com/linux/v5.11-rc3/source/drivers/clocksource/ingenic-timer.c#L35
So we are back at the TCU and OST driver!
After studying the code I think I got it:
ingenic_tcu_cevt_set_next()
There, we are simply writing the next value to TCU_JZ4730_REG_TRDRc
without taking into account that it is counting backwards. IMHO it must
be the reverse operation to ingenic_tcu_timer_read() so that
ingenic_tcu_cevt_set_next(value, ...);
ingenic_tcu_timer_read();
should return almost the same value!
ingenic_tcu_cevt_set_next() is only called for the hrtimers but
not for the sched_clock() (which is freely running and overflowing).
What do you think?
BR,
Nikolaus
More information about the Letux-kernel
mailing list