aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAbhijit Pagare <abhijitpagare@ti.com>2010-01-26 22:12:53 -0500
committerPaul Walmsley <paul@pwsan.com>2010-01-26 22:12:53 -0500
commit3a759f09d7b9c6bbefffadd38fdc116125c49730 (patch)
treede412e894d25084929f309b4cc7078ef97227973 /arch
parent38900c27fbbbe97e16f448b8bc9cafc05af03460 (diff)
ARM: OMAP4: PM: Refine the APIs to support OMAP4 features.
The proper Macros have to be used for platform specific calls and some of the compiling requirements and init calls are taken care of. Signed-off-by: Abhijit Pagare <abhijitpagare@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Benoit Cousson <b-cousson@ti.com> Cc: Rajendra Nayak <rnayak@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--arch/arm/mach-omap2/io.c2
-rw-r--r--arch/arm/mach-omap2/powerdomain.c112
3 files changed, 87 insertions, 29 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index b32678b848bc..4a54e5afbac5 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -13,7 +13,7 @@ clock-common = clock.o clock_common_data.o clockdomain.o
13obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) 13obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common)
14obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common) \ 14obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common) \
15 $(omap-3-4-common) 15 $(omap-3-4-common)
16obj-$(CONFIG_ARCH_OMAP4) += $(omap-3-4-common) prcm.o clock.o 16obj-$(CONFIG_ARCH_OMAP4) += $(omap-3-4-common) $(prcm-common) clock.o
17 17
18obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o 18obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
19 19
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 5a7996402c53..aa237ff644d6 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -312,12 +312,12 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
312 else if (cpu_is_omap34xx()) 312 else if (cpu_is_omap34xx())
313 hwmods = omap34xx_hwmods; 313 hwmods = omap34xx_hwmods;
314 314
315 pwrdm_init(powerdomains_omap);
315#ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once the clkdev is ready */ 316#ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once the clkdev is ready */
316 /* The OPP tables have to be registered before a clk init */ 317 /* The OPP tables have to be registered before a clk init */
317 omap_hwmod_init(hwmods); 318 omap_hwmod_init(hwmods);
318 omap2_mux_init(); 319 omap2_mux_init();
319 omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps); 320 omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
320 pwrdm_init(powerdomains_omap);
321 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps); 321 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
322#endif 322#endif
323 omap2_clk_init(); 323 omap2_clk_init();
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index e503050dda06..c0de05097b5d 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -6,6 +6,8 @@
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
8 * 8 *
9 * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com>
10 *
9 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
@@ -26,8 +28,10 @@
26 28
27#include "cm.h" 29#include "cm.h"
28#include "cm-regbits-34xx.h" 30#include "cm-regbits-34xx.h"
31#include "cm-regbits-44xx.h"
29#include "prm.h" 32#include "prm.h"
30#include "prm-regbits-34xx.h" 33#include "prm-regbits-34xx.h"
34#include "prm-regbits-44xx.h"
31 35
32#include <plat/cpu.h> 36#include <plat/cpu.h>
33#include <plat/powerdomain.h> 37#include <plat/powerdomain.h>
@@ -40,6 +44,38 @@ enum {
40 PWRDM_STATE_PREV, 44 PWRDM_STATE_PREV,
41}; 45};
42 46
47/* Variable holding value of the CPU dependent PWRSTCTRL Register Offset */
48static u16 pwrstctrl_reg_offs;
49
50/* Variable holding value of the CPU dependent PWRSTST Register Offset */
51static u16 pwrstst_reg_offs;
52
53/* OMAP3 and OMAP4 specific register bit initialisations
54 * Notice that the names here are not according to each power
55 * domain but the bit mapping used applies to all of them
56 */
57
58/* OMAP3 and OMAP4 Memory Onstate Masks (common across all power domains) */
59#define OMAP_MEM0_ONSTATE_MASK OMAP3430_SHAREDL1CACHEFLATONSTATE_MASK
60#define OMAP_MEM1_ONSTATE_MASK OMAP3430_L1FLATMEMONSTATE_MASK
61#define OMAP_MEM2_ONSTATE_MASK OMAP3430_SHAREDL2CACHEFLATONSTATE_MASK
62#define OMAP_MEM3_ONSTATE_MASK OMAP3430_L2FLATMEMONSTATE_MASK
63#define OMAP_MEM4_ONSTATE_MASK OMAP4430_OCP_NRET_BANK_ONSTATE_MASK
64
65/* OMAP3 and OMAP4 Memory Retstate Masks (common across all power domains) */
66#define OMAP_MEM0_RETSTATE_MASK OMAP3430_SHAREDL1CACHEFLATRETSTATE
67#define OMAP_MEM1_RETSTATE_MASK OMAP3430_L1FLATMEMRETSTATE
68#define OMAP_MEM2_RETSTATE_MASK OMAP3430_SHAREDL2CACHEFLATRETSTATE
69#define OMAP_MEM3_RETSTATE_MASK OMAP3430_L2FLATMEMRETSTATE
70#define OMAP_MEM4_RETSTATE_MASK OMAP4430_OCP_NRET_BANK_RETSTATE_MASK
71
72/* OMAP3 and OMAP4 Memory Status bits */
73#define OMAP_MEM0_STATEST_MASK OMAP3430_SHAREDL1CACHEFLATSTATEST_MASK
74#define OMAP_MEM1_STATEST_MASK OMAP3430_L1FLATMEMSTATEST_MASK
75#define OMAP_MEM2_STATEST_MASK OMAP3430_SHAREDL2CACHEFLATSTATEST_MASK
76#define OMAP_MEM3_STATEST_MASK OMAP3430_L2FLATMEMSTATEST_MASK
77#define OMAP_MEM4_STATEST_MASK OMAP4430_OCP_NRET_BANK_STATEST_MASK
78
43/* pwrdm_list contains all registered struct powerdomains */ 79/* pwrdm_list contains all registered struct powerdomains */
44static LIST_HEAD(pwrdm_list); 80static LIST_HEAD(pwrdm_list);
45 81
@@ -181,6 +217,18 @@ void pwrdm_init(struct powerdomain **pwrdm_list)
181{ 217{
182 struct powerdomain **p = NULL; 218 struct powerdomain **p = NULL;
183 219
220 if (cpu_is_omap24xx() | cpu_is_omap34xx()) {
221 pwrstctrl_reg_offs = OMAP2_PM_PWSTCTRL;
222 pwrstst_reg_offs = OMAP2_PM_PWSTST;
223 } else if (cpu_is_omap44xx()) {
224 pwrstctrl_reg_offs = OMAP4_PM_PWSTCTRL;
225 pwrstst_reg_offs = OMAP4_PM_PWSTST;
226 } else {
227 printk(KERN_ERR "Power Domain struct not supported for " \
228 "this CPU\n");
229 return;
230 }
231
184 if (pwrdm_list) { 232 if (pwrdm_list) {
185 for (p = pwrdm_list; *p; p++) { 233 for (p = pwrdm_list; *p; p++) {
186 pwrdm_register(*p); 234 pwrdm_register(*p);
@@ -710,7 +758,7 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
710 758
711 prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, 759 prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
712 (pwrst << OMAP_POWERSTATE_SHIFT), 760 (pwrst << OMAP_POWERSTATE_SHIFT),
713 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); 761 pwrdm->prcm_offs, pwrstctrl_reg_offs);
714 762
715 return 0; 763 return 0;
716} 764}
@@ -728,8 +776,8 @@ int pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
728 if (!pwrdm) 776 if (!pwrdm)
729 return -EINVAL; 777 return -EINVAL;
730 778
731 return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL, 779 return prm_read_mod_bits_shift(pwrdm->prcm_offs,
732 OMAP_POWERSTATE_MASK); 780 pwrstctrl_reg_offs, OMAP_POWERSTATE_MASK);
733} 781}
734 782
735/** 783/**
@@ -745,8 +793,8 @@ int pwrdm_read_pwrst(struct powerdomain *pwrdm)
745 if (!pwrdm) 793 if (!pwrdm)
746 return -EINVAL; 794 return -EINVAL;
747 795
748 return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST, 796 return prm_read_mod_bits_shift(pwrdm->prcm_offs,
749 OMAP_POWERSTATEST_MASK); 797 pwrstst_reg_offs, OMAP_POWERSTATEST_MASK);
750} 798}
751 799
752/** 800/**
@@ -796,7 +844,7 @@ int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
796 */ 844 */
797 prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE, 845 prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE,
798 (pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE)), 846 (pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE)),
799 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); 847 pwrdm->prcm_offs, pwrstctrl_reg_offs);
800 848
801 return 0; 849 return 0;
802} 850}
@@ -839,16 +887,19 @@ int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
839 */ 887 */
840 switch (bank) { 888 switch (bank) {
841 case 0: 889 case 0:
842 m = OMAP3430_SHAREDL1CACHEFLATONSTATE_MASK; 890 m = OMAP_MEM0_ONSTATE_MASK;
843 break; 891 break;
844 case 1: 892 case 1:
845 m = OMAP3430_L1FLATMEMONSTATE_MASK; 893 m = OMAP_MEM1_ONSTATE_MASK;
846 break; 894 break;
847 case 2: 895 case 2:
848 m = OMAP3430_SHAREDL2CACHEFLATONSTATE_MASK; 896 m = OMAP_MEM2_ONSTATE_MASK;
849 break; 897 break;
850 case 3: 898 case 3:
851 m = OMAP3430_L2FLATMEMONSTATE_MASK; 899 m = OMAP_MEM3_ONSTATE_MASK;
900 break;
901 case 4:
902 m = OMAP_MEM4_ONSTATE_MASK;
852 break; 903 break;
853 default: 904 default:
854 WARN_ON(1); /* should never happen */ 905 WARN_ON(1); /* should never happen */
@@ -856,7 +907,7 @@ int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
856 } 907 }
857 908
858 prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), 909 prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)),
859 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); 910 pwrdm->prcm_offs, pwrstctrl_reg_offs);
860 911
861 return 0; 912 return 0;
862} 913}
@@ -900,16 +951,19 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
900 */ 951 */
901 switch (bank) { 952 switch (bank) {
902 case 0: 953 case 0:
903 m = OMAP3430_SHAREDL1CACHEFLATRETSTATE; 954 m = OMAP_MEM0_RETSTATE_MASK;
904 break; 955 break;
905 case 1: 956 case 1:
906 m = OMAP3430_L1FLATMEMRETSTATE; 957 m = OMAP_MEM1_RETSTATE_MASK;
907 break; 958 break;
908 case 2: 959 case 2:
909 m = OMAP3430_SHAREDL2CACHEFLATRETSTATE; 960 m = OMAP_MEM2_RETSTATE_MASK;
910 break; 961 break;
911 case 3: 962 case 3:
912 m = OMAP3430_L2FLATMEMRETSTATE; 963 m = OMAP_MEM3_RETSTATE_MASK;
964 break;
965 case 4:
966 m = OMAP_MEM4_RETSTATE_MASK;
913 break; 967 break;
914 default: 968 default:
915 WARN_ON(1); /* should never happen */ 969 WARN_ON(1); /* should never happen */
@@ -917,7 +971,7 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
917 } 971 }
918 972
919 prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs, 973 prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
920 OMAP2_PM_PWSTCTRL); 974 pwrstctrl_reg_offs);
921 975
922 return 0; 976 return 0;
923} 977}
@@ -936,8 +990,8 @@ int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
936 if (!pwrdm) 990 if (!pwrdm)
937 return -EINVAL; 991 return -EINVAL;
938 992
939 return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST, 993 return prm_read_mod_bits_shift(pwrdm->prcm_offs,
940 OMAP3430_LOGICSTATEST); 994 pwrstst_reg_offs, OMAP3430_LOGICSTATEST);
941} 995}
942 996
943/** 997/**
@@ -994,23 +1048,27 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
994 */ 1048 */
995 switch (bank) { 1049 switch (bank) {
996 case 0: 1050 case 0:
997 m = OMAP3430_SHAREDL1CACHEFLATSTATEST_MASK; 1051 m = OMAP_MEM0_STATEST_MASK;
998 break; 1052 break;
999 case 1: 1053 case 1:
1000 m = OMAP3430_L1FLATMEMSTATEST_MASK; 1054 m = OMAP_MEM1_STATEST_MASK;
1001 break; 1055 break;
1002 case 2: 1056 case 2:
1003 m = OMAP3430_SHAREDL2CACHEFLATSTATEST_MASK; 1057 m = OMAP_MEM2_STATEST_MASK;
1004 break; 1058 break;
1005 case 3: 1059 case 3:
1006 m = OMAP3430_L2FLATMEMSTATEST_MASK; 1060 m = OMAP_MEM3_STATEST_MASK;
1061 break;
1062 case 4:
1063 m = OMAP_MEM4_STATEST_MASK;
1007 break; 1064 break;
1008 default: 1065 default:
1009 WARN_ON(1); /* should never happen */ 1066 WARN_ON(1); /* should never happen */
1010 return -EEXIST; 1067 return -EEXIST;
1011 } 1068 }
1012 1069
1013 return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST, m); 1070 return prm_read_mod_bits_shift(pwrdm->prcm_offs,
1071 pwrstst_reg_offs, m);
1014} 1072}
1015 1073
1016/** 1074/**
@@ -1114,7 +1172,7 @@ int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
1114 pwrdm->name); 1172 pwrdm->name);
1115 1173
1116 prm_rmw_mod_reg_bits(0, 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, 1174 prm_rmw_mod_reg_bits(0, 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
1117 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); 1175 pwrdm->prcm_offs, pwrstctrl_reg_offs);
1118 1176
1119 return 0; 1177 return 0;
1120} 1178}
@@ -1142,7 +1200,7 @@ int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
1142 pwrdm->name); 1200 pwrdm->name);
1143 1201
1144 prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, 0, 1202 prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, 0,
1145 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); 1203 pwrdm->prcm_offs, pwrstctrl_reg_offs);
1146 1204
1147 return 0; 1205 return 0;
1148} 1206}
@@ -1183,10 +1241,10 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm)
1183 */ 1241 */
1184 1242
1185 /* XXX Is this udelay() value meaningful? */ 1243 /* XXX Is this udelay() value meaningful? */
1186 while ((prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) & 1244 while ((prm_read_mod_reg(pwrdm->prcm_offs, pwrstst_reg_offs) &
1187 OMAP_INTRANSITION) && 1245 OMAP_INTRANSITION) &&
1188 (c++ < PWRDM_TRANSITION_BAILOUT)) 1246 (c++ < PWRDM_TRANSITION_BAILOUT))
1189 udelay(1); 1247 udelay(1);
1190 1248
1191 if (c > PWRDM_TRANSITION_BAILOUT) { 1249 if (c > PWRDM_TRANSITION_BAILOUT) {
1192 printk(KERN_ERR "powerdomain: waited too long for " 1250 printk(KERN_ERR "powerdomain: waited too long for "