mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
clocksource: dw_apb_timer_of: use clocksource_of_init
dw_apb_timer_init used to search the devicetree for matching timer devices, making calls to it from board files necessary. Change the dw_apb_timer_init to work with CLOCKSOURCE_OF_DECLARE. With this change the function gets called once for each timer node and tracks these number of calls to attach clockevent and clocksource devices to the nodes. Also remove the calls to dw_apb_timer_init from all previous users, as clocksource_of_init is the default for init_time now. Tested on the upcoming rk3066 code. Signed-off-by: Heiko Stuebner <[email protected]> Acked-by: Rob Herring <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Acked-by: Jamie Iles <[email protected]> Acked-by: Dinh Nguyen <[email protected]>
This commit is contained in:
parent
1b4eca0f63
commit
1002148899
5 changed files with 21 additions and 26 deletions
|
|
@ -22,6 +22,7 @@ config DW_APB_TIMER
|
|||
config DW_APB_TIMER_OF
|
||||
bool
|
||||
select DW_APB_TIMER
|
||||
select CLKSRC_OF
|
||||
|
||||
config ARMADA_370_XP_TIMER
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -133,27 +133,26 @@ static void init_sched_clock(void)
|
|||
setup_sched_clock(read_sched_clock, 32, sched_rate);
|
||||
}
|
||||
|
||||
static const struct of_device_id osctimer_ids[] __initconst = {
|
||||
{ .compatible = "picochip,pc3x2-timer" },
|
||||
{ .compatible = "snps,dw-apb-timer-osc" },
|
||||
{},
|
||||
};
|
||||
|
||||
void __init dw_apb_timer_init(void)
|
||||
static int num_called;
|
||||
static void __init dw_apb_timer_init(struct device_node *timer)
|
||||
{
|
||||
struct device_node *event_timer, *source_timer;
|
||||
switch (num_called) {
|
||||
case 0:
|
||||
pr_debug("%s: found clockevent timer\n", __func__);
|
||||
add_clockevent(timer);
|
||||
of_node_put(timer);
|
||||
break;
|
||||
case 1:
|
||||
pr_debug("%s: found clocksource timer\n", __func__);
|
||||
add_clocksource(timer);
|
||||
of_node_put(timer);
|
||||
init_sched_clock();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
event_timer = of_find_matching_node(NULL, osctimer_ids);
|
||||
if (!event_timer)
|
||||
panic("No timer for clockevent");
|
||||
add_clockevent(event_timer);
|
||||
|
||||
source_timer = of_find_matching_node(event_timer, osctimer_ids);
|
||||
if (!source_timer)
|
||||
panic("No timer for clocksource");
|
||||
add_clocksource(source_timer);
|
||||
|
||||
of_node_put(source_timer);
|
||||
|
||||
init_sched_clock();
|
||||
num_called++;
|
||||
}
|
||||
CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
|
||||
CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);
|
||||
|
|
|
|||
Loading…
Reference in a new issue