[PATCH 2/2] ARM: omap5/dra7xx: Fix counter frequency drift for AM572x errata i856.
Lennart Sorensen
lsorense at csclub.uwaterloo.ca
Tue Dec 16 08:16:14 PST 2014
On Tue, Dec 16, 2014 at 05:05:08PM +0530, Lokesh Vutla wrote:
> Is this applicable for OMAP5 also?
> If not can you drop omap5 from $subject?
DRA7xx = OMAP57xx, which to me is an omap5. Isn't it?
And I haven't been able to get a manual for the omap54xx to confirm it,
although it seems it does not apply to the omap54xx from what I have
been able to gather indirectly.
arch_timer_freq = (rate / den) * num;
If I do this with the workaround I get:
20000000 / 75 * 244 = 6147525
where as
20000000 * 244 / 75 = 6147540
best value would be 6147541 with proper rounding.
In the normal case the worst case is:
26000000 * 384 = 9984000000
That is too big for 32 bits.
Now what could be done is prescale by 4 to make the worst case still
fit in 32 bits while doing the multiplication before the division,
so like this:
arch_timer_freq = ((rate / 4) * num / den ) * 4;
That gives the same result in all cases including the errata case for
the dra7xx at 20MHz and 27MHz. It is off by 3 in the 19.2MHz case though
which isn't so nice.
Would that be more acceptable? I think having the arch_timer_freq
calculated for the errata case seperately from the normal case is
cleaner looking compared to that mess and gives a better result for the
19.2MHz case.
--
Len Sorensen
More information about the linux-arm-kernel
mailing list