On Monday 03 June 2013 11:46:57 Heiko Stübner wrote:
The timers are of the same type and the clocksource driver just grabs the
first of them as clockevent and the second as clocksource, so I think two
CLOCKSOURCE_OF_DECLARE lines won't do.
Ok, got it. I was confused by the fact that the existing two sets of
"compatible" strings have separate sets of strings:
static const struct of_device_id sptimer_ids[] __initconst = {
{ .compatible = "picochip,pc3x2-rtc" },
{ .compatible = "snps,dw-apb-timer-sp" },
{ /* Sentinel */ },
};
static const struct of_device_id osctimer_ids[] __initconst = {
{ .compatible = "picochip,pc3x2-timer" },
{ .compatible = "snps,dw-apb-timer-osc" },
{},
};
and thought they were for clocksource and clockevent respectively,
which is wrong.
But I just looked at clocksource_of_init a bit more closely, which does a
for_each_matching_node_and_match over the nodes. So the init_func could grab
the device for the clockevent on the first call and the clocksource when it
gets called for the second matching node.
Yes, I think that should work. You just have to be careful about calling
init_sched_clock() only once.
Arnd