aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-spear3xx
diff options
context:
space:
mode:
authorviresh kumar <viresh.kumar@st.com>2011-02-16 01:40:39 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-03-09 04:49:45 -0500
commitaf89fd812b00a52c54a3b9b2290fae4d31c7be9a (patch)
tree3892de4165b23e98424f672c23b7a6d456ad235d /arch/arm/mach-spear3xx
parentcf285434ac0880f94bf4afdd90b06a4655f56570 (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-spear3xx')
-rw-r--r--arch/arm/mach-spear3xx/clock.c431
-rw-r--r--arch/arm/mach-spear3xx/include/mach/misc_regs.h5
2 files changed, 369 insertions, 67 deletions
diff --git a/arch/arm/mach-spear3xx/clock.c b/arch/arm/mach-spear3xx/clock.c
index 7ea8749ddf28..8ae4ad0326a9 100644
--- a/arch/arm/mach-spear3xx/clock.c
+++ b/arch/arm/mach-spear3xx/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 */
64struct 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 */
64static struct clk pll1_clk = { 70static struct clk pll1_clk = {
71 .flags = ENABLED_ON_INIT,
65 .pclk = &osc_24m_clk, 72 .pclk = &osc_24m_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,11 +113,22 @@ 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 */
117struct 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 */
107static struct clk ahb_clk = { 125static 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
@@ -123,22 +144,40 @@ static struct aux_clk_masks aux_masks = {
123 .yscale_sel_shift = AUX_YSCALE_SHIFT, 144 .yscale_sel_shift = AUX_YSCALE_SHIFT,
124}; 145};
125 146
126/* uart configurations */ 147/* uart synth configurations */
127static struct aux_clk_config uart_config = { 148static struct aux_clk_config uart_synth_config = {
128 .synth_reg = UART_CLK_SYNT, 149 .synth_reg = UART_CLK_SYNT,
129 .masks = &aux_masks, 150 .masks = &aux_masks,
130}; 151};
131 152
153/* aux rate configuration table, in ascending order of rates */
154struct 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 */
162static 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), 1},
170 .private_data = &uart_synth_config,
171};
172
132/* uart parents */ 173/* uart parents */
133static struct pclk_info uart_pclk_info[] = { 174static struct pclk_info uart_pclk_info[] = {
134 { 175 {
135 .pclk = &pll1_clk, 176 .pclk = &uart_synth_clk,
136 .pclk_mask = AUX_CLK_PLL1_MASK, 177 .pclk_val = AUX_CLK_PLL1_VAL,
137 .scalable = 1,
138 }, { 178 }, {
139 .pclk = &pll3_48m_clk, 179 .pclk = &pll3_48m_clk,
140 .pclk_mask = AUX_CLK_PLL3_MASK, 180 .pclk_val = AUX_CLK_PLL3_VAL,
141 .scalable = 0,
142 }, 181 },
143}; 182};
144 183
@@ -156,26 +195,35 @@ static struct clk uart_clk = {
156 .en_reg_bit = UART_CLK_ENB, 195 .en_reg_bit = UART_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/* firda configurations */ 201/* firda configurations */
164static struct aux_clk_config firda_config = { 202static struct aux_clk_config firda_synth_config = {
165 .synth_reg = FIRDA_CLK_SYNT, 203 .synth_reg = FIRDA_CLK_SYNT,
166 .masks = &aux_masks, 204 .masks = &aux_masks,
167}; 205};
168 206
207/* firda synth clock */
208static struct clk firda_synth_clk = {
209 .en_reg = FIRDA_CLK_SYNT,
210 .en_reg_bit = AUX_SYNT_ENB,
211 .pclk = &pll1_clk,
212 .calc_rate = &aux_calc_rate,
213 .recalc = &aux_clk_recalc,
214 .set_rate = &aux_clk_set_rate,
215 .rate_config = {aux_rtbl, ARRAY_SIZE(aux_rtbl), 1},
216 .private_data = &firda_synth_config,
217};
218
169/* firda parents */ 219/* firda parents */
170static struct pclk_info firda_pclk_info[] = { 220static struct pclk_info firda_pclk_info[] = {
171 { 221 {
172 .pclk = &pll1_clk, 222 .pclk = &firda_synth_clk,
173 .pclk_mask = AUX_CLK_PLL1_MASK, 223 .pclk_val = AUX_CLK_PLL1_VAL,
174 .scalable = 1,
175 }, { 224 }, {
176 .pclk = &pll3_48m_clk, 225 .pclk = &pll3_48m_clk,
177 .pclk_mask = AUX_CLK_PLL3_MASK, 226 .pclk_val = AUX_CLK_PLL3_VAL,
178 .scalable = 0,
179 }, 227 },
180}; 228};
181 229
@@ -193,84 +241,155 @@ static struct clk firda_clk = {
193 .en_reg_bit = FIRDA_CLK_ENB, 241 .en_reg_bit = FIRDA_CLK_ENB,
194 .pclk_sel = &firda_pclk_sel, 242 .pclk_sel = &firda_pclk_sel,
195 .pclk_sel_shift = FIRDA_CLK_SHIFT, 243 .pclk_sel_shift = FIRDA_CLK_SHIFT,
196 .recalc = &aux_clk_recalc, 244 .recalc = &follow_parent,
197 .private_data = &firda_config, 245};
246
247/* gpt synthesizer masks */
248static struct gpt_clk_masks gpt_masks = {
249 .mscale_sel_mask = GPT_MSCALE_MASK,
250 .mscale_sel_shift = GPT_MSCALE_SHIFT,
251 .nscale_sel_mask = GPT_NSCALE_MASK,
252 .nscale_sel_shift = GPT_NSCALE_SHIFT,
253};
254
255/* gpt rate configuration table, in ascending order of rates */
256struct gpt_rate_tbl gpt_rtbl[] = {
257 /* For pll1 = 332 MHz */
258 {.mscale = 4, .nscale = 0}, /* 41.5 MHz */
259 {.mscale = 2, .nscale = 0}, /* 55.3 MHz */
260 {.mscale = 1, .nscale = 0}, /* 83 MHz */
261};
262
263/* gpt0 synth clk config*/
264static struct gpt_clk_config gpt0_synth_config = {
265 .synth_reg = PRSC1_CLK_CFG,
266 .masks = &gpt_masks,
267};
268
269/* gpt synth clock */
270static struct clk gpt0_synth_clk = {
271 .flags = ALWAYS_ENABLED,
272 .pclk = &pll1_clk,
273 .calc_rate = &gpt_calc_rate,
274 .recalc = &gpt_clk_recalc,
275 .set_rate = &gpt_clk_set_rate,
276 .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2},
277 .private_data = &gpt0_synth_config,
198}; 278};
199 279
200/* gpt parents */ 280/* gpt parents */
201static struct pclk_info gpt_pclk_info[] = { 281static struct pclk_info gpt0_pclk_info[] = {
202 { 282 {
203 .pclk = &pll1_clk, 283 .pclk = &gpt0_synth_clk,
204 .pclk_mask = AUX_CLK_PLL1_MASK, 284 .pclk_val = AUX_CLK_PLL1_VAL,
205 .scalable = 1,
206 }, { 285 }, {
207 .pclk = &pll3_48m_clk, 286 .pclk = &pll3_48m_clk,
208 .pclk_mask = AUX_CLK_PLL3_MASK, 287 .pclk_val = AUX_CLK_PLL3_VAL,
209 .scalable = 0,
210 }, 288 },
211}; 289};
212 290
213/* gpt parent select structure */ 291/* gpt parent select structure */
214static struct pclk_sel gpt_pclk_sel = { 292static struct pclk_sel gpt0_pclk_sel = {
215 .pclk_info = gpt_pclk_info, 293 .pclk_info = gpt0_pclk_info,
216 .pclk_count = ARRAY_SIZE(gpt_pclk_info), 294 .pclk_count = ARRAY_SIZE(gpt0_pclk_info),
217 .pclk_sel_reg = PERIP_CLK_CFG, 295 .pclk_sel_reg = PERIP_CLK_CFG,
218 .pclk_sel_mask = GPT_CLK_MASK, 296 .pclk_sel_mask = GPT_CLK_MASK,
219}; 297};
220 298
221/* gpt synthesizer masks */ 299/* gpt0 timer clock */
222static struct gpt_clk_masks gpt_masks = { 300static struct clk gpt0_clk = {
223 .mscale_sel_mask = GPT_MSCALE_MASK, 301 .flags = ALWAYS_ENABLED,
224 .mscale_sel_shift = GPT_MSCALE_SHIFT, 302 .pclk_sel = &gpt0_pclk_sel,
225 .nscale_sel_mask = GPT_NSCALE_MASK, 303 .pclk_sel_shift = GPT0_CLK_SHIFT,
226 .nscale_sel_shift = GPT_NSCALE_SHIFT, 304 .recalc = &follow_parent,
227}; 305};
228 306
229/* gpt0 configurations */ 307/* gpt1 synth clk configurations */
230static struct gpt_clk_config gpt0_config = { 308static struct gpt_clk_config gpt1_synth_config = {
231 .synth_reg = PRSC1_CLK_CFG, 309 .synth_reg = PRSC2_CLK_CFG,
232 .masks = &gpt_masks, 310 .masks = &gpt_masks,
233}; 311};
234 312
235/* gpt0 timer clock */ 313/* gpt1 synth clock */
236static struct clk gpt0_clk = { 314static struct clk gpt1_synth_clk = {
237 .flags = ALWAYS_ENABLED, 315 .flags = ALWAYS_ENABLED,
238 .pclk_sel = &gpt_pclk_sel, 316 .pclk = &pll1_clk,
239 .pclk_sel_shift = GPT0_CLK_SHIFT, 317 .calc_rate = &gpt_calc_rate,
240 .recalc = &gpt_clk_recalc, 318 .recalc = &gpt_clk_recalc,
241 .private_data = &gpt0_config, 319 .set_rate = &gpt_clk_set_rate,
320 .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2},
321 .private_data = &gpt1_synth_config,
242}; 322};
243 323
244/* gpt1 configurations */ 324static struct pclk_info gpt1_pclk_info[] = {
245static struct gpt_clk_config gpt1_config = { 325 {
246 .synth_reg = PRSC2_CLK_CFG, 326 .pclk = &gpt1_synth_clk,
247 .masks = &gpt_masks, 327 .pclk_val = AUX_CLK_PLL1_VAL,
328 }, {
329 .pclk = &pll3_48m_clk,
330 .pclk_val = AUX_CLK_PLL3_VAL,
331 },
332};
333
334/* gpt parent select structure */
335static struct pclk_sel gpt1_pclk_sel = {
336 .pclk_info = gpt1_pclk_info,
337 .pclk_count = ARRAY_SIZE(gpt1_pclk_info),
338 .pclk_sel_reg = PERIP_CLK_CFG,
339 .pclk_sel_mask = GPT_CLK_MASK,
248}; 340};
249 341
250/* gpt1 timer clock */ 342/* gpt1 timer clock */
251static struct clk gpt1_clk = { 343static struct clk gpt1_clk = {
252 .en_reg = PERIP1_CLK_ENB, 344 .en_reg = PERIP1_CLK_ENB,
253 .en_reg_bit = GPT1_CLK_ENB, 345 .en_reg_bit = GPT1_CLK_ENB,
254 .pclk_sel = &gpt_pclk_sel, 346 .pclk_sel = &gpt1_pclk_sel,
255 .pclk_sel_shift = GPT1_CLK_SHIFT, 347 .pclk_sel_shift = GPT1_CLK_SHIFT,
256 .recalc = &gpt_clk_recalc, 348 .recalc = &follow_parent,
257 .private_data = &gpt1_config,
258}; 349};
259 350
260/* gpt2 configurations */ 351/* gpt2 synth clk configurations */
261static struct gpt_clk_config gpt2_config = { 352static struct gpt_clk_config gpt2_synth_config = {
262 .synth_reg = PRSC3_CLK_CFG, 353 .synth_reg = PRSC3_CLK_CFG,
263 .masks = &gpt_masks, 354 .masks = &gpt_masks,
264}; 355};
265 356
357/* gpt1 synth clock */
358static struct clk gpt2_synth_clk = {
359 .flags = ALWAYS_ENABLED,
360 .pclk = &pll1_clk,
361 .calc_rate = &gpt_calc_rate,
362 .recalc = &gpt_clk_recalc,
363 .set_rate = &gpt_clk_set_rate,
364 .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2},
365 .private_data = &gpt2_synth_config,
366};
367
368static struct pclk_info gpt2_pclk_info[] = {
369 {
370 .pclk = &gpt2_synth_clk,
371 .pclk_val = AUX_CLK_PLL1_VAL,
372 }, {
373 .pclk = &pll3_48m_clk,
374 .pclk_val = AUX_CLK_PLL3_VAL,
375 },
376};
377
378/* gpt parent select structure */
379static struct pclk_sel gpt2_pclk_sel = {
380 .pclk_info = gpt2_pclk_info,
381 .pclk_count = ARRAY_SIZE(gpt2_pclk_info),
382 .pclk_sel_reg = PERIP_CLK_CFG,
383 .pclk_sel_mask = GPT_CLK_MASK,
384};
385
266/* gpt2 timer clock */ 386/* gpt2 timer clock */
267static struct clk gpt2_clk = { 387static struct clk gpt2_clk = {
268 .en_reg = PERIP1_CLK_ENB, 388 .en_reg = PERIP1_CLK_ENB,
269 .en_reg_bit = GPT2_CLK_ENB, 389 .en_reg_bit = GPT2_CLK_ENB,
270 .pclk_sel = &gpt_pclk_sel, 390 .pclk_sel = &gpt2_pclk_sel,
271 .pclk_sel_shift = GPT2_CLK_SHIFT, 391 .pclk_sel_shift = GPT2_CLK_SHIFT,
272 .recalc = &gpt_clk_recalc, 392 .recalc = &follow_parent,
273 .private_data = &gpt2_config,
274}; 393};
275 394
276/* clock derived from pll3 clk */ 395/* clock derived from pll3 clk */
@@ -290,13 +409,6 @@ static struct clk usbd_clk = {
290 .recalc = &follow_parent, 409 .recalc = &follow_parent,
291}; 410};
292 411
293/* clcd clock */
294static struct clk clcd_clk = {
295 .flags = ALWAYS_ENABLED,
296 .pclk = &pll3_48m_clk,
297 .recalc = &follow_parent,
298};
299
300/* clock derived from ahb clk */ 412/* clock derived from ahb clk */
301/* apb masks structure */ 413/* apb masks structure */
302static struct bus_clk_masks apb_masks = { 414static struct bus_clk_masks apb_masks = {
@@ -314,7 +426,10 @@ static struct bus_clk_config apb_config = {
314static struct clk apb_clk = { 426static struct clk apb_clk = {
315 .flags = ALWAYS_ENABLED, 427 .flags = ALWAYS_ENABLED,
316 .pclk = &ahb_clk, 428 .pclk = &ahb_clk,
429 .calc_rate = &bus_calc_rate,
317 .recalc = &bus_clk_recalc, 430 .recalc = &bus_clk_recalc,
431 .set_rate = &bus_clk_set_rate,
432 .rate_config = {bus_rtbl, ARRAY_SIZE(bus_rtbl), 2},
318 .private_data = &apb_config, 433 .private_data = &apb_config,
319}; 434};
320 435
@@ -375,8 +490,17 @@ static struct clk adc_clk = {
375 .recalc = &follow_parent, 490 .recalc = &follow_parent,
376}; 491};
377 492
493#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
494/* emi clock */
495static struct clk emi_clk = {
496 .flags = ALWAYS_ENABLED,
497 .pclk = &ahb_clk,
498 .recalc = &follow_parent,
499};
500#endif
501
378/* ssp clock */ 502/* ssp clock */
379static struct clk ssp_clk = { 503static struct clk ssp0_clk = {
380 .pclk = &apb_clk, 504 .pclk = &apb_clk,
381 .en_reg = PERIP1_CLK_ENB, 505 .en_reg = PERIP1_CLK_ENB,
382 .en_reg_bit = SSP_CLK_ENB, 506 .en_reg_bit = SSP_CLK_ENB,
@@ -393,6 +517,137 @@ static struct clk gpio_clk = {
393 517
394static struct clk dummy_apb_pclk; 518static struct clk dummy_apb_pclk;
395 519
520#if defined(CONFIG_MACH_SPEAR300) || defined(CONFIG_MACH_SPEAR310) || \
521 defined(CONFIG_MACH_SPEAR320)
522/* fsmc clock */
523static struct clk fsmc_clk = {
524 .flags = ALWAYS_ENABLED,
525 .pclk = &ahb_clk,
526 .recalc = &follow_parent,
527};
528#endif
529
530/* common clocks to spear310 and spear320 */
531#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
532/* uart1 clock */
533static struct clk uart1_clk = {
534 .flags = ALWAYS_ENABLED,
535 .pclk = &apb_clk,
536 .recalc = &follow_parent,
537};
538
539/* uart2 clock */
540static struct clk uart2_clk = {
541 .flags = ALWAYS_ENABLED,
542 .pclk = &apb_clk,
543 .recalc = &follow_parent,
544};
545#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */
546
547/* common clocks to spear300 and spear320 */
548#if defined(CONFIG_MACH_SPEAR300) || defined(CONFIG_MACH_SPEAR320)
549/* clcd clock */
550static struct clk clcd_clk = {
551 .flags = ALWAYS_ENABLED,
552 .pclk = &pll3_48m_clk,
553 .recalc = &follow_parent,
554};
555
556/* sdhci clock */
557static struct clk sdhci_clk = {
558 .flags = ALWAYS_ENABLED,
559 .pclk = &ahb_clk,
560 .recalc = &follow_parent,
561};
562#endif /* CONFIG_MACH_SPEAR300 || CONFIG_MACH_SPEAR320 */
563
564/* spear300 machine specific clock structures */
565#ifdef CONFIG_MACH_SPEAR300
566/* gpio1 clock */
567static struct clk gpio1_clk = {
568 .flags = ALWAYS_ENABLED,
569 .pclk = &apb_clk,
570 .recalc = &follow_parent,
571};
572
573/* keyboard clock */
574static struct clk kbd_clk = {
575 .flags = ALWAYS_ENABLED,
576 .pclk = &apb_clk,
577 .recalc = &follow_parent,
578};
579
580#endif
581
582/* spear310 machine specific clock structures */
583#ifdef CONFIG_MACH_SPEAR310
584/* uart3 clock */
585static struct clk uart3_clk = {
586 .flags = ALWAYS_ENABLED,
587 .pclk = &apb_clk,
588 .recalc = &follow_parent,
589};
590
591/* uart4 clock */
592static struct clk uart4_clk = {
593 .flags = ALWAYS_ENABLED,
594 .pclk = &apb_clk,
595 .recalc = &follow_parent,
596};
597
598/* uart5 clock */
599static struct clk uart5_clk = {
600 .flags = ALWAYS_ENABLED,
601 .pclk = &apb_clk,
602 .recalc = &follow_parent,
603};
604#endif
605
606/* spear320 machine specific clock structures */
607#ifdef CONFIG_MACH_SPEAR320
608/* can0 clock */
609static struct clk can0_clk = {
610 .flags = ALWAYS_ENABLED,
611 .pclk = &apb_clk,
612 .recalc = &follow_parent,
613};
614
615/* can1 clock */
616static struct clk can1_clk = {
617 .flags = ALWAYS_ENABLED,
618 .pclk = &apb_clk,
619 .recalc = &follow_parent,
620};
621
622/* i2c1 clock */
623static struct clk i2c1_clk = {
624 .flags = ALWAYS_ENABLED,
625 .pclk = &ahb_clk,
626 .recalc = &follow_parent,
627};
628
629/* ssp1 clock */
630static struct clk ssp1_clk = {
631 .flags = ALWAYS_ENABLED,
632 .pclk = &apb_clk,
633 .recalc = &follow_parent,
634};
635
636/* ssp2 clock */
637static struct clk ssp2_clk = {
638 .flags = ALWAYS_ENABLED,
639 .pclk = &apb_clk,
640 .recalc = &follow_parent,
641};
642
643/* pwm clock */
644static struct clk pwm_clk = {
645 .flags = ALWAYS_ENABLED,
646 .pclk = &apb_clk,
647 .recalc = &follow_parent,
648};
649#endif
650
396/* array of all spear 3xx clock lookups */ 651/* array of all spear 3xx clock lookups */
397static struct clk_lookup spear_clk_lookups[] = { 652static struct clk_lookup spear_clk_lookups[] = {
398 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk}, 653 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk},
@@ -400,7 +655,7 @@ static struct clk_lookup spear_clk_lookups[] = {
400 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 655 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk},
401 { .con_id = "osc_24m_clk", .clk = &osc_24m_clk}, 656 { .con_id = "osc_24m_clk", .clk = &osc_24m_clk},
402 /* clock derived from 32 KHz osc clk */ 657 /* clock derived from 32 KHz osc clk */
403 { .dev_id = "rtc", .clk = &rtc_clk}, 658 { .dev_id = "rtc-spear", .clk = &rtc_clk},
404 /* clock derived from 24 MHz osc clk */ 659 /* clock derived from 24 MHz osc clk */
405 { .con_id = "pll1_clk", .clk = &pll1_clk}, 660 { .con_id = "pll1_clk", .clk = &pll1_clk},
406 { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk}, 661 { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk},
@@ -408,18 +663,22 @@ static struct clk_lookup spear_clk_lookups[] = {
408 /* clock derived from pll1 clk */ 663 /* clock derived from pll1 clk */
409 { .con_id = "cpu_clk", .clk = &cpu_clk}, 664 { .con_id = "cpu_clk", .clk = &cpu_clk},
410 { .con_id = "ahb_clk", .clk = &ahb_clk}, 665 { .con_id = "ahb_clk", .clk = &ahb_clk},
666 { .con_id = "uart_synth_clk", .clk = &uart_synth_clk},
667 { .con_id = "firda_synth_clk", .clk = &firda_synth_clk},
668 { .con_id = "gpt0_synth_clk", .clk = &gpt0_synth_clk},
669 { .con_id = "gpt1_synth_clk", .clk = &gpt1_synth_clk},
670 { .con_id = "gpt2_synth_clk", .clk = &gpt2_synth_clk},
411 { .dev_id = "uart", .clk = &uart_clk}, 671 { .dev_id = "uart", .clk = &uart_clk},
412 { .dev_id = "firda", .clk = &firda_clk}, 672 { .dev_id = "firda", .clk = &firda_clk},
413 { .dev_id = "gpt0", .clk = &gpt0_clk}, 673 { .dev_id = "gpt0", .clk = &gpt0_clk},
414 { .dev_id = "gpt1", .clk = &gpt1_clk}, 674 { .dev_id = "gpt1", .clk = &gpt1_clk},
415 { .dev_id = "gpt2", .clk = &gpt2_clk}, 675 { .dev_id = "gpt2", .clk = &gpt2_clk},
416 /* clock derived from pll3 clk */ 676 /* clock derived from pll3 clk */
417 { .dev_id = "usbh", .clk = &usbh_clk}, 677 { .con_id = "usbh_clk", .clk = &usbh_clk},
418 { .dev_id = "usbd", .clk = &usbd_clk}, 678 { .dev_id = "usbd", .clk = &usbd_clk},
419 { .dev_id = "clcd", .clk = &clcd_clk},
420 /* clock derived from ahb clk */ 679 /* clock derived from ahb clk */
421 { .con_id = "apb_clk", .clk = &apb_clk}, 680 { .con_id = "apb_clk", .clk = &apb_clk},
422 { .dev_id = "i2c", .clk = &i2c_clk}, 681 { .dev_id = "i2c_designware.0", .clk = &i2c_clk},
423 { .dev_id = "dma", .clk = &dma_clk}, 682 { .dev_id = "dma", .clk = &dma_clk},
424 { .dev_id = "jpeg", .clk = &jpeg_clk}, 683 { .dev_id = "jpeg", .clk = &jpeg_clk},
425 { .dev_id = "gmac", .clk = &gmac_clk}, 684 { .dev_id = "gmac", .clk = &gmac_clk},
@@ -427,8 +686,50 @@ static struct clk_lookup spear_clk_lookups[] = {
427 { .dev_id = "c3", .clk = &c3_clk}, 686 { .dev_id = "c3", .clk = &c3_clk},
428 /* clock derived from apb clk */ 687 /* clock derived from apb clk */
429 { .dev_id = "adc", .clk = &adc_clk}, 688 { .dev_id = "adc", .clk = &adc_clk},
430 { .dev_id = "ssp", .clk = &ssp_clk}, 689 { .dev_id = "ssp-pl022.0", .clk = &ssp0_clk},
431 { .dev_id = "gpio", .clk = &gpio_clk}, 690 { .dev_id = "gpio", .clk = &gpio_clk},
691#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
692 { .dev_id = "physmap-flash", .clk = &emi_clk},
693#endif
694#if defined(CONFIG_MACH_SPEAR300) || defined(CONFIG_MACH_SPEAR310) || \
695 defined(CONFIG_MACH_SPEAR320)
696 { .con_id = "fsmc", .clk = &fsmc_clk},
697#endif
698
699/* common clocks to spear310 and spear320 */
700#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
701 { .dev_id = "uart1", .clk = &uart1_clk},
702 { .dev_id = "uart2", .clk = &uart2_clk},
703#endif
704
705 /* common clock to spear300 and spear320 */
706#if defined(CONFIG_MACH_SPEAR300) || defined(CONFIG_MACH_SPEAR320)
707 { .dev_id = "clcd", .clk = &clcd_clk},
708 { .dev_id = "sdhci", .clk = &sdhci_clk},
709#endif /* CONFIG_MACH_SPEAR300 || CONFIG_MACH_SPEAR320 */
710
711 /* spear300 machine specific clock structures */
712#ifdef CONFIG_MACH_SPEAR300
713 { .dev_id = "gpio1", .clk = &gpio1_clk},
714 { .dev_id = "keyboard", .clk = &kbd_clk},
715#endif
716
717 /* spear310 machine specific clock structures */
718#ifdef CONFIG_MACH_SPEAR310
719 { .dev_id = "uart3", .clk = &uart3_clk},
720 { .dev_id = "uart4", .clk = &uart4_clk},
721 { .dev_id = "uart5", .clk = &uart5_clk},
722
723#endif
724 /* spear320 machine specific clock structures */
725#ifdef CONFIG_MACH_SPEAR320
726 { .dev_id = "c_can_platform.0", .clk = &can0_clk},
727 { .dev_id = "c_can_platform.1", .clk = &can1_clk},
728 { .dev_id = "i2c_designware.1", .clk = &i2c1_clk},
729 { .dev_id = "ssp-pl022.1", .clk = &ssp1_clk},
730 { .dev_id = "ssp-pl022.2", .clk = &ssp2_clk},
731 { .dev_id = "pwm", .clk = &pwm_clk},
732#endif
432}; 733};
433 734
434void __init clk_init(void) 735void __init clk_init(void)
diff --git a/arch/arm/mach-spear3xx/include/mach/misc_regs.h b/arch/arm/mach-spear3xx/include/mach/misc_regs.h
index 6c919e1f9c43..0b93347c0f11 100644
--- a/arch/arm/mach-spear3xx/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear3xx/include/mach/misc_regs.h
@@ -63,8 +63,8 @@
63#define GPT1_CLK_SHIFT 11 63#define GPT1_CLK_SHIFT 11
64#define GPT2_CLK_SHIFT 12 64#define GPT2_CLK_SHIFT 12
65#define GPT_CLK_MASK 0x1 65#define GPT_CLK_MASK 0x1
66#define AUX_CLK_PLL3_MASK 0 66#define AUX_CLK_PLL3_VAL 0
67#define AUX_CLK_PLL1_MASK 1 67#define AUX_CLK_PLL1_VAL 1
68 68
69#define PERIP1_CLK_ENB (MISC_BASE + 0x02C) 69#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
70/* PERIP1_CLK_ENB register masks */ 70/* PERIP1_CLK_ENB register masks */
@@ -113,6 +113,7 @@
113#define RAS3_CLK_SYNT (MISC_BASE + 0x074) 113#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
114#define RAS4_CLK_SYNT (MISC_BASE + 0x078) 114#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
115/* aux clk synthesiser register masks for irda to ras4 */ 115/* aux clk synthesiser register masks for irda to ras4 */
116#define AUX_SYNT_ENB 31
116#define AUX_EQ_SEL_SHIFT 30 117#define AUX_EQ_SEL_SHIFT 30
117#define AUX_EQ_SEL_MASK 1 118#define AUX_EQ_SEL_MASK 1
118#define AUX_EQ1_SEL 0 119#define AUX_EQ1_SEL 0