aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/clockdomain.c
diff options
context:
space:
mode:
authorRajendra Nayak <rnayak@ti.com>2011-02-25 18:06:47 -0500
committerPaul Walmsley <paul@pwsan.com>2011-02-25 18:06:47 -0500
commit68b921ad7f35e0323ce0d9fe94e5701a112f257c (patch)
treeec9af432b9a366604ce43370dfccc779ae2bc5f9 /arch/arm/mach-omap2/clockdomain.c
parent4aef7a2a5aad52b60ac1a2f3cee055b8271b70d5 (diff)
OMAP: clockdomain: Arch specific funcs for sleep/wakeup of clkdm
Define the following architecture specific funtions for omap2/3/4 .clkdm_sleep .clkdm_wakeup Convert the platform-independent framework to call these functions. Also rename the api's by removing the omap2_ preamble. Hence call omap2_clkdm_wakeup as clkdm_wakeup and omap2_clkdm_sleep as clkdm_sleep. Signed-off-by: Rajendra Nayak <rnayak@ti.com> [paul@pwsan.com: fixed omap3_clkdm_clear_all_sleepdeps() and omap2_clkdm_clear_all_wkdeps() to test against the correct loop termination condition; thanks to Kevin Hilman for finding and helping fix] Cc: Kevin Hilman <khilman@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/clockdomain.c')
-rw-r--r--arch/arm/mach-omap2/clockdomain.c64
1 files changed, 15 insertions, 49 deletions
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 895c153c18e0..3035eb9eec36 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -355,7 +355,7 @@ void clkdm_init(struct clockdomain **clkdms,
355 */ 355 */
356 list_for_each_entry(clkdm, &clkdm_list, node) { 356 list_for_each_entry(clkdm, &clkdm_list, node) {
357 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) 357 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
358 omap2_clkdm_wakeup(clkdm); 358 clkdm_wakeup(clkdm);
359 else if (clkdm->flags & CLKDM_CAN_DISABLE_AUTO) 359 else if (clkdm->flags & CLKDM_CAN_DISABLE_AUTO)
360 omap2_clkdm_deny_idle(clkdm); 360 omap2_clkdm_deny_idle(clkdm);
361 361
@@ -765,7 +765,7 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
765} 765}
766 766
767/** 767/**
768 * omap2_clkdm_sleep - force clockdomain sleep transition 768 * clkdm_sleep - force clockdomain sleep transition
769 * @clkdm: struct clockdomain * 769 * @clkdm: struct clockdomain *
770 * 770 *
771 * Instruct the CM to force a sleep transition on the specified 771 * Instruct the CM to force a sleep transition on the specified
@@ -773,7 +773,7 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
773 * clockdomain does not support software-initiated sleep; 0 upon 773 * clockdomain does not support software-initiated sleep; 0 upon
774 * success. 774 * success.
775 */ 775 */
776int omap2_clkdm_sleep(struct clockdomain *clkdm) 776int clkdm_sleep(struct clockdomain *clkdm)
777{ 777{
778 if (!clkdm) 778 if (!clkdm)
779 return -EINVAL; 779 return -EINVAL;
@@ -784,33 +784,16 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
784 return -EINVAL; 784 return -EINVAL;
785 } 785 }
786 786
787 pr_debug("clockdomain: forcing sleep on %s\n", clkdm->name); 787 if (!arch_clkdm || !arch_clkdm->clkdm_sleep)
788 788 return -EINVAL;
789 if (cpu_is_omap24xx()) {
790
791 omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
792 clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
793
794 } else if (cpu_is_omap34xx()) {
795
796 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
797 clkdm->clktrctrl_mask);
798
799 } else if (cpu_is_omap44xx()) {
800
801 omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition,
802 clkdm->cm_inst,
803 clkdm->clkdm_offs);
804 789
805 } else { 790 pr_debug("clockdomain: forcing sleep on %s\n", clkdm->name);
806 BUG();
807 };
808 791
809 return 0; 792 return arch_clkdm->clkdm_sleep(clkdm);
810} 793}
811 794
812/** 795/**
813 * omap2_clkdm_wakeup - force clockdomain wakeup transition 796 * clkdm_wakeup - force clockdomain wakeup transition
814 * @clkdm: struct clockdomain * 797 * @clkdm: struct clockdomain *
815 * 798 *
816 * Instruct the CM to force a wakeup transition on the specified 799 * Instruct the CM to force a wakeup transition on the specified
@@ -818,7 +801,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
818 * clockdomain does not support software-controlled wakeup; 0 upon 801 * clockdomain does not support software-controlled wakeup; 0 upon
819 * success. 802 * success.
820 */ 803 */
821int omap2_clkdm_wakeup(struct clockdomain *clkdm) 804int clkdm_wakeup(struct clockdomain *clkdm)
822{ 805{
823 if (!clkdm) 806 if (!clkdm)
824 return -EINVAL; 807 return -EINVAL;
@@ -829,29 +812,12 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
829 return -EINVAL; 812 return -EINVAL;
830 } 813 }
831 814
832 pr_debug("clockdomain: forcing wakeup on %s\n", clkdm->name); 815 if (!arch_clkdm || !arch_clkdm->clkdm_wakeup)
833 816 return -EINVAL;
834 if (cpu_is_omap24xx()) {
835
836 omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
837 clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
838
839 } else if (cpu_is_omap34xx()) {
840
841 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
842 clkdm->clktrctrl_mask);
843
844 } else if (cpu_is_omap44xx()) {
845
846 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
847 clkdm->cm_inst,
848 clkdm->clkdm_offs);
849 817
850 } else { 818 pr_debug("clockdomain: forcing wakeup on %s\n", clkdm->name);
851 BUG();
852 };
853 819
854 return 0; 820 return arch_clkdm->clkdm_wakeup(clkdm);
855} 821}
856 822
857/** 823/**
@@ -990,7 +956,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
990 _clkdm_add_autodeps(clkdm); 956 _clkdm_add_autodeps(clkdm);
991 _enable_hwsup(clkdm); 957 _enable_hwsup(clkdm);
992 } else { 958 } else {
993 omap2_clkdm_wakeup(clkdm); 959 clkdm_wakeup(clkdm);
994 } 960 }
995 961
996 pwrdm_wait_transition(clkdm->pwrdm.ptr); 962 pwrdm_wait_transition(clkdm->pwrdm.ptr);
@@ -1062,7 +1028,7 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
1062 _clkdm_del_autodeps(clkdm); 1028 _clkdm_del_autodeps(clkdm);
1063 _enable_hwsup(clkdm); 1029 _enable_hwsup(clkdm);
1064 } else { 1030 } else {
1065 omap2_clkdm_sleep(clkdm); 1031 clkdm_sleep(clkdm);
1066 } 1032 }
1067 1033
1068 pwrdm_clkdm_state_switch(clkdm); 1034 pwrdm_clkdm_state_switch(clkdm);