ARM: SAMSUNG: Do not allow get/set/round rate calls with no divider
authorBen Dooks <ben@ben-laptop.fluff.org>
Tue, 5 Jan 2010 16:07:57 +0000 (01:07 +0900)
committerBen Dooks <ben-linux@fluff.org>
Fri, 15 Jan 2010 08:10:11 +0000 (17:10 +0900)
If the reg_div field is not set, then do not register clk_ops with the
get/set/round rate calls as these will fail to work.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
arch/arm/plat-samsung/clock-clksrc.c

index 12129f8e509c849c3d6fe853a127c05b9322dd41..aaf7d5ebea96f7b1a7bc4cb37e3266a6e66cfe16 100644 (file)
@@ -158,14 +158,25 @@ static struct clk_ops clksrc_ops = {
        .round_rate     = s3c_roundrate_clksrc,
 };
 
+static struct clk_ops clksrc_ops_nodiv = {
+       .set_parent     = s3c_setparent_clksrc,
+};
+
 void __init s3c_register_clksrc(struct clksrc_clk *clksrc, int size)
 {
        int ret;
 
+       WARN_ON(!clksrc->reg_div.reg && !clksrc->reg_src.reg);
+
        for (; size > 0; size--, clksrc++) {
                /* fill in the default functions */
-               if (!clksrc->clk.ops)
-                       clksrc->clk.ops = &clksrc_ops;
+
+               if (!clksrc->clk.ops) {
+                       if (!clksrc->reg_div.reg)
+                               clksrc->clk.ops = &clksrc_ops_nodiv;
+                       else
+                               clksrc->clk.ops = &clksrc_ops;
+               }
 
                /* setup the clocksource, but do not announce it
                 * as it may be re-set by the setup routines