]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sh: clkfwk: Make recalc return an unsigned long.
authorPaul Mundt <lethal@linux-sh.org>
Mon, 11 May 2009 18:45:08 +0000 (03:45 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 11 May 2009 18:45:08 +0000 (03:45 +0900)
This is prep work for cleaning up some of the rate propagation bits.
Trivial conversion.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
23 files changed:
arch/sh/include/asm/clock.h
arch/sh/kernel/cpu/clock.c
arch/sh/kernel/cpu/sh2/clock-sh7619.c
arch/sh/kernel/cpu/sh2a/clock-sh7201.c
arch/sh/kernel/cpu/sh2a/clock-sh7203.c
arch/sh/kernel/cpu/sh2a/clock-sh7206.c
arch/sh/kernel/cpu/sh3/clock-sh3.c
arch/sh/kernel/cpu/sh3/clock-sh7705.c
arch/sh/kernel/cpu/sh3/clock-sh7706.c
arch/sh/kernel/cpu/sh3/clock-sh7709.c
arch/sh/kernel/cpu/sh3/clock-sh7710.c
arch/sh/kernel/cpu/sh3/clock-sh7712.c
arch/sh/kernel/cpu/sh4/clock-sh4-202.c
arch/sh/kernel/cpu/sh4/clock-sh4.c
arch/sh/kernel/cpu/sh4a/clock-sh7722.c
arch/sh/kernel/cpu/sh4a/clock-sh7763.c
arch/sh/kernel/cpu/sh4a/clock-sh7770.c
arch/sh/kernel/cpu/sh4a/clock-sh7780.c
arch/sh/kernel/cpu/sh4a/clock-sh7785.c
arch/sh/kernel/cpu/sh4a/clock-sh7786.c
arch/sh/kernel/cpu/sh4a/clock-shx3.c
arch/sh/kernel/cpu/sh5/clock-sh5.c
arch/sh/kernel/timers/timer-tmu.c

index b1f29199e4bd29a29cadd1010f727fda73fe0f2f..d63352b375ccafd0a8a1e571c63923edc056c0a1 100644 (file)
@@ -12,7 +12,7 @@ struct clk_ops {
        void (*init)(struct clk *clk);
        void (*enable)(struct clk *clk);
        void (*disable)(struct clk *clk);
-       void (*recalc)(struct clk *clk);
+       unsigned long (*recalc)(struct clk *clk);
        int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
        int (*set_parent)(struct clk *clk, struct clk *parent);
        long (*round_rate)(struct clk *clk, unsigned long rate);
@@ -96,4 +96,5 @@ enum clk_sh_algo_id {
 
        IP_N1,
 };
+
 #endif /* __ASM_SH_CLOCK_H */
index 133dbe4033412e7c017a4dd6b2b1a5ea096645e8..b022affb44cdb97a2296aa19fd93508ead0a7449 100644 (file)
@@ -75,6 +75,7 @@ static struct clk *onchip_clocks[] = {
        &cpu_clk,
 };
 
+/* Propagate rate to children */
 static void propagate_rate(struct clk *clk)
 {
        struct clk *clkp;
@@ -83,7 +84,7 @@ static void propagate_rate(struct clk *clk)
                if (likely(clkp->parent != clk))
                        continue;
                if (likely(clkp->ops && clkp->ops->recalc))
-                       clkp->ops->recalc(clkp);
+                       clkp->rate = clkp->ops->recalc(clkp);
                if (unlikely(clkp->flags & CLK_RATE_PROPAGATES))
                        propagate_rate(clkp);
        }
@@ -240,7 +241,7 @@ void clk_recalc_rate(struct clk *clk)
                unsigned long flags;
 
                spin_lock_irqsave(&clock_lock, flags);
-               clk->ops->recalc(clk);
+               clk->rate = clk->ops->recalc(clk);
                spin_unlock_irqrestore(&clock_lock, flags);
        }
 
@@ -377,20 +378,22 @@ static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state)
        switch (state.event) {
        case PM_EVENT_ON:
                /* Resumeing from hibernation */
-               if (prev_state.event == PM_EVENT_FREEZE) {
-                       list_for_each_entry(clkp, &clock_list, node)
-                               if (likely(clkp->ops)) {
-                                       unsigned long rate = clkp->rate;
-
-                                       if (likely(clkp->ops->set_parent))
-                                               clkp->ops->set_parent(clkp,
-                                                       clkp->parent);
-                                       if (likely(clkp->ops->set_rate))
-                                               clkp->ops->set_rate(clkp,
-                                                       rate, NO_CHANGE);
-                                       else if (likely(clkp->ops->recalc))
-                                               clkp->ops->recalc(clkp);
-                                       }
+               if (prev_state.event != PM_EVENT_FREEZE)
+                       break;
+
+               list_for_each_entry(clkp, &clock_list, node) {
+                       if (likely(clkp->ops)) {
+                               unsigned long rate = clkp->rate;
+
+                               if (likely(clkp->ops->set_parent))
+                                       clkp->ops->set_parent(clkp,
+                                               clkp->parent);
+                               if (likely(clkp->ops->set_rate))
+                                       clkp->ops->set_rate(clkp,
+                                               rate, NO_CHANGE);
+                               else if (likely(clkp->ops->recalc))
+                                       clkp->rate = clkp->ops->recalc(clkp);
+                       }
                }
                break;
        case PM_EVENT_FREEZE:
index d2c157917999870078cc79c6b2bdaf431cac76d6..26799139aa7a3b3dd9d336cb022b78f16eda8f59 100644 (file)
@@ -38,28 +38,28 @@ static struct clk_ops sh7619_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FREQCR) & 0x0007);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7619_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       clk->rate = clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 7];
+       return clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 7];
 }
 
 static struct clk_ops sh7619_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       clk->rate = clk->parent->rate;
