diff mbox

[1/2] OMAP: hw_mod: consider supported idlemodes in enable_sysc

Message ID 1299749569-22673-2-git-send-email-kalle.jokiniemi@nokia.com (mailing list archive)
State New, archived
Delegated to: Paul Walmsley
Headers show

Commit Message

kalle.jokiniemi@nokia.com March 10, 2011, 9:32 a.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 028efda..ef77697 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -757,7 +757,7 @@  static void __iomem * __init _find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
  */
 static void _enable_sysc(struct omap_hwmod *oh)
 {
-	u8 idlemode, sf;
+	u8 idlemode, sf, idlemode_flags;
 	u32 v;
 
 	if (!oh->class->sysc)
@@ -765,17 +765,28 @@  static void _enable_sysc(struct omap_hwmod *oh)
 
 	v = oh->_sysc_cache;
 	sf = oh->class->sysc->sysc_flags;
+	idlemode_flags = oh->class->sysc->idlemodes;
+
+	/* Set the idlemode, priority order: 1. SMART 2. FORCE 3. NOIDLE */
+	if (idlemode_flags & SIDLE_SMART)
+		idlemode = HWMOD_IDLEMODE_SMART;
+	else if (idlemode_flags & SIDLE_FORCE)
+		idlemode = HWMOD_IDLEMODE_FORCE;
+	else
+		idlemode = HWMOD_IDLEMODE_NO;
 
 	if (sf & SYSC_HAS_SIDLEMODE) {
-		idlemode = (oh->flags & HWMOD_SWSUP_SIDLE) ?
-			HWMOD_IDLEMODE_NO : HWMOD_IDLEMODE_SMART;
-		_set_slave_idlemode(oh, idlemode, &v);
+		if (oh->flags & HWMOD_SWSUP_SIDLE)
+			_set_slave_idlemode(oh, HWMOD_IDLEMODE_NO, &v);
+		else
+			_set_slave_idlemode(oh, idlemode, &v);
 	}
 
 	if (sf & SYSC_HAS_MIDLEMODE) {
-		idlemode = (oh->flags & HWMOD_SWSUP_MSTANDBY) ?
-			HWMOD_IDLEMODE_NO : HWMOD_IDLEMODE_SMART;
-		_set_master_standbymode(oh, idlemode, &v);
+		if (oh->flags & HWMOD_SWSUP_MSTANDBY)
+			_set_master_standbymode(oh, HWMOD_IDLEMODE_NO, &v);
+		else
+			_set_master_standbymode(oh, idlemode, &v);
 	}
 
 	/*
@@ -788,7 +799,8 @@  static void _enable_sysc(struct omap_hwmod *oh)
 		_set_clockactivity(oh, oh->class->sysc->clockact, &v);
 
 	/* If slave is in SMARTIDLE, also enable wakeup */
-	if ((sf & SYSC_HAS_SIDLEMODE) && !(oh->flags & HWMOD_SWSUP_SIDLE))
+	if ((sf & SYSC_HAS_SIDLEMODE) && !(oh->flags & HWMOD_SWSUP_SIDLE) &&
+			idlemode_flags & SIDLE_SMART)
 		_enable_wakeup(oh, &v);
 
 	_write_sysconfig(v, oh);