From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] ARM: OMAP2+: hwmod: use init-time function ptrs for enable/disable module
Date: Fri, 27 Apr 2012 13:05:36 -0700 [thread overview]
Message-ID: <1335557140-10854-3-git-send-email-khilman@ti.com> (raw)
In-Reply-To: <1335557140-10854-1-git-send-email-khilman@ti.com>
The enable/disable module functions are specific to SoCs with
OMAP4-class PRCM. Rather than use cpu_is* checks at runtime inside
the enable/disable module functions, use cpu_is at init time to
initialize function pointers only for SoCs that need them.
NOTE: the cpu_is* check for _enable_module was different than
the one for _disable_module, and this patch uses
cpu_is_omap44xx() for both.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 22 +++++++++++-----------
arch/arm/plat-omap/include/plat/omap_hwmod.h | 3 +++
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 939032a..a978350 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -779,10 +779,6 @@ static void _disable_optional_clocks(struct omap_hwmod *oh)
*/
static void _omap4_enable_module(struct omap_hwmod *oh)
{
- /* The module mode does not exist prior OMAP4 */
- if (cpu_is_omap24xx() || cpu_is_omap34xx())
- return;
-
if (!oh->clkdm || !oh->prcm.omap4.modulemode)
return;
@@ -1571,10 +1567,6 @@ static int _omap4_disable_module(struct omap_hwmod *oh)
{
int v;
- /* The module mode does not exist prior OMAP4 */
- if (!cpu_is_omap44xx())
- return -EINVAL;
-
if (!oh->clkdm || !oh->prcm.omap4.modulemode)
return -EINVAL;
@@ -1814,7 +1806,8 @@ static int _enable(struct omap_hwmod *oh)
}
_enable_clocks(oh);
- _omap4_enable_module(oh);
+ if (oh->enable_module)
+ oh->enable_module(oh);
r = _wait_target_ready(oh);
if (!r) {
@@ -1870,7 +1863,8 @@ static int _idle(struct omap_hwmod *oh)
_idle_sysc(oh);
_del_initiator_dep(oh, mpu_oh);
- _omap4_disable_module(oh);
+ if (oh->disable_module)
+ oh->disable_module(oh);
/*
* The module must be in idle mode before disabling any parents
@@ -1975,7 +1969,8 @@ static int _shutdown(struct omap_hwmod *oh)
if (oh->_state == _HWMOD_STATE_ENABLED) {
_del_initiator_dep(oh, mpu_oh);
/* XXX what about the other system initiators here? dma, dsp */
- _omap4_disable_module(oh);
+ if (oh->disable_module)
+ oh->disable_module(oh);
_disable_clocks(oh);
if (oh->clkdm)
clkdm_hwmod_disable(oh->clkdm, oh);
@@ -2063,6 +2058,11 @@ static int __init _init(struct omap_hwmod *oh, void *data)
return -EINVAL;
}
+ if (cpu_is_omap44xx()) {
+ oh->enable_module = _omap4_enable_module;
+ oh->disable_module = _omap4_disable_module;
+ }
+
oh->_state = _HWMOD_STATE_INITIALIZED;
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 14dde32..0dbe8cf 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -564,6 +564,9 @@ struct omap_hwmod {
u8 _int_flags;
u8 _state;
u8 _postsetup_state;
+
+ void (*enable_module)(struct omap_hwmod *oh);
+ int (*disable_module)(struct omap_hwmod *oh);
};
struct omap_hwmod *omap_hwmod_lookup(const char *name);
--
1.7.9.2
next prev parent reply other threads:[~2012-04-27 20:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-27 20:05 [PATCH 0/6] ARM: OMAP: hwmod: remove runtime cpu_is checking Kevin Hilman
2012-04-27 20:05 ` [PATCH 1/6] ARM: OMAP4: hwmod: rename _enable_module to _omap4_enable_module() Kevin Hilman
2012-04-29 10:11 ` Hiremath, Vaibhav
2012-04-30 14:22 ` Paul Walmsley
2012-04-30 17:15 ` Kevin Hilman
2012-04-27 20:05 ` Kevin Hilman [this message]
2012-04-30 14:28 ` [PATCH 2/6] ARM: OMAP2+: hwmod: use init-time function ptrs for enable/disable module Paul Walmsley
2012-04-27 20:05 ` [PATCH 3/6] ARM: OMAP4: hwmod: drop extra cpu_is check from _wait_target_disable() Kevin Hilman
2012-04-30 14:29 ` Paul Walmsley
2012-04-27 20:05 ` [PATCH 4/6] ARM: OMAP2+: hwmod: use init-time function pointer for wait_target_ready Kevin Hilman
2012-04-30 14:33 ` Paul Walmsley
2012-04-27 20:05 ` [PATCH 5/6] ARM: OMAP2+: hwmod: use init-time function pointer for hardreset Kevin Hilman
2012-04-30 14:34 ` Paul Walmsley
2012-04-27 20:05 ` [PATCH 6/6] ARM: OMAP2+: hwmod: use init-time function pointer for _init_clkdm Kevin Hilman
2012-04-30 14:35 ` Paul Walmsley
2012-04-29 10:29 ` [PATCH 0/6] ARM: OMAP: hwmod: remove runtime cpu_is checking Hiremath, Vaibhav
2012-04-30 12:59 ` Santosh Shilimkar
2012-04-30 16:05 ` Tony Lindgren
2012-04-30 14:41 ` Paul Walmsley
2012-06-14 10:01 ` a0393909
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1335557140-10854-3-git-send-email-khilman@ti.com \
--to=khilman@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).