Skip to content

Commit 467ae18

Browse files
alexandrebellonidlezcano
authored andcommitted
clocksource/drivers/timer-atmel-tcb: Add sama5d2 support
The first divisor for the sama5d2 is actually the gclk selector. Because the currently remaining divisors are fitting the use case, currently ensure it is skipped. Signed-off-by: Alexandre Belloni <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 501465d commit 467ae18

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/clocksource/timer-atmel-tcb.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,15 @@ static struct atmel_tcb_config tcb_sam9x5_config = {
359359
.counter_width = 32,
360360
};
361361

362+
static struct atmel_tcb_config tcb_sama5d2_config = {
363+
.counter_width = 32,
364+
.has_gclk = 1,
365+
};
366+
362367
static const struct of_device_id atmel_tcb_of_match[] = {
363368
{ .compatible = "atmel,at91rm9200-tcb", .data = &tcb_rm9200_config, },
364369
{ .compatible = "atmel,at91sam9x5-tcb", .data = &tcb_sam9x5_config, },
370+
{ .compatible = "atmel,sama5d2-tcb", .data = &tcb_sama5d2_config, },
365371
{ /* sentinel */ }
366372
};
367373

@@ -426,7 +432,10 @@ static int __init tcb_clksrc_init(struct device_node *node)
426432

427433
/* How fast will we be counting? Pick something over 5 MHz. */
428434
rate = (u32) clk_get_rate(t0_clk);
429-
for (i = 0; i < ARRAY_SIZE(atmel_tcb_divisors); i++) {
435+
i = 0;
436+
if (tc.tcb_config->has_gclk)
437+
i = 1;
438+
for (; i < ARRAY_SIZE(atmel_tcb_divisors); i++) {
430439
unsigned divisor = atmel_tcb_divisors[i];
431440
unsigned tmp;
432441

0 commit comments

Comments
 (0)