]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap1/clock.c
[ARM] omap: provide a NULL clock operations structure
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap1 / clock.c
index 5fba207317100f4ed3cacb9361e134a4e75ee926..ff408105ffb24f4f534a7ce2037e10b1e7eaef81 100644 (file)
 #include <mach/clock.h>
 #include <mach/sram.h>
 
+static const struct clkops clkops_generic;
+static const struct clkops clkops_uart;
+static const struct clkops clkops_dspck;
+
 #include "clock.h"
 
+static int omap1_clk_enable_generic(struct clk * clk);
+static int omap1_clk_enable(struct clk *clk);
+static void omap1_clk_disable_generic(struct clk * clk);
+static void omap1_clk_disable(struct clk *clk);
+
 __u32 arm_idlect1_mask;
 
 /*-------------------------------------------------------------------------
@@ -78,6 +87,11 @@ static void omap1_clk_disable_dsp_domain(struct clk *clk)
        }
 }
 
+static const struct clkops clkops_dspck = {
+       .enable         = &omap1_clk_enable_dsp_domain,
+       .disable        = &omap1_clk_disable_dsp_domain,
+};
+
 static int omap1_clk_enable_uart_functional(struct clk *clk)
 {
        int ret;
@@ -105,6 +119,11 @@ static void omap1_clk_disable_uart_functional(struct clk *clk)
        omap1_clk_disable_generic(clk);
 }
 
+static const struct clkops clkops_uart = {
+       .enable         = &omap1_clk_enable_uart_functional,
+       .disable        = &omap1_clk_disable_uart_functional,
+};
+
 static void omap1_clk_allow_idle(struct clk *clk)
 {
        struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk;
@@ -468,7 +487,7 @@ static int omap1_clk_enable(struct clk *clk)
                                omap1_clk_deny_idle(clk->parent);
                }
 
-               ret = clk->enable(clk);
+               ret = clk->ops->enable(clk);
 
                if (unlikely(ret != 0) && clk->parent) {
                        omap1_clk_disable(clk->parent);
@@ -482,7 +501,7 @@ static int omap1_clk_enable(struct clk *clk)
 static void omap1_clk_disable(struct clk *clk)
 {
        if (clk->usecount > 0 && !(--clk->usecount)) {
-               clk->disable(clk);
+               clk->ops->disable(clk);
                if (likely(clk->parent)) {
                        omap1_clk_disable(clk->parent);
                        if (clk->flags & CLOCK_NO_IDLE_PARENT)
@@ -496,9 +515,6 @@ static int omap1_clk_enable_generic(struct clk *clk)
        __u16 regval16;
        __u32 regval32;
 
-       if (clk->flags & ALWAYS_ENABLED)
-               return 0;
-
        if (unlikely(clk->enable_reg == NULL)) {
                printk(KERN_ERR "clock.c: Enable for %s without enable code\n",
                       clk->name);
@@ -561,6 +577,11 @@ static void omap1_clk_disable_generic(struct clk *clk)
        }
 }
 
+static const struct clkops clkops_generic = {
+       .enable         = &omap1_clk_enable_generic,
+       .disable        = &omap1_clk_disable_generic,
+};
+
 static long omap1_clk_round_rate(struct clk *clk, unsigned long rate)
 {
        int dsor_exp;
@@ -659,7 +680,7 @@ static void __init omap1_clk_disable_unused(struct clk *clk)
        }
 
        printk(KERN_INFO "Disabling unused clock \"%s\"... ", clk->name);
-       clk->disable(clk);
+       clk->ops->disable(clk);
        printk(" done\n");
 }