aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_hwmod.c
diff options
context:
space:
mode:
authorRajendra Nayak <rnayak@ti.com>2011-12-16 07:50:12 -0500
committerTony Lindgren <tony@atomide.com>2011-12-16 16:59:55 -0500
commitaacf094128759cfb29a3ce88f92d08b79b74a4e8 (patch)
tree8a15e6774835240e953cb9f561d50ca88fe95c59 /arch/arm/mach-omap2/omap_hwmod.c
parent4c89aad9f4803875f7065e825badc9ba61922091 (diff)
ARM: OMAP2+: hwmod: Add a new flag to handle hwmods left enabled at init
An hwmod with a 'HWMOD_INIT_NO_IDLE' flag set, is left in enabled state by the hwmod framework post the initial setup. Once a real user of the device (a driver) tries to enable it at a later point, the hwmod framework throws a WARN() about the device being already in enabled state. Fix this by introducing a new internal flag '_HWMOD_SKIP_ENABLE' to identify such devices/hwmods. When the device/hwmod is requested to be enabled (the first time) by its driver/user, nothing except the mux-enable is needed. The mux data is board specific and is unavailable during initial enable() of the device, done by the framework as part of setup(). A good example of a such a device is an UART used as debug console. The UART module needs to be kept enabled through the boot, until the UART driver takes control of it, for debug prints to appear on the console. Acked-by: Kevin Hilman <khilman@ti.com> Acked-by: Benoit Cousson <b-cousson@ti.com> Signed-off-by: Rajendra Nayak <rnayak@ti.com> [paul@pwsan.com: use a flag rather than a state; updated commit message; edited some documentation] Signed-off-by: Paul Walmsley <paul@pwsan.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 529142aff766..f673f808725f 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1441,6 +1441,25 @@ static int _enable(struct omap_hwmod *oh)
1441 1441
1442 pr_debug("omap_hwmod: %s: enabling\n", oh->name); 1442 pr_debug("omap_hwmod: %s: enabling\n", oh->name);
1443 1443
1444 /*
1445 * hwmods with HWMOD_INIT_NO_IDLE flag set are left
1446 * in enabled state at init.
1447 * Now that someone is really trying to enable them,
1448 * just ensure that the hwmod mux is set.
1449 */
1450 if (oh->_int_flags & _HWMOD_SKIP_ENABLE) {
1451 /*
1452 * If the caller has mux data populated, do the mux'ing
1453 * which wouldn't have been done as part of the _enable()
1454 * done during setup.
1455 */
1456 if (oh->mux)
1457 omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED);
1458
1459 oh->_int_flags &= ~_HWMOD_SKIP_ENABLE;
1460 return 0;
1461 }
1462
1444 if (oh->_state != _HWMOD_STATE_INITIALIZED && 1463 if (oh->_state != _HWMOD_STATE_INITIALIZED &&
1445 oh->_state != _HWMOD_STATE_IDLE && 1464 oh->_state != _HWMOD_STATE_IDLE &&
1446 oh->_state != _HWMOD_STATE_DISABLED) { 1465 oh->_state != _HWMOD_STATE_DISABLED) {
@@ -1744,8 +1763,10 @@ static int _setup(struct omap_hwmod *oh, void *data)
1744 * it should be set by the core code as a runtime flag during startup 1763 * it should be set by the core code as a runtime flag during startup
1745 */ 1764 */
1746 if ((oh->flags & HWMOD_INIT_NO_IDLE) && 1765 if ((oh->flags & HWMOD_INIT_NO_IDLE) &&
1747 (postsetup_state == _HWMOD_STATE_IDLE)) 1766 (postsetup_state == _HWMOD_STATE_IDLE)) {
1767 oh->_int_flags |= _HWMOD_SKIP_ENABLE;
1748 postsetup_state = _HWMOD_STATE_ENABLED; 1768 postsetup_state = _HWMOD_STATE_ENABLED;
1769 }
1749 1770
1750 if (postsetup_state == _HWMOD_STATE_IDLE) 1771 if (postsetup_state == _HWMOD_STATE_IDLE)
1751 _idle(oh); 1772 _idle(oh);