Re: [PATCH v4 13/13] mips: cevt-r4k: Update the r4k-clockevent frequency in sync with CPU

From: Thomas Bogendoerfer
Date: Fri May 22 2020 - 03:31:09 EST


On Thu, May 21, 2020 at 05:07:24PM +0300, Serge Semin wrote:
> Due to being embedded into the CPU cores MIPS count/compare timer
> frequency is changed together with the CPU clocks alteration.
> In case if frequency really changes the kernel clockevent framework
> must be notified, otherwise the kernel timers won't work correctly.
> Fix this by calling clockevents_update_freq() for each r4k clockevent
> handlers registered per available CPUs.
>
> Traditionally MIPS r4k-clock are clocked with CPU frequency divided by 2.
> But this isn't true for some of the platforms. Due to this we have to save
> the basic CPU frequency, so then use it to scale the initial timer
> frequency (mips_hpt_frequency) and pass the updated value further to the
> clockevent framework.
>
> Signed-off-by: Serge Semin <Sergey.Semin@xxxxxxxxxxxxxxxxxxxx>
> Cc: Alexey Malahov <Alexey.Malahov@xxxxxxxxxxxxxxxxxxxx>
> Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
> Cc: Paul Burton <paulburton@xxxxxxxxxx>
> Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Arnd Bergmann <arnd@xxxxxxxx>
> Cc: Rob Herring <robh+dt@xxxxxxxxxx>
> Cc: devicetree@xxxxxxxxxxxxxxx
> ---
> arch/mips/kernel/cevt-r4k.c | 44 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)

applied to mips-next.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]