diff options
author | Paul Walmsley <paul@pwsan.com> | 2010-01-26 22:13:01 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-01-26 22:13:01 -0500 |
commit | 369d5614457384edcf62c5f39b03dd20be6ea1df (patch) | |
tree | 4ad04d48f3049ff2d88e8ddca35fb0ad8597d12c /arch/arm/plat-omap/include/plat/clockdomain.h | |
parent | e909d62a8afda7a224a7e322cf2f387d69ca771f (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.h | 8 |
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); | |||
126 | int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); | 132 | int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); |
127 | int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); | 133 | int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); |
128 | int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); | 134 | int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); |
135 | int clkdm_clear_all_wkdeps(struct clockdomain *clkdm); | ||
129 | int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); | 136 | int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); |
130 | int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); | 137 | int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); |
131 | int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); | 138 | int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); |
139 | int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm); | ||
132 | 140 | ||
133 | void omap2_clkdm_allow_idle(struct clockdomain *clkdm); | 141 | void omap2_clkdm_allow_idle(struct clockdomain *clkdm); |
134 | void omap2_clkdm_deny_idle(struct clockdomain *clkdm); | 142 | void omap2_clkdm_deny_idle(struct clockdomain *clkdm); |