aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/clockdomain.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/clockdomain.c')
-rw-r--r--arch/arm/mach-omap2/clockdomain.c46
1 files changed, 38 insertions, 8 deletions
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index a38a615b422f..b87ad66f083e 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * OMAP2/3/4 clockdomain framework functions 2 * OMAP2/3/4 clockdomain framework functions
3 * 3 *
4 * Copyright (C) 2008-2009 Texas Instruments, Inc. 4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2009 Nokia Corporation 5 * Copyright (C) 2008-2010 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley and Jouni Högander 7 * Written by Paul Walmsley and Jouni Högander
8 * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> 8 * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com>
@@ -173,6 +173,9 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm)
173{ 173{
174 struct clkdm_autodep *autodep; 174 struct clkdm_autodep *autodep;
175 175
176 if (!autodeps)
177 return;
178
176 for (autodep = autodeps; autodep->clkdm.ptr; autodep++) { 179 for (autodep = autodeps; autodep->clkdm.ptr; autodep++) {
177 if (IS_ERR(autodep->clkdm.ptr)) 180 if (IS_ERR(autodep->clkdm.ptr))
178 continue; 181 continue;
@@ -201,6 +204,9 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)
201{ 204{
202 struct clkdm_autodep *autodep; 205 struct clkdm_autodep *autodep;
203 206
207 if (!autodeps)
208 return;
209
204 for (autodep = autodeps; autodep->clkdm.ptr; autodep++) { 210 for (autodep = autodeps; autodep->clkdm.ptr; autodep++) {
205 if (IS_ERR(autodep->clkdm.ptr)) 211 if (IS_ERR(autodep->clkdm.ptr))
206 continue; 212 continue;
@@ -891,8 +897,17 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
891 pr_debug("clockdomain: enabling automatic idle transitions for %s\n", 897 pr_debug("clockdomain: enabling automatic idle transitions for %s\n",
892 clkdm->name); 898 clkdm->name);
893 899
894 if (atomic_read(&clkdm->usecount) > 0) 900 /*
895 _clkdm_add_autodeps(clkdm); 901 * XXX This should be removed once TI adds wakeup/sleep
902 * dependency code and data for OMAP4.
903 */
904 if (cpu_is_omap44xx()) {
905 WARN_ONCE(1, "clockdomain: OMAP4 wakeup/sleep dependency "
906 "support is not yet implemented\n");
907 } else {
908 if (atomic_read(&clkdm->usecount) > 0)
909 _clkdm_add_autodeps(clkdm);
910 }
896 911
897 _omap2_clkdm_set_hwsup(clkdm, 1); 912 _omap2_clkdm_set_hwsup(clkdm, 1);
898 913
@@ -924,8 +939,17 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
924 939
925 _omap2_clkdm_set_hwsup(clkdm, 0); 940 _omap2_clkdm_set_hwsup(clkdm, 0);
926 941
927 if (atomic_read(&clkdm->usecount) > 0) 942 /*
928 _clkdm_del_autodeps(clkdm); 943 * XXX This should be removed once TI adds wakeup/sleep
944 * dependency code and data for OMAP4.
945 */
946 if (cpu_is_omap44xx()) {
947 WARN_ONCE(1, "clockdomain: OMAP4 wakeup/sleep dependency "
948 "support is not yet implemented\n");
949 } else {
950 if (atomic_read(&clkdm->usecount) > 0)
951 _clkdm_del_autodeps(clkdm);
952 }
929} 953}
930 954
931 955
@@ -954,7 +978,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
954 * downstream clocks for debugging purposes? 978 * downstream clocks for debugging purposes?
955 */ 979 */
956 980
957 if (!clkdm || !clk || !clkdm->clkstctrl_reg) 981 if (!clkdm || !clk)
958 return -EINVAL; 982 return -EINVAL;
959 983
960 if (atomic_inc_return(&clkdm->usecount) > 1) 984 if (atomic_inc_return(&clkdm->usecount) > 1)
@@ -965,6 +989,9 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
965 pr_debug("clockdomain: clkdm %s: clk %s now enabled\n", clkdm->name, 989 pr_debug("clockdomain: clkdm %s: clk %s now enabled\n", clkdm->name,
966 clk->name); 990 clk->name);
967 991
992 if (!clkdm->clkstctrl_reg)
993 return 0;
994
968 v = omap2_clkdm_clktrctrl_read(clkdm); 995 v = omap2_clkdm_clktrctrl_read(clkdm);
969 996
970 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || 997 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
@@ -1006,7 +1033,7 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
1006 * downstream clocks for debugging purposes? 1033 * downstream clocks for debugging purposes?
1007 */ 1034 */
1008 1035
1009 if (!clkdm || !clk || !clkdm->clkstctrl_reg) 1036 if (!clkdm || !clk)
1010 return -EINVAL; 1037 return -EINVAL;
1011 1038
1012#ifdef DEBUG 1039#ifdef DEBUG
@@ -1024,6 +1051,9 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
1024 pr_debug("clockdomain: clkdm %s: clk %s now disabled\n", clkdm->name, 1051 pr_debug("clockdomain: clkdm %s: clk %s now disabled\n", clkdm->name,
1025 clk->name); 1052 clk->name);
1026 1053
1054 if (!clkdm->clkstctrl_reg)
1055 return 0;
1056
1027 v = omap2_clkdm_clktrctrl_read(clkdm); 1057 v = omap2_clkdm_clktrctrl_read(clkdm);
1028 1058
1029 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || 1059 if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||