aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-01-26 22:12:59 -0500
committerPaul Walmsley <paul@pwsan.com>2010-01-26 22:12:59 -0500
commit55ed96945b1f3d0f4ad21a27b32ce4bd99d8c268 (patch)
tree0bec60498742922a9c00f39ff63eb48549d391fc /arch/arm/plat-omap
parent6b04e0d99d4113ede24e263e3df246a17f490339 (diff)
OMAP2/3 clkdm/pwrdm: move wkdep/sleepdep handling from pwrdm to clkdm
Move clockdomain wakeup dependency and sleep dependency data structures from the powerdomain layer to the clockdomain layer, where they belong. These dependencies were originally placed in the powerdomain layer due to unclear documentation; however, it is clear now that these dependencies are between clockdomains. For OMAP2/3, this is not such a big problem, but for OMAP4 this needs to be fixed. Thanks to Benoît Cousson <b-cousson@ti.com> for his advice on this patch. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Benoît Cousson <b-cousson@ti.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/include/plat/clockdomain.h50
-rw-r--r--arch/arm/plat-omap/include/plat/powerdomain.h34
-rw-r--r--arch/arm/plat-omap/include/plat/prcm.h8
3 files changed, 50 insertions, 42 deletions
diff --git a/arch/arm/plat-omap/include/plat/clockdomain.h b/arch/arm/plat-omap/include/plat/clockdomain.h
index 4806e2c52c11..f77ca72ec3ad 100644
--- a/arch/arm/plat-omap/include/plat/clockdomain.h
+++ b/arch/arm/plat-omap/include/plat/clockdomain.h
@@ -4,7 +4,7 @@
4 * OMAP2/3 clockdomain framework functions 4 * OMAP2/3 clockdomain framework functions
5 * 5 *
6 * Copyright (C) 2008 Texas Instruments, Inc. 6 * Copyright (C) 2008 Texas Instruments, Inc.
7 * Copyright (C) 2008 Nokia Corporation 7 * Copyright (C) 2008-2009 Nokia Corporation
8 * 8 *
9 * Written by Paul Walmsley 9 * Written by Paul Walmsley
10 * 10 *
@@ -41,26 +41,40 @@
41#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO 0x3 41#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO 0x3
42 42
43/* 43/*
44 * struct clkdm_pwrdm_autodep - a powerdomain that should have wkdeps 44 * struct clkdm_autodep - a clockdomain that should have wkdeps
45 * and sleepdeps added when a powerdomain should stay active in hwsup mode; 45 * and sleepdeps added when a clockdomain should stay active in hwsup mode;
46 * and conversely, removed when the powerdomain should be allowed to go 46 * and conversely, removed when the clockdomain should be allowed to go
47 * inactive in hwsup mode. 47 * inactive in hwsup mode.
48 */ 48 */
49struct clkdm_pwrdm_autodep { 49struct clkdm_autodep {
50 50
51 union { 51 union {
52 /* Name of the powerdomain to add a wkdep/sleepdep on */ 52 /* Name of the clockdomain to add a wkdep/sleepdep on */
53 const char *name; 53 const char *name;
54 54
55 /* Powerdomain pointer (looked up at clkdm_init() time) */ 55 /* Clockdomain pointer (looked up at clkdm_init() time) */
56 struct powerdomain *ptr; 56 struct clockdomain *ptr;
57 } pwrdm; 57 } clkdm;
58 58
59 /* OMAP chip types that this clockdomain dep is valid on */ 59 /* OMAP chip types that this clockdomain dep is valid on */
60 const struct omap_chip_id omap_chip; 60 const struct omap_chip_id omap_chip;
61 61
62}; 62};
63 63
64/* Encodes dependencies between clockdomains - statically defined */
65struct clkdm_dep {
66
67 /* Clockdomain name */
68 const char *clkdm_name;
69
70 /* Clockdomain pointer - resolved by the clockdomain code */
71 struct clockdomain *clkdm;
72
73 /* Flags to mark OMAP chip restrictions, etc. */
74 const struct omap_chip_id omap_chip;
75
76};
77
64struct clockdomain { 78struct clockdomain {
65 79
66 /* Clockdomain name */ 80 /* Clockdomain name */
@@ -83,6 +97,15 @@ struct clockdomain {
83 /* Clockdomain capability flags */ 97 /* Clockdomain capability flags */
84 const u8 flags; 98 const u8 flags;
85 99
100 /* Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit */
101 const u8 dep_bit;
102
103 /* Clockdomains that can be told to wake this powerdomain up */
104 struct clkdm_dep *wkdep_srcs;
105
106 /* Clockdomains that can be told to keep this clkdm from inactivity */
107 struct clkdm_dep *sleepdep_srcs;
108
86 /* OMAP chip types that this clockdomain is valid on */ 109 /* OMAP chip types that this clockdomain is valid on */
87 const struct omap_chip_id omap_chip; 110 const struct omap_chip_id omap_chip;
88 111
@@ -93,7 +116,7 @@ struct clockdomain {
93 116
94}; 117};
95 118
96void clkdm_init(struct clockdomain **clkdms, struct clkdm_pwrdm_autodep *autodeps); 119void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps);
97int clkdm_register(struct clockdomain *clkdm); 120int clkdm_register(struct clockdomain *clkdm);
98int clkdm_unregister(struct clockdomain *clkdm); 121int clkdm_unregister(struct clockdomain *clkdm);
99struct clockdomain *clkdm_lookup(const char *name); 122struct clockdomain *clkdm_lookup(const char *name);
@@ -102,6 +125,13 @@ int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
102 void *user); 125 void *user);
103struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm); 126struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm);
104 127
128int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
129int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
130int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
131int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
132int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
133int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
134
105void omap2_clkdm_allow_idle(struct clockdomain *clkdm); 135void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
106void omap2_clkdm_deny_idle(struct clockdomain *clkdm); 136void omap2_clkdm_deny_idle(struct clockdomain *clkdm);
107 137
diff --git a/arch/arm/plat-omap/include/plat/powerdomain.h b/arch/arm/plat-omap/include/plat/powerdomain.h
index bac378eff8df..dd5f79dabb3b 100644
--- a/arch/arm/plat-omap/include/plat/powerdomain.h
+++ b/arch/arm/plat-omap/include/plat/powerdomain.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * OMAP2/3 powerdomain control 2 * OMAP2/3 powerdomain control
3 * 3 *
4 * Copyright (C) 2007-8 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007-8 Nokia Corporation 5 * Copyright (C) 2007-2009 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
8 * 8 *
@@ -68,20 +68,6 @@
68struct clockdomain; 68struct clockdomain;
69struct powerdomain; 69struct powerdomain;
70 70
71/* Encodes dependencies between powerdomains - statically defined */
72struct pwrdm_dep {
73
74 /* Powerdomain name */
75 const char *pwrdm_name;
76
77 /* Powerdomain pointer - resolved by the powerdomain code */
78 struct powerdomain *pwrdm;
79
80 /* Flags to mark OMAP chip restrictions, etc. */
81 const struct omap_chip_id omap_chip;
82
83};
84
85struct powerdomain { 71struct powerdomain {
86 72
87 /* Powerdomain name */ 73 /* Powerdomain name */
@@ -93,15 +79,6 @@ struct powerdomain {
93 /* Used to represent the OMAP chip types containing this pwrdm */ 79 /* Used to represent the OMAP chip types containing this pwrdm */
94 const struct omap_chip_id omap_chip; 80 const struct omap_chip_id omap_chip;
95 81
96 /* Powerdomains that can be told to wake this powerdomain up */
97 struct pwrdm_dep *wkdep_srcs;
98
99 /* Powerdomains that can be told to keep this pwrdm from inactivity */
100 struct pwrdm_dep *sleepdep_srcs;
101
102 /* Bit shift of this powerdomain's PM_WKDEP/CM_SLEEPDEP bit */
103 const u8 dep_bit;
104
105 /* Possible powerdomain power states */ 82 /* Possible powerdomain power states */
106 const u8 pwrsts; 83 const u8 pwrsts;
107 84
@@ -152,13 +129,6 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
152 int (*fn)(struct powerdomain *pwrdm, 129 int (*fn)(struct powerdomain *pwrdm,
153 struct clockdomain *clkdm)); 130 struct clockdomain *clkdm));
154 131
155int pwrdm_add_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
156int pwrdm_del_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
157int pwrdm_read_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
158int pwrdm_add_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
159int pwrdm_del_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
160int pwrdm_read_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
161
162int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm); 132int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
163 133
164int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst); 134int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
diff --git a/arch/arm/plat-omap/include/plat/prcm.h b/arch/arm/plat-omap/include/plat/prcm.h
index e63e94e18975..66938a9f8dae 100644
--- a/arch/arm/plat-omap/include/plat/prcm.h
+++ b/arch/arm/plat-omap/include/plat/prcm.h
@@ -33,6 +33,14 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name);
33void omap3_prcm_save_context(void); 33void omap3_prcm_save_context(void);
34void omap3_prcm_restore_context(void); 34void omap3_prcm_restore_context(void);
35 35
36u32 prm_read_mod_reg(s16 module, u16 idx);
37void prm_write_mod_reg(u32 val, s16 module, u16 idx);
38u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
39u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask);
40u32 cm_read_mod_reg(s16 module, u16 idx);
41void cm_write_mod_reg(u32 val, s16 module, u16 idx);
42u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
43
36#endif 44#endif
37 45
38 46