17 #include <linux/kernel.h>
18 #include <linux/list.h>
32 #define AM33XX_MAX_DPLL_MULT 2047
33 #define AM33XX_MAX_DPLL_DIV 128
36 #define AM33XX_MODULEMODE_HWCTRL 0
37 #define AM33XX_MODULEMODE_SWCTRL 1
47 static inline void am33xx_init_timer_parent(
struct clk *
clk)
55 static struct clk clk_32768_ck = {
56 .name =
"clk_32768_ck",
57 .clkdm_name =
"l4_rtc_clkdm",
63 static struct clk clk_rc32k_ck = {
64 .name =
"clk_rc32k_ck",
70 static struct clk virt_24000000_ck = {
71 .name =
"virt_24000000_ck",
76 static struct clk virt_25000000_ck = {
77 .name =
"virt_25000000_ck",
84 static const struct clksel sys_clkin_sel[] = {
93 static struct clk tclkin_ck = {
104 static struct clk sys_clkin_ck = {
105 .name =
"sys_clkin_ck",
106 .parent = &virt_24000000_ck,
110 .clksel = sys_clkin_sel,
116 static struct dpll_data dpll_core_dd = {
118 .clk_bypass = &sys_clkin_ck,
119 .clk_ref = &sys_clkin_ck,
133 static struct clk dpll_core_ck = {
134 .name =
"dpll_core_ck",
135 .parent = &sys_clkin_ck,
136 .dpll_data = &dpll_core_dd,
142 static struct clk dpll_core_x2_ck = {
143 .name =
"dpll_core_x2_ck",
144 .parent = &dpll_core_ck,
151 static const struct clksel dpll_core_m4_div[] = {
156 static struct clk dpll_core_m4_ck = {
157 .name =
"dpll_core_m4_ck",
158 .parent = &dpll_core_x2_ck,
160 .clksel = dpll_core_m4_div,
169 static const struct clksel dpll_core_m5_div[] = {
174 static struct clk dpll_core_m5_ck = {
175 .name =
"dpll_core_m5_ck",
176 .parent = &dpll_core_x2_ck,
178 .clksel = dpll_core_m5_div,
187 static const struct clksel dpll_core_m6_div[] = {
192 static struct clk dpll_core_m6_ck = {
193 .name =
"dpll_core_m6_ck",
194 .parent = &dpll_core_x2_ck,
196 .clksel = dpll_core_m6_div,
206 static struct dpll_data dpll_mpu_dd = {
208 .clk_bypass = &sys_clkin_ck,
209 .clk_ref = &sys_clkin_ck,
223 static struct clk dpll_mpu_ck = {
224 .name =
"dpll_mpu_ck",
225 .parent = &sys_clkin_ck,
226 .dpll_data = &dpll_mpu_dd,
238 static const struct clksel dpll_mpu_m2_div[] = {
243 static struct clk dpll_mpu_m2_ck = {
244 .name =
"dpll_mpu_m2_ck",
245 .clkdm_name =
"mpu_clkdm",
246 .parent = &dpll_mpu_ck,
247 .clksel = dpll_mpu_m2_div,
257 static struct dpll_data dpll_ddr_dd = {
259 .clk_bypass = &sys_clkin_ck,
260 .clk_ref = &sys_clkin_ck,
274 static struct clk dpll_ddr_ck = {
275 .name =
"dpll_ddr_ck",
276 .parent = &sys_clkin_ck,
277 .dpll_data = &dpll_ddr_dd,
287 static const struct clksel dpll_ddr_m2_div[] = {
292 static struct clk dpll_ddr_m2_ck = {
293 .name =
"dpll_ddr_m2_ck",
294 .parent = &dpll_ddr_ck,
295 .clksel = dpll_ddr_m2_div,
305 static struct clk dpll_ddr_m2_div2_ck = {
306 .name =
"dpll_ddr_m2_div2_ck",
307 .clkdm_name =
"l3_clkdm",
308 .parent = &dpll_ddr_m2_ck,
315 static struct dpll_data dpll_disp_dd = {
317 .clk_bypass = &sys_clkin_ck,
318 .clk_ref = &sys_clkin_ck,
332 static struct clk dpll_disp_ck = {
333 .name =
"dpll_disp_ck",
334 .parent = &sys_clkin_ck,
335 .dpll_data = &dpll_disp_dd,
347 static const struct clksel dpll_disp_m2_div[] = {
352 static struct clk dpll_disp_m2_ck = {
353 .name =
"dpll_disp_m2_ck",
354 .parent = &dpll_disp_ck,
355 .clksel = dpll_disp_m2_div,
365 static struct dpll_data dpll_per_dd = {
367 .clk_bypass = &sys_clkin_ck,
368 .clk_ref = &sys_clkin_ck,
383 static struct clk dpll_per_ck = {
384 .name =
"dpll_per_ck",
385 .parent = &sys_clkin_ck,
386 .dpll_data = &dpll_per_dd,
395 static const struct clksel dpll_per_m2_div[] = {
400 static struct clk dpll_per_m2_ck = {
401 .name =
"dpll_per_m2_ck",
402 .parent = &dpll_per_ck,
403 .clksel = dpll_per_m2_div,
412 static struct clk dpll_per_m2_div4_wkupdm_ck = {
413 .name =
"dpll_per_m2_div4_wkupdm_ck",
414 .clkdm_name =
"l4_wkup_clkdm",
415 .parent = &dpll_per_m2_ck,
421 static struct clk dpll_per_m2_div4_ck = {
422 .name =
"dpll_per_m2_div4_ck",
423 .clkdm_name =
"l4ls_clkdm",
424 .parent = &dpll_per_m2_ck,
430 static struct clk l3_gclk = {
432 .clkdm_name =
"l3_clkdm",
433 .parent = &dpll_core_m4_ck,
438 static struct clk dpll_core_m4_div2_ck = {
439 .name =
"dpll_core_m4_div2_ck",
440 .clkdm_name =
"l4_wkup_clkdm",
441 .parent = &dpll_core_m4_ck,
447 static struct clk l4_rtc_gclk = {
448 .name =
"l4_rtc_gclk",
449 .parent = &dpll_core_m4_ck,
455 static struct clk clk_24mhz = {
457 .parent = &dpll_per_m2_ck,
467 static struct clk l4hs_gclk = {
469 .clkdm_name =
"l4hs_clkdm",
470 .parent = &dpll_core_m4_ck,
475 static struct clk l3s_gclk = {
477 .clkdm_name =
"l3s_clkdm",
478 .parent = &dpll_core_m4_div2_ck,
483 static struct clk l4fw_gclk = {
485 .clkdm_name =
"l4fw_clkdm",
486 .parent = &dpll_core_m4_div2_ck,
491 static struct clk l4ls_gclk = {
493 .clkdm_name =
"l4ls_clkdm",
494 .parent = &dpll_core_m4_div2_ck,
499 static struct clk sysclk_div_ck = {
500 .name =
"sysclk_div_ck",
501 .parent = &dpll_core_m4_ck,
511 static struct clk adc_tsc_fck = {
512 .name =
"adc_tsc_fck",
513 .clkdm_name =
"l4_wkup_clkdm",
514 .parent = &sys_clkin_ck,
519 static struct clk dcan0_fck = {
521 .clkdm_name =
"l4ls_clkdm",
522 .parent = &sys_clkin_ck,
527 static struct clk dcan1_fck = {
529 .clkdm_name =
"l4ls_clkdm",
530 .parent = &sys_clkin_ck,
535 static struct clk mcasp0_fck = {
536 .name =
"mcasp0_fck",
537 .clkdm_name =
"l3s_clkdm",
538 .parent = &sys_clkin_ck,
543 static struct clk mcasp1_fck = {
544 .name =
"mcasp1_fck",
545 .clkdm_name =
"l3s_clkdm",
546 .parent = &sys_clkin_ck,
551 static struct clk smartreflex0_fck = {
552 .name =
"smartreflex0_fck",
553 .clkdm_name =
"l4_wkup_clkdm",
554 .parent = &sys_clkin_ck,
559 static struct clk smartreflex1_fck = {
560 .name =
"smartreflex1_fck",
561 .clkdm_name =
"l4_wkup_clkdm",
562 .parent = &sys_clkin_ck,
583 static struct clk debugss_ick = {
584 .name =
"debugss_ick",
585 .clkdm_name =
"l3_aon_clkdm",
586 .parent = &dpll_core_m4_ck,
593 static struct clk mmu_fck = {
595 .clkdm_name =
"gfx_l3_clkdm",
596 .parent = &dpll_core_m4_ck,
603 static struct clk cefuse_fck = {
604 .name =
"cefuse_fck",
605 .clkdm_name =
"l4_cefuse_clkdm",
606 .parent = &sys_clkin_ck,
616 static struct clk clkdiv32k_ick = {
617 .name =
"clkdiv32k_ick",
618 .clkdm_name =
"clk_24mhz_clkdm",
620 .parent = &clk_24mhz,
626 static struct clk usbotg_fck = {
627 .name =
"usbotg_fck",
628 .clkdm_name =
"l3s_clkdm",
629 .parent = &dpll_per_ck,
636 static struct clk ieee5000_fck = {
637 .name =
"ieee5000_fck",
638 .clkdm_name =
"l3s_clkdm",
639 .parent = &dpll_core_m4_div2_ck,
647 static const struct clksel timer1_clkmux_sel[] = {
656 static struct clk timer1_fck = {
657 .name =
"timer1_fck",
658 .clkdm_name =
"l4ls_clkdm",
659 .parent = &sys_clkin_ck,
661 .clksel = timer1_clkmux_sel,
668 static const struct clksel timer2_to_7_clk_sel[] = {
675 static struct clk timer2_fck = {
676 .name =
"timer2_fck",
677 .clkdm_name =
"l4ls_clkdm",
678 .parent = &sys_clkin_ck,
680 .clksel = timer2_to_7_clk_sel,
687 static struct clk timer3_fck = {
688 .name =
"timer3_fck",
689 .clkdm_name =
"l4ls_clkdm",
690 .parent = &sys_clkin_ck,
691 .
init = &am33xx_init_timer_parent,
692 .clksel = timer2_to_7_clk_sel,
699 static struct clk timer4_fck = {
700 .name =
"timer4_fck",
701 .clkdm_name =
"l4ls_clkdm",
702 .parent = &sys_clkin_ck,
704 .clksel = timer2_to_7_clk_sel,
711 static struct clk timer5_fck = {
712 .name =
"timer5_fck",
713 .clkdm_name =
"l4ls_clkdm",
714 .parent = &sys_clkin_ck,
716 .clksel = timer2_to_7_clk_sel,
723 static struct clk timer6_fck = {
724 .name =
"timer6_fck",
725 .clkdm_name =
"l4ls_clkdm",
726 .parent = &sys_clkin_ck,
727 .
init = &am33xx_init_timer_parent,
728 .clksel = timer2_to_7_clk_sel,
735 static struct clk timer7_fck = {
736 .name =
"timer7_fck",
737 .clkdm_name =
"l4ls_clkdm",
738 .parent = &sys_clkin_ck,
740 .clksel = timer2_to_7_clk_sel,
747 static struct clk cpsw_125mhz_gclk = {
748 .name =
"cpsw_125mhz_gclk",
749 .clkdm_name =
"cpsw_125mhz_clkdm",
750 .parent = &dpll_core_m5_ck,
756 static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
762 static struct clk cpsw_cpts_rft_clk = {
763 .name =
"cpsw_cpts_rft_clk",
764 .clkdm_name =
"cpsw_125mhz_clkdm",
765 .parent = &dpll_core_m5_ck,
766 .clksel = cpsw_cpts_rft_clkmux_sel,
774 static const struct clksel gpio0_dbclk_mux_sel[] = {
781 static struct clk gpio0_dbclk_mux_ck = {
782 .name =
"gpio0_dbclk_mux_ck",
783 .clkdm_name =
"l4_wkup_clkdm",
784 .parent = &clk_rc32k_ck,
786 .clksel = gpio0_dbclk_mux_sel,
793 static struct clk gpio0_dbclk = {
794 .name =
"gpio0_dbclk",
795 .clkdm_name =
"l4_wkup_clkdm",
796 .parent = &gpio0_dbclk_mux_ck,
803 static struct clk gpio1_dbclk = {
804 .name =
"gpio1_dbclk",
805 .clkdm_name =
"l4ls_clkdm",
806 .parent = &clkdiv32k_ick,
813 static struct clk gpio2_dbclk = {
814 .name =
"gpio2_dbclk",
815 .clkdm_name =
"l4ls_clkdm",
816 .parent = &clkdiv32k_ick,
823 static struct clk gpio3_dbclk = {
824 .name =
"gpio3_dbclk",
825 .clkdm_name =
"l4ls_clkdm",
826 .parent = &clkdiv32k_ick,
833 static const struct clksel pruss_ocp_clk_mux_sel[] = {
839 static struct clk pruss_ocp_gclk = {
840 .name =
"pruss_ocp_gclk",
841 .clkdm_name =
"pruss_ocp_clkdm",
844 .clksel = pruss_ocp_clk_mux_sel,
851 static const struct clksel lcd_clk_mux_sel[] = {
858 static struct clk lcd_gclk = {
860 .clkdm_name =
"lcdc_clkdm",
861 .parent = &dpll_disp_m2_ck,
863 .clksel = lcd_clk_mux_sel,
870 static struct clk mmc_clk = {
872 .clkdm_name =
"l4ls_clkdm",
873 .parent = &dpll_per_m2_ck,
879 static struct clk mmc2_fck = {
881 .clkdm_name =
"l3s_clkdm",
887 static const struct clksel gfx_clksel_sel[] = {
893 static struct clk gfx_fclk_clksel_ck = {
894 .name =
"gfx_fclk_clksel_ck",
895 .parent = &dpll_core_m4_ck,
896 .clksel = gfx_clksel_sel,
903 static const struct clksel_rate div_1_0_2_1_rates[] = {
904 { .div = 1, .val = 0, .flags = RATE_IN_AM33XX },
905 { .div = 2, .val = 1, .flags = RATE_IN_AM33XX },
909 static const struct clksel gfx_div_sel[] = {
910 { .parent = &gfx_fclk_clksel_ck, .
rates = div_1_0_2_1_rates },
914 static struct clk gfx_fck_div_ck = {
915 .name =
"gfx_fck_div_ck",
916 .clkdm_name =
"gfx_l3_clkdm",
917 .parent = &gfx_fclk_clksel_ck,
919 .clksel = gfx_div_sel,
928 static const struct clksel sysclkout_pre_sel[] = {
937 static struct clk sysclkout_pre_ck = {
938 .name =
"sysclkout_pre_ck",
939 .parent = &clk_32768_ck,
941 .clksel = sysclkout_pre_sel,
949 static const struct clksel_rate div8_rates[] = {
950 { .div = 1, .val = 0, .flags = RATE_IN_AM33XX },
951 { .div = 2, .val = 1, .flags = RATE_IN_AM33XX },
952 { .div = 3, .val = 2, .flags = RATE_IN_AM33XX },
953 { .div = 4, .val = 3, .flags = RATE_IN_AM33XX },
954 { .div = 5, .val = 4, .flags = RATE_IN_AM33XX },
955 { .div = 6, .val = 5, .flags = RATE_IN_AM33XX },
956 { .div = 7, .val = 6, .flags = RATE_IN_AM33XX },
957 { .div = 8, .val = 7, .flags = RATE_IN_AM33XX },
961 static const struct clksel clkout2_div[] = {
962 { .parent = &sysclkout_pre_ck, .
rates = div8_rates },
966 static struct clk clkout2_ck = {
967 .name =
"clkout2_ck",
968 .parent = &sysclkout_pre_ck,
970 .clksel = clkout2_div,
980 static const struct clksel wdt_clkmux_sel[] = {
986 static struct clk wdt1_fck = {
988 .clkdm_name =
"l4_wkup_clkdm",
989 .parent = &clk_rc32k_ck,
991 .clksel = wdt_clkmux_sel,
1001 static struct omap_clk am33xx_clks[] = {
1025 CLK(
NULL,
"dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck,
CK_AM33XX),
1092 for (c = am33xx_clks; c < am33xx_clks +
ARRAY_SIZE(am33xx_clks); c++)
1095 for (c = am33xx_clks; c < am33xx_clks +
ARRAY_SIZE(am33xx_clks); c++) {
1096 if (c->
cpu & cpu_clkflg) {