* [PATCH 0/5] OMAP2/3: misc. hwmod fixes
@ 2010-05-27 21:13 Kevin Hilman
2010-05-27 21:13 ` [PATCH 1/5] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE Kevin Hilman
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Kevin Hilman @ 2010-05-27 21:13 UTC (permalink / raw)
To: linux-omap
This series is a set of misc. hwmod fixes needed for functioning
runtime PM on OMAP2 and OMAP3. These were used to get an
omap_device/hwmod-based runtime PM working an tested on OMAP3430
(omap3evm) and OMAP2 (n810)
All of these have been previously posted in various forms, but here
they are all collected into one place.
This series is also available in the pm-wip/hwmods branch of my git
tree.
This series applies on top of Benoit's two fixup/cleanup series that
Paul has accepted.
Kevin Hilman (5):
OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE
OMAP: hwmod: if IDLEST fields are not set, use module defaults
OMAP: hwmod: add option for no locking in idle/enable paths
OMAP24xx: CM: fix mask used for checking IDLEST status
OMAP2/3: hwmod: L3 and L4 CORE/PER/WKUP hwmods don't have IDLEST
arch/arm/mach-omap2/cm.c | 6 ++--
arch/arm/mach-omap2/omap_hwmod.c | 33 ++++++++++++++++++++++----
arch/arm/mach-omap2/omap_hwmod_2420_data.c | 9 ++++--
arch/arm/mach-omap2/omap_hwmod_2430_data.c | 9 ++++--
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 12 ++++++---
arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 +
6 files changed, 52 insertions(+), 18 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/5] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE 2010-05-27 21:13 [PATCH 0/5] OMAP2/3: misc. hwmod fixes Kevin Hilman @ 2010-05-27 21:13 ` Kevin Hilman 2010-05-27 21:13 ` [PATCH 2/5] OMAP: hwmod: if IDLEST fields are not set, use module defaults Kevin Hilman ` (3 subsequent siblings) 4 siblings, 0 replies; 7+ messages in thread From: Kevin Hilman @ 2010-05-27 21:13 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] 7+ messages in thread
* [PATCH 2/5] OMAP: hwmod: if IDLEST fields are not set, use module defaults 2010-05-27 21:13 [PATCH 0/5] OMAP2/3: misc. hwmod fixes Kevin Hilman 2010-05-27 21:13 ` [PATCH 1/5] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE Kevin Hilman @ 2010-05-27 21:13 ` Kevin Hilman 2010-06-18 16:43 ` Kevin Hilman 2010-05-27 21:13 ` [PATCH 3/5] OMAP: hwmod: add option for no locking in idle/enable paths Kevin Hilman ` (2 subsequent siblings) 4 siblings, 1 reply; 7+ messages in thread From: Kevin Hilman @ 2010-05-27 21:13 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> --- 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] 7+ messages in thread
* Re: [PATCH 2/5] OMAP: hwmod: if IDLEST fields are not set, use module defaults 2010-05-27 21:13 ` [PATCH 2/5] OMAP: hwmod: if IDLEST fields are not set, use module defaults Kevin Hilman @ 2010-06-18 16:43 ` Kevin Hilman 0 siblings, 0 replies; 7+ messages in thread From: Kevin Hilman @ 2010-06-18 16:43 UTC (permalink / raw) To: linux-omap Kevin Hilman <khilman@deeprootsystems.com> writes: > 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> FYI... dropping this patch in favor of simply updating the hwmod data files to have valid idlest_* fields. Kevin > 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 [flat|nested] 7+ messages in thread
* [PATCH 3/5] OMAP: hwmod: add option for no locking in idle/enable paths 2010-05-27 21:13 [PATCH 0/5] OMAP2/3: misc. hwmod fixes Kevin Hilman 2010-05-27 21:13 ` [PATCH 1/5] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE Kevin Hilman 2010-05-27 21:13 ` [PATCH 2/5] OMAP: hwmod: if IDLEST fields are not set, use module defaults Kevin Hilman @ 2010-05-27 21:13 ` Kevin Hilman 2010-05-27 21:13 ` [PATCH 4/5] OMAP24xx: CM: fix mask used for checking IDLEST status Kevin Hilman 2010-05-27 21:13 ` [PATCH 5/5] OMAP2/3: hwmod: L3 and L4 CORE/PER/WKUP hwmods don't have IDLEST Kevin Hilman 4 siblings, 0 replies; 7+ messages in thread From: Kevin Hilman @ 2010-05-27 21:13 UTC (permalink / raw) To: linux-omap Some hwmods may be idled/enabled directly from within the core idle/suspend path. Since interrupts are already disabled here, the mutex-based locking in hwmod can sleep and will cause potential deadlocks. To fix, add a hwmod flag HWMOD_NO_IDLE_LOCKING which indicates to the hwmod core that no locking should be done during the idle/enable paths for this hwmod. Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> --- arch/arm/mach-omap2/omap_hwmod.c | 16 ++++++++++++---- arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 77fef90..1ee2fb2 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1304,9 +1304,13 @@ int omap_hwmod_enable(struct omap_hwmod *oh) if (!oh) return -EINVAL; - mutex_lock(&omap_hwmod_mutex); + if (!(oh->flags & HWMOD_NO_IDLE_LOCKING)) + mutex_lock(&omap_hwmod_mutex); + r = _enable(oh); - mutex_unlock(&omap_hwmod_mutex); + + if (!(oh->flags & HWMOD_NO_IDLE_LOCKING)) + mutex_unlock(&omap_hwmod_mutex); return r; } @@ -1323,9 +1327,13 @@ int omap_hwmod_idle(struct omap_hwmod *oh) if (!oh) return -EINVAL; - mutex_lock(&omap_hwmod_mutex); + if (!(oh->flags & HWMOD_NO_IDLE_LOCKING)) + mutex_lock(&omap_hwmod_mutex); + _idle(oh); - mutex_unlock(&omap_hwmod_mutex); + + if (!(oh->flags & HWMOD_NO_IDLE_LOCKING)) + mutex_unlock(&omap_hwmod_mutex); return 0; } diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 0eccc09..cc3f9a7 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -360,6 +360,7 @@ struct omap_hwmod_omap4_prcm { #define HWMOD_NO_OCP_AUTOIDLE (1 << 4) #define HWMOD_SET_DEFAULT_CLOCKACT (1 << 5) #define HWMOD_NO_IDLEST (1 << 6) +#define HWMOD_NO_IDLE_LOCKING (1 << 7) /* * omap_hwmod._int_flags definitions -- 1.7.0.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] OMAP24xx: CM: fix mask used for checking IDLEST status 2010-05-27 21:13 [PATCH 0/5] OMAP2/3: misc. hwmod fixes Kevin Hilman ` (2 preceding siblings ...) 2010-05-27 21:13 ` [PATCH 3/5] OMAP: hwmod: add option for no locking in idle/enable paths Kevin Hilman @ 2010-05-27 21:13 ` Kevin Hilman 2010-05-27 21:13 ` [PATCH 5/5] OMAP2/3: hwmod: L3 and L4 CORE/PER/WKUP hwmods don't have IDLEST Kevin Hilman 4 siblings, 0 replies; 7+ messages in thread From: Kevin Hilman @ 2010-05-27 21:13 UTC (permalink / raw) To: linux-omap On OMAP24xx, the polarity for the IDLEST bits is opposite of OMAP3. The mask used to check this was using the bit position instead of the bit mask. This patch fixes the problem by using the bit mask instead of the bit field. Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> --- arch/arm/mach-omap2/cm.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/cm.c b/arch/arm/mach-omap2/cm.c index 2d83565..721c3b6 100644 --- a/arch/arm/mach-omap2/cm.c +++ b/arch/arm/mach-omap2/cm.c @@ -50,15 +50,15 @@ int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift) cm_idlest_reg = cm_idlest_offs[idlest_id - 1]; + mask = 1 << idlest_shift; + if (cpu_is_omap24xx()) - ena = idlest_shift; + ena = mask; else if (cpu_is_omap34xx()) ena = 0; else BUG(); - mask = 1 << idlest_shift; - /* XXX should be OMAP2 CM */ omap_test_timeout(((cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) == ena), MAX_MODULE_READY_TIME, i); -- 1.7.0.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] OMAP2/3: hwmod: L3 and L4 CORE/PER/WKUP hwmods don't have IDLEST 2010-05-27 21:13 [PATCH 0/5] OMAP2/3: misc. hwmod fixes Kevin Hilman ` (3 preceding siblings ...) 2010-05-27 21:13 ` [PATCH 4/5] OMAP24xx: CM: fix mask used for checking IDLEST status Kevin Hilman @ 2010-05-27 21:13 ` Kevin Hilman 4 siblings, 0 replies; 7+ messages in thread From: Kevin Hilman @ 2010-05-27 21:13 UTC (permalink / raw) To: linux-omap Since these hwmods do not have IDLEST, set the HWMOD_NO_IDLEST flag, otherwise _enable() will fail due to failing _wait_target_ready(). Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 9 ++++++--- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 9 ++++++--- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 12 ++++++++---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index e5530c5..a8b57a6 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -65,7 +65,8 @@ static struct omap_hwmod omap2420_l3_hwmod = { .masters_cnt = ARRAY_SIZE(omap2420_l3_masters), .slaves = omap2420_l3_slaves, .slaves_cnt = ARRAY_SIZE(omap2420_l3_slaves), - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), + .flags = HWMOD_NO_IDLEST, }; static struct omap_hwmod omap2420_l4_wkup_hwmod; @@ -95,7 +96,8 @@ static struct omap_hwmod omap2420_l4_core_hwmod = { .masters_cnt = ARRAY_SIZE(omap2420_l4_core_masters), .slaves = omap2420_l4_core_slaves, .slaves_cnt = ARRAY_SIZE(omap2420_l4_core_slaves), - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), + .flags = HWMOD_NO_IDLEST, }; /* Slave interfaces on the L4_WKUP interconnect */ @@ -115,7 +117,8 @@ static struct omap_hwmod omap2420_l4_wkup_hwmod = { .masters_cnt = ARRAY_SIZE(omap2420_l4_wkup_masters), .slaves = omap2420_l4_wkup_slaves, .slaves_cnt = ARRAY_SIZE(omap2420_l4_wkup_slaves), - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), + .flags = HWMOD_NO_IDLEST, }; /* Master interfaces on the MPU device */ diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 0852d95..8b1f74b 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -65,7 +65,8 @@ static struct omap_hwmod omap2430_l3_hwmod = { .masters_cnt = ARRAY_SIZE(omap2430_l3_masters), .slaves = omap2430_l3_slaves, .slaves_cnt = ARRAY_SIZE(omap2430_l3_slaves), - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), + .flags = HWMOD_NO_IDLEST, }; static struct omap_hwmod omap2430_l4_wkup_hwmod; @@ -97,7 +98,8 @@ static struct omap_hwmod omap2430_l4_core_hwmod = { .masters_cnt = ARRAY_SIZE(omap2430_l4_core_masters), .slaves = omap2430_l4_core_slaves, .slaves_cnt = ARRAY_SIZE(omap2430_l4_core_slaves), - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), + .flags = HWMOD_NO_IDLEST, }; /* Slave interfaces on the L4_WKUP interconnect */ @@ -117,7 +119,8 @@ static struct omap_hwmod omap2430_l4_wkup_hwmod = { .masters_cnt = ARRAY_SIZE(omap2430_l4_wkup_masters), .slaves = omap2430_l4_wkup_slaves, .slaves_cnt = ARRAY_SIZE(omap2430_l4_wkup_slaves), - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), + .flags = HWMOD_NO_IDLEST, }; /* Master interfaces on the MPU device */ diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 39b0c0e..e288b20 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -76,7 +76,8 @@ static struct omap_hwmod omap3xxx_l3_hwmod = { .masters_cnt = ARRAY_SIZE(omap3xxx_l3_masters), .slaves = omap3xxx_l3_slaves, .slaves_cnt = ARRAY_SIZE(omap3xxx_l3_slaves), - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), + .flags = HWMOD_NO_IDLEST, }; static struct omap_hwmod omap3xxx_l4_wkup_hwmod; @@ -106,7 +107,8 @@ static struct omap_hwmod omap3xxx_l4_core_hwmod = { .masters_cnt = ARRAY_SIZE(omap3xxx_l4_core_masters), .slaves = omap3xxx_l4_core_slaves, .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_core_slaves), - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), + .flags = HWMOD_NO_IDLEST, }; /* Slave interfaces on the L4_PER interconnect */ @@ -126,7 +128,8 @@ static struct omap_hwmod omap3xxx_l4_per_hwmod = { .masters_cnt = ARRAY_SIZE(omap3xxx_l4_per_masters), .slaves = omap3xxx_l4_per_slaves, .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_per_slaves), - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), + .flags = HWMOD_NO_IDLEST, }; /* Slave interfaces on the L4_WKUP interconnect */ @@ -146,7 +149,8 @@ static struct omap_hwmod omap3xxx_l4_wkup_hwmod = { .masters_cnt = ARRAY_SIZE(omap3xxx_l4_wkup_masters), .slaves = omap3xxx_l4_wkup_slaves, .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_wkup_slaves), - .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), + .flags = HWMOD_NO_IDLEST, }; /* Master interfaces on the MPU device */ -- 1.7.0.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-06-18 16:43 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-05-27 21:13 [PATCH 0/5] OMAP2/3: misc. hwmod fixes Kevin Hilman 2010-05-27 21:13 ` [PATCH 1/5] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE Kevin Hilman 2010-05-27 21:13 ` [PATCH 2/5] OMAP: hwmod: if IDLEST fields are not set, use module defaults Kevin Hilman 2010-06-18 16:43 ` Kevin Hilman 2010-05-27 21:13 ` [PATCH 3/5] OMAP: hwmod: add option for no locking in idle/enable paths Kevin Hilman 2010-05-27 21:13 ` [PATCH 4/5] OMAP24xx: CM: fix mask used for checking IDLEST status Kevin Hilman 2010-05-27 21:13 ` [PATCH 5/5] OMAP2/3: hwmod: L3 and L4 CORE/PER/WKUP hwmods don't have IDLEST 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).