OMAP: clockdomain: Arch specific funcs for hwsup control of clkdm
authorRajendra Nayak <rnayak@ti.com>
Fri, 25 Feb 2011 23:06:48 +0000 (16:06 -0700)
committerPaul Walmsley <paul@pwsan.com>
Fri, 25 Feb 2011 23:06:48 +0000 (16:06 -0700)
Define the following architecture specific funtions for omap2/3/4
.clkdm_allow_idle
.clkdm_deny_idle

Convert the platform-independent framework to call these functions.
Also rename the api's by removing the omap2_ preamble.
Hence call omap2_clkdm_allow_idle as clkdm_allow_idle and
omap2_clkdm_deny_idle as clkdm_deny_idle.

Make the _clkdm_add_autodeps and _clkdm_del_autodeps as non-static
so they can be accessed from OMAP2/3 platform specific code.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
arch/arm/mach-omap2/clockdomain.c
arch/arm/mach-omap2/clockdomain.h
arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
arch/arm/mach-omap2/clockdomain44xx.c
arch/arm/mach-omap2/cpuidle34xx.c
arch/arm/mach-omap2/pm.c
arch/arm/mach-omap2/pm24xx.c
arch/arm/mach-omap2/pm34xx.c

index 3035eb9eec3692b65125f83a7b4f90e51bb96369..44664e7cc2a6f234d32839c375595f8566c9ceb9 100644 (file)
@@ -178,7 +178,7 @@ static void _autodep_lookup(struct clkdm_autodep *autodep)
  * XXX autodeps are deprecated and should be removed at the earliest
  * opportunity
  */
-static void _clkdm_add_autodeps(struct clockdomain *clkdm)
+void _clkdm_add_autodeps(struct clockdomain *clkdm)
 {
        struct clkdm_autodep *autodep;
 
@@ -212,7 +212,7 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm)
  * XXX autodeps are deprecated and should be removed at the earliest
  * opportunity
  */
-static void _clkdm_del_autodeps(struct clockdomain *clkdm)
+void _clkdm_del_autodeps(struct clockdomain *clkdm)
 {
        struct clkdm_autodep *autodep;
 
@@ -357,7 +357,7 @@ void clkdm_init(struct clockdomain **clkdms,
                if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
                        clkdm_wakeup(clkdm);
                else if (clkdm->flags & CLKDM_CAN_DISABLE_AUTO)
-                       omap2_clkdm_deny_idle(clkdm);
+                       clkdm_deny_idle(clkdm);
 
                _resolve_clkdm_deps(clkdm, clkdm->wkdep_srcs);
                clkdm_clear_all_wkdeps(clkdm);
@@ -821,7 +821,7 @@ int clkdm_wakeup(struct clockdomain *clkdm)
 }
 
 /**
- * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm
+ * clkdm_allow_idle - enable hwsup idle transitions for clkdm
  * @clkdm: struct clockdomain *
  *
  * Allow the hardware to automatically switch the clockdomain @clkdm into
@@ -830,7 +830,7 @@ int clkdm_wakeup(struct clockdomain *clkdm)
  * framework, wkdep/sleepdep autodependencies are added; this is so
  * device drivers can read and write to the device.  No return value.
  */
-void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
+void clkdm_allow_idle(struct clockdomain *clkdm)
 {
        if (!clkdm)
                return;
@@ -841,27 +841,18 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
                return;
        }
 
+       if (!arch_clkdm || !arch_clkdm->clkdm_allow_idle)
+               return;
+
        pr_debug("clockdomain: enabling automatic idle transitions for %s\n",
                 clkdm->name);
 
-       /*
-        * XXX This should be removed once TI adds wakeup/sleep
-        * dependency code and data for OMAP4.
-        */
-       if (cpu_is_omap44xx()) {
-               pr_err("clockdomain: %s: OMAP4 wakeup/sleep dependency support: not yet implemented\n", clkdm->name);
-       } else {
-               if (atomic_read(&clkdm->usecount) > 0)
-                       _clkdm_add_autodeps(clkdm);
-       }
-
-       _enable_hwsup(clkdm);
-
+       arch_clkdm->clkdm_allow_idle(clkdm);
        pwrdm_clkdm_state_switch(clkdm);
 }
 
 /**
- * omap2_clkdm_deny_idle - disable hwsup idle transitions for clkdm
+ * clkdm_deny_idle - disable hwsup idle transitions for clkdm
  * @clkdm: struct clockdomain *
  *
  * Prevent the hardware from automatically switching the clockdomain
@@ -869,7 +860,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
  * downstream clocks enabled in the clock framework, wkdep/sleepdep
  * autodependencies are removed.  No return value.
  */
