diff options
author | Rajendra Nayak <rnayak@ti.com> | 2011-12-16 07:50:12 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-12-16 16:59:55 -0500 |
commit | aacf094128759cfb29a3ce88f92d08b79b74a4e8 (patch) | |
tree | 8a15e6774835240e953cb9f561d50ca88fe95c59 /arch/arm | |
parent | 4c89aad9f4803875f7065e825badc9ba61922091 (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')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 23 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap_hwmod.h | 3 |
2 files changed, 25 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); |
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 8b372ede17c1..1a13c02118df 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -416,10 +416,13 @@ struct omap_hwmod_omap4_prcm { | |||
416 | * _HWMOD_NO_MPU_PORT: no path exists for the MPU to write to this module | 416 | * _HWMOD_NO_MPU_PORT: no path exists for the MPU to write to this module |
417 | * _HWMOD_WAKEUP_ENABLED: set when the omap_hwmod code has enabled ENAWAKEUP | 417 | * _HWMOD_WAKEUP_ENABLED: set when the omap_hwmod code has enabled ENAWAKEUP |
418 | * _HWMOD_SYSCONFIG_LOADED: set when the OCP_SYSCONFIG value has been cached | 418 | * _HWMOD_SYSCONFIG_LOADED: set when the OCP_SYSCONFIG value has been cached |
419 | * _HWMOD_SKIP_ENABLE: set if hwmod enabled during init (HWMOD_INIT_NO_IDLE) - | ||
420 | * causes the first call to _enable() to only update the pinmux | ||
419 | */ | 421 | */ |
420 | #define _HWMOD_NO_MPU_PORT (1 << 0) | 422 | #define _HWMOD_NO_MPU_PORT (1 << 0) |
421 | #define _HWMOD_WAKEUP_ENABLED (1 << 1) | 423 | #define _HWMOD_WAKEUP_ENABLED (1 << 1) |
422 | #define _HWMOD_SYSCONFIG_LOADED (1 << 2) | 424 | #define _HWMOD_SYSCONFIG_LOADED (1 << 2) |
425 | #define _HWMOD_SKIP_ENABLE (1 << 3) | ||
423 | 426 | ||
424 | /* | 427 | /* |
425 | * omap_hwmod._state definitions | 428 | * omap_hwmod._state definitions |