2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License as
4 * published by the Free Software Foundation version 2.
7 #include <linux/kernel.h>
9 #include <linux/clk-provider.h>
10 #include <linux/clk/ti.h>
11 #include <linux/of_platform.h>
15 static struct ti_dt_clk dm814_clks
[] = {
16 DT_CLK(NULL
, "devosc_ck", "devosc_ck"),
17 DT_CLK(NULL
, "mpu_ck", "mpu_ck"),
18 DT_CLK(NULL
, "sysclk4_ck", "sysclk4_ck"),
19 DT_CLK(NULL
, "sysclk5_ck", "sysclk5_ck"),
20 DT_CLK(NULL
, "sysclk6_ck", "sysclk6_ck"),
21 DT_CLK(NULL
, "sysclk8_ck", "sysclk8_ck"),
22 DT_CLK(NULL
, "sysclk10_ck", "sysclk10_ck"),
23 DT_CLK(NULL
, "sysclk18_ck", "sysclk18_ck"),
24 DT_CLK(NULL
, "timer_sys_ck", "devosc_ck"),
25 DT_CLK(NULL
, "timer1_fck", "timer1_fck"),
26 DT_CLK(NULL
, "timer2_fck", "timer2_fck"),
27 DT_CLK(NULL
, "cpsw_125mhz_gclk", "cpsw_125mhz_gclk"),
28 DT_CLK(NULL
, "cpsw_cpts_rft_clk", "cpsw_cpts_rft_clk"),
29 { .node_name
= NULL
},
32 static bool timer_clocks_initialized
;
34 static int __init
dm814x_adpll_early_init(void)
36 struct device_node
*np
;
38 if (!timer_clocks_initialized
)
41 np
= of_find_node_by_name(NULL
, "pllss");
43 pr_err("Could not find node for plls\n");
47 of_platform_populate(np
, NULL
, NULL
, NULL
);
51 core_initcall(dm814x_adpll_early_init
);
53 static const char * const init_clocks
[] = {
54 "pll040clkout", /* MPU 481c5040.adpll.clkout */
55 "pll290clkout", /* DDR 481c5290.adpll.clkout */
58 static int __init
dm814x_adpll_enable_init_clocks(void)
62 if (!timer_clocks_initialized
)
65 for (i
= 0; i
< ARRAY_SIZE(init_clocks
); i
++) {
68 clock
= clk_get(NULL
, init_clocks
[i
]);
69 if (WARN(IS_ERR(clock
), "could not find init clock %s\n",
72 err
= clk_prepare_enable(clock
);
73 if (WARN(err
, "could not enable init clock %s\n",
80 postcore_initcall(dm814x_adpll_enable_init_clocks
);
82 int __init
dm814x_dt_clk_init(void)
84 ti_dt_clocks_register(dm814_clks
);
85 omap2_clk_disable_autoidle_all();
86 omap2_clk_enable_init_clocks(NULL
, 0);
87 timer_clocks_initialized
= true;