diff mbox series

[4/7] ARM: OMAP2+: Define _HWMOD_STATE_DEFAULT and use it

Message ID 20190325183819.15400-5-tony@atomide.com (mailing list archive)
State New, archived
Headers show
Series omap changes to allocate struct omap_hwmod dynamically | expand

Commit Message

Tony Lindgren March 25, 2019, 6:38 p.m. UTC
For dynamically allocated struct hwmod entries probing with ti-sysc
interconnect target module driver, we need to specify the initial default
state the same way as we do for the platform data cases.

Let's prepare for that by adding _HWMOD_STATE_DEFAULT that we can then
use to set the initial default state without a need to add similar
CONFIG_PM handling in multiple places.

Cc: Paul Walmsley <paul@pwsan.com>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/io.c         | 7 +------
 arch/arm/mach-omap2/omap_hwmod.h | 6 ++++++
 2 files changed, 7 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -411,14 +411,9 @@  static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
 
 static void __init __maybe_unused omap_hwmod_init_postsetup(void)
 {
-	u8 postsetup_state;
+	u8 postsetup_state = _HWMOD_STATE_DEFAULT;
 
 	/* Set the default postsetup state for all hwmods */
-#ifdef CONFIG_PM
-	postsetup_state = _HWMOD_STATE_IDLE;
-#else
-	postsetup_state = _HWMOD_STATE_ENABLED;
-#endif
 	omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
 }
 
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -493,6 +493,12 @@  struct omap_hwmod_omap4_prcm {
 #define _HWMOD_STATE_IDLE			5
 #define _HWMOD_STATE_DISABLED			6
 
+#ifdef CONFIG_PM
+#define _HWMOD_STATE_DEFAULT			_HWMOD_STATE_IDLE
+#else
+#define _HWMOD_STATE_DEFAULT			_HWMOD_STATE_ENABLED
+#endif
+
 /**
  * struct omap_hwmod_class - the type of an IP block
  * @name: name of the hwmod_class