+       return clk->parent->rate;
 }
 
 static struct clk_ops sh7619_cpu_clk_ops = {
@@ -78,4 +78,3 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
        if (idx < ARRAY_SIZE(sh7619_clk_ops))
                *ops = sh7619_clk_ops[idx];
 }
-
index 4a5e59732334ca70782a167c5eccaf4e133b9ffd..7814c76159a7299fdcd512bf7d62b1cf8ce782a7 100644 (file)
@@ -34,37 +34,37 @@ static const int pfc_divisors[]={1,2,3,4,6,8,12};
 
 static void master_clk_init(struct clk *clk)
 {
-       clk->rate = 10000000 * PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
+       return 10000000 * PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
 }
 
 static struct clk_ops sh7201_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FREQCR) & 0x0007);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7201_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FREQCR) & 0x0007);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7201_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inw(FREQCR) >> 4) & 0x0007);
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh7201_cpu_clk_ops = {
index fb781329848af930b22290d452fe99a8fdc7a169..f8c6933857b3dd62cf65d92ae642fad186f733bc 100644 (file)
@@ -46,29 +46,29 @@ static struct clk_ops sh7203_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FREQCR) & 0x0007);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7203_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FREQCR) & 0x0007);
-       clk->rate = clk->parent->rate / pfc_divisors[idx-2];
+       return clk->parent->rate / pfc_divisors[idx-2];
 }
 
 static struct clk_ops sh7203_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       clk->rate = clk->parent->rate;
+       return clk->parent->rate;
 }
 
 static struct clk_ops sh7203_cpu_clk_ops = {
index 82d7f991ef6bd8acb3da60c2238b18c69ebc616a..c2268bdeceeb80a30d6522041e40433b5f2518bb 100644 (file)
@@ -41,29 +41,29 @@ static struct clk_ops sh7206_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FREQCR) & 0x0007);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7206_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
-       clk->rate = clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
+       return clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
 }
 
 static struct clk_ops sh7206_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FREQCR) & 0x0007);
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh7206_cpu_clk_ops = {
index c3c945958baf6f74472a28a8d49750cbc2632133..27b8738f0b0986d5b255e5cfe2b63dc4b33d13c1 100644 (file)
@@ -38,36 +38,36 @@ static struct clk_ops sh3_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
 
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh3_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4);
 