-void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
+void clkdm_deny_idle(struct clockdomain *clkdm)
 {
        if (!clkdm)
                return;
@@ -880,21 +871,13 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
                return;
        }
 
+       if (!arch_clkdm || !arch_clkdm->clkdm_deny_idle)
+               return;
+
        pr_debug("clockdomain: disabling automatic idle transitions for %s\n",
                 clkdm->name);
 
-       _disable_hwsup(clkdm);
-
-       /*
-        * XXX This should be removed once TI adds wakeup/sleep
-        * dependency code and data for OMAP4.
-        */
-       if (cpu_is_omap44xx()) {
-               pr_err("clockdomain: %s: OMAP4 wakeup/sleep dependency support: not yet implemented\n", clkdm->name);
-       } else {
-               if (atomic_read(&clkdm->usecount) > 0)
-                       _clkdm_del_autodeps(clkdm);
-       }
+       arch_clkdm->clkdm_deny_idle(clkdm);
 }
 
 
index 7a5cb5cf9949178c48c0eb399c67c92b155cc361..7126658d9ae1eb2757e4d7e46d515f0ca14c72f6 100644 (file)
@@ -167,8 +167,8 @@ int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
 int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
 int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
 
-void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
-void omap2_clkdm_deny_idle(struct clockdomain *clkdm);
+void clkdm_allow_idle(struct clockdomain *clkdm);
+void clkdm_deny_idle(struct clockdomain *clkdm);
 
 int clkdm_wakeup(struct clockdomain *clkdm);
 int clkdm_sleep(struct clockdomain *clkdm);
@@ -179,6 +179,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
 extern void __init omap2xxx_clockdomains_init(void);
 extern void __init omap3xxx_clockdomains_init(void);
 extern void __init omap44xx_clockdomains_init(void);
+extern void _clkdm_add_autodeps(struct clockdomain *clkdm);
+extern void _clkdm_del_autodeps(struct clockdomain *clkdm);
 
 extern struct clkdm_ops omap2_clkdm_operations;
 extern struct clkdm_ops omap3_clkdm_operations;
index 08c87fe3da123ac99e26c85a9e4fa4a6777a61bd..25c27a5c722f625c5567ddd8bd95f59880a15e5f 100644 (file)
@@ -128,6 +128,24 @@ static int omap2_clkdm_wakeup(struct clockdomain *clkdm)
        return 0;
 }
 
+static void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
+{
+       if (atomic_read(&clkdm->usecount) > 0)
+               _clkdm_add_autodeps(clkdm);
+
+       omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                               clkdm->clktrctrl_mask);
+}
+
+static void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
+{
+       omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                               clkdm->clktrctrl_mask);
+
+       if (atomic_read(&clkdm->usecount) > 0)
+               _clkdm_del_autodeps(clkdm);
+}
+
 static int omap3_clkdm_sleep(struct clockdomain *clkdm)
 {
        omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
@@ -142,6 +160,24 @@ static int omap3_clkdm_wakeup(struct clockdomain *clkdm)
        return 0;
 }
 
