All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource: sirf: fix incorrect clock enable counter for timer
@ 2014-07-03 12:52 Barry Song
  2014-07-21 14:45 ` Daniel Lezcano
  0 siblings, 1 reply; 2+ messages in thread
From: Barry Song @ 2014-07-03 12:52 UTC (permalink / raw)
  To: linux-arm-kernel

From: Zhiwu Song <Zhiwu.Song@csr.com>

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>
---
 drivers/clocksource/timer-marco.c  | 3 +++
 drivers/clocksource/timer-prima2.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/clocksource/timer-marco.c b/drivers/clocksource/timer-marco.c
index dbd3039..330e930 100644
--- a/drivers/clocksource/timer-marco.c
+++ b/drivers/clocksource/timer-marco.c
@@ -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);
diff --git a/drivers/clocksource/timer-prima2.c b/drivers/clocksource/timer-prima2.c
index a722aac..ce18d57 100644
--- a/drivers/clocksource/timer-prima2.c
+++ b/drivers/clocksource/timer-prima2.c
@@ -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);
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-21 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-03 12:52 [PATCH] clocksource: sirf: fix incorrect clock enable counter for timer Barry Song
2014-07-21 14:45 ` Daniel Lezcano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.