aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/clockdomain.c
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/clockdomain.c
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/clockdomain.c')
-rw-r--r--arch/arm/mach-omap2/clockdomain.c131
1 files changed, 12 insertions, 119 deletions
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;