|
@@ -3796,3 +3796,130 @@ int omap_hwmod_enable_wakeup(struct omap_hwmod *oh)
|
|
|
* events for this IP block if it has dynamic mux entries. Eventually
|
|
|
* this should clear PRCM wakeup registers to cause the PRCM to ignore
|
|
|
* wakeup events from the module. Does not set any wakeup routing
|
|
|
+ * registers beyond this point - if the module is to wake up any other
|
|
|
+ * module or subsystem, that must be set separately. Called by
|
|
|
+ * omap_device code. Returns -EINVAL on error or 0 upon success.
|
|
|
+ */
|
|
|
+int omap_hwmod_disable_wakeup(struct omap_hwmod *oh)
|
|
|
+{
|
|
|
+ unsigned long flags;
|
|
|
+ u32 v;
|
|
|
+
|
|
|
+ spin_lock_irqsave(&oh->_lock, flags);
|
|
|
+
|
|
|
+ if (oh->class->sysc &&
|
|
|
+ (oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)) {
|
|
|
+ v = oh->_sysc_cache;
|
|
|
+ _disable_wakeup(oh, &v);
|
|
|
+ _write_sysconfig(v, oh);
|
|
|
+ }
|
|
|
+
|
|
|
+ _set_idle_ioring_wakeup(oh, false);
|
|
|
+ spin_unlock_irqrestore(&oh->_lock, flags);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * omap_hwmod_assert_hardreset - assert the HW reset line of submodules
|
|
|
+ * contained in the hwmod module.
|
|
|
+ * @oh: struct omap_hwmod *
|
|
|
+ * @name: name of the reset line to lookup and assert
|
|
|
+ *
|
|
|
+ * Some IP like dsp, ipu or iva contain processor that require
|
|
|
+ * an HW reset line to be assert / deassert in order to enable fully
|
|
|
+ * the IP. Returns -EINVAL if @oh is null or if the operation is not
|
|
|
+ * yet supported on this OMAP; otherwise, passes along the return value
|
|
|
+ * from _assert_hardreset().
|
|
|
+ */
|
|
|
+int omap_hwmod_assert_hardreset(struct omap_hwmod *oh, const char *name)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+ unsigned long flags;
|
|
|
+
|
|
|
+ if (!oh)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ spin_lock_irqsave(&oh->_lock, flags);
|
|
|
+ ret = _assert_hardreset(oh, name);
|
|
|
+ spin_unlock_irqrestore(&oh->_lock, flags);
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * omap_hwmod_deassert_hardreset - deassert the HW reset line of submodules
|
|
|
+ * contained in the hwmod module.
|
|
|
+ * @oh: struct omap_hwmod *
|
|
|
+ * @name: name of the reset line to look up and deassert
|
|
|
+ *
|
|
|
+ * Some IP like dsp, ipu or iva contain processor that require
|
|
|
+ * an HW reset line to be assert / deassert in order to enable fully
|
|
|
+ * the IP. Returns -EINVAL if @oh is null or if the operation is not
|
|
|
+ * yet supported on this OMAP; otherwise, passes along the return value
|
|
|
+ * from _deassert_hardreset().
|
|
|
+ */
|
|
|
+int omap_hwmod_deassert_hardreset(struct omap_hwmod *oh, const char *name)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+ unsigned long flags;
|
|
|
+
|
|
|
+ if (!oh)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ spin_lock_irqsave(&oh->_lock, flags);
|
|
|
+ ret = _deassert_hardreset(oh, name);
|
|
|
+ spin_unlock_irqrestore(&oh->_lock, flags);
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * omap_hwmod_read_hardreset - read the HW reset line state of submodules
|
|
|
+ * contained in the hwmod module
|
|
|
+ * @oh: struct omap_hwmod *
|
|
|
+ * @name: name of the reset line to look up and read
|
|
|
+ *
|
|
|
+ * Return the current state of the hwmod @oh's reset line named @name:
|
|
|
+ * returns -EINVAL upon parameter error or if this operation
|
|
|
+ * is unsupported on the current OMAP; otherwise, passes along the return
|
|
|
+ * value from _read_hardreset().
|
|
|
+ */
|
|
|
+int omap_hwmod_read_hardreset(struct omap_hwmod *oh, const char *name)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+ unsigned long flags;
|
|
|
+
|
|
|
+ if (!oh)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ spin_lock_irqsave(&oh->_lock, flags);
|
|
|
+ ret = _read_hardreset(oh, name);
|
|
|
+ spin_unlock_irqrestore(&oh->_lock, flags);
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * omap_hwmod_for_each_by_class - call @fn for each hwmod of class @classname
|
|
|
+ * @classname: struct omap_hwmod_class name to search for
|
|
|
+ * @fn: callback function pointer to call for each hwmod in class @classname
|
|
|
+ * @user: arbitrary context data to pass to the callback function
|
|
|
+ *
|
|
|
+ * For each omap_hwmod of class @classname, call @fn.
|
|
|
+ * If the callback function returns something other than
|
|
|
+ * zero, the iterator is terminated, and the callback function's return
|
|
|
+ * value is passed back to the caller. Returns 0 upon success, -EINVAL
|
|
|
+ * if @classname or @fn are NULL, or passes back the error code from @fn.
|
|
|
+ */
|
|
|
+int omap_hwmod_for_each_by_class(const char *classname,
|
|
|
+ int (*fn)(struct omap_hwmod *oh,
|
|
|
+ void *user),
|
|
|
+ void *user)
|
|
|
+{
|
|
|
+ struct omap_hwmod *temp_oh;
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ if (!classname || !fn)
|
|
|
+ return -EINVAL;
|