-       clk->rate = clk->parent->rate / stc_multipliers[idx];
+       return clk->parent->rate / stc_multipliers[idx];
 }
 
 static struct clk_ops sh3_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
 
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh3_cpu_clk_ops = {
index dfdbf3277fd7dda3b73b4244fc55a73c3078a70a..0ca8f2c3646c558be6bbf8c9da0ed64cc25e2b54 100644 (file)
@@ -39,30 +39,30 @@ static struct clk_ops sh7705_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = ctrl_inw(FRQCR) & 0x0003;
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7705_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FRQCR) & 0x0300) >> 8;
-       clk->rate = clk->parent->rate / stc_multipliers[idx];
+       return clk->parent->rate / stc_multipliers[idx];
 }
 
 static struct clk_ops sh7705_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FRQCR) & 0x0030) >> 4;
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh7705_cpu_clk_ops = {
index 0cf96f9833bcbceaa1e09c25e84ac02061114a97..4bf7887d310af2cf1b59bc1088ab52835279bf37 100644 (file)
@@ -34,36 +34,36 @@ static struct clk_ops sh7706_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
 
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7706_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4);
 
-       clk->rate = clk->parent->rate / stc_multipliers[idx];
+       return clk->parent->rate / stc_multipliers[idx];
 }
 
 static struct clk_ops sh7706_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
 
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh7706_cpu_clk_ops = {
index b791a29fdb6245773c045eb55ab5e39e2e830e79..fa30b601773040d6246071e3dce54fdc1abaad61 100644 (file)
@@ -41,12 +41,12 @@ static struct clk_ops sh7709_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
 
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7709_module_clk_ops = {
@@ -56,25 +56,25 @@ static struct clk_ops sh7709_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = (frqcr & 0x0080) ?
                ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4) : 1;
 
-       clk->rate = clk->parent->rate * stc_multipliers[idx];
+       return clk->parent->rate * stc_multipliers[idx];
 }
 
 static struct clk_ops sh7709_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
 
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh7709_cpu_clk_ops = {
index 4744c50ec449cd61a97d04e725bfe5662b7209b2..030a58ba18a5070c6c36ce50c01d4e18a2fcca49 100644 (file)
@@ -33,30 +33,30 @@ static struct clk_ops sh7710_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FRQCR) & 0x0007);
-       clk->rate = clk->parent->rate / md_table[idx];
+       return clk->parent->rate / md_table[idx];
 }
 
 static struct clk_ops sh7710_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FRQCR) & 0x0700) >> 8;
-       clk->rate = clk->parent->rate / md_table[idx];
+       return clk->parent->rate / md_table[idx];
 }
 
 static struct clk_ops sh7710_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FRQCR) & 0x0070) >> 4;
-       clk->rate = clk->parent->rate / md_table[idx];
+       return clk->parent->rate / md_table[idx];
 }
 
 static struct clk_ops sh7710_cpu_clk_ops = {
index 54f54df51ef0e4eb08b6adcd62836222f8ed6627..6428ee6c77edc4c028d5b6ecd21437993a92ce8b 100644 (file)
@@ -33,24 +33,24 @@ static struct clk_ops sh7712_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = frqcr & 0x0007;
 
-       clk->rate = clk->parent->rate / divisors[idx];
+       return clk->parent->rate / divisors[idx];
 }
 
 static struct clk_ops sh7712_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int frqcr = ctrl_inw(FRQCR);
        int idx = (frqcr & 0x0030) >> 4;
 
-       clk->rate = clk->parent->rate / divisors[idx];
+       return clk->parent->rate / divisors[idx];
 }
 
 static struct clk_ops sh7712_cpu_clk_ops = {
index a33429463e96cd0c758b9f05f631a5d610025d6e..628d50ea6f6bf6ba2b0939fa7e25c60f501af77e 100644 (file)
 static int frqcr3_divisors[] = { 1, 2, 3, 4, 6, 8, 16 };
 static int frqcr3_values[]   = { 0, 1, 2, 3, 4, 5, 6  };
 
-static void emi_clk_recalc(struct clk *clk)
+static unsigned long emi_clk_recalc(struct clk *clk)
 {
        int idx = ctrl_inl(CPG2_FRQCR3) & 0x0007;
-       clk->rate = clk->parent->rate / frqcr3_divisors[idx];
+       return clk->parent->rate / frqcr3_divisors[idx];
 }
 
 static inline int frqcr3_lookup(struct clk *clk, unsigned long rate)
@@ -50,10 +50,10 @@ static struct clk sh4202_emi_clk = {
        .ops            = &sh4202_emi_clk_ops,
 };
 
-static void femi_clk_recalc(struct clk *clk)
+static unsigned long femi_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inl(CPG2_FRQCR3) >> 3) & 0x0007;
-       clk->rate = clk->parent->rate / frqcr3_divisors[idx];
+       return clk->parent->rate / frqcr3_divisors[idx];
 }
 
 static struct clk_ops sh4202_femi_clk_ops = {
@@ -90,10 +90,10 @@ static void shoc_clk_init(struct clk *clk)
        WARN_ON(i == ARRAY_SIZE(frqcr3_divisors));      /* Undefined clock */
 }
 
