diff options
-rw-r--r-- | arch/arm/mach-omap2/clockdomain.c | 47 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clockdomain.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clockdomain2xxx_3xxx.c | 40 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clockdomain44xx.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-omap2/cpuidle34xx.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm24xx.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm34xx.c | 4 |
8 files changed, 79 insertions, 40 deletions
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 3035eb9eec36..44664e7cc2a6 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c | |||
@@ -178,7 +178,7 @@ static void _autodep_lookup(struct clkdm_autodep *autodep) | |||
178 | * XXX autodeps are deprecated and should be removed at the earliest | 178 | * XXX autodeps are deprecated and should be removed at the earliest |
179 | * opportunity | 179 | * opportunity |
180 | */ | 180 | */ |
181 | static void _clkdm_add_autodeps(struct clockdomain *clkdm) | 181 | void _clkdm_add_autodeps(struct clockdomain *clkdm) |
182 | { | 182 | { |
183 | struct clkdm_autodep *autodep; | 183 | struct clkdm_autodep *autodep; |
184 | 184 | ||
@@ -212,7 +212,7 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm) | |||
212 | * XXX autodeps are deprecated and should be removed at the earliest | 212 | * XXX autodeps are deprecated and should be removed at the earliest |
213 | * opportunity | 213 | * opportunity |
214 | */ | 214 | */ |
215 | static void _clkdm_del_autodeps(struct clockdomain *clkdm) | 215 | void _clkdm_del_autodeps(struct clockdomain *clkdm) |
216 | { | 216 | { |
217 | struct clkdm_autodep *autodep; | 217 | struct clkdm_autodep *autodep; |
218 | 218 | ||
@@ -357,7 +357,7 @@ void clkdm_init(struct clockdomain **clkdms, | |||
357 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | 357 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) |
358 | 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 | clkdm_deny_idle(clkdm); |
361 | 361 | ||
362 | _resolve_clkdm_deps(clkdm, clkdm->wkdep_srcs); | 362 | _resolve_clkdm_deps(clkdm, clkdm->wkdep_srcs); |
363 | clkdm_clear_all_wkdeps(clkdm); | 363 | clkdm_clear_all_wkdeps(clkdm); |
@@ -821,7 +821,7 @@ int clkdm_wakeup(struct clockdomain *clkdm) | |||
821 | } | 821 | } |
822 | 822 | ||
823 | /** | 823 | /** |
824 | * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm | 824 | * clkdm_allow_idle - enable hwsup idle transitions for clkdm |
825 | * @clkdm: struct clockdomain * | 825 | * @clkdm: struct clockdomain * |
826 | * | 826 | * |
827 | * Allow the hardware to automatically switch the clockdomain @clkdm into | 827 | * Allow the hardware to automatically switch the clockdomain @clkdm into |
@@ -830,7 +830,7 @@ int clkdm_wakeup(struct clockdomain *clkdm) | |||
830 | * framework, wkdep/sleepdep autodependencies are added; this is so | 830 | * framework, wkdep/sleepdep autodependencies are added; this is so |
831 | * device drivers can read and write to the device. No return value. | 831 | * device drivers can read and write to the device. No return value. |
832 | */ | 832 | */ |
833 | void omap2_clkdm_allow_idle(struct clockdomain *clkdm) | 833 | void clkdm_allow_idle(struct clockdomain *clkdm) |
834 | { | 834 | { |
835 | if (!clkdm) | 835 | if (!clkdm) |
836 | return; | 836 | return; |
@@ -841,27 +841,18 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm) | |||
841 | return; | 841 | return; |
842 | } | 842 | } |
843 | 843 | ||
844 | if (!arch_clkdm || !arch_clkdm->clkdm_allow_idle) | ||
845 | return; | ||
846 | |||
844 | pr_debug("clockdomain: enabling automatic idle transitions for %s\n", | 847 | pr_debug("clockdomain: enabling automatic idle transitions for %s\n", |
845 | clkdm->name); | 848 | clkdm->name); |
846 | 849 | ||
847 | /* | 850 | arch_clkdm->clkdm_allow_idle(clkdm); |
848 | * XXX This should be removed once TI adds wakeup/sleep | ||
849 | * dependency code and data for OMAP4. | ||
850 | */ | ||
851 | if (cpu_is_omap44xx()) { | ||
852 | pr_err("clockdomain: %s: OMAP4 wakeup/sleep dependency support: not yet implemented\n", clkdm->name); | ||
853 | } else { | ||
854 | if (atomic_read(&clkdm->usecount) > 0) | ||
855 | _clkdm_add_autodeps(clkdm); | ||
856 | } | ||
857 | |||
858 | _enable_hwsup(clkdm); | ||
859 | |||
860 | pwrdm_clkdm_state_switch(clkdm); | 851 | pwrdm_clkdm_state_switch(clkdm); |
861 | } | 852 | } |
862 | 853 | ||
863 | /** | 854 | /** |
864 | * omap2_clkdm_deny_idle - disable hwsup idle transitions for clkdm | 855 | * clkdm_deny_idle - disable hwsup idle transitions for clkdm |
865 | * @clkdm: struct clockdomain * | 856 | * @clkdm: struct clockdomain * |
866 | * | 857 | * |
867 | * Prevent the hardware from automatically switching the clockdomain | 858 | * Prevent the hardware from automatically switching the clockdomain |
@@ -869,7 +860,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm) | |||
869 | * downstream clocks enabled in the clock framework, wkdep/sleepdep | 860 | * downstream clocks enabled in the clock framework, wkdep/sleepdep |
870 | * autodependencies are removed. No return value. | 861 | * autodependencies are removed. No return value. |
871 | */ | 862 | */ |
872 | void omap2_clkdm_deny_idle(struct clockdomain *clkdm) | 863 | void clkdm_deny_idle(struct clockdomain *clkdm) |
873 | { | 864 | { |
874 | if (!clkdm) | 865 | if (!clkdm) |
875 | return; | 866 | return; |
@@ -880,21 +871,13 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm) | |||
880 | return; | 871 | return; |
881 | } | 872 | } |
882 | 873 | ||
874 | if (!arch_clkdm || !arch_clkdm->clkdm_deny_idle) | ||
875 | return; | ||
876 | |||
883 | pr_debug("clockdomain: disabling automatic idle transitions for %s\n", | 877 | pr_debug("clockdomain: disabling automatic idle transitions for %s\n", |
884 | clkdm->name); | 878 | clkdm->name); |
885 | 879 | ||
886 | _disable_hwsup(clkdm); | 880 | arch_clkdm->clkdm_deny_idle(clkdm); |
887 | |||
888 | /* | ||
889 | * XXX This should be removed once TI adds wakeup/sleep | ||
890 | * dependency code and data for OMAP4. | ||
891 | */ | ||
892 | if (cpu_is_omap44xx()) { | ||
893 | pr_err("clockdomain: %s: OMAP4 wakeup/sleep dependency support: not yet implemented\n", clkdm->name); | ||
894 | } else { | ||
895 | if (atomic_read(&clkdm->usecount) > 0) | ||
896 | _clkdm_del_autodeps(clkdm); | ||
897 | } | ||
898 | } | 881 | } |
899 | 882 | ||
900 | 883 | ||
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h index 7a5cb5cf9949..7126658d9ae1 100644 --- a/arch/arm/mach-omap2/clockdomain.h +++ b/arch/arm/mach-omap2/clockdomain.h | |||
@@ -167,8 +167,8 @@ int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); | |||
167 | int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); | 167 | int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); |
168 | int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm); | 168 | int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm); |
169 | 169 | ||
170 | void omap2_clkdm_allow_idle(struct clockdomain *clkdm); | 170 | void clkdm_allow_idle(struct clockdomain *clkdm); |
171 | void omap2_clkdm_deny_idle(struct clockdomain *clkdm); | 171 | void clkdm_deny_idle(struct clockdomain *clkdm); |
172 | 172 | ||
173 | int clkdm_wakeup(struct clockdomain *clkdm); | 173 | int clkdm_wakeup(struct clockdomain *clkdm); |
174 | int clkdm_sleep(struct clockdomain *clkdm); | 174 | int clkdm_sleep(struct clockdomain *clkdm); |
@@ -179,6 +179,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk); | |||
179 | extern void __init omap2xxx_clockdomains_init(void); | 179 | extern void __init omap2xxx_clockdomains_init(void); |
180 | extern void __init omap3xxx_clockdomains_init(void); | 180 | extern void __init omap3xxx_clockdomains_init(void); |
181 | extern void __init omap44xx_clockdomains_init(void); | 181 | extern void __init omap44xx_clockdomains_init(void); |
182 | extern void _clkdm_add_autodeps(struct clockdomain *clkdm); | ||
183 | extern void _clkdm_del_autodeps(struct clockdomain *clkdm); | ||
182 | 184 | ||
183 | extern struct clkdm_ops omap2_clkdm_operations; | 185 | extern struct clkdm_ops omap2_clkdm_operations; |
184 | extern struct clkdm_ops omap3_clkdm_operations; | 186 | extern struct clkdm_ops omap3_clkdm_operations; |
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c index 08c87fe3da12..25c27a5c722f 100644 --- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c +++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c | |||
@@ -128,6 +128,24 @@ static int omap2_clkdm_wakeup(struct clockdomain *clkdm) | |||
128 | return 0; | 128 | return 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | static void omap2_clkdm_allow_idle(struct clockdomain *clkdm) | ||
132 | { | ||
133 | if (atomic_read(&clkdm->usecount) > 0) | ||
134 | _clkdm_add_autodeps(clkdm); | ||
135 | |||
136 | omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
137 | clkdm->clktrctrl_mask); | ||
138 | } | ||
139 | |||
140 | static void omap2_clkdm_deny_idle(struct clockdomain *clkdm) | ||
141 | { | ||
142 | omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
143 | clkdm->clktrctrl_mask); | ||
144 | |||
145 | if (atomic_read(&clkdm->usecount) > 0) | ||
146 | _clkdm_del_autodeps(clkdm); | ||
147 | } | ||
148 | |||
131 | static int omap3_clkdm_sleep(struct clockdomain *clkdm) | 149 | static int omap3_clkdm_sleep(struct clockdomain *clkdm) |
132 | { | 150 | { |
133 | omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs, | 151 | omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs, |
@@ -142,6 +160,24 @@ static int omap3_clkdm_wakeup(struct clockdomain *clkdm) | |||
142 | return 0; | 160 | return 0; |
143 | } | 161 | } |
144 | 162 | ||
163 | static void omap3_clkdm_allow_idle(struct clockdomain *clkdm) | ||
164 | { | ||
165 | if (atomic_read(&clkdm->usecount) > 0) | ||
166 | _clkdm_add_autodeps(clkdm); | ||
167 | |||
168 | omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
169 | clkdm->clktrctrl_mask); | ||
170 | } | ||
171 | |||
172 | static void omap3_clkdm_deny_idle(struct clockdomain *clkdm) | ||
173 | { | ||
174 | omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
175 | clkdm->clktrctrl_mask); | ||
176 | |||
177 | if (atomic_read(&clkdm->usecount) > 0) | ||
178 | _clkdm_del_autodeps(clkdm); | ||
179 | } | ||
180 | |||
145 | struct clkdm_ops omap2_clkdm_operations = { | 181 | struct clkdm_ops omap2_clkdm_operations = { |
146 | .clkdm_add_wkdep = omap2_clkdm_add_wkdep, | 182 | .clkdm_add_wkdep = omap2_clkdm_add_wkdep, |
147 | .clkdm_del_wkdep = omap2_clkdm_del_wkdep, | 183 | .clkdm_del_wkdep = omap2_clkdm_del_wkdep, |
@@ -149,6 +185,8 @@ struct clkdm_ops omap2_clkdm_operations = { | |||
149 | .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps, | 185 | .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps, |
150 | .clkdm_sleep = omap2_clkdm_sleep, | 186 | .clkdm_sleep = omap2_clkdm_sleep, |
151 | .clkdm_wakeup = omap2_clkdm_wakeup, | 187 | .clkdm_wakeup = omap2_clkdm_wakeup, |
188 | .clkdm_allow_idle = omap2_clkdm_allow_idle, | ||
189 | .clkdm_deny_idle = omap2_clkdm_deny_idle, | ||
152 | }; | 190 | }; |
153 | 191 | ||
154 | struct clkdm_ops omap3_clkdm_operations = { | 192 | struct clkdm_ops omap3_clkdm_operations = { |
@@ -162,4 +200,6 @@ struct clkdm_ops omap3_clkdm_operations = { | |||
162 | .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps, | 200 | .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps, |
163 | .clkdm_sleep = omap3_clkdm_sleep, | 201 | .clkdm_sleep = omap3_clkdm_sleep, |
164 | .clkdm_wakeup = omap3_clkdm_wakeup, | 202 | .clkdm_wakeup = omap3_clkdm_wakeup, |
203 | .clkdm_allow_idle = omap3_clkdm_allow_idle, | ||
204 | .clkdm_deny_idle = omap3_clkdm_deny_idle, | ||
165 | }; | 205 | }; |
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c index 9ccb406cf54f..a46125f15454 100644 --- a/arch/arm/mach-omap2/clockdomain44xx.c +++ b/arch/arm/mach-omap2/clockdomain44xx.c | |||
@@ -29,7 +29,21 @@ static int omap4_clkdm_wakeup(struct clockdomain *clkdm) | |||
29 | return 0; | 29 | return 0; |
30 | } | 30 | } |
31 | 31 | ||
32 | static void omap4_clkdm_allow_idle(struct clockdomain *clkdm) | ||
33 | { | ||
34 | omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition, | ||
35 | clkdm->cm_inst, clkdm->clkdm_offs); | ||
36 | } | ||
37 | |||
38 | static void omap4_clkdm_deny_idle(struct clockdomain *clkdm) | ||
39 | { | ||
40 | omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition, | ||
41 | clkdm->cm_inst, clkdm->clkdm_offs); | ||
42 | } | ||
43 | |||
32 | struct clkdm_ops omap4_clkdm_operations = { | 44 | struct clkdm_ops omap4_clkdm_operations = { |
33 | .clkdm_sleep = omap4_clkdm_sleep, | 45 | .clkdm_sleep = omap4_clkdm_sleep, |
34 | .clkdm_wakeup = omap4_clkdm_wakeup, | 46 | .clkdm_wakeup = omap4_clkdm_wakeup, |
47 | .clkdm_allow_idle = omap4_clkdm_allow_idle, | ||
48 | .clkdm_deny_idle = omap4_clkdm_deny_idle, | ||
35 | }; | 49 | }; |
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index f7b22a16f385..7cc80715ef12 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c | |||
@@ -99,14 +99,14 @@ static int omap3_idle_bm_check(void) | |||
99 | static int _cpuidle_allow_idle(struct powerdomain *pwrdm, | 99 | static int _cpuidle_allow_idle(struct powerdomain *pwrdm, |
100 | struct clockdomain *clkdm) | 100 | struct clockdomain *clkdm) |
101 | { | 101 | { |
102 | omap2_clkdm_allow_idle(clkdm); | 102 | clkdm_allow_idle(clkdm); |
103 | return 0; | 103 | return 0; |
104 | } | 104 | } |
105 | 105 | ||
106 | static int _cpuidle_deny_idle(struct powerdomain *pwrdm, | 106 | static int _cpuidle_deny_idle(struct powerdomain *pwrdm, |
107 | struct clockdomain *clkdm) | 107 | struct clockdomain *clkdm) |
108 | { | 108 | { |
109 | omap2_clkdm_deny_idle(clkdm); | 109 | clkdm_deny_idle(clkdm); |
110 | return 0; | 110 | return 0; |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 74c31008079c..7bb64d8121a7 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -140,7 +140,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state) | |||
140 | switch (sleep_switch) { | 140 | switch (sleep_switch) { |
141 | case FORCEWAKEUP_SWITCH: | 141 | case FORCEWAKEUP_SWITCH: |
142 | if (pwrdm->pwrdm_clkdms[0]->flags & CLKDM_CAN_ENABLE_AUTO) | 142 | if (pwrdm->pwrdm_clkdms[0]->flags & CLKDM_CAN_ENABLE_AUTO) |
143 | omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]); | 143 | clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]); |
144 | else | 144 | else |
145 | clkdm_sleep(pwrdm->pwrdm_clkdms[0]); | 145 | clkdm_sleep(pwrdm->pwrdm_clkdms[0]); |
146 | break; | 146 | break; |
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index 4125621bf591..e983c8301f55 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -367,7 +367,7 @@ static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) | |||
367 | clkdm_clear_all_sleepdeps(clkdm); | 367 | clkdm_clear_all_sleepdeps(clkdm); |
368 | 368 | ||
369 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) | 369 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) |
370 | omap2_clkdm_allow_idle(clkdm); | 370 | clkdm_allow_idle(clkdm); |
371 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && | 371 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && |
372 | atomic_read(&clkdm->usecount) == 0) | 372 | atomic_read(&clkdm->usecount) == 0) |
373 | clkdm_sleep(clkdm); | 373 | clkdm_sleep(clkdm); |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 81df2b169a56..eda9a4e99a89 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -496,7 +496,7 @@ console_still_active: | |||
496 | 496 | ||
497 | pwrdm_post_transition(); | 497 | pwrdm_post_transition(); |
498 | 498 | ||
499 | omap2_clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]); | 499 | clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]); |
500 | } | 500 | } |
501 | 501 | ||
502 | int omap3_can_sleep(void) | 502 | int omap3_can_sleep(void) |
@@ -990,7 +990,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) | |||
990 | static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) | 990 | static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) |
991 | { | 991 | { |
992 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) | 992 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) |
993 | omap2_clkdm_allow_idle(clkdm); | 993 | clkdm_allow_idle(clkdm); |
994 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && | 994 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && |
995 | atomic_read(&clkdm->usecount) == 0) | 995 | atomic_read(&clkdm->usecount) == 0) |
996 | clkdm_sleep(clkdm); | 996 | clkdm_sleep(clkdm); |