20 #include <linux/kernel.h>
21 #include <asm/clock.h>
25 static int stc_multipliers[] = { 1, 2, 3, 4, 6, 1, 1, 1 };
27 static int pfc_divisors[] = { 1, 2, 3, 4, 6, 1, 1, 1 };
29 static void master_clk_init(
struct clk *
clk)
32 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
37 static struct sh_clk_ops sh3_master_clk_ops = {
38 .init = master_clk_init,
41 static unsigned long module_clk_recalc(
struct clk *
clk)
44 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
46 return clk->
parent->rate / pfc_divisors[
idx];
49 static struct sh_clk_ops sh3_module_clk_ops = {
50 .recalc = module_clk_recalc,
53 static unsigned long bus_clk_recalc(
struct clk *
clk)
56 int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4);
58 return clk->
parent->rate / stc_multipliers[
idx];
62 .recalc = bus_clk_recalc,
65 static unsigned long cpu_clk_recalc(
struct clk *
clk)
68 int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
74 .recalc = cpu_clk_recalc,
87 *ops = sh3_clk_ops[
idx];