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>
37 static u32 epll_div[][5] = {
38 { 36000000, 0, 48, 1, 4 },
39 { 48000000, 0, 32, 1, 3 },
40 { 60000000, 0, 40, 1, 3 },
41 { 72000000, 0, 48, 1, 3 },
42 { 84000000, 0, 28, 1, 2 },
43 { 96000000, 0, 32, 1, 2 },
44 { 32768000, 45264, 43, 1, 4 },
45 { 45158000, 6903, 30, 1, 3 },
46 { 49152000, 50332, 32, 1, 3 },
47 { 67738000, 10398, 45, 1, 3 },
48 { 73728000, 9961, 49, 1, 3 }
51 static int s5p6440_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 s5p6440_epll_ops = {
93 .set_rate = s5p6440_epll_set_rate,
107 .parent = &clk_hclk.
clk,
113 .name =
"clk_hclk_low",
122 .name =
"clk_pclk_low",
123 .parent = &clk_hclk_low.
clk,
133 static struct clk init_clocks_off[] = {
136 .parent = &clk_hclk.
clk,
141 .parent = &clk_hclk_low.
clk,
146 .parent = &clk_hclk.
clk,
151 .devname =
"dma-pl330",
152 .parent = &clk_hclk_low.
clk,
154 .ctrlbit = (1 << 12),
157 .devname =
"s3c-sdhci.0",
158 .parent = &clk_hclk_low.
clk,
160 .ctrlbit = (1 << 17),
163 .devname =
"s3c-sdhci.1",
164 .parent = &clk_hclk_low.
clk,
166 .ctrlbit = (1 << 18),
169 .devname =
"s3c-sdhci.2",
170 .parent = &clk_hclk_low.
clk,
172 .ctrlbit = (1 << 19),
175 .parent = &clk_hclk_low.
clk,
180 .parent = &clk_hclk.
clk,
182 .ctrlbit = (1 << 25),
185 .parent = &clk_hclk_low.
clk,
189 .name =
"hclk_fimgvg",
190 .parent = &clk_hclk.
clk,
195 .parent = &clk_hclk_low.
clk,
200 .parent = &clk_pclk_low.
clk,
205 .parent = &clk_pclk_low.
clk,
210 .parent = &clk_pclk_low.
clk,
215 .parent = &clk_pclk_low.
clk,
220 .parent = &clk_pclk_low.
clk,
222 .ctrlbit = (1 << 12),
225 .parent = &clk_pclk_low.
clk,
227 .ctrlbit = (1 << 17),
230 .devname =
"s5p64x0-spi.0",
231 .parent = &clk_pclk_low.
clk,
233 .ctrlbit = (1 << 21),
236 .devname =
"s5p64x0-spi.1",
237 .parent = &clk_pclk_low.
clk,
239 .ctrlbit = (1 << 22),
242 .parent = &clk_pclk_low.
clk,
244 .ctrlbit = (1 << 25),
247 .devname =
"samsung-i2s.0",
248 .parent = &clk_pclk_low.
clk,
250 .ctrlbit = (1 << 26),
253 .parent = &clk_pclk_low.
clk,
255 .ctrlbit = (1 << 28),
258 .parent = &clk_pclk.
clk,
260 .ctrlbit = (1 << 29),
263 .parent = &clk_pclk.
clk,
265 .ctrlbit = (1 << 30),
267 .name =
"pclk_fimgvg",
268 .parent = &clk_pclk.
clk,
270 .ctrlbit = (1 << 31),
273 .devname =
"s3c-sdhci.0",
276 .ctrlbit = (1 << 27),
279 .devname =
"s3c-sdhci.1",
282 .ctrlbit = (1 << 28),
285 .devname =
"s3c-sdhci.2",
288 .ctrlbit = (1 << 29),
295 static struct clk init_clocks[] = {
298 .parent = &clk_hclk.
clk,
303 .parent = &clk_hclk.
clk,
305 .ctrlbit = (1 << 21),
308 .devname =
"s3c6400-uart.0",
309 .parent = &clk_pclk_low.
clk,
314 .devname =
"s3c6400-uart.1",
315 .parent = &clk_pclk_low.
clk,
320 .devname =
"s3c6400-uart.2",
321 .parent = &clk_pclk_low.
clk,
326 .devname =
"s3c6400-uart.3",
327 .parent = &clk_pclk_low.
clk,
332 .parent = &clk_pclk_low.
clk,
334 .ctrlbit = (1 << 18),
338 static struct clk clk_iis_cd_v40 = {
339 .name =
"iis_cdclk_v40",
342 static struct clk clk_pcm_cd = {
346 static struct clk *clkset_group1_list[] = {
353 .sources = clkset_group1_list,
357 static struct clk *clkset_uart_list[] = {
363 .sources = clkset_uart_list,
367 static struct clk *clkset_audio_list[] = {
376 .sources = clkset_audio_list,
384 .ctrlbit = (1 << 10),
392 .name =
"sclk_dispcon",
401 .name =
"sclk_fimgvg",
410 .name =
"sclk_audio2",
411 .ctrlbit = (1 << 11),
423 .devname =
"s3c-sdhci.0",
424 .ctrlbit = (1 << 24),
435 .devname =
"s3c-sdhci.1",
436 .ctrlbit = (1 << 25),
447 .devname =
"s3c-sdhci.2",
448 .ctrlbit = (1 << 26),
470 .devname =
"s5p64x0-spi.0",
471 .ctrlbit = (1 << 20),
482 .devname =
"s5p64x0-spi.1",
483 .ctrlbit = (1 << 21),
504 static struct clk dummy_apb_pclk = {
518 static struct clk_lookup s5p6440_clk_lookup[] = {
531 struct clk *xtal_clk;
536 unsigned long hclk_low;
538 unsigned long pclk_low;
567 printk(
KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \
578 " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n",
586 for (ptr = 0; ptr <
ARRAY_SIZE(clksrcs); ptr++)
602 for (ptr = 0; ptr <
ARRAY_SIZE(sysclks); ptr++)
607 for (ptr = 0; ptr <
ARRAY_SIZE(clksrc_cdev); ptr++)