]> rtime.felk.cvut.cz Git - zynq/linux.git/commit
clocksource/cadence_ttc: Adjust timer frequency on clock changes
authorSoren Brinkmann <soren.brinkmann@xilinx.com>
Fri, 11 Apr 2014 16:24:03 +0000 (09:24 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 22 Apr 2014 07:06:38 +0000 (09:06 +0200)
commit356cbded4131b067ec5fa4430c15c2fac867fa2b
tree57a60215ad5a3d34cea3e263268cf9c01d3efcf6
parent9166259e8cbc302e7201e1ccefbce73fcc346dfa
clocksource/cadence_ttc: Adjust timer frequency on clock changes

Implement a clock notifier to handle changes of the timer's input clock
frequency.
This syncs up the driver with mainline squashing the following commits
into this one:

Revert "clocksource/cadence_ttc: Remove clocksource clock notifier"

This reverts commit 1fae768cc7e0f09eb0a173c3c2e8e51acce4e13c.
Remove this work around in order to be able to cherry-pick the updates
for the TTC from mainline.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
clocksource/cadence_ttc: Call clockevents_update_freq() with IRQs enabled

The timer core takes care of serialization and IRQs. Hence the driver is
no longer required to disable interrupts when calling
clockevents_update_freq().

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Michal Simek <michal.simek@xilinx.com>
(cherry picked from commit 5f0ba3b462b2d36b3c28748863747fb1050f40d0)

clocksource/cadence_ttc: Overhaul clocksource frequency adjustment

The currently used method adjusting the clocksource to a changing input
frequency does not work on kernels from 3.11 on.
The new approach is to keep the timer frequency as constant as possible.
I.e.
 - due to the TTC's prescaler limitations, allow frequency changes
   only if the frequency scales by a power of 2
 - adjust the counter's divider on the fly when a frequency change
   occurs

This limits cpufreq to scale by certain factors only.
But we may keep the time base somewhat constant, so that sleep() & co
keep working as expected, while supporting cpufreq.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Michal Simek <michal.simek@xilinx.com>
(cherry picked from commit b3e90722f6f53fa457a88146a877e34ea71d25ea)

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/clocksource/cadence_ttc_timer.c