ARM: smp_twd: convert to use CLKSRC_OF init
authorRob Herring <rob.herring@calxeda.com>
Thu, 7 Feb 2013 03:17:47 +0000 (21:17 -0600)
committerRob Herring <rob.herring@calxeda.com>
Mon, 11 Mar 2013 13:42:08 +0000 (08:42 -0500)
Now that we have OF based init with CLKSRC_OF, convert smp_twd init
function to use it and covert all callers of
twd_local_timer_of_register.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Shiraz Hashim <shiraz.hashim@st.com>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-omap@vger.kernel.org
Cc: spear-devel@list.st.com
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
arch/arm/Kconfig
arch/arm/include/asm/smp_twd.h
arch/arm/kernel/smp_twd.c
arch/arm/mach-highbank/highbank.c
arch/arm/mach-imx/mach-imx6q.c
arch/arm/mach-omap2/timer.c
arch/arm/mach-spear13xx/spear13xx.c
arch/arm/mach-ux500/timer.c
arch/arm/mach-vexpress/v2m.c
drivers/clocksource/tegra20_timer.c

index 5b714695b01bb9db0455ad2f5c959a714aa00064..5bfd584929c8176988d057cfb54b7f8e88db8020 100644 (file)
@@ -1597,6 +1597,7 @@ config HAVE_ARM_ARCH_TIMER
 config HAVE_ARM_TWD
        bool
        depends on SMP
+       select CLKSRC_OF if OF
        help
          This options enables support for the ARM timer and watchdog unit
 
index 0f01f4677bd27569df340029cabe9f602a1e0eeb..7b2899c2f7fc8a4f07221bb599df93c6c4756f5f 100644 (file)
@@ -34,12 +34,4 @@ struct twd_local_timer name __initdata = {   \
 
 int twd_local_timer_register(struct twd_local_timer *);
 
-#ifdef CONFIG_HAVE_ARM_TWD
-void twd_local_timer_of_register(void);
-#else
-static inline void twd_local_timer_of_register(void)
-{
-}
-#endif
-
 #endif
index 3f256503748005346d5f1388aa1ed30978433b03..90525d9d290b9c25e3b40d5bdeedfc6a6f524cf6 100644 (file)
@@ -362,25 +362,13 @@ int __init twd_local_timer_register(struct twd_local_timer *tlt)
 }
 
 #ifdef CONFIG_OF
-const static struct of_device_id twd_of_match[] __initconst = {
-       { .compatible = "arm,cortex-a9-twd-timer",      },
-       { .compatible = "arm,cortex-a5-twd-timer",      },
-       { .compatible = "arm,arm11mp-twd-timer",        },
-       { },
-};
-
-void __init twd_local_timer_of_register(void)
+static void __init twd_local_timer_of_register(struct device_node *np)
 {
-       struct device_node *np;
        int err;
 
        if (!is_smp() || !setup_max_cpus)
                return;
 
-       np = of_find_matching_node(NULL, twd_of_match);
-       if (!np)
-               return;
-
        twd_ppi = irq_of_parse_and_map(np, 0);
        if (!twd_ppi) {
                err = -EINVAL;
@@ -398,4 +386,7 @@ void __init twd_local_timer_of_register(void)
 out:
        WARN(err, "twd_local_timer_of_register failed (%d)\n", err);
 }
+CLOCKSOURCE_OF_DECLARE(arm_twd_a9, "arm,cortex-a9-twd-timer", twd_local_timer_of_register);
+CLOCKSOURCE_OF_DECLARE(arm_twd_a5, "arm,cortex-a5-twd-timer", twd_local_timer_of_register);
+CLOCKSOURCE_OF_DECLARE(arm_twd_11mp, "arm,arm11mp-twd-timer", twd_local_timer_of_register);
 #endif
index a4f9f50247d4e9e4f5dc008436145b9a204bc2cb..76c1170b35284a0c96646413bb29476add96c7c3 100644 (file)
@@ -32,7 +32,6 @@
 #include <asm/cacheflush.h>
 #include <asm/cputype.h>
 #include <asm/smp_plat.h>
-#include <asm/smp_twd.h>
 #include <asm/hardware/arm_timer.h>
 #include <asm/hardware/timer-sp.h>
 #include <asm/hardware/cache-l2x0.h>
@@ -119,10 +118,10 @@ static void __init highbank_timer_init(void)
        sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1");
        sp804_clockevents_init(timer_base, irq, "timer0");
 
-       twd_local_timer_of_register();
-
        arch_timer_of_register();
        arch_timer_sched_clock_init();
+
+       clocksource_of_init();
 }
 
 static void highbank_power_off(void)
index 9ffd103b27e4da660f229cca79359a36fbeb1d38..b59ddcb57c78558c622b1022536f13e94b981d82 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/clk.h>
 #include <linux/clkdev.h>
+#include <linux/clocksource.h>
 #include <linux/cpu.h>
 #include <linux/delay.h>
 #include <linux/export.h>
 #include <linux/regmap.h>
 #include <linux/micrel_phy.h>
 #include <linux/mfd/syscon.h>
-#include <asm/smp_twd.h>
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
-#include <asm/mach/time.h>
 #include <asm/system_misc.h>
 
 #include "common.h"
@@ -292,7 +291,7 @@ static void __init imx6q_init_irq(void)
 static void __init imx6q_timer_init(void)
 {
        mx6q_clocks_init();
-       twd_local_timer_of_register();
+       clocksource_of_init();
        imx_print_silicon_rev("i.MX6Q", imx6q_revision());
 }
 
index 2bdd4cf17a8fd0e80b6c2c74feb66fcc9018ecca..4fd80257c73ebe768fbfef51c492bbde4dd9423c 100644 (file)
@@ -597,7 +597,7 @@ void __init omap4_local_timer_init(void)
                int err;
 
                if (of_have_populated_dt()) {
-                       twd_local_timer_of_register();
+                       clocksource_of_init();
                        return;
                }
 
index c7d2b4a8d8cc8dade91873b7a137656395b40051..25a10191b0218afb8ebbebe8a463ccf7cd869ea9 100644 (file)
 
 #include <linux/amba/pl022.h>
 #include <linux/clk.h>
+#include <linux/clocksource.h>
 #include <linux/dw_dmac.h>
 #include <linux/err.h>
 #include <linux/of.h>
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/mach/map.h>
-#include <asm/smp_twd.h>
 #include <mach/dma.h>
 #include <mach/generic.h>
 #include <mach/spear.h>
@@ -179,5 +179,5 @@ void __init spear13xx_timer_init(void)
        clk_put(pclk);
 
        spear_setup_of_timer();
-       twd_local_timer_of_register();
+       clocksource_of_init();
 }
index a6af0b8732bac8255619bdb5ebb1956692d74681..d07bbe7f04a65a5ceea7f9dd954be68aef7a877e 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/io.h>
 #include <linux/errno.h>
 #include <linux/clksrc-dbx500-prcmu.h>
+#include <linux/clocksource.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_data/clocksource-nomadik-mtu.h>
@@ -32,7 +33,7 @@ static void __init ux500_twd_init(void)
        twd_local_timer = &u8500_twd_local_timer;
 
        if (of_have_populated_dt())
-               twd_local_timer_of_register();
+               clocksource_of_init();
        else {
                err = twd_local_timer_register(twd_local_timer);
                if (err)
index 915683cb67d60a6eed062fa49cbc7781a11f761b..d0ad78998cb628c34feee844b81a4293cb28f253 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/amba/bus.h>
 #include <linux/amba/mmci.h>
 #include <linux/io.h>
+#include <linux/clocksource.h>
 #include <linux/smp.h>
 #include <linux/init.h>
 #include <linux/irqchip.h>
@@ -25,7 +26,6 @@
 #include <asm/arch_timer.h>
 #include <asm/mach-types.h>
 #include <asm/sizes.h>
-#include <asm/smp_twd.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
@@ -435,6 +435,7 @@ static void __init v2m_dt_timer_init(void)
 
        vexpress_clk_of_init();
 
+       clocksource_of_init();
        do {
                node = of_find_compatible_node(node, NULL, "arm,sp804");
        } while (node && vexpress_get_site_by_node(node) != VEXPRESS_SITE_MB);
@@ -445,8 +446,7 @@ static void __init v2m_dt_timer_init(void)
                                irq_of_parse_and_map(node, 0));
        }
 
-       if (arch_timer_of_register() != 0)
-               twd_local_timer_of_register();
+       arch_timer_of_register();
 
        if (arch_timer_sched_clock_init() != 0)
                versatile_sched_clock_init(vexpress_get_24mhz_clock_base(),
index 15cc723f699fe542524efae99308dc5418a4ab8c..2e4d8a666c36d6ee40db523408f34a8b5927bebf 100644 (file)
@@ -218,9 +218,6 @@ static void __init tegra20_init_timer(struct device_node *np)
        tegra_clockevent.irq = tegra_timer_irq.irq;
        clockevents_config_and_register(&tegra_clockevent, 1000000,
                                        0x1, 0x1fffffff);
-#ifdef CONFIG_HAVE_ARM_TWD
-       twd_local_timer_of_register();
-#endif
 }
 CLOCKSOURCE_OF_DECLARE(tegra20_timer, "nvidia,tegra20-timer", tegra20_init_timer);