|
@@ -2729,3 +2729,117 @@ static int __init _register_link(struct omap_hwmod_ocp_if *oi)
|
|
|
* Allocate a large block of struct omap_hwmod_link records. This
|
|
|
* improves boot time significantly by avoiding the need to allocate
|
|
|
* individual records one by one. If the number of records to
|
|
|
+ * allocate in the block hasn't been manually specified, this function
|
|
|
+ * will count the number of struct omap_hwmod_ocp_if records in @ois
|
|
|
+ * and use that to determine the allocation size. For SoC families
|
|
|
+ * that require multiple list registrations, such as OMAP3xxx, this
|
|
|
+ * estimation process isn't optimal, so manual estimation is advised
|
|
|
+ * in those cases. Returns -EEXIST if the allocation has already occurred
|
|
|
+ * or 0 upon success.
|
|
|
+ */
|
|
|
+static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
|
|
|
+{
|
|
|
+ unsigned int i = 0;
|
|
|
+ unsigned int sz;
|
|
|
+
|
|
|
+ if (linkspace) {
|
|
|
+ WARN(1, "linkspace already allocated\n");
|
|
|
+ return -EEXIST;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (max_ls == 0)
|
|
|
+ while (ois[i++])
|
|
|
+ max_ls += LINKS_PER_OCP_IF;
|
|
|
+
|
|
|
+ sz = sizeof(struct omap_hwmod_link) * max_ls;
|
|
|
+
|
|
|
+ pr_debug("omap_hwmod: %s: allocating %d byte linkspace (%d links)\n",
|
|
|
+ __func__, sz, max_ls);
|
|
|
+
|
|
|
+ linkspace = alloc_bootmem(sz);
|
|
|
+
|
|
|
+ memset(linkspace, 0, sz);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+/* Static functions intended only for use in soc_ops field function pointers */
|
|
|
+
|
|
|
+/**
|
|
|
+ * _omap2xxx_wait_target_ready - wait for a module to leave slave idle
|
|
|
+ * @oh: struct omap_hwmod *
|
|
|
+ *
|
|
|
+ * Wait for a module @oh to leave slave idle. Returns 0 if the module
|
|
|
+ * does not have an IDLEST bit or if the module successfully leaves
|
|
|
+ * slave idle; otherwise, pass along the return value of the
|
|
|
+ * appropriate *_cm*_wait_module_ready() function.
|
|
|
+ */
|
|
|
+static int _omap2xxx_wait_target_ready(struct omap_hwmod *oh)
|
|
|
+{
|
|
|
+ if (!oh)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ if (oh->flags & HWMOD_NO_IDLEST)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ if (!_find_mpu_rt_port(oh))
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
|
|
|
+
|
|
|
+ return omap2xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
|
|
|
+ oh->prcm.omap2.idlest_reg_id,
|
|
|
+ oh->prcm.omap2.idlest_idle_bit);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * _omap3xxx_wait_target_ready - wait for a module to leave slave idle
|
|
|
+ * @oh: struct omap_hwmod *
|
|
|
+ *
|
|
|
+ * Wait for a module @oh to leave slave idle. Returns 0 if the module
|
|
|
+ * does not have an IDLEST bit or if the module successfully leaves
|
|
|
+ * slave idle; otherwise, pass along the return value of the
|
|
|
+ * appropriate *_cm*_wait_module_ready() function.
|
|
|
+ */
|
|
|
+static int _omap3xxx_wait_target_ready(struct omap_hwmod *oh)
|
|
|
+{
|
|
|
+ if (!oh)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ if (oh->flags & HWMOD_NO_IDLEST)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ if (!_find_mpu_rt_port(oh))
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
|
|
|
+
|
|
|
+ return omap3xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
|
|
|
+ oh->prcm.omap2.idlest_reg_id,
|
|
|
+ oh->prcm.omap2.idlest_idle_bit);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * _omap4_wait_target_ready - wait for a module to leave slave idle
|
|
|
+ * @oh: struct omap_hwmod *
|
|
|
+ *
|
|
|
+ * Wait for a module @oh to leave slave idle. Returns 0 if the module
|
|
|
+ * does not have an IDLEST bit or if the module successfully leaves
|
|
|
+ * slave idle; otherwise, pass along the return value of the
|
|
|
+ * appropriate *_cm*_wait_module_ready() function.
|
|
|
+ */
|
|
|
+static int _omap4_wait_target_ready(struct omap_hwmod *oh)
|
|
|
+{
|
|
|
+ if (!oh)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ if (oh->flags & HWMOD_NO_IDLEST || !oh->clkdm)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ if (!_find_mpu_rt_port(oh))
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ /* XXX check module SIDLEMODE, hardreset status */
|
|
|
+
|
|
|
+ return omap4_cminst_wait_module_ready(oh->clkdm->prcm_partition,
|
|
|
+ oh->clkdm->cm_inst,
|