]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
omap2 clock: use custom osc_ck enable/disable routines
authorPaul Walmsley <paul@pwsan.com>
Mon, 27 Aug 2007 08:39:18 +0000 (02:39 -0600)
committerTony Lindgren <tony@atomide.com>
Fri, 31 Aug 2007 18:14:01 +0000 (11:14 -0700)
Now that we're paying attention to the .enable/.disable fields in struct
clk, convert the osc_ck enable and disable code to use this standard
mechanism.  (osc_ck enable/disable does not technically enable or disable
the osc_ck; it actually enables/disables autoidling.)

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/clock.c
arch/arm/mach-omap2/clock.h

index ad84869226a3fa85b1d969eb23205dbfad18e5e8..f389e9d7923057d71fdb37187120f035981fdd39 100644 (file)
@@ -163,18 +163,26 @@ static void omap2_fixed_divisor_recalc(struct clk *clk)
                propagate_rate(clk);
 }
 
-static void omap2_set_osc_ck(int enable)
+static int omap2_enable_osc_ck(struct clk *clk)
 {
        u32 pcc;
 
        pcc = prm_read_reg(OMAP24XX_PRCM_CLKSRC_CTRL);
 
-       if (enable)
-               prm_write_reg(pcc & ~OMAP_AUTOEXTCLKMODE_MASK,
-                             OMAP24XX_PRCM_CLKSRC_CTRL);
-       else
-               prm_write_reg(pcc | OMAP_AUTOEXTCLKMODE_MASK,
-                             OMAP24XX_PRCM_CLKSRC_CTRL);
+       prm_write_reg(pcc & ~OMAP_AUTOEXTCLKMODE_MASK,
+                     OMAP24XX_PRCM_CLKSRC_CTRL);
+
+       return 0;
+}
+
+static void omap2_disable_osc_ck(struct clk *clk)
+{
+       u32 pcc;
+
+       pcc = prm_read_reg(OMAP24XX_PRCM_CLKSRC_CTRL);
+
+       prm_write_reg(pcc | OMAP_AUTOEXTCLKMODE_MASK,
+                     OMAP24XX_PRCM_CLKSRC_CTRL);
 }
 
 /*
@@ -272,11 +280,6 @@ static int _omap2_clk_enable(struct clk * clk)
        if (clk->flags & (ALWAYS_ENABLED | PARENT_CONTROLS_CLOCK))
                return 0;
 
-       if (unlikely(clk == &osc_ck)) {
-               omap2_set_osc_ck(1);
-               return 0;
-       }
-
        if (clk->enable)
                return clk->enable(clk);
 
@@ -324,11 +327,6 @@ static void _omap2_clk_disable(struct clk *clk)
                return;
        }
 
-       if (unlikely(clk == &osc_ck)) {
-               omap2_set_osc_ck(0);
-               return;
-       }
-
        if (clk->enable_reg == 0) {
                /*
                 * 'Independent' here refers to a clock which is not
index 1243201e19cca5b7c8aa3c7c2ded18eb3b8847f9..bd64fba6d155fddf1ef9c2ed90bb066baa31a8e9 100644 (file)
@@ -26,7 +26,6 @@
 #include "prm_regbits_24xx.h"
 #include "cm_regbits_24xx.h"
 
-static void omap2_sys_clk_recalc(struct clk * clk);
 static void omap2_clksel_recalc(struct clk * clk);
 static void omap2_table_mpu_recalc(struct clk *clk);
 static int omap2_select_table_rate(struct clk * clk, unsigned long rate);
@@ -42,6 +41,8 @@ static void omap2_fixed_divisor_recalc(struct clk *clk);
 static long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);
 static int omap2_clksel_set_rate(struct clk *clk, unsigned long rate);
 static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate);
+static int omap2_enable_osc_ck(struct clk *clk);
+static void omap2_disable_osc_ck(struct clk *clk);
 
 /* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
  * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP
@@ -598,6 +599,8 @@ static struct clk osc_ck = {                /* (*12, *13, 19.2, *26, 38.4)MHz */
        .rate           = 26000000,             /* fixed up in clock init */
        .flags          = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
                                RATE_FIXED | RATE_PROPAGATES,
+       .enable         = &omap2_enable_osc_ck,
+       .disable        = &omap2_disable_osc_ck,
        .recalc         = &propagate_rate,
 };