|
@@ -764,6 +764,7 @@ static struct omap_hwmod *_lookup(const char *name)
|
|
|
/**
|
|
|
* _init_clocks - clk_get() all clocks associated with this hwmod
|
|
|
* @oh: struct omap_hwmod *
|
|
|
+ * @data: not used; pass NULL
|
|
|
*
|
|
|
* Called by omap_hwmod_late_init() (after omap2_clk_init()).
|
|
|
* Resolves all clock names embedded in the hwmod. Must be called
|
|
@@ -771,7 +772,7 @@ static struct omap_hwmod *_lookup(const char *name)
|
|
|
* has not yet been registered or if the clocks have already been
|
|
|
* initialized, 0 on success, or a non-zero error on failure.
|
|
|
*/
|
|
|
-static int _init_clocks(struct omap_hwmod *oh)
|
|
|
+static int _init_clocks(struct omap_hwmod *oh, void *data)
|
|
|
{
|
|
|
int ret = 0;
|
|
|
|
|
@@ -996,19 +997,25 @@ static int _shutdown(struct omap_hwmod *oh)
|
|
|
/**
|
|
|
* _setup - do initial configuration of omap_hwmod
|
|
|
* @oh: struct omap_hwmod *
|
|
|
+ * @skip_setup_idle_p: do not idle hwmods at the end of the fn if 1
|
|
|
*
|
|
|
* Writes the CLOCKACTIVITY bits @clockact to the hwmod @oh
|
|
|
- * OCP_SYSCONFIG register. Must be called with omap_hwmod_mutex
|
|
|
- * held. Returns -EINVAL if the hwmod is in the wrong state or returns
|
|
|
- * 0.
|
|
|
+ * OCP_SYSCONFIG register. Must be called with omap_hwmod_mutex held.
|
|
|
+ * @skip_setup_idle is intended to be used on a system that will not
|
|
|
+ * call omap_hwmod_enable() to enable devices (e.g., a system without
|
|
|
+ * PM runtime). Returns -EINVAL if the hwmod is in the wrong state or
|
|
|
+ * returns 0.
|
|
|
*/
|
|
|
-static int _setup(struct omap_hwmod *oh)
|
|
|
+static int _setup(struct omap_hwmod *oh, void *data)
|
|
|
{
|
|
|
int i, r;
|
|
|
+ u8 skip_setup_idle;
|
|
|
|
|
|
- if (!oh)
|
|
|
+ if (!oh || !data)
|
|
|
return -EINVAL;
|
|
|
|
|
|
+ skip_setup_idle = *(u8 *)data;
|
|
|
+
|
|
|
/* Set iclk autoidle mode */
|
|
|
if (oh->slaves_cnt > 0) {
|
|
|
for (i = 0; i < oh->slaves_cnt; i++) {
|
|
@@ -1050,7 +1057,7 @@ static int _setup(struct omap_hwmod *oh)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!(oh->flags & HWMOD_INIT_NO_IDLE))
|
|
|
+ if (!(oh->flags & HWMOD_INIT_NO_IDLE) && !skip_setup_idle)
|
|
|
_omap_hwmod_idle(oh);
|
|
|
|
|
|
return 0;
|
|
@@ -1164,6 +1171,7 @@ struct omap_hwmod *omap_hwmod_lookup(const char *name)
|
|
|
/**
|
|
|
* omap_hwmod_for_each - call function for each registered omap_hwmod
|
|
|
* @fn: pointer to a callback function
|
|
|
+ * @data: void * data to pass to callback function
|
|
|
*
|
|
|
* Call @fn for each registered omap_hwmod, passing @data to each
|
|
|
* function. @fn must return 0 for success or any other value for
|
|
@@ -1172,7 +1180,8 @@ struct omap_hwmod *omap_hwmod_lookup(const char *name)
|
|
|
* caller of omap_hwmod_for_each(). @fn is called with
|
|
|
* omap_hwmod_for_each() held.
|
|
|
*/
|
|
|
-int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh))
|
|
|
+int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
|
|
|
+ void *data)
|
|
|
{
|
|
|
struct omap_hwmod *temp_oh;
|
|
|
int ret;
|
|
@@ -1182,7 +1191,7 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh))
|
|
|
|
|
|
mutex_lock(&omap_hwmod_mutex);
|
|
|
list_for_each_entry(temp_oh, &omap_hwmod_list, node) {
|
|
|
- ret = (*fn)(temp_oh);
|
|
|
+ ret = (*fn)(temp_oh, data);
|
|
|
if (ret)
|
|
|
break;
|
|
|
}
|
|
@@ -1229,24 +1238,28 @@ int omap_hwmod_init(struct omap_hwmod **ohs)
|
|
|
|
|
|
/**
|
|
|
* omap_hwmod_late_init - do some post-clock framework initialization
|
|
|
+ * @skip_setup_idle: if 1, do not idle hwmods in _setup()
|
|
|
*
|
|
|
* Must be called after omap2_clk_init(). Resolves the struct clk names
|
|
|
* to struct clk pointers for each registered omap_hwmod. Also calls
|
|
|
* _setup() on each hwmod. Returns 0.
|
|
|
*/
|
|
|
-int omap_hwmod_late_init(void)
|
|
|
+int omap_hwmod_late_init(u8 skip_setup_idle)
|
|
|
{
|
|
|
int r;
|
|
|
|
|
|
/* XXX check return value */
|
|
|
- r = omap_hwmod_for_each(_init_clocks);
|
|
|
+ r = omap_hwmod_for_each(_init_clocks, NULL);
|
|
|
WARN(r, "omap_hwmod: omap_hwmod_late_init(): _init_clocks failed\n");
|
|
|
|
|
|
mpu_oh = omap_hwmod_lookup(MPU_INITIATOR_NAME);
|
|
|
WARN(!mpu_oh, "omap_hwmod: could not find MPU initiator hwmod %s\n",
|
|
|
MPU_INITIATOR_NAME);
|
|
|
|
|
|
- omap_hwmod_for_each(_setup);
|
|
|
+ if (skip_setup_idle)
|
|
|
+ pr_debug("omap_hwmod: will leave hwmods enabled during setup\n");
|
|
|
+
|
|
|
+ omap_hwmod_for_each(_setup, &skip_setup_idle);
|
|
|
|
|
|
return 0;
|
|
|
}
|