ARM: mxs: retrieve timer irq from device tree
authorShawn Guo <shawn.guo@linaro.org>
Mon, 20 Aug 2012 00:51:45 +0000 (08:51 +0800)
committerShawn Guo <shawn.guo@linaro.org>
Mon, 3 Sep 2012 01:31:50 +0000 (09:31 +0800)
Rather than using the static timer irq definition, we should retrieve
timer irq from device tree for better.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
arch/arm/boot/dts/imx23.dtsi
arch/arm/boot/dts/imx28.dtsi
arch/arm/mach-mxs/include/mach/common.h
arch/arm/mach-mxs/timer.c
drivers/clk/mxs/clk-imx23.c
drivers/clk/mxs/clk-imx28.c

index e6138310e5ced961a269b903fadcfff6869c7be2..573066bc4c513c83c0e45fc9658e71ec5aa01c41 100644 (file)
                        };
 
                        timrot@80068000 {
+                               compatible = "fsl,imx23-timrot", "fsl,timrot";
                                reg = <0x80068000 0x2000>;
-                               status = "disabled";
+                               interrupts = <28 29 30 31>;
                        };
 
                        auart0: serial@8006c000 {
index 3fa6d190fab4f9a2c1c4c47abc8904bce199b0da..183fc65faa56fdd92fa43f3c401d357a0edb7e07 100644 (file)
                        };
 
                        timrot@80068000 {
+                               compatible = "fsl,imx28-timrot", "fsl,timrot";
                                reg = <0x80068000 0x2000>;
-                               status = "disabled";
+                               interrupts = <48 49 50 51>;
                        };
 
                        auart0: serial@8006a000 {
index de6c7ba425444ac2f7488c2a45fed2081887c79e..a7416c8a85ffa0e2044dd64e51376efd93bdfdad 100644 (file)
@@ -13,7 +13,7 @@
 
 extern const u32 *mxs_get_ocotp(void);
 extern int mxs_reset_block(void __iomem *);
-extern void mxs_timer_init(int);
+extern void mxs_timer_init(void);
 extern void mxs_restart(char, const char *);
 extern int mxs_saif_clkmux_select(unsigned int clkmux);
 
index 02d36de9c4e8c394a2b498fff4fbe877dea2a205..7c3792613392ddc7a4936a5f44388c5a23c4dd58 100644 (file)
@@ -25,6 +25,8 @@
 #include <linux/irq.h>
 #include <linux/clockchips.h>
 #include <linux/clk.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
 
 #include <asm/mach/time.h>
 #include <mach/mxs.h>
@@ -244,9 +246,17 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)
        return 0;
 }
 
-void __init mxs_timer_init(int irq)
+void __init mxs_timer_init(void)
 {
+       struct device_node *np;
        struct clk *timer_clk;
+       int irq;
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,timrot");
+       if (!np) {
+               pr_err("%s: failed find timrot node\n", __func__);
+               return;
+       }
 
        timer_clk = clk_get_sys("timrot", NULL);
        if (IS_ERR(timer_clk)) {
@@ -295,5 +305,6 @@ void __init mxs_timer_init(int irq)
        mxs_clockevent_init(timer_clk);
 
        /* Make irqs happen */
+       irq = irq_of_parse_and_map(np, 0);
        setup_irq(irq, &mxs_timer_irq);
 }
index 844043ad0fe44c7b18dfee9ce05abc4218fc2f8d..e0dc3f8d98665ad9639c7c2a0a65e381511632b6 100644 (file)
@@ -200,7 +200,7 @@ int __init mx23_clocks_init(void)
        for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
                clk_prepare_enable(clks[clks_init_on[i]]);
 
-       mxs_timer_init(MX23_INT_TIMER0);
+       mxs_timer_init();
 
        return 0;
 }
index e3aab67b3eb75a604a74d483f70ee9efdc403074..9df864dc65a3b13dd1a67fd5f578ad2fa21eb06c 100644 (file)
@@ -337,7 +337,7 @@ int __init mx28_clocks_init(void)
        for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
                clk_prepare_enable(clks[clks_init_on[i]]);
 
-       mxs_timer_init(MX28_INT_TIMER0);
+       mxs_timer_init();
 
        return 0;
 }