Skip to contentSkip to conversation

clocksource: sirf: fix incorrect clock enable counter for timer

PATCH New Barry Song 2 participants 2 messages Jul 3, 2014 – Jul 21, 2014 Clocksource, clockevent drivers

lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH 1/1 clocksource: sirf: fix incorrect clock enable counter for timer

From: Zhiwu Song <[email protected]>

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.

---
 drivers/clocksource/timer-marco.c  | 3 +++
 drivers/clocksource/timer-prima2.c | 3 +++
 2 files changed, 6 insertions(+)
drivers/clocksource/timer-marco.c +3 -0
index dbd3039..330e930 100644
@@ -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);
drivers/clocksource/timer-prima2.c +3 -0
index a722aac..ce18d57 100644
@@ -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);
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 clocksource: sirf: fix incorrect clock enable counter for timer

Quoted 9 lines · Barry Song

From: Zhiwu Song <[email protected]>

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.

Quoted 5 lines

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

Applied to my tree for 3.17

Thanks!

-- Daniel

Signature · 5 lines
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog