diff options
Diffstat (limited to 'arch/arm/plat-s5pc1xx/s5pc100-clock.c')
-rw-r--r-- | arch/arm/plat-s5pc1xx/s5pc100-clock.c | 770 |
1 files changed, 251 insertions, 519 deletions
diff --git a/arch/arm/plat-s5pc1xx/s5pc100-clock.c b/arch/arm/plat-s5pc1xx/s5pc100-clock.c index b436d44510c8..2bf6c57a96a2 100644 --- a/arch/arm/plat-s5pc1xx/s5pc100-clock.c +++ b/arch/arm/plat-s5pc1xx/s5pc100-clock.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <plat/regs-clock.h> | 30 | #include <plat/regs-clock.h> |
31 | #include <plat/clock.h> | 31 | #include <plat/clock.h> |
32 | #include <plat/clock-clksrc.h> | ||
32 | #include <plat/cpu.h> | 33 | #include <plat/cpu.h> |
33 | #include <plat/pll.h> | 34 | #include <plat/pll.h> |
34 | #include <plat/devs.h> | 35 | #include <plat/devs.h> |
@@ -51,23 +52,6 @@ static struct clk clk_ext_xtal_mux = { | |||
51 | #define clk_fout_mpll clk_mpll | 52 | #define clk_fout_mpll clk_mpll |
52 | #define clk_vclk_54m clk_54m | 53 | #define clk_vclk_54m clk_54m |
53 | 54 | ||
54 | struct clk_sources { | ||
55 | unsigned int nr_sources; | ||
56 | struct clk **sources; | ||
57 | }; | ||
58 | |||
59 | struct clksrc_clk { | ||
60 | struct clk clk; | ||
61 | unsigned int mask; | ||
62 | unsigned int shift; | ||
63 | |||
64 | struct clk_sources *sources; | ||
65 | |||
66 | unsigned int divider_shift; | ||
67 | void __iomem *reg_divider; | ||
68 | void __iomem *reg_source; | ||
69 | }; | ||
70 | |||
71 | /* APLL */ | 55 | /* APLL */ |
72 | static struct clk clk_fout_apll = { | 56 | static struct clk clk_fout_apll = { |
73 | .name = "fout_apll", | 57 | .name = "fout_apll", |
@@ -80,7 +64,7 @@ static struct clk *clk_src_apll_list[] = { | |||
80 | [1] = &clk_fout_apll, | 64 | [1] = &clk_fout_apll, |
81 | }; | 65 | }; |
82 | 66 | ||
83 | static struct clk_sources clk_src_apll = { | 67 | static struct clksrc_sources clk_src_apll = { |
84 | .sources = clk_src_apll_list, | 68 | .sources = clk_src_apll_list, |
85 | .nr_sources = ARRAY_SIZE(clk_src_apll_list), | 69 | .nr_sources = ARRAY_SIZE(clk_src_apll_list), |
86 | }; | 70 | }; |
@@ -90,10 +74,8 @@ static struct clksrc_clk clk_mout_apll = { | |||
90 | .name = "mout_apll", | 74 | .name = "mout_apll", |
91 | .id = -1, | 75 | .id = -1, |
92 | }, | 76 | }, |
93 | .shift = S5PC100_CLKSRC0_APLL_SHIFT, | ||
94 | .mask = S5PC100_CLKSRC0_APLL_MASK, | ||
95 | .sources = &clk_src_apll, | 77 | .sources = &clk_src_apll, |
96 | .reg_source = S5PC100_CLKSRC0, | 78 | .reg_src = { .reg = S5PC100_CLKSRC0, .shift = 0, .size = 1, }, |
97 | }; | 79 | }; |
98 | 80 | ||
99 | static unsigned long s5pc100_clk_dout_apll_get_rate(struct clk *clk) | 81 | static unsigned long s5pc100_clk_dout_apll_get_rate(struct clk *clk) |
@@ -111,7 +93,9 @@ static struct clk clk_dout_apll = { | |||
111 | .name = "dout_apll", | 93 | .name = "dout_apll", |
112 | .id = -1, | 94 | .id = -1, |
113 | .parent = &clk_mout_apll.clk, | 95 | .parent = &clk_mout_apll.clk, |
114 | .get_rate = s5pc100_clk_dout_apll_get_rate, | 96 | .ops = &(struct clk_ops) { |
97 | .get_rate = s5pc100_clk_dout_apll_get_rate, | ||
98 | }, | ||
115 | }; | 99 | }; |
116 | 100 | ||
117 | static unsigned long s5pc100_clk_arm_get_rate(struct clk *clk) | 101 | static unsigned long s5pc100_clk_arm_get_rate(struct clk *clk) |
@@ -165,9 +149,11 @@ static struct clk clk_arm = { | |||
165 | .name = "armclk", | 149 | .name = "armclk", |
166 | .id = -1, | 150 | .id = -1, |
167 | .parent = &clk_dout_apll, | 151 | .parent = &clk_dout_apll, |
168 | .get_rate = s5pc100_clk_arm_get_rate, | 152 | .ops = &(struct clk_ops) { |
169 | .set_rate = s5pc100_clk_arm_set_rate, | 153 | .get_rate = s5pc100_clk_arm_get_rate, |
170 | .round_rate = s5pc100_clk_arm_round_rate, | 154 | .set_rate = s5pc100_clk_arm_set_rate, |
155 | .round_rate = s5pc100_clk_arm_round_rate, | ||
156 | }, | ||
171 | }; | 157 | }; |
172 | 158 | ||
173 | static unsigned long s5pc100_clk_dout_d0_bus_get_rate(struct clk *clk) | 159 | static unsigned long s5pc100_clk_dout_d0_bus_get_rate(struct clk *clk) |
@@ -185,7 +171,9 @@ static struct clk clk_dout_d0_bus = { | |||
185 | .name = "dout_d0_bus", | 171 | .name = "dout_d0_bus", |
186 | .id = -1, | 172 | .id = -1, |
187 | .parent = &clk_arm, | 173 | .parent = &clk_arm, |
188 | .get_rate = s5pc100_clk_dout_d0_bus_get_rate, | 174 | .ops = &(struct clk_ops) { |
175 | .get_rate = s5pc100_clk_dout_d0_bus_get_rate, | ||
176 | }, | ||
189 | }; | 177 | }; |
190 | 178 | ||
191 | static unsigned long s5pc100_clk_dout_pclkd0_get_rate(struct clk *clk) | 179 | static unsigned long s5pc100_clk_dout_pclkd0_get_rate(struct clk *clk) |
@@ -203,7 +191,9 @@ static struct clk clk_dout_pclkd0 = { | |||
203 | .name = "dout_pclkd0", | 191 | .name = "dout_pclkd0", |
204 | .id = -1, | 192 | .id = -1, |
205 | .parent = &clk_dout_d0_bus, | 193 | .parent = &clk_dout_d0_bus, |
206 | .get_rate = s5pc100_clk_dout_pclkd0_get_rate, | 194 | .ops = &(struct clk_ops) { |
195 | .get_rate = s5pc100_clk_dout_pclkd0_get_rate, | ||
196 | }, | ||
207 | }; | 197 | }; |
208 | 198 | ||
209 | static unsigned long s5pc100_clk_dout_apll2_get_rate(struct clk *clk) | 199 | static unsigned long s5pc100_clk_dout_apll2_get_rate(struct clk *clk) |
@@ -221,7 +211,9 @@ static struct clk clk_dout_apll2 = { | |||
221 | .name = "dout_apll2", | 211 | .name = "dout_apll2", |
222 | .id = -1, | 212 | .id = -1, |
223 | .parent = &clk_mout_apll.clk, | 213 | .parent = &clk_mout_apll.clk, |
224 | .get_rate = s5pc100_clk_dout_apll2_get_rate, | 214 | .ops = &(struct clk_ops) { |
215 | .get_rate = s5pc100_clk_dout_apll2_get_rate, | ||
216 | }, | ||
225 | }; | 217 | }; |
226 | 218 | ||
227 | /* MPLL */ | 219 | /* MPLL */ |
@@ -230,7 +222,7 @@ static struct clk *clk_src_mpll_list[] = { | |||
230 | [1] = &clk_fout_mpll, | 222 | [1] = &clk_fout_mpll, |
231 | }; | 223 | }; |
232 | 224 | ||
233 | static struct clk_sources clk_src_mpll = { | 225 | static struct clksrc_sources clk_src_mpll = { |
234 | .sources = clk_src_mpll_list, | 226 | .sources = clk_src_mpll_list, |
235 | .nr_sources = ARRAY_SIZE(clk_src_mpll_list), | 227 | .nr_sources = ARRAY_SIZE(clk_src_mpll_list), |
236 | }; | 228 | }; |
@@ -240,10 +232,8 @@ static struct clksrc_clk clk_mout_mpll = { | |||
240 | .name = "mout_mpll", | 232 | .name = "mout_mpll", |
241 | .id = -1, | 233 | .id = -1, |
242 | }, | 234 | }, |
243 | .shift = S5PC100_CLKSRC0_MPLL_SHIFT, | ||
244 | .mask = S5PC100_CLKSRC0_MPLL_MASK, | ||
245 | .sources = &clk_src_mpll, | 235 | .sources = &clk_src_mpll, |
246 | .reg_source = S5PC100_CLKSRC0, | 236 | .reg_src = { .reg = S5PC100_CLKSRC0, .shift = 4, .size = 1, }, |
247 | }; | 237 | }; |
248 | 238 | ||
249 | static struct clk *clkset_am_list[] = { | 239 | static struct clk *clkset_am_list[] = { |
@@ -251,7 +241,7 @@ static struct clk *clkset_am_list[] = { | |||
251 | [1] = &clk_dout_apll2, | 241 | [1] = &clk_dout_apll2, |
252 | }; | 242 | }; |
253 | 243 | ||
254 | static struct clk_sources clk_src_am = { | 244 | static struct clksrc_sources clk_src_am = { |
255 | .sources = clkset_am_list, | 245 | .sources = clkset_am_list, |
256 | .nr_sources = ARRAY_SIZE(clkset_am_list), | 246 | .nr_sources = ARRAY_SIZE(clkset_am_list), |
257 | }; | 247 | }; |
@@ -261,10 +251,8 @@ static struct clksrc_clk clk_mout_am = { | |||
261 | .name = "mout_am", | 251 | .name = "mout_am", |
262 | .id = -1, | 252 | .id = -1, |
263 | }, | 253 | }, |
264 | .shift = S5PC100_CLKSRC0_AMMUX_SHIFT, | ||
265 | .mask = S5PC100_CLKSRC0_AMMUX_MASK, | ||
266 | .sources = &clk_src_am, | 254 | .sources = &clk_src_am, |
267 | .reg_source = S5PC100_CLKSRC0, | 255 | .reg_src = { .reg = S5PC100_CLKSRC0, .shift = 16, .size = 1, }, |
268 | }; | 256 | }; |
269 | 257 | ||
270 | static unsigned long s5pc100_clk_dout_d1_bus_get_rate(struct clk *clk) | 258 | static unsigned long s5pc100_clk_dout_d1_bus_get_rate(struct clk *clk) |
@@ -284,7 +272,9 @@ static struct clk clk_dout_d1_bus = { | |||
284 | .name = "dout_d1_bus", | 272 | .name = "dout_d1_bus", |
285 | .id = -1, | 273 | .id = -1, |
286 | .parent = &clk_mout_am.clk, | 274 | .parent = &clk_mout_am.clk, |
287 | .get_rate = s5pc100_clk_dout_d1_bus_get_rate, | 275 | .ops = &(struct clk_ops) { |
276 | .get_rate = s5pc100_clk_dout_d1_bus_get_rate, | ||
277 | }, | ||
288 | }; | 278 | }; |
289 | 279 | ||
290 | static struct clk *clkset_onenand_list[] = { | 280 | static struct clk *clkset_onenand_list[] = { |
@@ -292,7 +282,7 @@ static struct clk *clkset_onenand_list[] = { | |||
292 | [1] = &clk_dout_d1_bus, | 282 | [1] = &clk_dout_d1_bus, |
293 | }; | 283 | }; |
294 | 284 | ||
295 | static struct clk_sources clk_src_onenand = { | 285 | static struct clksrc_sources clk_src_onenand = { |
296 | .sources = clkset_onenand_list, | 286 | .sources = clkset_onenand_list, |
297 | .nr_sources = ARRAY_SIZE(clkset_onenand_list), | 287 | .nr_sources = ARRAY_SIZE(clkset_onenand_list), |
298 | }; | 288 | }; |
@@ -302,10 +292,8 @@ static struct clksrc_clk clk_mout_onenand = { | |||
302 | .name = "mout_onenand", | 292 | .name = "mout_onenand", |
303 | .id = -1, | 293 | .id = -1, |
304 | }, | 294 | }, |
305 | .shift = S5PC100_CLKSRC0_ONENAND_SHIFT, | ||
306 | .mask = S5PC100_CLKSRC0_ONENAND_MASK, | ||
307 | .sources = &clk_src_onenand, | 295 | .sources = &clk_src_onenand, |
308 | .reg_source = S5PC100_CLKSRC0, | 296 | .reg_src = { .reg = S5PC100_CLKSRC0, .shift = 24, .size = 1, }, |
309 | }; | 297 | }; |
310 | 298 | ||
311 | static unsigned long s5pc100_clk_dout_pclkd1_get_rate(struct clk *clk) | 299 | static unsigned long s5pc100_clk_dout_pclkd1_get_rate(struct clk *clk) |
@@ -325,7 +313,9 @@ static struct clk clk_dout_pclkd1 = { | |||
325 | .name = "dout_pclkd1", | 313 | .name = "dout_pclkd1", |
326 | .id = -1, | 314 | .id = -1, |
327 | .parent = &clk_dout_d1_bus, | 315 | .parent = &clk_dout_d1_bus, |
328 | .get_rate = s5pc100_clk_dout_pclkd1_get_rate, | 316 | .ops = &(struct clk_ops) { |
317 | .get_rate = s5pc100_clk_dout_pclkd1_get_rate, | ||
318 | }, | ||
329 | }; | 319 | }; |
330 | 320 | ||
331 | static unsigned long s5pc100_clk_dout_mpll2_get_rate(struct clk *clk) | 321 | static unsigned long s5pc100_clk_dout_mpll2_get_rate(struct clk *clk) |
@@ -345,7 +335,9 @@ static struct clk clk_dout_mpll2 = { | |||
345 | .name = "dout_mpll2", | 335 | .name = "dout_mpll2", |
346 | .id = -1, | 336 | .id = -1, |
347 | .parent = &clk_mout_am.clk, | 337 | .parent = &clk_mout_am.clk, |
348 | .get_rate = s5pc100_clk_dout_mpll2_get_rate, | 338 | .ops = &(struct clk_ops) { |
339 | .get_rate = s5pc100_clk_dout_mpll2_get_rate, | ||
340 | }, | ||
349 | }; | 341 | }; |
350 | 342 | ||
351 | static unsigned long s5pc100_clk_dout_cam_get_rate(struct clk *clk) | 343 | static unsigned long s5pc100_clk_dout_cam_get_rate(struct clk *clk) |
@@ -365,7 +357,9 @@ static struct clk clk_dout_cam = { | |||
365 | .name = "dout_cam", | 357 | .name = "dout_cam", |
366 | .id = -1, | 358 | .id = -1, |
367 | .parent = &clk_dout_mpll2, | 359 | .parent = &clk_dout_mpll2, |
368 | .get_rate = s5pc100_clk_dout_cam_get_rate, | 360 | .ops = &(struct clk_ops) { |
361 | .get_rate = s5pc100_clk_dout_cam_get_rate, | ||
362 | }, | ||
369 | }; | 363 | }; |
370 | 364 | ||
371 | static unsigned long s5pc100_clk_dout_mpll_get_rate(struct clk *clk) | 365 | static unsigned long s5pc100_clk_dout_mpll_get_rate(struct clk *clk) |
@@ -385,7 +379,9 @@ static struct clk clk_dout_mpll = { | |||
385 | .name = "dout_mpll", | 379 | .name = "dout_mpll", |
386 | .id = -1, | 380 | .id = -1, |
387 | .parent = &clk_mout_am.clk, | 381 | .parent = &clk_mout_am.clk, |
388 | .get_rate = s5pc100_clk_dout_mpll_get_rate, | 382 | .ops = &(struct clk_ops) { |
383 | .get_rate = s5pc100_clk_dout_mpll_get_rate, | ||
384 | }, | ||
389 | }; | 385 | }; |
390 | 386 | ||
391 | /* EPLL */ | 387 | /* EPLL */ |
@@ -399,7 +395,7 @@ static struct clk *clk_src_epll_list[] = { | |||
399 | [1] = &clk_fout_epll, | 395 | [1] = &clk_fout_epll, |
400 | }; | 396 | }; |
401 | 397 | ||
402 | static struct clk_sources clk_src_epll = { | 398 | static struct clksrc_sources clk_src_epll = { |
403 | .sources = clk_src_epll_list, | 399 | .sources = clk_src_epll_list, |
404 | .nr_sources = ARRAY_SIZE(clk_src_epll_list), | 400 | .nr_sources = ARRAY_SIZE(clk_src_epll_list), |
405 | }; | 401 | }; |
@@ -409,10 +405,8 @@ static struct clksrc_clk clk_mout_epll = { | |||
409 | .name = "mout_epll", | 405 | .name = "mout_epll", |
410 | .id = -1, | 406 | .id = -1, |
411 | }, | 407 | }, |
412 | .shift = S5PC100_CLKSRC0_EPLL_SHIFT, | 408 | .sources = &clk_src_epll, |
413 | .mask = S5PC100_CLKSRC0_EPLL_MASK, | 409 | .reg_src = { .reg = S5PC100_CLKSRC0, .shift = 8, .size = 1, }, |
414 | .sources = &clk_src_epll, | ||
415 | .reg_source = S5PC100_CLKSRC0, | ||
416 | }; | 410 | }; |
417 | 411 | ||
418 | /* HPLL */ | 412 | /* HPLL */ |
@@ -426,7 +420,7 @@ static struct clk *clk_src_hpll_list[] = { | |||
426 | [1] = &clk_fout_hpll, | 420 | [1] = &clk_fout_hpll, |
427 | }; | 421 | }; |
428 | 422 | ||
429 | static struct clk_sources clk_src_hpll = { | 423 | static struct clksrc_sources clk_src_hpll = { |
430 | .sources = clk_src_hpll_list, | 424 | .sources = clk_src_hpll_list, |
431 | .nr_sources = ARRAY_SIZE(clk_src_hpll_list), | 425 | .nr_sources = ARRAY_SIZE(clk_src_hpll_list), |
432 | }; | 426 | }; |
@@ -436,10 +430,8 @@ static struct clksrc_clk clk_mout_hpll = { | |||
436 | .name = "mout_hpll", | 430 | .name = "mout_hpll", |
437 | .id = -1, | 431 | .id = -1, |
438 | }, | 432 | }, |
439 | .shift = S5PC100_CLKSRC0_HPLL_SHIFT, | 433 | .sources = &clk_src_hpll, |
440 | .mask = S5PC100_CLKSRC0_HPLL_MASK, | 434 | .reg_src = { .reg = S5PC100_CLKSRC0, .shift = 12, .size = 1, }, |
441 | .sources = &clk_src_hpll, | ||
442 | .reg_source = S5PC100_CLKSRC0, | ||
443 | }; | 435 | }; |
444 | 436 | ||
445 | /* Peripherals */ | 437 | /* Peripherals */ |
@@ -454,190 +446,6 @@ static struct clksrc_clk clk_mout_hpll = { | |||
454 | * have a common parent divisor so are not included here. | 446 | * have a common parent divisor so are not included here. |
455 | */ | 447 | */ |
456 | 448 | ||
457 | static inline struct clksrc_clk *to_clksrc(struct clk *clk) | ||
458 | { | ||
459 | return container_of(clk, struct clksrc_clk, clk); | ||
460 | } | ||
461 | |||
462 | static unsigned long s5pc100_getrate_clksrc(struct clk *clk) | ||
463 | { | ||
464 | struct clksrc_clk *sclk = to_clksrc(clk); | ||
465 | unsigned long rate = clk_get_rate(clk->parent); | ||
466 | u32 clkdiv = __raw_readl(sclk->reg_divider); | ||
467 | |||
468 | clkdiv >>= sclk->divider_shift; | ||
469 | clkdiv &= 0xf; | ||
470 | clkdiv++; | ||
471 | |||
472 | rate /= clkdiv; | ||
473 | return rate; | ||
474 | } | ||
475 | |||
476 | static int s5pc100_setrate_clksrc(struct clk *clk, unsigned long rate) | ||
477 | { | ||
478 | struct clksrc_clk *sclk = to_clksrc(clk); | ||
479 | void __iomem *reg = sclk->reg_divider; | ||
480 | unsigned int div; | ||
481 | u32 val; | ||
482 | |||
483 | rate = clk_round_rate(clk, rate); | ||
484 | div = clk_get_rate(clk->parent) / rate; | ||
485 | if (div > 16) | ||
486 | return -EINVAL; | ||
487 | |||
488 | val = __raw_readl(reg); | ||
489 | val &= ~(0xf << sclk->divider_shift); | ||
490 | val |= (div - 1) << sclk->divider_shift; | ||
491 | __raw_writel(val, reg); | ||
492 | |||
493 | return 0; | ||
494 | } | ||
495 | |||
496 | static int s5pc100_setparent_clksrc(struct clk *clk, struct clk *parent) | ||
497 | { | ||
498 | struct clksrc_clk *sclk = to_clksrc(clk); | ||
499 | struct clk_sources *srcs = sclk->sources; | ||
500 | u32 clksrc = __raw_readl(sclk->reg_source); | ||
501 | int src_nr = -1; | ||
502 | int ptr; | ||
503 | |||
504 | for (ptr = 0; ptr < srcs->nr_sources; ptr++) | ||
505 | if (srcs->sources[ptr] == parent) { | ||
506 | src_nr = ptr; | ||
507 | break; | ||
508 | } | ||
509 | |||
510 | if (src_nr >= 0) { | ||
511 | clksrc &= ~sclk->mask; | ||
512 | clksrc |= src_nr << sclk->shift; | ||
513 | |||
514 | __raw_writel(clksrc, sclk->reg_source); | ||
515 | return 0; | ||
516 | } | ||
517 | |||
518 | return -EINVAL; | ||
519 | } | ||
520 | |||
521 | static unsigned long s5pc100_roundrate_clksrc(struct clk *clk, | ||
522 | unsigned long rate) | ||
523 | { | ||
524 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
525 | int div; | ||
526 | |||
527 | if (rate > parent_rate) | ||
528 | rate = parent_rate; | ||
529 | else { | ||
530 | div = rate / parent_rate; | ||
531 | |||
532 | if (div == 0) | ||
533 | div = 1; | ||
534 | if (div > 16) | ||
535 | div = 16; | ||
536 | |||
537 | rate = parent_rate / div; | ||
538 | } | ||
539 | |||
540 | return rate; | ||
541 | } | ||
542 | |||
543 | static struct clk *clkset_spi_list[] = { | ||
544 | &clk_mout_epll.clk, | ||
545 | &clk_dout_mpll2, | ||
546 | &clk_fin_epll, | ||
547 | &clk_mout_hpll.clk, | ||
548 | }; | ||
549 | |||
550 | static struct clk_sources clkset_spi = { | ||
551 | .sources = clkset_spi_list, | ||
552 | .nr_sources = ARRAY_SIZE(clkset_spi_list), | ||
553 | }; | ||
554 | |||
555 | static struct clksrc_clk clk_spi0 = { | ||
556 | .clk = { | ||
557 | .name = "spi_bus", | ||
558 | .id = 0, | ||
559 | .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI0, | ||
560 | .enable = s5pc100_sclk0_ctrl, | ||
561 | .set_parent = s5pc100_setparent_clksrc, | ||
562 | .get_rate = s5pc100_getrate_clksrc, | ||
563 | .set_rate = s5pc100_setrate_clksrc, | ||
564 | .round_rate = s5pc100_roundrate_clksrc, | ||
565 | }, | ||
566 | .shift = S5PC100_CLKSRC1_SPI0_SHIFT, | ||
567 | .mask = S5PC100_CLKSRC1_SPI0_MASK, | ||
568 | .sources = &clkset_spi, | ||
569 | .divider_shift = S5PC100_CLKDIV2_SPI0_SHIFT, | ||
570 | .reg_divider = S5PC100_CLKDIV2, | ||
571 | .reg_source = S5PC100_CLKSRC1, | ||
572 | }; | ||
573 | |||
574 | static struct clksrc_clk clk_spi1 = { | ||
575 | .clk = { | ||
576 | .name = "spi_bus", | ||
577 | .id = 1, | ||
578 | .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI1, | ||
579 | .enable = s5pc100_sclk0_ctrl, | ||
580 | .set_parent = s5pc100_setparent_clksrc, | ||
581 | .get_rate = s5pc100_getrate_clksrc, | ||
582 | .set_rate = s5pc100_setrate_clksrc, | ||
583 | .round_rate = s5pc100_roundrate_clksrc, | ||
584 | }, | ||
585 | .shift = S5PC100_CLKSRC1_SPI1_SHIFT, | ||
586 | .mask = S5PC100_CLKSRC1_SPI1_MASK, | ||
587 | .sources = &clkset_spi, | ||
588 | .divider_shift = S5PC100_CLKDIV2_SPI1_SHIFT, | ||
589 | .reg_divider = S5PC100_CLKDIV2, | ||
590 | .reg_source = S5PC100_CLKSRC1, | ||
591 | }; | ||
592 | |||
593 | static struct clksrc_clk clk_spi2 = { | ||
594 | .clk = { | ||
595 | .name = "spi_bus", | ||
596 | .id = 2, | ||
597 | .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI2, | ||
598 | .enable = s5pc100_sclk0_ctrl, | ||
599 | .set_parent = s5pc100_setparent_clksrc, | ||
600 | .get_rate = s5pc100_getrate_clksrc, | ||
601 | .set_rate = s5pc100_setrate_clksrc, | ||
602 | .round_rate = s5pc100_roundrate_clksrc, | ||
603 | }, | ||
604 | .shift = S5PC100_CLKSRC1_SPI2_SHIFT, | ||
605 | .mask = S5PC100_CLKSRC1_SPI2_MASK, | ||
606 | .sources = &clkset_spi, | ||
607 | .divider_shift = S5PC100_CLKDIV2_SPI2_SHIFT, | ||
608 | .reg_divider = S5PC100_CLKDIV2, | ||
609 | .reg_source = S5PC100_CLKSRC1, | ||
610 | }; | ||
611 | |||
612 | static struct clk *clkset_uart_list[] = { | ||
613 | &clk_mout_epll.clk, | ||
614 | &clk_dout_mpll, | ||
615 | }; | ||
616 | |||
617 | static struct clk_sources clkset_uart = { | ||
618 | .sources = clkset_uart_list, | ||
619 | .nr_sources = ARRAY_SIZE(clkset_uart_list), | ||
620 | }; | ||
621 | |||
622 | static struct clksrc_clk clk_uart_uclk1 = { | ||
623 | .clk = { | ||
624 | .name = "uclk1", | ||
625 | .id = -1, | ||
626 | .ctrlbit = S5PC100_CLKGATE_SCLK0_UART, | ||
627 | .enable = s5pc100_sclk0_ctrl, | ||
628 | .set_parent = s5pc100_setparent_clksrc, | ||
629 | .get_rate = s5pc100_getrate_clksrc, | ||
630 | .set_rate = s5pc100_setrate_clksrc, | ||
631 | .round_rate = s5pc100_roundrate_clksrc, | ||
632 | }, | ||
633 | .shift = S5PC100_CLKSRC1_UART_SHIFT, | ||
634 | .mask = S5PC100_CLKSRC1_UART_MASK, | ||
635 | .sources = &clkset_uart, | ||
636 | .divider_shift = S5PC100_CLKDIV2_UART_SHIFT, | ||
637 | .reg_divider = S5PC100_CLKDIV2, | ||
638 | .reg_source = S5PC100_CLKSRC1, | ||
639 | }; | ||
640 | |||
641 | static struct clk clk_iis_cd0 = { | 449 | static struct clk clk_iis_cd0 = { |
642 | .name = "iis_cdclk0", | 450 | .name = "iis_cdclk0", |
643 | .id = -1, | 451 | .id = -1, |
@@ -672,28 +480,31 @@ static struct clk *clkset_audio0_list[] = { | |||
672 | &clk_mout_hpll.clk, | 480 | &clk_mout_hpll.clk, |
673 | }; | 481 | }; |
674 | 482 | ||
675 | static struct clk_sources clkset_audio0 = { | 483 | static struct clksrc_sources clkset_audio0 = { |
676 | .sources = clkset_audio0_list, | 484 | .sources = clkset_audio0_list, |
677 | .nr_sources = ARRAY_SIZE(clkset_audio0_list), | 485 | .nr_sources = ARRAY_SIZE(clkset_audio0_list), |
678 | }; | 486 | }; |
679 | 487 | ||
680 | static struct clksrc_clk clk_audio0 = { | 488 | static struct clk *clkset_spi_list[] = { |
681 | .clk = { | 489 | &clk_mout_epll.clk, |
682 | .name = "audio-bus", | 490 | &clk_dout_mpll2, |
683 | .id = 0, | 491 | &clk_fin_epll, |
684 | .ctrlbit = S5PC100_CLKGATE_SCLK1_AUDIO0, | 492 | &clk_mout_hpll.clk, |
685 | .enable = s5pc100_sclk1_ctrl, | 493 | }; |
686 | .set_parent = s5pc100_setparent_clksrc, | 494 | |
687 | .get_rate = s5pc100_getrate_clksrc, | 495 | static struct clksrc_sources clkset_spi = { |
688 | .set_rate = s5pc100_setrate_clksrc, | 496 | .sources = clkset_spi_list, |
689 | .round_rate = s5pc100_roundrate_clksrc, | 497 | .nr_sources = ARRAY_SIZE(clkset_spi_list), |
690 | }, | 498 | }; |
691 | .shift = S5PC100_CLKSRC3_AUDIO0_SHIFT, | 499 | |
692 | .mask = S5PC100_CLKSRC3_AUDIO0_MASK, | 500 | static struct clk *clkset_uart_list[] = { |
693 | .sources = &clkset_audio0, | 501 | &clk_mout_epll.clk, |
694 | .divider_shift = S5PC100_CLKDIV4_AUDIO0_SHIFT, | 502 | &clk_dout_mpll, |
695 | .reg_divider = S5PC100_CLKDIV4, | 503 | }; |
696 | .reg_source = S5PC100_CLKSRC3, | 504 | |
505 | static struct clksrc_sources clkset_uart = { | ||
506 | .sources = clkset_uart_list, | ||
507 | .nr_sources = ARRAY_SIZE(clkset_uart_list), | ||
697 | }; | 508 | }; |
698 | 509 | ||
699 | static struct clk *clkset_audio1_list[] = { | 510 | static struct clk *clkset_audio1_list[] = { |
@@ -705,30 +516,11 @@ static struct clk *clkset_audio1_list[] = { | |||
705 | &clk_mout_hpll.clk, | 516 | &clk_mout_hpll.clk, |
706 | }; | 517 | }; |
707 | 518 | ||
708 | static struct clk_sources clkset_audio1 = { | 519 | static struct clksrc_sources clkset_audio1 = { |
709 | .sources = clkset_audio1_list, | 520 | .sources = clkset_audio1_list, |
710 | .nr_sources = ARRAY_SIZE(clkset_audio1_list), | 521 | .nr_sources = ARRAY_SIZE(clkset_audio1_list), |
711 | }; | 522 | }; |
712 | 523 | ||
713 | static struct clksrc_clk clk_audio1 = { | ||
714 | .clk = { | ||
715 | .name = "audio-bus", | ||
716 | .id = 1, | ||
717 | .ctrlbit = S5PC100_CLKGATE_SCLK1_AUDIO1, | ||
718 | .enable = s5pc100_sclk1_ctrl, | ||
719 | .set_parent = s5pc100_setparent_clksrc, | ||
720 | .get_rate = s5pc100_getrate_clksrc, | ||
721 | .set_rate = s5pc100_setrate_clksrc, | ||
722 | .round_rate = s5pc100_roundrate_clksrc, | ||
723 | }, | ||
724 | .shift = S5PC100_CLKSRC3_AUDIO1_SHIFT, | ||
725 | .mask = S5PC100_CLKSRC3_AUDIO1_MASK, | ||
726 | .sources = &clkset_audio1, | ||
727 | .divider_shift = S5PC100_CLKDIV4_AUDIO1_SHIFT, | ||
728 | .reg_divider = S5PC100_CLKDIV4, | ||
729 | .reg_source = S5PC100_CLKSRC3, | ||
730 | }; | ||
731 | |||
732 | static struct clk *clkset_audio2_list[] = { | 524 | static struct clk *clkset_audio2_list[] = { |
733 | &clk_mout_epll.clk, | 525 | &clk_mout_epll.clk, |
734 | &clk_dout_mpll, | 526 | &clk_dout_mpll, |
@@ -737,52 +529,56 @@ static struct clk *clkset_audio2_list[] = { | |||
737 | &clk_mout_hpll.clk, | 529 | &clk_mout_hpll.clk, |
738 | }; | 530 | }; |
739 | 531 | ||
740 | static struct clk_sources clkset_audio2 = { | 532 | static struct clksrc_sources clkset_audio2 = { |
741 | .sources = clkset_audio2_list, | 533 | .sources = clkset_audio2_list, |
742 | .nr_sources = ARRAY_SIZE(clkset_audio2_list), | 534 | .nr_sources = ARRAY_SIZE(clkset_audio2_list), |
743 | }; | 535 | }; |
744 | 536 | ||
745 | static struct clksrc_clk clk_audio2 = { | 537 | static struct clksrc_clk clksrc_audio[] = { |
746 | .clk = { | 538 | { |
747 | .name = "audio-bus", | 539 | .clk = { |
748 | .id = 2, | 540 | .name = "audio-bus", |
749 | .ctrlbit = S5PC100_CLKGATE_SCLK1_AUDIO2, | 541 | .id = 0, |
750 | .enable = s5pc100_sclk1_ctrl, | 542 | .ctrlbit = S5PC100_CLKGATE_SCLK1_AUDIO0, |
751 | .set_parent = s5pc100_setparent_clksrc, | 543 | .enable = s5pc100_sclk1_ctrl, |
752 | .get_rate = s5pc100_getrate_clksrc, | 544 | }, |
753 | .set_rate = s5pc100_setrate_clksrc, | 545 | .sources = &clkset_audio0, |
754 | .round_rate = s5pc100_roundrate_clksrc, | 546 | .reg_div = { .reg = S5PC100_CLKDIV4, .shift = 12, .size = 4, }, |
547 | .reg_src = { .reg = S5PC100_CLKSRC3, .shift = 12, .size = 3, }, | ||
548 | }, { | ||
549 | .clk = { | ||
550 | .name = "audio-bus", | ||
551 | .id = 1, | ||
552 | .ctrlbit = S5PC100_CLKGATE_SCLK1_AUDIO1, | ||
553 | .enable = s5pc100_sclk1_ctrl, | ||
554 | }, | ||
555 | .sources = &clkset_audio1, | ||
556 | .reg_div = { .reg = S5PC100_CLKDIV4, .shift = 16, .size = 4, }, | ||
557 | .reg_src = { .reg = S5PC100_CLKSRC3, .shift = 16, .size = 3, }, | ||
558 | }, { | ||
559 | .clk = { | ||
560 | .name = "audio-bus", | ||
561 | .id = 2, | ||
562 | .ctrlbit = S5PC100_CLKGATE_SCLK1_AUDIO2, | ||
563 | .enable = s5pc100_sclk1_ctrl, | ||
564 | }, | ||
565 | .sources = &clkset_audio2, | ||
566 | .reg_div = { .reg = S5PC100_CLKDIV4, .shift = 20, .size = 4, }, | ||
567 | .reg_src = { .reg = S5PC100_CLKSRC3, .shift = 20, .size = 3, }, | ||
755 | }, | 568 | }, |
756 | .shift = S5PC100_CLKSRC3_AUDIO2_SHIFT, | ||
757 | .mask = S5PC100_CLKSRC3_AUDIO2_MASK, | ||
758 | .sources = &clkset_audio2, | ||
759 | .divider_shift = S5PC100_CLKDIV4_AUDIO2_SHIFT, | ||
760 | .reg_divider = S5PC100_CLKDIV4, | ||
761 | .reg_source = S5PC100_CLKSRC3, | ||
762 | }; | 569 | }; |
763 | 570 | ||
764 | static struct clk *clkset_spdif_list[] = { | 571 | static struct clk *clkset_spdif_list[] = { |
765 | &clk_audio0.clk, | 572 | &clksrc_audio[0].clk, |
766 | &clk_audio1.clk, | 573 | &clksrc_audio[1].clk, |
767 | &clk_audio2.clk, | 574 | &clksrc_audio[2].clk, |
768 | }; | 575 | }; |
769 | 576 | ||
770 | static struct clk_sources clkset_spdif = { | 577 | static struct clksrc_sources clkset_spdif = { |
771 | .sources = clkset_spdif_list, | 578 | .sources = clkset_spdif_list, |
772 | .nr_sources = ARRAY_SIZE(clkset_spdif_list), | 579 | .nr_sources = ARRAY_SIZE(clkset_spdif_list), |
773 | }; | 580 | }; |
774 | 581 | ||
775 | static struct clksrc_clk clk_spdif = { | ||
776 | .clk = { | ||
777 | .name = "spdif", | ||
778 | .id = -1, | ||
779 | }, | ||
780 | .shift = S5PC100_CLKSRC3_SPDIF_SHIFT, | ||
781 | .mask = S5PC100_CLKSRC3_SPDIF_MASK, | ||
782 | .sources = &clkset_spdif, | ||
783 | .reg_source = S5PC100_CLKSRC3, | ||
784 | }; | ||
785 | |||
786 | static struct clk *clkset_lcd_fimc_list[] = { | 582 | static struct clk *clkset_lcd_fimc_list[] = { |
787 | &clk_mout_epll.clk, | 583 | &clk_mout_epll.clk, |
788 | &clk_dout_mpll, | 584 | &clk_dout_mpll, |
@@ -790,87 +586,11 @@ static struct clk *clkset_lcd_fimc_list[] = { | |||
790 | &clk_vclk_54m, | 586 | &clk_vclk_54m, |
791 | }; | 587 | }; |
792 | 588 | ||
793 | static struct clk_sources clkset_lcd_fimc = { | 589 | static struct clksrc_sources clkset_lcd_fimc = { |
794 | .sources = clkset_lcd_fimc_list, | 590 | .sources = clkset_lcd_fimc_list, |
795 | .nr_sources = ARRAY_SIZE(clkset_lcd_fimc_list), | 591 | .nr_sources = ARRAY_SIZE(clkset_lcd_fimc_list), |
796 | }; | 592 | }; |
797 | 593 | ||
798 | static struct clksrc_clk clk_lcd = { | ||
799 | .clk = { | ||
800 | .name = "lcd", | ||
801 | .id = -1, | ||
802 | .ctrlbit = S5PC100_CLKGATE_SCLK1_LCD, | ||
803 | .enable = s5pc100_sclk1_ctrl, | ||
804 | .set_parent = s5pc100_setparent_clksrc, | ||
805 | .get_rate = s5pc100_getrate_clksrc, | ||
806 | .set_rate = s5pc100_setrate_clksrc, | ||
807 | .round_rate = s5pc100_roundrate_clksrc, | ||
808 | }, | ||
809 | .shift = S5PC100_CLKSRC2_LCD_SHIFT, | ||
810 | .mask = S5PC100_CLKSRC2_LCD_MASK, | ||
811 | .sources = &clkset_lcd_fimc, | ||
812 | .divider_shift = S5PC100_CLKDIV3_LCD_SHIFT, | ||
813 | .reg_divider = S5PC100_CLKDIV3, | ||
814 | .reg_source = S5PC100_CLKSRC2, | ||
815 | }; | ||
816 | |||
817 | static struct clksrc_clk clk_fimc0 = { | ||
818 | .clk = { | ||
819 | .name = "fimc", | ||
820 | .id = 0, | ||
821 | .ctrlbit = S5PC100_CLKGATE_SCLK1_FIMC0, | ||
822 | .enable = s5pc100_sclk1_ctrl, | ||
823 | .set_parent = s5pc100_setparent_clksrc, | ||
824 | .get_rate = s5pc100_getrate_clksrc, | ||
825 | .set_rate = s5pc100_setrate_clksrc, | ||
826 | .round_rate = s5pc100_roundrate_clksrc, | ||
827 | }, | ||
828 | .shift = S5PC100_CLKSRC2_FIMC0_SHIFT, | ||
829 | .mask = S5PC100_CLKSRC2_FIMC0_MASK, | ||
830 | .sources = &clkset_lcd_fimc, | ||
831 | .divider_shift = S5PC100_CLKDIV3_FIMC0_SHIFT, | ||
832 | .reg_divider = S5PC100_CLKDIV3, | ||
833 | .reg_source = S5PC100_CLKSRC2, | ||
834 | }; | ||
835 | |||
836 | static struct clksrc_clk clk_fimc1 = { | ||
837 | .clk = { | ||
838 | .name = "fimc", | ||
839 | .id = 1, | ||
840 | .ctrlbit = S5PC100_CLKGATE_SCLK1_FIMC1, | ||
841 | .enable = s5pc100_sclk1_ctrl, | ||
842 | .set_parent = s5pc100_setparent_clksrc, | ||
843 | .get_rate = s5pc100_getrate_clksrc, | ||
844 | .set_rate = s5pc100_setrate_clksrc, | ||
845 | .round_rate = s5pc100_roundrate_clksrc, | ||
846 | }, | ||
847 | .shift = S5PC100_CLKSRC2_FIMC1_SHIFT, | ||
848 | .mask = S5PC100_CLKSRC2_FIMC1_MASK, | ||
849 | .sources = &clkset_lcd_fimc, | ||
850 | .divider_shift = S5PC100_CLKDIV3_FIMC1_SHIFT, | ||
851 | .reg_divider = S5PC100_CLKDIV3, | ||
852 | .reg_source = S5PC100_CLKSRC2, | ||
853 | }; | ||
854 | |||
855 | static struct clksrc_clk clk_fimc2 = { | ||
856 | .clk = { | ||
857 | .name = "fimc", | ||
858 | .id = 2, | ||
859 | .ctrlbit = S5PC100_CLKGATE_SCLK1_FIMC2, | ||
860 | .enable = s5pc100_sclk1_ctrl, | ||
861 | .set_parent = s5pc100_setparent_clksrc, | ||
862 | .get_rate = s5pc100_getrate_clksrc, | ||
863 | .set_rate = s5pc100_setrate_clksrc, | ||
864 | .round_rate = s5pc100_roundrate_clksrc, | ||
865 | }, | ||
866 | .shift = S5PC100_CLKSRC2_FIMC2_SHIFT, | ||
867 | .mask = S5PC100_CLKSRC2_FIMC2_MASK, | ||
868 | .sources = &clkset_lcd_fimc, | ||
869 | .divider_shift = S5PC100_CLKDIV3_FIMC2_SHIFT, | ||
870 | .reg_divider = S5PC100_CLKDIV3, | ||
871 | .reg_source = S5PC100_CLKSRC2, | ||
872 | }; | ||
873 | |||
874 | static struct clk *clkset_mmc_list[] = { | 594 | static struct clk *clkset_mmc_list[] = { |
875 | &clk_mout_epll.clk, | 595 | &clk_mout_epll.clk, |
876 | &clk_dout_mpll, | 596 | &clk_dout_mpll, |
@@ -878,69 +598,11 @@ static struct clk *clkset_mmc_list[] = { | |||
878 | &clk_mout_hpll.clk , | 598 | &clk_mout_hpll.clk , |
879 | }; | 599 | }; |
880 | 600 | ||
881 | static struct clk_sources clkset_mmc = { | 601 | static struct clksrc_sources clkset_mmc = { |
882 | .sources = clkset_mmc_list, | 602 | .sources = clkset_mmc_list, |
883 | .nr_sources = ARRAY_SIZE(clkset_mmc_list), | 603 | .nr_sources = ARRAY_SIZE(clkset_mmc_list), |
884 | }; | 604 | }; |
885 | 605 | ||
886 | static struct clksrc_clk clk_mmc0 = { | ||
887 | .clk = { | ||
888 | .name = "mmc_bus", | ||
889 | .id = 0, | ||
890 | .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC0, | ||
891 | .enable = s5pc100_sclk0_ctrl, | ||
892 | .set_parent = s5pc100_setparent_clksrc, | ||
893 | .get_rate = s5pc100_getrate_clksrc, | ||
894 | .set_rate = s5pc100_setrate_clksrc, | ||
895 | .round_rate = s5pc100_roundrate_clksrc, | ||
896 | }, | ||
897 | .shift = S5PC100_CLKSRC2_MMC0_SHIFT, | ||
898 | .mask = S5PC100_CLKSRC2_MMC0_MASK, | ||
899 | .sources = &clkset_mmc, | ||
900 | .divider_shift = S5PC100_CLKDIV3_MMC0_SHIFT, | ||
901 | .reg_divider = S5PC100_CLKDIV3, | ||
902 | .reg_source = S5PC100_CLKSRC2, | ||
903 | }; | ||
904 | |||
905 | static struct clksrc_clk clk_mmc1 = { | ||
906 | .clk = { | ||
907 | .name = "mmc_bus", | ||
908 | .id = 1, | ||
909 | .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC1, | ||
910 | .enable = s5pc100_sclk0_ctrl, | ||
911 | .set_parent = s5pc100_setparent_clksrc, | ||
912 | .get_rate = s5pc100_getrate_clksrc, | ||
913 | .set_rate = s5pc100_setrate_clksrc, | ||
914 | .round_rate = s5pc100_roundrate_clksrc, | ||
915 | }, | ||
916 | .shift = S5PC100_CLKSRC2_MMC1_SHIFT, | ||
917 | .mask = S5PC100_CLKSRC2_MMC1_MASK, | ||
918 | .sources = &clkset_mmc, | ||
919 | .divider_shift = S5PC100_CLKDIV3_MMC1_SHIFT, | ||
920 | .reg_divider = S5PC100_CLKDIV3, | ||
921 | .reg_source = S5PC100_CLKSRC2, | ||
922 | }; | ||
923 | |||
924 | static struct clksrc_clk clk_mmc2 = { | ||
925 | .clk = { | ||
926 | .name = "mmc_bus", | ||
927 | .id = 2, | ||
928 | .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC2, | ||
929 | .enable = s5pc100_sclk0_ctrl, | ||
930 | .set_parent = s5pc100_setparent_clksrc, | ||
931 | .get_rate = s5pc100_getrate_clksrc, | ||
932 | .set_rate = s5pc100_setrate_clksrc, | ||
933 | .round_rate = s5pc100_roundrate_clksrc, | ||
934 | }, | ||
935 | .shift = S5PC100_CLKSRC2_MMC2_SHIFT, | ||
936 | .mask = S5PC100_CLKSRC2_MMC2_MASK, | ||
937 | .sources = &clkset_mmc, | ||
938 | .divider_shift = S5PC100_CLKDIV3_MMC2_SHIFT, | ||
939 | .reg_divider = S5PC100_CLKDIV3, | ||
940 | .reg_source = S5PC100_CLKSRC2, | ||
941 | }; | ||
942 | |||
943 | |||
944 | static struct clk *clkset_usbhost_list[] = { | 606 | static struct clk *clkset_usbhost_list[] = { |
945 | &clk_mout_epll.clk, | 607 | &clk_mout_epll.clk, |
946 | &clk_dout_mpll, | 608 | &clk_dout_mpll, |
@@ -948,28 +610,141 @@ static struct clk *clkset_usbhost_list[] = { | |||
948 | &clk_48m, | 610 | &clk_48m, |
949 | }; | 611 | }; |
950 | 612 | ||
951 | static struct clk_sources clkset_usbhost = { | 613 | static struct clksrc_sources clkset_usbhost = { |
952 | .sources = clkset_usbhost_list, | 614 | .sources = clkset_usbhost_list, |
953 | .nr_sources = ARRAY_SIZE(clkset_usbhost_list), | 615 | .nr_sources = ARRAY_SIZE(clkset_usbhost_list), |
954 | }; | 616 | }; |
955 | 617 | ||
956 | static struct clksrc_clk clk_usbhost = { | 618 | static struct clksrc_clk clksrc_clks[] = { |
957 | .clk = { | 619 | { |
958 | .name = "usbhost", | 620 | .clk = { |
959 | .id = -1, | 621 | .name = "spi_bus", |
960 | .ctrlbit = S5PC100_CLKGATE_SCLK0_USBHOST, | 622 | .id = 0, |
961 | .enable = s5pc100_sclk0_ctrl, | 623 | .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI0, |
962 | .set_parent = s5pc100_setparent_clksrc, | 624 | .enable = s5pc100_sclk0_ctrl, |
963 | .get_rate = s5pc100_getrate_clksrc, | 625 | |
964 | .set_rate = s5pc100_setrate_clksrc, | 626 | }, |
965 | .round_rate = s5pc100_roundrate_clksrc, | 627 | .sources = &clkset_spi, |
966 | }, | 628 | .reg_div = { .reg = S5PC100_CLKDIV2, .shift = 4, .size = 4, }, |
967 | .shift = S5PC100_CLKSRC1_UHOST_SHIFT, | 629 | .reg_src = { .reg = S5PC100_CLKSRC1, .shift = 4, .size = 2, }, |
968 | .mask = S5PC100_CLKSRC1_UHOST_MASK, | 630 | }, { |
969 | .sources = &clkset_usbhost, | 631 | .clk = { |
970 | .divider_shift = S5PC100_CLKDIV2_UHOST_SHIFT, | 632 | .name = "spi_bus", |
971 | .reg_divider = S5PC100_CLKDIV2, | 633 | .id = 1, |
972 | .reg_source = S5PC100_CLKSRC1, | 634 | .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI1, |
635 | .enable = s5pc100_sclk0_ctrl, | ||
636 | }, | ||
637 | .sources = &clkset_spi, | ||
638 | .reg_div = { .reg = S5PC100_CLKDIV2, .shift = 8, .size = 4, }, | ||
639 | .reg_src = { .reg = S5PC100_CLKSRC1, .shift = 8, .size = 2, }, | ||
640 | }, { | ||
641 | .clk = { | ||
642 | .name = "spi_bus", | ||
643 | .id = 2, | ||
644 | .ctrlbit = S5PC100_CLKGATE_SCLK0_SPI2, | ||
645 | .enable = s5pc100_sclk0_ctrl, | ||
646 | }, | ||
647 | .sources = &clkset_spi, | ||
648 | .reg_div = { .reg = S5PC100_CLKDIV2, .shift = 12, .size = 4, }, | ||
649 | .reg_src = { .reg = S5PC100_CLKSRC1, .shift = 12, .size = 2, }, | ||
650 | }, { | ||
651 | .clk = { | ||
652 | .name = "uclk1", | ||
653 | .id = -1, | ||
654 | .ctrlbit = S5PC100_CLKGATE_SCLK0_UART, | ||
655 | .enable = s5pc100_sclk0_ctrl, | ||
656 | }, | ||
657 | .sources = &clkset_uart, | ||
658 | .reg_div = { .reg = S5PC100_CLKDIV2, .shift = 0, .size = 3, }, | ||
659 | .reg_src = { .reg = S5PC100_CLKSRC1, .shift = 0, .size = 1, }, | ||
660 | }, { | ||
661 | .clk = { | ||
662 | .name = "spdif", | ||
663 | .id = -1, | ||
664 | }, | ||
665 | .sources = &clkset_spdif, | ||
666 | .reg_src = { .reg = S5PC100_CLKSRC3, .shift = 24, .size = 2, }, | ||
667 | }, { | ||
668 | .clk = { | ||
669 | .name = "lcd", | ||
670 | .id = -1, | ||
671 | .ctrlbit = S5PC100_CLKGATE_SCLK1_LCD, | ||
672 | .enable = s5pc100_sclk1_ctrl, | ||
673 | }, | ||
674 | .sources = &clkset_lcd_fimc, | ||
675 | .reg_div = { .reg = S5PC100_CLKDIV3, .shift = 12, .size = 4, }, | ||
676 | .reg_src = { .reg = S5PC100_CLKSRC2, .shift = 12, .size = 2, }, | ||
677 | }, { | ||
678 | .clk = { | ||
679 | .name = "fimc", | ||
680 | .id = 0, | ||
681 | .ctrlbit = S5PC100_CLKGATE_SCLK1_FIMC0, | ||
682 | .enable = s5pc100_sclk1_ctrl, | ||
683 | }, | ||
684 | .sources = &clkset_lcd_fimc, | ||
685 | .reg_div = { .reg = S5PC100_CLKDIV3, .shift = 16, .size = 4, }, | ||
686 | .reg_src = { .reg = S5PC100_CLKSRC2, .shift = 16, .size = 2, }, | ||
687 | }, { | ||
688 | .clk = { | ||
689 | .name = "fimc", | ||
690 | .id = 1, | ||
691 | .ctrlbit = S5PC100_CLKGATE_SCLK1_FIMC1, | ||
692 | .enable = s5pc100_sclk1_ctrl, | ||
693 | }, | ||
694 | .sources = &clkset_lcd_fimc, | ||
695 | .reg_div = { .reg = S5PC100_CLKDIV3, .shift = 20, .size = 4, }, | ||
696 | .reg_src = { .reg = S5PC100_CLKSRC2, .shift = 20, .size = 2, }, | ||
697 | }, { | ||
698 | .clk = { | ||
699 | .name = "fimc", | ||
700 | .id = 2, | ||
701 | .ctrlbit = S5PC100_CLKGATE_SCLK1_FIMC2, | ||
702 | .enable = s5pc100_sclk1_ctrl, | ||
703 | }, | ||
704 | .sources = &clkset_lcd_fimc, | ||
705 | .reg_div = { .reg = S5PC100_CLKDIV3, .shift = 24, .size = 4, }, | ||
706 | .reg_src = { .reg = S5PC100_CLKSRC2, .shift = 24, .size = 2, }, | ||
707 | }, { | ||
708 | .clk = { | ||
709 | .name = "mmc_bus", | ||
710 | .id = 0, | ||
711 | .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC0, | ||
712 | .enable = s5pc100_sclk0_ctrl, | ||
713 | }, | ||
714 | .sources = &clkset_mmc, | ||
715 | .reg_div = { .reg = S5PC100_CLKDIV3, .shift = 0, .size = 4, }, | ||
716 | .reg_src = { .reg = S5PC100_CLKSRC2, .shift = 0, .size = 2, }, | ||
717 | }, { | ||
718 | .clk = { | ||
719 | .name = "mmc_bus", | ||
720 | .id = 1, | ||
721 | .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC1, | ||
722 | .enable = s5pc100_sclk0_ctrl, | ||
723 | }, | ||
724 | .sources = &clkset_mmc, | ||
725 | .reg_div = { .reg = S5PC100_CLKDIV3, .shift = 4, .size = 4, }, | ||
726 | .reg_src = { .reg = S5PC100_CLKSRC2, .shift = 4, .size = 2, }, | ||
727 | }, { | ||
728 | .clk = { | ||
729 | .name = "mmc_bus", | ||
730 | .id = 2, | ||
731 | .ctrlbit = S5PC100_CLKGATE_SCLK0_MMC2, | ||
732 | .enable = s5pc100_sclk0_ctrl, | ||
733 | }, | ||
734 | .sources = &clkset_mmc, | ||
735 | .reg_div = { .reg = S5PC100_CLKDIV3, .shift = 8, .size = 4, }, | ||
736 | .reg_src = { .reg = S5PC100_CLKSRC2, .shift = 8, .size = 2, }, | ||
737 | }, { | ||
738 | .clk = { | ||
739 | .name = "usbhost", | ||
740 | .id = -1, | ||
741 | .ctrlbit = S5PC100_CLKGATE_SCLK0_USBHOST, | ||
742 | .enable = s5pc100_sclk0_ctrl, | ||
743 | }, | ||
744 | .sources = &clkset_usbhost, | ||
745 | .reg_div = { .reg = S5PC100_CLKDIV2, .shift = 20, .size = 4, }, | ||
746 | .reg_src = { .reg = S5PC100_CLKSRC1, .shift = 20, .size = 2, }, | ||
747 | } | ||
973 | }; | 748 | }; |
974 | 749 | ||
975 | /* Clock initialisation code */ | 750 | /* Clock initialisation code */ |
@@ -981,45 +756,8 @@ static struct clksrc_clk *init_parents[] = { | |||
981 | &clk_mout_onenand, | 756 | &clk_mout_onenand, |
982 | &clk_mout_epll, | 757 | &clk_mout_epll, |
983 | &clk_mout_hpll, | 758 | &clk_mout_hpll, |
984 | &clk_spi0, | ||
985 | &clk_spi1, | ||
986 | &clk_spi2, | ||
987 | &clk_uart_uclk1, | ||
988 | &clk_audio0, | ||
989 | &clk_audio1, | ||
990 | &clk_audio2, | ||
991 | &clk_spdif, | ||
992 | &clk_lcd, | ||
993 | &clk_fimc0, | ||
994 | &clk_fimc1, | ||
995 | &clk_fimc2, | ||
996 | &clk_mmc0, | ||
997 | &clk_mmc1, | ||
998 | &clk_mmc2, | ||
999 | &clk_usbhost, | ||
1000 | }; | 759 | }; |
1001 | 760 | ||
1002 | static void __init_or_cpufreq s5pc100_set_clksrc(struct clksrc_clk *clk) | ||
1003 | { | ||
1004 | struct clk_sources *srcs = clk->sources; | ||
1005 | u32 clksrc = __raw_readl(clk->reg_source); | ||
1006 | |||
1007 | clksrc &= clk->mask; | ||
1008 | clksrc >>= clk->shift; | ||
1009 | |||
1010 | if (clksrc > srcs->nr_sources || !srcs->sources[clksrc]) { | ||
1011 | printk(KERN_ERR "%s: bad source %d\n", | ||
1012 | clk->clk.name, clksrc); | ||
1013 | return; | ||
1014 | } | ||
1015 | |||
1016 | clk->clk.parent = srcs->sources[clksrc]; | ||
1017 | |||
1018 | printk(KERN_INFO "%s: source is %s (%d), rate is %ld.%03ld MHz\n", | ||
1019 | clk->clk.name, clk->clk.parent->name, clksrc, | ||
1020 | print_mhz(clk_get_rate(&clk->clk))); | ||
1021 | } | ||
1022 | |||
1023 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) | 761 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) |
1024 | 762 | ||
1025 | void __init_or_cpufreq s5pc100_setup_clocks(void) | 763 | void __init_or_cpufreq s5pc100_setup_clocks(void) |
@@ -1083,17 +821,25 @@ void __init_or_cpufreq s5pc100_setup_clocks(void) | |||
1083 | clk_f.rate = armclk; | 821 | clk_f.rate = armclk; |
1084 | 822 | ||
1085 | for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++) | 823 | for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++) |
1086 | s5pc100_set_clksrc(init_parents[ptr]); | 824 | s3c_set_clksrc(init_parents[ptr], true); |
825 | |||
826 | for (ptr = 0; ptr < ARRAY_SIZE(clksrc_audio); ptr++) | ||
827 | s3c_set_clksrc(clksrc_audio + ptr, true); | ||
828 | |||
829 | for (ptr = 0; ptr < ARRAY_SIZE(clksrc_clks); ptr++) | ||
830 | s3c_set_clksrc(clksrc_clks + ptr, true); | ||
1087 | } | 831 | } |
1088 | 832 | ||
1089 | static struct clk *clks[] __initdata = { | 833 | static struct clk *clks[] __initdata = { |
1090 | &clk_ext_xtal_mux, | 834 | &clk_ext_xtal_mux, |
1091 | &clk_mout_apll.clk, | ||
1092 | &clk_dout_apll, | 835 | &clk_dout_apll, |
1093 | &clk_dout_d0_bus, | 836 | &clk_dout_d0_bus, |
1094 | &clk_dout_pclkd0, | 837 | &clk_dout_pclkd0, |
1095 | &clk_dout_apll2, | 838 | &clk_dout_apll2, |
839 | &clk_mout_apll.clk, | ||
1096 | &clk_mout_mpll.clk, | 840 | &clk_mout_mpll.clk, |
841 | &clk_mout_epll.clk, | ||
842 | &clk_mout_hpll.clk, | ||
1097 | &clk_mout_am.clk, | 843 | &clk_mout_am.clk, |
1098 | &clk_dout_d1_bus, | 844 | &clk_dout_d1_bus, |
1099 | &clk_mout_onenand.clk, | 845 | &clk_mout_onenand.clk, |
@@ -1101,29 +847,12 @@ static struct clk *clks[] __initdata = { | |||
1101 | &clk_dout_mpll2, | 847 | &clk_dout_mpll2, |
1102 | &clk_dout_cam, | 848 | &clk_dout_cam, |
1103 | &clk_dout_mpll, | 849 | &clk_dout_mpll, |
1104 | &clk_mout_epll.clk, | ||
1105 | &clk_fout_epll, | 850 | &clk_fout_epll, |
1106 | &clk_iis_cd0, | 851 | &clk_iis_cd0, |
1107 | &clk_iis_cd1, | 852 | &clk_iis_cd1, |
1108 | &clk_iis_cd2, | 853 | &clk_iis_cd2, |
1109 | &clk_pcm_cd0, | 854 | &clk_pcm_cd0, |
1110 | &clk_pcm_cd1, | 855 | &clk_pcm_cd1, |
1111 | &clk_spi0.clk, | ||
1112 | &clk_spi1.clk, | ||
1113 | &clk_spi2.clk, | ||
1114 | &clk_uart_uclk1.clk, | ||
1115 | &clk_audio0.clk, | ||
1116 | &clk_audio1.clk, | ||
1117 | &clk_audio2.clk, | ||
1118 | &clk_spdif.clk, | ||
1119 | &clk_lcd.clk, | ||
1120 | &clk_fimc0.clk, | ||
1121 | &clk_fimc1.clk, | ||
1122 | &clk_fimc2.clk, | ||
1123 | &clk_mmc0.clk, | ||
1124 | &clk_mmc1.clk, | ||
1125 | &clk_mmc2.clk, | ||
1126 | &clk_usbhost.clk, | ||
1127 | &clk_arm, | 856 | &clk_arm, |
1128 | }; | 857 | }; |
1129 | 858 | ||
@@ -1141,4 +870,7 @@ void __init s5pc100_register_clocks(void) | |||
1141 | clkp->name, ret); | 870 | clkp->name, ret); |
1142 | } | 871 | } |
1143 | } | 872 | } |
873 | |||
874 | s3c_register_clksrc(clksrc_audio, ARRAY_SIZE(clksrc_audio)); | ||
875 | s3c_register_clksrc(clksrc_clks, ARRAY_SIZE(clksrc_clks)); | ||
1144 | } | 876 | } |