Merge branch 'tk_prm_chain_handler_devel_3.3' of git://git.pwsan.com/linux-2.6 into...
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-omap2 / omap_hwmod.c
index 7ea3df517d2b53f36263df2e747daf4e8f19fa1d..ee9416bcc3e6072c1777ea9397ffb5578832827b 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 
-#include <plat/common.h>
+#include "common.h"
 #include <plat/cpu.h>
 #include "clockdomain.h"
 #include "powerdomain.h"
@@ -1487,6 +1487,25 @@ static int _enable(struct omap_hwmod *oh)
 
        pr_debug("omap_hwmod: %s: enabling\n", oh->name);
 
+       /*
+        * hwmods with HWMOD_INIT_NO_IDLE flag set are left
+        * in enabled state at init.
+        * Now that someone is really trying to enable them,
+        * just ensure that the hwmod mux is set.
+        */
+       if (oh->_int_flags & _HWMOD_SKIP_ENABLE) {
+               /*
+                * If the caller has mux data populated, do the mux'ing
+                * which wouldn't have been done as part of the _enable()
+                * done during setup.
+                */
+               if (oh->mux)
+                       omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED);
+
+               oh->_int_flags &= ~_HWMOD_SKIP_ENABLE;
+               return 0;
+       }
+
        if (oh->_state != _HWMOD_STATE_INITIALIZED &&
            oh->_state != _HWMOD_STATE_IDLE &&
            oh->_state != _HWMOD_STATE_DISABLED) {
@@ -1790,8 +1809,10 @@ static int _setup(struct omap_hwmod *oh, void *data)
         * it should be set by the core code as a runtime flag during startup
         */
        if ((oh->flags & HWMOD_INIT_NO_IDLE) &&
-           (postsetup_state == _HWMOD_STATE_IDLE))
+           (postsetup_state == _HWMOD_STATE_IDLE)) {
+               oh->_int_flags |= _HWMOD_SKIP_ENABLE;
                postsetup_state = _HWMOD_STATE_ENABLED;
+       }
 
        if (postsetup_state == _HWMOD_STATE_IDLE)
                _idle(oh);