-static void shoc_clk_recalc(struct clk *clk)
+static unsigned long shoc_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inl(CPG2_FRQCR3) >> 6) & 0x0007;
-       clk->rate = clk->parent->rate / frqcr3_divisors[idx];
+       return clk->parent->rate / frqcr3_divisors[idx];
 }
 
 static 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)
        frqcr3 |= tmp << 6;
        ctrl_outl(frqcr3, CPG2_FRQCR3);
 
-       clk->rate = clk->parent->rate / frqcr3_divisors[tmp];
+       return clk->parent->rate / frqcr3_divisors[tmp];
 
        return 0;
 }
index dca9f87a12d68fa114cdc6bdbcc252e4caf722c3..73294d9cd0492fe69637be663e3c22a72f21eef2 100644 (file)
@@ -35,30 +35,30 @@ static struct clk_ops sh4_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FRQCR) & 0x0007);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh4_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FRQCR) >> 3) & 0x0007;
-       clk->rate = clk->parent->rate / bfc_divisors[idx];
+       return clk->parent->rate / bfc_divisors[idx];
 }
 
 static struct clk_ops sh4_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(FRQCR) >> 6) & 0x0007;
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh4_cpu_clk_ops = {
index 1ccdfc561fefa7218d1f2fab3510822bfb1ffdfb..5b1427f1ed41af2a8015009845472ee2905d36fc 100644 (file)
@@ -151,11 +151,11 @@ static int divisors2[] = { 4, 1, 8, 12, 16, 24, 32, 1, 48, 64, 72, 96, 1, 144 };
 static int divisors2[] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40 };
 #endif
 
-static void master_clk_recalc(struct clk *clk)
+static unsigned long master_clk_recalc(struct clk *clk)
 {
        unsigned frqcr = ctrl_inl(FRQCR);
 
-       clk->rate = CONFIG_SH_PCLK_FREQ * STCPLL(frqcr);
+       return CONFIG_SH_PCLK_FREQ * STCPLL(frqcr);
 }
 
 static void master_clk_init(struct clk *clk)
@@ -166,12 +166,11 @@ static void master_clk_init(struct clk *clk)
        master_clk_recalc(clk);
 }
 
-
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        unsigned long frqcr = ctrl_inl(FRQCR);
 
-       clk->rate = clk->parent->rate / STCPLL(frqcr);
+       return clk->parent->rate / STCPLL(frqcr);
 }
 
 #if defined(CONFIG_CPU_SUBTYPE_SH7724)
@@ -283,14 +282,14 @@ static int sh7722_find_div_index(unsigned long parent_rate, unsigned rate)
        return index;
 }
 
