microblaze: Added fdt chosen capability for timer
authorMichal Simek <monstr@monstr.eu>
Mon, 12 Dec 2011 13:02:47 +0000 (14:02 +0100)
committerMichal Simek <monstr@monstr.eu>
Thu, 4 Oct 2012 12:29:15 +0000 (14:29 +0200)
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@petalogix.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
arch/microblaze/kernel/timer.c

index 522defa7d41fa09a42badedf7fe675dd2fe3e9bf..edd3f835e7df1741bd6e6db417d620a1b01f1bb3 100644 (file)
@@ -257,7 +257,15 @@ void __init time_init(void)
                                0
                        };
 #endif
-       timer = of_find_compatible_node(NULL, NULL, "xlnx,xps-timer-1.00.a");
+       prop = of_get_property(of_chosen, "system-timer", NULL);
+       if (prop)
+               timer = of_find_node_by_phandle(be32_to_cpup(prop));
+       else
+               pr_info("No chosen timer found, using default\n");
+
+       if (!timer)
+               timer = of_find_compatible_node(NULL, NULL,
+                                               "xlnx,xps-timer-1.00.a");
        BUG_ON(!timer);
 
        timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL));