[Letux-kernel] [PATCH 00/20] A bunch of JZ4730 fixups for letux-kernel
H. Nikolaus Schaller
hns at goldelico.com
Tue Dec 29 16:36:10 CET 2020
AH,
some overlap in writing e-mails :)
> Am 29.12.2020 um 16:25 schrieb Paul Boddie <paul at boddie.org.uk>:
>
>
> Given a reload value of 0xFFFF, presumably giving a period of 0x10000 cycles,
> the counter would underflow 26 times a second, by my estimation.
Which is pretty slow.
Having the counter go backwards is a little unusual but I haven't seen
a problem with that.
Even that it starts with 0xffff is not an issue, since it will restart
with that value. And, it is not used as an interrupt trigger but just a
constant frequency impulse counter. So it doesn't matter where it starts
and where it wraps, only time differences are calculated.
But as I has assumed there is logic to "expand" this counter by regularily
reading this timer, getting the time difference to the previous read
and summing up the difference with u64 resolution.
The key is that this happens regularly before the counter wraps (in whatever
direction or start value). And it seems to be done by hrtimers.
Well, I think now the hrtimers are not working properly.
BR,
Nikolaus
PS: that it counts backwards may be to simplify the digital logic.
It is easier to have a data register and initialize the backwards
counting counter flipflop chain and detect if it overflows after
0x0000 than resetting to 0 and comparing to a data registers.
But that makes less than 10-15 gates difference. IMHO not really
necessary in the VLSI technology we have. And not even in 2005 when
the jz4730 was designed.
Maybe they simply had a VHDL macro sitting around.
More information about the Letux-kernel
mailing list