-static void sh7722_frqcr_recalc(struct clk *clk)
+static unsigned long sh7722_frqcr_recalc(struct clk *clk)
 {
        struct frqcr_context ctx = sh7722_get_clk_context(clk->name);
        unsigned long frqcr = ctrl_inl(FRQCR);
        int index;
 
        index = (frqcr >> ctx.shift) & ctx.mask;
-       clk->rate = clk->parent->rate * 2 / divisors2[index];
+       return clk->parent->rate * 2 / divisors2[index];
 }
 
 static int sh7722_frqcr_set_rate(struct clk *clk, unsigned long rate,
@@ -439,11 +438,8 @@ static struct clk_ops sh7722_frqcr_clk_ops = {
 
 /*
  * clock ops methods for SIU A/B and IrDA clock
- *
  */
-
 #ifndef CONFIG_CPU_SUBTYPE_SH7343
-
 static int sh7722_siu_set_rate(struct clk *clk, unsigned long rate, int algo_id)
 {
        unsigned long r;
@@ -458,12 +454,12 @@ static int sh7722_siu_set_rate(struct clk *clk, unsigned long rate, int algo_id)
        return 0;
 }
 
-static void sh7722_siu_recalc(struct clk *clk)
+static unsigned long sh7722_siu_recalc(struct clk *clk)
 {
        unsigned long r;
 
        r = ctrl_inl(clk->arch_flags);
-       clk->rate = clk->parent->rate * 2 / divisors2[r & 0xF];
+       return clk->parent->rate * 2 / divisors2[r & 0xF];
 }
 
 static 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,
        return 0;
 }
 
-static void sh7722_video_recalc(struct clk *clk)
+static unsigned long sh7722_video_recalc(struct clk *clk)
 {
        unsigned long r;
 
        r = ctrl_inl(VCLKCR);
-       clk->rate = clk->parent->rate / ((r & 0x3F) + 1);
+       return clk->parent->rate / ((r & 0x3F) + 1);
 }
 
 static struct clk_ops sh7722_video_clk_ops = {
@@ -627,7 +623,7 @@ static int sh7722_mstpcr_start_stop(struct clk *clk, int enable)
                break;
        default:
                return -EINVAL;
-       }  
+       }
 
        r = ctrl_inl(reg);
 
@@ -650,10 +646,9 @@ static void sh7722_mstpcr_disable(struct clk *clk)
        sh7722_mstpcr_start_stop(clk, 0);
 }
 
-static void sh7722_mstpcr_recalc(struct clk *clk)
+static unsigned long sh7722_mstpcr_recalc(struct clk *clk)
 {
-       if (clk->parent)
-               clk->rate = clk->parent->rate;
+       return clk->parent->rate;
 }
 
 static struct clk_ops sh7722_mstpcr_clk_ops = {
index 3177d0d1e06da240cac4fccf5e56a90c7c2b19f9..26630fb190c76bb82964bfd1b84156b4dc7c20ee 100644 (file)
@@ -29,29 +29,29 @@ static struct clk_ops sh7763_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> 4) & 0x07);
-       clk->rate = clk->parent->rate / p0fc_divisors[idx];
+       return clk->parent->rate / p0fc_divisors[idx];
 }
 
 static struct clk_ops sh7763_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> 16) & 0x07);
-       clk->rate = clk->parent->rate / bfc_divisors[idx];
+       return clk->parent->rate / bfc_divisors[idx];
 }
 
 static struct clk_ops sh7763_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
-       clk->rate = clk->parent->rate;
+       return clk->parent->rate;
 }
 
 static struct clk_ops sh7763_cpu_clk_ops = {
@@ -71,10 +71,10 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
                *ops = sh7763_clk_ops[idx];
 }
 
-static void shyway_clk_recalc(struct clk *clk)
+static unsigned long shyway_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> 20) & 0x07);
-       clk->rate = clk->parent->rate / cfc_divisors[idx];
+       return clk->parent->rate / cfc_divisors[idx];
 }
 
 static struct clk_ops sh7763_shyway_clk_ops = {
index 8e236062c721860fb5f39768c09f4eb2859bb6cc..e0b896769205a291809ac035dab984c309db3392 100644 (file)
@@ -28,30 +28,30 @@ static struct clk_ops sh7770_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> 28) & 0x000f);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7770_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inl(FRQCR) & 0x000f);
-       clk->rate = clk->parent->rate / bfc_divisors[idx];
+       return clk->parent->rate / bfc_divisors[idx];
 }
 
 static struct clk_ops sh7770_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> 24) & 0x000f);
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh7770_cpu_clk_ops = {
index 01f3da619d3d95f259b19153e556fe1ea721718f..ba8dacc4ba2387e78d39506f35de53b04325815a 100644 (file)
@@ -29,30 +29,30 @@ static struct clk_ops sh7780_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inl(FRQCR) & 0x0003);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7780_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> 16) & 0x0007);
-       clk->rate = clk->parent->rate / bfc_divisors[idx];
+       return clk->parent->rate / bfc_divisors[idx];
 }
 
 static struct clk_ops sh7780_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> 24) & 0x0001);
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh7780_cpu_clk_ops = {
@@ -72,10 +72,10 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
                *ops = sh7780_clk_ops[idx];
 }
 
