aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-05-11 14:45:08 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-05-11 14:45:08 -0400
commitb68d8201433a91cabbcbeae48b53d8c1c426433a (patch)
treefed76b13249a01356509c0860260434216352f8c /arch/sh/kernel
parentccc195655fb25d7d967b278c4a4725dc5e7a6bf4 (diff)
sh: clkfwk: Make recalc return an unsigned long.
This is prep work for cleaning up some of the rate propagation bits. Trivial conversion. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r--arch/sh/kernel/cpu/clock.c35
-rw-r--r--arch/sh/kernel/cpu/sh2/clock-sh7619.c13
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7201.c14
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7203.c12
-rw-r--r--arch/sh/kernel/cpu/sh2a/clock-sh7206.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh3.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7705.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7706.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7709.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7710.c12
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7712.c8
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh4-202.c14
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh4.c12
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c31
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7763.c16
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7770.c12
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7780.c16
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7785.c24
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7786.c20
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-shx3.c16
-rw-r--r--arch/sh/kernel/cpu/sh5/clock-sh5.c12
-rw-r--r--arch/sh/kernel/timers/timer-tmu.c16
22 files changed, 169 insertions, 174 deletions
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index 133dbe403341..b022affb44cd 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -75,6 +75,7 @@ static struct clk *onchip_clocks[] = {
75 &cpu_clk, 75 &cpu_clk,
76}; 76};
77 77
78/* Propagate rate to children */
78static void propagate_rate(struct clk *clk) 79static void propagate_rate(struct clk *clk)
79{ 80{
80 struct clk *clkp; 81 struct clk *clkp;
@@ -83,7 +84,7 @@ static void propagate_rate(struct clk *clk)
83 if (likely(clkp->parent != clk)) 84 if (likely(clkp->parent != clk))
84 continue; 85 continue;
85 if (likely(clkp->ops && clkp->ops->recalc)) 86 if (likely(clkp->ops && clkp->ops->recalc))
86 clkp->ops->recalc(clkp); 87 clkp->rate = clkp->ops->recalc(clkp);
87 if (unlikely(clkp->flags & CLK_RATE_PROPAGATES)) 88 if (unlikely(clkp->flags & CLK_RATE_PROPAGATES))
88 propagate_rate(clkp); 89 propagate_rate(clkp);
89 } 90 }
@@ -240,7 +241,7 @@ void clk_recalc_rate(struct clk *clk)
240 unsigned long flags; 241 unsigned long flags;
241 242
242 spin_lock_irqsave(&clock_lock, flags); 243 spin_lock_irqsave(&clock_lock, flags);
243 clk->ops->recalc(clk); 244 clk->rate = clk->ops->recalc(clk);
244 spin_unlock_irqrestore(&clock_lock, flags); 245 spin_unlock_irqrestore(&clock_lock, flags);
245 } 246 }
246 247
@@ -377,20 +378,22 @@ static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state)
377 switch (state.event) { 378 switch (state.event) {
378 case PM_EVENT_ON: 379 case PM_EVENT_ON:
379 /* Resumeing from hibernation */ 380 /* Resumeing from hibernation */
380 if (prev_state.event == PM_EVENT_FREEZE) { 381 if (prev_state.event != PM_EVENT_FREEZE)
381 list_for_each_entry(clkp, &clock_list, node) 382 break;
382 if (likely(clkp->ops)) { 383
383 unsigned long rate = clkp->rate; 384 list_for_each_entry(clkp, &clock_list, node) {
384 385 if (likely(clkp->ops)) {
385 if (likely(clkp->ops->set_parent)) 386 unsigned long rate = clkp->rate;
386 clkp->ops->set_parent(clkp, 387
387 clkp->parent); 388 if (likely(clkp->ops->set_parent))
388 if (likely(clkp->ops->set_rate)) 389 clkp->ops->set_parent(clkp,
389 clkp->ops->set_rate(clkp, 390 clkp->parent);
390 rate, NO_CHANGE); 391 if (likely(clkp->ops->set_rate))
391 else if (likely(clkp->ops->recalc)) 392 clkp->ops->set_rate(clkp,
392 clkp->ops->recalc(clkp); 393 rate, NO_CHANGE);
393 } 394 else if (likely(clkp->ops->recalc))
395 clkp->rate = clkp->ops->recalc(clkp);
396 }
394 } 397 }
395 break; 398 break;
396 case PM_EVENT_FREEZE: 399 case PM_EVENT_FREEZE:
diff --git a/arch/sh/kernel/cpu/sh2/clock-sh7619.c b/arch/sh/kernel/cpu/sh2/clock-sh7619.c
index d2c157917999..26799139aa7a 100644
--- a/arch/sh/kernel/cpu/sh2/clock-sh7619.c
+++ b/arch/sh/kernel/cpu/sh2/clock-sh7619.c
@@ -38,28 +38,28 @@ static struct clk_ops sh7619_master_clk_ops = {
38 .init = master_clk_init, 38 .init = master_clk_init,
39}; 39};
40 40
41static void module_clk_recalc(struct clk *clk) 41static unsigned long module_clk_recalc(struct clk *clk)
42{ 42{
43 int idx = (ctrl_inw(FREQCR) & 0x0007); 43 int idx = (ctrl_inw(FREQCR) & 0x0007);
44 clk->rate = clk->parent->rate / pfc_divisors[idx]; 44 return clk->parent->rate / pfc_divisors[idx];
45} 45}
46 46
47static struct clk_ops sh7619_module_clk_ops = { 47static struct clk_ops sh7619_module_clk_ops = {
48 .recalc = module_clk_recalc, 48 .recalc = module_clk_recalc,
49}; 49};
50 50
51static void bus_clk_recalc(struct clk *clk) 51static unsigned long bus_clk_recalc(struct clk *clk)
52{ 52{
53 clk->rate = clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 7]; 53 return clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 7];
54} 54}
55 55
56static struct clk_ops sh7619_bus_clk_ops = { 56static struct clk_ops sh7619_bus_clk_ops = {
57 .recalc = bus_clk_recalc, 57 .recalc = bus_clk_recalc,
58}; 58};
59 59
60static void cpu_clk_recalc(struct clk *clk) 60static unsigned long cpu_clk_recalc(struct clk *clk)
61{ 61{
62 clk->rate = clk->parent->rate; 62 return clk->parent->rate;
63} 63}
64 64
65static struct clk_ops sh7619_cpu_clk_ops = { 65static struct clk_ops sh7619_cpu_clk_ops = {
@@ -78,4 +78,3 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
78 if (idx < ARRAY_SIZE(sh7619_clk_ops)) 78 if (idx < ARRAY_SIZE(sh7619_clk_ops))
79 *ops = sh7619_clk_ops[idx]; 79 *ops = sh7619_clk_ops[idx];
80} 80}
81
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7201.c b/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
index 4a5e59732334..7814c76159a7 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7201.c
@@ -34,37 +34,37 @@ static const int pfc_divisors[]={1,2,3,4,6,8,12};
34 34
35static void master_clk_init(struct clk *clk) 35static void master_clk_init(struct clk *clk)
36{ 36{
37 clk->rate = 10000000 * PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007]; 37 return 10000000 * PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
38} 38}
39 39
40static struct clk_ops sh7201_master_clk_ops = { 40static struct clk_ops sh7201_master_clk_ops = {
41 .init = master_clk_init, 41 .init = master_clk_init,
42}; 42};
43 43
44static void module_clk_recalc(struct clk *clk) 44static unsigned long module_clk_recalc(struct clk *clk)
45{ 45{
46 int idx = (ctrl_inw(FREQCR) & 0x0007); 46 int idx = (ctrl_inw(FREQCR) & 0x0007);
47 clk->rate = clk->parent->rate / pfc_divisors[idx]; 47 return clk->parent->rate / pfc_divisors[idx];
48} 48}
49 49
50static struct clk_ops sh7201_module_clk_ops = { 50static struct clk_ops sh7201_module_clk_ops = {
51 .recalc = module_clk_recalc, 51 .recalc = module_clk_recalc,
52}; 52};
53 53
54static void bus_clk_recalc(struct clk *clk) 54static unsigned long bus_clk_recalc(struct clk *clk)
55{ 55{
56 int idx = (ctrl_inw(FREQCR) & 0x0007); 56 int idx = (ctrl_inw(FREQCR) & 0x0007);
57 clk->rate = clk->parent->rate / pfc_divisors[idx]; 57 return clk->parent->rate / pfc_divisors[idx];
58} 58}
59 59
60static struct clk_ops sh7201_bus_clk_ops = { 60static struct clk_ops sh7201_bus_clk_ops = {
61 .recalc = bus_clk_recalc, 61 .recalc = bus_clk_recalc,
62}; 62};
63 63
64static void cpu_clk_recalc(struct clk *clk) 64static unsigned long cpu_clk_recalc(struct clk *clk)
65{ 65{
66 int idx = ((ctrl_inw(FREQCR) >> 4) & 0x0007); 66 int idx = ((ctrl_inw(FREQCR) >> 4) & 0x0007);
67 clk->rate = clk->parent->rate / ifc_divisors[idx]; 67 return clk->parent->rate / ifc_divisors[idx];
68} 68}
69 69
70static struct clk_ops sh7201_cpu_clk_ops = { 70static struct clk_ops sh7201_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7203.c b/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
index fb781329848a..f8c6933857b3 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7203.c
@@ -46,29 +46,29 @@ static struct clk_ops sh7203_master_clk_ops = {
46 .init = master_clk_init, 46 .init = master_clk_init,
47}; 47};
48 48
49static void module_clk_recalc(struct clk *clk) 49static unsigned long module_clk_recalc(struct clk *clk)
50{ 50{
51 int idx = (ctrl_inw(FREQCR) & 0x0007); 51 int idx = (ctrl_inw(FREQCR) & 0x0007);
52 clk->rate = clk->parent->rate / pfc_divisors[idx]; 52 return clk->parent->rate / pfc_divisors[idx];
53} 53}
54 54
55static struct clk_ops sh7203_module_clk_ops = { 55static struct clk_ops sh7203_module_clk_ops = {
56 .recalc = module_clk_recalc, 56 .recalc = module_clk_recalc,
57}; 57};
58 58
59static void bus_clk_recalc(struct clk *clk) 59static unsigned long bus_clk_recalc(struct clk *clk)
60{ 60{
61 int idx = (ctrl_inw(FREQCR) & 0x0007); 61 int idx = (ctrl_inw(FREQCR) & 0x0007);
62 clk->rate = clk->parent->rate / pfc_divisors[idx-2]; 62 return clk->parent->rate / pfc_divisors[idx-2];
63} 63}
64 64
65static struct clk_ops sh7203_bus_clk_ops = { 65static struct clk_ops sh7203_bus_clk_ops = {
66 .recalc = bus_clk_recalc, 66 .recalc = bus_clk_recalc,
67}; 67};
68 68
69static void cpu_clk_recalc(struct clk *clk) 69static unsigned long cpu_clk_recalc(struct clk *clk)
70{ 70{
71 clk->rate = clk->parent->rate; 71 return clk->parent->rate;
72} 72}
73 73
74static struct clk_ops sh7203_cpu_clk_ops = { 74static struct clk_ops sh7203_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7206.c b/arch/sh/kernel/cpu/sh2a/clock-sh7206.c
index 82d7f991ef6b..c2268bdeceeb 100644
--- a/arch/sh/kernel/cpu/sh2a/clock-sh7206.c
+++ b/arch/sh/kernel/cpu/sh2a/clock-sh7206.c
@@ -41,29 +41,29 @@ static struct clk_ops sh7206_master_clk_ops = {
41 .init = master_clk_init, 41 .init = master_clk_init,
42}; 42};
43 43
44static void module_clk_recalc(struct clk *clk) 44static unsigned long module_clk_recalc(struct clk *clk)
45{ 45{
46 int idx = (ctrl_inw(FREQCR) & 0x0007); 46 int idx = (ctrl_inw(FREQCR) & 0x0007);
47 clk->rate = clk->parent->rate / pfc_divisors[idx]; 47 return clk->parent->rate / pfc_divisors[idx];
48} 48}
49 49
50static struct clk_ops sh7206_module_clk_ops = { 50static struct clk_ops sh7206_module_clk_ops = {
51 .recalc = module_clk_recalc, 51 .recalc = module_clk_recalc,
52}; 52};
53 53
54static void bus_clk_recalc(struct clk *clk) 54static unsigned long bus_clk_recalc(struct clk *clk)
55{ 55{
56 clk->rate = clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007]; 56 return clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
57} 57}
58 58
59static struct clk_ops sh7206_bus_clk_ops = { 59static struct clk_ops sh7206_bus_clk_ops = {
60 .recalc = bus_clk_recalc, 60 .recalc = bus_clk_recalc,
61}; 61};
62 62
63static void cpu_clk_recalc(struct clk *clk) 63static unsigned long cpu_clk_recalc(struct clk *clk)
64{ 64{
65 int idx = (ctrl_inw(FREQCR) & 0x0007); 65 int idx = (ctrl_inw(FREQCR) & 0x0007);
66 clk->rate = clk->parent->rate / ifc_divisors[idx]; 66 return clk->parent->rate / ifc_divisors[idx];
67} 67}
68 68
69static struct clk_ops sh7206_cpu_clk_ops = { 69static struct clk_ops sh7206_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh3.c b/arch/sh/kernel/cpu/sh3/clock-sh3.c
index c3c945958baf..27b8738f0b09 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh3.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh3.c
@@ -38,36 +38,36 @@ static struct clk_ops sh3_master_clk_ops = {
38 .init = master_clk_init, 38 .init = master_clk_init,
39}; 39};
40 40
41static void module_clk_recalc(struct clk *clk) 41static unsigned long module_clk_recalc(struct clk *clk)
42{ 42{
43 int frqcr = ctrl_inw(FRQCR); 43 int frqcr = ctrl_inw(FRQCR);
44 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003); 44 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
45 45
46 clk->rate = clk->parent->rate / pfc_divisors[idx]; 46 return clk->parent->rate / pfc_divisors[idx];
47} 47}
48 48
49static struct clk_ops sh3_module_clk_ops = { 49static struct clk_ops sh3_module_clk_ops = {
50 .recalc = module_clk_recalc, 50 .recalc = module_clk_recalc,
51}; 51};
52 52
53static void bus_clk_recalc(struct clk *clk) 53static unsigned long bus_clk_recalc(struct clk *clk)
54{ 54{
55 int frqcr = ctrl_inw(FRQCR); 55 int frqcr = ctrl_inw(FRQCR);
56 int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4); 56 int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4);
57 57
58 clk->rate = clk->parent->rate / stc_multipliers[idx]; 58 return clk->parent->rate / stc_multipliers[idx];
59} 59}
60 60
61static struct clk_ops sh3_bus_clk_ops = { 61static struct clk_ops sh3_bus_clk_ops = {
62 .recalc = bus_clk_recalc, 62 .recalc = bus_clk_recalc,
63}; 63};
64 64
65static void cpu_clk_recalc(struct clk *clk) 65static unsigned long cpu_clk_recalc(struct clk *clk)
66{ 66{
67 int frqcr = ctrl_inw(FRQCR); 67 int frqcr = ctrl_inw(FRQCR);
68 int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2); 68 int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
69 69
70 clk->rate = clk->parent->rate / ifc_divisors[idx]; 70 return clk->parent->rate / ifc_divisors[idx];
71} 71}
72 72
73static struct clk_ops sh3_cpu_clk_ops = { 73static struct clk_ops sh3_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7705.c b/arch/sh/kernel/cpu/sh3/clock-sh7705.c
index dfdbf3277fd7..0ca8f2c3646c 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7705.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7705.c
@@ -39,30 +39,30 @@ static struct clk_ops sh7705_master_clk_ops = {
39 .init = master_clk_init, 39 .init = master_clk_init,
40}; 40};
41 41
42static void module_clk_recalc(struct clk *clk) 42static unsigned long module_clk_recalc(struct clk *clk)
43{ 43{
44 int idx = ctrl_inw(FRQCR) & 0x0003; 44 int idx = ctrl_inw(FRQCR) & 0x0003;
45 clk->rate = clk->parent->rate / pfc_divisors[idx]; 45 return clk->parent->rate / pfc_divisors[idx];
46} 46}
47 47
48static struct clk_ops sh7705_module_clk_ops = { 48static struct clk_ops sh7705_module_clk_ops = {
49 .recalc = module_clk_recalc, 49 .recalc = module_clk_recalc,
50}; 50};
51 51
52static void bus_clk_recalc(struct clk *clk) 52static unsigned long bus_clk_recalc(struct clk *clk)
53{ 53{
54 int idx = (ctrl_inw(FRQCR) & 0x0300) >> 8; 54 int idx = (ctrl_inw(FRQCR) & 0x0300) >> 8;
55 clk->rate = clk->parent->rate / stc_multipliers[idx]; 55 return clk->parent->rate / stc_multipliers[idx];
56} 56}
57 57
58static struct clk_ops sh7705_bus_clk_ops = { 58static struct clk_ops sh7705_bus_clk_ops = {
59 .recalc = bus_clk_recalc, 59 .recalc = bus_clk_recalc,
60}; 60};
61 61
62static void cpu_clk_recalc(struct clk *clk) 62static unsigned long cpu_clk_recalc(struct clk *clk)
63{ 63{
64 int idx = (ctrl_inw(FRQCR) & 0x0030) >> 4; 64 int idx = (ctrl_inw(FRQCR) & 0x0030) >> 4;
65 clk->rate = clk->parent->rate / ifc_divisors[idx]; 65 return clk->parent->rate / ifc_divisors[idx];
66} 66}
67 67
68static struct clk_ops sh7705_cpu_clk_ops = { 68static struct clk_ops sh7705_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7706.c b/arch/sh/kernel/cpu/sh3/clock-sh7706.c
index 0cf96f9833bc..4bf7887d310a 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7706.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7706.c
@@ -34,36 +34,36 @@ static struct clk_ops sh7706_master_clk_ops = {
34 .init = master_clk_init, 34 .init = master_clk_init,
35}; 35};
36 36
37static void module_clk_recalc(struct clk *clk) 37static unsigned long module_clk_recalc(struct clk *clk)
38{ 38{
39 int frqcr = ctrl_inw(FRQCR); 39 int frqcr = ctrl_inw(FRQCR);
40 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003); 40 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
41 41
42 clk->rate = clk->parent->rate / pfc_divisors[idx]; 42 return clk->parent->rate / pfc_divisors[idx];
43} 43}
44 44
45static struct clk_ops sh7706_module_clk_ops = { 45static struct clk_ops sh7706_module_clk_ops = {
46 .recalc = module_clk_recalc, 46 .recalc = module_clk_recalc,
47}; 47};
48 48
49static void bus_clk_recalc(struct clk *clk) 49static unsigned long bus_clk_recalc(struct clk *clk)
50{ 50{
51 int frqcr = ctrl_inw(FRQCR); 51 int frqcr = ctrl_inw(FRQCR);
52 int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4); 52 int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4);
53 53
54 clk->rate = clk->parent->rate / stc_multipliers[idx]; 54 return clk->parent->rate / stc_multipliers[idx];
55} 55}
56 56
57static struct clk_ops sh7706_bus_clk_ops = { 57static struct clk_ops sh7706_bus_clk_ops = {
58 .recalc = bus_clk_recalc, 58 .recalc = bus_clk_recalc,
59}; 59};
60 60
61static void cpu_clk_recalc(struct clk *clk) 61static unsigned long cpu_clk_recalc(struct clk *clk)
62{ 62{
63 int frqcr = ctrl_inw(FRQCR); 63 int frqcr = ctrl_inw(FRQCR);
64 int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2); 64 int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
65 65
66 clk->rate = clk->parent->rate / ifc_divisors[idx]; 66 return clk->parent->rate / ifc_divisors[idx];
67} 67}
68 68
69static struct clk_ops sh7706_cpu_clk_ops = { 69static struct clk_ops sh7706_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7709.c b/arch/sh/kernel/cpu/sh3/clock-sh7709.c
index b791a29fdb62..fa30b6017730 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7709.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7709.c
@@ -41,12 +41,12 @@ static struct clk_ops sh7709_master_clk_ops = {
41 .init = master_clk_init, 41 .init = master_clk_init,
42}; 42};
43 43
44static void module_clk_recalc(struct clk *clk) 44static unsigned long module_clk_recalc(struct clk *clk)
45{ 45{
46 int frqcr = ctrl_inw(FRQCR); 46 int frqcr = ctrl_inw(FRQCR);
47 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003); 47 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
48 48
49 clk->rate = clk->parent->rate / pfc_divisors[idx]; 49 return clk->parent->rate / pfc_divisors[idx];
50} 50}
51 51
52static struct clk_ops sh7709_module_clk_ops = { 52static struct clk_ops sh7709_module_clk_ops = {
@@ -56,25 +56,25 @@ static struct clk_ops sh7709_module_clk_ops = {
56 .recalc = module_clk_recalc, 56 .recalc = module_clk_recalc,
57}; 57};
58 58
59static void bus_clk_recalc(struct clk *clk) 59static unsigned long bus_clk_recalc(struct clk *clk)
60{ 60{
61 int frqcr = ctrl_inw(FRQCR); 61 int frqcr = ctrl_inw(FRQCR);
62 int idx = (frqcr & 0x0080) ? 62 int idx = (frqcr & 0x0080) ?
63 ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4) : 1; 63 ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4) : 1;
64 64
65 clk->rate = clk->parent->rate * stc_multipliers[idx]; 65 return clk->parent->rate * stc_multipliers[idx];
66} 66}
67 67
68static struct clk_ops sh7709_bus_clk_ops = { 68static struct clk_ops sh7709_bus_clk_ops = {
69 .recalc = bus_clk_recalc, 69 .recalc = bus_clk_recalc,
70}; 70};
71 71
72static void cpu_clk_recalc(struct clk *clk) 72static unsigned long cpu_clk_recalc(struct clk *clk)
73{ 73{
74 int frqcr = ctrl_inw(FRQCR); 74 int frqcr = ctrl_inw(FRQCR);
75 int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2); 75 int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
76 76
77 clk->rate = clk->parent->rate / ifc_divisors[idx]; 77 return clk->parent->rate / ifc_divisors[idx];
78} 78}
79 79
80static struct clk_ops sh7709_cpu_clk_ops = { 80static struct clk_ops sh7709_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7710.c b/arch/sh/kernel/cpu/sh3/clock-sh7710.c
index 4744c50ec449..030a58ba18a5 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7710.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7710.c
@@ -33,30 +33,30 @@ static struct clk_ops sh7710_master_clk_ops = {
33 .init = master_clk_init, 33 .init = master_clk_init,
34}; 34};
35 35
36static void module_clk_recalc(struct clk *clk) 36static unsigned long module_clk_recalc(struct clk *clk)
37{ 37{
38 int idx = (ctrl_inw(FRQCR) & 0x0007); 38 int idx = (ctrl_inw(FRQCR) & 0x0007);
39 clk->rate = clk->parent->rate / md_table[idx]; 39 return clk->parent->rate / md_table[idx];
40} 40}
41 41
42static struct clk_ops sh7710_module_clk_ops = { 42static struct clk_ops sh7710_module_clk_ops = {
43 .recalc = module_clk_recalc, 43 .recalc = module_clk_recalc,
44}; 44};
45 45
46static void bus_clk_recalc(struct clk *clk) 46static unsigned long bus_clk_recalc(struct clk *clk)
47{ 47{
48 int idx = (ctrl_inw(FRQCR) & 0x0700) >> 8; 48 int idx = (ctrl_inw(FRQCR) & 0x0700) >> 8;
49 clk->rate = clk->parent->rate / md_table[idx]; 49 return clk->parent->rate / md_table[idx];
50} 50}
51 51
52static struct clk_ops sh7710_bus_clk_ops = { 52static struct clk_ops sh7710_bus_clk_ops = {
53 .recalc = bus_clk_recalc, 53 .recalc = bus_clk_recalc,
54}; 54};
55 55
56static void cpu_clk_recalc(struct clk *clk) 56static unsigned long cpu_clk_recalc(struct clk *clk)
57{ 57{
58 int idx = (ctrl_inw(FRQCR) & 0x0070) >> 4; 58 int idx = (ctrl_inw(FRQCR) & 0x0070) >> 4;
59 clk->rate = clk->parent->rate / md_table[idx]; 59 return clk->parent->rate / md_table[idx];
60} 60}
61 61
62static struct clk_ops sh7710_cpu_clk_ops = { 62static struct clk_ops sh7710_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7712.c b/arch/sh/kernel/cpu/sh3/clock-sh7712.c
index 54f54df51ef0..6428ee6c77ed 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7712.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7712.c
@@ -33,24 +33,24 @@ static struct clk_ops sh7712_master_clk_ops = {
33 .init = master_clk_init, 33 .init = master_clk_init,
34}; 34};
35 35
36static void module_clk_recalc(struct clk *clk) 36static unsigned long module_clk_recalc(struct clk *clk)
37{ 37{
38 int frqcr = ctrl_inw(FRQCR); 38 int frqcr = ctrl_inw(FRQCR);
39 int idx = frqcr & 0x0007; 39 int idx = frqcr & 0x0007;
40 40
41 clk->rate = clk->parent->rate / divisors[idx]; 41 return clk->parent->rate / divisors[idx];
42} 42}
43 43
44static struct clk_ops sh7712_module_clk_ops = { 44static struct clk_ops sh7712_module_clk_ops = {
45 .recalc = module_clk_recalc, 45 .recalc = module_clk_recalc,
46}; 46};
47 47
48static void cpu_clk_recalc(struct clk *clk) 48static unsigned long cpu_clk_recalc(struct clk *clk)
49{ 49{
50 int frqcr = ctrl_inw(FRQCR); 50 int frqcr = ctrl_inw(FRQCR);
51 int idx = (frqcr & 0x0030) >> 4; 51 int idx = (frqcr & 0x0030) >> 4;
52 52
53 clk->rate = clk->parent->rate / divisors[idx]; 53 return clk->parent->rate / divisors[idx];
54} 54}
55 55
56static struct clk_ops sh7712_cpu_clk_ops = { 56static struct clk_ops sh7712_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
index a33429463e96..628d50ea6f6b 100644
--- a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
+++ b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
@@ -21,10 +21,10 @@
21static int frqcr3_divisors[] = { 1, 2, 3, 4, 6, 8, 16 }; 21static int frqcr3_divisors[] = { 1, 2, 3, 4, 6, 8, 16 };
22static int frqcr3_values[] = { 0, 1, 2, 3, 4, 5, 6 }; 22static int frqcr3_values[] = { 0, 1, 2, 3, 4, 5, 6 };
23 23
24static void emi_clk_recalc(struct clk *clk) 24static unsigned long emi_clk_recalc(struct clk *clk)
25{ 25{
26 int idx = ctrl_inl(CPG2_FRQCR3) & 0x0007; 26 int idx = ctrl_inl(CPG2_FRQCR3) & 0x0007;
27 clk->rate = clk->parent->rate / frqcr3_divisors[idx]; 27 return clk->parent->rate / frqcr3_divisors[idx];
28} 28}
29 29
30static inline int frqcr3_lookup(struct clk *clk, unsigned long rate) 30static inline int frqcr3_lookup(struct clk *clk, unsigned long rate)
@@ -50,10 +50,10 @@ static struct clk sh4202_emi_clk = {
50 .ops = &sh4202_emi_clk_ops, 50 .ops = &sh4202_emi_clk_ops,
51}; 51};
52 52
53static void femi_clk_recalc(struct clk *clk) 53static unsigned long femi_clk_recalc(struct clk *clk)
54{ 54{
55 int idx = (ctrl_inl(CPG2_FRQCR3) >> 3) & 0x0007; 55 int idx = (ctrl_inl(CPG2_FRQCR3) >> 3) & 0x0007;
56 clk->rate = clk->parent->rate / frqcr3_divisors[idx]; 56 return clk->parent->rate / frqcr3_divisors[idx];
57} 57}
58 58
59static struct clk_ops sh4202_femi_clk_ops = { 59static struct clk_ops sh4202_femi_clk_ops = {
@@ -90,10 +90,10 @@ static void shoc_clk_init(struct clk *clk)
90 WARN_ON(i == ARRAY_SIZE(frqcr3_divisors)); /* Undefined clock */ 90 WARN_ON(i == ARRAY_SIZE(frqcr3_divisors)); /* Undefined clock */
91} 91}
92 92
93static void shoc_clk_recalc(struct clk *clk) 93static unsigned long shoc_clk_recalc(struct clk *clk)
94{ 94{
95 int idx = (ctrl_inl(CPG2_FRQCR3) >> 6) & 0x0007; 95 int idx = (ctrl_inl(CPG2_FRQCR3) >> 6) & 0x0007;
96 clk->rate = clk->parent->rate / frqcr3_divisors[idx]; 96 return clk->parent->rate / frqcr3_divisors[idx];
97} 97}
98 98
99static int shoc_clk_verify_rate(struct clk *clk, unsigned long rate) 99static int shoc_clk_verify_rate(struct clk *clk, unsigned long rate)
@@ -127,7 +127,7 @@ static int shoc_clk_set_rate(struct clk *clk, unsigned long rate, int algo_id)
127 frqcr3 |= tmp << 6; 127 frqcr3 |= tmp << 6;
128 ctrl_outl(frqcr3, CPG2_FRQCR3); 128 ctrl_outl(frqcr3, CPG2_FRQCR3);
129 129
130 clk->rate = clk->parent->rate / frqcr3_divisors[tmp]; 130 return clk->parent->rate / frqcr3_divisors[tmp];
131 131
132 return 0; 132 return 0;
133} 133}
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4.c b/arch/sh/kernel/cpu/sh4/clock-sh4.c
index dca9f87a12d6..73294d9cd049 100644
--- a/arch/sh/kernel/cpu/sh4/clock-sh4.c
+++ b/arch/sh/kernel/cpu/sh4/clock-sh4.c
@@ -35,30 +35,30 @@ static struct clk_ops sh4_master_clk_ops = {
35 .init = master_clk_init, 35 .init = master_clk_init,
36}; 36};
37 37
38static void module_clk_recalc(struct clk *clk) 38static unsigned long module_clk_recalc(struct clk *clk)
39{ 39{
40 int idx = (ctrl_inw(FRQCR) & 0x0007); 40 int idx = (ctrl_inw(FRQCR) & 0x0007);
41 clk->rate = clk->parent->rate / pfc_divisors[idx]; 41 return clk->parent->rate / pfc_divisors[idx];
42} 42}
43 43
44static struct clk_ops sh4_module_clk_ops = { 44static struct clk_ops sh4_module_clk_ops = {
45 .recalc = module_clk_recalc, 45 .recalc = module_clk_recalc,
46}; 46};
47 47
48static void bus_clk_recalc(struct clk *clk) 48static unsigned long bus_clk_recalc(struct clk *clk)
49{ 49{
50 int idx = (ctrl_inw(FRQCR) >> 3) & 0x0007; 50 int idx = (ctrl_inw(FRQCR) >> 3) & 0x0007;
51 clk->rate = clk->parent->rate / bfc_divisors[idx]; 51 return clk->parent->rate / bfc_divisors[idx];
52} 52}
53 53
54static struct clk_ops sh4_bus_clk_ops = { 54static struct clk_ops sh4_bus_clk_ops = {
55 .recalc = bus_clk_recalc, 55 .recalc = bus_clk_recalc,
56}; 56};
57 57
58static void cpu_clk_recalc(struct clk *clk) 58static unsigned long cpu_clk_recalc(struct clk *clk)
59{ 59{
60 int idx = (ctrl_inw(FRQCR) >> 6) & 0x0007; 60 int idx = (ctrl_inw(FRQCR) >> 6) & 0x0007;
61 clk->rate = clk->parent->rate / ifc_divisors[idx]; 61 return clk->parent->rate / ifc_divisors[idx];
62} 62}
63 63
64static struct clk_ops sh4_cpu_clk_ops = { 64static struct clk_ops sh4_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index 1ccdfc561fef..5b1427f1ed41 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -151,11 +151,11 @@ static int divisors2[] = { 4, 1, 8, 12, 16, 24, 32, 1, 48, 64, 72, 96, 1, 144 };
151static int divisors2[] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40 }; 151static int divisors2[] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40 };
152#endif 152#endif
153 153
154static void master_clk_recalc(struct clk *clk) 154static unsigned long master_clk_recalc(struct clk *clk)
155{ 155{
156 unsigned frqcr = ctrl_inl(FRQCR); 156 unsigned frqcr = ctrl_inl(FRQCR);
157 157
158 clk->rate = CONFIG_SH_PCLK_FREQ * STCPLL(frqcr); 158 return CONFIG_SH_PCLK_FREQ * STCPLL(frqcr);
159} 159}
160 160
161static void master_clk_init(struct clk *clk) 161static void master_clk_init(struct clk *clk)
@@ -166,12 +166,11 @@ static void master_clk_init(struct clk *clk)
166 master_clk_recalc(clk); 166 master_clk_recalc(clk);
167} 167}
168 168
169 169static unsigned long module_clk_recalc(struct clk *clk)
170static void module_clk_recalc(struct clk *clk)
171{ 170{
172 unsigned long frqcr = ctrl_inl(FRQCR); 171 unsigned long frqcr = ctrl_inl(FRQCR);
173 172
174 clk->rate = clk->parent->rate / STCPLL(frqcr); 173 return clk->parent->rate / STCPLL(frqcr);
175} 174}
176 175
177#if defined(CONFIG_CPU_SUBTYPE_SH7724) 176#if defined(CONFIG_CPU_SUBTYPE_SH7724)
@@ -283,14 +282,14 @@ static int sh7722_find_div_index(unsigned long parent_rate, unsigned rate)
283 return index; 282 return index;
284} 283}
285 284
286static void sh7722_frqcr_recalc(struct clk *clk) 285static unsigned long sh7722_frqcr_recalc(struct clk *clk)
287{ 286{
288 struct frqcr_context ctx = sh7722_get_clk_context(clk->name); 287 struct frqcr_context ctx = sh7722_get_clk_context(clk->name);
289 unsigned long frqcr = ctrl_inl(FRQCR); 288 unsigned long frqcr = ctrl_inl(FRQCR);
290 int index; 289 int index;
291 290
292 index = (frqcr >> ctx.shift) & ctx.mask; 291 index = (frqcr >> ctx.shift) & ctx.mask;
293 clk->rate = clk->parent->rate * 2 / divisors2[index]; 292 return clk->parent->rate * 2 / divisors2[index];
294} 293}
295 294
296static int sh7722_frqcr_set_rate(struct clk *clk, unsigned long rate, 295static int sh7722_frqcr_set_rate(struct clk *clk, unsigned long rate,
@@ -439,11 +438,8 @@ static struct clk_ops sh7722_frqcr_clk_ops = {
439 438
440/* 439/*
441 * clock ops methods for SIU A/B and IrDA clock 440 * clock ops methods for SIU A/B and IrDA clock
442 *
443 */ 441 */
444
445#ifndef CONFIG_CPU_SUBTYPE_SH7343 442#ifndef CONFIG_CPU_SUBTYPE_SH7343
446
447static int sh7722_siu_set_rate(struct clk *clk, unsigned long rate, int algo_id) 443static int sh7722_siu_set_rate(struct clk *clk, unsigned long rate, int algo_id)
448{ 444{
449 unsigned long r; 445 unsigned long r;
@@ -458,12 +454,12 @@ static int sh7722_siu_set_rate(struct clk *clk, unsigned long rate, int algo_id)
458 return 0; 454 return 0;
459} 455}
460 456
461static void sh7722_siu_recalc(struct clk *clk) 457static unsigned long sh7722_siu_recalc(struct clk *clk)
462{ 458{
463 unsigned long r; 459 unsigned long r;
464 460
465 r = ctrl_inl(clk->arch_flags); 461 r = ctrl_inl(clk->arch_flags);
466 clk->rate = clk->parent->rate * 2 / divisors2[r & 0xF]; 462 return clk->parent->rate * 2 / divisors2[r & 0xF];
467} 463}
468 464
469static int sh7722_siu_start_stop(struct clk *clk, int enable) 465static int sh7722_siu_start_stop(struct clk *clk, int enable)
@@ -525,12 +521,12 @@ static int sh7722_video_set_rate(struct clk *clk, unsigned long rate,
525 return 0; 521 return 0;
526} 522}
527 523
528static void sh7722_video_recalc(struct clk *clk) 524static unsigned long sh7722_video_recalc(struct clk *clk)
529{ 525{
530 unsigned long r; 526 unsigned long r;
531 527
532 r = ctrl_inl(VCLKCR); 528 r = ctrl_inl(VCLKCR);
533 clk->rate = clk->parent->rate / ((r & 0x3F) + 1); 529 return clk->parent->rate / ((r & 0x3F) + 1);
534} 530}
535 531
536static struct clk_ops sh7722_video_clk_ops = { 532static struct clk_ops sh7722_video_clk_ops = {
@@ -627,7 +623,7 @@ static int sh7722_mstpcr_start_stop(struct clk *clk, int enable)
627 break; 623 break;
628 default: 624 default:
629 return -EINVAL; 625 return -EINVAL;
630 } 626 }
631 627
632 r = ctrl_inl(reg); 628 r = ctrl_inl(reg);
633 629
@@ -650,10 +646,9 @@ static void sh7722_mstpcr_disable(struct clk *clk)
650 sh7722_mstpcr_start_stop(clk, 0); 646 sh7722_mstpcr_start_stop(clk, 0);
651} 647}
652 648
653static void sh7722_mstpcr_recalc(struct clk *clk) 649static unsigned long sh7722_mstpcr_recalc(struct clk *clk)
654{ 650{
655 if (clk->parent) 651 return clk->parent->rate;
656 clk->rate = clk->parent->rate;
657} 652}
658 653
659static struct clk_ops sh7722_mstpcr_clk_ops = { 654static struct clk_ops sh7722_mstpcr_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
index 3177d0d1e06d..26630fb190c7 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
@@ -29,29 +29,29 @@ static struct clk_ops sh7763_master_clk_ops = {
29 .init = master_clk_init, 29 .init = master_clk_init,
30}; 30};
31 31
32static void module_clk_recalc(struct clk *clk) 32static unsigned long module_clk_recalc(struct clk *clk)
33{ 33{
34 int idx = ((ctrl_inl(FRQCR) >> 4) & 0x07); 34 int idx = ((ctrl_inl(FRQCR) >> 4) & 0x07);
35 clk->rate = clk->parent->rate / p0fc_divisors[idx]; 35 return clk->parent->rate / p0fc_divisors[idx];
36} 36}
37 37
38static struct clk_ops sh7763_module_clk_ops = { 38static struct clk_ops sh7763_module_clk_ops = {
39 .recalc = module_clk_recalc, 39 .recalc = module_clk_recalc,
40}; 40};
41 41
42static void bus_clk_recalc(struct clk *clk) 42static unsigned long bus_clk_recalc(struct clk *clk)
43{ 43{
44 int idx = ((ctrl_inl(FRQCR) >> 16) & 0x07); 44 int idx = ((ctrl_inl(FRQCR) >> 16) & 0x07);
45 clk->rate = clk->parent->rate / bfc_divisors[idx]; 45 return clk->parent->rate / bfc_divisors[idx];
46} 46}
47 47
48static struct clk_ops sh7763_bus_clk_ops = { 48static struct clk_ops sh7763_bus_clk_ops = {
49 .recalc = bus_clk_recalc, 49 .recalc = bus_clk_recalc,
50}; 50};
51 51
52static void cpu_clk_recalc(struct clk *clk) 52static unsigned long cpu_clk_recalc(struct clk *clk)
53{ 53{
54 clk->rate = clk->parent->rate; 54 return clk->parent->rate;
55} 55}
56 56
57static struct clk_ops sh7763_cpu_clk_ops = { 57static struct clk_ops sh7763_cpu_clk_ops = {
@@ -71,10 +71,10 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
71 *ops = sh7763_clk_ops[idx]; 71 *ops = sh7763_clk_ops[idx];
72} 72}
73 73
74static void shyway_clk_recalc(struct clk *clk) 74static unsigned long shyway_clk_recalc(struct clk *clk)
75{ 75{
76 int idx = ((ctrl_inl(FRQCR) >> 20) & 0x07); 76 int idx = ((ctrl_inl(FRQCR) >> 20) & 0x07);
77 clk->rate = clk->parent->rate / cfc_divisors[idx]; 77 return clk->parent->rate / cfc_divisors[idx];
78} 78}
79 79
80static struct clk_ops sh7763_shyway_clk_ops = { 80static struct clk_ops sh7763_shyway_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7770.c b/arch/sh/kernel/cpu/sh4a/clock-sh7770.c
index 8e236062c721..e0b896769205 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7770.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7770.c
@@ -28,30 +28,30 @@ static struct clk_ops sh7770_master_clk_ops = {
28 .init = master_clk_init, 28 .init = master_clk_init,
29}; 29};
30 30
31static void module_clk_recalc(struct clk *clk) 31static unsigned long module_clk_recalc(struct clk *clk)
32{ 32{
33 int idx = ((ctrl_inl(FRQCR) >> 28) & 0x000f); 33 int idx = ((ctrl_inl(FRQCR) >> 28) & 0x000f);
34 clk->rate = clk->parent->rate / pfc_divisors[idx]; 34 return clk->parent->rate / pfc_divisors[idx];
35} 35}
36 36
37static struct clk_ops sh7770_module_clk_ops = { 37static struct clk_ops sh7770_module_clk_ops = {
38 .recalc = module_clk_recalc, 38 .recalc = module_clk_recalc,
39}; 39};
40 40
41static void bus_clk_recalc(struct clk *clk) 41static unsigned long bus_clk_recalc(struct clk *clk)
42{ 42{
43 int idx = (ctrl_inl(FRQCR) & 0x000f); 43 int idx = (ctrl_inl(FRQCR) & 0x000f);
44 clk->rate = clk->parent->rate / bfc_divisors[idx]; 44 return clk->parent->rate / bfc_divisors[idx];
45} 45}
46 46
47static struct clk_ops sh7770_bus_clk_ops = { 47static struct clk_ops sh7770_bus_clk_ops = {
48 .recalc = bus_clk_recalc, 48 .recalc = bus_clk_recalc,
49}; 49};
50 50
51static void cpu_clk_recalc(struct clk *clk) 51static unsigned long cpu_clk_recalc(struct clk *clk)
52{ 52{
53 int idx = ((ctrl_inl(FRQCR) >> 24) & 0x000f); 53 int idx = ((ctrl_inl(FRQCR) >> 24) & 0x000f);
54 clk->rate = clk->parent->rate / ifc_divisors[idx]; 54 return clk->parent->rate / ifc_divisors[idx];
55} 55}
56 56
57static struct clk_ops sh7770_cpu_clk_ops = { 57static struct clk_ops sh7770_cpu_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7780.c b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
index 01f3da619d3d..ba8dacc4ba23 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
@@ -29,30 +29,30 @@ static struct clk_ops sh7780_master_clk_ops = {
29 .init = master_clk_init, 29 .init = master_clk_init,
30}; 30};
31 31
32static void module_clk_recalc(struct clk *clk) 32static unsigned long module_clk_recalc(struct clk *clk)
33{ 33{
34 int idx = (ctrl_inl(FRQCR) & 0x0003); 34 int idx = (ctrl_inl(FRQCR) & 0x0003);
35 clk->rate = clk->parent->rate / pfc_divisors[idx]; 35 return clk->parent->rate / pfc_divisors[idx];
36} 36}
37 37
38static struct clk_ops sh7780_module_clk_ops = { 38static struct clk_ops sh7780_module_clk_ops = {
39 .recalc = module_clk_recalc, 39 .recalc = module_clk_recalc,
40}; 40};
41 41
42static void bus_clk_recalc(struct clk *clk) 42static unsigned long bus_clk_recalc(struct clk *clk)
43{ 43{
44 int idx = ((ctrl_inl(FRQCR) >> 16) & 0x0007); 44 int idx = ((ctrl_inl(FRQCR) >> 16) & 0x0007);
45 clk->rate = clk->parent->rate / bfc_divisors[idx]; 45 return clk->parent->rate / bfc_divisors[idx];
46} 46}
47 47
48static struct clk_ops sh7780_bus_clk_ops = { 48static struct clk_ops sh7780_bus_clk_ops = {
49 .recalc = bus_clk_recalc, 49 .recalc = bus_clk_recalc,
50}; 50};
51 51
52static void cpu_clk_recalc(struct clk *clk) 52static unsigned long cpu_clk_recalc(struct clk *clk)
53{ 53{
54 int idx = ((ctrl_inl(FRQCR) >> 24) & 0x0001); 54 int idx = ((ctrl_inl(FRQCR) >> 24) & 0x0001);
55 clk->rate = clk->parent->rate / ifc_divisors[idx]; 55 return clk->parent->rate / ifc_divisors[idx];
56} 56}
57 57
58static struct clk_ops sh7780_cpu_clk_ops = { 58static struct clk_ops sh7780_cpu_clk_ops = {
@@ -72,10 +72,10 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
72 *ops = sh7780_clk_ops[idx]; 72 *ops = sh7780_clk_ops[idx];
73} 73}
74 74
75static void shyway_clk_recalc(struct clk *clk) 75static unsigned long shyway_clk_recalc(struct clk *clk)
76{ 76{
77 int idx = ((ctrl_inl(FRQCR) >> 20) & 0x0007); 77 int idx = ((ctrl_inl(FRQCR) >> 20) & 0x0007);
78 clk->rate = clk->parent->rate / cfc_divisors[idx]; 78 return clk->parent->rate / cfc_divisors[idx];
79} 79}
80 80
81static struct clk_ops sh7780_shyway_clk_ops = { 81static struct clk_ops sh7780_shyway_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
index 27fa81bef6a0..52691eaeb9ba 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
@@ -33,30 +33,30 @@ static struct clk_ops sh7785_master_clk_ops = {
33 .init = master_clk_init, 33 .init = master_clk_init,
34}; 34};
35 35
36static void module_clk_recalc(struct clk *clk) 36static unsigned long module_clk_recalc(struct clk *clk)
37{ 37{
38 int idx = (ctrl_inl(FRQMR1) & 0x000f); 38 int idx = (ctrl_inl(FRQMR1) & 0x000f);
39 clk->rate = clk->parent->rate / pfc_divisors[idx]; 39 return clk->parent->rate / pfc_divisors[idx];
40} 40}
41 41
42static struct clk_ops sh7785_module_clk_ops = { 42static struct clk_ops sh7785_module_clk_ops = {
43 .recalc = module_clk_recalc, 43 .recalc = module_clk_recalc,
44}; 44};
45 45
46static void bus_clk_recalc(struct clk *clk) 46static unsigned long bus_clk_recalc(struct clk *clk)
47{ 47{
48 int idx = ((ctrl_inl(FRQMR1) >> 16) & 0x000f); 48 int idx = ((ctrl_inl(FRQMR1) >> 16) & 0x000f);
49 clk->rate = clk->parent->rate / bfc_divisors[idx]; 49 return clk->parent->rate / bfc_divisors[idx];
50} 50}
51 51
52static struct clk_ops sh7785_bus_clk_ops = { 52static struct clk_ops sh7785_bus_clk_ops = {
53 .recalc = bus_clk_recalc, 53 .recalc = bus_clk_recalc,
54}; 54};
55 55
56static void cpu_clk_recalc(struct clk *clk) 56static unsigned long cpu_clk_recalc(struct clk *clk)
57{ 57{
58 int idx = ((ctrl_inl(FRQMR1) >> 28) & 0x0003); 58 int idx = ((ctrl_inl(FRQMR1) >> 28) & 0x0003);
59 clk->rate = clk->parent->rate / ifc_divisors[idx]; 59 return clk->parent->rate / ifc_divisors[idx];
60} 60}
61 61
62static struct clk_ops sh7785_cpu_clk_ops = { 62static struct clk_ops sh7785_cpu_clk_ops = {
@@ -76,10 +76,10 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
76 *ops = sh7785_clk_ops[idx]; 76 *ops = sh7785_clk_ops[idx];
77} 77}
78 78
79static void shyway_clk_recalc(struct clk *clk) 79static unsigned long shyway_clk_recalc(struct clk *clk)
80{ 80{
81 int idx = ((ctrl_inl(FRQMR1) >> 20) & 0x0003); 81 int idx = ((ctrl_inl(FRQMR1) >> 20) & 0x0003);
82 clk->rate = clk->parent->rate / sfc_divisors[idx]; 82 return clk->parent->rate / sfc_divisors[idx];
83} 83}
84 84
85static struct clk_ops sh7785_shyway_clk_ops = { 85static struct clk_ops sh7785_shyway_clk_ops = {
@@ -92,10 +92,10 @@ static struct clk sh7785_shyway_clk = {
92 .ops = &sh7785_shyway_clk_ops, 92 .ops = &sh7785_shyway_clk_ops,
93}; 93};
94 94
95static void ddr_clk_recalc(struct clk *clk) 95static unsigned long ddr_clk_recalc(struct clk *clk)
96{ 96{
97 int idx = ((ctrl_inl(FRQMR1) >> 12) & 0x0003); 97 int idx = ((ctrl_inl(FRQMR1) >> 12) & 0x0003);
98 clk->rate = clk->parent->rate / mfc_divisors[idx]; 98 return clk->parent->rate / mfc_divisors[idx];
99} 99}
100 100
101static struct clk_ops sh7785_ddr_clk_ops = { 101static struct clk_ops sh7785_ddr_clk_ops = {
@@ -108,10 +108,10 @@ static struct clk sh7785_ddr_clk = {
108 .ops = &sh7785_ddr_clk_ops, 108 .ops = &sh7785_ddr_clk_ops,
109}; 109};
110 110
111static void ram_clk_recalc(struct clk *clk) 111static unsigned long ram_clk_recalc(struct clk *clk)
112{ 112{
113 int idx = ((ctrl_inl(FRQMR1) >> 24) & 0x0003); 113 int idx = ((ctrl_inl(FRQMR1) >> 24) & 0x0003);
114 clk->rate = clk->parent->rate / ufc_divisors[idx]; 114 return clk->parent->rate / ufc_divisors[idx];
115} 115}
116 116
117static struct clk_ops sh7785_ram_clk_ops = { 117static struct clk_ops sh7785_ram_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
index f84a9c134471..2e00ff436c63 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
@@ -36,30 +36,30 @@ static struct clk_ops sh7786_master_clk_ops = {
36 .init = master_clk_init, 36 .init = master_clk_init,
37}; 37};
38 38
39static void module_clk_recalc(struct clk *clk) 39static unsigned long module_clk_recalc(struct clk *clk)
40{ 40{
41 int idx = (ctrl_inl(FRQMR1) & 0x000f); 41 int idx = (ctrl_inl(FRQMR1) & 0x000f);
42 clk->rate = clk->parent->rate / pfc_divisors[idx]; 42 return clk->parent->rate / pfc_divisors[idx];
43} 43}
44 44
45static struct clk_ops sh7786_module_clk_ops = { 45static struct clk_ops sh7786_module_clk_ops = {
46 .recalc = module_clk_recalc, 46 .recalc = module_clk_recalc,
47}; 47};
48 48
49static void bus_clk_recalc(struct clk *clk) 49static unsigned long bus_clk_recalc(struct clk *clk)
50{ 50{
51 int idx = ((ctrl_inl(FRQMR1) >> 16) & 0x000f); 51 int idx = ((ctrl_inl(FRQMR1) >> 16) & 0x000f);
52 clk->rate = clk->parent->rate / bfc_divisors[idx]; 52 return clk->parent->rate / bfc_divisors[idx];
53} 53}
54 54
55static struct clk_ops sh7786_bus_clk_ops = { 55static struct clk_ops sh7786_bus_clk_ops = {
56 .recalc = bus_clk_recalc, 56 .recalc = bus_clk_recalc,
57}; 57};
58 58
59static void cpu_clk_recalc(struct clk *clk) 59static unsigned long cpu_clk_recalc(struct clk *clk)
60{ 60{
61 int idx = ((ctrl_inl(FRQMR1) >> 28) & 0x0003); 61 int idx = ((ctrl_inl(FRQMR1) >> 28) & 0x0003);
62 clk->rate = clk->parent->rate / ifc_divisors[idx]; 62 return clk->parent->rate / ifc_divisors[idx];
63} 63}
64 64
65static struct clk_ops sh7786_cpu_clk_ops = { 65static struct clk_ops sh7786_cpu_clk_ops = {
@@ -79,10 +79,10 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
79 *ops = sh7786_clk_ops[idx]; 79 *ops = sh7786_clk_ops[idx];
80} 80}
81 81
82static void shyway_clk_recalc(struct clk *clk) 82static unsigned long shyway_clk_recalc(struct clk *clk)
83{ 83{
84 int idx = ((ctrl_inl(FRQMR1) >> 20) & 0x0003); 84 int idx = ((ctrl_inl(FRQMR1) >> 20) & 0x0003);
85 clk->rate = clk->parent->rate / sfc_divisors[idx]; 85 return clk->parent->rate / sfc_divisors[idx];
86} 86}
87 87
88static struct clk_ops sh7786_shyway_clk_ops = { 88static struct clk_ops sh7786_shyway_clk_ops = {
@@ -95,10 +95,10 @@ static struct clk sh7786_shyway_clk = {
95 .ops = &sh7786_shyway_clk_ops, 95 .ops = &sh7786_shyway_clk_ops,
96}; 96};
97 97
98static void ddr_clk_recalc(struct clk *clk) 98static unsigned long ddr_clk_recalc(struct clk *clk)
99{ 99{
100 int idx = ((ctrl_inl(FRQMR1) >> 12) & 0x0003); 100 int idx = ((ctrl_inl(FRQMR1) >> 12) & 0x0003);
101 clk->rate = clk->parent->rate / mfc_divisors[idx]; 101 return clk->parent->rate / mfc_divisors[idx];
102} 102}
103 103
104static struct clk_ops sh7786_ddr_clk_ops = { 104static struct clk_ops sh7786_ddr_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh4a/clock-shx3.c b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
index c630b29e06a8..770934e68281 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
@@ -40,30 +40,30 @@ static struct clk_ops shx3_master_clk_ops = {
40 .init = master_clk_init, 40 .init = master_clk_init,
41}; 41};
42 42
43static void module_clk_recalc(struct clk *clk) 43static unsigned long module_clk_recalc(struct clk *clk)
44{ 44{
45 int idx = ((ctrl_inl(FRQCR) >> PFC_POS) & PFC_MSK); 45 int idx = ((ctrl_inl(FRQCR) >> PFC_POS) & PFC_MSK);
46 clk->rate = clk->parent->rate / pfc_divisors[idx]; 46 return clk->parent->rate / pfc_divisors[idx];
47} 47}
48 48
49static struct clk_ops shx3_module_clk_ops = { 49static struct clk_ops shx3_module_clk_ops = {
50 .recalc = module_clk_recalc, 50 .recalc = module_clk_recalc,
51}; 51};
52 52
53static void bus_clk_recalc(struct clk *clk) 53static unsigned long bus_clk_recalc(struct clk *clk)
54{ 54{
55 int idx = ((ctrl_inl(FRQCR) >> BFC_POS) & BFC_MSK); 55 int idx = ((ctrl_inl(FRQCR) >> BFC_POS) & BFC_MSK);
56 clk->rate = clk->parent->rate / bfc_divisors[idx]; 56 return clk->parent->rate / bfc_divisors[idx];
57} 57}
58 58
59static struct clk_ops shx3_bus_clk_ops = { 59static struct clk_ops shx3_bus_clk_ops = {
60 .recalc = bus_clk_recalc, 60 .recalc = bus_clk_recalc,
61}; 61};
62 62
63static void cpu_clk_recalc(struct clk *clk) 63static unsigned long cpu_clk_recalc(struct clk *clk)
64{ 64{
65 int idx = ((ctrl_inl(FRQCR) >> IFC_POS) & IFC_MSK); 65 int idx = ((ctrl_inl(FRQCR) >> IFC_POS) & IFC_MSK);
66 clk->rate = clk->parent->rate / ifc_divisors[idx]; 66 return clk->parent->rate / ifc_divisors[idx];
67} 67}
68 68
69static struct clk_ops shx3_cpu_clk_ops = { 69static struct clk_ops shx3_cpu_clk_ops = {
@@ -83,10 +83,10 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
83 *ops = shx3_clk_ops[idx]; 83 *ops = shx3_clk_ops[idx];
84} 84}
85 85
86static void shyway_clk_recalc(struct clk *clk) 86static unsigned long shyway_clk_recalc(struct clk *clk)
87{ 87{
88 int idx = ((ctrl_inl(FRQCR) >> CFC_POS) & CFC_MSK); 88 int idx = ((ctrl_inl(FRQCR) >> CFC_POS) & CFC_MSK);
89 clk->rate = clk->parent->rate / cfc_divisors[idx]; 89 return clk->parent->rate / cfc_divisors[idx];
90} 90}
91 91
92static struct clk_ops shx3_shyway_clk_ops = { 92static struct clk_ops shx3_shyway_clk_ops = {
diff --git a/arch/sh/kernel/cpu/sh5/clock-sh5.c b/arch/sh/kernel/cpu/sh5/clock-sh5.c
index 5486324880e1..7f864ebc51d3 100644
--- a/arch/sh/kernel/cpu/sh5/clock-sh5.c
+++ b/arch/sh/kernel/cpu/sh5/clock-sh5.c
@@ -32,30 +32,30 @@ static struct clk_ops sh5_master_clk_ops = {
32 .init = master_clk_init, 32 .init = master_clk_init,
33}; 33};
34 34
35static void module_clk_recalc(struct clk *clk) 35static unsigned long module_clk_recalc(struct clk *clk)
36{ 36{
37 int idx = (ctrl_inw(cprc_base) >> 12) & 0x0007; 37 int idx = (ctrl_inw(cprc_base) >> 12) & 0x0007;
38 clk->rate = clk->parent->rate / ifc_table[idx]; 38 return clk->parent->rate / ifc_table[idx];
39} 39}
40 40
41static struct clk_ops sh5_module_clk_ops = { 41static struct clk_ops sh5_module_clk_ops = {
42 .recalc = module_clk_recalc, 42 .recalc = module_clk_recalc,
43}; 43};
44 44
45static void bus_clk_recalc(struct clk *clk) 45static unsigned long bus_clk_recalc(struct clk *clk)
46{ 46{
47 int idx = (ctrl_inw(cprc_base) >> 3) & 0x0007; 47 int idx = (ctrl_inw(cprc_base) >> 3) & 0x0007;
48 clk->rate = clk->parent->rate / ifc_table[idx]; 48 return clk->parent->rate / ifc_table[idx];
49} 49}
50 50
51static struct clk_ops sh5_bus_clk_ops = { 51static struct clk_ops sh5_bus_clk_ops = {
52 .recalc = bus_clk_recalc, 52 .recalc = bus_clk_recalc,
53}; 53};
54 54
55static void cpu_clk_recalc(struct clk *clk) 55static unsigned long cpu_clk_recalc(struct clk *clk)
56{ 56{
57 int idx = (ctrl_inw(cprc_base) & 0x0007); 57 int idx = (ctrl_inw(cprc_base) & 0x0007);
58 clk->rate = clk->parent->rate / ifc_table[idx]; 58 return clk->parent->rate / ifc_table[idx];
59} 59}
60 60
61static struct clk_ops sh5_cpu_clk_ops = { 61static struct clk_ops sh5_cpu_clk_ops = {
diff --git a/arch/sh/kernel/timers/timer-tmu.c b/arch/sh/kernel/timers/timer-tmu.c
index fe8d8930ccb6..a693dcdbe13e 100644
--- a/arch/sh/kernel/timers/timer-tmu.c
+++ b/arch/sh/kernel/timers/timer-tmu.c
@@ -172,22 +172,19 @@ static void __init tmu_clk_init(struct clk *clk)
172 clk->rate = clk_get_rate(clk->parent) / (4 << (divisor << 1)); 172 clk->rate = clk_get_rate(clk->parent) / (4 << (divisor << 1));
173} 173}
174 174
175static void tmu_clk_recalc(struct clk *clk) 175static unsigned long tmu_clk_recalc(struct clk *clk)
176{ 176{
177 int tmu_num = clk->name[3]-'0'; 177 int tmu_num = clk->name[3]-'0';
178 unsigned long prev_rate = clk_get_rate(clk); 178 unsigned long new_rate;
179 unsigned long flags; 179 unsigned long flags;
180 u8 divisor = ctrl_inw(TMU0_TCR+tmu_num*0xC) & 0x7; 180 u8 divisor = ctrl_inw(TMU0_TCR+tmu_num*0xC) & 0x7;
181 clk->rate = clk_get_rate(clk->parent) / (4 << (divisor << 1));
182 181
183 if(prev_rate==clk_get_rate(clk)) 182 new_rate = clk_get_rate(clk->parent) / (4 << (divisor << 1));
184 return; 183 if (clk->rate == new_rate || tmu_num)
185 184 return clk->rate; /* No more work on TMU1 */
186 if(tmu_num)
187 return; /* No more work on TMU1 */
188 185
189 local_irq_save(flags); 186 local_irq_save(flags);
190 tmus_are_scaled = (prev_rate > clk->rate); 187 tmus_are_scaled = (clk->rate > new_rate);
191 188
192 _tmu_stop(TMU0); 189 _tmu_stop(TMU0);
193 190
@@ -210,6 +207,7 @@ static void tmu_clk_recalc(struct clk *clk)
210 _tmu_start(TMU0); 207 _tmu_start(TMU0);
211 208
212 local_irq_restore(flags); 209 local_irq_restore(flags);
210 return new_rate;
213} 211}
214 212
215static struct clk_ops tmu_clk_ops = { 213static struct clk_ops tmu_clk_ops = {