1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/compiler.h>
4 #include <linux/slab.h>
6 #include <linux/clkdev.h>
9 static struct clk master_clk
= {
10 .flags
= CLK_ENABLE_ON_INIT
,
11 .rate
= CONFIG_SH_PCLK_FREQ
,
14 static struct clk peripheral_clk
= {
15 .parent
= &master_clk
,
16 .flags
= CLK_ENABLE_ON_INIT
,
19 static struct clk bus_clk
= {
20 .parent
= &master_clk
,
21 .flags
= CLK_ENABLE_ON_INIT
,
24 static struct clk cpu_clk
= {
25 .parent
= &master_clk
,
26 .flags
= CLK_ENABLE_ON_INIT
,
30 * The ordering of these clocks matters, do not change it.
32 static struct clk
*onchip_clocks
[] = {
39 static struct clk_lookup lookups
[] = {
41 CLKDEV_CON_ID("master_clk", &master_clk
),
42 CLKDEV_CON_ID("peripheral_clk", &peripheral_clk
),
43 CLKDEV_CON_ID("bus_clk", &bus_clk
),
44 CLKDEV_CON_ID("cpu_clk", &cpu_clk
),
47 int __init __deprecated
cpg_clk_init(void)
51 for (i
= 0; i
< ARRAY_SIZE(onchip_clocks
); i
++) {
52 struct clk
*clk
= onchip_clocks
[i
];
53 arch_init_clk_ops(&clk
->ops
, i
);
55 ret
|= clk_register(clk
);
58 clkdev_add_table(lookups
, ARRAY_SIZE(lookups
));
60 clk_add_alias("fck", "sh-tmu-sh3.0", "peripheral_clk", NULL
);
61 clk_add_alias("fck", "sh-tmu.0", "peripheral_clk", NULL
);
62 clk_add_alias("fck", "sh-tmu.1", "peripheral_clk", NULL
);
63 clk_add_alias("fck", "sh-tmu.2", "peripheral_clk", NULL
);
64 clk_add_alias("fck", "sh-mtu2", "peripheral_clk", NULL
);
65 clk_add_alias("fck", "sh-cmt-16.0", "peripheral_clk", NULL
);
66 clk_add_alias("fck", "sh-cmt-32.0", "peripheral_clk", NULL
);
72 * Placeholder for compatibility, until the lazy CPUs do this
75 int __init __weak
arch_clk_init(void)
77 return cpg_clk_init();