Skip to contentSkip to conversation

OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE

PATCH New Kevin Hilman 1 participant 2 messages May 20, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE

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.

---

 arch/arm/mach-omap2/omap_hwmod.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +10 -1
index 2fff39f..a127c9b 100644
@@ -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;
 }
 
Signature · 1 line
1.7.0.2
#1 lore raw

PATCH 1/1 OMAP: hwmod: if IDLEST fields are not set, use module defaults

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.

---
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(-)
arch/arm/mach-omap2/omap_hwmod.c +6 -0
index a127c9b..77fef90 100644
@@ -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",
Signature · 1 line
1.7.0.2