hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/clk/rockchip/clk-half-divider.c
....@@ -3,8 +3,9 @@
33 * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd
44 */
55
6
-#include <linux/slab.h>
76 #include <linux/clk-provider.h>
7
+#include <linux/io.h>
8
+#include <linux/slab.h>
89 #include "clk.h"
910
1011 #define div_mask(width) ((1 << (width)) - 1)
....@@ -24,7 +25,7 @@
2425 struct clk_divider *divider = to_clk_divider(hw);
2526 unsigned int val;
2627
27
- val = clk_readl(divider->reg) >> divider->shift;
28
+ val = readl(divider->reg) >> divider->shift;
2829 val &= div_mask(divider->width);
2930 val = val * 2 + 3;
3031
....@@ -116,11 +117,11 @@
116117 if (divider->flags & CLK_DIVIDER_HIWORD_MASK) {
117118 val = div_mask(divider->width) << (divider->shift + 16);
118119 } else {
119
- val = clk_readl(divider->reg);
120
+ val = readl(divider->reg);
120121 val &= ~(div_mask(divider->width) << divider->shift);
121122 }
122123 val |= value << divider->shift;
123
- clk_writel(val, divider->reg);
124
+ writel(val, divider->reg);
124125
125126 if (divider->lock)
126127 spin_unlock_irqrestore(divider->lock, flags);
....@@ -130,12 +131,11 @@
130131 return 0;
131132 }
132133
133
-const struct clk_ops clk_half_divider_ops = {
134
+static const struct clk_ops clk_half_divider_ops = {
134135 .recalc_rate = clk_half_divider_recalc_rate,
135136 .round_rate = clk_half_divider_round_rate,
136137 .set_rate = clk_half_divider_set_rate,
137138 };
138
-EXPORT_SYMBOL_GPL(clk_half_divider_ops);
139139
140140 /**
141141 * Register a clock branch.
....@@ -158,7 +158,7 @@
158158 u8 gate_flags, unsigned long flags,
159159 spinlock_t *lock)
160160 {
161
- struct clk *clk = ERR_PTR(-ENOMEM);
161
+ struct clk_hw *hw = ERR_PTR(-ENOMEM);
162162 struct clk_mux *mux = NULL;
163163 struct clk_gate *gate = NULL;
164164 struct clk_divider *div = NULL;
....@@ -207,16 +207,18 @@
207207 div_ops = &clk_half_divider_ops;
208208 }
209209
210
- clk = clk_register_composite(NULL, name, parent_names, num_parents,
211
- mux ? &mux->hw : NULL, mux_ops,
212
- div ? &div->hw : NULL, div_ops,
213
- gate ? &gate->hw : NULL, gate_ops,
214
- flags);
210
+ hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
211
+ mux ? &mux->hw : NULL, mux_ops,
212
+ div ? &div->hw : NULL, div_ops,
213
+ gate ? &gate->hw : NULL, gate_ops,
214
+ flags);
215
+ if (IS_ERR(hw))
216
+ goto err_div;
215217
216
- return clk;
218
+ return hw->clk;
217219 err_div:
218220 kfree(gate);
219221 err_gate:
220222 kfree(mux);
221
- return ERR_PTR(-ENOMEM);
223
+ return ERR_CAST(hw);
222224 }