]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
arm: zynq: timer: Use helper initialization function
authorMichal Simek <michal.simek@xilinx.com>
Thu, 14 Feb 2013 09:07:00 +0000 (10:07 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 14 Feb 2013 15:58:11 +0000 (16:58 +0100)
In the Kernel v3.10 mainline zynq driver will use
different registration. Be prepare for it and synchronize
it with mainline.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/arm/mach-zynq/common.c
arch/arm/mach-zynq/common.h
arch/arm/mach-zynq/timer.c

index 4ddf571d33daf896d43bd163e107a66f498f4441..641bce9b71bccae2104c271cf0d5e61729e308be 100644 (file)
@@ -85,7 +85,7 @@ static int __init scu_init(void)
 static void __init xilinx_zynq_timer_init(void)
 {
        xslcr_init();
-       xttcps_timer_init();
+       xttcps_timer_init_old();
 }
 
 /*
index 21dc2020f154f977dba270cf4e642abdd19e2ed8..e4c5e98951ee7209f0c7c49502ddd0244cd559a8 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <mach/slcr.h>
 
-void __init xttcps_timer_init(void);
+void __init xttcps_timer_init_old(void);
 void platform_device_init(void);
 
 int __cpuinit zynq_cpun_start(u32 address, int cpu);
index 265a20f75029f9701a7366a42c88b1966c87769b..6fdc5f94700818cb3e3aa61923fca6d10eca2654 100644 (file)
@@ -318,15 +318,10 @@ static int xttcps_timer_rate_change_cb(struct notifier_block *nb,
  * Initializes the timer hardware and register the clock source and clock event
  * timers with Linux kernal timer framework
  */
-void __init xttcps_timer_init(void)
+static void __init xttcps_timer_init(struct device_node *timer)
 {
        unsigned int irq;
-       struct device_node *timer = NULL;
        void __iomem *timer_baseaddr;
-       const char * const timer_list[] = {
-               "xlnx,ps7-ttc-1.00.a",
-               NULL
-       };
        struct clk *clk;
 
        /*
@@ -334,12 +329,6 @@ void __init xttcps_timer_init(void)
         * and use it. Note that the event timer uses the interrupt and it's the
         * 2nd TTC hence the irq_of_parse_and_map(,1)
         */
-       timer = of_find_compatible_node(NULL, NULL, timer_list[0]);
-       if (!timer) {
-               pr_err("ERROR: no compatible timer found\n");
-               BUG();
-       }
-
        timer_baseaddr = of_iomap(timer, 0);
        if (!timer_baseaddr) {
                pr_err("ERROR: invalid timer base address\n");
@@ -358,7 +347,7 @@ void __init xttcps_timer_init(void)
        event_timer_irq.dev_id = &timers[XTTCPS_CLOCKEVENT];
        setup_irq(irq, &event_timer_irq);
 
-       pr_info("%s #0 at %p, irq=%d\n", timer_list[0], timer_baseaddr, irq);
+       pr_info("%s #0 at %p, irq=%d\n", timer->name, timer_baseaddr, irq);
 
        clk = clk_get_sys("CPU_1X_CLK", NULL);
        if (IS_ERR(clk)) {
@@ -395,3 +384,26 @@ void __init xttcps_timer_init(void)
        twd_local_timer_of_register();
 #endif
 }
+
+/*
+ * This will be replaced in v3.10 by
+ * CLOCKSOURCE_OF_DECLARE(zynq, "xlnx,ttc",xttcps_timer_init);
+ * or
+ * CLOCKSOURCE_OF_DECLARE(zynq, "xlnx,ps7-ttc-1.00.a",xttcps_timer_init);
+ */
+void __init xttcps_timer_init_old(void)
+{
+       const char * const timer_list[] = {
+               "xlnx,ps7-ttc-1.00.a",
+               NULL
+       };
+       struct device_node *timer;
+
+       timer = of_find_compatible_node(NULL, NULL, timer_list[0]);
+       if (!timer) {
+               pr_err("ERROR: no compatible timer found\n");
+               BUG();
+       }
+
+       xttcps_timer_init(timer);
+}