-static void shyway_clk_recalc(struct clk *clk)
+static unsigned long shyway_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> 20) & 0x0007);
-       clk->rate = clk->parent->rate / cfc_divisors[idx];
+       return clk->parent->rate / cfc_divisors[idx];
 }
 
 static struct clk_ops sh7780_shyway_clk_ops = {
index 27fa81bef6a07f4a4b1cfceb525dba54ed706fb1..52691eaeb9ba3c427e7c6583f30655f63b74740e 100644 (file)
@@ -33,30 +33,30 @@ static struct clk_ops sh7785_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inl(FRQMR1) & 0x000f);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7785_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQMR1) >> 16) & 0x000f);
-       clk->rate = clk->parent->rate / bfc_divisors[idx];
+       return clk->parent->rate / bfc_divisors[idx];
 }
 
 static struct clk_ops sh7785_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQMR1) >> 28) & 0x0003);
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh7785_cpu_clk_ops = {
@@ -76,10 +76,10 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
                *ops = sh7785_clk_ops[idx];
 }
 
-static void shyway_clk_recalc(struct clk *clk)
+static unsigned long shyway_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQMR1) >> 20) & 0x0003);
-       clk->rate = clk->parent->rate / sfc_divisors[idx];
+       return clk->parent->rate / sfc_divisors[idx];
 }
 
 static struct clk_ops sh7785_shyway_clk_ops = {
@@ -92,10 +92,10 @@ static struct clk sh7785_shyway_clk = {
        .ops            = &sh7785_shyway_clk_ops,
 };
 
-static void ddr_clk_recalc(struct clk *clk)
+static unsigned long ddr_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQMR1) >> 12) & 0x0003);
-       clk->rate = clk->parent->rate / mfc_divisors[idx];
+       return clk->parent->rate / mfc_divisors[idx];
 }
 
 static struct clk_ops sh7785_ddr_clk_ops = {
@@ -108,10 +108,10 @@ static struct clk sh7785_ddr_clk = {
        .ops            = &sh7785_ddr_clk_ops,
 };
 
-static void ram_clk_recalc(struct clk *clk)
+static unsigned long ram_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQMR1) >> 24) & 0x0003);
-       clk->rate = clk->parent->rate / ufc_divisors[idx];
+       return clk->parent->rate / ufc_divisors[idx];
 }
 
 static struct clk_ops sh7785_ram_clk_ops = {
index f84a9c1344710ea3777c47275eeec8b47f73a30e..2e00ff436c63241908044007024b8d93ffa53998 100644 (file)
@@ -36,30 +36,30 @@ static struct clk_ops sh7786_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inl(FRQMR1) & 0x000f);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops sh7786_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQMR1) >> 16) & 0x000f);
-       clk->rate = clk->parent->rate / bfc_divisors[idx];
+       return clk->parent->rate / bfc_divisors[idx];
 }
 
 static struct clk_ops sh7786_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQMR1) >> 28) & 0x0003);
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops sh7786_cpu_clk_ops = {
@@ -79,10 +79,10 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
                *ops = sh7786_clk_ops[idx];
 }
 
-static void shyway_clk_recalc(struct clk *clk)
+static unsigned long shyway_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQMR1) >> 20) & 0x0003);
-       clk->rate = clk->parent->rate / sfc_divisors[idx];
+       return clk->parent->rate / sfc_divisors[idx];
 }
 
 static struct clk_ops sh7786_shyway_clk_ops = {
@@ -95,10 +95,10 @@ static struct clk sh7786_shyway_clk = {
        .ops            = &sh7786_shyway_clk_ops,
 };
 
-static void ddr_clk_recalc(struct clk *clk)
+static unsigned long ddr_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQMR1) >> 12) & 0x0003);
-       clk->rate = clk->parent->rate / mfc_divisors[idx];
+       return clk->parent->rate / mfc_divisors[idx];
 }
 
 static struct clk_ops sh7786_ddr_clk_ops = {
index c630b29e06a81def79e3d4dee82dd1e7e9a1cb72..770934e682813d4cf9d6a3ac94507bdfb6abe5a1 100644 (file)
@@ -40,30 +40,30 @@ static struct clk_ops shx3_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> PFC_POS) & PFC_MSK);
-       clk->rate = clk->parent->rate / pfc_divisors[idx];
+       return clk->parent->rate / pfc_divisors[idx];
 }
 
 static struct clk_ops shx3_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> BFC_POS) & BFC_MSK);
