12 #include <linux/kernel.h>
18 #include <plat/clock.h>
26 #include <mach/regs-clock.h>
32 #ifdef CONFIG_PM_SLEEP
33 static struct sleep_save exynos4_clock_save[] = {
98 static struct clk exynos4_clk_sclk_hdmi27m = {
99 .name =
"sclk_hdmi27m",
103 static struct clk exynos4_clk_sclk_hdmiphy = {
104 .name =
"sclk_hdmiphy",
107 static struct clk exynos4_clk_sclk_usbphy0 = {
108 .name =
"sclk_usbphy0",
112 static struct clk exynos4_clk_sclk_usbphy1 = {
113 .name =
"sclk_usbphy1",
116 static struct clk dummy_apb_pclk = {
121 static int exynos4_clksrc_mask_top_ctrl(
struct clk *
clk,
int enable)
126 static int exynos4_clksrc_mask_cam_ctrl(
struct clk *
clk,
int enable)
131 static int exynos4_clksrc_mask_lcd0_ctrl(
struct clk *
clk,
int enable)
141 static int exynos4_clksrc_mask_peril0_ctrl(
struct clk *
clk,
int enable)
146 static int exynos4_clksrc_mask_peril1_ctrl(
struct clk *
clk,
int enable)
151 static int exynos4_clk_ip_mfc_ctrl(
struct clk *
clk,
int enable)
156 static int exynos4_clksrc_mask_tv_ctrl(
struct clk *
clk,
int enable)
161 static int exynos4_clk_ip_cam_ctrl(
struct clk *
clk,
int enable)
166 static int exynos4_clk_ip_tv_ctrl(
struct clk *
clk,
int enable)
176 static int exynos4_clk_ip_lcd0_ctrl(
struct clk *
clk,
int enable)
191 static int exynos4_clk_ip_peril_ctrl(
struct clk *
clk,
int enable)
196 static int exynos4_clk_ip_perir_ctrl(
struct clk *
clk,
int enable)
206 static int exynos4_clk_hdmiphy_ctrl(
struct clk *
clk,
int enable)
211 static int exynos4_clk_dac_ctrl(
struct clk *
clk,
int enable)
218 static struct clksrc_clk exynos4_clk_mout_apll = {
226 static struct clksrc_clk exynos4_clk_sclk_apll = {
229 .parent = &exynos4_clk_mout_apll.
clk,
234 static struct clksrc_clk exynos4_clk_mout_epll = {
251 static struct clk *exynos4_clkset_moutcore_list[] = {
252 [0] = &exynos4_clk_mout_apll.
clk,
253 [1] = &exynos4_clk_mout_mpll.
clk,
257 .sources = exynos4_clkset_moutcore_list,
258 .nr_sources =
ARRAY_SIZE(exynos4_clkset_moutcore_list),
261 static struct clksrc_clk exynos4_clk_moutcore = {
265 .sources = &exynos4_clkset_moutcore,
269 static struct clksrc_clk exynos4_clk_coreclk = {
272 .parent = &exynos4_clk_moutcore.
clk,
277 static struct clksrc_clk exynos4_clk_armclk = {
280 .parent = &exynos4_clk_coreclk.
clk,
284 static struct clksrc_clk exynos4_clk_aclk_corem0 = {
286 .name =
"aclk_corem0",
287 .parent = &exynos4_clk_coreclk.
clk,
292 static struct clksrc_clk exynos4_clk_aclk_cores = {
294 .name =
"aclk_cores",
295 .parent = &exynos4_clk_coreclk.
clk,
300 static struct clksrc_clk exynos4_clk_aclk_corem1 = {
302 .name =
"aclk_corem1",
303 .parent = &exynos4_clk_coreclk.
clk,
308 static struct clksrc_clk exynos4_clk_periphclk = {
311 .parent = &exynos4_clk_coreclk.
clk,
318 static struct clk *exynos4_clkset_corebus_list[] = {
319 [0] = &exynos4_clk_mout_mpll.
clk,
320 [1] = &exynos4_clk_sclk_apll.
clk,
324 .sources = exynos4_clkset_corebus_list,
325 .nr_sources =
ARRAY_SIZE(exynos4_clkset_corebus_list),
328 static struct clksrc_clk exynos4_clk_mout_corebus = {
330 .name =
"mout_corebus",
336 static struct clksrc_clk exynos4_clk_sclk_dmc = {
339 .parent = &exynos4_clk_mout_corebus.
clk,
344 static struct clksrc_clk exynos4_clk_aclk_cored = {
346 .name =
"aclk_cored",
347 .parent = &exynos4_clk_sclk_dmc.
clk,
352 static struct clksrc_clk exynos4_clk_aclk_corep = {
354 .name =
"aclk_corep",
355 .parent = &exynos4_clk_aclk_cored.
clk,
360 static struct clksrc_clk exynos4_clk_aclk_acp = {
363 .parent = &exynos4_clk_mout_corebus.
clk,
368 static struct clksrc_clk exynos4_clk_pclk_acp = {
371 .parent = &exynos4_clk_aclk_acp.
clk,
379 [0] = &exynos4_clk_mout_mpll.
clk,
380 [1] = &exynos4_clk_sclk_apll.
clk,
385 .nr_sources =
ARRAY_SIZE(exynos4_clkset_aclk_top_list),
388 static struct clksrc_clk exynos4_clk_aclk_200 = {
392 .sources = &exynos4_clkset_aclk,
397 static struct clksrc_clk exynos4_clk_aclk_100 = {
401 .sources = &exynos4_clkset_aclk,
406 static struct clksrc_clk exynos4_clk_aclk_160 = {
410 .sources = &exynos4_clkset_aclk,
419 .sources = &exynos4_clkset_aclk,
424 static struct clk *exynos4_clkset_vpllsrc_list[] = {
426 [1] = &exynos4_clk_sclk_hdmi27m,
430 .sources = exynos4_clkset_vpllsrc_list,
431 .nr_sources =
ARRAY_SIZE(exynos4_clkset_vpllsrc_list),
434 static struct clksrc_clk exynos4_clk_vpllsrc = {
437 .enable = exynos4_clksrc_mask_top_ctrl,
440 .
sources = &exynos4_clkset_vpllsrc,
444 static struct clk *exynos4_clkset_sclk_vpll_list[] = {
445 [0] = &exynos4_clk_vpllsrc.
clk,
450 .sources = exynos4_clkset_sclk_vpll_list,
451 .nr_sources =
ARRAY_SIZE(exynos4_clkset_sclk_vpll_list),
454 static struct clksrc_clk exynos4_clk_sclk_vpll = {
458 .sources = &exynos4_clkset_sclk_vpll,
462 static struct clk exynos4_init_clocks_off[] = {
465 .parent = &exynos4_clk_aclk_100.
clk,
466 .enable = exynos4_clk_ip_peril_ctrl,
470 .devname =
"s5p-mipi-csis.0",
471 .enable = exynos4_clk_ip_cam_ctrl,
475 .devname =
"s5p-mipi-csis.1",
476 .enable = exynos4_clk_ip_cam_ctrl,
481 .enable = exynos4_clk_ip_cam_ctrl,
485 .devname =
"exynos4-fimc.0",
486 .enable = exynos4_clk_ip_cam_ctrl,
490 .devname =
"exynos4-fimc.1",
491 .enable = exynos4_clk_ip_cam_ctrl,
495 .devname =
"exynos4-fimc.2",
496 .enable = exynos4_clk_ip_cam_ctrl,
500 .devname =
"exynos4-fimc.3",
501 .enable = exynos4_clk_ip_cam_ctrl,
509 .devname =
"exynos4-sdhci.0",
510 .parent = &exynos4_clk_aclk_133.
clk,
515 .devname =
"exynos4-sdhci.1",
516 .parent = &exynos4_clk_aclk_133.
clk,
521 .devname =
"exynos4-sdhci.2",
522 .parent = &exynos4_clk_aclk_133.
clk,
527 .devname =
"exynos4-sdhci.3",
528 .parent = &exynos4_clk_aclk_133.
clk,
533 .parent = &exynos4_clk_aclk_133.
clk,
539 .ctrlbit = (1 << 15),
543 .ctrlbit = (1 << 16),
546 .devname =
"s5p-sdo",
547 .enable = exynos4_clk_ip_tv_ctrl,
551 .devname =
"s5p-mixer",
552 .enable = exynos4_clk_ip_tv_ctrl,
556 .devname =
"s5p-mixer",
557 .enable = exynos4_clk_ip_tv_ctrl,
561 .devname =
"exynos4-hdmi",
562 .enable = exynos4_clk_ip_tv_ctrl,
566 .devname =
"exynos4-hdmi",
567 .enable = exynos4_clk_hdmiphy_ctrl,
571 .devname =
"s5p-sdo",
572 .enable = exynos4_clk_dac_ctrl,
576 .enable = exynos4_clk_ip_peril_ctrl,
577 .ctrlbit = (1 << 15),
580 .enable = exynos4_clk_ip_perir_ctrl,
581 .ctrlbit = (1 << 16),
584 .enable = exynos4_clk_ip_perir_ctrl,
585 .ctrlbit = (1 << 15),
588 .parent = &exynos4_clk_aclk_100.
clk,
589 .enable = exynos4_clk_ip_perir_ctrl,
590 .ctrlbit = (1 << 14),
594 .ctrlbit = (1 << 12),
598 .ctrlbit = (1 << 13),
601 .devname =
"exynos4210-spi.0",
602 .enable = exynos4_clk_ip_peril_ctrl,
603 .ctrlbit = (1 << 16),
606 .devname =
"exynos4210-spi.1",
607 .enable = exynos4_clk_ip_peril_ctrl,
608 .ctrlbit = (1 << 17),
611 .devname =
"exynos4210-spi.2",
612 .enable = exynos4_clk_ip_peril_ctrl,
613 .ctrlbit = (1 << 18),
616 .devname =
"samsung-i2s.0",
617 .enable = exynos4_clk_ip_peril_ctrl,
618 .ctrlbit = (1 << 19),
621 .devname =
"samsung-i2s.1",
622 .enable = exynos4_clk_ip_peril_ctrl,
623 .ctrlbit = (1 << 20),
626 .devname =
"samsung-i2s.2",
627 .enable = exynos4_clk_ip_peril_ctrl,
628 .ctrlbit = (1 << 21),
631 .devname =
"samsung-pcm.1",
632 .enable = exynos4_clk_ip_peril_ctrl,
633 .ctrlbit = (1 << 22),
636 .devname =
"samsung-pcm.2",
637 .enable = exynos4_clk_ip_peril_ctrl,
638 .ctrlbit = (1 << 23),
641 .enable = exynos4_clk_ip_peril_ctrl,
642 .ctrlbit = (1 << 25),
645 .devname =
"samsung-spdif",
646 .enable = exynos4_clk_ip_peril_ctrl,
647 .ctrlbit = (1 << 26),
650 .devname =
"samsung-ac97",
651 .enable = exynos4_clk_ip_peril_ctrl,
652 .ctrlbit = (1 << 27),
655 .devname =
"s5p-mfc",
656 .enable = exynos4_clk_ip_mfc_ctrl,
660 .devname =
"s3c2440-i2c.0",
661 .parent = &exynos4_clk_aclk_100.
clk,
662 .enable = exynos4_clk_ip_peril_ctrl,
666 .devname =
"s3c2440-i2c.1",
667 .parent = &exynos4_clk_aclk_100.
clk,
668 .enable = exynos4_clk_ip_peril_ctrl,
672 .devname =
"s3c2440-i2c.2",
673 .parent = &exynos4_clk_aclk_100.
clk,
674 .enable = exynos4_clk_ip_peril_ctrl,
678 .devname =
"s3c2440-i2c.3",
679 .parent = &exynos4_clk_aclk_100.
clk,
680 .enable = exynos4_clk_ip_peril_ctrl,
684 .devname =
"s3c2440-i2c.4",
685 .parent = &exynos4_clk_aclk_100.
clk,
686 .enable = exynos4_clk_ip_peril_ctrl,
687 .ctrlbit = (1 << 10),
690 .devname =
"s3c2440-i2c.5",
691 .parent = &exynos4_clk_aclk_100.
clk,
692 .enable = exynos4_clk_ip_peril_ctrl,
693 .ctrlbit = (1 << 11),
696 .devname =
"s3c2440-i2c.6",
697 .parent = &exynos4_clk_aclk_100.
clk,
698 .enable = exynos4_clk_ip_peril_ctrl,
699 .ctrlbit = (1 << 12),
702 .devname =
"s3c2440-i2c.7",
703 .parent = &exynos4_clk_aclk_100.
clk,
704 .enable = exynos4_clk_ip_peril_ctrl,
705 .ctrlbit = (1 << 13),
708 .devname =
"s3c2440-hdmiphy-i2c",
709 .parent = &exynos4_clk_aclk_100.
clk,
710 .enable = exynos4_clk_ip_peril_ctrl,
711 .ctrlbit = (1 << 14),
715 .enable = exynos4_clk_ip_mfc_ctrl,
720 .enable = exynos4_clk_ip_mfc_ctrl,
725 .enable = exynos4_clk_ip_tv_ctrl,
730 .enable = exynos4_clk_ip_cam_ctrl,
731 .ctrlbit = (1 << 11),
740 .enable = exynos4_clk_ip_cam_ctrl,
745 .enable = exynos4_clk_ip_cam_ctrl,
750 .enable = exynos4_clk_ip_cam_ctrl,
755 .enable = exynos4_clk_ip_cam_ctrl,
756 .ctrlbit = (1 << 10),
760 .enable = exynos4_clk_ip_lcd0_ctrl,
765 static struct clk exynos4_init_clocks_on[] = {
768 .devname =
"s5pv210-uart.0",
769 .enable = exynos4_clk_ip_peril_ctrl,
773 .devname =
"s5pv210-uart.1",
774 .enable = exynos4_clk_ip_peril_ctrl,
778 .devname =
"s5pv210-uart.2",
779 .enable = exynos4_clk_ip_peril_ctrl,
783 .devname =
"s5pv210-uart.3",
784 .enable = exynos4_clk_ip_peril_ctrl,
788 .devname =
"s5pv210-uart.4",
789 .enable = exynos4_clk_ip_peril_ctrl,
793 .devname =
"s5pv210-uart.5",
794 .enable = exynos4_clk_ip_peril_ctrl,
799 static struct clk exynos4_clk_pdma0 = {
801 .devname =
"dma-pl330.0",
806 static struct clk exynos4_clk_pdma1 = {
808 .devname =
"dma-pl330.1",
813 static struct clk exynos4_clk_mdma1 = {
815 .devname =
"dma-pl330.2",
817 .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)),
820 static struct clk exynos4_clk_fimd0 = {
822 .devname =
"exynos4-fb.0",
823 .enable = exynos4_clk_ip_lcd0_ctrl,
830 [2] = &exynos4_clk_sclk_hdmi27m,
831 [3] = &exynos4_clk_sclk_usbphy0,
832 [4] = &exynos4_clk_sclk_usbphy1,
833 [5] = &exynos4_clk_sclk_hdmiphy,
834 [6] = &exynos4_clk_mout_mpll.
clk,
835 [7] = &exynos4_clk_mout_epll.
clk,
836 [8] = &exynos4_clk_sclk_vpll.
clk,
841 .nr_sources =
ARRAY_SIZE(exynos4_clkset_group_list),
844 static struct clk *exynos4_clkset_mout_g2d0_list[] = {
845 [0] = &exynos4_clk_mout_mpll.
clk,
846 [1] = &exynos4_clk_sclk_apll.
clk,
850 .sources = exynos4_clkset_mout_g2d0_list,
851 .nr_sources =
ARRAY_SIZE(exynos4_clkset_mout_g2d0_list),
854 static struct clk *exynos4_clkset_mout_g2d1_list[] = {
855 [0] = &exynos4_clk_mout_epll.
clk,
856 [1] = &exynos4_clk_sclk_vpll.
clk,
860 .sources = exynos4_clkset_mout_g2d1_list,
861 .nr_sources =
ARRAY_SIZE(exynos4_clkset_mout_g2d1_list),
864 static struct clk *exynos4_clkset_mout_mfc0_list[] = {
865 [0] = &exynos4_clk_mout_mpll.
clk,
866 [1] = &exynos4_clk_sclk_apll.
clk,
870 .sources = exynos4_clkset_mout_mfc0_list,
871 .nr_sources =
ARRAY_SIZE(exynos4_clkset_mout_mfc0_list),
874 static struct clksrc_clk exynos4_clk_mout_mfc0 = {
878 .sources = &exynos4_clkset_mout_mfc0,
882 static struct clk *exynos4_clkset_mout_mfc1_list[] = {
883 [0] = &exynos4_clk_mout_epll.
clk,
884 [1] = &exynos4_clk_sclk_vpll.
clk,
888 .sources = exynos4_clkset_mout_mfc1_list,
889 .nr_sources =
ARRAY_SIZE(exynos4_clkset_mout_mfc1_list),
892 static struct clksrc_clk exynos4_clk_mout_mfc1 = {
896 .sources = &exynos4_clkset_mout_mfc1,
900 static struct clk *exynos4_clkset_mout_mfc_list[] = {
901 [0] = &exynos4_clk_mout_mfc0.
clk,
902 [1] = &exynos4_clk_mout_mfc1.
clk,
906 .sources = exynos4_clkset_mout_mfc_list,
907 .nr_sources =
ARRAY_SIZE(exynos4_clkset_mout_mfc_list),
910 static struct clk *exynos4_clkset_sclk_dac_list[] = {
911 [0] = &exynos4_clk_sclk_vpll.
clk,
912 [1] = &exynos4_clk_sclk_hdmiphy,
916 .sources = exynos4_clkset_sclk_dac_list,
917 .nr_sources =
ARRAY_SIZE(exynos4_clkset_sclk_dac_list),
920 static struct clksrc_clk exynos4_clk_sclk_dac = {
923 .enable = exynos4_clksrc_mask_tv_ctrl,
926 .
sources = &exynos4_clkset_sclk_dac,
930 static struct clksrc_clk exynos4_clk_sclk_pixel = {
932 .name =
"sclk_pixel",
933 .parent = &exynos4_clk_sclk_vpll.
clk,
938 static struct clk *exynos4_clkset_sclk_hdmi_list[] = {
939 [0] = &exynos4_clk_sclk_pixel.
clk,
940 [1] = &exynos4_clk_sclk_hdmiphy,
944 .sources = exynos4_clkset_sclk_hdmi_list,
945 .nr_sources =
ARRAY_SIZE(exynos4_clkset_sclk_hdmi_list),
948 static struct clksrc_clk exynos4_clk_sclk_hdmi = {
951 .enable = exynos4_clksrc_mask_tv_ctrl,
954 .
sources = &exynos4_clkset_sclk_hdmi,
958 static struct clk *exynos4_clkset_sclk_mixer_list[] = {
959 [0] = &exynos4_clk_sclk_dac.
clk,
960 [1] = &exynos4_clk_sclk_hdmi.
clk,
964 .sources = exynos4_clkset_sclk_mixer_list,
965 .nr_sources =
ARRAY_SIZE(exynos4_clkset_sclk_mixer_list),
968 static struct clksrc_clk exynos4_clk_sclk_mixer = {
970 .name =
"sclk_mixer",
971 .enable = exynos4_clksrc_mask_tv_ctrl,
974 .
sources = &exynos4_clkset_sclk_mixer,
978 static struct clksrc_clk *exynos4_sclk_tv[] = {
979 &exynos4_clk_sclk_dac,
980 &exynos4_clk_sclk_pixel,
981 &exynos4_clk_sclk_hdmi,
982 &exynos4_clk_sclk_mixer,
985 static struct clksrc_clk exynos4_clk_dout_mmc0 = {
994 static struct clksrc_clk exynos4_clk_dout_mmc1 = {
1003 static struct clksrc_clk exynos4_clk_dout_mmc2 = {
1005 .name =
"dout_mmc2",
1012 static struct clksrc_clk exynos4_clk_dout_mmc3 = {
1014 .name =
"dout_mmc3",
1021 static struct clksrc_clk exynos4_clk_dout_mmc4 = {
1023 .name =
"dout_mmc4",
1030 static struct clksrc_clk exynos4_clksrcs[] = {
1034 .enable = exynos4_clksrc_mask_peril0_ctrl,
1035 .ctrlbit = (1 << 24),
1037 .
sources = &exynos4_clkset_group,
1042 .name =
"sclk_csis",
1043 .devname =
"s5p-mipi-csis.0",
1044 .enable = exynos4_clksrc_mask_cam_ctrl,
1045 .ctrlbit = (1 << 24),
1047 .
sources = &exynos4_clkset_group,
1052 .name =
"sclk_csis",
1053 .devname =
"s5p-mipi-csis.1",
1054 .enable = exynos4_clksrc_mask_cam_ctrl,
1055 .ctrlbit = (1 << 28),
1057 .
sources = &exynos4_clkset_group,
1062 .name =
"sclk_cam0",
1063 .enable = exynos4_clksrc_mask_cam_ctrl,
1064 .ctrlbit = (1 << 16),
1066 .
sources = &exynos4_clkset_group,
1071 .name =
"sclk_cam1",
1072 .enable = exynos4_clksrc_mask_cam_ctrl,
1073 .ctrlbit = (1 << 20),
1075 .
sources = &exynos4_clkset_group,
1080 .name =
"sclk_fimc",
1081 .devname =
"exynos4-fimc.0",
1082 .enable = exynos4_clksrc_mask_cam_ctrl,
1083 .ctrlbit = (1 << 0),
1085 .
sources = &exynos4_clkset_group,
1090 .name =
"sclk_fimc",
1091 .devname =
"exynos4-fimc.1",
1092 .enable = exynos4_clksrc_mask_cam_ctrl,
1093 .ctrlbit = (1 << 4),
1095 .
sources = &exynos4_clkset_group,
1100 .name =
"sclk_fimc",
1101 .devname =
"exynos4-fimc.2",
1102 .enable = exynos4_clksrc_mask_cam_ctrl,
1103 .ctrlbit = (1 << 8),
1105 .
sources = &exynos4_clkset_group,
1110 .name =
"sclk_fimc",
1111 .devname =
"exynos4-fimc.3",
1112 .enable = exynos4_clksrc_mask_cam_ctrl,
1113 .ctrlbit = (1 << 12),
1115 .
sources = &exynos4_clkset_group,
1120 .name =
"sclk_fimd",
1121 .devname =
"exynos4-fb.0",
1122 .enable = exynos4_clksrc_mask_lcd0_ctrl,
1123 .ctrlbit = (1 << 0),
1125 .
sources = &exynos4_clkset_group,
1131 .devname =
"s5p-mfc",
1133 .sources = &exynos4_clkset_mout_mfc,
1138 .name =
"sclk_dwmmc",
1139 .parent = &exynos4_clk_dout_mmc4.
clk,
1141 .ctrlbit = (1 << 16),
1147 static struct clksrc_clk exynos4_clk_sclk_uart0 = {
1150 .devname =
"exynos4210-uart.0",
1151 .enable = exynos4_clksrc_mask_peril0_ctrl,
1152 .ctrlbit = (1 << 0),
1154 .
sources = &exynos4_clkset_group,
1159 static struct clksrc_clk exynos4_clk_sclk_uart1 = {
1162 .devname =
"exynos4210-uart.1",
1163 .enable = exynos4_clksrc_mask_peril0_ctrl,
1164 .ctrlbit = (1 << 4),
1166 .
sources = &exynos4_clkset_group,
1171 static struct clksrc_clk exynos4_clk_sclk_uart2 = {
1174 .devname =
"exynos4210-uart.2",
1175 .enable = exynos4_clksrc_mask_peril0_ctrl,
1176 .ctrlbit = (1 << 8),
1178 .
sources = &exynos4_clkset_group,
1183 static struct clksrc_clk exynos4_clk_sclk_uart3 = {
1186 .devname =
"exynos4210-uart.3",
1187 .enable = exynos4_clksrc_mask_peril0_ctrl,
1188 .ctrlbit = (1 << 12),
1190 .
sources = &exynos4_clkset_group,
1195 static struct clksrc_clk exynos4_clk_sclk_mmc0 = {
1198 .devname =
"exynos4-sdhci.0",
1199 .parent = &exynos4_clk_dout_mmc0.
clk,
1201 .ctrlbit = (1 << 0),
1206 static struct clksrc_clk exynos4_clk_sclk_mmc1 = {
1209 .devname =
"exynos4-sdhci.1",
1210 .parent = &exynos4_clk_dout_mmc1.
clk,
1212 .ctrlbit = (1 << 4),
1217 static struct clksrc_clk exynos4_clk_sclk_mmc2 = {
1220 .devname =
"exynos4-sdhci.2",
1221 .parent = &exynos4_clk_dout_mmc2.
clk,
1223 .ctrlbit = (1 << 8),
1228 static struct clksrc_clk exynos4_clk_sclk_mmc3 = {
1231 .devname =
"exynos4-sdhci.3",
1232 .parent = &exynos4_clk_dout_mmc3.
clk,
1234 .ctrlbit = (1 << 12),
1239 static struct clksrc_clk exynos4_clk_mdout_spi0 = {
1241 .name =
"mdout_spi",
1242 .devname =
"exynos4210-spi.0",
1249 static struct clksrc_clk exynos4_clk_mdout_spi1 = {
1251 .name =
"mdout_spi",
1252 .devname =
"exynos4210-spi.1",
1259 static struct clksrc_clk exynos4_clk_mdout_spi2 = {
1261 .name =
"mdout_spi",
1262 .devname =
"exynos4210-spi.2",
1269 static struct clksrc_clk exynos4_clk_sclk_spi0 = {
1272 .devname =
"exynos4210-spi.0",
1273 .parent = &exynos4_clk_mdout_spi0.
clk,
1274 .enable = exynos4_clksrc_mask_peril1_ctrl,
1275 .ctrlbit = (1 << 16),
1280 static struct clksrc_clk exynos4_clk_sclk_spi1 = {
1283 .devname =
"exynos4210-spi.1",
1284 .parent = &exynos4_clk_mdout_spi1.
clk,
1285 .enable = exynos4_clksrc_mask_peril1_ctrl,
1286 .ctrlbit = (1 << 20),
1291 static struct clksrc_clk exynos4_clk_sclk_spi2 = {
1294 .devname =
"exynos4210-spi.2",
1295 .parent = &exynos4_clk_mdout_spi2.
clk,
1296 .enable = exynos4_clksrc_mask_peril1_ctrl,
1297 .ctrlbit = (1 << 24),
1303 static struct clksrc_clk *exynos4_sysclks[] = {
1304 &exynos4_clk_mout_apll,
1305 &exynos4_clk_sclk_apll,
1306 &exynos4_clk_mout_epll,
1308 &exynos4_clk_moutcore,
1309 &exynos4_clk_coreclk,
1310 &exynos4_clk_armclk,
1311 &exynos4_clk_aclk_corem0,
1312 &exynos4_clk_aclk_cores,
1313 &exynos4_clk_aclk_corem1,
1314 &exynos4_clk_periphclk,
1315 &exynos4_clk_mout_corebus,
1316 &exynos4_clk_sclk_dmc,
1317 &exynos4_clk_aclk_cored,
1318 &exynos4_clk_aclk_corep,
1319 &exynos4_clk_aclk_acp,
1320 &exynos4_clk_pclk_acp,
1321 &exynos4_clk_vpllsrc,
1322 &exynos4_clk_sclk_vpll,
1323 &exynos4_clk_aclk_200,
1324 &exynos4_clk_aclk_100,
1325 &exynos4_clk_aclk_160,
1327 &exynos4_clk_dout_mmc0,
1328 &exynos4_clk_dout_mmc1,
1329 &exynos4_clk_dout_mmc2,
1330 &exynos4_clk_dout_mmc3,
1331 &exynos4_clk_dout_mmc4,
1332 &exynos4_clk_mout_mfc0,
1333 &exynos4_clk_mout_mfc1,
1336 static struct clk *exynos4_clk_cdev[] = {
1343 static struct clksrc_clk *exynos4_clksrc_cdev[] = {
1344 &exynos4_clk_sclk_uart0,
1345 &exynos4_clk_sclk_uart1,
1346 &exynos4_clk_sclk_uart2,
1347 &exynos4_clk_sclk_uart3,
1348 &exynos4_clk_sclk_mmc0,
1349 &exynos4_clk_sclk_mmc1,
1350 &exynos4_clk_sclk_mmc2,
1351 &exynos4_clk_sclk_mmc3,
1352 &exynos4_clk_sclk_spi0,
1353 &exynos4_clk_sclk_spi1,
1354 &exynos4_clk_sclk_spi2,
1355 &exynos4_clk_mdout_spi0,
1356 &exynos4_clk_mdout_spi1,
1357 &exynos4_clk_mdout_spi2,
1360 static struct clk_lookup exynos4_clk_lookup[] = {
1361 CLKDEV_INIT(
"exynos4210-uart.0",
"clk_uart_baud0", &exynos4_clk_sclk_uart0.
clk),
1362 CLKDEV_INIT(
"exynos4210-uart.1",
"clk_uart_baud0", &exynos4_clk_sclk_uart1.
clk),
1363 CLKDEV_INIT(
"exynos4210-uart.2",
"clk_uart_baud0", &exynos4_clk_sclk_uart2.
clk),
1364 CLKDEV_INIT(
"exynos4210-uart.3",
"clk_uart_baud0", &exynos4_clk_sclk_uart3.
clk),
1365 CLKDEV_INIT(
"exynos4-sdhci.0",
"mmc_busclk.2", &exynos4_clk_sclk_mmc0.
clk),
1366 CLKDEV_INIT(
"exynos4-sdhci.1",
"mmc_busclk.2", &exynos4_clk_sclk_mmc1.
clk),
1367 CLKDEV_INIT(
"exynos4-sdhci.2",
"mmc_busclk.2", &exynos4_clk_sclk_mmc2.
clk),
1368 CLKDEV_INIT(
"exynos4-sdhci.3",
"mmc_busclk.2", &exynos4_clk_sclk_mmc3.
clk),
1369 CLKDEV_INIT(
"exynos4-fb.0",
"lcd", &exynos4_clk_fimd0),
1370 CLKDEV_INIT(
"dma-pl330.0",
"apb_pclk", &exynos4_clk_pdma0),
1371 CLKDEV_INIT(
"dma-pl330.1",
"apb_pclk", &exynos4_clk_pdma1),
1372 CLKDEV_INIT(
"dma-pl330.2",
"apb_pclk", &exynos4_clk_mdma1),
1373 CLKDEV_INIT(
"exynos4210-spi.0",
"spi_busclk0", &exynos4_clk_sclk_spi0.
clk),
1374 CLKDEV_INIT(
"exynos4210-spi.1",
"spi_busclk0", &exynos4_clk_sclk_spi1.
clk),
1375 CLKDEV_INIT(
"exynos4210-spi.2",
"spi_busclk0", &exynos4_clk_sclk_spi2.
clk),
1378 static int xtal_rate;
1380 static unsigned long exynos4_fout_apll_get_rate(
struct clk *
clk)
1391 static struct clk_ops exynos4_fout_apll_ops = {
1392 .get_rate = exynos4_fout_apll_get_rate,
1395 static u32 exynos4_vpll_div[][8] = {
1396 { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
1397 { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
1400 static unsigned long exynos4_vpll_get_rate(
struct clk *clk)
1405 static int exynos4_vpll_set_rate(
struct clk *clk,
unsigned long rate)
1407 unsigned int vpll_con0, vpll_con1 = 0;
1411 if (clk->
rate == rate)
1415 vpll_con0 &= ~(0x1 << 27 | \
1425 for (i = 0; i <
ARRAY_SIZE(exynos4_vpll_div); i++) {
1426 if (exynos4_vpll_div[i][0] == rate) {
1433 vpll_con0 |= exynos4_vpll_div[
i][7] << 27;
1455 static struct clk_ops exynos4_vpll_ops = {
1456 .get_rate = exynos4_vpll_get_rate,
1457 .set_rate = exynos4_vpll_set_rate,
1462 struct clk *xtal_clk;
1463 unsigned long apll = 0;
1464 unsigned long mpll = 0;
1465 unsigned long epll = 0;
1466 unsigned long vpll = 0;
1467 unsigned long vpllsrc;
1469 unsigned long armclk;
1470 unsigned long sclk_dmc;
1471 unsigned long aclk_200;
1472 unsigned long aclk_100;
1473 unsigned long aclk_160;
1474 unsigned long aclk_133;
1480 BUG_ON(IS_ERR(xtal_clk));
1521 apll, mpll, epll, vpll);
1532 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1533 armclk, sclk_dmc, aclk_200,
1534 aclk_100, aclk_160, aclk_133);
1536 clk_f.rate = armclk;
1537 clk_h.rate = sclk_dmc;
1538 clk_p.rate = aclk_100;
1540 for (ptr = 0; ptr <
ARRAY_SIZE(exynos4_clksrcs); ptr++)
1544 static struct clk *exynos4_clks[]
__initdata = {
1545 &exynos4_clk_sclk_hdmi27m,
1546 &exynos4_clk_sclk_hdmiphy,
1547 &exynos4_clk_sclk_usbphy0,
1548 &exynos4_clk_sclk_usbphy1,
1551 #ifdef CONFIG_PM_SLEEP
1564 #define exynos4_clock_suspend NULL
1565 #define exynos4_clock_resume NULL
1568 static struct syscore_ops exynos4_clock_syscore_ops = {
1579 for (ptr = 0; ptr <
ARRAY_SIZE(exynos4_sysclks); ptr++)
1582 for (ptr = 0; ptr <
ARRAY_SIZE(exynos4_sclk_tv); ptr++)
1585 for (ptr = 0; ptr <
ARRAY_SIZE(exynos4_clksrc_cdev); ptr++)
1592 for (ptr = 0; ptr <
ARRAY_SIZE(exynos4_clk_cdev); ptr++)