aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/clockdomain.c75
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c121
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h11
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c105
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h6
5 files changed, 252 insertions, 66 deletions
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 8e3276bfed25..555a518836b9 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -29,6 +29,9 @@
29#include "prm2xxx_3xxx.h" 29#include "prm2xxx_3xxx.h"
30#include "prm-regbits-24xx.h" 30#include "prm-regbits-24xx.h"
31#include "cm2xxx_3xxx.h" 31#include "cm2xxx_3xxx.h"
32#include "cm-regbits-34xx.h"
33#include "cminst44xx.h"
34#include "prcm44xx.h"
32 35
33#include <plat/clock.h> 36#include <plat/clock.h>
34#include <plat/powerdomain.h> 37#include <plat/powerdomain.h>
@@ -247,13 +250,21 @@ static void _enable_hwsup(struct clockdomain *clkdm)
247 250
248 if (cpu_is_omap24xx()) 251 if (cpu_is_omap24xx())
249 bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO; 252 bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
250 else if (cpu_is_omap34xx() || cpu_is_omap44xx()) 253 else if (cpu_is_omap34xx())
251 bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO; 254 bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
255 else if (cpu_is_omap44xx())
256 return omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
257 clkdm->cm_inst,
258 clkdm->clkdm_offs);
252 else 259 else
253 BUG(); 260 BUG();
254 261
255 bits = bits << __ffs(clkdm->clktrctrl_mask); 262 bits = bits << __ffs(clkdm->clktrctrl_mask);
256 263
264 /*
265 * XXX clkstctrl_reg is known on OMAP2 - this clkdm
266 * field is not needed
267 */
257 v = __raw_readl(clkdm->clkstctrl_reg); 268 v = __raw_readl(clkdm->clkstctrl_reg);
258 v &= ~(clkdm->clktrctrl_mask); 269 v &= ~(clkdm->clktrctrl_mask);
259 v |= bits; 270 v |= bits;
@@ -275,21 +286,27 @@ static void _disable_hwsup(struct clockdomain *clkdm)
275{ 286{
276 u32 bits, v; 287 u32 bits, v;
277 288
278 if (cpu_is_omap24xx()) { 289 if (cpu_is_omap24xx())
279 bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO; 290 bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
280 } else if (cpu_is_omap34xx() || cpu_is_omap44xx()) { 291 else if (cpu_is_omap34xx())
281 bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO; 292 bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
282 } else { 293 else if (cpu_is_omap44xx())
294 return omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
295 clkdm->cm_inst,
296 clkdm->clkdm_offs);
297 else
283 BUG(); 298 BUG();
284 }
285 299
286 bits = bits << __ffs(clkdm->clktrctrl_mask); 300 bits = bits << __ffs(clkdm->clktrctrl_mask);
287 301
302 /*
303 * XXX clkstctrl_reg is known on OMAP2 - this clkdm
304 * field is not needed
305 */
288 v = __raw_readl(clkdm->clkstctrl_reg); 306 v = __raw_readl(clkdm->clkstctrl_reg);
289 v &= ~(clkdm->clktrctrl_mask); 307 v &= ~(clkdm->clktrctrl_mask);
290 v |= bits; 308 v |= bits;
291 __raw_writel(v, clkdm->clkstctrl_reg); 309 __raw_writel(v, clkdm->clkstctrl_reg);
292
293} 310}
294 311
295/* Public functions */ 312/* Public functions */
@@ -727,14 +744,20 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
727 */ 744 */
728static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm) 745static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
729{ 746{
730 u32 v; 747 u32 v = 0;
731 748
732 if (!clkdm) 749 if (!clkdm)
733 return -EINVAL; 750 return -EINVAL;
734 751
735 v = __raw_readl(clkdm->clkstctrl_reg); 752 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
736 v &= clkdm->clktrctrl_mask; 753 v = __raw_readl(clkdm->clkstctrl_reg);
737 v >>= __ffs(clkdm->clktrctrl_mask); 754 v &= clkdm->clktrctrl_mask;
755 v >>= __ffs(clkdm->clktrctrl_mask);
756 } else if (cpu_is_omap44xx()) {
757 pr_warn("OMAP4 clockdomain: missing wakeup/sleep deps\n");
758 } else {
759 BUG();
760 }
738 761
739 return v; 762 return v;
740} 763}
@@ -750,6 +773,8 @@ static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
750 */ 773 */
751int omap2_clkdm_sleep(struct clockdomain *clkdm) 774int omap2_clkdm_sleep(struct clockdomain *clkdm)
752{ 775{
776 u32 bits, v;
777
753 if (!clkdm) 778 if (!clkdm)
754 return -EINVAL; 779 return -EINVAL;
755 780
@@ -766,16 +791,22 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
766 omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK, 791 omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
767 clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL); 792 clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
768 793
769 } else if (cpu_is_omap34xx() || cpu_is_omap44xx()) { 794 } else if (cpu_is_omap34xx()) {
770 795
771 u32 bits = (OMAP34XX_CLKSTCTRL_FORCE_SLEEP << 796 bits = (OMAP34XX_CLKSTCTRL_FORCE_SLEEP <<
772 __ffs(clkdm->clktrctrl_mask)); 797 __ffs(clkdm->clktrctrl_mask));
773 798
774 u32 v = __raw_readl(clkdm->clkstctrl_reg); 799 v = __raw_readl(clkdm->clkstctrl_reg);
775 v &= ~(clkdm->clktrctrl_mask); 800 v &= ~(clkdm->clktrctrl_mask);
776 v |= bits; 801 v |= bits;
777 __raw_writel(v, clkdm->clkstctrl_reg); 802 __raw_writel(v, clkdm->clkstctrl_reg);
778 803
804 } else if (cpu_is_omap44xx()) {
805
806 omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition,
807 clkdm->cm_inst,
808 clkdm->clkdm_offs);
809
779 } else { 810 } else {
780 BUG(); 811 BUG();
781 }; 812 };
@@ -794,6 +825,8 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
794 */ 825 */
795int omap2_clkdm_wakeup(struct clockdomain *clkdm) 826int omap2_clkdm_wakeup(struct clockdomain *clkdm)
796{ 827{
828 u32 bits, v;
829
797 if (!clkdm) 830 if (!clkdm)
798 return -EINVAL; 831 return -EINVAL;
799 832
@@ -810,16 +843,22 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
810 omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK, 843 omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
811 clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL); 844 clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
812 845
813 } else if (cpu_is_omap34xx() || cpu_is_omap44xx()) { 846 } else if (cpu_is_omap34xx()) {
814 847
815 u32 bits = (OMAP34XX_CLKSTCTRL_FORCE_WAKEUP << 848 bits = (OMAP34XX_CLKSTCTRL_FORCE_WAKEUP <<
816 __ffs(clkdm->clktrctrl_mask)); 849 __ffs(clkdm->clktrctrl_mask));
817 850
818 u32 v = __raw_readl(clkdm->clkstctrl_reg); 851 v = __raw_readl(clkdm->clkstctrl_reg);
819 v &= ~(clkdm->clktrctrl_mask); 852 v &= ~(clkdm->clktrctrl_mask);
820 v |= bits; 853 v |= bits;
821 __raw_writel(v, clkdm->clkstctrl_reg); 854 __raw_writel(v, clkdm->clkstctrl_reg);
822 855
856 } else if (cpu_is_omap44xx()) {
857
858 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
859 clkdm->cm_inst,
860 clkdm->clkdm_offs);
861
823 } else { 862 } else {
824 BUG(); 863 BUG();
825 }; 864 };
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index 7fc81f651b5e..2d3d1ef23814 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -34,14 +34,16 @@
34#include "cm2_44xx.h" 34#include "cm2_44xx.h"
35#include "cm-regbits-44xx.h" 35#include "cm-regbits-44xx.h"
36#include "prm44xx.h" 36#include "prm44xx.h"
37#include "prcm44xx.h"
37#include "prcm_mpu44xx.h" 38#include "prcm_mpu44xx.h"
38 39
39 40
40static struct clockdomain l4_cefuse_44xx_clkdm = { 41static struct clockdomain l4_cefuse_44xx_clkdm = {
41 .name = "l4_cefuse_clkdm", 42 .name = "l4_cefuse_clkdm",
42 .pwrdm = { .name = "cefuse_pwrdm" }, 43 .pwrdm = { .name = "cefuse_pwrdm" },
43 .clkstctrl_reg = OMAP4430_CM_CEFUSE_CLKSTCTRL, 44 .prcm_partition = OMAP4430_CM2_PARTITION,
44 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 45 .cm_inst = OMAP4430_CM2_CEFUSE_INST,
46 .clkdm_offs = OMAP4430_CM2_CEFUSE_CEFUSE_CDOFFS,
45 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 47 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
46 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 48 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
47}; 49};
@@ -49,8 +51,9 @@ static struct clockdomain l4_cefuse_44xx_clkdm = {
49static struct clockdomain l4_cfg_44xx_clkdm = { 51static struct clockdomain l4_cfg_44xx_clkdm = {
50 .name = "l4_cfg_clkdm", 52 .name = "l4_cfg_clkdm",
51 .pwrdm = { .name = "core_pwrdm" }, 53 .pwrdm = { .name = "core_pwrdm" },
52 .clkstctrl_reg = OMAP4430_CM_L4CFG_CLKSTCTRL, 54 .prcm_partition = OMAP4430_CM2_PARTITION,
53 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 55 .cm_inst = OMAP4430_CM2_CORE_INST,
56 .clkdm_offs = OMAP4430_CM2_CORE_L4CFG_CDOFFS,
54 .flags = CLKDM_CAN_HWSUP, 57 .flags = CLKDM_CAN_HWSUP,
55 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 58 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
56}; 59};
@@ -58,8 +61,9 @@ static struct clockdomain l4_cfg_44xx_clkdm = {
58static struct clockdomain tesla_44xx_clkdm = { 61static struct clockdomain tesla_44xx_clkdm = {
59 .name = "tesla_clkdm", 62 .name = "tesla_clkdm",
60 .pwrdm = { .name = "tesla_pwrdm" }, 63 .pwrdm = { .name = "tesla_pwrdm" },
61 .clkstctrl_reg = OMAP4430_CM_TESLA_CLKSTCTRL, 64 .prcm_partition = OMAP4430_CM1_PARTITION,
62 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 65 .cm_inst = OMAP4430_CM1_TESLA_INST,
66 .clkdm_offs = OMAP4430_CM1_TESLA_TESLA_CDOFFS,
63 .flags = CLKDM_CAN_HWSUP_SWSUP, 67 .flags = CLKDM_CAN_HWSUP_SWSUP,
64 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 68 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
65}; 69};
@@ -67,8 +71,9 @@ static struct clockdomain tesla_44xx_clkdm = {
67static struct clockdomain l3_gfx_44xx_clkdm = { 71static struct clockdomain l3_gfx_44xx_clkdm = {
68 .name = "l3_gfx_clkdm", 72 .name = "l3_gfx_clkdm",
69 .pwrdm = { .name = "gfx_pwrdm" }, 73 .pwrdm = { .name = "gfx_pwrdm" },
70 .clkstctrl_reg = OMAP4430_CM_GFX_CLKSTCTRL, 74 .prcm_partition = OMAP4430_CM2_PARTITION,
71 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 75 .cm_inst = OMAP4430_CM2_GFX_INST,
76 .clkdm_offs = OMAP4430_CM2_GFX_GFX_CDOFFS,
72 .flags = CLKDM_CAN_HWSUP_SWSUP, 77 .flags = CLKDM_CAN_HWSUP_SWSUP,
73 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 78 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
74}; 79};
@@ -76,8 +81,9 @@ static struct clockdomain l3_gfx_44xx_clkdm = {
76static struct clockdomain ivahd_44xx_clkdm = { 81static struct clockdomain ivahd_44xx_clkdm = {
77 .name = "ivahd_clkdm", 82 .name = "ivahd_clkdm",
78 .pwrdm = { .name = "ivahd_pwrdm" }, 83 .pwrdm = { .name = "ivahd_pwrdm" },
79 .clkstctrl_reg = OMAP4430_CM_IVAHD_CLKSTCTRL, 84 .prcm_partition = OMAP4430_CM2_PARTITION,
80 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 85 .cm_inst = OMAP4430_CM2_IVAHD_INST,
86 .clkdm_offs = OMAP4430_CM2_IVAHD_IVAHD_CDOFFS,
81 .flags = CLKDM_CAN_HWSUP_SWSUP, 87 .flags = CLKDM_CAN_HWSUP_SWSUP,
82 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 88 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
83}; 89};
@@ -85,8 +91,9 @@ static struct clockdomain ivahd_44xx_clkdm = {
85static struct clockdomain l4_secure_44xx_clkdm = { 91static struct clockdomain l4_secure_44xx_clkdm = {
86 .name = "l4_secure_clkdm", 92 .name = "l4_secure_clkdm",
87 .pwrdm = { .name = "l4per_pwrdm" }, 93 .pwrdm = { .name = "l4per_pwrdm" },
88 .clkstctrl_reg = OMAP4430_CM_L4SEC_CLKSTCTRL, 94 .prcm_partition = OMAP4430_CM2_PARTITION,
89 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 95 .cm_inst = OMAP4430_CM2_L4PER_INST,
96 .clkdm_offs = OMAP4430_CM2_L4PER_L4SEC_CDOFFS,
90 .flags = CLKDM_CAN_HWSUP_SWSUP, 97 .flags = CLKDM_CAN_HWSUP_SWSUP,
91 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 98 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
92}; 99};
@@ -94,8 +101,9 @@ static struct clockdomain l4_secure_44xx_clkdm = {
94static struct clockdomain l4_per_44xx_clkdm = { 101static struct clockdomain l4_per_44xx_clkdm = {
95 .name = "l4_per_clkdm", 102 .name = "l4_per_clkdm",
96 .pwrdm = { .name = "l4per_pwrdm" }, 103 .pwrdm = { .name = "l4per_pwrdm" },
97 .clkstctrl_reg = OMAP4430_CM_L4PER_CLKSTCTRL, 104 .prcm_partition = OMAP4430_CM2_PARTITION,
98 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 105 .cm_inst = OMAP4430_CM2_L4PER_INST,
106 .clkdm_offs = OMAP4430_CM2_L4PER_L4PER_CDOFFS,
99 .flags = CLKDM_CAN_HWSUP_SWSUP, 107 .flags = CLKDM_CAN_HWSUP_SWSUP,
100 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 108 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
101}; 109};
@@ -103,8 +111,9 @@ static struct clockdomain l4_per_44xx_clkdm = {
103static struct clockdomain abe_44xx_clkdm = { 111static struct clockdomain abe_44xx_clkdm = {
104 .name = "abe_clkdm", 112 .name = "abe_clkdm",
105 .pwrdm = { .name = "abe_pwrdm" }, 113 .pwrdm = { .name = "abe_pwrdm" },
106 .clkstctrl_reg = OMAP4430_CM1_ABE_CLKSTCTRL, 114 .prcm_partition = OMAP4430_CM1_PARTITION,
107 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 115 .cm_inst = OMAP4430_CM1_ABE_INST,
116 .clkdm_offs = OMAP4430_CM1_ABE_ABE_CDOFFS,
108 .flags = CLKDM_CAN_HWSUP_SWSUP, 117 .flags = CLKDM_CAN_HWSUP_SWSUP,
109 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 118 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
110}; 119};
@@ -112,16 +121,18 @@ static struct clockdomain abe_44xx_clkdm = {
112static struct clockdomain l3_instr_44xx_clkdm = { 121static struct clockdomain l3_instr_44xx_clkdm = {
113 .name = "l3_instr_clkdm", 122 .name = "l3_instr_clkdm",
114 .pwrdm = { .name = "core_pwrdm" }, 123 .pwrdm = { .name = "core_pwrdm" },
115 .clkstctrl_reg = OMAP4430_CM_L3INSTR_CLKSTCTRL, 124 .prcm_partition = OMAP4430_CM2_PARTITION,
116 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 125 .cm_inst = OMAP4430_CM2_CORE_INST,
126 .clkdm_offs = OMAP4430_CM2_CORE_L3INSTR_CDOFFS,
117 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 127 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
118}; 128};
119 129
120static struct clockdomain l3_init_44xx_clkdm = { 130static struct clockdomain l3_init_44xx_clkdm = {
121 .name = "l3_init_clkdm", 131 .name = "l3_init_clkdm",
122 .pwrdm = { .name = "l3init_pwrdm" }, 132 .pwrdm = { .name = "l3init_pwrdm" },
123 .clkstctrl_reg = OMAP4430_CM_L3INIT_CLKSTCTRL, 133 .prcm_partition = OMAP4430_CM2_PARTITION,
124 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 134 .cm_inst = OMAP4430_CM2_L3INIT_INST,
135 .clkdm_offs = OMAP4430_CM2_L3INIT_L3INIT_CDOFFS,
125 .flags = CLKDM_CAN_HWSUP_SWSUP, 136 .flags = CLKDM_CAN_HWSUP_SWSUP,
126 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 137 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
127}; 138};
@@ -129,8 +140,9 @@ static struct clockdomain l3_init_44xx_clkdm = {
129static struct clockdomain mpuss_44xx_clkdm = { 140static struct clockdomain mpuss_44xx_clkdm = {
130 .name = "mpuss_clkdm", 141 .name = "mpuss_clkdm",
131 .pwrdm = { .name = "mpu_pwrdm" }, 142 .pwrdm = { .name = "mpu_pwrdm" },
132 .clkstctrl_reg = OMAP4430_CM_MPU_CLKSTCTRL, 143 .prcm_partition = OMAP4430_CM1_PARTITION,
133 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 144 .cm_inst = OMAP4430_CM1_MPU_INST,
145 .clkdm_offs = OMAP4430_CM1_MPU_MPU_CDOFFS,
134 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 146 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
135 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 147 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
136}; 148};
@@ -138,8 +150,9 @@ static struct clockdomain mpuss_44xx_clkdm = {
138static struct clockdomain mpu0_44xx_clkdm = { 150static struct clockdomain mpu0_44xx_clkdm = {
139 .name = "mpu0_clkdm", 151 .name = "mpu0_clkdm",
140 .pwrdm = { .name = "cpu0_pwrdm" }, 152 .pwrdm = { .name = "cpu0_pwrdm" },
141 .clkstctrl_reg = OMAP4430_CM_CPU0_CLKSTCTRL, 153 .prcm_partition = OMAP4430_PRCM_MPU_PARTITION,
142 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 154 .cm_inst = OMAP4430_PRCM_MPU_CPU0_INST,
155 .clkdm_offs = OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS,
143 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 156 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
144 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 157 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
145}; 158};
@@ -147,8 +160,9 @@ static struct clockdomain mpu0_44xx_clkdm = {
147static struct clockdomain mpu1_44xx_clkdm = { 160static struct clockdomain mpu1_44xx_clkdm = {
148 .name = "mpu1_clkdm", 161 .name = "mpu1_clkdm",
149 .pwrdm = { .name = "cpu1_pwrdm" }, 162 .pwrdm = { .name = "cpu1_pwrdm" },
150 .clkstctrl_reg = OMAP4430_CM_CPU1_CLKSTCTRL, 163 .prcm_partition = OMAP4430_PRCM_MPU_PARTITION,
151 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 164 .cm_inst = OMAP4430_PRCM_MPU_CPU1_INST,
165 .clkdm_offs = OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS,
152 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 166 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
153 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 167 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
154}; 168};
@@ -156,8 +170,9 @@ static struct clockdomain mpu1_44xx_clkdm = {
156static struct clockdomain l3_emif_44xx_clkdm = { 170static struct clockdomain l3_emif_44xx_clkdm = {
157 .name = "l3_emif_clkdm", 171 .name = "l3_emif_clkdm",
158 .pwrdm = { .name = "core_pwrdm" }, 172 .pwrdm = { .name = "core_pwrdm" },
159 .clkstctrl_reg = OMAP4430_CM_MEMIF_CLKSTCTRL, 173 .prcm_partition = OMAP4430_CM2_PARTITION,
160 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 174 .cm_inst = OMAP4430_CM2_CORE_INST,
175 .clkdm_offs = OMAP4430_CM2_CORE_MEMIF_CDOFFS,
161 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 176 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
162 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 177 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
163}; 178};
@@ -165,8 +180,9 @@ static struct clockdomain l3_emif_44xx_clkdm = {
165static struct clockdomain l4_ao_44xx_clkdm = { 180static struct clockdomain l4_ao_44xx_clkdm = {
166 .name = "l4_ao_clkdm", 181 .name = "l4_ao_clkdm",
167 .pwrdm = { .name = "always_on_core_pwrdm" }, 182 .pwrdm = { .name = "always_on_core_pwrdm" },
168 .clkstctrl_reg = OMAP4430_CM_ALWON_CLKSTCTRL, 183 .prcm_partition = OMAP4430_CM2_PARTITION,
169 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 184 .cm_inst = OMAP4430_CM2_ALWAYS_ON_INST,
185 .clkdm_offs = OMAP4430_CM2_ALWAYS_ON_ALWON_CDOFFS,
170 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 186 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
171 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 187 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
172}; 188};
@@ -174,8 +190,9 @@ static struct clockdomain l4_ao_44xx_clkdm = {
174static struct clockdomain ducati_44xx_clkdm = { 190static struct clockdomain ducati_44xx_clkdm = {
175 .name = "ducati_clkdm", 191 .name = "ducati_clkdm",
176 .pwrdm = { .name = "core_pwrdm" }, 192 .pwrdm = { .name = "core_pwrdm" },
177 .clkstctrl_reg = OMAP4430_CM_DUCATI_CLKSTCTRL, 193 .prcm_partition = OMAP4430_CM2_PARTITION,
178 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 194 .cm_inst = OMAP4430_CM2_CORE_INST,
195 .clkdm_offs = OMAP4430_CM2_CORE_DUCATI_CDOFFS,
179 .flags = CLKDM_CAN_HWSUP_SWSUP, 196 .flags = CLKDM_CAN_HWSUP_SWSUP,
180 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 197 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
181}; 198};
@@ -183,8 +200,9 @@ static struct clockdomain ducati_44xx_clkdm = {
183static struct clockdomain l3_2_44xx_clkdm = { 200static struct clockdomain l3_2_44xx_clkdm = {
184 .name = "l3_2_clkdm", 201 .name = "l3_2_clkdm",
185 .pwrdm = { .name = "core_pwrdm" }, 202 .pwrdm = { .name = "core_pwrdm" },
186 .clkstctrl_reg = OMAP4430_CM_L3_2_CLKSTCTRL, 203 .prcm_partition = OMAP4430_CM2_PARTITION,
187 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 204 .cm_inst = OMAP4430_CM2_CORE_INST,
205 .clkdm_offs = OMAP4430_CM2_CORE_L3_2_CDOFFS,
188 .flags = CLKDM_CAN_HWSUP, 206 .flags = CLKDM_CAN_HWSUP,
189 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 207 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
190}; 208};
@@ -192,8 +210,9 @@ static struct clockdomain l3_2_44xx_clkdm = {
192static struct clockdomain l3_1_44xx_clkdm = { 210static struct clockdomain l3_1_44xx_clkdm = {
193 .name = "l3_1_clkdm", 211 .name = "l3_1_clkdm",
194 .pwrdm = { .name = "core_pwrdm" }, 212 .pwrdm = { .name = "core_pwrdm" },
195 .clkstctrl_reg = OMAP4430_CM_L3_1_CLKSTCTRL, 213 .prcm_partition = OMAP4430_CM2_PARTITION,
196 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 214 .cm_inst = OMAP4430_CM2_CORE_INST,
215 .clkdm_offs = OMAP4430_CM2_CORE_L3_1_CDOFFS,
197 .flags = CLKDM_CAN_HWSUP, 216 .flags = CLKDM_CAN_HWSUP,
198 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 217 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
199}; 218};
@@ -201,8 +220,9 @@ static struct clockdomain l3_1_44xx_clkdm = {
201static struct clockdomain l3_d2d_44xx_clkdm = { 220static struct clockdomain l3_d2d_44xx_clkdm = {
202 .name = "l3_d2d_clkdm", 221 .name = "l3_d2d_clkdm",
203 .pwrdm = { .name = "core_pwrdm" }, 222 .pwrdm = { .name = "core_pwrdm" },
204 .clkstctrl_reg = OMAP4430_CM_D2D_CLKSTCTRL, 223 .prcm_partition = OMAP4430_CM2_PARTITION,
205 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 224 .cm_inst = OMAP4430_CM2_CORE_INST,
225 .clkdm_offs = OMAP4430_CM2_CORE_D2D_CDOFFS,
206 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 226 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
207 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 227 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
208}; 228};
@@ -210,8 +230,9 @@ static struct clockdomain l3_d2d_44xx_clkdm = {
210static struct clockdomain iss_44xx_clkdm = { 230static struct clockdomain iss_44xx_clkdm = {
211 .name = "iss_clkdm", 231 .name = "iss_clkdm",
212 .pwrdm = { .name = "cam_pwrdm" }, 232 .pwrdm = { .name = "cam_pwrdm" },
213 .clkstctrl_reg = OMAP4430_CM_CAM_CLKSTCTRL, 233 .prcm_partition = OMAP4430_CM2_PARTITION,
214 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 234 .cm_inst = OMAP4430_CM2_CAM_INST,
235 .clkdm_offs = OMAP4430_CM2_CAM_CAM_CDOFFS,
215 .flags = CLKDM_CAN_HWSUP_SWSUP, 236 .flags = CLKDM_CAN_HWSUP_SWSUP,
216 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 237 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
217}; 238};
@@ -219,8 +240,9 @@ static struct clockdomain iss_44xx_clkdm = {
219static struct clockdomain l3_dss_44xx_clkdm = { 240static struct clockdomain l3_dss_44xx_clkdm = {
220 .name = "l3_dss_clkdm", 241 .name = "l3_dss_clkdm",
221 .pwrdm = { .name = "dss_pwrdm" }, 242 .pwrdm = { .name = "dss_pwrdm" },
222 .clkstctrl_reg = OMAP4430_CM_DSS_CLKSTCTRL, 243 .prcm_partition = OMAP4430_CM2_PARTITION,
223 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 244 .cm_inst = OMAP4430_CM2_DSS_INST,
245 .clkdm_offs = OMAP4430_CM2_DSS_DSS_CDOFFS,
224 .flags = CLKDM_CAN_HWSUP_SWSUP, 246 .flags = CLKDM_CAN_HWSUP_SWSUP,
225 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 247 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
226}; 248};
@@ -228,8 +250,9 @@ static struct clockdomain l3_dss_44xx_clkdm = {
228static struct clockdomain l4_wkup_44xx_clkdm = { 250static struct clockdomain l4_wkup_44xx_clkdm = {
229 .name = "l4_wkup_clkdm", 251 .name = "l4_wkup_clkdm",
230 .pwrdm = { .name = "wkup_pwrdm" }, 252 .pwrdm = { .name = "wkup_pwrdm" },
231 .clkstctrl_reg = OMAP4430_CM_WKUP_CLKSTCTRL, 253 .prcm_partition = OMAP4430_PRM_PARTITION,
232 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 254 .cm_inst = OMAP4430_PRM_WKUP_CM_INST,
255 .clkdm_offs = OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS,
233 .flags = CLKDM_CAN_HWSUP, 256 .flags = CLKDM_CAN_HWSUP,
234 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 257 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
235}; 258};
@@ -237,8 +260,9 @@ static struct clockdomain l4_wkup_44xx_clkdm = {
237static struct clockdomain emu_sys_44xx_clkdm = { 260static struct clockdomain emu_sys_44xx_clkdm = {
238 .name = "emu_sys_clkdm", 261 .name = "emu_sys_clkdm",
239 .pwrdm = { .name = "emu_pwrdm" }, 262 .pwrdm = { .name = "emu_pwrdm" },
240 .clkstctrl_reg = OMAP4430_CM_EMU_CLKSTCTRL, 263 .prcm_partition = OMAP4430_PRM_PARTITION,
241 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 264 .cm_inst = OMAP4430_PRM_EMU_CM_INST,
265 .clkdm_offs = OMAP4430_PRM_EMU_CM_EMU_CDOFFS,
242 .flags = CLKDM_CAN_HWSUP, 266 .flags = CLKDM_CAN_HWSUP,
243 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 267 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
244}; 268};
@@ -246,8 +270,9 @@ static struct clockdomain emu_sys_44xx_clkdm = {
246static struct clockdomain l3_dma_44xx_clkdm = { 270static struct clockdomain l3_dma_44xx_clkdm = {
247 .name = "l3_dma_clkdm", 271 .name = "l3_dma_clkdm",
248 .pwrdm = { .name = "core_pwrdm" }, 272 .pwrdm = { .name = "core_pwrdm" },
249 .clkstctrl_reg = OMAP4430_CM_SDMA_CLKSTCTRL, 273 .prcm_partition = OMAP4430_CM2_PARTITION,
250 .clktrctrl_mask = OMAP4430_CLKTRCTRL_MASK, 274 .cm_inst = OMAP4430_CM2_CORE_INST,
275 .clkdm_offs = OMAP4430_CM2_CORE_SDMA_CDOFFS,
251 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 276 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
252 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 277 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
253}; 278};
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index cd9ff8b6a109..b91275908f33 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -798,4 +798,15 @@
798#define OMAP3430ES2_CLKACTIVITY_USBHOST_SHIFT 0 798#define OMAP3430ES2_CLKACTIVITY_USBHOST_SHIFT 0
799#define OMAP3430ES2_CLKACTIVITY_USBHOST_MASK (1 << 0) 799#define OMAP3430ES2_CLKACTIVITY_USBHOST_MASK (1 << 0)
800 800
801/*
802 *
803 */
804
805/* OMAP3XXX CM_CLKSTCTRL_*.CLKTRCTRL_* register bit values */
806#define OMAP34XX_CLKSTCTRL_DISABLE_AUTO 0x0
807#define OMAP34XX_CLKSTCTRL_FORCE_SLEEP 0x1
808#define OMAP34XX_CLKSTCTRL_FORCE_WAKEUP 0x2
809#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO 0x3
810
811
801#endif 812#endif
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index c13613b513b5..c04bbbea17a5 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -26,6 +26,7 @@
26#include "cm2_44xx.h" 26#include "cm2_44xx.h"
27#include "cm44xx.h" 27#include "cm44xx.h"
28#include "cminst44xx.h" 28#include "cminst44xx.h"
29#include "cm-regbits-34xx.h"
29#include "cm-regbits-44xx.h" 30#include "cm-regbits-44xx.h"
30#include "prcm44xx.h" 31#include "prcm44xx.h"
31#include "prm44xx.h" 32#include "prm44xx.h"
@@ -72,6 +73,110 @@ u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst,
72 return v; 73 return v;
73} 74}
74 75
76/*
77 *
78 */
79
80/**
81 * _clktrctrl_write - write @c to a CM_CLKSTCTRL.CLKTRCTRL register bitfield
82 * @c: CLKTRCTRL register bitfield (LSB = bit 0, i.e., unshifted)
83 * @part: PRCM partition ID that the CM_CLKSTCTRL register exists in
84 * @inst: CM instance register offset (*_INST macro)
85 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
86 *
87 * @c must be the unshifted value for CLKTRCTRL - i.e., this function
88 * will handle the shift itself.
89 */
90static void _clktrctrl_write(u8 c, u8 part, s16 inst, u16 cdoffs)
91{
92 u32 v;
93
94 v = omap4_cminst_read_inst_reg(part, inst, cdoffs + OMAP4_CM_CLKSTCTRL);
95 v &= ~OMAP4430_CLKTRCTRL_MASK;
96 v |= c << OMAP4430_CLKTRCTRL_SHIFT;
97 omap4_cminst_write_inst_reg(v, part, inst, cdoffs + OMAP4_CM_CLKSTCTRL);
98}
99
100/**
101 * omap4_cminst_is_clkdm_in_hwsup - is a clockdomain in hwsup idle mode?
102 * @part: PRCM partition ID that the CM_CLKSTCTRL register exists in
103 * @inst: CM instance register offset (*_INST macro)
104 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
105 *
106 * Returns true if the clockdomain referred to by (@part, @inst, @cdoffs)
107 * is in hardware-supervised idle mode, or 0 otherwise.
108 */
109bool omap4_cminst_is_clkdm_in_hwsup(u8 part, s16 inst, u16 cdoffs)
110{
111 u32 v;
112
113 v = omap4_cminst_read_inst_reg(part, inst, cdoffs + OMAP4_CM_CLKSTCTRL);
114 v &= OMAP4430_CLKTRCTRL_MASK;
115 v >>= OMAP4430_CLKTRCTRL_SHIFT;
116
117 return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? true : false;
118}
119
120/**
121 * omap4_cminst_clkdm_enable_hwsup - put a clockdomain in hwsup-idle mode
122 * @part: PRCM partition ID that the clockdomain registers exist in
123 * @inst: CM instance register offset (*_INST macro)
124 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
125 *
126 * Put a clockdomain referred to by (@part, @inst, @cdoffs) into
127 * hardware-supervised idle mode. No return value.
128 */
129void omap4_cminst_clkdm_enable_hwsup(u8 part, s16 inst, u16 cdoffs)
130{
131 _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, part, inst, cdoffs);
132}
133
134/**
135 * omap4_cminst_clkdm_disable_hwsup - put a clockdomain in swsup-idle mode
136 * @part: PRCM partition ID that the clockdomain registers exist in
137 * @inst: CM instance register offset (*_INST macro)
138 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
139 *
140 * Put a clockdomain referred to by (@part, @inst, @cdoffs) into
141 * software-supervised idle mode, i.e., controlled manually by the
142 * Linux OMAP clockdomain code. No return value.
143 */
144void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs)
145{
146 _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, part, inst, cdoffs);
147}
148
149/**
150 * omap4_cminst_clkdm_force_sleep - try to put a clockdomain into idle
151 * @part: PRCM partition ID that the clockdomain registers exist in
152 * @inst: CM instance register offset (*_INST macro)
153 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
154 *
155 * Put a clockdomain referred to by (@part, @inst, @cdoffs) into idle
156 * No return value.
157 */
158void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs)
159{
160 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, part, inst, cdoffs);
161}
162
163/**
164 * omap4_cminst_clkdm_force_sleep - try to take a clockdomain out of idle
165 * @part: PRCM partition ID that the clockdomain registers exist in
166 * @inst: CM instance register offset (*_INST macro)
167 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
168 *
169 * Take a clockdomain referred to by (@part, @inst, @cdoffs) out of idle,
170 * waking it up. No return value.
171 */
172void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs)
173{
174 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, part, inst, cdoffs);
175}
176
177/*
178 *
179 */
75 180
76/** 181/**
77 * omap4_cm_wait_module_ready - wait for a module to be in 'func' state 182 * omap4_cm_wait_module_ready - wait for a module to be in 'func' state
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
index 6baa4c7b14f1..a6abd0a8cb82 100644
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ b/arch/arm/mach-omap2/cminst44xx.h
@@ -11,6 +11,12 @@
11#ifndef __ARCH_ASM_MACH_OMAP2_CMINST44XX_H 11#ifndef __ARCH_ASM_MACH_OMAP2_CMINST44XX_H
12#define __ARCH_ASM_MACH_OMAP2_CMINST44XX_H 12#define __ARCH_ASM_MACH_OMAP2_CMINST44XX_H
13 13
14extern bool omap4_cminst_is_clkdm_in_hwsup(u8 part, s16 inst, u16 cdoffs);
15extern void omap4_cminst_clkdm_enable_hwsup(u8 part, s16 inst, u16 cdoffs);
16extern void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs);
17extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs);
18extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs);
19
14/* 20/*
15 * In an ideal world, we would not export these low-level functions, 21 * In an ideal world, we would not export these low-level functions,
16 * but this will probably take some time to fix properly 22 * but this will probably take some time to fix properly