20 #include <linux/kernel.h>
24 #include <mach/common.h>
26 #define EMEV2_SMU_BASE 0xe0110000
29 #define USIAU0_RSTCTRL 0x094
30 #define USIBU1_RSTCTRL 0x0ac
31 #define USIBU2_RSTCTRL 0x0b0
32 #define USIBU3_RSTCTRL 0x0b4
33 #define STI_RSTCTRL 0x124
34 #define USIAU0GCLKCTRL 0x4a0
35 #define USIBU1GCLKCTRL 0x4b8
36 #define USIBU2GCLKCTRL 0x4bc
37 #define USIBU3GCLKCTRL 0x04c0
38 #define STIGCLKCTRL 0x528
39 #define USIAU0SCLKDIV 0x61c
40 #define USIB2SCLKDIV 0x65c
41 #define USIB3SCLKDIV 0x660
42 #define STI_CLKSEL 0x688
43 #define SMU_GENERAL_REG0 0x7c0
48 static void emev2_smu_write(
unsigned long value,
int offs)
65 static struct clk c32k_clk = {
67 .mapping = &smu_mapping,
71 static unsigned long pll3_recalc(
struct clk *
clk)
73 return clk->
parent->rate * 7000;
77 .recalc = pll3_recalc,
80 static struct clk pll3_clk = {
85 static struct clk *main_clks[] = {
93 #define SCLKDIV(_reg, _shift) \
95 .parent = &pll3_clk, \
96 .enable_reg = IOMEM(EMEV2_SMU_BASE + (_reg)), \
97 .enable_bit = _shift, \
111 #define GCLK_SCLK(_parent, _reg) \
114 .enable_reg = IOMEM(EMEV2_SMU_BASE + (_reg)), \
130 static int emev2_gclk_enable(
struct clk *
clk)
137 static void emev2_gclk_disable(
struct clk *clk)
143 static struct sh_clk_ops emev2_gclk_clk_ops = {
144 .enable = emev2_gclk_enable,
145 .disable = emev2_gclk_disable,
149 static int __init emev2_gclk_register(
struct clk *clks,
int nr)
155 for (k = 0; !ret && (k <
nr); k++) {
157 clkp->
ops = &emev2_gclk_clk_ops;
164 static unsigned long emev2_sclkdiv_recalc(
struct clk *clk)
166 unsigned int sclk_div;
170 return clk->
parent->rate / (sclk_div + 1);
173 static struct sh_clk_ops emev2_sclkdiv_clk_ops = {
174 .recalc = emev2_sclkdiv_recalc,
177 static int __init emev2_sclkdiv_register(
struct clk *clks,
int nr)
183 for (k = 0; !ret && (k <
nr); k++) {
185 clkp->
ops = &emev2_sclkdiv_clk_ops;
234 for (k = 0; !ret && (k <
ARRAY_SIZE(main_clks)); k++)
238 ret = emev2_sclkdiv_register(sclkdiv_clks,
SCLKDIV_NR);
241 ret = emev2_gclk_register(gclk_clks,
GCLK_NR);
248 panic(
"failed to setup emev2 clocks\n");