14 #include <linux/module.h>
15 #include <linux/kernel.h>
16 #include <linux/list.h>
17 #include <linux/errno.h>
20 #include <linux/device.h>
23 #include <mach/hardware.h>
25 #include <mach/regs-clock.h>
29 #include <plat/clock.h>
45 static u32 epll_div[][5] = {
46 { 133000000, 27307, 55, 2, 2 },
47 { 100000000, 43691, 41, 2, 2 },
48 { 480000000, 0, 80, 2, 0 },
51 static int s5p6450_epll_set_rate(
struct clk *
clk,
unsigned long rate)
53 unsigned int epll_con, epll_con_k;
56 if (clk->
rate == rate)
66 if (epll_div[i][0] == rate) {
91 static struct clk_ops s5p6450_epll_ops = {
93 .set_rate = s5p6450_epll_set_rate,
104 static struct clksrc_clk clk_mout_hclk_sel = {
106 .name =
"mout_hclk_sel",
112 static struct clk *clkset_hclk_list[] = {
113 &clk_mout_hclk_sel.
clk,
118 .sources = clkset_hclk_list,
126 .sources = &clkset_hclk,
134 .parent = &clk_hclk.
clk,
138 static struct clksrc_clk clk_dout_pwm_ratio0 = {
140 .name =
"clk_dout_pwm_ratio0",
141 .parent = &clk_mout_hclk_sel.
clk,
146 static struct clksrc_clk clk_pclk_to_wdt_pwm = {
148 .name =
"clk_pclk_to_wdt_pwm",
149 .parent = &clk_dout_pwm_ratio0.
clk,
156 .name =
"clk_hclk_low",
165 .name =
"clk_pclk_low",
166 .parent = &clk_hclk_low.
clk,
176 static struct clk init_clocks_off[] = {
179 .parent = &clk_hclk_low.
clk,
184 .devname =
"dma-pl330",
185 .parent = &clk_hclk_low.
clk,
187 .ctrlbit = (1 << 12),
190 .devname =
"s3c-sdhci.0",
191 .parent = &clk_hclk_low.
clk,
193 .ctrlbit = (1 << 17),
196 .devname =
"s3c-sdhci.1",
197 .parent = &clk_hclk_low.
clk,
199 .ctrlbit = (1 << 18),
202 .devname =
"s3c-sdhci.2",
203 .parent = &clk_hclk_low.
clk,
205 .ctrlbit = (1 << 19),
208 .parent = &clk_hclk_low.
clk,
210 .ctrlbit = (1 << 20),
218 .parent = &clk_pclk_low.
clk,
223 .parent = &clk_pclk_low.
clk,
228 .parent = &clk_pclk_low.
clk,
230 .ctrlbit = (1 << 12),
233 .devname =
"s3c2440-i2c.0",
234 .parent = &clk_pclk_low.
clk,
236 .ctrlbit = (1 << 17),
239 .devname =
"s5p64x0-spi.0",
240 .parent = &clk_pclk_low.
clk,
242 .ctrlbit = (1 << 21),
245 .devname =
"s5p64x0-spi.1",
246 .parent = &clk_pclk_low.
clk,
248 .ctrlbit = (1 << 22),
251 .devname =
"samsung-i2s.0",
252 .parent = &clk_pclk_low.
clk,
254 .ctrlbit = (1 << 26),
257 .devname =
"samsung-i2s.1",
258 .parent = &clk_pclk_low.
clk,
260 .ctrlbit = (1 << 15),
263 .devname =
"samsung-i2s.2",
264 .parent = &clk_pclk_low.
clk,
266 .ctrlbit = (1 << 16),
269 .devname =
"s3c2440-i2c.1",
270 .parent = &clk_pclk_low.
clk,
272 .ctrlbit = (1 << 27),
275 .parent = &clk_pclk.
clk,
277 .ctrlbit = (1 << 30),
284 static struct clk init_clocks[] = {
287 .parent = &clk_hclk.
clk,
292 .parent = &clk_hclk.
clk,
294 .ctrlbit = (1 << 21),
297 .devname =
"s3c6400-uart.0",
298 .parent = &clk_pclk_low.
clk,
303 .devname =
"s3c6400-uart.1",
304 .parent = &clk_pclk_low.
clk,
309 .devname =
"s3c6400-uart.2",
310 .parent = &clk_pclk_low.
clk,
315 .devname =
"s3c6400-uart.3",
316 .parent = &clk_pclk_low.
clk,
321 .parent = &clk_pclk_to_wdt_pwm.
clk,
326 .parent = &clk_pclk_low.
clk,
328 .ctrlbit = (1 << 18),
332 static struct clk *clkset_uart_list[] = {
338 .sources = clkset_uart_list,
342 static struct clk *clkset_mali_list[] = {
349 .sources = clkset_mali_list,
353 static struct clk *clkset_group2_list[] = {
360 .sources = clkset_group2_list,
364 static struct clk *clkset_dispcon_list[] = {
372 .sources = clkset_dispcon_list,
373 .nr_sources =
ARRAY_SIZE(clkset_dispcon_list),
376 static struct clk *clkset_hsmmc44_list[] = {
385 .sources = clkset_hsmmc44_list,
386 .nr_sources =
ARRAY_SIZE(clkset_hsmmc44_list),
389 static struct clk *clkset_sclk_audio0_list[] = {
390 [0] = &clk_dout_epll.
clk,
398 .sources = clkset_sclk_audio0_list,
399 .nr_sources =
ARRAY_SIZE(clkset_sclk_audio0_list),
407 .parent = &clk_dout_epll.
clk,
409 .sources = &clkset_sclk_audio0,
418 .ctrlbit = (1 << 10),
436 .ctrlbit = (1 << 12),
453 .name =
"sclk_camif",
462 .name =
"sclk_dispcon",
471 .name =
"sclk_hsmmc44",
472 .ctrlbit = (1 << 30),
484 .devname =
"s3c-sdhci.0",
485 .ctrlbit = (1 << 24),
496 .devname =
"s3c-sdhci.1",
497 .ctrlbit = (1 << 25),
508 .devname =
"s3c-sdhci.2",
509 .ctrlbit = (1 << 26),
531 .devname =
"s5p64x0-spi.0",
532 .ctrlbit = (1 << 20),
543 .devname =
"s5p64x0-spi.1",
544 .ctrlbit = (1 << 21),
561 static struct clk_lookup s5p6450_clk_lookup[] = {
581 &clk_dout_pwm_ratio0,
582 &clk_pclk_to_wdt_pwm,
590 static struct clk dummy_apb_pclk = {
597 struct clk *xtal_clk;
602 unsigned long hclk_low;
604 unsigned long pclk_low;
637 printk(
KERN_INFO "S5P6450: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
638 " E=%ld.%ldMHz, D=%ld.%ldMHz\n",
649 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
657 for (ptr = 0; ptr <
ARRAY_SIZE(clksrcs); ptr++)
665 for (ptr = 0; ptr <
ARRAY_SIZE(sysclks); ptr++)
670 for (ptr = 0; ptr <
ARRAY_SIZE(clksrc_cdev); ptr++)