aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/rockchip/clk-cpu.c29
-rw-r--r--drivers/clk/rockchip/clk-rk3036.c3
-rw-r--r--drivers/clk/rockchip/clk-rk3188.c6
-rw-r--r--drivers/clk/rockchip/clk-rk3228.c3
-rw-r--r--drivers/clk/rockchip/clk-rk3288.c3
-rw-r--r--drivers/clk/rockchip/clk-rk3368.c6
-rw-r--r--drivers/clk/rockchip/clk.h6
7 files changed, 45 insertions, 11 deletions
diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c
index 4e73ed5cab58..4bb130cd0062 100644
--- a/drivers/clk/rockchip/clk-cpu.c
+++ b/drivers/clk/rockchip/clk-cpu.c
@@ -158,12 +158,16 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk,
158 158
159 writel(HIWORD_UPDATE(alt_div, reg_data->div_core_mask, 159 writel(HIWORD_UPDATE(alt_div, reg_data->div_core_mask,
160 reg_data->div_core_shift) | 160 reg_data->div_core_shift) |
161 HIWORD_UPDATE(1, 1, reg_data->mux_core_shift), 161 HIWORD_UPDATE(reg_data->mux_core_alt,
162 reg_data->mux_core_mask,
163 reg_data->mux_core_shift),
162 cpuclk->reg_base + reg_data->core_reg); 164 cpuclk->reg_base + reg_data->core_reg);
163 } else { 165 } else {
164 /* select alternate parent */ 166 /* select alternate parent */
165 writel(HIWORD_UPDATE(1, 1, reg_data->mux_core_shift), 167 writel(HIWORD_UPDATE(reg_data->mux_core_alt,
166 cpuclk->reg_base + reg_data->core_reg); 168 reg_data->mux_core_mask,
169 reg_data->mux_core_shift),
170 cpuclk->reg_base + reg_data->core_reg);
167 } 171 }
168 172
169 spin_unlock_irqrestore(cpuclk->lock, flags); 173 spin_unlock_irqrestore(cpuclk->lock, flags);
@@ -198,7 +202,9 @@ static int rockchip_cpuclk_post_rate_change(struct rockchip_cpuclk *cpuclk,
198 202
199 writel(HIWORD_UPDATE(0, reg_data->div_core_mask, 203 writel(HIWORD_UPDATE(0, reg_data->div_core_mask,
200 reg_data->div_core_shift) | 204 reg_data->div_core_shift) |
201 HIWORD_UPDATE(0, 1, reg_data->mux_core_shift), 205 HIWORD_UPDATE(reg_data->mux_core_main,
206 reg_data->mux_core_mask,
207 reg_data->mux_core_shift),
202 cpuclk->reg_base + reg_data->core_reg); 208 cpuclk->reg_base + reg_data->core_reg);
203 209
204 if (ndata->old_rate > ndata->new_rate) 210 if (ndata->old_rate > ndata->new_rate)
@@ -252,7 +258,7 @@ struct clk *rockchip_clk_register_cpuclk(const char *name,
252 return ERR_PTR(-ENOMEM); 258 return ERR_PTR(-ENOMEM);
253 259
254 init.name = name; 260 init.name = name;
255 init.parent_names = &parent_names[0]; 261 init.parent_names = &parent_names[reg_data->mux_core_main];
256 init.num_parents = 1; 262 init.num_parents = 1;
257 init.ops = &rockchip_cpuclk_ops; 263 init.ops = &rockchip_cpuclk_ops;
258 264
@@ -270,10 +276,10 @@ struct clk *rockchip_clk_register_cpuclk(const char *name,
270 cpuclk->clk_nb.notifier_call = rockchip_cpuclk_notifier_cb; 276 cpuclk->clk_nb.notifier_call = rockchip_cpuclk_notifier_cb;
271 cpuclk->hw.init = &init; 277 cpuclk->hw.init = &init;
272 278
273 cpuclk->alt_parent = __clk_lookup(parent_names[1]); 279 cpuclk->alt_parent = __clk_lookup(parent_names[reg_data->mux_core_alt]);
274 if (!cpuclk->alt_parent) { 280 if (!cpuclk->alt_parent) {
275 pr_err("%s: could not lookup alternate parent\n", 281 pr_err("%s: could not lookup alternate parent: (%d)\n",
276 __func__); 282 __func__, reg_data->mux_core_alt);
277 ret = -EINVAL; 283 ret = -EINVAL;
278 goto free_cpuclk; 284 goto free_cpuclk;
279 } 285 }
@@ -285,10 +291,11 @@ struct clk *rockchip_clk_register_cpuclk(const char *name,
285 goto free_cpuclk; 291 goto free_cpuclk;
286 } 292 }
287 293
288 clk = __clk_lookup(parent_names[0]); 294 clk = __clk_lookup(parent_names[reg_data->mux_core_main]);
289 if (!clk) { 295 if (!clk) {
290 pr_err("%s: could not lookup parent clock %s\n", 296 pr_err("%s: could not lookup parent clock: (%d) %s\n",
291 __func__, parent_names[0]); 297 __func__, reg_data->mux_core_main,
298 parent_names[reg_data->mux_core_main]);
292 ret = -EINVAL; 299 ret = -EINVAL;
293 goto free_alt_parent; 300 goto free_alt_parent;
294 } 301 }
diff --git a/drivers/clk/rockchip/clk-rk3036.c b/drivers/clk/rockchip/clk-rk3036.c
index 7cdb2d61f3e0..f9cbba0eac36 100644
--- a/drivers/clk/rockchip/clk-rk3036.c
+++ b/drivers/clk/rockchip/clk-rk3036.c
@@ -113,7 +113,10 @@ static const struct rockchip_cpuclk_reg_data rk3036_cpuclk_data = {
113 .core_reg = RK2928_CLKSEL_CON(0), 113 .core_reg = RK2928_CLKSEL_CON(0),
114 .div_core_shift = 0, 114 .div_core_shift = 0,
115 .div_core_mask = 0x1f, 115 .div_core_mask = 0x1f,
116 .mux_core_alt = 1,
117 .mux_core_main = 0,
116 .mux_core_shift = 7, 118 .mux_core_shift = 7,
119 .mux_core_mask = 0x1,
117}; 120};
118 121
119PNAME(mux_pll_p) = { "xin24m", "xin24m" }; 122PNAME(mux_pll_p) = { "xin24m", "xin24m" };
diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c
index 40bab3901491..e832403a0f9f 100644
--- a/drivers/clk/rockchip/clk-rk3188.c
+++ b/drivers/clk/rockchip/clk-rk3188.c
@@ -155,7 +155,10 @@ static const struct rockchip_cpuclk_reg_data rk3066_cpuclk_data = {
155 .core_reg = RK2928_CLKSEL_CON(0), 155 .core_reg = RK2928_CLKSEL_CON(0),
156 .div_core_shift = 0, 156 .div_core_shift = 0,
157 .div_core_mask = 0x1f, 157 .div_core_mask = 0x1f,
158 .mux_core_alt = 1,
159 .mux_core_main = 0,
158 .mux_core_shift = 8, 160 .mux_core_shift = 8,
161 .mux_core_mask = 0x1,
159}; 162};
160 163
161#define RK3188_DIV_ACLK_CORE_MASK 0x7 164#define RK3188_DIV_ACLK_CORE_MASK 0x7
@@ -191,7 +194,10 @@ static const struct rockchip_cpuclk_reg_data rk3188_cpuclk_data = {
191 .core_reg = RK2928_CLKSEL_CON(0), 194 .core_reg = RK2928_CLKSEL_CON(0),
192 .div_core_shift = 9, 195 .div_core_shift = 9,
193 .div_core_mask = 0x1f, 196 .div_core_mask = 0x1f,
197 .mux_core_alt = 1,
198 .mux_core_main = 0,
194 .mux_core_shift = 8, 199 .mux_core_shift = 8,
200 .mux_core_mask = 0x1,
195}; 201};
196 202
197PNAME(mux_pll_p) = { "xin24m", "xin32k" }; 203PNAME(mux_pll_p) = { "xin24m", "xin32k" };
diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c
index 7702d2855e9c..4b4137e85125 100644
--- a/drivers/clk/rockchip/clk-rk3228.c
+++ b/drivers/clk/rockchip/clk-rk3228.c
@@ -111,7 +111,10 @@ static const struct rockchip_cpuclk_reg_data rk3228_cpuclk_data = {
111 .core_reg = RK2928_CLKSEL_CON(0), 111 .core_reg = RK2928_CLKSEL_CON(0),
112 .div_core_shift = 0, 112 .div_core_shift = 0,
113 .div_core_mask = 0x1f, 113 .div_core_mask = 0x1f,
114 .mux_core_alt = 1,
115 .mux_core_main = 0,
114 .mux_core_shift = 6, 116 .mux_core_shift = 6,
117 .mux_core_mask = 0x1,
115}; 118};
116 119
117PNAME(mux_pll_p) = { "clk_24m", "xin24m" }; 120PNAME(mux_pll_p) = { "clk_24m", "xin24m" };
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
index 3cb72163a512..00faf3f9b179 100644
--- a/drivers/clk/rockchip/clk-rk3288.c
+++ b/drivers/clk/rockchip/clk-rk3288.c
@@ -165,7 +165,10 @@ static const struct rockchip_cpuclk_reg_data rk3288_cpuclk_data = {
165 .core_reg = RK3288_CLKSEL_CON(0), 165 .core_reg = RK3288_CLKSEL_CON(0),
166 .div_core_shift = 8, 166 .div_core_shift = 8,
167 .div_core_mask = 0x1f, 167 .div_core_mask = 0x1f,
168 .mux_core_alt = 1,
169 .mux_core_main = 0,
168 .mux_core_shift = 15, 170 .mux_core_shift = 15,
171 .mux_core_mask = 0x1,
169}; 172};
170 173
171PNAME(mux_pll_p) = { "xin24m", "xin32k" }; 174PNAME(mux_pll_p) = { "xin24m", "xin32k" };
diff --git a/drivers/clk/rockchip/clk-rk3368.c b/drivers/clk/rockchip/clk-rk3368.c
index a2bb12200465..c26ff4a36dcd 100644
--- a/drivers/clk/rockchip/clk-rk3368.c
+++ b/drivers/clk/rockchip/clk-rk3368.c
@@ -165,14 +165,20 @@ static const struct rockchip_cpuclk_reg_data rk3368_cpuclkb_data = {
165 .core_reg = RK3368_CLKSEL_CON(0), 165 .core_reg = RK3368_CLKSEL_CON(0),
166 .div_core_shift = 0, 166 .div_core_shift = 0,
167 .div_core_mask = 0x1f, 167 .div_core_mask = 0x1f,
168 .mux_core_alt = 1,
169 .mux_core_main = 0,
168 .mux_core_shift = 7, 170 .mux_core_shift = 7,
171 .mux_core_mask = 0x1,
169}; 172};
170 173
171static const struct rockchip_cpuclk_reg_data rk3368_cpuclkl_data = { 174static const struct rockchip_cpuclk_reg_data rk3368_cpuclkl_data = {
172 .core_reg = RK3368_CLKSEL_CON(2), 175 .core_reg = RK3368_CLKSEL_CON(2),
173 .div_core_shift = 0, 176 .div_core_shift = 0,
177 .mux_core_alt = 1,
178 .mux_core_main = 0,
174 .div_core_mask = 0x1f, 179 .div_core_mask = 0x1f,
175 .mux_core_shift = 7, 180 .mux_core_shift = 7,
181 .mux_core_mask = 0x1,
176}; 182};
177 183
178#define RK3368_DIV_ACLKM_MASK 0x1f 184#define RK3368_DIV_ACLKM_MASK 0x1f
diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h
index f3da205073ee..4133bfc8f827 100644
--- a/drivers/clk/rockchip/clk.h
+++ b/drivers/clk/rockchip/clk.h
@@ -217,14 +217,20 @@ struct rockchip_cpuclk_rate_table {
217 * @core_reg: register offset of the core settings register 217 * @core_reg: register offset of the core settings register
218 * @div_core_shift: core divider offset used to divide the pll value 218 * @div_core_shift: core divider offset used to divide the pll value
219 * @div_core_mask: core divider mask 219 * @div_core_mask: core divider mask
220 * @mux_core_alt: mux value to select alternate parent
221 * @mux_core_main: mux value to select main parent of core
220 * @mux_core_shift: offset of the core multiplexer 222 * @mux_core_shift: offset of the core multiplexer
223 * @mux_core_mask: core multiplexer mask
221 */ 224 */
222struct rockchip_cpuclk_reg_data { 225struct rockchip_cpuclk_reg_data {
223 int core_reg; 226 int core_reg;
224 u8 div_core_shift; 227 u8 div_core_shift;
225 u32 div_core_mask; 228 u32 div_core_mask;
226 int mux_core_reg; 229 int mux_core_reg;
230 u8 mux_core_alt;
231 u8 mux_core_main;
227 u8 mux_core_shift; 232 u8 mux_core_shift;
233 u32 mux_core_mask;
228}; 234};
229 235
230struct clk *rockchip_clk_register_cpuclk(const char *name, 236struct clk *rockchip_clk_register_cpuclk(const char *name,