aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/Makefile1
-rw-r--r--arch/arm/mach-omap2/clockdomain.c64
-rw-r--r--arch/arm/mach-omap2/clockdomain.h5
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c35
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c35
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/pm.c4
-rw-r--r--arch/arm/mach-omap2/pm24xx.c6
-rw-r--r--arch/arm/mach-omap2/pm34xx.c2
9 files changed, 96 insertions, 58 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 759d9ebd79c6..10c3c8f16eaa 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -108,6 +108,7 @@ obj-$(CONFIG_ARCH_OMAP3) += clockdomain.o \
108 clockdomain2xxx_3xxx.o \ 108 clockdomain2xxx_3xxx.o \
109 clockdomains2xxx_3xxx_data.o 109 clockdomains2xxx_3xxx_data.o
110obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \ 110obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \
111 clockdomain44xx.o \
111 clockdomains44xx_data.o 112 clockdomains44xx_data.o
112# Clock framework 113# Clock framework
113obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o \ 114obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o \
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 895c153c18e0..3035eb9eec36 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -355,7 +355,7 @@ void clkdm_init(struct clockdomain **clkdms,
355 */ 355 */
356 list_for_each_entry(clkdm, &clkdm_list, node) { 356 list_for_each_entry(clkdm, &clkdm_list, node) {
357 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) 357 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
358 omap2_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 omap2_clkdm_deny_idle(clkdm);
361 361
@@ -765,7 +765,7 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
765} 765}
766 766
767/** 767/**
768 * omap2_clkdm_sleep - force clockdomain sleep transition 768 * clkdm_sleep - force clockdomain sleep transition
769 * @clkdm: struct clockdomain * 769 * @clkdm: struct clockdomain *
770 * 770 *
771 * Instruct the CM to force a sleep transition on the specified 771 * Instruct the CM to force a sleep transition on the specified
@@ -773,7 +773,7 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
773 * clockdomain does not support software-initiated sleep; 0 upon 773 * clockdomain does not support software-initiated sleep; 0 upon
774 * success. 774 * success.
775 */ 775 */
776int omap2_clkdm_sleep(struct clockdomain *clkdm) 776int clkdm_sleep(struct clockdomain *clkdm)
777{ 777{
778 if (!clkdm) 778 if (!clkdm)
779 return -EINVAL; 779 return -EINVAL;
@@ -784,33 +784,16 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
784 return -EINVAL; 784 return -EINVAL;
785 } 785 }
786 786
787 pr_debug("clockdomain: forcing sleep on %s\n", clkdm->name); 787 if (!arch_clkdm || !arch_clkdm->clkdm_sleep)
788 788 return -EINVAL;
789 if (cpu_is_omap24xx()) {
790
791 omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
792 clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
793
794 } else if (cpu_is_omap34xx()) {
795
796 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
797 clkdm->clktrctrl_mask);
798
799 } else if (cpu_is_omap44xx()) {
800
801 omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition,
802 clkdm->cm_inst,
803 clkdm->clkdm_offs);
804 789
805 } else { 790 pr_debug("clockdomain: forcing sleep on %s\n", clkdm->name);
806 BUG();
807 };
808 791
809 return 0; 792 return arch_clkdm->clkdm_sleep(clkdm);
810} 793}
811 794
812/** 795/**
813 * omap2_clkdm_wakeup - force clockdomain wakeup transition 796 * clkdm_wakeup - force clockdomain wakeup transition
814 * @clkdm: struct clockdomain * 797 * @clkdm: struct clockdomain *
815 * 798 *
816 * Instruct the CM to force a wakeup transition on the specified 799 * Instruct the CM to force a wakeup transition on the specified
@@ -818,7 +801,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
818 * clockdomain does not support software-controlled wakeup; 0 upon 801 * clockdomain does not support software-controlled wakeup; 0 upon
819 * success. 802 * success.
820 */ 803 */
821int omap2_clkdm_wakeup(struct clockdomain *clkdm) 804int clkdm_wakeup(struct clockdomain *clkdm)
822{ 805{
823 if (!clkdm) 806 if (!clkdm)
824 return -EINVAL; 807 return -EINVAL;
@@ -829,29 +812,12 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
829 return -EINVAL; 812 return -EINVAL;
830 } 813 }
831 814
832 pr_debug("clockdomain: forcing wakeup on %s\n", clkdm->name); 815 if (!arch_clkdm || !arch_clkdm->clkdm_wakeup)
833 816 return -EINVAL;
834 if (cpu_is_omap24xx()) {
835
836 omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
837 clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
838
839 } else if (cpu_is_omap34xx()) {
840
841 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
842 clkdm->clktrctrl_mask);
843
844 } else if (cpu_is_omap44xx()) {
845
846 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
847 clkdm->cm_inst,
848 clkdm->clkdm_offs);
849 817
850 } else { 818 pr_debug("clockdomain: forcing wakeup on %s\n", clkdm->name);
851 BUG();
852 };
853 819
854 return 0; 820 return arch_clkdm->clkdm_wakeup(clkdm);
855} 821}
856 822
857/** 823/**
@@ -990,7 +956,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
990 _clkdm_add_autodeps(clkdm); 956 _clkdm_add_autodeps(clkdm);
991 _enable_hwsup(clkdm); 957 _enable_hwsup(clkdm);
992 } else { 958 } else {
993 omap2_clkdm_wakeup(clkdm); 959 clkdm_wakeup(clkdm);
994 } 960 }
995 961
996 pwrdm_wait_transition(clkdm->pwrdm.ptr); 962 pwrdm_wait_transition(clkdm->pwrdm.ptr);
@@ -1062,7 +1028,7 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
1062 _clkdm_del_autodeps(clkdm); 1028 _clkdm_del_autodeps(clkdm);
1063 _enable_hwsup(clkdm); 1029 _enable_hwsup(clkdm);
1064 } else { 1030 } else {
1065 omap2_clkdm_sleep(clkdm); 1031 clkdm_sleep(clkdm);
1066 } 1032 }
1067 1033
1068 pwrdm_clkdm_state_switch(clkdm); 1034 pwrdm_clkdm_state_switch(clkdm);
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 90b6d6a50862..7a5cb5cf9949 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -170,8 +170,8 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
170void omap2_clkdm_allow_idle(struct clockdomain *clkdm); 170void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
171void omap2_clkdm_deny_idle(struct clockdomain *clkdm); 171void omap2_clkdm_deny_idle(struct clockdomain *clkdm);
172 172
173int omap2_clkdm_wakeup(struct clockdomain *clkdm); 173int clkdm_wakeup(struct clockdomain *clkdm);
174int omap2_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 omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk);
177int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk); 177int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
@@ -182,5 +182,6 @@ extern void __init omap44xx_clockdomains_init(void);
182 182
183extern struct clkdm_ops omap2_clkdm_operations; 183extern struct clkdm_ops omap2_clkdm_operations;
184extern struct clkdm_ops omap3_clkdm_operations; 184extern struct clkdm_ops omap3_clkdm_operations;
185extern struct clkdm_ops omap4_clkdm_operations;
185 186
186#endif 187#endif
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
index a1fd6fd5a466..08c87fe3da12 100644
--- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
@@ -20,6 +20,7 @@
20#include "cm2xxx_3xxx.h" 20#include "cm2xxx_3xxx.h"
21#include "cm-regbits-24xx.h" 21#include "cm-regbits-24xx.h"
22#include "cm-regbits-34xx.h" 22#include "cm-regbits-34xx.h"
23#include "prm-regbits-24xx.h"
23#include "clockdomain.h" 24#include "clockdomain.h"
24 25
25static int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1, 26static int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
@@ -111,11 +112,43 @@ static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
111 return 0; 112 return 0;
112} 113}
113 114
115static int omap2_clkdm_sleep(struct clockdomain *clkdm)
116{
117 omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
118 clkdm->pwrdm.ptr->prcm_offs,
119 OMAP2_PM_PWSTCTRL);
120 return 0;
121}
122
123static int omap2_clkdm_wakeup(struct clockdomain *clkdm)
124{
125 omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
126 clkdm->pwrdm.ptr->prcm_offs,
127 OMAP2_PM_PWSTCTRL);
128 return 0;
129}
130
131static int omap3_clkdm_sleep(struct clockdomain *clkdm)
132{
133 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
134 clkdm->clktrctrl_mask);
135 return 0;
136}
137
138static int omap3_clkdm_wakeup(struct clockdomain *clkdm)
139{
140 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
141 clkdm->clktrctrl_mask);
142 return 0;
143}
144
114struct clkdm_ops omap2_clkdm_operations = { 145struct clkdm_ops omap2_clkdm_operations = {
115 .clkdm_add_wkdep = omap2_clkdm_add_wkdep, 146 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
116 .clkdm_del_wkdep = omap2_clkdm_del_wkdep, 147 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
117 .clkdm_read_wkdep = omap2_clkdm_read_wkdep, 148 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
118 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps, 149 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
150 .clkdm_sleep = omap2_clkdm_sleep,
151 .clkdm_wakeup = omap2_clkdm_wakeup,
119}; 152};
120 153
121struct clkdm_ops omap3_clkdm_operations = { 154struct clkdm_ops omap3_clkdm_operations = {
@@ -127,4 +160,6 @@ struct clkdm_ops omap3_clkdm_operations = {
127 .clkdm_del_sleepdep = omap3_clkdm_del_sleepdep, 160 .clkdm_del_sleepdep = omap3_clkdm_del_sleepdep,
128 .clkdm_read_sleepdep = omap3_clkdm_read_sleepdep, 161 .clkdm_read_sleepdep = omap3_clkdm_read_sleepdep,
129 .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps, 162 .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps,
163 .clkdm_sleep = omap3_clkdm_sleep,
164 .clkdm_wakeup = omap3_clkdm_wakeup,
130}; 165};
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
new file mode 100644
index 000000000000..9ccb406cf54f
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomain44xx.c
@@ -0,0 +1,35 @@
1/*
2 * OMAP4 clockdomain control
3 *
4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include "clockdomain.h"
16#include "cminst44xx.h"
17
18static int omap4_clkdm_sleep(struct clockdomain *clkdm)
19{
20 omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition,
21 clkdm->cm_inst, clkdm->clkdm_offs);
22 return 0;
23}
24
25static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
26{
27 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
28 clkdm->cm_inst, clkdm->clkdm_offs);
29 return 0;
30}
31
32struct clkdm_ops omap4_clkdm_operations = {
33 .clkdm_sleep = omap4_clkdm_sleep,
34 .clkdm_wakeup = omap4_clkdm_wakeup,
35};
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index a5000d473d45..eea6f8e40289 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -305,5 +305,5 @@ static struct clockdomain *clockdomains_omap44xx[] __initdata = {
305 305
306void __init omap44xx_clockdomains_init(void) 306void __init omap44xx_clockdomains_init(void)
307{ 307{
308 clkdm_init(clockdomains_omap44xx, NULL, NULL); 308 clkdm_init(clockdomains_omap44xx, NULL, &omap4_clkdm_operations);
309} 309}
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index d5a102c71989..74c31008079c 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -124,7 +124,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
124 (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) { 124 (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
125 sleep_switch = LOWPOWERSTATE_SWITCH; 125 sleep_switch = LOWPOWERSTATE_SWITCH;
126 } else { 126 } else {
127 omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]); 127 clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
128 pwrdm_wait_transition(pwrdm); 128 pwrdm_wait_transition(pwrdm);
129 sleep_switch = FORCEWAKEUP_SWITCH; 129 sleep_switch = FORCEWAKEUP_SWITCH;
130 } 130 }
@@ -142,7 +142,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
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 omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
144 else 144 else
145 omap2_clkdm_sleep(pwrdm->pwrdm_clkdms[0]); 145 clkdm_sleep(pwrdm->pwrdm_clkdms[0]);
146 break; 146 break;
147 case LOWPOWERSTATE_SWITCH: 147 case LOWPOWERSTATE_SWITCH:
148 pwrdm_set_lowpwrstchange(pwrdm); 148 pwrdm_set_lowpwrstchange(pwrdm);
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 97feb3ab6a69..4125621bf591 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -370,7 +370,7 @@ static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
370 omap2_clkdm_allow_idle(clkdm); 370 omap2_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 omap2_clkdm_sleep(clkdm); 373 clkdm_sleep(clkdm);
374 return 0; 374 return 0;
375} 375}
376 376
@@ -405,11 +405,11 @@ static void __init prcm_setup_regs(void)
405 405
406 pwrdm = clkdm_get_pwrdm(dsp_clkdm); 406 pwrdm = clkdm_get_pwrdm(dsp_clkdm);
407 pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF); 407 pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF);
408 omap2_clkdm_sleep(dsp_clkdm); 408 clkdm_sleep(dsp_clkdm);
409 409
410 pwrdm = clkdm_get_pwrdm(gfx_clkdm); 410 pwrdm = clkdm_get_pwrdm(gfx_clkdm);
411 pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF); 411 pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF);
412 omap2_clkdm_sleep(gfx_clkdm); 412 clkdm_sleep(gfx_clkdm);
413 413
414 /* 414 /*
415 * Clear clockdomain wakeup dependencies and enable 415 * Clear clockdomain wakeup dependencies and enable
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 2f864e4b085d..81df2b169a56 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -993,7 +993,7 @@ static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
993 omap2_clkdm_allow_idle(clkdm); 993 omap2_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 omap2_clkdm_sleep(clkdm); 996 clkdm_sleep(clkdm);
997 return 0; 997 return 0;
998} 998}
999 999