-       clk->rate = clk->parent->rate / bfc_divisors[idx];
+       return clk->parent->rate / bfc_divisors[idx];
 }
 
 static struct clk_ops shx3_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> IFC_POS) & IFC_MSK);
-       clk->rate = clk->parent->rate / ifc_divisors[idx];
+       return clk->parent->rate / ifc_divisors[idx];
 }
 
 static struct clk_ops shx3_cpu_clk_ops = {
@@ -83,10 +83,10 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
                *ops = shx3_clk_ops[idx];
 }
 
-static void shyway_clk_recalc(struct clk *clk)
+static unsigned long shyway_clk_recalc(struct clk *clk)
 {
        int idx = ((ctrl_inl(FRQCR) >> CFC_POS) & CFC_MSK);
-       clk->rate = clk->parent->rate / cfc_divisors[idx];
+       return clk->parent->rate / cfc_divisors[idx];
 }
 
 static struct clk_ops shx3_shyway_clk_ops = {
index 5486324880e10ab8b6ac8ab1255424c0dd7c1fdb..7f864ebc51d3b054cb561826c69f577abc3ed144 100644 (file)
@@ -32,30 +32,30 @@ static struct clk_ops sh5_master_clk_ops = {
        .init           = master_clk_init,
 };
 
-static void module_clk_recalc(struct clk *clk)
+static unsigned long module_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(cprc_base) >> 12) & 0x0007;
-       clk->rate = clk->parent->rate / ifc_table[idx];
+       return clk->parent->rate / ifc_table[idx];
 }
 
 static struct clk_ops sh5_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
-static void bus_clk_recalc(struct clk *clk)
+static unsigned long bus_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(cprc_base) >> 3) & 0x0007;
-       clk->rate = clk->parent->rate / ifc_table[idx];
+       return clk->parent->rate / ifc_table[idx];
 }
 
 static struct clk_ops sh5_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
-static void cpu_clk_recalc(struct clk *clk)
+static unsigned long cpu_clk_recalc(struct clk *clk)
 {
        int idx = (ctrl_inw(cprc_base) & 0x0007);
-       clk->rate = clk->parent->rate / ifc_table[idx];
+       return clk->parent->rate / ifc_table[idx];
 }
 
 static struct clk_ops sh5_cpu_clk_ops = {
index fe8d8930ccb620a649e825157872ea09675bbebb..a693dcdbe13ec584bafb11d3b2a109985e8c1297 100644 (file)
@@ -172,22 +172,19 @@ static void __init tmu_clk_init(struct clk *clk)
        clk->rate = clk_get_rate(clk->parent) / (4 << (divisor << 1));
 }
 
-static void tmu_clk_recalc(struct clk *clk)
+static unsigned long tmu_clk_recalc(struct clk *clk)
 {
        int tmu_num = clk->name[3]-'0';
-       unsigned long prev_rate = clk_get_rate(clk);
+       unsigned long new_rate;
        unsigned long flags;
        u8 divisor = ctrl_inw(TMU0_TCR+tmu_num*0xC) & 0x7;
-       clk->rate  = clk_get_rate(clk->parent) / (4 << (divisor << 1));
 
-       if(prev_rate==clk_get_rate(clk))
-               return;
-
-       if(tmu_num)
-               return; /* No more work on TMU1 */
+       new_rate = clk_get_rate(clk->parent) / (4 << (divisor << 1));
+       if (clk->rate == new_rate || tmu_num)
+               return clk->rate; /* No more work on TMU1 */
 
        local_irq_save(flags);
-       tmus_are_scaled = (prev_rate > clk->rate);
+       tmus_are_scaled = (clk->rate > new_rate);
 
        _tmu_stop(TMU0);
 
@@ -210,6 +207,7 @@ static void tmu_clk_recalc(struct clk *clk)
        _tmu_start(TMU0);
 
        local_irq_restore(flags);
+       return new_rate;
 }
 
 static struct clk_ops tmu_clk_ops = {