[PATCH 1/1] microblaze: Added fdt chosen capability for timer
John Williams
john.williams at petalogix.com
Fri Nov 11 01:21:50 EST 2011
On Thu, Nov 10, 2011 at 11:10 PM, Michal Simek <monstr at monstr.eu> wrote:
> From: "Peter A. G. Crosthwaite" <peter.crosthwaite at petalogix.com>
>
> This lets a dts author flag a particular timer in the system as the system timer.
> If the chosen node contains a "system-timer=<&foo>" entry than that handle will
> be used to determine the system timer. In no such entry exists then the first
> found timer will be used (current behaviour).
>
> Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite at petalogix.com>
> Signed-off-by: Michal Simek <monstr at monstr.eu>
> ---
> arch/microblaze/kernel/timer.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
> index 91804cd..c289412 100644
> --- a/arch/microblaze/kernel/timer.c
> +++ b/arch/microblaze/kernel/timer.c
> @@ -267,11 +267,15 @@ void __init time_init(void)
> NULL
> };
>
> - for (i = 0; timer_list[i] != NULL; i++) {
> + prop = of_get_property(of_chosen, "system-timer", NULL);
> + if (prop)
> + timer = of_find_node_by_phandle(be32_to_cpup(prop));
Suggest expanding this code to check that the chosen timer meets the
kernel requirements - IRQ connected, dual channel etc.
If it fails, then perhaps fall through to finding the first suitable
one, or panic()?
> + else
> + printk(KERN_INFO "No chosen timer found, using default\n");
> +
> + for (i = 0; timer_list[i] != NULL && !timer; i++)
> timer = of_find_compatible_node(NULL, NULL, timer_list[i]);
> - if (timer)
> - break;
There is another issue I think - can we somehow mark the system timer
instance as 'taken' so it can't be bound by another driver that might
be compatible (esp. generic-uio for example).
Currently if you mark the timer as generic-uio then a UIO app can mess
with it - not good.
John
--
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663 f: +61-7-30090663
More information about the devicetree-discuss
mailing list