Lines Matching +full:no +full:- +full:idle +full:- +full:on +full:- +full:init
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2009-2011 Nokia Corporation
6 * Copyright (C) 2011-2012 Texas Instruments, Inc.
15 * ------------
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
28 * interconnects that distribute the hardware clock tree, handle idle
30 * various pads or balls on the OMAP package.
32 * OMAP hwmod provides a consistent way to describe the on-chip
36 * to reset, enable, idle, and disable these hardware blocks. And
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 * ---------------------------
98 * the IDLE state to save power, or in the case of a critical system
102 * directly to move the module between the IDLE, ENABLED, and DISABLED
103 * states, as needed. This is done during both the PM idle loop, and
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)
180 * status registers: 4 bytes on OMAP4
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
293 * one. No return value.
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()
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()
362 * Update the slave idle mode bits in @v to be @idlemode for the @oh
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()
396 * @oh hwmod. Used for additional powersaving on some modules. Does
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
483 * @oh: struct omap_hwmod * to wait on
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()
539 /* clocks must be on for this operation */ 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()
633 if (oh->clkdm) { in _get_clkdm()
634 return oh->clkdm; in _get_clkdm()
635 } else if (oh->_clk) { in _get_clkdm()
636 if (!omap2_clk_is_hw_omap(__clk_get_hw(oh->_clk))) in _get_clkdm()
638 clk = to_clk_hw_omap(__clk_get_hw(oh->_clk)); in _get_clkdm()
639 return clk->clkdm; in _get_clkdm()
645 * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active
648 * Prevent the hardware module @oh from entering idle while the
652 * initiator and the module). Only applies to modules in smart-idle
654 * 0 without doing anything. Otherwise, returns -EINVAL upon error or
665 return -EINVAL; in _add_initiator_dep()
667 if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS) in _add_initiator_dep()
674 * _del_initiator_dep: allow @oh to smart-idle even if @init_oh is active
677 * Allow the hardware module @oh to enter idle while the hardare
680 * be accessed by the IVA, there should be no sleepdep between the IVA
681 * initiator and the module). Only applies to modules in smart-idle
683 * 0 without doing anything. Returns -EINVAL upon error or passes
694 return -EINVAL; in _del_initiator_dep()
696 if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS) in _del_initiator_dep()
714 return -ENOMEM; in _setup_clkctrl_provider()
716 provider->node = np; in _setup_clkctrl_provider()
718 provider->num_addrs = of_address_count(np); 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()
735 provider->addr[i] = res.start; in _setup_clkctrl_provider()
736 provider->size[i] = resource_size(&res); 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 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 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 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
974 * on the hwmod @oh. Returns 0.
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
1063 * No return value.
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
1083 * Wait for a module @oh to enter slave idle. Returns 0 if the module
1085 * slave idle; otherwise, pass along the return value of the
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
1116 * Intended to be called during hwmod registration only. No return
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()
1212 * 32k sync timer. Force them to idle! 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()
1251 * Setting this will not have any impact on the other modules. 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
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
1319 * Force the module into slave idle and master suspend. No return
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
1402 * Resolves all clock names embedded in the hwmod. Returns 0 on
1403 * success, or a negative error code on failure.
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
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
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
1596 * Otherwise, if part of @oh is out hardreset or if no hardreset lines
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
1624 * return true. Otherwise, if no hardreset lines associated with @oh
1625 * are asserted, or if @oh has no hardreset lines, then return false.
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()
1702 /* clocks must be on for this operation */ 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
1771 * therefore have no OCP header registers to access. Others (like the
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
1828 * bits. No return value.
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()
1873 * state at init. 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()
1883 …WARN(1, "omap_hwmod: %s: enabled state can only be entered from initialized, idle, or disabled sta… in _enable()
1884 oh->name); in _enable()
1885 return -EINVAL; in _enable()
1892 * information on what those driver authors need, and until 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()
1975 WARN(1, "omap_hwmod: %s: idle state can only be entered from enabled state\n", in _idle()
1976 oh->name); in _idle()
1977 return -EINVAL; in _idle()
1980 if (oh->class->sysc) in _idle()
1986 * deny idle the clkdm again since idle was already denied 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()
1998 * The module must be in idle mode before disabling any parents 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()
2033 WARN(1, "omap_hwmod: %s: disabled state can only be entered from idle, or enabled state\n", 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()
2058 /* clocks and deps are already disabled in idle */ in _shutdown()
2059 if (oh->_state == _HWMOD_STATE_ENABLED) { 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.
2147 return -ENODEV; in of_dev_hwmod_lookup()
2151 * omap_hwmod_fix_mpu_rt_idx - fix up mpu_rt_idx register offsets
2175 error = of_address_to_resource(child, oh->mpu_rt_idx, res); in omap_hwmod_fix_mpu_rt_idx()
2182 * omap_hwmod_parse_module_range - map module IO range from device tree
2201 if (!strncmp("ti,sysc-", name, 8)) in omap_hwmod_parse_module_range()
2205 return -ENOENT; in omap_hwmod_parse_module_range()
2212 oh->name, np, res); in omap_hwmod_parse_module_range()
2214 if (oh && oh->mpu_rt_idx) { in omap_hwmod_parse_module_range()
2224 * _init_mpu_rt_base - populate the virtual address for a hwmod
2235 * and non-availability of MPU access is not treated as an error.
2237 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and
2238 * -ENXIO on absent or invalid register target address space.
2248 return -EINVAL; in _init_mpu_rt_base()
2253 if (!oh->class->sysc) in _init_mpu_rt_base()
2257 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) in _init_mpu_rt_base()
2258 return -ENXIO; in _init_mpu_rt_base()
2261 pr_err("omap_hwmod: %s: no dt node\n", oh->name); in _init_mpu_rt_base()
2262 return -ENXIO; in _init_mpu_rt_base()
2270 /* No ranges, rely on device reg entry */ in _init_mpu_rt_base()
2272 va_start = of_iomap(np, index + oh->mpu_rt_idx); in _init_mpu_rt_base()
2275 oh->name, index, np); in _init_mpu_rt_base()
2276 return -ENXIO; in _init_mpu_rt_base()
2280 oh->name, va_start); in _init_mpu_rt_base()
2282 oh->_mpu_rt_va = va_start; in _init_mpu_rt_base()
2289 if (of_property_read_bool(np, "ti,no-reset-on-init")) in parse_module_flags()
2290 oh->flags |= HWMOD_INIT_NO_RESET; in parse_module_flags()
2291 if (of_property_read_bool(np, "ti,no-idle-on-init")) in parse_module_flags()
2292 oh->flags |= HWMOD_INIT_NO_IDLE; in parse_module_flags()
2293 if (of_property_read_bool(np, "ti,no-idle")) in parse_module_flags()
2294 oh->flags |= HWMOD_NO_IDLE; in parse_module_flags()
2298 * _init - initialize internal data for the hwmod @oh
2308 * address space is not defined, or -EINVAL upon failure.
2316 if (oh->_state != _HWMOD_STATE_REGISTERED) in _init()
2321 return -ENODEV; in _init()
2325 pr_debug("omap_hwmod: %s missing dt data\n", oh->name); in _init()
2328 oh->name, np); in _init()
2333 oh->name); in _init()
2339 WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); in _init()
2340 return -EINVAL; in _init()
2352 oh->_state = _HWMOD_STATE_INITIALIZED; in _init()
2358 * _setup_iclk_autoidle - configure an IP block's interface clocks
2363 * the clock code. No return value.
2369 if (oh->_state != _HWMOD_STATE_INITIALIZED) in _setup_iclk_autoidle()
2372 list_for_each_entry(os, &oh->slave_ports, node) { in _setup_iclk_autoidle()
2373 if (!os->_clk) in _setup_iclk_autoidle()
2376 if (os->flags & OCPIF_SWSUP_IDLE) { in _setup_iclk_autoidle()
2384 clk_enable(os->_clk); in _setup_iclk_autoidle()
2392 * _setup_reset - reset an IP block during the setup process
2404 if (oh->_state != _HWMOD_STATE_INITIALIZED) in _setup_reset()
2405 return -EINVAL; in _setup_reset()
2407 if (oh->flags & HWMOD_EXT_OPT_MAIN_CLK) in _setup_reset()
2408 return -EPERM; in _setup_reset()
2410 if (oh->rst_lines_cnt == 0) { in _setup_reset()
2414 oh->name, oh->_state); in _setup_reset()
2415 return -EINVAL; in _setup_reset()
2419 if (!(oh->flags & HWMOD_INIT_NO_RESET)) in _setup_reset()
2426 * _setup_postsetup - transition to the appropriate state after _setup
2429 * Place an IP block represented by @oh into a "post-setup" state --
2430 * either IDLE, ENABLED, or DISABLED. ("post-setup" simply means that
2437 * The IP block stays in this state until a PM runtime-based driver is
2438 * loaded for that IP block. A post-setup state of IDLE is
2439 * appropriate for almost all IP blocks with runtime PM-enabled
2441 * post-setup state of ENABLED is appropriate for kernels with PM
2443 * blocks such as the MPU WDTIMER on kernels without WDTIMER drivers
2444 * included, since the WDTIMER starts running on reset and will reset
2447 * This post-setup mechanism is deprecated. Once all of the OMAP
2456 * has no way of knowing which IP blocks are in use by drivers, and
2459 * No return value.
2465 if (oh->rst_lines_cnt > 0) in _setup_postsetup()
2468 postsetup_state = oh->_postsetup_state; in _setup_postsetup()
2473 * XXX HWMOD_INIT_NO_IDLE does not belong in hwmod data - in _setup_postsetup()
2476 if ((oh->flags & (HWMOD_INIT_NO_IDLE | HWMOD_NO_IDLE)) && in _setup_postsetup()
2478 oh->_int_flags |= _HWMOD_SKIP_ENABLE; in _setup_postsetup()
2488 oh->name, postsetup_state); in _setup_postsetup()
2494 * _setup - prepare IP block hardware for use
2500 * post-setup state, depending on the type of IP block and applicable
2511 if (oh->_state != _HWMOD_STATE_INITIALIZED) in _setup()
2514 if (oh->parent_hwmod) { in _setup()
2517 r = _enable(oh->parent_hwmod); in _setup()
2519 oh->name, oh->parent_hwmod->name); in _setup()
2527 if (oh->parent_hwmod) { in _setup()
2530 postsetup_state = oh->parent_hwmod->_postsetup_state; in _setup()
2533 _idle(oh->parent_hwmod); in _setup()
2535 _shutdown(oh->parent_hwmod); in _setup()
2538 oh->parent_hwmod->name, postsetup_state); in _setup()
2545 * _register - register a struct omap_hwmod
2548 * Registers the omap_hwmod @oh. Returns -EEXIST if an omap_hwmod
2549 * already has been registered by the same name; -EINVAL if the
2556 * should be marked __initdata and freed after init. This would allow
2557 * unneeded omap_hwmods to be freed on multi-OMAP configurations. Note
2563 if (!oh || !oh->name || !oh->class || !oh->class->name || in _register()
2564 (oh->_state != _HWMOD_STATE_UNKNOWN)) in _register()
2565 return -EINVAL; in _register()
2567 pr_debug("omap_hwmod: %s: registering\n", oh->name); in _register()
2569 if (_lookup(oh->name)) in _register()
2570 return -EEXIST; in _register()
2572 list_add_tail(&oh->node, &omap_hwmod_list); in _register()
2574 INIT_LIST_HEAD(&oh->slave_ports); in _register()
2575 spin_lock_init(&oh->_lock); in _register()
2576 lockdep_set_class(&oh->_lock, &oh->hwmod_key); in _register()
2578 oh->_state = _HWMOD_STATE_REGISTERED; in _register()
2584 if (!strcmp(oh->name, MPU_INITIATOR_NAME)) in _register()
2591 * _add_link - add an interconnect between two IP blocks
2595 * specified in @oi->slave to @oi. This code is assumed to run before
2602 pr_debug("omap_hwmod: %s -> %s: adding link\n", oi->master->name, in _add_link()
2603 oi->slave->name); in _add_link()
2605 list_add(&oi->node, &oi->slave->slave_ports); in _add_link()
2606 oi->slave->slaves_cnt++; in _add_link()
2612 * _register_link - register a struct omap_hwmod_ocp_if
2615 * Registers the omap_hwmod_ocp_if record @oi. Returns -EEXIST if it
2616 * has already been registered; -EINVAL if @oi is NULL or if the
2621 * should be marked __initdata and freed after init. This would allow
2622 * unneeded omap_hwmods to be freed on multi-OMAP configurations.
2626 if (!oi || !oi->master || !oi->slave || !oi->user) in _register_link()
2627 return -EINVAL; in _register_link()
2629 if (oi->_int_flags & _OCPIF_INT_FLAGS_REGISTERED) in _register_link()
2630 return -EEXIST; in _register_link()
2633 oi->master->name, oi->slave->name); in _register_link()
2639 if (oi->master->_state != _HWMOD_STATE_REGISTERED) in _register_link()
2640 _register(oi->master); in _register_link()
2642 if (oi->slave->_state != _HWMOD_STATE_REGISTERED) in _register_link()
2643 _register(oi->slave); in _register_link()
2647 oi->_int_flags |= _OCPIF_INT_FLAGS_REGISTERED; in _register_link()
2655 * _omap2xxx_3xxx_wait_target_ready - wait for a module to leave slave idle
2658 * Wait for a module @oh to leave slave idle. Returns 0 if the module
2660 * slave idle; otherwise, pass along the return value of the
2666 return -EINVAL; in _omap2xxx_3xxx_wait_target_ready()
2668 if (oh->flags & HWMOD_NO_IDLEST) in _omap2xxx_3xxx_wait_target_ready()
2676 return omap_cm_wait_module_ready(0, oh->prcm.omap2.module_offs, in _omap2xxx_3xxx_wait_target_ready()
2677 oh->prcm.omap2.idlest_reg_id, in _omap2xxx_3xxx_wait_target_ready()
2678 oh->prcm.omap2.idlest_idle_bit); in _omap2xxx_3xxx_wait_target_ready()
2682 * _omap4_wait_target_ready - wait for a module to leave slave idle
2685 * Wait for a module @oh to leave slave idle. Returns 0 if the module
2687 * slave idle; otherwise, pass along the return value of the
2693 return -EINVAL; in _omap4_wait_target_ready()
2695 if (oh->flags & HWMOD_NO_IDLEST || !oh->clkdm) in _omap4_wait_target_ready()
2709 return omap_cm_wait_module_ready(oh->clkdm->prcm_partition, in _omap4_wait_target_ready()
2710 oh->clkdm->cm_inst, in _omap4_wait_target_ready()
2711 oh->prcm.omap4.clkctrl_offs, 0); in _omap4_wait_target_ready()
2715 * _omap2_assert_hardreset - call OMAP2 PRM hardreset fn with hwmod args
2728 return omap_prm_assert_hardreset(ohri->rst_shift, 0, in _omap2_assert_hardreset()
2729 oh->prcm.omap2.module_offs, 0); in _omap2_assert_hardreset()
2733 * _omap2_deassert_hardreset - call OMAP2 PRM hardreset fn with hwmod args
2746 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, 0, in _omap2_deassert_hardreset()
2747 oh->prcm.omap2.module_offs, 0, 0); in _omap2_deassert_hardreset()
2751 * _omap2_is_hardreset_asserted - call OMAP2 PRM hardreset fn with hwmod args
2765 return omap_prm_is_hardreset_asserted(ohri->st_shift, 0, in _omap2_is_hardreset_asserted()
2766 oh->prcm.omap2.module_offs, 0); in _omap2_is_hardreset_asserted()
2770 * _omap4_assert_hardreset - call OMAP4 PRM hardreset fn with hwmod args
2784 if (!oh->clkdm) in _omap4_assert_hardreset()
2785 return -EINVAL; in _omap4_assert_hardreset()
2787 return omap_prm_assert_hardreset(ohri->rst_shift, in _omap4_assert_hardreset()
2788 oh->clkdm->pwrdm.ptr->prcm_partition, in _omap4_assert_hardreset()
2789 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_assert_hardreset()
2790 oh->prcm.omap4.rstctrl_offs); in _omap4_assert_hardreset()
2794 * _omap4_deassert_hardreset - call OMAP4 PRM hardreset fn with hwmod args
2808 if (!oh->clkdm) in _omap4_deassert_hardreset()
2809 return -EINVAL; in _omap4_deassert_hardreset()
2811 if (ohri->st_shift) in _omap4_deassert_hardreset()
2813 oh->name, ohri->name); in _omap4_deassert_hardreset()
2814 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->rst_shift, in _omap4_deassert_hardreset()
2815 oh->clkdm->pwrdm.ptr->prcm_partition, in _omap4_deassert_hardreset()
2816 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_deassert_hardreset()
2817 oh->prcm.omap4.rstctrl_offs, in _omap4_deassert_hardreset()
2818 oh->prcm.omap4.rstctrl_offs + in _omap4_deassert_hardreset()
2823 * _omap4_is_hardreset_asserted - call OMAP4 PRM hardreset fn with hwmod args
2837 if (!oh->clkdm) in _omap4_is_hardreset_asserted()
2838 return -EINVAL; in _omap4_is_hardreset_asserted()
2840 return omap_prm_is_hardreset_asserted(ohri->rst_shift, in _omap4_is_hardreset_asserted()
2841 oh->clkdm->pwrdm.ptr-> in _omap4_is_hardreset_asserted()
2843 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_is_hardreset_asserted()
2844 oh->prcm.omap4.rstctrl_offs); in _omap4_is_hardreset_asserted()
2848 * _omap4_disable_direct_prcm - disable direct PRCM control for hwmod
2858 return -EINVAL; in _omap4_disable_direct_prcm()
2860 oh->prcm.omap4.flags |= HWMOD_OMAP4_CLKFWK_CLKCTR_CLOCK; in _omap4_disable_direct_prcm()
2866 * _am33xx_deassert_hardreset - call AM33XX PRM hardreset fn with hwmod args
2880 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, in _am33xx_deassert_hardreset()
2881 oh->clkdm->pwrdm.ptr->prcm_partition, in _am33xx_deassert_hardreset()
2882 oh->clkdm->pwrdm.ptr->prcm_offs, in _am33xx_deassert_hardreset()
2883 oh->prcm.omap4.rstctrl_offs, in _am33xx_deassert_hardreset()
2884 oh->prcm.omap4.rstst_offs); in _am33xx_deassert_hardreset()
2891 if (oh->flags & HWMOD_16BIT_REG) in omap_hwmod_read()
2892 return readw_relaxed(oh->_mpu_rt_va + reg_offs); in omap_hwmod_read()
2894 return readl_relaxed(oh->_mpu_rt_va + reg_offs); in omap_hwmod_read()
2899 if (oh->flags & HWMOD_16BIT_REG) in omap_hwmod_write()
2900 writew_relaxed(v, oh->_mpu_rt_va + reg_offs); in omap_hwmod_write()
2902 writel_relaxed(v, oh->_mpu_rt_va + reg_offs); in omap_hwmod_write()
2906 * omap_hwmod_softreset - reset a module via SYSCONFIG.SOFTRESET bit
2919 if (!oh || !(oh->_sysc_cache)) in omap_hwmod_softreset()
2920 return -EINVAL; in omap_hwmod_softreset()
2922 v = oh->_sysc_cache; in omap_hwmod_softreset()
2938 * omap_hwmod_lookup - look up a registered omap_hwmod by name
2957 * omap_hwmod_for_each - call function for each registered omap_hwmod
2963 * failure. If @fn returns non-zero, the iteration across omap_hwmods
2964 * will stop and the non-zero return value will be passed to the
2975 return -EINVAL; in omap_hwmod_for_each()
2987 * omap_hwmod_register_links - register an array of hwmod links
2992 * listed in @ois that are valid for this chip. Returns -EINVAL if
2994 * -ENOMEM if the link memory area can't be allocated, or 0 upon
3002 return -EINVAL; in omap_hwmod_register_links()
3013 WARN(r && r != -EEXIST, in omap_hwmod_register_links()
3014 "omap_hwmod: _register_link(%s -> %s) returned %d\n", in omap_hwmod_register_links()
3015 ois[i]->master->name, ois[i]->slave->name, r); in omap_hwmod_register_links()
3024 * _ensure_mpu_hwmod_is_setup - ensure the MPU SS hwmod is init'ed and set up
3030 * to the MPU. Intended to be called only by omap_hwmod_setup*(). No
3035 if (!mpu_oh || mpu_oh->_state == _HWMOD_STATE_UNKNOWN) in _ensure_mpu_hwmod_is_setup()
3038 else if (mpu_oh->_state == _HWMOD_STATE_REGISTERED && oh != mpu_oh) in _ensure_mpu_hwmod_is_setup()
3043 * omap_hwmod_setup_one - set up a single hwmod
3044 * @oh_name: const char * name of the already-registered hwmod to set up
3050 * registered omap_hwmod. Also calls _setup() on each hwmod. Returns
3051 * -EINVAL upon error or 0 upon success.
3062 return -EINVAL; in omap_hwmod_setup_one()
3084 * omap_hwmod_check_sysc - check sysc against platform sysc
3093 const struct sysc_regbits *regbits = data->cap->regbits; in omap_hwmod_check_sysc()
3096 regbits->dmadisable_shift, in omap_hwmod_check_sysc()
3097 sysc_fields->dmadisable_shift); in omap_hwmod_check_sysc()
3099 regbits->midle_shift, in omap_hwmod_check_sysc()
3100 sysc_fields->midle_shift); in omap_hwmod_check_sysc()
3102 regbits->sidle_shift, in omap_hwmod_check_sysc()
3103 sysc_fields->sidle_shift); in omap_hwmod_check_sysc()
3105 regbits->clkact_shift, in omap_hwmod_check_sysc()
3106 sysc_fields->clkact_shift); in omap_hwmod_check_sysc()
3108 regbits->enwkup_shift, in omap_hwmod_check_sysc()
3109 sysc_fields->enwkup_shift); in omap_hwmod_check_sysc()
3111 regbits->srst_shift, in omap_hwmod_check_sysc()
3112 sysc_fields->srst_shift); in omap_hwmod_check_sysc()
3114 regbits->autoidle_shift, in omap_hwmod_check_sysc()
3115 sysc_fields->autoidle_shift); in omap_hwmod_check_sysc()
3121 * omap_hwmod_init_regbits - init sysconfig specific register bits
3131 switch (data->cap->type) { in omap_hwmod_init_regbits()
3166 if (!oh->class->sysc->sysc_fields) in omap_hwmod_init_regbits()
3171 return -EINVAL; in omap_hwmod_init_regbits()
3178 * omap_hwmod_init_reg_offs - initialize sysconfig register offsets
3190 *rev_offs = -ENODEV; in omap_hwmod_init_reg_offs()
3194 if (data->offsets[SYSC_REVISION] >= 0) in omap_hwmod_init_reg_offs()
3195 *rev_offs = data->offsets[SYSC_REVISION]; in omap_hwmod_init_reg_offs()
3197 if (data->offsets[SYSC_SYSCONFIG] >= 0) in omap_hwmod_init_reg_offs()
3198 *sysc_offs = data->offsets[SYSC_SYSCONFIG]; in omap_hwmod_init_reg_offs()
3200 if (data->offsets[SYSC_SYSSTATUS] >= 0) in omap_hwmod_init_reg_offs()
3201 *syss_offs = data->offsets[SYSC_SYSSTATUS]; in omap_hwmod_init_reg_offs()
3207 * omap_hwmod_init_sysc_flags - initialize sysconfig features
3218 switch (data->cap->type) { in omap_hwmod_init_sysc_flags()
3221 /* See SYSC_OMAP2_* in include/dt-bindings/bus/ti-sysc.h */ in omap_hwmod_init_sysc_flags()
3222 if (data->cfg->sysc_val & SYSC_OMAP2_CLOCKACTIVITY) in omap_hwmod_init_sysc_flags()
3224 if (data->cfg->sysc_val & SYSC_OMAP2_EMUFREE) in omap_hwmod_init_sysc_flags()
3226 if (data->cfg->sysc_val & SYSC_OMAP2_ENAWAKEUP) in omap_hwmod_init_sysc_flags()
3228 if (data->cfg->sysc_val & SYSC_OMAP2_SOFTRESET) in omap_hwmod_init_sysc_flags()
3230 if (data->cfg->sysc_val & SYSC_OMAP2_AUTOIDLE) in omap_hwmod_init_sysc_flags()
3235 /* See SYSC_OMAP4_* in include/dt-bindings/bus/ti-sysc.h */ in omap_hwmod_init_sysc_flags()
3236 if (data->cfg->sysc_val & SYSC_OMAP4_DMADISABLE) in omap_hwmod_init_sysc_flags()
3238 if (data->cfg->sysc_val & SYSC_OMAP4_FREEEMU) in omap_hwmod_init_sysc_flags()
3240 if (data->cfg->sysc_val & SYSC_OMAP4_SOFTRESET) in omap_hwmod_init_sysc_flags()
3245 /* See SYSC_OMAP3_SR_* in include/dt-bindings/bus/ti-sysc.h */ in omap_hwmod_init_sysc_flags()
3246 if (data->cfg->sysc_val & SYSC_OMAP3_SR_ENAWAKEUP) in omap_hwmod_init_sysc_flags()
3250 if (data->cap->regbits->emufree_shift >= 0) in omap_hwmod_init_sysc_flags()
3252 if (data->cap->regbits->enwkup_shift >= 0) in omap_hwmod_init_sysc_flags()
3254 if (data->cap->regbits->srst_shift >= 0) in omap_hwmod_init_sysc_flags()
3256 if (data->cap->regbits->autoidle_shift >= 0) in omap_hwmod_init_sysc_flags()
3261 if (data->cap->regbits->midle_shift >= 0 && in omap_hwmod_init_sysc_flags()
3262 data->cfg->midlemodes) in omap_hwmod_init_sysc_flags()
3265 if (data->cap->regbits->sidle_shift >= 0 && in omap_hwmod_init_sysc_flags()
3266 data->cfg->sidlemodes) in omap_hwmod_init_sysc_flags()
3269 if (data->cfg->quirks & SYSC_QUIRK_UNCACHED) in omap_hwmod_init_sysc_flags()
3271 if (data->cfg->quirks & SYSC_QUIRK_RESET_STATUS) in omap_hwmod_init_sysc_flags()
3274 if (data->cfg->syss_mask & 1) in omap_hwmod_init_sysc_flags()
3281 * omap_hwmod_init_idlemodes - initialize module idle modes
3284 * @idlemodes: module supported idle modes
3292 if (data->cfg->midlemodes & BIT(SYSC_IDLE_FORCE)) in omap_hwmod_init_idlemodes()
3294 if (data->cfg->midlemodes & BIT(SYSC_IDLE_NO)) in omap_hwmod_init_idlemodes()
3296 if (data->cfg->midlemodes & BIT(SYSC_IDLE_SMART)) in omap_hwmod_init_idlemodes()
3298 if (data->cfg->midlemodes & BIT(SYSC_IDLE_SMART_WKUP)) in omap_hwmod_init_idlemodes()
3301 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_FORCE)) in omap_hwmod_init_idlemodes()
3303 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_NO)) in omap_hwmod_init_idlemodes()
3305 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_SMART)) in omap_hwmod_init_idlemodes()
3307 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_SMART_WKUP)) in omap_hwmod_init_idlemodes()
3314 * omap_hwmod_check_module - check new module against platform data
3333 if (!oh->class->sysc) in omap_hwmod_check_module()
3334 return -ENODEV; in omap_hwmod_check_module()
3336 if (oh->class->sysc->sysc_fields && in omap_hwmod_check_module()
3337 sysc_fields != oh->class->sysc->sysc_fields) in omap_hwmod_check_module()
3340 if (rev_offs != oh->class->sysc->rev_offs) in omap_hwmod_check_module()
3342 oh->class->sysc->rev_offs); in omap_hwmod_check_module()
3343 if (sysc_offs != oh->class->sysc->sysc_offs) in omap_hwmod_check_module()
3345 oh->class->sysc->sysc_offs); in omap_hwmod_check_module()
3346 if (syss_offs != oh->class->sysc->syss_offs) in omap_hwmod_check_module()
3348 oh->class->sysc->syss_offs); in omap_hwmod_check_module()
3350 if (sysc_flags != oh->class->sysc->sysc_flags) in omap_hwmod_check_module()
3352 oh->class->sysc->sysc_flags); in omap_hwmod_check_module()
3354 if (idlemodes != oh->class->sysc->idlemodes) in omap_hwmod_check_module()
3356 oh->class->sysc->idlemodes); in omap_hwmod_check_module()
3358 if (data->cfg->srst_udelay != oh->class->sysc->srst_udelay) in omap_hwmod_check_module()
3360 data->cfg->srst_udelay, in omap_hwmod_check_module()
3361 oh->class->sysc->srst_udelay); in omap_hwmod_check_module()
3367 * omap_hwmod_allocate_module - allocate new module
3378 * Note that the allocations here cannot use devm as ti-sysc can rebind.
3396 return -ENOMEM; in omap_hwmod_allocate_module()
3398 sysc->sysc_fields = sysc_fields; in omap_hwmod_allocate_module()
3399 sysc->rev_offs = rev_offs; in omap_hwmod_allocate_module()
3400 sysc->sysc_offs = sysc_offs; in omap_hwmod_allocate_module()
3401 sysc->syss_offs = syss_offs; in omap_hwmod_allocate_module()
3402 sysc->sysc_flags = sysc_flags; in omap_hwmod_allocate_module()
3403 sysc->idlemodes = idlemodes; in omap_hwmod_allocate_module()
3404 sysc->srst_udelay = data->cfg->srst_udelay; in omap_hwmod_allocate_module()
3406 if (!oh->_mpu_rt_va) { in omap_hwmod_allocate_module()
3407 regs = ioremap(data->module_pa, in omap_hwmod_allocate_module()
3408 data->module_size); in omap_hwmod_allocate_module()
3414 * We may need a new oh->class as the other devices in the same class in omap_hwmod_allocate_module()
3417 if (oh->class->name && strcmp(oh->class->name, data->name)) { in omap_hwmod_allocate_module()
3418 class = kmemdup(oh->class, sizeof(*oh->class), GFP_KERNEL); in omap_hwmod_allocate_module()
3423 if (list_empty(&oh->slave_ports)) { in omap_hwmod_allocate_module()
3431 * on omap24xx and omap3. in omap_hwmod_allocate_module()
3433 oi->slave = oh; in omap_hwmod_allocate_module()
3434 oi->user = OCP_USER_MPU | OCP_USER_SDMA; in omap_hwmod_allocate_module()
3437 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_allocate_module()
3439 oh->_mpu_rt_va = regs; in omap_hwmod_allocate_module()
3441 oh->class = class; in omap_hwmod_allocate_module()
3442 oh->class->sysc = sysc; in omap_hwmod_allocate_module()
3446 oh->clkdm = clkdm; in omap_hwmod_allocate_module()
3447 oh->_state = _HWMOD_STATE_INITIALIZED; in omap_hwmod_allocate_module()
3448 oh->_postsetup_state = _HWMOD_STATE_DEFAULT; in omap_hwmod_allocate_module()
3450 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_allocate_module()
3460 return -ENOMEM; in omap_hwmod_allocate_module()
3485 if (!strncmp(data->name, quirk->match, quirk->len)) { in omap_hwmod_init_reset_quirk()
3486 oh->class->reset = quirk->reset; in omap_hwmod_init_reset_quirk()
3507 * omap_hwmod_init_module - initialize new module
3522 if (!dev || !data || !data->name || !cookie) in omap_hwmod_init_module()
3523 return -EINVAL; in omap_hwmod_init_module()
3525 oh = _lookup(data->name); in omap_hwmod_init_module()
3529 return -ENOMEM; in omap_hwmod_init_module()
3531 oh->name = data->name; in omap_hwmod_init_module()
3532 oh->_state = _HWMOD_STATE_UNKNOWN; in omap_hwmod_init_module()
3533 lockdep_register_key(&oh->hwmod_key); in omap_hwmod_init_module()
3536 oh->prcm.omap4.flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT; in omap_hwmod_init_module()
3538 oh->class = kzalloc(sizeof(*oh->class), GFP_KERNEL); in omap_hwmod_init_module()
3539 if (!oh->class) { in omap_hwmod_init_module()
3541 return -ENOMEM; in omap_hwmod_init_module()
3546 oh->class->name = data->name; in omap_hwmod_init_module()
3552 cookie->data = oh; in omap_hwmod_init_module()
3571 if (data->cfg->quirks & SYSC_QUIRK_NO_IDLE) in omap_hwmod_init_module()
3572 oh->flags |= HWMOD_NO_IDLE; in omap_hwmod_init_module()
3573 if (data->cfg->quirks & SYSC_QUIRK_NO_IDLE_ON_INIT) in omap_hwmod_init_module()
3574 oh->flags |= HWMOD_INIT_NO_IDLE; in omap_hwmod_init_module()
3575 if (data->cfg->quirks & SYSC_QUIRK_NO_RESET_ON_INIT) in omap_hwmod_init_module()
3576 oh->flags |= HWMOD_INIT_NO_RESET; in omap_hwmod_init_module()
3577 if (data->cfg->quirks & SYSC_QUIRK_USE_CLOCKACT) in omap_hwmod_init_module()
3578 oh->flags |= HWMOD_SET_DEFAULT_CLOCKACT; in omap_hwmod_init_module()
3579 if (data->cfg->quirks & SYSC_QUIRK_SWSUP_SIDLE) in omap_hwmod_init_module()
3580 oh->flags |= HWMOD_SWSUP_SIDLE; in omap_hwmod_init_module()
3581 if (data->cfg->quirks & SYSC_QUIRK_SWSUP_SIDLE_ACT) in omap_hwmod_init_module()
3582 oh->flags |= HWMOD_SWSUP_SIDLE_ACT; in omap_hwmod_init_module()
3583 if (data->cfg->quirks & SYSC_QUIRK_SWSUP_MSTANDBY) in omap_hwmod_init_module()
3584 oh->flags |= HWMOD_SWSUP_MSTANDBY; in omap_hwmod_init_module()
3585 if (data->cfg->quirks & SYSC_QUIRK_CLKDM_NOAUTO) in omap_hwmod_init_module()
3586 oh->flags |= HWMOD_CLKDM_NOAUTO; in omap_hwmod_init_module()
3595 cookie->clkdm, rev_offs, in omap_hwmod_init_module()
3601 * omap_hwmod_setup_earlycon_flags - set up flags for early console
3604 * early concole so that hwmod core doesn't reset and keep it in idle
3616 uart = of_get_property(np, "stdout-path", NULL); in omap_hwmod_setup_earlycon_flags()
3623 uart = of_get_property(np->parent, in omap_hwmod_setup_earlycon_flags()
3629 oh->flags |= DEBUG_OMAPUART_FLAGS; in omap_hwmod_setup_earlycon_flags()
3637 * omap_hwmod_setup_all - set up all registered IP blocks
3642 * calls _setup() on each hwmod. Returns 0 upon success.
3662 * omap_hwmod_enable - enable an omap_hwmod
3666 * Returns -EINVAL on error or passes along the return value from _enable().
3674 return -EINVAL; in omap_hwmod_enable()
3676 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_enable()
3678 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_enable()
3684 * omap_hwmod_idle - idle an omap_hwmod
3687 * Idle an omap_hwmod @oh. Intended to be called by omap_device_idle().
3688 * Returns -EINVAL on error or passes along the return value from _idle().
3696 return -EINVAL; in omap_hwmod_idle()
3698 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_idle()
3700 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_idle()
3706 * omap_hwmod_shutdown - shutdown an omap_hwmod
3710 * omap_device_shutdown(). Returns -EINVAL on error or passes along
3719 return -EINVAL; in omap_hwmod_shutdown()
3721 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_shutdown()
3723 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_shutdown()
3733 * omap_hwmod_get_mpu_rt_va - return the module's base address (for the MPU)
3746 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) in omap_hwmod_get_mpu_rt_va()
3749 if (oh->_state == _HWMOD_STATE_UNKNOWN) in omap_hwmod_get_mpu_rt_va()
3752 return oh->_mpu_rt_va; in omap_hwmod_get_mpu_rt_va()
3761 * omap_hwmod_assert_hardreset - assert the HW reset line of submodules
3768 * the IP. Returns -EINVAL if @oh is null or if the operation is not
3769 * yet supported on this OMAP; otherwise, passes along the return value
3778 return -EINVAL; in omap_hwmod_assert_hardreset()
3780 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_assert_hardreset()
3782 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_assert_hardreset()
3788 * omap_hwmod_deassert_hardreset - deassert the HW reset line of submodules
3795 * the IP. Returns -EINVAL if @oh is null or if the operation is not
3796 * yet supported on this OMAP; otherwise, passes along the return value
3805 return -EINVAL; in omap_hwmod_deassert_hardreset()
3807 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_deassert_hardreset()
3809 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_deassert_hardreset()
3815 * omap_hwmod_for_each_by_class - call @fn for each hwmod of class @classname
3823 * value is passed back to the caller. Returns 0 upon success, -EINVAL
3835 return -EINVAL; in omap_hwmod_for_each_by_class()
3841 if (!strcmp(temp_oh->class->name, classname)) { in omap_hwmod_for_each_by_class()
3843 __func__, temp_oh->name); in omap_hwmod_for_each_by_class()
3858 * omap_hwmod_set_postsetup_state - set the post-_setup() state for this hwmod
3865 * -EINVAL if there is a problem with the arguments or if the hwmod is
3874 return -EINVAL; in omap_hwmod_set_postsetup_state()
3879 return -EINVAL; in omap_hwmod_set_postsetup_state()
3881 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_set_postsetup_state()
3883 if (oh->_state != _HWMOD_STATE_REGISTERED) { in omap_hwmod_set_postsetup_state()
3884 ret = -EINVAL; in omap_hwmod_set_postsetup_state()
3888 oh->_postsetup_state = state; in omap_hwmod_set_postsetup_state()
3892 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_set_postsetup_state()
3898 * omap_hwmod_init - initialize the hwmod code
3900 * Sets up some function pointers needed by the hwmod code to operate on the
3901 * currently-booted SoC. Intended to be called once during kernel init
3902 * before any hwmods are registered. No return value.