diff options
author | Peter De Schrijver <pdeschrijver@nvidia.com> | 2013-02-07 11:24:14 -0500 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2013-02-12 12:29:12 -0500 |
commit | c64c65d494ade53fa41fb0b980381807743b5095 (patch) | |
tree | 3dcf17880f8487eceac3a5a8d40b745d3d49d9b0 /drivers/clk | |
parent | 22ca335f6db9cf614696bbcb83eb0b80db7b4110 (diff) |
clk: tegra: Implement locking for super clock
Although tegra_clk_register_super_mux() has a lock parameter, the lock is not
actually used by the code. Fixed with this patch.
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Acked-by: Mike Turquette <mturquette@linaro.org>
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/tegra/clk-super.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c index 7ad48a832334..2fd924d38606 100644 --- a/drivers/clk/tegra/clk-super.c +++ b/drivers/clk/tegra/clk-super.c | |||
@@ -73,7 +73,12 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index) | |||
73 | { | 73 | { |
74 | struct tegra_clk_super_mux *mux = to_clk_super_mux(hw); | 74 | struct tegra_clk_super_mux *mux = to_clk_super_mux(hw); |
75 | u32 val, state; | 75 | u32 val, state; |
76 | int err = 0; | ||
76 | u8 parent_index, shift; | 77 | u8 parent_index, shift; |
78 | unsigned long flags = 0; | ||
79 | |||
80 | if (mux->lock) | ||
81 | spin_lock_irqsave(mux->lock, flags); | ||
77 | 82 | ||
78 | val = readl_relaxed(mux->reg); | 83 | val = readl_relaxed(mux->reg); |
79 | state = val & SUPER_STATE_MASK; | 84 | state = val & SUPER_STATE_MASK; |
@@ -92,8 +97,10 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index) | |||
92 | (index == mux->pllx_index))) { | 97 | (index == mux->pllx_index))) { |
93 | parent_index = clk_super_get_parent(hw); | 98 | parent_index = clk_super_get_parent(hw); |
94 | if ((parent_index == mux->div2_index) || | 99 | if ((parent_index == mux->div2_index) || |
95 | (parent_index == mux->pllx_index)) | 100 | (parent_index == mux->pllx_index)) { |
96 | return -EINVAL; | 101 | err = -EINVAL; |
102 | goto out; | ||
103 | } | ||
97 | 104 | ||
98 | val ^= SUPER_LP_DIV2_BYPASS; | 105 | val ^= SUPER_LP_DIV2_BYPASS; |
99 | writel_relaxed(val, mux->reg); | 106 | writel_relaxed(val, mux->reg); |
@@ -107,7 +114,12 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index) | |||
107 | 114 | ||
108 | writel_relaxed(val, mux->reg); | 115 | writel_relaxed(val, mux->reg); |
109 | udelay(2); | 116 | udelay(2); |
110 | return 0; | 117 | |
118 | out: | ||
119 | if (mux->lock) | ||
120 | spin_unlock_irqrestore(mux->lock, flags); | ||
121 | |||
122 | return err; | ||
111 | } | 123 | } |
112 | 124 | ||
113 | const struct clk_ops tegra_clk_super_ops = { | 125 | const struct clk_ops tegra_clk_super_ops = { |