diff options
author | viresh kumar <viresh.kumar@st.com> | 2011-02-16 01:40:39 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-03-09 04:49:45 -0500 |
commit | af89fd812b00a52c54a3b9b2290fae4d31c7be9a (patch) | |
tree | 3892de4165b23e98424f672c23b7a6d456ad235d /arch/arm/mach-spear6xx/clock.c | |
parent | cf285434ac0880f94bf4afdd90b06a4655f56570 (diff) |
ARM: 6703/1: SPEAr: update clk API support
- Add support for divisor per parent clock
- Add ENABLED_ON_INIT feature in clk
- Add clk_set_rate(), round_rate_index & clk_round_rate()
- Simplify clk_recalc functions
- Add/update clock definitions
Reviewed-by: Stanley Miao <stanley.miao@windriver.com>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: shiraz hashim <shiraz.hashim@st.com>
Signed-off-by: Rajeev Kumar <rajeev-dlh.kumar@st.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-spear6xx/clock.c')
-rw-r--r-- | arch/arm/mach-spear6xx/clock.c | 331 |
1 files changed, 238 insertions, 93 deletions
diff --git a/arch/arm/mach-spear6xx/clock.c b/arch/arm/mach-spear6xx/clock.c index ef88922986e0..91719524766b 100644 --- a/arch/arm/mach-spear6xx/clock.c +++ b/arch/arm/mach-spear6xx/clock.c | |||
@@ -60,12 +60,22 @@ static struct pll_clk_config pll1_config = { | |||
60 | .masks = &pll1_masks, | 60 | .masks = &pll1_masks, |
61 | }; | 61 | }; |
62 | 62 | ||
63 | /* pll rate configuration table, in ascending order of rates */ | ||
64 | struct pll_rate_tbl pll_rtbl[] = { | ||
65 | {.mode = 0, .m = 0x85, .n = 0x0C, .p = 0x1}, /* 266 MHz */ | ||
66 | {.mode = 0, .m = 0xA6, .n = 0x0C, .p = 0x1}, /* 332 MHz */ | ||
67 | }; | ||
68 | |||
63 | /* PLL1 clock */ | 69 | /* PLL1 clock */ |
64 | static struct clk pll1_clk = { | 70 | static struct clk pll1_clk = { |
71 | .flags = ENABLED_ON_INIT, | ||
65 | .pclk = &osc_30m_clk, | 72 | .pclk = &osc_30m_clk, |
66 | .en_reg = PLL1_CTR, | 73 | .en_reg = PLL1_CTR, |
67 | .en_reg_bit = PLL_ENABLE, | 74 | .en_reg_bit = PLL_ENABLE, |
75 | .calc_rate = &pll_calc_rate, | ||
68 | .recalc = &pll_clk_recalc, | 76 | .recalc = &pll_clk_recalc, |
77 | .set_rate = &pll_clk_set_rate, | ||
78 | .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 1}, | ||
69 | .private_data = &pll1_config, | 79 | .private_data = &pll1_config, |
70 | }; | 80 | }; |
71 | 81 | ||
@@ -103,35 +113,25 @@ static struct bus_clk_config ahb_config = { | |||
103 | .masks = &ahb_masks, | 113 | .masks = &ahb_masks, |
104 | }; | 114 | }; |
105 | 115 | ||
116 | /* ahb rate configuration table, in ascending order of rates */ | ||
117 | struct bus_rate_tbl bus_rtbl[] = { | ||
118 | {.div = 3}, /* == parent divided by 4 */ | ||
119 | {.div = 2}, /* == parent divided by 3 */ | ||
120 | {.div = 1}, /* == parent divided by 2 */ | ||
121 | {.div = 0}, /* == parent divided by 1 */ | ||
122 | }; | ||
123 | |||
106 | /* ahb clock */ | 124 | /* ahb clock */ |
107 | static struct clk ahb_clk = { | 125 | static struct clk ahb_clk = { |
108 | .flags = ALWAYS_ENABLED, | 126 | .flags = ALWAYS_ENABLED, |
109 | .pclk = &pll1_clk, | 127 | .pclk = &pll1_clk, |
128 | .calc_rate = &bus_calc_rate, | ||
110 | .recalc = &bus_clk_recalc, | 129 | .recalc = &bus_clk_recalc, |
130 | .set_rate = &bus_clk_set_rate, | ||
131 | .rate_config = {bus_rtbl, ARRAY_SIZE(bus_rtbl), 2}, | ||
111 | .private_data = &ahb_config, | 132 | .private_data = &ahb_config, |
112 | }; | 133 | }; |
113 | 134 | ||
114 | /* uart parents */ | ||
115 | static struct pclk_info uart_pclk_info[] = { | ||
116 | { | ||
117 | .pclk = &pll1_clk, | ||
118 | .pclk_mask = AUX_CLK_PLL1_MASK, | ||
119 | .scalable = 1, | ||
120 | }, { | ||
121 | .pclk = &pll3_48m_clk, | ||
122 | .pclk_mask = AUX_CLK_PLL3_MASK, | ||
123 | .scalable = 0, | ||
124 | }, | ||
125 | }; | ||
126 | |||
127 | /* uart parent select structure */ | ||
128 | static struct pclk_sel uart_pclk_sel = { | ||
129 | .pclk_info = uart_pclk_info, | ||
130 | .pclk_count = ARRAY_SIZE(uart_pclk_info), | ||
131 | .pclk_sel_reg = PERIP_CLK_CFG, | ||
132 | .pclk_sel_mask = UART_CLK_MASK, | ||
133 | }; | ||
134 | |||
135 | /* auxiliary synthesizers masks */ | 135 | /* auxiliary synthesizers masks */ |
136 | static struct aux_clk_masks aux_masks = { | 136 | static struct aux_clk_masks aux_masks = { |
137 | .eq_sel_mask = AUX_EQ_SEL_MASK, | 137 | .eq_sel_mask = AUX_EQ_SEL_MASK, |
@@ -145,19 +145,57 @@ static struct aux_clk_masks aux_masks = { | |||
145 | }; | 145 | }; |
146 | 146 | ||
147 | /* uart configurations */ | 147 | /* uart configurations */ |
148 | static struct aux_clk_config uart_config = { | 148 | static struct aux_clk_config uart_synth_config = { |
149 | .synth_reg = UART_CLK_SYNT, | 149 | .synth_reg = UART_CLK_SYNT, |
150 | .masks = &aux_masks, | 150 | .masks = &aux_masks, |
151 | }; | 151 | }; |
152 | 152 | ||
153 | /* aux rate configuration table, in ascending order of rates */ | ||
154 | struct aux_rate_tbl aux_rtbl[] = { | ||
155 | /* For PLL1 = 332 MHz */ | ||
156 | {.xscale = 1, .yscale = 8, .eq = 1}, /* 41.5 MHz */ | ||
157 | {.xscale = 1, .yscale = 4, .eq = 1}, /* 83 MHz */ | ||
158 | {.xscale = 1, .yscale = 2, .eq = 1}, /* 166 MHz */ | ||
159 | }; | ||
160 | |||
161 | /* uart synth clock */ | ||
162 | static struct clk uart_synth_clk = { | ||
163 | .en_reg = UART_CLK_SYNT, | ||
164 | .en_reg_bit = AUX_SYNT_ENB, | ||
165 | .pclk = &pll1_clk, | ||
166 | .calc_rate = &aux_calc_rate, | ||
167 | .recalc = &aux_clk_recalc, | ||
168 | .set_rate = &aux_clk_set_rate, | ||
169 | .rate_config = {aux_rtbl, ARRAY_SIZE(aux_rtbl), 2}, | ||
170 | .private_data = &uart_synth_config, | ||
171 | }; | ||
172 | |||
173 | /* uart parents */ | ||
174 | static struct pclk_info uart_pclk_info[] = { | ||
175 | { | ||
176 | .pclk = &uart_synth_clk, | ||
177 | .pclk_val = AUX_CLK_PLL1_VAL, | ||
178 | }, { | ||
179 | .pclk = &pll3_48m_clk, | ||
180 | .pclk_val = AUX_CLK_PLL3_VAL, | ||
181 | }, | ||
182 | }; | ||
183 | |||
184 | /* uart parent select structure */ | ||
185 | static struct pclk_sel uart_pclk_sel = { | ||
186 | .pclk_info = uart_pclk_info, | ||
187 | .pclk_count = ARRAY_SIZE(uart_pclk_info), | ||
188 | .pclk_sel_reg = PERIP_CLK_CFG, | ||
189 | .pclk_sel_mask = UART_CLK_MASK, | ||
190 | }; | ||
191 | |||
153 | /* uart0 clock */ | 192 | /* uart0 clock */ |
154 | static struct clk uart0_clk = { | 193 | static struct clk uart0_clk = { |
155 | .en_reg = PERIP1_CLK_ENB, | 194 | .en_reg = PERIP1_CLK_ENB, |
156 | .en_reg_bit = UART0_CLK_ENB, | 195 | .en_reg_bit = UART0_CLK_ENB, |
157 | .pclk_sel = &uart_pclk_sel, | 196 | .pclk_sel = &uart_pclk_sel, |
158 | .pclk_sel_shift = UART_CLK_SHIFT, | 197 | .pclk_sel_shift = UART_CLK_SHIFT, |
159 | .recalc = &aux_clk_recalc, | 198 | .recalc = &follow_parent, |
160 | .private_data = &uart_config, | ||
161 | }; | 199 | }; |
162 | 200 | ||
163 | /* uart1 clock */ | 201 | /* uart1 clock */ |
@@ -166,26 +204,35 @@ static struct clk uart1_clk = { | |||
166 | .en_reg_bit = UART1_CLK_ENB, | 204 | .en_reg_bit = UART1_CLK_ENB, |
167 | .pclk_sel = &uart_pclk_sel, | 205 | .pclk_sel = &uart_pclk_sel, |
168 | .pclk_sel_shift = UART_CLK_SHIFT, | 206 | .pclk_sel_shift = UART_CLK_SHIFT, |
169 | .recalc = &aux_clk_recalc, | 207 | .recalc = &follow_parent, |
170 | .private_data = &uart_config, | ||
171 | }; | 208 | }; |
172 | 209 | ||
173 | /* firda configurations */ | 210 | /* firda configurations */ |
174 | static struct aux_clk_config firda_config = { | 211 | static struct aux_clk_config firda_synth_config = { |
175 | .synth_reg = FIRDA_CLK_SYNT, | 212 | .synth_reg = FIRDA_CLK_SYNT, |
176 | .masks = &aux_masks, | 213 | .masks = &aux_masks, |
177 | }; | 214 | }; |
178 | 215 | ||
216 | /* firda synth clock */ | ||
217 | static struct clk firda_synth_clk = { | ||
218 | .en_reg = FIRDA_CLK_SYNT, | ||
219 | .en_reg_bit = AUX_SYNT_ENB, | ||
220 | .pclk = &pll1_clk, | ||
221 | .calc_rate = &aux_calc_rate, | ||
222 | .recalc = &aux_clk_recalc, | ||
223 | .set_rate = &aux_clk_set_rate, | ||
224 | .rate_config = {aux_rtbl, ARRAY_SIZE(aux_rtbl), 2}, | ||
225 | .private_data = &firda_synth_config, | ||
226 | }; | ||
227 | |||
179 | /* firda parents */ | 228 | /* firda parents */ |
180 | static struct pclk_info firda_pclk_info[] = { | 229 | static struct pclk_info firda_pclk_info[] = { |
181 | { | 230 | { |
182 | .pclk = &pll1_clk, | 231 | .pclk = &firda_synth_clk, |
183 | .pclk_mask = AUX_CLK_PLL1_MASK, | 232 | .pclk_val = AUX_CLK_PLL1_VAL, |
184 | .scalable = 1, | ||
185 | }, { | 233 | }, { |
186 | .pclk = &pll3_48m_clk, | 234 | .pclk = &pll3_48m_clk, |
187 | .pclk_mask = AUX_CLK_PLL3_MASK, | 235 | .pclk_val = AUX_CLK_PLL3_VAL, |
188 | .scalable = 0, | ||
189 | }, | 236 | }, |
190 | }; | 237 | }; |
191 | 238 | ||
@@ -203,26 +250,35 @@ static struct clk firda_clk = { | |||
203 | .en_reg_bit = FIRDA_CLK_ENB, | 250 | .en_reg_bit = FIRDA_CLK_ENB, |
204 | .pclk_sel = &firda_pclk_sel, | 251 | .pclk_sel = &firda_pclk_sel, |
205 | .pclk_sel_shift = FIRDA_CLK_SHIFT, | 252 | .pclk_sel_shift = FIRDA_CLK_SHIFT, |
206 | .recalc = &aux_clk_recalc, | 253 | .recalc = &follow_parent, |
207 | .private_data = &firda_config, | ||
208 | }; | 254 | }; |
209 | 255 | ||
210 | /* clcd configurations */ | 256 | /* clcd configurations */ |
211 | static struct aux_clk_config clcd_config = { | 257 | static struct aux_clk_config clcd_synth_config = { |
212 | .synth_reg = CLCD_CLK_SYNT, | 258 | .synth_reg = CLCD_CLK_SYNT, |
213 | .masks = &aux_masks, | 259 | .masks = &aux_masks, |
214 | }; | 260 | }; |
215 | 261 | ||
262 | /* firda synth clock */ | ||
263 | static struct clk clcd_synth_clk = { | ||
264 | .en_reg = CLCD_CLK_SYNT, | ||
265 | .en_reg_bit = AUX_SYNT_ENB, | ||
266 | .pclk = &pll1_clk, | ||
267 | .calc_rate = &aux_calc_rate, | ||
268 | .recalc = &aux_clk_recalc, | ||
269 | .set_rate = &aux_clk_set_rate, | ||
270 | .rate_config = {aux_rtbl, ARRAY_SIZE(aux_rtbl), 2}, | ||
271 | .private_data = &clcd_synth_config, | ||
272 | }; | ||
273 | |||
216 | /* clcd parents */ | 274 | /* clcd parents */ |
217 | static struct pclk_info clcd_pclk_info[] = { | 275 | static struct pclk_info clcd_pclk_info[] = { |
218 | { | 276 | { |
219 | .pclk = &pll1_clk, | 277 | .pclk = &clcd_synth_clk, |
220 | .pclk_mask = AUX_CLK_PLL1_MASK, | 278 | .pclk_val = AUX_CLK_PLL1_VAL, |
221 | .scalable = 1, | ||
222 | }, { | 279 | }, { |
223 | .pclk = &pll3_48m_clk, | 280 | .pclk = &pll3_48m_clk, |
224 | .pclk_mask = AUX_CLK_PLL3_MASK, | 281 | .pclk_val = AUX_CLK_PLL3_VAL, |
225 | .scalable = 0, | ||
226 | }, | 282 | }, |
227 | }; | 283 | }; |
228 | 284 | ||
@@ -240,29 +296,7 @@ static struct clk clcd_clk = { | |||
240 | .en_reg_bit = CLCD_CLK_ENB, | 296 | .en_reg_bit = CLCD_CLK_ENB, |
241 | .pclk_sel = &clcd_pclk_sel, | 297 | .pclk_sel = &clcd_pclk_sel, |
242 | .pclk_sel_shift = CLCD_CLK_SHIFT, | 298 | .pclk_sel_shift = CLCD_CLK_SHIFT, |
243 | .recalc = &aux_clk_recalc, | 299 | .recalc = &follow_parent, |
244 | .private_data = &clcd_config, | ||
245 | }; | ||
246 | |||
247 | /* gpt parents */ | ||
248 | static struct pclk_info gpt_pclk_info[] = { | ||
249 | { | ||
250 | .pclk = &pll1_clk, | ||
251 | .pclk_mask = AUX_CLK_PLL1_MASK, | ||
252 | .scalable = 1, | ||
253 | }, { | ||
254 | .pclk = &pll3_48m_clk, | ||
255 | .pclk_mask = AUX_CLK_PLL3_MASK, | ||
256 | .scalable = 0, | ||
257 | }, | ||
258 | }; | ||
259 | |||
260 | /* gpt parent select structure */ | ||
261 | static struct pclk_sel gpt_pclk_sel = { | ||
262 | .pclk_info = gpt_pclk_info, | ||
263 | .pclk_count = ARRAY_SIZE(gpt_pclk_info), | ||
264 | .pclk_sel_reg = PERIP_CLK_CFG, | ||
265 | .pclk_sel_mask = GPT_CLK_MASK, | ||
266 | }; | 300 | }; |
267 | 301 | ||
268 | /* gpt synthesizer masks */ | 302 | /* gpt synthesizer masks */ |
@@ -273,60 +307,162 @@ static struct gpt_clk_masks gpt_masks = { | |||
273 | .nscale_sel_shift = GPT_NSCALE_SHIFT, | 307 | .nscale_sel_shift = GPT_NSCALE_SHIFT, |
274 | }; | 308 | }; |
275 | 309 | ||
276 | /* gpt0_1 configurations */ | 310 | /* gpt rate configuration table, in ascending order of rates */ |
277 | static struct gpt_clk_config gpt0_1_config = { | 311 | struct gpt_rate_tbl gpt_rtbl[] = { |
312 | /* For pll1 = 332 MHz */ | ||
313 | {.mscale = 4, .nscale = 0}, /* 41.5 MHz */ | ||
314 | {.mscale = 2, .nscale = 0}, /* 55.3 MHz */ | ||
315 | {.mscale = 1, .nscale = 0}, /* 83 MHz */ | ||
316 | }; | ||
317 | |||
318 | /* gpt0 synth clk config*/ | ||
319 | static struct gpt_clk_config gpt0_synth_config = { | ||
278 | .synth_reg = PRSC1_CLK_CFG, | 320 | .synth_reg = PRSC1_CLK_CFG, |
279 | .masks = &gpt_masks, | 321 | .masks = &gpt_masks, |
280 | }; | 322 | }; |
281 | 323 | ||
324 | /* gpt synth clock */ | ||
325 | static struct clk gpt0_synth_clk = { | ||
326 | .flags = ALWAYS_ENABLED, | ||
327 | .pclk = &pll1_clk, | ||
328 | .calc_rate = &gpt_calc_rate, | ||
329 | .recalc = &gpt_clk_recalc, | ||
330 | .set_rate = &gpt_clk_set_rate, | ||
331 | .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2}, | ||
332 | .private_data = &gpt0_synth_config, | ||
333 | }; | ||
334 | |||
335 | /* gpt parents */ | ||
336 | static struct pclk_info gpt0_pclk_info[] = { | ||
337 | { | ||
338 | .pclk = &gpt0_synth_clk, | ||
339 | .pclk_val = AUX_CLK_PLL1_VAL, | ||
340 | }, { | ||
341 | .pclk = &pll3_48m_clk, | ||
342 | .pclk_val = AUX_CLK_PLL3_VAL, | ||
343 | }, | ||
344 | }; | ||
345 | |||
346 | /* gpt parent select structure */ | ||
347 | static struct pclk_sel gpt0_pclk_sel = { | ||
348 | .pclk_info = gpt0_pclk_info, | ||
349 | .pclk_count = ARRAY_SIZE(gpt0_pclk_info), | ||
350 | .pclk_sel_reg = PERIP_CLK_CFG, | ||
351 | .pclk_sel_mask = GPT_CLK_MASK, | ||
352 | }; | ||
353 | |||
282 | /* gpt0 ARM1 subsystem timer clock */ | 354 | /* gpt0 ARM1 subsystem timer clock */ |
283 | static struct clk gpt0_clk = { | 355 | static struct clk gpt0_clk = { |
284 | .flags = ALWAYS_ENABLED, | 356 | .flags = ALWAYS_ENABLED, |
285 | .pclk_sel = &gpt_pclk_sel, | 357 | .pclk_sel = &gpt0_pclk_sel, |
286 | .pclk_sel_shift = GPT0_CLK_SHIFT, | 358 | .pclk_sel_shift = GPT0_CLK_SHIFT, |
287 | .recalc = &gpt_clk_recalc, | 359 | .recalc = &follow_parent, |
288 | .private_data = &gpt0_1_config, | 360 | }; |
361 | |||
362 | |||
363 | /* Note: gpt0 and gpt1 share same parent clocks */ | ||
364 | /* gpt parent select structure */ | ||
365 | static struct pclk_sel gpt1_pclk_sel = { | ||
366 | .pclk_info = gpt0_pclk_info, | ||
367 | .pclk_count = ARRAY_SIZE(gpt0_pclk_info), | ||
368 | .pclk_sel_reg = PERIP_CLK_CFG, | ||
369 | .pclk_sel_mask = GPT_CLK_MASK, | ||
289 | }; | 370 | }; |
290 | 371 | ||
291 | /* gpt1 timer clock */ | 372 | /* gpt1 timer clock */ |
292 | static struct clk gpt1_clk = { | 373 | static struct clk gpt1_clk = { |
293 | .flags = ALWAYS_ENABLED, | 374 | .flags = ALWAYS_ENABLED, |
294 | .pclk_sel = &gpt_pclk_sel, | 375 | .pclk_sel = &gpt1_pclk_sel, |
295 | .pclk_sel_shift = GPT1_CLK_SHIFT, | 376 | .pclk_sel_shift = GPT1_CLK_SHIFT, |
296 | .recalc = &gpt_clk_recalc, | 377 | .recalc = &follow_parent, |
297 | .private_data = &gpt0_1_config, | ||
298 | }; | 378 | }; |
299 | 379 | ||
300 | /* gpt2 configurations */ | 380 | /* gpt2 synth clk config*/ |
301 | static struct gpt_clk_config gpt2_config = { | 381 | static struct gpt_clk_config gpt2_synth_config = { |
302 | .synth_reg = PRSC2_CLK_CFG, | 382 | .synth_reg = PRSC2_CLK_CFG, |
303 | .masks = &gpt_masks, | 383 | .masks = &gpt_masks, |
304 | }; | 384 | }; |
305 | 385 | ||
386 | /* gpt synth clock */ | ||
387 | static struct clk gpt2_synth_clk = { | ||
388 | .flags = ALWAYS_ENABLED, | ||
389 | .pclk = &pll1_clk, | ||
390 | .calc_rate = &gpt_calc_rate, | ||
391 | .recalc = &gpt_clk_recalc, | ||
392 | .set_rate = &gpt_clk_set_rate, | ||
393 | .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2}, | ||
394 | .private_data = &gpt2_synth_config, | ||
395 | }; | ||
396 | |||
397 | /* gpt parents */ | ||
398 | static struct pclk_info gpt2_pclk_info[] = { | ||
399 | { | ||
400 | .pclk = &gpt2_synth_clk, | ||
401 | .pclk_val = AUX_CLK_PLL1_VAL, | ||
402 | }, { | ||
403 | .pclk = &pll3_48m_clk, | ||
404 | .pclk_val = AUX_CLK_PLL3_VAL, | ||
405 | }, | ||
406 | }; | ||
407 | |||
408 | /* gpt parent select structure */ | ||
409 | static struct pclk_sel gpt2_pclk_sel = { | ||
410 | .pclk_info = gpt2_pclk_info, | ||
411 | .pclk_count = ARRAY_SIZE(gpt2_pclk_info), | ||
412 | .pclk_sel_reg = PERIP_CLK_CFG, | ||
413 | .pclk_sel_mask = GPT_CLK_MASK, | ||
414 | }; | ||
415 | |||
306 | /* gpt2 timer clock */ | 416 | /* gpt2 timer clock */ |
307 | static struct clk gpt2_clk = { | 417 | static struct clk gpt2_clk = { |
308 | .en_reg = PERIP1_CLK_ENB, | 418 | .flags = ALWAYS_ENABLED, |
309 | .en_reg_bit = GPT2_CLK_ENB, | 419 | .pclk_sel = &gpt2_pclk_sel, |
310 | .pclk_sel = &gpt_pclk_sel, | ||
311 | .pclk_sel_shift = GPT2_CLK_SHIFT, | 420 | .pclk_sel_shift = GPT2_CLK_SHIFT, |
312 | .recalc = &gpt_clk_recalc, | 421 | .recalc = &follow_parent, |
313 | .private_data = &gpt2_config, | ||
314 | }; | 422 | }; |
315 | 423 | ||
316 | /* gpt3 configurations */ | 424 | /* gpt3 synth clk config*/ |
317 | static struct gpt_clk_config gpt3_config = { | 425 | static struct gpt_clk_config gpt3_synth_config = { |
318 | .synth_reg = PRSC3_CLK_CFG, | 426 | .synth_reg = PRSC3_CLK_CFG, |
319 | .masks = &gpt_masks, | 427 | .masks = &gpt_masks, |
320 | }; | 428 | }; |
321 | 429 | ||
430 | /* gpt synth clock */ | ||
431 | static struct clk gpt3_synth_clk = { | ||
432 | .flags = ALWAYS_ENABLED, | ||
433 | .pclk = &pll1_clk, | ||
434 | .calc_rate = &gpt_calc_rate, | ||
435 | .recalc = &gpt_clk_recalc, | ||
436 | .set_rate = &gpt_clk_set_rate, | ||
437 | .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2}, | ||
438 | .private_data = &gpt3_synth_config, | ||
439 | }; | ||
440 | |||
441 | /* gpt parents */ | ||
442 | static struct pclk_info gpt3_pclk_info[] = { | ||
443 | { | ||
444 | .pclk = &gpt3_synth_clk, | ||
445 | .pclk_val = AUX_CLK_PLL1_VAL, | ||
446 | }, { | ||
447 | .pclk = &pll3_48m_clk, | ||
448 | .pclk_val = AUX_CLK_PLL3_VAL, | ||
449 | }, | ||
450 | }; | ||
451 | |||
452 | /* gpt parent select structure */ | ||
453 | static struct pclk_sel gpt3_pclk_sel = { | ||
454 | .pclk_info = gpt3_pclk_info, | ||
455 | .pclk_count = ARRAY_SIZE(gpt3_pclk_info), | ||
456 | .pclk_sel_reg = PERIP_CLK_CFG, | ||
457 | .pclk_sel_mask = GPT_CLK_MASK, | ||
458 | }; | ||
459 | |||
322 | /* gpt3 timer clock */ | 460 | /* gpt3 timer clock */ |
323 | static struct clk gpt3_clk = { | 461 | static struct clk gpt3_clk = { |
324 | .en_reg = PERIP1_CLK_ENB, | 462 | .flags = ALWAYS_ENABLED, |
325 | .en_reg_bit = GPT3_CLK_ENB, | 463 | .pclk_sel = &gpt3_pclk_sel, |
326 | .pclk_sel = &gpt_pclk_sel, | ||
327 | .pclk_sel_shift = GPT3_CLK_SHIFT, | 464 | .pclk_sel_shift = GPT3_CLK_SHIFT, |
328 | .recalc = &gpt_clk_recalc, | 465 | .recalc = &follow_parent, |
329 | .private_data = &gpt3_config, | ||
330 | }; | 466 | }; |
331 | 467 | ||
332 | /* clock derived from pll3 clk */ | 468 | /* clock derived from pll3 clk */ |
@@ -371,7 +507,10 @@ static struct bus_clk_config apb_config = { | |||
371 | static struct clk apb_clk = { | 507 | static struct clk apb_clk = { |
372 | .flags = ALWAYS_ENABLED, | 508 | .flags = ALWAYS_ENABLED, |
373 | .pclk = &ahb_clk, | 509 | .pclk = &ahb_clk, |
510 | .calc_rate = &bus_calc_rate, | ||
374 | .recalc = &bus_clk_recalc, | 511 | .recalc = &bus_clk_recalc, |
512 | .set_rate = &bus_clk_set_rate, | ||
513 | .rate_config = {bus_rtbl, ARRAY_SIZE(bus_rtbl), 2}, | ||
375 | .private_data = &apb_config, | 514 | .private_data = &apb_config, |
376 | }; | 515 | }; |
377 | 516 | ||
@@ -488,7 +627,7 @@ static struct clk_lookup spear_clk_lookups[] = { | |||
488 | { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, | 627 | { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, |
489 | { .con_id = "osc_30m_clk", .clk = &osc_30m_clk}, | 628 | { .con_id = "osc_30m_clk", .clk = &osc_30m_clk}, |
490 | /* clock derived from 32 KHz os clk */ | 629 | /* clock derived from 32 KHz os clk */ |
491 | { .dev_id = "rtc", .clk = &rtc_clk}, | 630 | { .dev_id = "rtc-spear", .clk = &rtc_clk}, |
492 | /* clock derived from 30 MHz os clk */ | 631 | /* clock derived from 30 MHz os clk */ |
493 | { .con_id = "pll1_clk", .clk = &pll1_clk}, | 632 | { .con_id = "pll1_clk", .clk = &pll1_clk}, |
494 | { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk}, | 633 | { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk}, |
@@ -496,6 +635,12 @@ static struct clk_lookup spear_clk_lookups[] = { | |||
496 | /* clock derived from pll1 clk */ | 635 | /* clock derived from pll1 clk */ |
497 | { .con_id = "cpu_clk", .clk = &cpu_clk}, | 636 | { .con_id = "cpu_clk", .clk = &cpu_clk}, |
498 | { .con_id = "ahb_clk", .clk = &ahb_clk}, | 637 | { .con_id = "ahb_clk", .clk = &ahb_clk}, |
638 | { .con_id = "uart_synth_clk", .clk = &uart_synth_clk}, | ||
639 | { .con_id = "firda_synth_clk", .clk = &firda_synth_clk}, | ||
640 | { .con_id = "clcd_synth_clk", .clk = &clcd_synth_clk}, | ||
641 | { .con_id = "gpt0_synth_clk", .clk = &gpt0_synth_clk}, | ||
642 | { .con_id = "gpt2_synth_clk", .clk = &gpt2_synth_clk}, | ||
643 | { .con_id = "gpt3_synth_clk", .clk = &gpt3_synth_clk}, | ||
499 | { .dev_id = "uart0", .clk = &uart0_clk}, | 644 | { .dev_id = "uart0", .clk = &uart0_clk}, |
500 | { .dev_id = "uart1", .clk = &uart1_clk}, | 645 | { .dev_id = "uart1", .clk = &uart1_clk}, |
501 | { .dev_id = "firda", .clk = &firda_clk}, | 646 | { .dev_id = "firda", .clk = &firda_clk}, |
@@ -505,22 +650,22 @@ static struct clk_lookup spear_clk_lookups[] = { | |||
505 | { .dev_id = "gpt2", .clk = &gpt2_clk}, | 650 | { .dev_id = "gpt2", .clk = &gpt2_clk}, |
506 | { .dev_id = "gpt3", .clk = &gpt3_clk}, | 651 | { .dev_id = "gpt3", .clk = &gpt3_clk}, |
507 | /* clock derived from pll3 clk */ | 652 | /* clock derived from pll3 clk */ |
508 | { .dev_id = "usbh0", .clk = &usbh0_clk}, | 653 | { .con_id = "usbh.0_clk", .clk = &usbh0_clk}, |
509 | { .dev_id = "usbh1", .clk = &usbh1_clk}, | 654 | { .con_id = "usbh.1_clk", .clk = &usbh1_clk}, |
510 | { .dev_id = "usbd", .clk = &usbd_clk}, | 655 | { .dev_id = "usbd", .clk = &usbd_clk}, |
511 | /* clock derived from ahb clk */ | 656 | /* clock derived from ahb clk */ |
512 | { .con_id = "apb_clk", .clk = &apb_clk}, | 657 | { .con_id = "apb_clk", .clk = &apb_clk}, |
513 | { .dev_id = "i2c", .clk = &i2c_clk}, | 658 | { .dev_id = "i2c_designware.0", .clk = &i2c_clk}, |
514 | { .dev_id = "dma", .clk = &dma_clk}, | 659 | { .dev_id = "dma", .clk = &dma_clk}, |
515 | { .dev_id = "jpeg", .clk = &jpeg_clk}, | 660 | { .dev_id = "jpeg", .clk = &jpeg_clk}, |
516 | { .dev_id = "gmac", .clk = &gmac_clk}, | 661 | { .dev_id = "gmac", .clk = &gmac_clk}, |
517 | { .dev_id = "smi", .clk = &smi_clk}, | 662 | { .dev_id = "smi", .clk = &smi_clk}, |
518 | { .dev_id = "fsmc", .clk = &fsmc_clk}, | 663 | { .con_id = "fsmc", .clk = &fsmc_clk}, |
519 | /* clock derived from apb clk */ | 664 | /* clock derived from apb clk */ |
520 | { .dev_id = "adc", .clk = &adc_clk}, | 665 | { .dev_id = "adc", .clk = &adc_clk}, |
521 | { .dev_id = "ssp0", .clk = &ssp0_clk}, | 666 | { .dev_id = "ssp-pl022.0", .clk = &ssp0_clk}, |
522 | { .dev_id = "ssp1", .clk = &ssp1_clk}, | 667 | { .dev_id = "ssp-pl022.1", .clk = &ssp1_clk}, |
523 | { .dev_id = "ssp2", .clk = &ssp2_clk}, | 668 | { .dev_id = "ssp-pl022.2", .clk = &ssp2_clk}, |
524 | { .dev_id = "gpio0", .clk = &gpio0_clk}, | 669 | { .dev_id = "gpio0", .clk = &gpio0_clk}, |
525 | { .dev_id = "gpio1", .clk = &gpio1_clk}, | 670 | { .dev_id = "gpio1", .clk = &gpio1_clk}, |
526 | { .dev_id = "gpio2", .clk = &gpio2_clk}, | 671 | { .dev_id = "gpio2", .clk = &gpio2_clk}, |