diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2017-05-18 16:17:03 -0400 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2017-06-12 04:14:02 -0400 |
commit | b589da8b26f4b5cc3c3a84183dee33a73871522b (patch) | |
tree | f147cc6640fc5d70aefd8136fdcbe800cbb5a4a9 | |
parent | d0d76d575960b0bf0e1481cb3f578add9b26988c (diff) |
clocksource/drivers/fttmr010: Switch to use TIMER2 src
This switches the clocksource to TIMER2 like the Moxart driver
does. Mainly to make it more similar to the Moxart/Aspeed driver
but also because it seems more neat to use the timers in order:
use timer 1, then timer 2.
Cc: Joel Stanley <joel@jms.id.au>
Tested-by: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r-- | drivers/clocksource/timer-fttmr010.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/clocksource/timer-fttmr010.c b/drivers/clocksource/timer-fttmr010.c index 9df14cf13808..2d915d1455ab 100644 --- a/drivers/clocksource/timer-fttmr010.c +++ b/drivers/clocksource/timer-fttmr010.c | |||
@@ -49,9 +49,6 @@ | |||
49 | #define TIMER_1_CR_UPDOWN BIT(9) | 49 | #define TIMER_1_CR_UPDOWN BIT(9) |
50 | #define TIMER_2_CR_UPDOWN BIT(10) | 50 | #define TIMER_2_CR_UPDOWN BIT(10) |
51 | #define TIMER_3_CR_UPDOWN BIT(11) | 51 | #define TIMER_3_CR_UPDOWN BIT(11) |
52 | #define TIMER_DEFAULT_FLAGS (TIMER_1_CR_UPDOWN | \ | ||
53 | TIMER_3_CR_ENABLE | \ | ||
54 | TIMER_3_CR_UPDOWN) | ||
55 | 52 | ||
56 | #define TIMER_1_INT_MATCH1 BIT(0) | 53 | #define TIMER_1_INT_MATCH1 BIT(0) |
57 | #define TIMER_1_INT_MATCH2 BIT(1) | 54 | #define TIMER_1_INT_MATCH2 BIT(1) |
@@ -80,7 +77,7 @@ static inline struct fttmr010 *to_fttmr010(struct clock_event_device *evt) | |||
80 | 77 | ||
81 | static u64 notrace fttmr010_read_sched_clock(void) | 78 | static u64 notrace fttmr010_read_sched_clock(void) |
82 | { | 79 | { |
83 | return readl(local_fttmr->base + TIMER3_COUNT); | 80 | return readl(local_fttmr->base + TIMER2_COUNT); |
84 | } | 81 | } |
85 | 82 | ||
86 | static int fttmr010_timer_set_next_event(unsigned long cycles, | 83 | static int fttmr010_timer_set_next_event(unsigned long cycles, |
@@ -230,19 +227,21 @@ static int __init fttmr010_timer_init(struct device_node *np) | |||
230 | */ | 227 | */ |
231 | writel(TIMER_INT_ALL_MASK, fttmr010->base + TIMER_INTR_MASK); | 228 | writel(TIMER_INT_ALL_MASK, fttmr010->base + TIMER_INTR_MASK); |
232 | writel(0, fttmr010->base + TIMER_INTR_STATE); | 229 | writel(0, fttmr010->base + TIMER_INTR_STATE); |
233 | writel(TIMER_DEFAULT_FLAGS, fttmr010->base + TIMER_CR); | 230 | /* Enable timer 1 count up, timer 2 count up */ |
231 | writel((TIMER_1_CR_UPDOWN | TIMER_2_CR_ENABLE | TIMER_2_CR_UPDOWN), | ||
232 | fttmr010->base + TIMER_CR); | ||
234 | 233 | ||
235 | /* | 234 | /* |
236 | * Setup free-running clocksource timer (interrupts | 235 | * Setup free-running clocksource timer (interrupts |
237 | * disabled.) | 236 | * disabled.) |
238 | */ | 237 | */ |
239 | local_fttmr = fttmr010; | 238 | local_fttmr = fttmr010; |
240 | writel(0, fttmr010->base + TIMER3_COUNT); | 239 | writel(0, fttmr010->base + TIMER2_COUNT); |
241 | writel(0, fttmr010->base + TIMER3_LOAD); | 240 | writel(0, fttmr010->base + TIMER2_LOAD); |
242 | writel(0, fttmr010->base + TIMER3_MATCH1); | 241 | writel(0, fttmr010->base + TIMER2_MATCH1); |
243 | writel(0, fttmr010->base + TIMER3_MATCH2); | 242 | writel(0, fttmr010->base + TIMER2_MATCH2); |
244 | clocksource_mmio_init(fttmr010->base + TIMER3_COUNT, | 243 | clocksource_mmio_init(fttmr010->base + TIMER2_COUNT, |
245 | "FTTMR010-TIMER3", | 244 | "FTTMR010-TIMER2", |
246 | fttmr010->tick_rate, | 245 | fttmr010->tick_rate, |
247 | 300, 32, clocksource_mmio_readl_up); | 246 | 300, 32, clocksource_mmio_readl_up); |
248 | sched_clock_register(fttmr010_read_sched_clock, 32, | 247 | sched_clock_register(fttmr010_read_sched_clock, 32, |