clocksource: samsung_pwm_timer: Get clock from device tree
authorTomasz Figa <t.figa@samsung.com>
Mon, 26 Aug 2013 17:08:58 +0000 (19:08 +0200)
committerMike Turquette <mturquette@linaro.org>
Fri, 6 Sep 2013 20:33:05 +0000 (13:33 -0700)
When booting with device tree static clkdev aliases should not be used.
This patch modifies the samsung_pwm_timer driver to use DT-based clock
lookup when booting with device tree.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
drivers/clocksource/samsung_pwm_timer.c

index 584b5472eea3e4f593c50dbea18cd5a78fe9d826..32950c3ed374fe6508f89ee4dcba1155dee14050 100644 (file)
@@ -349,10 +349,6 @@ static void __init samsung_clocksource_init(void)
 
 static void __init samsung_timer_resources(void)
 {
-       pwm.timerclk = clk_get(NULL, "timers");
-       if (IS_ERR(pwm.timerclk))
-               panic("failed to get timers clock for timer");
-
        clk_prepare_enable(pwm.timerclk);
 
        pwm.tcnt_max = (1UL << pwm.variant.bits) - 1;
@@ -397,6 +393,10 @@ void __init samsung_pwm_clocksource_init(void __iomem *base,
        memcpy(&pwm.variant, variant, sizeof(pwm.variant));
        memcpy(pwm.irq, irqs, SAMSUNG_PWM_NUM * sizeof(*irqs));
 
+       pwm.timerclk = clk_get(NULL, "timers");
+       if (IS_ERR(pwm.timerclk))
+               panic("failed to get timers clock for timer");
+
        _samsung_pwm_clocksource_init();
 }
 
@@ -437,6 +437,10 @@ static void __init samsung_pwm_alloc(struct device_node *np,
                return;
        }
 
+       pwm.timerclk = of_clk_get_by_name(np, "timers");
+       if (IS_ERR(pwm.timerclk))
+               panic("failed to get timers clock for timer");
+
        _samsung_pwm_clocksource_init();
 }