aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/include/plat/clockdomain.h
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-01-26 22:13:01 -0500
committerPaul Walmsley <paul@pwsan.com>2010-01-26 22:13:01 -0500
commit369d5614457384edcf62c5f39b03dd20be6ea1df (patch)
tree4ad04d48f3049ff2d88e8ddca35fb0ad8597d12c /arch/arm/plat-omap/include/plat/clockdomain.h
parente909d62a8afda7a224a7e322cf2f387d69ca771f (diff)
OMAP clockdomains: add usecounting for wakeup and sleep dependencies
Add usecounting for wakeup and sleep dependencies. In the current situation, if several functions add dependencies on the same clockdomains, when the first dependency removal function is called, the dependency will be incorrectly removed from the hardware. Add clkdm_clear_all_wkdeps() and clkdm_clear_all_sleepdeps(), which provide a fast and usecounting-consistent way to clear all hardware clockdomain dependencies, since accesses to these registers can be quite slow. pm{2,3}4xx.c has been updated to use these new functions. The original version of this patch did not touch these files, which previously wrote directly to the wkdep registers, and thus confused the usecounting code. This problem was found by Kevin Hilman <khilman@deeprootsystems.com>. N.B.: This patch introduces one significant functional difference over the previous pm34xx.c code: sleepdeps are now cleared during clockdomain initialization, whereas previously they were left untouched. This has been tested by Kevin and confirmed to work. The original version of this patch also did not take into consideration that some clockdomains do not have sleep or wakeup dependency sources, which caused NULL pointer dereferences. This problem was debugged and fixed by Kevin Hilman <khilman@deeprootsystems.com>. Signed-off-by: Paul Walmsley <paul@pwsan.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> Cc: Jouni Högander <jouni.hogander@nokia.com>
Diffstat (limited to 'arch/arm/plat-omap/include/plat/clockdomain.h')
-rw-r--r--arch/arm/plat-omap/include/plat/clockdomain.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/include/plat/clockdomain.h b/arch/arm/plat-omap/include/plat/clockdomain.h
index 22869713265f..45b5debc5d3f 100644
--- a/arch/arm/plat-omap/include/plat/clockdomain.h
+++ b/arch/arm/plat-omap/include/plat/clockdomain.h
@@ -70,6 +70,12 @@ struct clkdm_dep {
70 /* Clockdomain pointer - resolved by the clockdomain code */ 70 /* Clockdomain pointer - resolved by the clockdomain code */
71 struct clockdomain *clkdm; 71 struct clockdomain *clkdm;
72 72
73 /* Number of wakeup dependencies causing this clkdm to wake */
74 atomic_t wkdep_usecount;
75
76 /* Number of sleep dependencies that could prevent clkdm from idle */
77 atomic_t sleepdep_usecount;
78
73 /* Flags to mark OMAP chip restrictions, etc. */ 79 /* Flags to mark OMAP chip restrictions, etc. */
74 const struct omap_chip_id omap_chip; 80 const struct omap_chip_id omap_chip;
75 81
@@ -126,9 +132,11 @@ struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm);
126int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); 132int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
127int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); 133int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
128int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); 134int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
135int clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
129int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); 136int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
130int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); 137int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
131int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); 138int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
139int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
132 140
133void omap2_clkdm_allow_idle(struct clockdomain *clkdm); 141void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
134void omap2_clkdm_deny_idle(struct clockdomain *clkdm); 142void omap2_clkdm_deny_idle(struct clockdomain *clkdm);