clocksource: sirf: Fix incorrect clock enable counter for timer
authorZhiwu Song <Zhiwu.Song@csr.com>
Thu, 3 Jul 2014 12:52:51 +0000 (20:52 +0800)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Wed, 23 Jul 2014 10:02:34 +0000 (12:02 +0200)
In the clocksource driver, we didn't explicitly enable the clock. it makes the
clk reference counter wrong. We didn't encounter any hang issue because the
tick's clock input has been open and is shared by some other hardware
components, but if we don't enable those components in kernel, in the stage of
disabling unused clk in kernel boot, Linux tick hangs.

This patch fixes it. it does an explicit prepare and enable to the clock input,
and increases the usage counter of the clk.

Signed-off-by: Zhiwu Song <Zhiwu.Song@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/clocksource/timer-marco.c
drivers/clocksource/timer-prima2.c

index dbd30398222a5268dce5ce5ced046a7789a5566e..330e93064692b881c1245dd2b4a64ab5a29cabd4 100644 (file)
@@ -260,6 +260,9 @@ static void __init sirfsoc_marco_timer_init(struct device_node *np)
 
        clk = of_clk_get(np, 0);
        BUG_ON(IS_ERR(clk));
+
+       BUG_ON(clk_prepare_enable(clk));
+
        rate = clk_get_rate(clk);
 
        BUG_ON(rate < MARCO_CLOCK_FREQ);
index a722aac7ac021baedf3db3db8e629de6d99a0b14..ce18d570e1cdfa58274201f74e90f15c2f1d13ff 100644 (file)
@@ -200,6 +200,9 @@ static void __init sirfsoc_prima2_timer_init(struct device_node *np)
 
        clk = of_clk_get(np, 0);
        BUG_ON(IS_ERR(clk));
+
+       BUG_ON(clk_prepare_enable(clk));
+
        rate = clk_get_rate(clk);
 
        BUG_ON(rate < PRIMA2_CLOCK_FREQ);