* [PATCH] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE
@ 2010-05-20 23:59 Kevin Hilman
2010-05-20 23:59 ` [PATCH] OMAP: hwmod: if IDLEST fields are not set, use module defaults Kevin Hilman
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Hilman @ 2010-05-20 23:59 UTC (permalink / raw)
To: linux-omap
If an omap_hwmod is setup using HWMOD_INIT_NO_IDLE flag, there is
currently way to idle it since omap_hwmod_idle() requires the hwmod to
be in the enabled state.
This patch adds a check to omap_hwmod_idle() so if the hwmod was has
the INIT_NO_IDLE flag, calling omap_hwmod_idle() will still succeed.
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 2fff39f..a127c9b 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -939,7 +939,13 @@ static int _enable(struct omap_hwmod *oh)
*/
static int _idle(struct omap_hwmod *oh)
{
- if (oh->_state != _HWMOD_STATE_ENABLED) {
+ /*
+ * To idle, hwmod must be enabled, EXCEPT if hwmod was
+ * initialized using the INIT_NO_IDLE flag. In this case it
+ * will not yet be enabled so we have to allow it to be idled.
+ */
+ if ((oh->_state != _HWMOD_STATE_ENABLED) &&
+ !(oh->flags & HWMOD_INIT_NO_IDLE)) {
WARN(1, "omap_hwmod: %s: idle state can only be entered from "
"enabled state\n", oh->name);
return -EINVAL;
@@ -954,6 +960,9 @@ static int _idle(struct omap_hwmod *oh)
oh->_state = _HWMOD_STATE_IDLE;
+ /* Clear init flag which should only affect first call to idle */
+ oh->flags &= ~HWMOD_INIT_NO_IDLE;
+
return 0;
}
--
1.7.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] OMAP: hwmod: if IDLEST fields are not set, use module defaults
2010-05-20 23:59 [PATCH] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE Kevin Hilman
@ 2010-05-20 23:59 ` Kevin Hilman
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Hilman @ 2010-05-20 23:59 UTC (permalink / raw)
To: linux-omap
In the _setup() hook, check for valid IDLEST fields. If not set, use
the module defaults since they are the same as the module defaults
for most hwmods.
Problem found because _wait_target_ready() will fail if IDLEST
fields are not valid.
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
RFC: is this an OK solution, or is the preferred solution to ensure
that all the hwmod data is filled with valid fields.
arch/arm/mach-omap2/omap_hwmod.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index a127c9b..77fef90 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1036,6 +1036,12 @@ static int _setup(struct omap_hwmod *oh)
oh->_state = _HWMOD_STATE_INITIALIZED;
+ /* if IDLEST values are not set, use module defaults */
+ if (!oh->prcm.omap2.idlest_reg_id)
+ oh->prcm.omap2.idlest_reg_id = oh->prcm.omap2.prcm_reg_id;
+ if (!oh->prcm.omap2.idlest_idle_bit)
+ oh->prcm.omap2.idlest_idle_bit = oh->prcm.omap2.module_bit;
+
r = _enable(oh);
if (r) {
pr_warning("omap_hwmod: %s: cannot be enabled (%d)\n",
--
1.7.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-20 23:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-20 23:59 [PATCH] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE Kevin Hilman
2010-05-20 23:59 ` [PATCH] OMAP: hwmod: if IDLEST fields are not set, use module defaults Kevin Hilman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).