.. | .. |
---|
3 | 3 | * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd |
---|
4 | 4 | */ |
---|
5 | 5 | |
---|
6 | | -#include <linux/slab.h> |
---|
7 | 6 | #include <linux/clk-provider.h> |
---|
| 7 | +#include <linux/io.h> |
---|
| 8 | +#include <linux/slab.h> |
---|
8 | 9 | #include "clk.h" |
---|
9 | 10 | |
---|
10 | 11 | #define div_mask(width) ((1 << (width)) - 1) |
---|
.. | .. |
---|
24 | 25 | struct clk_divider *divider = to_clk_divider(hw); |
---|
25 | 26 | unsigned int val; |
---|
26 | 27 | |
---|
27 | | - val = clk_readl(divider->reg) >> divider->shift; |
---|
| 28 | + val = readl(divider->reg) >> divider->shift; |
---|
28 | 29 | val &= div_mask(divider->width); |
---|
29 | 30 | val = val * 2 + 3; |
---|
30 | 31 | |
---|
.. | .. |
---|
116 | 117 | if (divider->flags & CLK_DIVIDER_HIWORD_MASK) { |
---|
117 | 118 | val = div_mask(divider->width) << (divider->shift + 16); |
---|
118 | 119 | } else { |
---|
119 | | - val = clk_readl(divider->reg); |
---|
| 120 | + val = readl(divider->reg); |
---|
120 | 121 | val &= ~(div_mask(divider->width) << divider->shift); |
---|
121 | 122 | } |
---|
122 | 123 | val |= value << divider->shift; |
---|
123 | | - clk_writel(val, divider->reg); |
---|
| 124 | + writel(val, divider->reg); |
---|
124 | 125 | |
---|
125 | 126 | if (divider->lock) |
---|
126 | 127 | spin_unlock_irqrestore(divider->lock, flags); |
---|
.. | .. |
---|
130 | 131 | return 0; |
---|
131 | 132 | } |
---|
132 | 133 | |
---|
133 | | -const struct clk_ops clk_half_divider_ops = { |
---|
| 134 | +static const struct clk_ops clk_half_divider_ops = { |
---|
134 | 135 | .recalc_rate = clk_half_divider_recalc_rate, |
---|
135 | 136 | .round_rate = clk_half_divider_round_rate, |
---|
136 | 137 | .set_rate = clk_half_divider_set_rate, |
---|
137 | 138 | }; |
---|
138 | | -EXPORT_SYMBOL_GPL(clk_half_divider_ops); |
---|
139 | 139 | |
---|
140 | 140 | /** |
---|
141 | 141 | * Register a clock branch. |
---|
.. | .. |
---|
158 | 158 | u8 gate_flags, unsigned long flags, |
---|
159 | 159 | spinlock_t *lock) |
---|
160 | 160 | { |
---|
161 | | - struct clk *clk = ERR_PTR(-ENOMEM); |
---|
| 161 | + struct clk_hw *hw = ERR_PTR(-ENOMEM); |
---|
162 | 162 | struct clk_mux *mux = NULL; |
---|
163 | 163 | struct clk_gate *gate = NULL; |
---|
164 | 164 | struct clk_divider *div = NULL; |
---|
.. | .. |
---|
207 | 207 | div_ops = &clk_half_divider_ops; |
---|
208 | 208 | } |
---|
209 | 209 | |
---|
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; |
---|
215 | 217 | |
---|
216 | | - return clk; |
---|
| 218 | + return hw->clk; |
---|
217 | 219 | err_div: |
---|
218 | 220 | kfree(gate); |
---|
219 | 221 | err_gate: |
---|
220 | 222 | kfree(mux); |
---|
221 | | - return ERR_PTR(-ENOMEM); |
---|
| 223 | + return ERR_CAST(hw); |
---|
222 | 224 | } |
---|