Commit 08e4b448 authored by Jisheng Zhang's avatar Jisheng Zhang Committed by Daniel Lezcano

clockevents/drivers/arm_global_timer: Use writel_relaxed in gt_compare_set

Use the relaxed version to improve performance. we measured time of
4096 rounds of gt_compare_set() spent on Marvell BG2Q:

before the patch: 3690648ns on average
after the patch: 1083023ns on average

improved by 70%!
Signed-off-by: default avatarJisheng Zhang <jszhang@marvell.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 520ddad4
...@@ -99,17 +99,17 @@ static void gt_compare_set(unsigned long delta, int periodic) ...@@ -99,17 +99,17 @@ static void gt_compare_set(unsigned long delta, int periodic)
counter += delta; counter += delta;
ctrl = GT_CONTROL_TIMER_ENABLE; ctrl = GT_CONTROL_TIMER_ENABLE;
writel(ctrl, gt_base + GT_CONTROL); writel_relaxed(ctrl, gt_base + GT_CONTROL);
writel(lower_32_bits(counter), gt_base + GT_COMP0); writel_relaxed(lower_32_bits(counter), gt_base + GT_COMP0);
writel(upper_32_bits(counter), gt_base + GT_COMP1); writel_relaxed(upper_32_bits(counter), gt_base + GT_COMP1);
if (periodic) { if (periodic) {
writel(delta, gt_base + GT_AUTO_INC); writel_relaxed(delta, gt_base + GT_AUTO_INC);
ctrl |= GT_CONTROL_AUTO_INC; ctrl |= GT_CONTROL_AUTO_INC;
} }
ctrl |= GT_CONTROL_COMP_ENABLE | GT_CONTROL_IRQ_ENABLE; ctrl |= GT_CONTROL_COMP_ENABLE | GT_CONTROL_IRQ_ENABLE;
writel(ctrl, gt_base + GT_CONTROL); writel_relaxed(ctrl, gt_base + GT_CONTROL);
} }
static int gt_clockevent_shutdown(struct clock_event_device *evt) static int gt_clockevent_shutdown(struct clock_event_device *evt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment