• Home
  • Raw
  • Download

Lines Matching +full:dsp +full:- +full:standby

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2009-2011 Nokia Corporation
6 * Copyright (C) 2011-2012 Texas Instruments, Inc.
15 * ------------
19 * etc. Some of these devices, like the DSP, are created by TI;
21 * TI's documentation, on-chip devices are referred to as "OMAP
26 * Most of the address and data flow between modules is via OCP-based
32 * OMAP hwmod provides a consistent way to describe the on-chip
42 * -----------
54 * +-------------------------------+
57 * +-------------------------------+
61 * +-------------------------------+
62 * | OMAP core-driver integration |
63 * |(arch/arm/mach-omap2/devices.c)|
64 * +-------------------------------+
66 * | (../plat-omap/omap_device.c) |
67 * +-------------------------------+
68 * ----> | omap_hwmod code/data | <-----
69 * | (../mach-omap2/omap_hwmod*) |
70 * +-------------------------------+
73 * +-------------------------------+
75 * Device drivers should not contain any OMAP-specific code or data in
82 * The OMAP hwmod code also will attempt to reset and idle all on-chip
84 * completely self-reliant and independent from bootloaders. This is
90 * ---------------------------
108 * ----------
110 * - OMAP2420 Multimedia Processor Silicon Revision 2.1.1, 2.2 (SWPU064)
111 * - OMAP2430 Multimedia Device POP Silicon Revision 2.1 (SWPU090)
112 * - OMAP34xx Multimedia Device Silicon Revision 3.1 (SWPU108)
113 * - OMAP4430 Multimedia Device Silicon Revision 1.0 (SWPU140)
114 * - Open Core Protocol Specification 2.2
117 * - handle IO mapping
118 * - bus throughput & module latency measurement code
131 #include <linux/clk-provider.h>
143 #include <linux/platform_data/ti-sysc.h>
145 #include <dt-bindings/bus/ti-sysc.h>
174 * omap_hwmod_ocp_if record (master->slave and slave->master)
190 * struct clkctrl_provider - clkctrl provider mapping data
208 * struct omap_hwmod_reset - IP specific reset functions
222 * struct omap_hwmod_soc_ops - fn ptrs for some SoC-specific operations
247 /* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */
263 * _update_sysc_cache - return the module OCP_SYSCONFIG register, keep copy
267 * struct omap_hwmod for later use. Returns -EINVAL if the hwmod has no
272 if (!oh->class->sysc) { in _update_sysc_cache()
273 WARN(1, "omap_hwmod: %s: cannot read OCP_SYSCONFIG: not defined on hwmod's class\n", oh->name); in _update_sysc_cache()
274 return -EINVAL; in _update_sysc_cache()
279 oh->_sysc_cache = omap_hwmod_read(oh, oh->class->sysc->sysc_offs); in _update_sysc_cache()
281 if (!(oh->class->sysc->sysc_flags & SYSC_NO_CACHE)) in _update_sysc_cache()
282 oh->_int_flags |= _HWMOD_SYSCONFIG_LOADED; in _update_sysc_cache()
288 * _write_sysconfig - write a value to the module's OCP_SYSCONFIG register
297 if (!oh->class->sysc) { in _write_sysconfig()
298 WARN(1, "omap_hwmod: %s: cannot write OCP_SYSCONFIG: not defined on hwmod's class\n", oh->name); in _write_sysconfig()
305 oh->_sysc_cache = v; in _write_sysconfig()
313 if (oh->class->unlock) in _write_sysconfig()
314 oh->class->unlock(oh); in _write_sysconfig()
316 omap_hwmod_write(v, oh, oh->class->sysc->sysc_offs); in _write_sysconfig()
318 if (oh->class->lock) in _write_sysconfig()
319 oh->class->lock(oh); in _write_sysconfig()
328 * Update the master standby mode bits in @v to be @standbymode for
329 * the @oh hwmod. Does not write to the hardware. Returns -EINVAL
338 if (!oh->class->sysc || in _set_master_standbymode()
339 !(oh->class->sysc->sysc_flags & SYSC_HAS_MIDLEMODE)) in _set_master_standbymode()
340 return -EINVAL; in _set_master_standbymode()
342 if (!oh->class->sysc->sysc_fields) { in _set_master_standbymode()
343 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name); in _set_master_standbymode()
344 return -EINVAL; in _set_master_standbymode()
347 mstandby_shift = oh->class->sysc->sysc_fields->midle_shift; in _set_master_standbymode()
363 * hwmod. Does not write to the hardware. Returns -EINVAL upon error
371 if (!oh->class->sysc || in _set_slave_idlemode()
372 !(oh->class->sysc->sysc_flags & SYSC_HAS_SIDLEMODE)) in _set_slave_idlemode()
373 return -EINVAL; in _set_slave_idlemode()
375 if (!oh->class->sysc->sysc_fields) { in _set_slave_idlemode()
376 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name); in _set_slave_idlemode()
377 return -EINVAL; in _set_slave_idlemode()
380 sidle_shift = oh->class->sysc->sysc_fields->sidle_shift; in _set_slave_idlemode()
397 * not write to the hardware. Returns -EINVAL upon error or 0 upon
405 if (!oh->class->sysc || in _set_clockactivity()
406 !(oh->class->sysc->sysc_flags & SYSC_HAS_CLOCKACTIVITY)) in _set_clockactivity()
407 return -EINVAL; in _set_clockactivity()
409 if (!oh->class->sysc->sysc_fields) { in _set_clockactivity()
410 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name); in _set_clockactivity()
411 return -EINVAL; in _set_clockactivity()
414 clkact_shift = oh->class->sysc->sysc_fields->clkact_shift; in _set_clockactivity()
428 * Set the SOFTRESET bit in @v for hwmod @oh. Returns -EINVAL upon
435 if (!oh->class->sysc || in _set_softreset()
436 !(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET)) in _set_softreset()
437 return -EINVAL; in _set_softreset()
439 if (!oh->class->sysc->sysc_fields) { in _set_softreset()
440 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name); in _set_softreset()
441 return -EINVAL; in _set_softreset()
444 softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift); in _set_softreset()
456 * Clear the SOFTRESET bit in @v for hwmod @oh. Returns -EINVAL upon
463 if (!oh->class->sysc || in _clear_softreset()
464 !(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET)) in _clear_softreset()
465 return -EINVAL; in _clear_softreset()
467 if (!oh->class->sysc->sysc_fields) { in _clear_softreset()
470 oh->name); in _clear_softreset()
471 return -EINVAL; in _clear_softreset()
474 softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift); in _clear_softreset()
482 * _wait_softreset_complete - wait for an OCP softreset to complete
487 * _ocp_softreset()) or by hardware upon returning from off-mode (one
497 sysc = oh->class->sysc; in _wait_softreset_complete()
499 if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS && sysc->syss_offs > 0) in _wait_softreset_complete()
500 omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs) in _wait_softreset_complete()
503 else if (sysc->sysc_flags & SYSC_HAS_RESET_STATUS) { in _wait_softreset_complete()
504 softrst_mask = (0x1 << sysc->sysc_fields->srst_shift); in _wait_softreset_complete()
505 omap_test_timeout(!(omap_hwmod_read(oh, sysc->sysc_offs) in _wait_softreset_complete()
517 * The DMADISABLE bit is a semi-automatic bit present in sysconfig register
522 * Set the DMADISABLE bit in @v for hwmod @oh. Returns -EINVAL upon
530 if (!oh->class->sysc || in _set_dmadisable()
531 !(oh->class->sysc->sysc_flags & SYSC_HAS_DMADISABLE)) in _set_dmadisable()
532 return -EINVAL; in _set_dmadisable()
534 if (!oh->class->sysc->sysc_fields) { in _set_dmadisable()
535 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name); in _set_dmadisable()
536 return -EINVAL; in _set_dmadisable()
540 if (oh->_state != _HWMOD_STATE_ENABLED) { in _set_dmadisable()
541 pr_warn("omap_hwmod: %s: dma can be disabled only from enabled state\n", oh->name); in _set_dmadisable()
542 return -EINVAL; in _set_dmadisable()
545 pr_debug("omap_hwmod: %s: setting DMADISABLE\n", oh->name); in _set_dmadisable()
547 v = oh->_sysc_cache; in _set_dmadisable()
549 (0x1 << oh->class->sysc->sysc_fields->dmadisable_shift); in _set_dmadisable()
565 * exact function of this bit varies on a per-module basis. This
566 * function does not write to the hardware. Returns -EINVAL upon
575 if (!oh->class->sysc || in _set_module_autoidle()
576 !(oh->class->sysc->sysc_flags & SYSC_HAS_AUTOIDLE)) in _set_module_autoidle()
577 return -EINVAL; in _set_module_autoidle()
579 if (!oh->class->sysc->sysc_fields) { in _set_module_autoidle()
580 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name); in _set_module_autoidle()
581 return -EINVAL; in _set_module_autoidle()
584 autoidle_shift = oh->class->sysc->sysc_fields->autoidle_shift; in _set_module_autoidle()
597 * Allow the hardware module @oh to send wakeups. Returns -EINVAL
602 if (!oh->class->sysc || in _enable_wakeup()
603 !((oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP) || in _enable_wakeup()
604 (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP) || in _enable_wakeup()
605 (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP))) in _enable_wakeup()
606 return -EINVAL; in _enable_wakeup()
608 if (!oh->class->sysc->sysc_fields) { in _enable_wakeup()
609 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name); in _enable_wakeup()
610 return -EINVAL; in _enable_wakeup()
613 if (oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP) in _enable_wakeup()
614 *v |= 0x1 << oh->class->sysc->sysc_fields->enwkup_shift; in _enable_wakeup()
616 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP) in _enable_wakeup()
618 if (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP) in _enable_wakeup()
630 if (oh->clkdm) { in _get_clkdm()
631 return oh->clkdm; in _get_clkdm()
632 } else if (oh->_clk) { in _get_clkdm()
633 if (!omap2_clk_is_hw_omap(__clk_get_hw(oh->_clk))) in _get_clkdm()
635 clk = to_clk_hw_omap(__clk_get_hw(oh->_clk)); in _get_clkdm()
636 return clk->clkdm; in _get_clkdm()
642 * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active
649 * initiator and the module). Only applies to modules in smart-idle
651 * 0 without doing anything. Otherwise, returns -EINVAL upon error or
662 return -EINVAL; in _add_initiator_dep()
664 if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS) in _add_initiator_dep()
671 * _del_initiator_dep: allow @oh to smart-idle even if @init_oh is active
678 * initiator and the module). Only applies to modules in smart-idle
680 * 0 without doing anything. Returns -EINVAL upon error or passes
691 return -EINVAL; in _del_initiator_dep()
693 if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS) in _del_initiator_dep()
713 return -ENOMEM; in _setup_clkctrl_provider()
715 provider->node = np; in _setup_clkctrl_provider()
717 provider->num_addrs = in _setup_clkctrl_provider()
720 provider->addr = in _setup_clkctrl_provider()
721 memblock_alloc(sizeof(void *) * provider->num_addrs, in _setup_clkctrl_provider()
723 if (!provider->addr) in _setup_clkctrl_provider()
724 return -ENOMEM; in _setup_clkctrl_provider()
726 provider->size = in _setup_clkctrl_provider()
727 memblock_alloc(sizeof(u32) * provider->num_addrs, in _setup_clkctrl_provider()
729 if (!provider->size) in _setup_clkctrl_provider()
730 return -ENOMEM; in _setup_clkctrl_provider()
732 for (i = 0; i < provider->num_addrs; i++) { in _setup_clkctrl_provider()
734 provider->addr[i] = (u32)of_translate_address(np, addrp); in _setup_clkctrl_provider()
735 provider->size[i] = size; in _setup_clkctrl_provider()
736 pr_debug("%s: %pOF: %x...%x\n", __func__, np, provider->addr[i], in _setup_clkctrl_provider()
737 provider->addr[i] + provider->size[i]); in _setup_clkctrl_provider()
740 list_add(&provider->link, &clkctrl_providers); in _setup_clkctrl_provider()
763 if (!oh->prcm.omap4.modulemode) in _omap4_xlate_clkctrl()
766 return omap_cm_xlate_clkctrl(oh->clkdm->prcm_partition, in _omap4_xlate_clkctrl()
767 oh->clkdm->cm_inst, in _omap4_xlate_clkctrl()
768 oh->prcm.omap4.clkctrl_offs); in _omap4_xlate_clkctrl()
784 pr_debug("%s: %s: addr=%x\n", __func__, oh->name, addr); in _lookup_clkctrl_clk()
789 for (i = 0; i < provider->num_addrs; i++) { in _lookup_clkctrl_clk()
790 if (provider->addr[i] <= addr && in _lookup_clkctrl_clk()
791 provider->addr[i] + provider->size[i] > addr) { in _lookup_clkctrl_clk()
794 clkspec.np = provider->node; in _lookup_clkctrl_clk()
796 clkspec.args[0] = addr - provider->addr[0]; in _lookup_clkctrl_clk()
802 __func__, oh->name, clk, in _lookup_clkctrl_clk()
803 clkspec.args[0], provider->node); in _lookup_clkctrl_clk()
814 * _init_main_clk - get a struct clk * for the the hwmod's main functional clk
819 * or a main_clk is present. Returns 0 on success or -EINVAL on error.
830 __clk_get_name(clk), oh->name); in _init_main_clk()
831 oh->main_clk = __clk_get_name(clk); in _init_main_clk()
832 oh->_clk = clk; in _init_main_clk()
835 if (!oh->main_clk) in _init_main_clk()
838 oh->_clk = clk_get(NULL, oh->main_clk); in _init_main_clk()
841 if (IS_ERR(oh->_clk)) { in _init_main_clk()
843 oh->name, oh->main_clk); in _init_main_clk()
844 return -EINVAL; in _init_main_clk()
847 * HACK: This needs a re-visit once clk_prepare() is implemented in _init_main_clk()
848 * to do something meaningful. Today its just a no-op. in _init_main_clk()
854 clk_prepare(oh->_clk); in _init_main_clk()
858 oh->name, oh->main_clk); in _init_main_clk()
864 * _init_interface_clks - get a struct clk * for the the hwmod's interface clks
868 * clock pointers. Returns 0 on success or -EINVAL on error.
876 list_for_each_entry(os, &oh->slave_ports, node) { in _init_interface_clks()
877 if (!os->clk) in _init_interface_clks()
880 c = clk_get(NULL, os->clk); in _init_interface_clks()
883 oh->name, os->clk); in _init_interface_clks()
884 ret = -EINVAL; in _init_interface_clks()
887 os->_clk = c; in _init_interface_clks()
889 * HACK: This needs a re-visit once clk_prepare() is implemented in _init_interface_clks()
890 * to do something meaningful. Today its just a no-op. in _init_interface_clks()
896 clk_prepare(os->_clk); in _init_interface_clks()
903 * _init_opt_clk - get a struct clk * for the the hwmod's optional clocks
907 * clock pointers. Returns 0 on success or -EINVAL on error.
916 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) { in _init_opt_clks()
917 c = clk_get(NULL, oc->clk); in _init_opt_clks()
920 oh->name, oc->clk); in _init_opt_clks()
921 ret = -EINVAL; in _init_opt_clks()
924 oc->_clk = c; in _init_opt_clks()
926 * HACK: This needs a re-visit once clk_prepare() is implemented in _init_opt_clks()
927 * to do something meaningful. Today its just a no-op. in _init_opt_clks()
933 clk_prepare(oc->_clk); in _init_opt_clks()
944 pr_debug("omap_hwmod: %s: enabling optional clocks\n", oh->name); in _enable_optional_clocks()
946 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) in _enable_optional_clocks()
947 if (oc->_clk) { in _enable_optional_clocks()
948 pr_debug("omap_hwmod: enable %s:%s\n", oc->role, in _enable_optional_clocks()
949 __clk_get_name(oc->_clk)); in _enable_optional_clocks()
950 clk_enable(oc->_clk); in _enable_optional_clocks()
959 pr_debug("omap_hwmod: %s: disabling optional clocks\n", oh->name); in _disable_optional_clocks()
961 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) in _disable_optional_clocks()
962 if (oc->_clk) { in _disable_optional_clocks()
963 pr_debug("omap_hwmod: disable %s:%s\n", oc->role, in _disable_optional_clocks()
964 __clk_get_name(oc->_clk)); in _disable_optional_clocks()
965 clk_disable(oc->_clk); in _disable_optional_clocks()
970 * _enable_clocks - enable hwmod main clock and interface clocks
980 pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name); in _enable_clocks()
982 if (oh->flags & HWMOD_OPT_CLKS_NEEDED) in _enable_clocks()
985 if (oh->_clk) in _enable_clocks()
986 clk_enable(oh->_clk); in _enable_clocks()
988 list_for_each_entry(os, &oh->slave_ports, node) { in _enable_clocks()
989 if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) { in _enable_clocks()
990 omap2_clk_deny_idle(os->_clk); in _enable_clocks()
991 clk_enable(os->_clk); in _enable_clocks()
1001 * _omap4_clkctrl_managed_by_clkfwk - true if clkctrl managed by clock framework
1006 if (oh->prcm.omap4.flags & HWMOD_OMAP4_CLKFWK_CLKCTR_CLOCK) in _omap4_clkctrl_managed_by_clkfwk()
1013 * _omap4_has_clkctrl_clock - returns true if a module has clkctrl clock
1018 if (oh->prcm.omap4.clkctrl_offs) in _omap4_has_clkctrl_clock()
1021 if (!oh->prcm.omap4.clkctrl_offs && in _omap4_has_clkctrl_clock()
1022 oh->prcm.omap4.flags & HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET) in _omap4_has_clkctrl_clock()
1029 * _disable_clocks - disable hwmod main clock and interface clocks
1038 pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name); in _disable_clocks()
1040 if (oh->_clk) in _disable_clocks()
1041 clk_disable(oh->_clk); in _disable_clocks()
1043 list_for_each_entry(os, &oh->slave_ports, node) { in _disable_clocks()
1044 if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) { in _disable_clocks()
1045 clk_disable(os->_clk); in _disable_clocks()
1046 omap2_clk_allow_idle(os->_clk); in _disable_clocks()
1050 if (oh->flags & HWMOD_OPT_CLKS_NEEDED) in _disable_clocks()
1059 * _omap4_enable_module - enable CLKCTRL modulemode on OMAP4
1067 if (!oh->clkdm || !oh->prcm.omap4.modulemode || in _omap4_enable_module()
1072 oh->name, __func__, oh->prcm.omap4.modulemode); in _omap4_enable_module()
1074 omap_cm_module_enable(oh->prcm.omap4.modulemode, in _omap4_enable_module()
1075 oh->clkdm->prcm_partition, in _omap4_enable_module()
1076 oh->clkdm->cm_inst, oh->prcm.omap4.clkctrl_offs); in _omap4_enable_module()
1080 * _omap4_wait_target_disable - wait for a module to be disabled on OMAP4
1091 return -EINVAL; in _omap4_wait_target_disable()
1093 if (oh->_int_flags & _HWMOD_NO_MPU_PORT || !oh->clkdm) in _omap4_wait_target_disable()
1096 if (oh->flags & HWMOD_NO_IDLEST) in _omap4_wait_target_disable()
1105 return omap_cm_wait_module_idle(oh->clkdm->prcm_partition, in _omap4_wait_target_disable()
1106 oh->clkdm->cm_inst, in _omap4_wait_target_disable()
1107 oh->prcm.omap4.clkctrl_offs, 0); in _omap4_wait_target_disable()
1111 * _save_mpu_port_index - find and save the index to @oh's MPU port
1126 oh->_int_flags |= _HWMOD_NO_MPU_PORT; in _save_mpu_port_index()
1128 list_for_each_entry(os, &oh->slave_ports, node) { in _save_mpu_port_index()
1129 if (os->user & OCP_USER_MPU) { in _save_mpu_port_index()
1130 oh->_mpu_port = os; in _save_mpu_port_index()
1131 oh->_int_flags &= ~_HWMOD_NO_MPU_PORT; in _save_mpu_port_index()
1140 * _find_mpu_rt_port - return omap_hwmod_ocp_if accessible by the MPU
1154 if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0) in _find_mpu_rt_port()
1157 return oh->_mpu_port; in _find_mpu_rt_port()
1161 * _enable_sysc - try to bring a module out of idle via OCP_SYSCONFIG
1166 * Usually this means placing the module into smart-idle mode and
1167 * smart-standby, but if there is a bug in the automatic idle handling
1168 * for the IP block, it may need to be placed into the force-idle or
1169 * no-idle variants of these modes. No return value.
1178 if (!oh->class->sysc) in _enable_sysc()
1184 * (off-mode for example), and the drivers require the in _enable_sysc()
1187 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) in _enable_sysc()
1190 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) in _enable_sysc()
1193 v = oh->_sysc_cache; in _enable_sysc()
1194 sf = oh->class->sysc->sysc_flags; in _enable_sysc()
1198 if (oh->flags & HWMOD_SWSUP_SIDLE || in _enable_sysc()
1199 oh->flags & HWMOD_SWSUP_SIDLE_ACT) { in _enable_sysc()
1204 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP) in _enable_sysc()
1214 clkdm_act = (clkdm && clkdm->flags & CLKDM_ACTIVE_WITH_MPU); in _enable_sysc()
1215 if (clkdm_act && !(oh->class->sysc->idlemodes & in _enable_sysc()
1223 if (oh->flags & HWMOD_FORCE_MSTANDBY) { in _enable_sysc()
1225 } else if (oh->flags & HWMOD_SWSUP_MSTANDBY) { in _enable_sysc()
1230 if (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP) in _enable_sysc()
1243 if ((oh->flags & HWMOD_SET_DEFAULT_CLOCKACT) && in _enable_sysc()
1254 idlemode = (oh->flags & HWMOD_NO_OCP_AUTOIDLE) ? in _enable_sysc()
1262 * _idle_sysc - try to put a module into idle via OCP_SYSCONFIG
1266 * idle; otherwise, configure it for smart-idle. If module is marked
1267 * as SWSUP_MSUSPEND, force the module into master standby; otherwise,
1268 * configure it for smart-standby. No return value.
1275 if (!oh->class->sysc) in _idle_sysc()
1278 v = oh->_sysc_cache; in _idle_sysc()
1279 sf = oh->class->sysc->sysc_flags; in _idle_sysc()
1282 if (oh->flags & HWMOD_SWSUP_SIDLE) { in _idle_sysc()
1287 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP) in _idle_sysc()
1296 if ((oh->flags & HWMOD_SWSUP_MSTANDBY) || in _idle_sysc()
1297 (oh->flags & HWMOD_FORCE_MSTANDBY)) { in _idle_sysc()
1302 if (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP) in _idle_sysc()
1311 if (oh->_sysc_cache != v) in _idle_sysc()
1316 * _shutdown_sysc - force a module into idle via OCP_SYSCONFIG
1327 if (!oh->class->sysc) in _shutdown_sysc()
1330 v = oh->_sysc_cache; in _shutdown_sysc()
1331 sf = oh->class->sysc->sysc_flags; in _shutdown_sysc()
1346 * _lookup - find an omap_hwmod by name
1358 if (!strcmp(name, temp_oh->name)) { in _lookup()
1368 * _init_clkdm - look up a clockdomain name, store pointer in omap_hwmod
1373 * Return -EINVAL if the clkdm_name lookup failed.
1377 if (!oh->clkdm_name) { in _init_clkdm()
1378 pr_debug("omap_hwmod: %s: missing clockdomain\n", oh->name); in _init_clkdm()
1382 oh->clkdm = clkdm_lookup(oh->clkdm_name); in _init_clkdm()
1383 if (!oh->clkdm) { in _init_clkdm()
1385 oh->name, oh->clkdm_name); in _init_clkdm()
1390 oh->name, oh->clkdm_name); in _init_clkdm()
1396 * _init_clocks - clk_get() all clocks associated with this hwmod. Retrieve as
1409 if (oh->_state != _HWMOD_STATE_REGISTERED) in _init_clocks()
1412 pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name); in _init_clocks()
1422 oh->_state = _HWMOD_STATE_CLKS_INITED; in _init_clocks()
1424 pr_warn("omap_hwmod: %s: cannot _init_clocks\n", oh->name); in _init_clocks()
1430 * _lookup_hardreset - fill register bit info for this hwmod/reset line
1436 * input name. Return -ENOENT if not found.
1443 for (i = 0; i < oh->rst_lines_cnt; i++) { in _lookup_hardreset()
1444 const char *rst_line = oh->rst_lines[i].name; in _lookup_hardreset()
1446 ohri->rst_shift = oh->rst_lines[i].rst_shift; in _lookup_hardreset()
1447 ohri->st_shift = oh->rst_lines[i].st_shift; in _lookup_hardreset()
1449 oh->name, __func__, rst_line, ohri->rst_shift, in _lookup_hardreset()
1450 ohri->st_shift); in _lookup_hardreset()
1456 return -ENOENT; in _lookup_hardreset()
1460 * _assert_hardreset - assert the HW reset line of submodules
1465 * Some IP like dsp, ipu or iva contain processor that require an HW
1467 * Returns -EINVAL if @oh is null, -ENOSYS if we have no way of
1468 * asserting the hardreset line on the currently-booted SoC, or passes
1475 int ret = -EINVAL; in _assert_hardreset()
1478 return -EINVAL; in _assert_hardreset()
1481 return -ENOSYS; in _assert_hardreset()
1493 * _deassert_hardreset - deassert the HW reset line of submodules contained
1498 * Some IP like dsp, ipu or iva contain processor that require an HW
1500 * Returns -EINVAL if @oh is null, -ENOSYS if we have no way of
1501 * deasserting the hardreset line on the currently-booted SoC, or passes
1508 int ret = -EINVAL; in _deassert_hardreset()
1511 return -EINVAL; in _deassert_hardreset()
1514 return -ENOSYS; in _deassert_hardreset()
1520 if (oh->clkdm) { in _deassert_hardreset()
1526 clkdm_deny_idle(oh->clkdm); in _deassert_hardreset()
1527 ret = clkdm_hwmod_enable(oh->clkdm, oh); in _deassert_hardreset()
1530 oh->name, oh->clkdm->name, ret); in _deassert_hardreset()
1545 if (ret == -EBUSY) in _deassert_hardreset()
1546 pr_warn("omap_hwmod: %s: failed to hardreset\n", oh->name); in _deassert_hardreset()
1548 if (oh->clkdm) { in _deassert_hardreset()
1553 clkdm_allow_idle(oh->clkdm); in _deassert_hardreset()
1555 clkdm_hwmod_disable(oh->clkdm, oh); in _deassert_hardreset()
1562 * _read_hardreset - read the HW reset line state of submodules
1567 * Return the state of the reset line. Returns -EINVAL if @oh is
1568 * null, -ENOSYS if we have no way of reading the hardreset line
1569 * status on the currently-booted SoC, or passes along the return
1576 int ret = -EINVAL; in _read_hardreset()
1579 return -EINVAL; in _read_hardreset()
1582 return -ENOSYS; in _read_hardreset()
1592 * _are_all_hardreset_lines_asserted - return true if the @oh is hard-reset
1605 if (oh->rst_lines_cnt == 0) in _are_all_hardreset_lines_asserted()
1608 for (i = 0; i < oh->rst_lines_cnt; i++) in _are_all_hardreset_lines_asserted()
1609 if (_read_hardreset(oh, oh->rst_lines[i].name) > 0) in _are_all_hardreset_lines_asserted()
1612 if (oh->rst_lines_cnt == rst_cnt) in _are_all_hardreset_lines_asserted()
1619 * _are_any_hardreset_lines_asserted - return true if any part of @oh is
1620 * hard-reset
1634 for (i = 0; i < oh->rst_lines_cnt && rst_cnt == 0; i++) in _are_any_hardreset_lines_asserted()
1635 if (_read_hardreset(oh, oh->rst_lines[i].name) > 0) in _are_any_hardreset_lines_asserted()
1642 * _omap4_disable_module - enable CLKCTRL modulemode on OMAP4
1652 if (!oh->clkdm || !oh->prcm.omap4.modulemode || in _omap4_disable_module()
1654 return -EINVAL; in _omap4_disable_module()
1663 pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__); in _omap4_disable_module()
1665 omap_cm_module_disable(oh->clkdm->prcm_partition, oh->clkdm->cm_inst, in _omap4_disable_module()
1666 oh->prcm.omap4.clkctrl_offs); in _omap4_disable_module()
1671 oh->name); in _omap4_disable_module()
1677 * _ocp_softreset - reset an omap_hwmod via the OCP_SYSCONFIG bit
1681 * enabled for this to work. Returns -ENOENT if the hwmod cannot be
1682 * reset this way, -EINVAL if the hwmod is in the wrong state,
1683 * -ETIMEDOUT if the module did not reset in time, or 0 upon success.
1698 if (!oh->class->sysc || in _ocp_softreset()
1699 !(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET)) in _ocp_softreset()
1700 return -ENOENT; in _ocp_softreset()
1703 if (oh->_state != _HWMOD_STATE_ENABLED) { in _ocp_softreset()
1705 oh->name); in _ocp_softreset()
1706 return -EINVAL; in _ocp_softreset()
1710 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) in _ocp_softreset()
1713 pr_debug("omap_hwmod: %s: resetting via OCP SOFTRESET\n", oh->name); in _ocp_softreset()
1715 v = oh->_sysc_cache; in _ocp_softreset()
1722 if (oh->class->sysc->srst_udelay) in _ocp_softreset()
1723 udelay(oh->class->sysc->srst_udelay); in _ocp_softreset()
1728 oh->name, MAX_MODULE_SOFTRESET_WAIT); in _ocp_softreset()
1729 ret = -ETIMEDOUT; in _ocp_softreset()
1732 pr_debug("omap_hwmod: %s: softreset in %d usec\n", oh->name, c); in _ocp_softreset()
1747 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) in _ocp_softreset()
1754 * _reset - reset an omap_hwmod
1782 * custom reset function - these must return -EINVAL if the hwmod
1784 * -ETIMEDOUT if the module did not reset in time, or 0 upon success.
1790 pr_debug("omap_hwmod: %s: resetting\n", oh->name); in _reset()
1792 if (oh->class->reset) { in _reset()
1793 r = oh->class->reset(oh); in _reset()
1795 if (oh->rst_lines_cnt > 0) { in _reset()
1796 for (i = 0; i < oh->rst_lines_cnt; i++) in _reset()
1797 _assert_hardreset(oh, oh->rst_lines[i].name); in _reset()
1801 if (r == -ENOENT) in _reset()
1813 if (oh->class->sysc) { in _reset()
1822 * _omap4_update_context_lost - increment hwmod context loss counter if
1827 * our in-memory context loss counter, and clear the RM_*_CONTEXT
1832 if (oh->prcm.omap4.flags & HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT) in _omap4_update_context_lost()
1835 if (!prm_was_any_context_lost_old(oh->clkdm->pwrdm.ptr->prcm_partition, in _omap4_update_context_lost()
1836 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_update_context_lost()
1837 oh->prcm.omap4.context_offs)) in _omap4_update_context_lost()
1840 oh->prcm.omap4.context_lost_counter++; in _omap4_update_context_lost()
1841 prm_clear_context_loss_flags_old(oh->clkdm->pwrdm.ptr->prcm_partition, in _omap4_update_context_lost()
1842 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_update_context_lost()
1843 oh->prcm.omap4.context_offs); in _omap4_update_context_lost()
1847 * _omap4_get_context_lost - get context loss counter for a hwmod
1850 * Returns the in-memory context loss counter for a hwmod.
1854 return oh->prcm.omap4.context_lost_counter; in _omap4_get_context_lost()
1858 * _enable - enable an omap_hwmod
1862 * register target. Returns -EINVAL if the hwmod is in the wrong
1869 pr_debug("omap_hwmod: %s: enabling\n", oh->name); in _enable()
1875 if (oh->_int_flags & _HWMOD_SKIP_ENABLE) { in _enable()
1876 oh->_int_flags &= ~_HWMOD_SKIP_ENABLE; in _enable()
1880 if (oh->_state != _HWMOD_STATE_INITIALIZED && in _enable()
1881 oh->_state != _HWMOD_STATE_IDLE && in _enable()
1882 oh->_state != _HWMOD_STATE_DISABLED) { in _enable()
1884 oh->name); in _enable()
1885 return -EINVAL; in _enable()
1902 if (oh->clkdm) { in _enable()
1908 clkdm_deny_idle(oh->clkdm); in _enable()
1909 r = clkdm_hwmod_enable(oh->clkdm, oh); in _enable()
1912 oh->name, oh->clkdm->name, r); in _enable()
1920 if (oh->flags & HWMOD_BLOCK_WFI) in _enable()
1927 -EINVAL; in _enable()
1928 if (oh->clkdm && !(oh->flags & HWMOD_CLKDM_NOAUTO)) in _enable()
1929 clkdm_allow_idle(oh->clkdm); in _enable()
1932 oh->_state = _HWMOD_STATE_ENABLED; in _enable()
1935 if (oh->class->sysc) { in _enable()
1936 if (!(oh->_int_flags & _HWMOD_SYSCONFIG_LOADED)) in _enable()
1945 oh->name, r); in _enable()
1947 if (oh->clkdm) in _enable()
1948 clkdm_hwmod_disable(oh->clkdm, oh); in _enable()
1955 * _idle - idle an omap_hwmod
1959 * no further work. Returns -EINVAL if the hwmod is in the wrong
1964 if (oh->flags & HWMOD_NO_IDLE) { in _idle()
1965 oh->_int_flags |= _HWMOD_SKIP_ENABLE; in _idle()
1969 pr_debug("omap_hwmod: %s: idling\n", oh->name); in _idle()
1974 if (oh->_state != _HWMOD_STATE_ENABLED) { in _idle()
1976 oh->name); in _idle()
1977 return -EINVAL; in _idle()
1980 if (oh->class->sysc) in _idle()
1989 if (oh->clkdm && !(oh->flags & HWMOD_CLKDM_NOAUTO)) in _idle()
1990 clkdm_deny_idle(oh->clkdm); in _idle()
1992 if (oh->flags & HWMOD_BLOCK_WFI) in _idle()
2004 if (oh->clkdm) { in _idle()
2005 clkdm_allow_idle(oh->clkdm); in _idle()
2006 clkdm_hwmod_disable(oh->clkdm, oh); in _idle()
2009 oh->_state = _HWMOD_STATE_IDLE; in _idle()
2015 * _shutdown - shutdown an omap_hwmod
2020 * used by the system. Returns -EINVAL if the hwmod is in the wrong
2031 if (oh->_state != _HWMOD_STATE_IDLE && in _shutdown()
2032 oh->_state != _HWMOD_STATE_ENABLED) { in _shutdown()
2034 oh->name); in _shutdown()
2035 return -EINVAL; in _shutdown()
2038 pr_debug("omap_hwmod: %s: disabling\n", oh->name); in _shutdown()
2040 if (oh->class->pre_shutdown) { in _shutdown()
2041 prev_state = oh->_state; in _shutdown()
2042 if (oh->_state == _HWMOD_STATE_IDLE) in _shutdown()
2044 ret = oh->class->pre_shutdown(oh); in _shutdown()
2052 if (oh->class->sysc) { in _shutdown()
2053 if (oh->_state == _HWMOD_STATE_IDLE) in _shutdown()
2059 if (oh->_state == _HWMOD_STATE_ENABLED) { in _shutdown()
2061 /* XXX what about the other system initiators here? dma, dsp */ in _shutdown()
2062 if (oh->flags & HWMOD_BLOCK_WFI) in _shutdown()
2067 if (oh->clkdm) in _shutdown()
2068 clkdm_hwmod_disable(oh->clkdm, oh); in _shutdown()
2070 /* XXX Should this code also force-disable the optional clocks? */ in _shutdown()
2072 for (i = 0; i < oh->rst_lines_cnt; i++) in _shutdown()
2073 _assert_hardreset(oh, oh->rst_lines[i].name); in _shutdown()
2075 oh->_state = _HWMOD_STATE_DISABLED; in _shutdown()
2088 return -ENODEV; in of_dev_find_hwmod()
2095 if (!strcmp(p, oh->name)) { in of_dev_find_hwmod()
2097 np, i, oh->name); in of_dev_find_hwmod()
2102 return -ENODEV; in of_dev_find_hwmod()
2106 * of_dev_hwmod_lookup - look up needed hwmod from dt blob
2114 * Return: Returns 0 on success, -ENODEV when not found.
2146 return -ENODEV; in of_dev_hwmod_lookup()
2150 * omap_hwmod_fix_mpu_rt_idx - fix up mpu_rt_idx register offsets
2174 error = of_address_to_resource(child, oh->mpu_rt_idx, res); in omap_hwmod_fix_mpu_rt_idx()
2181 * omap_hwmod_parse_module_range - map module IO range from device tree
2203 return -EINVAL; in omap_hwmod_parse_module_range()
2207 return -ENOENT; in omap_hwmod_parse_module_range()
2212 return -EINVAL; in omap_hwmod_parse_module_range()
2215 if (!strncmp("ti,sysc-", name, 8)) in omap_hwmod_parse_module_range()
2219 return -ENOENT; in omap_hwmod_parse_module_range()
2221 error = of_property_read_u32(np, "#address-cells", &nr_addr); in omap_hwmod_parse_module_range()
2223 return -ENOENT; in omap_hwmod_parse_module_range()
2225 error = of_property_read_u32(np, "#size-cells", &nr_size); in omap_hwmod_parse_module_range()
2227 return -ENOENT; in omap_hwmod_parse_module_range()
2230 pr_err("%s: invalid range for %s->%pOFn\n", __func__, in omap_hwmod_parse_module_range()
2231 oh->name, np); in omap_hwmod_parse_module_range()
2232 return -EINVAL; in omap_hwmod_parse_module_range()
2240 oh->name, np, base, size); in omap_hwmod_parse_module_range()
2242 if (oh && oh->mpu_rt_idx) { in omap_hwmod_parse_module_range()
2248 res->start = base; in omap_hwmod_parse_module_range()
2249 res->end = base + size - 1; in omap_hwmod_parse_module_range()
2250 res->flags = IORESOURCE_MEM; in omap_hwmod_parse_module_range()
2256 * _init_mpu_rt_base - populate the virtual address for a hwmod
2267 * and non-availability of MPU access is not treated as an error.
2269 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and
2270 * -ENXIO on absent or invalid register target address space.
2280 return -EINVAL; in _init_mpu_rt_base()
2285 if (!oh->class->sysc) in _init_mpu_rt_base()
2289 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) in _init_mpu_rt_base()
2290 return -ENXIO; in _init_mpu_rt_base()
2293 pr_err("omap_hwmod: %s: no dt node\n", oh->name); in _init_mpu_rt_base()
2294 return -ENXIO; in _init_mpu_rt_base()
2304 va_start = of_iomap(np, index + oh->mpu_rt_idx); in _init_mpu_rt_base()
2307 oh->name, index, np); in _init_mpu_rt_base()
2308 return -ENXIO; in _init_mpu_rt_base()
2312 oh->name, va_start); in _init_mpu_rt_base()
2314 oh->_mpu_rt_va = va_start; in _init_mpu_rt_base()
2321 if (of_find_property(np, "ti,no-reset-on-init", NULL)) in parse_module_flags()
2322 oh->flags |= HWMOD_INIT_NO_RESET; in parse_module_flags()
2323 if (of_find_property(np, "ti,no-idle-on-init", NULL)) in parse_module_flags()
2324 oh->flags |= HWMOD_INIT_NO_IDLE; in parse_module_flags()
2325 if (of_find_property(np, "ti,no-idle", NULL)) in parse_module_flags()
2326 oh->flags |= HWMOD_NO_IDLE; in parse_module_flags()
2330 * _init - initialize internal data for the hwmod @oh
2340 * address space is not defined, or -EINVAL upon failure.
2348 if (oh->_state != _HWMOD_STATE_REGISTERED) in _init()
2353 return -ENODEV; in _init()
2357 pr_debug("omap_hwmod: %s missing dt data\n", oh->name); in _init()
2360 oh->name, np); in _init()
2365 oh->name); in _init()
2371 WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); in _init()
2372 return -EINVAL; in _init()
2384 oh->_state = _HWMOD_STATE_INITIALIZED; in _init()
2390 * _setup_iclk_autoidle - configure an IP block's interface clocks
2401 if (oh->_state != _HWMOD_STATE_INITIALIZED) in _setup_iclk_autoidle()
2404 list_for_each_entry(os, &oh->slave_ports, node) { in _setup_iclk_autoidle()
2405 if (!os->_clk) in _setup_iclk_autoidle()
2408 if (os->flags & OCPIF_SWSUP_IDLE) { in _setup_iclk_autoidle()
2416 clk_enable(os->_clk); in _setup_iclk_autoidle()
2424 * _setup_reset - reset an IP block during the setup process
2436 if (oh->_state != _HWMOD_STATE_INITIALIZED) in _setup_reset()
2437 return -EINVAL; in _setup_reset()
2439 if (oh->flags & HWMOD_EXT_OPT_MAIN_CLK) in _setup_reset()
2440 return -EPERM; in _setup_reset()
2442 if (oh->rst_lines_cnt == 0) { in _setup_reset()
2446 oh->name, oh->_state); in _setup_reset()
2447 return -EINVAL; in _setup_reset()
2451 if (!(oh->flags & HWMOD_INIT_NO_RESET)) in _setup_reset()
2458 * _setup_postsetup - transition to the appropriate state after _setup
2461 * Place an IP block represented by @oh into a "post-setup" state --
2462 * either IDLE, ENABLED, or DISABLED. ("post-setup" simply means that
2469 * The IP block stays in this state until a PM runtime-based driver is
2470 * loaded for that IP block. A post-setup state of IDLE is
2471 * appropriate for almost all IP blocks with runtime PM-enabled
2473 * post-setup state of ENABLED is appropriate for kernels with PM
2479 * This post-setup mechanism is deprecated. Once all of the OMAP
2497 if (oh->rst_lines_cnt > 0) in _setup_postsetup()
2500 postsetup_state = oh->_postsetup_state; in _setup_postsetup()
2505 * XXX HWMOD_INIT_NO_IDLE does not belong in hwmod data - in _setup_postsetup()
2508 if ((oh->flags & (HWMOD_INIT_NO_IDLE | HWMOD_NO_IDLE)) && in _setup_postsetup()
2510 oh->_int_flags |= _HWMOD_SKIP_ENABLE; in _setup_postsetup()
2520 oh->name, postsetup_state); in _setup_postsetup()
2526 * _setup - prepare IP block hardware for use
2532 * post-setup state, depending on the type of IP block and applicable
2543 if (oh->_state != _HWMOD_STATE_INITIALIZED) in _setup()
2546 if (oh->parent_hwmod) { in _setup()
2549 r = _enable(oh->parent_hwmod); in _setup()
2551 oh->name, oh->parent_hwmod->name); in _setup()
2559 if (oh->parent_hwmod) { in _setup()
2562 postsetup_state = oh->parent_hwmod->_postsetup_state; in _setup()
2565 _idle(oh->parent_hwmod); in _setup()
2567 _shutdown(oh->parent_hwmod); in _setup()
2570 oh->parent_hwmod->name, postsetup_state); in _setup()
2577 * _register - register a struct omap_hwmod
2580 * Registers the omap_hwmod @oh. Returns -EEXIST if an omap_hwmod
2581 * already has been registered by the same name; -EINVAL if the
2589 * unneeded omap_hwmods to be freed on multi-OMAP configurations. Note
2595 if (!oh || !oh->name || !oh->class || !oh->class->name || in _register()
2596 (oh->_state != _HWMOD_STATE_UNKNOWN)) in _register()
2597 return -EINVAL; in _register()
2599 pr_debug("omap_hwmod: %s: registering\n", oh->name); in _register()
2601 if (_lookup(oh->name)) in _register()
2602 return -EEXIST; in _register()
2604 list_add_tail(&oh->node, &omap_hwmod_list); in _register()
2606 INIT_LIST_HEAD(&oh->slave_ports); in _register()
2607 spin_lock_init(&oh->_lock); in _register()
2608 lockdep_set_class(&oh->_lock, &oh->hwmod_key); in _register()
2610 oh->_state = _HWMOD_STATE_REGISTERED; in _register()
2616 if (!strcmp(oh->name, MPU_INITIATOR_NAME)) in _register()
2623 * _add_link - add an interconnect between two IP blocks
2627 * specified in @oi->slave to @oi. This code is assumed to run before
2634 pr_debug("omap_hwmod: %s -> %s: adding link\n", oi->master->name, in _add_link()
2635 oi->slave->name); in _add_link()
2637 list_add(&oi->node, &oi->slave->slave_ports); in _add_link()
2638 oi->slave->slaves_cnt++; in _add_link()
2644 * _register_link - register a struct omap_hwmod_ocp_if
2647 * Registers the omap_hwmod_ocp_if record @oi. Returns -EEXIST if it
2648 * has already been registered; -EINVAL if @oi is NULL or if the
2654 * unneeded omap_hwmods to be freed on multi-OMAP configurations.
2658 if (!oi || !oi->master || !oi->slave || !oi->user) in _register_link()
2659 return -EINVAL; in _register_link()
2661 if (oi->_int_flags & _OCPIF_INT_FLAGS_REGISTERED) in _register_link()
2662 return -EEXIST; in _register_link()
2665 oi->master->name, oi->slave->name); in _register_link()
2671 if (oi->master->_state != _HWMOD_STATE_REGISTERED) in _register_link()
2672 _register(oi->master); in _register_link()
2674 if (oi->slave->_state != _HWMOD_STATE_REGISTERED) in _register_link()
2675 _register(oi->slave); in _register_link()
2679 oi->_int_flags |= _OCPIF_INT_FLAGS_REGISTERED; in _register_link()
2687 * _omap2xxx_3xxx_wait_target_ready - wait for a module to leave slave idle
2698 return -EINVAL; in _omap2xxx_3xxx_wait_target_ready()
2700 if (oh->flags & HWMOD_NO_IDLEST) in _omap2xxx_3xxx_wait_target_ready()
2708 return omap_cm_wait_module_ready(0, oh->prcm.omap2.module_offs, in _omap2xxx_3xxx_wait_target_ready()
2709 oh->prcm.omap2.idlest_reg_id, in _omap2xxx_3xxx_wait_target_ready()
2710 oh->prcm.omap2.idlest_idle_bit); in _omap2xxx_3xxx_wait_target_ready()
2714 * _omap4_wait_target_ready - wait for a module to leave slave idle
2725 return -EINVAL; in _omap4_wait_target_ready()
2727 if (oh->flags & HWMOD_NO_IDLEST || !oh->clkdm) in _omap4_wait_target_ready()
2741 return omap_cm_wait_module_ready(oh->clkdm->prcm_partition, in _omap4_wait_target_ready()
2742 oh->clkdm->cm_inst, in _omap4_wait_target_ready()
2743 oh->prcm.omap4.clkctrl_offs, 0); in _omap4_wait_target_ready()
2747 * _omap2_assert_hardreset - call OMAP2 PRM hardreset fn with hwmod args
2760 return omap_prm_assert_hardreset(ohri->rst_shift, 0, in _omap2_assert_hardreset()
2761 oh->prcm.omap2.module_offs, 0); in _omap2_assert_hardreset()
2765 * _omap2_deassert_hardreset - call OMAP2 PRM hardreset fn with hwmod args
2778 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, 0, in _omap2_deassert_hardreset()
2779 oh->prcm.omap2.module_offs, 0, 0); in _omap2_deassert_hardreset()
2783 * _omap2_is_hardreset_asserted - call OMAP2 PRM hardreset fn with hwmod args
2797 return omap_prm_is_hardreset_asserted(ohri->st_shift, 0, in _omap2_is_hardreset_asserted()
2798 oh->prcm.omap2.module_offs, 0); in _omap2_is_hardreset_asserted()
2802 * _omap4_assert_hardreset - call OMAP4 PRM hardreset fn with hwmod args
2816 if (!oh->clkdm) in _omap4_assert_hardreset()
2817 return -EINVAL; in _omap4_assert_hardreset()
2819 return omap_prm_assert_hardreset(ohri->rst_shift, in _omap4_assert_hardreset()
2820 oh->clkdm->pwrdm.ptr->prcm_partition, in _omap4_assert_hardreset()
2821 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_assert_hardreset()
2822 oh->prcm.omap4.rstctrl_offs); in _omap4_assert_hardreset()
2826 * _omap4_deassert_hardreset - call OMAP4 PRM hardreset fn with hwmod args
2840 if (!oh->clkdm) in _omap4_deassert_hardreset()
2841 return -EINVAL; in _omap4_deassert_hardreset()
2843 if (ohri->st_shift) in _omap4_deassert_hardreset()
2845 oh->name, ohri->name); in _omap4_deassert_hardreset()
2846 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->rst_shift, in _omap4_deassert_hardreset()
2847 oh->clkdm->pwrdm.ptr->prcm_partition, in _omap4_deassert_hardreset()
2848 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_deassert_hardreset()
2849 oh->prcm.omap4.rstctrl_offs, in _omap4_deassert_hardreset()
2850 oh->prcm.omap4.rstctrl_offs + in _omap4_deassert_hardreset()
2855 * _omap4_is_hardreset_asserted - call OMAP4 PRM hardreset fn with hwmod args
2869 if (!oh->clkdm) in _omap4_is_hardreset_asserted()
2870 return -EINVAL; in _omap4_is_hardreset_asserted()
2872 return omap_prm_is_hardreset_asserted(ohri->rst_shift, in _omap4_is_hardreset_asserted()
2873 oh->clkdm->pwrdm.ptr-> in _omap4_is_hardreset_asserted()
2875 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_is_hardreset_asserted()
2876 oh->prcm.omap4.rstctrl_offs); in _omap4_is_hardreset_asserted()
2880 * _omap4_disable_direct_prcm - disable direct PRCM control for hwmod
2890 return -EINVAL; in _omap4_disable_direct_prcm()
2892 oh->prcm.omap4.flags |= HWMOD_OMAP4_CLKFWK_CLKCTR_CLOCK; in _omap4_disable_direct_prcm()
2898 * _am33xx_deassert_hardreset - call AM33XX PRM hardreset fn with hwmod args
2912 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, in _am33xx_deassert_hardreset()
2913 oh->clkdm->pwrdm.ptr->prcm_partition, in _am33xx_deassert_hardreset()
2914 oh->clkdm->pwrdm.ptr->prcm_offs, in _am33xx_deassert_hardreset()
2915 oh->prcm.omap4.rstctrl_offs, in _am33xx_deassert_hardreset()
2916 oh->prcm.omap4.rstst_offs); in _am33xx_deassert_hardreset()
2923 if (oh->flags & HWMOD_16BIT_REG) in omap_hwmod_read()
2924 return readw_relaxed(oh->_mpu_rt_va + reg_offs); in omap_hwmod_read()
2926 return readl_relaxed(oh->_mpu_rt_va + reg_offs); in omap_hwmod_read()
2931 if (oh->flags & HWMOD_16BIT_REG) in omap_hwmod_write()
2932 writew_relaxed(v, oh->_mpu_rt_va + reg_offs); in omap_hwmod_write()
2934 writel_relaxed(v, oh->_mpu_rt_va + reg_offs); in omap_hwmod_write()
2938 * omap_hwmod_softreset - reset a module via SYSCONFIG.SOFTRESET bit
2951 if (!oh || !(oh->_sysc_cache)) in omap_hwmod_softreset()
2952 return -EINVAL; in omap_hwmod_softreset()
2954 v = oh->_sysc_cache; in omap_hwmod_softreset()
2970 * omap_hwmod_lookup - look up a registered omap_hwmod by name
2989 * omap_hwmod_for_each - call function for each registered omap_hwmod
2995 * failure. If @fn returns non-zero, the iteration across omap_hwmods
2996 * will stop and the non-zero return value will be passed to the
3007 return -EINVAL; in omap_hwmod_for_each()
3019 * omap_hwmod_register_links - register an array of hwmod links
3024 * listed in @ois that are valid for this chip. Returns -EINVAL if
3026 * -ENOMEM if the link memory area can't be allocated, or 0 upon
3034 return -EINVAL; in omap_hwmod_register_links()
3045 WARN(r && r != -EEXIST, in omap_hwmod_register_links()
3046 "omap_hwmod: _register_link(%s -> %s) returned %d\n", in omap_hwmod_register_links()
3047 ois[i]->master->name, ois[i]->slave->name, r); in omap_hwmod_register_links()
3054 * _ensure_mpu_hwmod_is_setup - ensure the MPU SS hwmod is init'ed and set up
3065 if (!mpu_oh || mpu_oh->_state == _HWMOD_STATE_UNKNOWN) in _ensure_mpu_hwmod_is_setup()
3068 else if (mpu_oh->_state == _HWMOD_STATE_REGISTERED && oh != mpu_oh) in _ensure_mpu_hwmod_is_setup()
3073 * omap_hwmod_setup_one - set up a single hwmod
3074 * @oh_name: const char * name of the already-registered hwmod to set up
3081 * -EINVAL upon error or 0 upon success.
3092 return -EINVAL; in omap_hwmod_setup_one()
3114 * omap_hwmod_check_sysc - check sysc against platform sysc
3123 const struct sysc_regbits *regbits = data->cap->regbits; in omap_hwmod_check_sysc()
3126 regbits->dmadisable_shift, in omap_hwmod_check_sysc()
3127 sysc_fields->dmadisable_shift); in omap_hwmod_check_sysc()
3129 regbits->midle_shift, in omap_hwmod_check_sysc()
3130 sysc_fields->midle_shift); in omap_hwmod_check_sysc()
3132 regbits->sidle_shift, in omap_hwmod_check_sysc()
3133 sysc_fields->sidle_shift); in omap_hwmod_check_sysc()
3135 regbits->clkact_shift, in omap_hwmod_check_sysc()
3136 sysc_fields->clkact_shift); in omap_hwmod_check_sysc()
3138 regbits->enwkup_shift, in omap_hwmod_check_sysc()
3139 sysc_fields->enwkup_shift); in omap_hwmod_check_sysc()
3141 regbits->srst_shift, in omap_hwmod_check_sysc()
3142 sysc_fields->srst_shift); in omap_hwmod_check_sysc()
3144 regbits->autoidle_shift, in omap_hwmod_check_sysc()
3145 sysc_fields->autoidle_shift); in omap_hwmod_check_sysc()
3151 * omap_hwmod_init_regbits - init sysconfig specific register bits
3161 switch (data->cap->type) { in omap_hwmod_init_regbits()
3196 if (!oh->class->sysc->sysc_fields) in omap_hwmod_init_regbits()
3201 return -EINVAL; in omap_hwmod_init_regbits()
3208 * omap_hwmod_init_reg_offs - initialize sysconfig register offsets
3220 *rev_offs = -ENODEV; in omap_hwmod_init_reg_offs()
3224 if (data->offsets[SYSC_REVISION] >= 0) in omap_hwmod_init_reg_offs()
3225 *rev_offs = data->offsets[SYSC_REVISION]; in omap_hwmod_init_reg_offs()
3227 if (data->offsets[SYSC_SYSCONFIG] >= 0) in omap_hwmod_init_reg_offs()
3228 *sysc_offs = data->offsets[SYSC_SYSCONFIG]; in omap_hwmod_init_reg_offs()
3230 if (data->offsets[SYSC_SYSSTATUS] >= 0) in omap_hwmod_init_reg_offs()
3231 *syss_offs = data->offsets[SYSC_SYSSTATUS]; in omap_hwmod_init_reg_offs()
3237 * omap_hwmod_init_sysc_flags - initialize sysconfig features
3248 switch (data->cap->type) { in omap_hwmod_init_sysc_flags()
3251 /* See SYSC_OMAP2_* in include/dt-bindings/bus/ti-sysc.h */ in omap_hwmod_init_sysc_flags()
3252 if (data->cfg->sysc_val & SYSC_OMAP2_CLOCKACTIVITY) in omap_hwmod_init_sysc_flags()
3254 if (data->cfg->sysc_val & SYSC_OMAP2_EMUFREE) in omap_hwmod_init_sysc_flags()
3256 if (data->cfg->sysc_val & SYSC_OMAP2_ENAWAKEUP) in omap_hwmod_init_sysc_flags()
3258 if (data->cfg->sysc_val & SYSC_OMAP2_SOFTRESET) in omap_hwmod_init_sysc_flags()
3260 if (data->cfg->sysc_val & SYSC_OMAP2_AUTOIDLE) in omap_hwmod_init_sysc_flags()
3265 /* See SYSC_OMAP4_* in include/dt-bindings/bus/ti-sysc.h */ in omap_hwmod_init_sysc_flags()
3266 if (data->cfg->sysc_val & SYSC_OMAP4_DMADISABLE) in omap_hwmod_init_sysc_flags()
3268 if (data->cfg->sysc_val & SYSC_OMAP4_FREEEMU) in omap_hwmod_init_sysc_flags()
3270 if (data->cfg->sysc_val & SYSC_OMAP4_SOFTRESET) in omap_hwmod_init_sysc_flags()
3275 /* See SYSC_OMAP3_SR_* in include/dt-bindings/bus/ti-sysc.h */ in omap_hwmod_init_sysc_flags()
3276 if (data->cfg->sysc_val & SYSC_OMAP3_SR_ENAWAKEUP) in omap_hwmod_init_sysc_flags()
3280 if (data->cap->regbits->emufree_shift >= 0) in omap_hwmod_init_sysc_flags()
3282 if (data->cap->regbits->enwkup_shift >= 0) in omap_hwmod_init_sysc_flags()
3284 if (data->cap->regbits->srst_shift >= 0) in omap_hwmod_init_sysc_flags()
3286 if (data->cap->regbits->autoidle_shift >= 0) in omap_hwmod_init_sysc_flags()
3291 if (data->cap->regbits->midle_shift >= 0 && in omap_hwmod_init_sysc_flags()
3292 data->cfg->midlemodes) in omap_hwmod_init_sysc_flags()
3295 if (data->cap->regbits->sidle_shift >= 0 && in omap_hwmod_init_sysc_flags()
3296 data->cfg->sidlemodes) in omap_hwmod_init_sysc_flags()
3299 if (data->cfg->quirks & SYSC_QUIRK_UNCACHED) in omap_hwmod_init_sysc_flags()
3301 if (data->cfg->quirks & SYSC_QUIRK_RESET_STATUS) in omap_hwmod_init_sysc_flags()
3304 if (data->cfg->syss_mask & 1) in omap_hwmod_init_sysc_flags()
3311 * omap_hwmod_init_idlemodes - initialize module idle modes
3322 if (data->cfg->midlemodes & BIT(SYSC_IDLE_FORCE)) in omap_hwmod_init_idlemodes()
3324 if (data->cfg->midlemodes & BIT(SYSC_IDLE_NO)) in omap_hwmod_init_idlemodes()
3326 if (data->cfg->midlemodes & BIT(SYSC_IDLE_SMART)) in omap_hwmod_init_idlemodes()
3328 if (data->cfg->midlemodes & BIT(SYSC_IDLE_SMART_WKUP)) in omap_hwmod_init_idlemodes()
3331 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_FORCE)) in omap_hwmod_init_idlemodes()
3333 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_NO)) in omap_hwmod_init_idlemodes()
3335 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_SMART)) in omap_hwmod_init_idlemodes()
3337 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_SMART_WKUP)) in omap_hwmod_init_idlemodes()
3344 * omap_hwmod_check_module - check new module against platform data
3363 if (!oh->class->sysc) in omap_hwmod_check_module()
3364 return -ENODEV; in omap_hwmod_check_module()
3366 if (oh->class->sysc->sysc_fields && in omap_hwmod_check_module()
3367 sysc_fields != oh->class->sysc->sysc_fields) in omap_hwmod_check_module()
3370 if (rev_offs != oh->class->sysc->rev_offs) in omap_hwmod_check_module()
3372 oh->class->sysc->rev_offs); in omap_hwmod_check_module()
3373 if (sysc_offs != oh->class->sysc->sysc_offs) in omap_hwmod_check_module()
3375 oh->class->sysc->sysc_offs); in omap_hwmod_check_module()
3376 if (syss_offs != oh->class->sysc->syss_offs) in omap_hwmod_check_module()
3378 oh->class->sysc->syss_offs); in omap_hwmod_check_module()
3380 if (sysc_flags != oh->class->sysc->sysc_flags) in omap_hwmod_check_module()
3382 oh->class->sysc->sysc_flags); in omap_hwmod_check_module()
3384 if (idlemodes != oh->class->sysc->idlemodes) in omap_hwmod_check_module()
3386 oh->class->sysc->idlemodes); in omap_hwmod_check_module()
3388 if (data->cfg->srst_udelay != oh->class->sysc->srst_udelay) in omap_hwmod_check_module()
3390 data->cfg->srst_udelay, in omap_hwmod_check_module()
3391 oh->class->sysc->srst_udelay); in omap_hwmod_check_module()
3397 * omap_hwmod_allocate_module - allocate new module
3408 * Note that the allocations here cannot use devm as ti-sysc can rebind.
3426 return -ENOMEM; in omap_hwmod_allocate_module()
3428 sysc->sysc_fields = sysc_fields; in omap_hwmod_allocate_module()
3429 sysc->rev_offs = rev_offs; in omap_hwmod_allocate_module()
3430 sysc->sysc_offs = sysc_offs; in omap_hwmod_allocate_module()
3431 sysc->syss_offs = syss_offs; in omap_hwmod_allocate_module()
3432 sysc->sysc_flags = sysc_flags; in omap_hwmod_allocate_module()
3433 sysc->idlemodes = idlemodes; in omap_hwmod_allocate_module()
3434 sysc->srst_udelay = data->cfg->srst_udelay; in omap_hwmod_allocate_module()
3436 if (!oh->_mpu_rt_va) { in omap_hwmod_allocate_module()
3437 regs = ioremap(data->module_pa, in omap_hwmod_allocate_module()
3438 data->module_size); in omap_hwmod_allocate_module()
3444 * We may need a new oh->class as the other devices in the same class in omap_hwmod_allocate_module()
3447 if (oh->class->name && strcmp(oh->class->name, data->name)) { in omap_hwmod_allocate_module()
3448 class = kmemdup(oh->class, sizeof(*oh->class), GFP_KERNEL); in omap_hwmod_allocate_module()
3453 if (list_empty(&oh->slave_ports)) { in omap_hwmod_allocate_module()
3463 oi->slave = oh; in omap_hwmod_allocate_module()
3464 oi->user = OCP_USER_MPU | OCP_USER_SDMA; in omap_hwmod_allocate_module()
3467 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_allocate_module()
3469 oh->_mpu_rt_va = regs; in omap_hwmod_allocate_module()
3471 oh->class = class; in omap_hwmod_allocate_module()
3472 oh->class->sysc = sysc; in omap_hwmod_allocate_module()
3476 oh->clkdm = clkdm; in omap_hwmod_allocate_module()
3477 oh->_state = _HWMOD_STATE_INITIALIZED; in omap_hwmod_allocate_module()
3478 oh->_postsetup_state = _HWMOD_STATE_DEFAULT; in omap_hwmod_allocate_module()
3480 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_allocate_module()
3490 return -ENOMEM; in omap_hwmod_allocate_module()
3519 if (!strncmp(data->name, quirk->match, quirk->len)) { in omap_hwmod_init_reset_quirk()
3520 oh->class->reset = quirk->reset; in omap_hwmod_init_reset_quirk()
3545 * omap_hwmod_init_module - initialize new module
3560 if (!dev || !data || !data->name || !cookie) in omap_hwmod_init_module()
3561 return -EINVAL; in omap_hwmod_init_module()
3563 oh = _lookup(data->name); in omap_hwmod_init_module()
3567 return -ENOMEM; in omap_hwmod_init_module()
3569 oh->name = data->name; in omap_hwmod_init_module()
3570 oh->_state = _HWMOD_STATE_UNKNOWN; in omap_hwmod_init_module()
3571 lockdep_register_key(&oh->hwmod_key); in omap_hwmod_init_module()
3574 oh->prcm.omap4.flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT; in omap_hwmod_init_module()
3576 oh->class = kzalloc(sizeof(*oh->class), GFP_KERNEL); in omap_hwmod_init_module()
3577 if (!oh->class) { in omap_hwmod_init_module()
3579 return -ENOMEM; in omap_hwmod_init_module()
3584 oh->class->name = data->name; in omap_hwmod_init_module()
3590 cookie->data = oh; in omap_hwmod_init_module()
3609 if (data->cfg->quirks & SYSC_QUIRK_NO_IDLE) in omap_hwmod_init_module()
3610 oh->flags |= HWMOD_NO_IDLE; in omap_hwmod_init_module()
3611 if (data->cfg->quirks & SYSC_QUIRK_NO_IDLE_ON_INIT) in omap_hwmod_init_module()
3612 oh->flags |= HWMOD_INIT_NO_IDLE; in omap_hwmod_init_module()
3613 if (data->cfg->quirks & SYSC_QUIRK_NO_RESET_ON_INIT) in omap_hwmod_init_module()
3614 oh->flags |= HWMOD_INIT_NO_RESET; in omap_hwmod_init_module()
3615 if (data->cfg->quirks & SYSC_QUIRK_USE_CLOCKACT) in omap_hwmod_init_module()
3616 oh->flags |= HWMOD_SET_DEFAULT_CLOCKACT; in omap_hwmod_init_module()
3617 if (data->cfg->quirks & SYSC_QUIRK_SWSUP_SIDLE) in omap_hwmod_init_module()
3618 oh->flags |= HWMOD_SWSUP_SIDLE; in omap_hwmod_init_module()
3619 if (data->cfg->quirks & SYSC_QUIRK_SWSUP_SIDLE_ACT) in omap_hwmod_init_module()
3620 oh->flags |= HWMOD_SWSUP_SIDLE_ACT; in omap_hwmod_init_module()
3621 if (data->cfg->quirks & SYSC_QUIRK_SWSUP_MSTANDBY) in omap_hwmod_init_module()
3622 oh->flags |= HWMOD_SWSUP_MSTANDBY; in omap_hwmod_init_module()
3623 if (data->cfg->quirks & SYSC_QUIRK_CLKDM_NOAUTO) in omap_hwmod_init_module()
3624 oh->flags |= HWMOD_CLKDM_NOAUTO; in omap_hwmod_init_module()
3633 cookie->clkdm, rev_offs, in omap_hwmod_init_module()
3639 * omap_hwmod_setup_earlycon_flags - set up flags for early console
3654 uart = of_get_property(np, "stdout-path", NULL); in omap_hwmod_setup_earlycon_flags()
3661 uart = of_get_property(np->parent, in omap_hwmod_setup_earlycon_flags()
3667 oh->flags |= DEBUG_OMAPUART_FLAGS; in omap_hwmod_setup_earlycon_flags()
3675 * omap_hwmod_setup_all - set up all registered IP blocks
3697 * omap_hwmod_enable - enable an omap_hwmod
3701 * Returns -EINVAL on error or passes along the return value from _enable().
3709 return -EINVAL; in omap_hwmod_enable()
3711 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_enable()
3713 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_enable()
3719 * omap_hwmod_idle - idle an omap_hwmod
3723 * Returns -EINVAL on error or passes along the return value from _idle().
3731 return -EINVAL; in omap_hwmod_idle()
3733 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_idle()
3735 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_idle()
3741 * omap_hwmod_shutdown - shutdown an omap_hwmod
3745 * omap_device_shutdown(). Returns -EINVAL on error or passes along
3754 return -EINVAL; in omap_hwmod_shutdown()
3756 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_shutdown()
3758 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_shutdown()
3768 * omap_hwmod_get_pwrdm - return pointer to this module's main powerdomain
3789 if (oh->clkdm) in omap_hwmod_get_pwrdm()
3790 return oh->clkdm->pwrdm.ptr; in omap_hwmod_get_pwrdm()
3792 if (oh->_clk) { in omap_hwmod_get_pwrdm()
3793 c = oh->_clk; in omap_hwmod_get_pwrdm()
3798 c = oi->_clk; in omap_hwmod_get_pwrdm()
3809 clkdm = clk->clkdm; in omap_hwmod_get_pwrdm()
3813 return clkdm->pwrdm.ptr; in omap_hwmod_get_pwrdm()
3817 * omap_hwmod_get_mpu_rt_va - return the module's base address (for the MPU)
3830 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) in omap_hwmod_get_mpu_rt_va()
3833 if (oh->_state == _HWMOD_STATE_UNKNOWN) in omap_hwmod_get_mpu_rt_va()
3836 return oh->_mpu_rt_va; in omap_hwmod_get_mpu_rt_va()
3845 * omap_hwmod_assert_hardreset - assert the HW reset line of submodules
3850 * Some IP like dsp, ipu or iva contain processor that require
3852 * the IP. Returns -EINVAL if @oh is null or if the operation is not
3862 return -EINVAL; in omap_hwmod_assert_hardreset()
3864 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_assert_hardreset()
3866 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_assert_hardreset()
3872 * omap_hwmod_deassert_hardreset - deassert the HW reset line of submodules
3877 * Some IP like dsp, ipu or iva contain processor that require
3879 * the IP. Returns -EINVAL if @oh is null or if the operation is not
3889 return -EINVAL; in omap_hwmod_deassert_hardreset()
3891 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_deassert_hardreset()
3893 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_deassert_hardreset()
3899 * omap_hwmod_for_each_by_class - call @fn for each hwmod of class @classname
3907 * value is passed back to the caller. Returns 0 upon success, -EINVAL
3919 return -EINVAL; in omap_hwmod_for_each_by_class()
3925 if (!strcmp(temp_oh->class->name, classname)) { in omap_hwmod_for_each_by_class()
3927 __func__, temp_oh->name); in omap_hwmod_for_each_by_class()
3942 * omap_hwmod_set_postsetup_state - set the post-_setup() state for this hwmod
3949 * -EINVAL if there is a problem with the arguments or if the hwmod is
3958 return -EINVAL; in omap_hwmod_set_postsetup_state()
3963 return -EINVAL; in omap_hwmod_set_postsetup_state()
3965 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_set_postsetup_state()
3967 if (oh->_state != _HWMOD_STATE_REGISTERED) { in omap_hwmod_set_postsetup_state()
3968 ret = -EINVAL; in omap_hwmod_set_postsetup_state()
3972 oh->_postsetup_state = state; in omap_hwmod_set_postsetup_state()
3976 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_set_postsetup_state()
3982 * omap_hwmod_get_context_loss_count - get lost context count
3988 * On OMAP4, this queries the per-hwmod context loss register,
4008 * omap_hwmod_init - initialize the hwmod code
4011 * currently-booted SoC. Intended to be called once during kernel init
4060 * omap_hwmod_get_main_clk - get pointer to main clock name
4071 return oh->main_clk; in omap_hwmod_get_main_clk()