+static void omap3_clkdm_allow_idle(struct clockdomain *clkdm)
+{
+       if (atomic_read(&clkdm->usecount) > 0)
+               _clkdm_add_autodeps(clkdm);
+
+       omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                               clkdm->clktrctrl_mask);
+}
+
+static void omap3_clkdm_deny_idle(struct clockdomain *clkdm)
+{
+       omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
+                               clkdm->clktrctrl_mask);
+
+       if (atomic_read(&clkdm->usecount) > 0)
+               _clkdm_del_autodeps(clkdm);
+}
+
 struct clkdm_ops omap2_clkdm_operations = {
        .clkdm_add_wkdep        = omap2_clkdm_add_wkdep,
        .clkdm_del_wkdep        = omap2_clkdm_del_wkdep,
@@ -149,6 +185,8 @@ struct clkdm_ops omap2_clkdm_operations = {
        .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
        .clkdm_sleep            = omap2_clkdm_sleep,
        .clkdm_wakeup           = omap2_clkdm_wakeup,
+       .clkdm_allow_idle       = omap2_clkdm_allow_idle,
+       .clkdm_deny_idle        = omap2_clkdm_deny_idle,
 };
 
 struct clkdm_ops omap3_clkdm_operations = {
@@ -162,4 +200,6 @@ struct clkdm_ops omap3_clkdm_operations = {
        .clkdm_clear_all_sleepdeps      = omap3_clkdm_clear_all_sleepdeps,
        .clkdm_sleep            = omap3_clkdm_sleep,
        .clkdm_wakeup           = omap3_clkdm_wakeup,
+       .clkdm_allow_idle       = omap3_clkdm_allow_idle,
+       .clkdm_deny_idle        = omap3_clkdm_deny_idle,
 };
index 9ccb406cf54f99cc6e6d429f68966c561d66f328..a46125f154545a40fbe2c1c8e79f99c245403895 100644 (file)
@@ -29,7 +29,21 @@ static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
        return 0;
 }
 
+static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
+{
+       omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
+                                       clkdm->cm_inst, clkdm->clkdm_offs);
+}
+
+static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
+{
+       omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
+                                       clkdm->cm_inst, clkdm->clkdm_offs);
+}
+
 struct clkdm_ops omap4_clkdm_operations = {
        .clkdm_sleep            = omap4_clkdm_sleep,
        .clkdm_wakeup           = omap4_clkdm_wakeup,
+       .clkdm_allow_idle       = omap4_clkdm_allow_idle,
+       .clkdm_deny_idle        = omap4_clkdm_deny_idle,
 };
index f7b22a16f385af410579b0bd0adc18cb725ad717..7cc80715ef12106b3af1e237533c0582a955d472 100644 (file)
@@ -99,14 +99,14 @@ static int omap3_idle_bm_check(void)
 static int _cpuidle_allow_idle(struct powerdomain *pwrdm,
                                struct clockdomain *clkdm)
 {
-       omap2_clkdm_allow_idle(clkdm);
+       clkdm_allow_idle(clkdm);
        return 0;
 }
 
 static int _cpuidle_deny_idle(struct powerdomain *pwrdm,
                                struct clockdomain *clkdm)
 {
-       omap2_clkdm_deny_idle(clkdm);
+       clkdm_deny_idle(clkdm);
        return 0;
 }
 
index 74c31008079c020d4a59c8b170407c7414cd0fd8..7bb64d8121a7d2982baef5e94f3b41636b94b0d9 100644 (file)
@@ -140,7 +140,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
        switch (sleep_switch) {
        case FORCEWAKEUP_SWITCH:
                if (pwrdm->pwrdm_clkdms[0]->flags & CLKDM_CAN_ENABLE_AUTO)
-                       omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
+                       clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
                else
                        clkdm_sleep(pwrdm->pwrdm_clkdms[0]);
                break;
index 4125621bf591855ddb93377a3c1e3c650198ccad..e983c8301f553142e88fc634de034d060f16f635 100644 (file)
@@ -367,7 +367,7 @@ static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
        clkdm_clear_all_sleepdeps(clkdm);
 
        if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
-               omap2_clkdm_allow_idle(clkdm);
+               clkdm_allow_idle(clkdm);
        else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
                 atomic_read(&clkdm->usecount) == 0)
                clkdm_sleep(clkdm);
index 81df2b169a56dfbbaceca11b4013a2b6a8e1db82..eda9a4e99a895c52958a30f6c3b8c508075492d5 100644 (file)
@@ -496,7 +496,7 @@ console_still_active:
 
        pwrdm_post_transition();
 
-       omap2_clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]);
+       clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]);
 }
 
 int omap3_can_sleep(void)
@@ -990,7 +990,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
 static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
 {
        if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
-               omap2_clkdm_allow_idle(clkdm);
+               clkdm_allow_idle(clkdm);
        else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
                 atomic_read(&clkdm->usecount) == 0)
                clkdm_sleep(clkdm);