On Dec 12, 2011 4:54 PM, "Rob Herring" <[email protected]> wrote: > > Grant, > > On 12/12/2011 04:02 PM, Grant Likely wrote: > > This patch adds support to the sp804 code for retrieving timer > > configuration from the device tree. sp804 channels can be used as > > a clock event device or a clock source. > > > > Signed-off-by: Grant Likely <[email protected]> > > Cc: Russell King <[email protected]> > > --- > > [snip] > > > + > > + /* > > + * Figure out how to use this clock > > + * > > + * Note: This is kind of ugly since it requires linux-specific > > + * properties in the device tree so that Linux knows which sp804 > > + * channels can be used as the clock source and the clock events > > + * trigger. Something OS agnostic would be nicer, but it isn't > > + * obvious what that should look like. > > + */ > > + if (of_get_property(node, "linux,clock-source", NULL)) { > > + __sp804_clocksource_init(base, node->full_name, clk); > > + } else if (of_get_property(node, "linux,clockevents-device", NULL)) { > > + irq = irq_of_parse_and_map(node, 0); > > + __sp804_clockevents_init(base, irq, node->full_name, clk); > > At least in the case of highbank, there is no interrupt connected for > 2nd timer in the h/w. So we could use that fact and presence of a clock > for each timer to determine which to use. Some of the ARM boards have 2 > sp804's (4 timers) though and you could use any combination I think. > Does it really matter which one is selected as long as it meets the > needs of the OS? Yes, we could think of possible scenarios that don't > work, but it's not likely to see a slew of new platforms with sp804's as > new ARM core integrate the timers in. Although, bcmring is a bit strange > setting up 2 clksrc's, but that doesn't really present a problem.
Interesting idea. I'll take a look at that tomorrow. It would be nice to be rid of that hack. I was mostly concerned about sp804s getting clocked from different sources and if there were any constraints I didn't understand. > The fact that you split the timer to 2 nodes is a bit of Linux's needs > defining the binding. The h/w block is a block with 2 timers. It's not > really split. The block does have a single set of primecell ID registers > at 0xfe0 for example. Yeah, I kind of bodged it that way because it was easier. I realized it probably should remain as one node when I wrote it. I'll take another look tomorrow. g.
_______________________________________________ devicetree-discuss mailing list [email protected] https://lists.ozlabs.org/listinfo/devicetree-discuss
