Commit 5cd1937b6d5990fe5d5287d925f05afd38e9fb02
Committed by
Paul Walmsley
1 parent
68b921ad7f
Exists in
master
and in
4 other branches
OMAP: clockdomain: Arch specific funcs for hwsup control of clkdm
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>
Showing 8 changed files with 79 additions and 40 deletions Side-by-side Diff
arch/arm/mach-omap2/clockdomain.c
... | ... | @@ -178,7 +178,7 @@ |
178 | 178 | * XXX autodeps are deprecated and should be removed at the earliest |
179 | 179 | * opportunity |
180 | 180 | */ |
181 | -static void _clkdm_add_autodeps(struct clockdomain *clkdm) | |
181 | +void _clkdm_add_autodeps(struct clockdomain *clkdm) | |
182 | 182 | { |
183 | 183 | struct clkdm_autodep *autodep; |
184 | 184 | |
... | ... | @@ -212,7 +212,7 @@ |
212 | 212 | * XXX autodeps are deprecated and should be removed at the earliest |
213 | 213 | * opportunity |
214 | 214 | */ |
215 | -static void _clkdm_del_autodeps(struct clockdomain *clkdm) | |
215 | +void _clkdm_del_autodeps(struct clockdomain *clkdm) | |
216 | 216 | { |
217 | 217 | struct clkdm_autodep *autodep; |
218 | 218 | |
... | ... | @@ -357,7 +357,7 @@ |
357 | 357 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) |
358 | 358 | clkdm_wakeup(clkdm); |
359 | 359 | else if (clkdm->flags & CLKDM_CAN_DISABLE_AUTO) |
360 | - omap2_clkdm_deny_idle(clkdm); | |
360 | + clkdm_deny_idle(clkdm); | |
361 | 361 | |
362 | 362 | _resolve_clkdm_deps(clkdm, clkdm->wkdep_srcs); |
363 | 363 | clkdm_clear_all_wkdeps(clkdm); |
... | ... | @@ -821,7 +821,7 @@ |
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 | 825 | * @clkdm: struct clockdomain * |
826 | 826 | * |
827 | 827 | * Allow the hardware to automatically switch the clockdomain @clkdm into |
... | ... | @@ -830,7 +830,7 @@ |
830 | 830 | * framework, wkdep/sleepdep autodependencies are added; this is so |
831 | 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 | 835 | if (!clkdm) |
836 | 836 | return; |
837 | 837 | |
838 | 838 | |
... | ... | @@ -841,27 +841,18 @@ |
841 | 841 | return; |
842 | 842 | } |
843 | 843 | |
844 | + if (!arch_clkdm || !arch_clkdm->clkdm_allow_idle) | |
845 | + return; | |
846 | + | |
844 | 847 | pr_debug("clockdomain: enabling automatic idle transitions for %s\n", |
845 | 848 | clkdm->name); |
846 | 849 | |
847 | - /* | |
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 | - | |
850 | + arch_clkdm->clkdm_allow_idle(clkdm); | |
860 | 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 | 856 | * @clkdm: struct clockdomain * |
866 | 857 | * |
867 | 858 | * Prevent the hardware from automatically switching the clockdomain |
... | ... | @@ -869,7 +860,7 @@ |
869 | 860 | * downstream clocks enabled in the clock framework, wkdep/sleepdep |
870 | 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 | 865 | if (!clkdm) |
875 | 866 | return; |
876 | 867 | |
... | ... | @@ -880,21 +871,13 @@ |
880 | 871 | return; |
881 | 872 | } |
882 | 873 | |
874 | + if (!arch_clkdm || !arch_clkdm->clkdm_deny_idle) | |
875 | + return; | |
876 | + | |
883 | 877 | pr_debug("clockdomain: disabling automatic idle transitions for %s\n", |
884 | 878 | clkdm->name); |
885 | 879 | |
886 | - _disable_hwsup(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 | - } | |
880 | + arch_clkdm->clkdm_deny_idle(clkdm); | |
898 | 881 | } |
899 | 882 | |
900 | 883 |
arch/arm/mach-omap2/clockdomain.h
... | ... | @@ -167,8 +167,8 @@ |
167 | 167 | int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); |
168 | 168 | int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm); |
169 | 169 | |
170 | -void omap2_clkdm_allow_idle(struct clockdomain *clkdm); | |
171 | -void omap2_clkdm_deny_idle(struct clockdomain *clkdm); | |
170 | +void clkdm_allow_idle(struct clockdomain *clkdm); | |
171 | +void clkdm_deny_idle(struct clockdomain *clkdm); | |
172 | 172 | |
173 | 173 | int clkdm_wakeup(struct clockdomain *clkdm); |
174 | 174 | int clkdm_sleep(struct clockdomain *clkdm); |
... | ... | @@ -179,6 +179,8 @@ |
179 | 179 | extern void __init omap2xxx_clockdomains_init(void); |
180 | 180 | extern void __init omap3xxx_clockdomains_init(void); |
181 | 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 | 185 | extern struct clkdm_ops omap2_clkdm_operations; |
184 | 186 | extern struct clkdm_ops omap3_clkdm_operations; |
arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
... | ... | @@ -128,6 +128,24 @@ |
128 | 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 | 149 | static int omap3_clkdm_sleep(struct clockdomain *clkdm) |
132 | 150 | { |
133 | 151 | omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs, |
... | ... | @@ -142,6 +160,24 @@ |
142 | 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 | 181 | struct clkdm_ops omap2_clkdm_operations = { |
146 | 182 | .clkdm_add_wkdep = omap2_clkdm_add_wkdep, |
147 | 183 | .clkdm_del_wkdep = omap2_clkdm_del_wkdep, |
... | ... | @@ -149,6 +185,8 @@ |
149 | 185 | .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps, |
150 | 186 | .clkdm_sleep = omap2_clkdm_sleep, |
151 | 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 | 192 | struct clkdm_ops omap3_clkdm_operations = { |
... | ... | @@ -162,5 +200,7 @@ |
162 | 200 | .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps, |
163 | 201 | .clkdm_sleep = omap3_clkdm_sleep, |
164 | 202 | .clkdm_wakeup = omap3_clkdm_wakeup, |
203 | + .clkdm_allow_idle = omap3_clkdm_allow_idle, | |
204 | + .clkdm_deny_idle = omap3_clkdm_deny_idle, | |
165 | 205 | }; |
arch/arm/mach-omap2/clockdomain44xx.c
... | ... | @@ -29,8 +29,22 @@ |
29 | 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 | 44 | struct clkdm_ops omap4_clkdm_operations = { |
33 | 45 | .clkdm_sleep = omap4_clkdm_sleep, |
34 | 46 | .clkdm_wakeup = omap4_clkdm_wakeup, |
47 | + .clkdm_allow_idle = omap4_clkdm_allow_idle, | |
48 | + .clkdm_deny_idle = omap4_clkdm_deny_idle, | |
35 | 49 | }; |
arch/arm/mach-omap2/cpuidle34xx.c
... | ... | @@ -99,14 +99,14 @@ |
99 | 99 | static int _cpuidle_allow_idle(struct powerdomain *pwrdm, |
100 | 100 | struct clockdomain *clkdm) |
101 | 101 | { |
102 | - omap2_clkdm_allow_idle(clkdm); | |
102 | + clkdm_allow_idle(clkdm); | |
103 | 103 | return 0; |
104 | 104 | } |
105 | 105 | |
106 | 106 | static int _cpuidle_deny_idle(struct powerdomain *pwrdm, |
107 | 107 | struct clockdomain *clkdm) |
108 | 108 | { |
109 | - omap2_clkdm_deny_idle(clkdm); | |
109 | + clkdm_deny_idle(clkdm); | |
110 | 110 | return 0; |
111 | 111 | } |
112 | 112 |
arch/arm/mach-omap2/pm.c
... | ... | @@ -140,7 +140,7 @@ |
140 | 140 | switch (sleep_switch) { |
141 | 141 | case FORCEWAKEUP_SWITCH: |
142 | 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 | 144 | else |
145 | 145 | clkdm_sleep(pwrdm->pwrdm_clkdms[0]); |
146 | 146 | break; |
arch/arm/mach-omap2/pm24xx.c
... | ... | @@ -367,7 +367,7 @@ |
367 | 367 | clkdm_clear_all_sleepdeps(clkdm); |
368 | 368 | |
369 | 369 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) |
370 | - omap2_clkdm_allow_idle(clkdm); | |
370 | + clkdm_allow_idle(clkdm); | |
371 | 371 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && |
372 | 372 | atomic_read(&clkdm->usecount) == 0) |
373 | 373 | clkdm_sleep(clkdm); |
arch/arm/mach-omap2/pm34xx.c
... | ... | @@ -496,7 +496,7 @@ |
496 | 496 | |
497 | 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 | 502 | int omap3_can_sleep(void) |
... | ... | @@ -990,7 +990,7 @@ |
990 | 990 | static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) |
991 | 991 | { |
992 | 992 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) |
993 | - omap2_clkdm_allow_idle(clkdm); | |
993 | + clkdm_allow_idle(clkdm); | |
994 | 994 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && |
995 | 995 | atomic_read(&clkdm->usecount) == 0) |
996 | 996 | clkdm_sleep(clkdm); |