Skip to content

Commit

Permalink
clocksource/drivers/arm_global_timer: Register delay timer
Browse files Browse the repository at this point in the history
Provide a delay timer using the lower 32-bits of the global timer so
that we can use that instead of having to calibrating delays.

Signed-off-by: Rabin Vincent <rabin.vincent@axis.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
  • Loading branch information
Rabin Vincent authored and Daniel Lezcano committed Feb 25, 2016
1 parent 1b18fd2 commit bbaa067
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions drivers/clocksource/arm_global_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/clockchips.h>
#include <linux/cpu.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/of.h>
Expand Down Expand Up @@ -221,6 +222,21 @@ static u64 notrace gt_sched_clock_read(void)
}
#endif

static unsigned long gt_read_long(void)
{
return readl_relaxed(gt_base + GT_COUNTER0);
}

static struct delay_timer gt_delay_timer = {
.read_current_timer = gt_read_long,
};

static void __init gt_delay_timer_init(void)
{
gt_delay_timer.freq = gt_clk_rate;
register_current_timer_delay(&gt_delay_timer);
}

static void __init gt_clocksource_init(void)
{
writel(0, gt_base + GT_CONTROL);
Expand Down Expand Up @@ -317,6 +333,7 @@ static void __init global_timer_of_register(struct device_node *np)
/* Immediately configure the timer on the boot CPU */
gt_clocksource_init();
gt_clockevents_init(this_cpu_ptr(gt_evt));
gt_delay_timer_init();

return;

Expand Down

0 comments on commit bbaa067

Please sign in to comment.