aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorRajendra Nayak <rnayak@ti.com>2011-02-25 18:06:48 -0500
committerPaul Walmsley <paul@pwsan.com>2011-02-25 18:06:48 -0500
commit4da71ae607fc657075286abd2774041ff4d00fe5 (patch)
treec43b8dfe4c8bae5bd3aa66771488804112154f6e /arch/arm/mach-omap2
parent5cd1937b6d5990fe5d5287d925f05afd38e9fb02 (diff)
OMAP: clockdomain: Arch specific funcs for clkdm_clk_enable/disable
Define the following architecture specific funtions for omap2/3/4 .clkdm_clk_enable .clkdm_clk_disable Convert the platform-independent framework to call these functions. Also rename the api's by removing the omap2_ preamble. Hence call omap2_clkdm_k_enable as clkdm_clk_enable and omap2_clkdm_clk_disable as clkdm_clk_disable.a Remove unused functions (_enable/_disable_hwsup) and unsed headers from clockdomain.c file. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/clock.c6
-rw-r--r--arch/arm/mach-omap2/clockdomain.c131
-rw-r--r--arch/arm/mach-omap2/clockdomain.h4
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c69
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c28
5 files changed, 114 insertions, 124 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 2a2f15213add..e9625fcf6390 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -264,7 +264,7 @@ void omap2_clk_disable(struct clk *clk)
264 clk->ops->disable(clk); 264 clk->ops->disable(clk);
265 265
266 if (clk->clkdm) 266 if (clk->clkdm)
267 omap2_clkdm_clk_disable(clk->clkdm, clk); 267 clkdm_clk_disable(clk->clkdm, clk);
268 268
269 if (clk->parent) 269 if (clk->parent)
270 omap2_clk_disable(clk->parent); 270 omap2_clk_disable(clk->parent);
@@ -304,7 +304,7 @@ int omap2_clk_enable(struct clk *clk)
304 } 304 }
305 305
306 if (clk->clkdm) { 306 if (clk->clkdm) {
307 ret = omap2_clkdm_clk_enable(clk->clkdm, clk); 307 ret = clkdm_clk_enable(clk->clkdm, clk);
308 if (ret) { 308 if (ret) {
309 WARN(1, "clock: %s: could not enable clockdomain %s: " 309 WARN(1, "clock: %s: could not enable clockdomain %s: "
310 "%d\n", clk->name, clk->clkdm->name, ret); 310 "%d\n", clk->name, clk->clkdm->name, ret);
@@ -322,7 +322,7 @@ int omap2_clk_enable(struct clk *clk)
322 322
323oce_err3: 323oce_err3:
324 if (clk->clkdm) 324 if (clk->clkdm)
325 omap2_clkdm_clk_disable(clk->clkdm, clk); 325 clkdm_clk_disable(clk->clkdm, clk);
326oce_err2: 326oce_err2:
327 if (clk->parent) 327 if (clk->parent)
328 omap2_clk_disable(clk->parent); 328 omap2_clk_disable(clk->parent);
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 44664e7cc2a6..70d242007e0b 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -26,17 +26,8 @@
26 26
27#include <linux/bitops.h> 27#include <linux/bitops.h>
28 28
29#include "prm2xxx_3xxx.h"
30#include "prm-regbits-24xx.h"
31#include "cm2xxx_3xxx.h"
32#include "cm-regbits-24xx.h"
33#include "cminst44xx.h"
34#include "prcm44xx.h"
35
36#include <plat/clock.h> 29#include <plat/clock.h>
37#include "powerdomain.h"
38#include "clockdomain.h" 30#include "clockdomain.h"
39#include <plat/prcm.h>
40 31
41/* clkdm_list contains all registered struct clockdomains */ 32/* clkdm_list contains all registered struct clockdomains */
42static LIST_HEAD(clkdm_list); 33static LIST_HEAD(clkdm_list);
@@ -236,58 +227,6 @@ void _clkdm_del_autodeps(struct clockdomain *clkdm)
236} 227}
237 228
238/** 229/**
239 * _enable_hwsup - place a clockdomain into hardware-supervised idle
240 * @clkdm: struct clockdomain *
241 *
242 * Place the clockdomain into hardware-supervised idle mode. No return
243 * value.
244 *
245 * XXX Should this return an error if the clockdomain does not support
246 * hardware-supervised idle mode?
247 */
248static void _enable_hwsup(struct clockdomain *clkdm)
249{
250 if (cpu_is_omap24xx())
251 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
252 clkdm->clktrctrl_mask);
253 else if (cpu_is_omap34xx())
254 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
255 clkdm->clktrctrl_mask);
256 else if (cpu_is_omap44xx())
257 return omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
258 clkdm->cm_inst,
259 clkdm->clkdm_offs);
260 else
261 BUG();
262}
263
264/**
265 * _disable_hwsup - place a clockdomain into software-supervised idle
266 * @clkdm: struct clockdomain *
267 *
268 * Place the clockdomain @clkdm into software-supervised idle mode.
269 * No return value.
270 *
271 * XXX Should this return an error if the clockdomain does not support
272 * software-supervised idle mode?
273 */
274static void _disable_hwsup(struct clockdomain *clkdm)
275{
276 if (cpu_is_omap24xx())
277 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
278 clkdm->clktrctrl_mask);
279 else if (cpu_is_omap34xx())
280 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
281 clkdm->clktrctrl_mask);
282 else if (cpu_is_omap44xx())
283 return omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
284 clkdm->cm_inst,
285 clkdm->clkdm_offs);
286 else
287 BUG();
288}
289
290/**
291 * _resolve_clkdm_deps() - resolve clkdm_names in @clkdm_deps to clkdms 230 * _resolve_clkdm_deps() - resolve clkdm_names in @clkdm_deps to clkdms
292 * @clkdm: clockdomain that we are resolving dependencies for 231 * @clkdm: clockdomain that we are resolving dependencies for
293 * @clkdm_deps: ptr to array of struct clkdm_deps to resolve 232 * @clkdm_deps: ptr to array of struct clkdm_deps to resolve
@@ -884,7 +823,7 @@ void clkdm_deny_idle(struct clockdomain *clkdm)
884/* Clockdomain-to-clock framework interface code */ 823/* Clockdomain-to-clock framework interface code */
885 824
886/** 825/**
887 * omap2_clkdm_clk_enable - add an enabled downstream clock to this clkdm 826 * clkdm_clk_enable - add an enabled downstream clock to this clkdm
888 * @clkdm: struct clockdomain * 827 * @clkdm: struct clockdomain *
889 * @clk: struct clk * of the enabled downstream clock 828 * @clk: struct clk * of the enabled downstream clock
890 * 829 *
@@ -897,10 +836,8 @@ void clkdm_deny_idle(struct clockdomain *clkdm)
897 * by on-chip processors. Returns -EINVAL if passed null pointers; 836 * by on-chip processors. Returns -EINVAL if passed null pointers;
898 * returns 0 upon success or if the clockdomain is in hwsup idle mode. 837 * returns 0 upon success or if the clockdomain is in hwsup idle mode.
899 */ 838 */
900int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) 839int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
901{ 840{
902 bool hwsup = false;
903
904 /* 841 /*
905 * XXX Rewrite this code to maintain a list of enabled 842 * XXX Rewrite this code to maintain a list of enabled
906 * downstream clocks for debugging purposes? 843 * downstream clocks for debugging purposes?
@@ -909,6 +846,9 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
909 if (!clkdm || !clk) 846 if (!clkdm || !clk)
910 return -EINVAL; 847 return -EINVAL;
911 848
849 if (!arch_clkdm || !arch_clkdm->clkdm_clk_enable)
850 return -EINVAL;
851
912 if (atomic_inc_return(&clkdm->usecount) > 1) 852 if (atomic_inc_return(&clkdm->usecount) > 1)
913 return 0; 853 return 0;
914 854
@@ -917,31 +857,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
917 pr_debug("clockdomain: clkdm %s: clk %s now enabled\n", clkdm->name, 857 pr_debug("clockdomain: clkdm %s: clk %s now enabled\n", clkdm->name,
918 clk->name); 858 clk->name);
919 859
920 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 860 arch_clkdm->clkdm_clk_enable(clkdm);
921
922 if (!clkdm->clktrctrl_mask)
923 return 0;
924
925 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
926 clkdm->clktrctrl_mask);
927
928 } else if (cpu_is_omap44xx()) {
929
930 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
931 clkdm->cm_inst,
932 clkdm->clkdm_offs);
933
934 }
935
936 if (hwsup) {
937 /* Disable HW transitions when we are changing deps */
938 _disable_hwsup(clkdm);
939 _clkdm_add_autodeps(clkdm);
940 _enable_hwsup(clkdm);
941 } else {
942 clkdm_wakeup(clkdm);
943 }
944
945 pwrdm_wait_transition(clkdm->pwrdm.ptr); 861 pwrdm_wait_transition(clkdm->pwrdm.ptr);
946 pwrdm_clkdm_state_switch(clkdm); 862 pwrdm_clkdm_state_switch(clkdm);
947 863
@@ -949,7 +865,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
949} 865}
950 866
951/** 867/**
952 * omap2_clkdm_clk_disable - remove an enabled downstream clock from this clkdm 868 * clkdm_clk_disable - remove an enabled downstream clock from this clkdm
953 * @clkdm: struct clockdomain * 869 * @clkdm: struct clockdomain *
954 * @clk: struct clk * of the disabled downstream clock 870 * @clk: struct clk * of the disabled downstream clock
955 * 871 *
@@ -962,10 +878,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
962 * is enabled; or returns 0 upon success or if the clockdomain is in 878 * is enabled; or returns 0 upon success or if the clockdomain is in
963 * hwsup idle mode. 879 * hwsup idle mode.
964 */ 880 */
965int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) 881int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
966{ 882{
967 bool hwsup = false;
968
969 /* 883 /*
970 * XXX Rewrite this code to maintain a list of enabled 884 * XXX Rewrite this code to maintain a list of enabled
971 * downstream clocks for debugging purposes? 885 * downstream clocks for debugging purposes?
@@ -974,6 +888,9 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
974 if (!clkdm || !clk) 888 if (!clkdm || !clk)
975 return -EINVAL; 889 return -EINVAL;
976 890
891 if (!arch_clkdm || !arch_clkdm->clkdm_clk_disable)
892 return -EINVAL;
893
977#ifdef DEBUG 894#ifdef DEBUG
978 if (atomic_read(&clkdm->usecount) == 0) { 895 if (atomic_read(&clkdm->usecount) == 0) {
979 WARN_ON(1); /* underflow */ 896 WARN_ON(1); /* underflow */
@@ -989,31 +906,7 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
989 pr_debug("clockdomain: clkdm %s: clk %s now disabled\n", clkdm->name, 906 pr_debug("clockdomain: clkdm %s: clk %s now disabled\n", clkdm->name,
990 clk->name); 907 clk->name);
991 908
992 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 909 arch_clkdm->clkdm_clk_disable(clkdm);
993
994 if (!clkdm->clktrctrl_mask)
995 return 0;
996
997 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
998 clkdm->clktrctrl_mask);
999
1000 } else if (cpu_is_omap44xx()) {
1001
1002 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
1003 clkdm->cm_inst,
1004 clkdm->clkdm_offs);
1005
1006 }
1007
1008 if (hwsup) {
1009 /* Disable HW transitions when we are changing deps */
1010 _disable_hwsup(clkdm);
1011 _clkdm_del_autodeps(clkdm);
1012 _enable_hwsup(clkdm);
1013 } else {
1014 clkdm_sleep(clkdm);
1015 }
1016
1017 pwrdm_clkdm_state_switch(clkdm); 910 pwrdm_clkdm_state_switch(clkdm);
1018 911
1019 return 0; 912 return 0;
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 7126658d9ae1..de52f059f9e2 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -173,8 +173,8 @@ void clkdm_deny_idle(struct clockdomain *clkdm);
173int clkdm_wakeup(struct clockdomain *clkdm); 173int clkdm_wakeup(struct clockdomain *clkdm);
174int clkdm_sleep(struct clockdomain *clkdm); 174int clkdm_sleep(struct clockdomain *clkdm);
175 175
176int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk); 176int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk);
177int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk); 177int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
178 178
179extern void __init omap2xxx_clockdomains_init(void); 179extern void __init omap2xxx_clockdomains_init(void);
180extern void __init omap3xxx_clockdomains_init(void); 180extern void __init omap3xxx_clockdomains_init(void);
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
index 25c27a5c722f..48d0db7e6069 100644
--- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
@@ -146,6 +146,71 @@ static void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
146 _clkdm_del_autodeps(clkdm); 146 _clkdm_del_autodeps(clkdm);
147} 147}
148 148
149static void _enable_hwsup(struct clockdomain *clkdm)
150{
151 if (cpu_is_omap24xx())
152 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
153 clkdm->clktrctrl_mask);
154 else if (cpu_is_omap34xx())
155 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
156 clkdm->clktrctrl_mask);
157}
158
159static void _disable_hwsup(struct clockdomain *clkdm)
160{
161 if (cpu_is_omap24xx())
162 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
163 clkdm->clktrctrl_mask);
164 else if (cpu_is_omap34xx())
165 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
166 clkdm->clktrctrl_mask);
167}
168
169
170static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
171{
172 bool hwsup = false;
173
174 if (!clkdm->clktrctrl_mask)
175 return 0;
176
177 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
178 clkdm->clktrctrl_mask);
179
180 if (hwsup) {
181 /* Disable HW transitions when we are changing deps */
182 _disable_hwsup(clkdm);
183 _clkdm_add_autodeps(clkdm);
184 _enable_hwsup(clkdm);
185 } else {
186 clkdm_wakeup(clkdm);
187 }
188
189 return 0;
190}
191
192static int omap2_clkdm_clk_disable(struct clockdomain *clkdm)
193{
194 bool hwsup = false;
195
196 if (!clkdm->clktrctrl_mask)
197 return 0;
198
199 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
200 clkdm->clktrctrl_mask);
201
202 if (hwsup) {
203 /* Disable HW transitions when we are changing deps */
204 _disable_hwsup(clkdm);
205 _clkdm_del_autodeps(clkdm);
206 _enable_hwsup(clkdm);
207 } else {
208 clkdm_sleep(clkdm);
209 }
210
211 return 0;
212}
213
149static int omap3_clkdm_sleep(struct clockdomain *clkdm) 214static int omap3_clkdm_sleep(struct clockdomain *clkdm)
150{ 215{
151 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs, 216 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
@@ -187,6 +252,8 @@ struct clkdm_ops omap2_clkdm_operations = {
187 .clkdm_wakeup = omap2_clkdm_wakeup, 252 .clkdm_wakeup = omap2_clkdm_wakeup,
188 .clkdm_allow_idle = omap2_clkdm_allow_idle, 253 .clkdm_allow_idle = omap2_clkdm_allow_idle,
189 .clkdm_deny_idle = omap2_clkdm_deny_idle, 254 .clkdm_deny_idle = omap2_clkdm_deny_idle,
255 .clkdm_clk_enable = omap2_clkdm_clk_enable,
256 .clkdm_clk_disable = omap2_clkdm_clk_disable,
190}; 257};
191 258
192struct clkdm_ops omap3_clkdm_operations = { 259struct clkdm_ops omap3_clkdm_operations = {
@@ -202,4 +269,6 @@ struct clkdm_ops omap3_clkdm_operations = {
202 .clkdm_wakeup = omap3_clkdm_wakeup, 269 .clkdm_wakeup = omap3_clkdm_wakeup,
203 .clkdm_allow_idle = omap3_clkdm_allow_idle, 270 .clkdm_allow_idle = omap3_clkdm_allow_idle,
204 .clkdm_deny_idle = omap3_clkdm_deny_idle, 271 .clkdm_deny_idle = omap3_clkdm_deny_idle,
272 .clkdm_clk_enable = omap2_clkdm_clk_enable,
273 .clkdm_clk_disable = omap2_clkdm_clk_disable,
205}; 274};
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
index a46125f15454..c0ccc4701646 100644
--- a/arch/arm/mach-omap2/clockdomain44xx.c
+++ b/arch/arm/mach-omap2/clockdomain44xx.c
@@ -41,9 +41,37 @@ static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
41 clkdm->cm_inst, clkdm->clkdm_offs); 41 clkdm->cm_inst, clkdm->clkdm_offs);
42} 42}
43 43
44static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
45{
46 bool hwsup = false;
47
48 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
49 clkdm->cm_inst, clkdm->clkdm_offs);
50
51 if (!hwsup)
52 clkdm_wakeup(clkdm);
53
54 return 0;
55}
56
57static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
58{
59 bool hwsup = false;
60
61 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
62 clkdm->cm_inst, clkdm->clkdm_offs);
63
64 if (!hwsup)
65 clkdm_sleep(clkdm);
66
67 return 0;
68}
69
44struct clkdm_ops omap4_clkdm_operations = { 70struct clkdm_ops omap4_clkdm_operations = {
45 .clkdm_sleep = omap4_clkdm_sleep, 71 .clkdm_sleep = omap4_clkdm_sleep,
46 .clkdm_wakeup = omap4_clkdm_wakeup, 72 .clkdm_wakeup = omap4_clkdm_wakeup,
47 .clkdm_allow_idle = omap4_clkdm_allow_idle, 73 .clkdm_allow_idle = omap4_clkdm_allow_idle,
48 .clkdm_deny_idle = omap4_clkdm_deny_idle, 74 .clkdm_deny_idle = omap4_clkdm_deny_idle,
75 .clkdm_clk_enable = omap4_clkdm_clk_enable,
76 .clkdm_clk_disable = omap4_clkdm_clk_disable,
49}; 77};