diff options
-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 = { |