diff options
Diffstat (limited to 'arch/arm/mach-s5pv310/clock.c')
-rw-r--r-- | arch/arm/mach-s5pv310/clock.c | 77 |
1 files changed, 55 insertions, 22 deletions
diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c index 58c9d33f36fe..fc7c2f8d165e 100644 --- a/arch/arm/mach-s5pv310/clock.c +++ b/arch/arm/mach-s5pv310/clock.c | |||
@@ -244,7 +244,7 @@ static struct clksrc_clk clk_mout_corebus = { | |||
244 | .id = -1, | 244 | .id = -1, |
245 | }, | 245 | }, |
246 | .sources = &clkset_mout_corebus, | 246 | .sources = &clkset_mout_corebus, |
247 | .reg_src = { .reg = S5P_CLKSRC_CORE, .shift = 4, .size = 1 }, | 247 | .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 }, |
248 | }; | 248 | }; |
249 | 249 | ||
250 | static struct clksrc_clk clk_sclk_dmc = { | 250 | static struct clksrc_clk clk_sclk_dmc = { |
@@ -253,7 +253,7 @@ static struct clksrc_clk clk_sclk_dmc = { | |||
253 | .id = -1, | 253 | .id = -1, |
254 | .parent = &clk_mout_corebus.clk, | 254 | .parent = &clk_mout_corebus.clk, |
255 | }, | 255 | }, |
256 | .reg_div = { .reg = S5P_CLKDIV_CORE0, .shift = 12, .size = 3 }, | 256 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 }, |
257 | }; | 257 | }; |
258 | 258 | ||
259 | static struct clksrc_clk clk_aclk_cored = { | 259 | static struct clksrc_clk clk_aclk_cored = { |
@@ -262,7 +262,7 @@ static struct clksrc_clk clk_aclk_cored = { | |||
262 | .id = -1, | 262 | .id = -1, |
263 | .parent = &clk_sclk_dmc.clk, | 263 | .parent = &clk_sclk_dmc.clk, |
264 | }, | 264 | }, |
265 | .reg_div = { .reg = S5P_CLKDIV_CORE0, .shift = 16, .size = 3 }, | 265 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 }, |
266 | }; | 266 | }; |
267 | 267 | ||
268 | static struct clksrc_clk clk_aclk_corep = { | 268 | static struct clksrc_clk clk_aclk_corep = { |
@@ -271,7 +271,7 @@ static struct clksrc_clk clk_aclk_corep = { | |||
271 | .id = -1, | 271 | .id = -1, |
272 | .parent = &clk_aclk_cored.clk, | 272 | .parent = &clk_aclk_cored.clk, |
273 | }, | 273 | }, |
274 | .reg_div = { .reg = S5P_CLKDIV_CORE0, .shift = 20, .size = 3 }, | 274 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 }, |
275 | }; | 275 | }; |
276 | 276 | ||
277 | static struct clksrc_clk clk_aclk_acp = { | 277 | static struct clksrc_clk clk_aclk_acp = { |
@@ -280,7 +280,7 @@ static struct clksrc_clk clk_aclk_acp = { | |||
280 | .id = -1, | 280 | .id = -1, |
281 | .parent = &clk_mout_corebus.clk, | 281 | .parent = &clk_mout_corebus.clk, |
282 | }, | 282 | }, |
283 | .reg_div = { .reg = S5P_CLKDIV_CORE0, .shift = 0, .size = 3 }, | 283 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 }, |
284 | }; | 284 | }; |
285 | 285 | ||
286 | static struct clksrc_clk clk_pclk_acp = { | 286 | static struct clksrc_clk clk_pclk_acp = { |
@@ -289,7 +289,7 @@ static struct clksrc_clk clk_pclk_acp = { | |||
289 | .id = -1, | 289 | .id = -1, |
290 | .parent = &clk_aclk_acp.clk, | 290 | .parent = &clk_aclk_acp.clk, |
291 | }, | 291 | }, |
292 | .reg_div = { .reg = S5P_CLKDIV_CORE0, .shift = 4, .size = 3 }, | 292 | .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 }, |
293 | }; | 293 | }; |
294 | 294 | ||
295 | /* Core list of CMU_TOP side */ | 295 | /* Core list of CMU_TOP side */ |
@@ -384,7 +384,7 @@ static struct clksrc_clk clk_sclk_vpll = { | |||
384 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 }, | 384 | .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 }, |
385 | }; | 385 | }; |
386 | 386 | ||
387 | static struct clk init_clocks_disable[] = { | 387 | static struct clk init_clocks_off[] = { |
388 | { | 388 | { |
389 | .name = "timers", | 389 | .name = "timers", |
390 | .id = -1, | 390 | .id = -1, |
@@ -467,6 +467,16 @@ static struct clk init_clocks_disable[] = { | |||
467 | .enable = s5pv310_clk_ip_fsys_ctrl, | 467 | .enable = s5pv310_clk_ip_fsys_ctrl, |
468 | .ctrlbit = (1 << 10), | 468 | .ctrlbit = (1 << 10), |
469 | }, { | 469 | }, { |
470 | .name = "pdma", | ||
471 | .id = 0, | ||
472 | .enable = s5pv310_clk_ip_fsys_ctrl, | ||
473 | .ctrlbit = (1 << 0), | ||
474 | }, { | ||
475 | .name = "pdma", | ||
476 | .id = 1, | ||
477 | .enable = s5pv310_clk_ip_fsys_ctrl, | ||
478 | .ctrlbit = (1 << 1), | ||
479 | }, { | ||
470 | .name = "adc", | 480 | .name = "adc", |
471 | .id = -1, | 481 | .id = -1, |
472 | .enable = s5pv310_clk_ip_peril_ctrl, | 482 | .enable = s5pv310_clk_ip_peril_ctrl, |
@@ -507,6 +517,26 @@ static struct clk init_clocks_disable[] = { | |||
507 | .enable = s5pv310_clk_ip_peril_ctrl, | 517 | .enable = s5pv310_clk_ip_peril_ctrl, |
508 | .ctrlbit = (1 << 18), | 518 | .ctrlbit = (1 << 18), |
509 | }, { | 519 | }, { |
520 | .name = "iis", | ||
521 | .id = 0, | ||
522 | .enable = s5pv310_clk_ip_peril_ctrl, | ||
523 | .ctrlbit = (1 << 19), | ||
524 | }, { | ||
525 | .name = "iis", | ||
526 | .id = 1, | ||
527 | .enable = s5pv310_clk_ip_peril_ctrl, | ||
528 | .ctrlbit = (1 << 20), | ||
529 | }, { | ||
530 | .name = "iis", | ||
531 | .id = 2, | ||
532 | .enable = s5pv310_clk_ip_peril_ctrl, | ||
533 | .ctrlbit = (1 << 21), | ||
534 | }, { | ||
535 | .name = "ac97", | ||
536 | .id = -1, | ||
537 | .enable = s5pv310_clk_ip_peril_ctrl, | ||
538 | .ctrlbit = (1 << 27), | ||
539 | }, { | ||
510 | .name = "fimg2d", | 540 | .name = "fimg2d", |
511 | .id = -1, | 541 | .id = -1, |
512 | .enable = s5pv310_clk_ip_image_ctrl, | 542 | .enable = s5pv310_clk_ip_image_ctrl, |
@@ -990,6 +1020,17 @@ static struct clksrc_clk *sysclks[] = { | |||
990 | &clk_dout_mmc4, | 1020 | &clk_dout_mmc4, |
991 | }; | 1021 | }; |
992 | 1022 | ||
1023 | static int xtal_rate; | ||
1024 | |||
1025 | static unsigned long s5pv310_fout_apll_get_rate(struct clk *clk) | ||
1026 | { | ||
1027 | return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0), pll_4508); | ||
1028 | } | ||
1029 | |||
1030 | static struct clk_ops s5pv310_fout_apll_ops = { | ||
1031 | .get_rate = s5pv310_fout_apll_get_rate, | ||
1032 | }; | ||
1033 | |||
993 | void __init_or_cpufreq s5pv310_setup_clocks(void) | 1034 | void __init_or_cpufreq s5pv310_setup_clocks(void) |
994 | { | 1035 | { |
995 | struct clk *xtal_clk; | 1036 | struct clk *xtal_clk; |
@@ -1013,6 +1054,9 @@ void __init_or_cpufreq s5pv310_setup_clocks(void) | |||
1013 | BUG_ON(IS_ERR(xtal_clk)); | 1054 | BUG_ON(IS_ERR(xtal_clk)); |
1014 | 1055 | ||
1015 | xtal = clk_get_rate(xtal_clk); | 1056 | xtal = clk_get_rate(xtal_clk); |
1057 | |||
1058 | xtal_rate = xtal; | ||
1059 | |||
1016 | clk_put(xtal_clk); | 1060 | clk_put(xtal_clk); |
1017 | 1061 | ||
1018 | printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); | 1062 | printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); |
@@ -1026,7 +1070,7 @@ void __init_or_cpufreq s5pv310_setup_clocks(void) | |||
1026 | vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), | 1070 | vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), |
1027 | __raw_readl(S5P_VPLL_CON1), pll_4650); | 1071 | __raw_readl(S5P_VPLL_CON1), pll_4650); |
1028 | 1072 | ||
1029 | clk_fout_apll.rate = apll; | 1073 | clk_fout_apll.ops = &s5pv310_fout_apll_ops; |
1030 | clk_fout_mpll.rate = mpll; | 1074 | clk_fout_mpll.rate = mpll; |
1031 | clk_fout_epll.rate = epll; | 1075 | clk_fout_epll.rate = epll; |
1032 | clk_fout_vpll.rate = vpll; | 1076 | clk_fout_vpll.rate = vpll; |
@@ -1061,13 +1105,9 @@ static struct clk *clks[] __initdata = { | |||
1061 | 1105 | ||
1062 | void __init s5pv310_register_clocks(void) | 1106 | void __init s5pv310_register_clocks(void) |
1063 | { | 1107 | { |
1064 | struct clk *clkp; | ||
1065 | int ret; | ||
1066 | int ptr; | 1108 | int ptr; |
1067 | 1109 | ||
1068 | ret = s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); | 1110 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); |
1069 | if (ret > 0) | ||
1070 | printk(KERN_ERR "Failed to register %u clocks\n", ret); | ||
1071 | 1111 | ||
1072 | for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) | 1112 | for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) |
1073 | s3c_register_clksrc(sysclks[ptr], 1); | 1113 | s3c_register_clksrc(sysclks[ptr], 1); |
@@ -1075,15 +1115,8 @@ void __init s5pv310_register_clocks(void) | |||
1075 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | 1115 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); |
1076 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); | 1116 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); |
1077 | 1117 | ||
1078 | clkp = init_clocks_disable; | 1118 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
1079 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { | 1119 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); |
1080 | ret = s3c24xx_register_clock(clkp); | ||
1081 | if (ret < 0) { | ||
1082 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
1083 | clkp->name, ret); | ||
1084 | } | ||
1085 | (clkp->enable)(clkp, 0); | ||
1086 | } | ||
1087 | 1120 | ||
1088 | s3c_pwmclk_init(); | 1121 | s3c_pwmclk_init(); |
1089 | } | 1122 | } |