Skip to content

Commit 03e053b

Browse files
lumagandersson
authored andcommitted
Revert "clk: qcom: regmap-mux: add pipe clk implementation"
Johan Hovold has pointed out that there are several deficiencies and a race condition in the regmap_mux_safe ops that were merged. Pipe clocks has been updated to use newer and simpler clk_regmap_phy_mux_ops. Drop the regmap-mux-safe clock ops now. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Johan Hovold <johan+linaro@kernel.org> Tested-by: Reviewed-by: Johan Hovold <johan+linaro@kernel.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220521005343.1429642-4-dmitry.baryshkov@linaro.org
1 parent 720e14f commit 03e053b

2 files changed

Lines changed: 0 additions & 81 deletions

File tree

drivers/clk/qcom/clk-regmap-mux.c

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -49,87 +49,9 @@ static int mux_set_parent(struct clk_hw *hw, u8 index)
4949
return regmap_update_bits(clkr->regmap, mux->reg, mask, val);
5050
}
5151

52-
static u8 mux_safe_get_parent(struct clk_hw *hw)
53-
{
54-
struct clk_regmap_mux *mux = to_clk_regmap_mux(hw);
55-
unsigned int val;
56-
57-
if (clk_hw_is_enabled(hw))
58-
return mux_get_parent(hw);
59-
60-
val = mux->stored_parent_cfg;
61-
62-
if (mux->parent_map)
63-
return qcom_find_cfg_index(hw, mux->parent_map, val);
64-
65-
return val;
66-
}
67-
68-
static int mux_safe_set_parent(struct clk_hw *hw, u8 index)
69-
{
70-
struct clk_regmap_mux *mux = to_clk_regmap_mux(hw);
71-
72-
if (clk_hw_is_enabled(hw))
73-
return mux_set_parent(hw, index);
74-
75-
if (mux->parent_map)
76-
index = mux->parent_map[index].cfg;
77-
78-
mux->stored_parent_cfg = index;
79-
80-
return 0;
81-
}
82-
83-
static void mux_safe_disable(struct clk_hw *hw)
84-
{
85-
struct clk_regmap_mux *mux = to_clk_regmap_mux(hw);
86-
struct clk_regmap *clkr = to_clk_regmap(hw);
87-
unsigned int mask = GENMASK(mux->width + mux->shift - 1, mux->shift);
88-
unsigned int val;
89-
90-
regmap_read(clkr->regmap, mux->reg, &val);
91-
92-
mux->stored_parent_cfg = (val & mask) >> mux->shift;
93-
94-
val = mux->safe_src_parent;
95-
if (mux->parent_map) {
96-
int index = qcom_find_src_index(hw, mux->parent_map, val);
97-
98-
if (WARN_ON(index < 0))
99-
return;
100-
101-
val = mux->parent_map[index].cfg;
102-
}
103-
val <<= mux->shift;
104-
105-
regmap_update_bits(clkr->regmap, mux->reg, mask, val);
106-
}
107-
108-
static int mux_safe_enable(struct clk_hw *hw)
109-
{
110-
struct clk_regmap_mux *mux = to_clk_regmap_mux(hw);
111-
struct clk_regmap *clkr = to_clk_regmap(hw);
112-
unsigned int mask = GENMASK(mux->width + mux->shift - 1, mux->shift);
113-
unsigned int val;
114-
115-
val = mux->stored_parent_cfg;
116-
val <<= mux->shift;
117-
118-
return regmap_update_bits(clkr->regmap, mux->reg, mask, val);
119-
}
120-
12152
const struct clk_ops clk_regmap_mux_closest_ops = {
12253
.get_parent = mux_get_parent,
12354
.set_parent = mux_set_parent,
12455
.determine_rate = __clk_mux_determine_rate_closest,
12556
};
12657
EXPORT_SYMBOL_GPL(clk_regmap_mux_closest_ops);
127-
128-
const struct clk_ops clk_regmap_mux_safe_ops = {
129-
.enable = mux_safe_enable,
130-
.disable = mux_safe_disable,
131-
.get_parent = mux_safe_get_parent,
132-
.set_parent = mux_safe_set_parent,
133-
.determine_rate = __clk_mux_determine_rate_closest,
134-
};
135-
EXPORT_SYMBOL_GPL(clk_regmap_mux_safe_ops);

drivers/clk/qcom/clk-regmap-mux.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@ struct clk_regmap_mux {
1414
u32 reg;
1515
u32 shift;
1616
u32 width;
17-
u8 safe_src_parent;
18-
u8 stored_parent_cfg;
1917
const struct parent_map *parent_map;
2018
struct clk_regmap clkr;
2119
};
2220

2321
extern const struct clk_ops clk_regmap_mux_closest_ops;
24-
extern const struct clk_ops clk_regmap_mux_safe_ops;
2522

2623
#endif

0 commit comments

Comments
 (0)