Skip to content

Commit 228e218

Browse files
alexandrebellonidlezcano
authored andcommitted
clocksource/drivers/timer-atmel-tcb: Rework 32khz clock selection
On all the supported SoCs, the slow clock is always ATMEL_TC_TIMER_CLOCK5, avoid looking it up and pass it directly to setup_clkevents. Signed-off-by: Alexandre Belloni <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 738c58c commit 228e218

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/clocksource/timer-atmel-tcb.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id
346346
writel(ATMEL_TC_SYNC, tcaddr + ATMEL_TC_BCR);
347347
}
348348

349-
static const u8 atmel_tcb_divisors[5] = { 2, 8, 32, 128, 0, };
349+
static const u8 atmel_tcb_divisors[] = { 2, 8, 32, 128 };
350350

351351
static const struct of_device_id atmel_tcb_of_match[] = {
352352
{ .compatible = "atmel,at91rm9200-tcb", .data = (void *)16, },
@@ -362,7 +362,6 @@ static int __init tcb_clksrc_init(struct device_node *node)
362362
u64 (*tc_sched_clock)(void);
363363
u32 rate, divided_rate = 0;
364364
int best_divisor_idx = -1;
365-
int clk32k_divisor_idx = -1;
366365
int bits;
367366
int i;
368367
int ret;
@@ -416,12 +415,6 @@ static int __init tcb_clksrc_init(struct device_node *node)
416415
unsigned divisor = atmel_tcb_divisors[i];
417416
unsigned tmp;
418417

419-
/* remember 32 KiHz clock for later */
420-
if (!divisor) {
421-
clk32k_divisor_idx = i;
422-
continue;
423-
}
424-
425418
tmp = rate / divisor;
426419
pr_debug("TC: %u / %-3u [%d] --> %u\n", rate, divisor, i, tmp);
427420
if (best_divisor_idx > 0) {
@@ -467,7 +460,7 @@ static int __init tcb_clksrc_init(struct device_node *node)
467460
goto err_disable_t1;
468461

469462
/* channel 2: periodic and oneshot timer support */
470-
ret = setup_clkevents(&tc, clk32k_divisor_idx);
463+
ret = setup_clkevents(&tc, ATMEL_TC_TIMER_CLOCK5);
471464
if (ret)
472465
goto err_unregister_clksrc;
473466

0 commit comments

Comments
 (0)