Skip to content

Commit

Permalink
clocksource: sirf: Fix incorrect clock enable counter for timer
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Barry Song <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
  • Loading branch information
Zhiwu Song authored and dlezcano committed Jul 23, 2014
1 parent 40c9631 commit 3894152
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/clocksource/timer-marco.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions drivers/clocksource/timer-prima2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3894152

Please sign in to comment.