2 #include <linux/compiler.h>
3 #include <linux/slab.h>
5 #include <asm/clkdev.h>
8 static struct clk master_clk = {
9 .flags = CLK_ENABLE_ON_INIT,
10 .rate = CONFIG_SH_PCLK_FREQ,
13 static struct clk peripheral_clk = {
14 .parent = &master_clk,
15 .flags = CLK_ENABLE_ON_INIT,
18 static struct clk bus_clk = {
19 .parent = &master_clk,
20 .flags = CLK_ENABLE_ON_INIT,
23 static struct clk cpu_clk = {
24 .parent = &master_clk,
25 .flags = CLK_ENABLE_ON_INIT,
29 * The ordering of these clocks matters, do not change it.
31 static struct clk *onchip_clocks[] = {
38 #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
40 static struct clk_lookup lookups[] = {
42 CLKDEV_CON_ID("master_clk", &master_clk),
43 CLKDEV_CON_ID("peripheral_clk", &peripheral_clk),
44 CLKDEV_CON_ID("bus_clk", &bus_clk),
45 CLKDEV_CON_ID("cpu_clk", &cpu_clk),
48 int __init __deprecated cpg_clk_init(void)
52 for (i = 0; i < ARRAY_SIZE(onchip_clocks); i++) {
53 struct clk *clk = onchip_clocks[i];
54 arch_init_clk_ops(&clk->ops, i);
56 ret |= clk_register(clk);
59 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
61 clk_add_alias("tmu_fck", NULL, "peripheral_clk", NULL);
62 clk_add_alias("mtu2_fck", NULL, "peripheral_clk", NULL);
63 clk_add_alias("cmt_fck", NULL, "peripheral_clk", NULL);
64 clk_add_alias("sci_ick", NULL, "peripheral_clk", NULL);
70 * Placeholder for compatability, until the lazy CPUs do this
73 int __init __weak arch_clk_init(void)
75 return cpg_clk_init();