diff mbox

[RFC,1/2] ARM: OMAP2+: hwmod: Split _init() into _init_early() and _init_late()

Message ID 1375089162-30664-2-git-send-email-rnayak@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rajendra Nayak July 29, 2013, 9:12 a.m. UTC
Split the _init() function into something that can be done early and
the rest which can be done late (during drivers inits).

This is done in preperation to remove the hwmod dependency to do all
clock inits (which inturn need clockdomain and other frameworks to be
in place) and module resets quite early in boot, and instead do these
on demand when the drivers initialize.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 7341eff..e49159c 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2415,16 +2415,21 @@  static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
  * upon success or if the hwmod isn't registered, or -EINVAL upon
  * failure.
  */
-static int __init _init(struct omap_hwmod *oh, void *data)
+static int __init _init_early(struct omap_hwmod *oh, void *data)
 {
-	int r;
-
 	if (oh->_state != _HWMOD_STATE_REGISTERED)
 		return 0;
 
 	if (oh->class->sysc)
 		_init_mpu_rt_base(oh, NULL);
 
+	return 0;
+}
+
+static int __init _init_late(struct omap_hwmod *oh, void *data)
+{
+	int r;
+
 	r = _init_clocks(oh, NULL);
 	if (r < 0) {
 		WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name);
@@ -3284,7 +3289,8 @@  int __init omap_hwmod_setup_one(const char *oh_name)
 
 	_ensure_mpu_hwmod_is_setup(oh);
 
-	_init(oh, NULL);
+	_init_early(oh, NULL);
+	_init_late(oh, NULL);
 	_setup(oh, NULL);
 
 	return 0;
@@ -3302,7 +3308,8 @@  static int __init omap_hwmod_setup_all(void)
 {
 	_ensure_mpu_hwmod_is_setup(NULL);
 
-	omap_hwmod_for_each(_init, NULL);
+	omap_hwmod_for_each(_init_early, NULL);
+	omap_hwmod_for_each(_init_late, NULL);
 	omap_hwmod_for_each(_setup, NULL);
 
 	return 0;