Lines Matching +full:reg +full:- +full:names

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
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 * ---------------------------
94 * Once their clock names are resolved to clock pointers, the module
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)
185 * Maximum length for module clock handle names
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()
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()
718 of_property_count_elems_of_size(np, "reg", sizeof(u32)) / 2; 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()
761 if (!oh->prcm.omap4.modulemode) in _omap4_xlate_clkctrl()
764 return omap_cm_xlate_clkctrl(oh->clkdm->prcm_partition, in _omap4_xlate_clkctrl()
765 oh->clkdm->cm_inst, in _omap4_xlate_clkctrl()
766 oh->prcm.omap4.clkctrl_offs); in _omap4_xlate_clkctrl()
782 pr_debug("%s: %s: addr=%x\n", __func__, oh->name, addr); in _lookup_clkctrl_clk()
787 for (i = 0; i < provider->num_addrs; i++) { in _lookup_clkctrl_clk()
788 if (provider->addr[i] <= addr && in _lookup_clkctrl_clk()
789 provider->addr[i] + provider->size[i] > addr) { in _lookup_clkctrl_clk()
792 clkspec.np = provider->node; in _lookup_clkctrl_clk()
794 clkspec.args[0] = addr - provider->addr[0]; in _lookup_clkctrl_clk()
800 __func__, oh->name, clk, in _lookup_clkctrl_clk()
801 clkspec.args[0], provider->node); in _lookup_clkctrl_clk()
812 * _init_main_clk - get a struct clk * for the the hwmod's main functional clk
817 * or a main_clk is present. Returns 0 on success or -EINVAL on error.
828 __clk_get_name(clk), oh->name); in _init_main_clk()
829 oh->main_clk = __clk_get_name(clk); in _init_main_clk()
830 oh->_clk = clk; in _init_main_clk()
833 if (!oh->main_clk) in _init_main_clk()
836 oh->_clk = clk_get(NULL, oh->main_clk); in _init_main_clk()
839 if (IS_ERR(oh->_clk)) { in _init_main_clk()
841 oh->name, oh->main_clk); in _init_main_clk()
842 return -EINVAL; in _init_main_clk()
845 * HACK: This needs a re-visit once clk_prepare() is implemented in _init_main_clk()
846 * to do something meaningful. Today its just a no-op. in _init_main_clk()
852 clk_prepare(oh->_clk); in _init_main_clk()
856 oh->name, oh->main_clk); in _init_main_clk()
862 * _init_interface_clks - get a struct clk * for the the hwmod's interface clks
866 * clock pointers. Returns 0 on success or -EINVAL on error.
874 list_for_each_entry(os, &oh->slave_ports, node) { in _init_interface_clks()
875 if (!os->clk) in _init_interface_clks()
878 c = clk_get(NULL, os->clk); in _init_interface_clks()
881 oh->name, os->clk); in _init_interface_clks()
882 ret = -EINVAL; in _init_interface_clks()
885 os->_clk = c; in _init_interface_clks()
887 * HACK: This needs a re-visit once clk_prepare() is implemented in _init_interface_clks()
888 * to do something meaningful. Today its just a no-op. in _init_interface_clks()
894 clk_prepare(os->_clk); in _init_interface_clks()
901 * _init_opt_clk - get a struct clk * for the the hwmod's optional clocks
905 * clock pointers. Returns 0 on success or -EINVAL on error.
914 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) { in _init_opt_clks()
915 c = clk_get(NULL, oc->clk); in _init_opt_clks()
918 oh->name, oc->clk); in _init_opt_clks()
919 ret = -EINVAL; in _init_opt_clks()
922 oc->_clk = c; in _init_opt_clks()
924 * HACK: This needs a re-visit once clk_prepare() is implemented in _init_opt_clks()
925 * to do something meaningful. Today its just a no-op. in _init_opt_clks()
931 clk_prepare(oc->_clk); in _init_opt_clks()
942 pr_debug("omap_hwmod: %s: enabling optional clocks\n", oh->name); in _enable_optional_clocks()
944 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) in _enable_optional_clocks()
945 if (oc->_clk) { in _enable_optional_clocks()
946 pr_debug("omap_hwmod: enable %s:%s\n", oc->role, in _enable_optional_clocks()
947 __clk_get_name(oc->_clk)); in _enable_optional_clocks()
948 clk_enable(oc->_clk); in _enable_optional_clocks()
957 pr_debug("omap_hwmod: %s: disabling optional clocks\n", oh->name); in _disable_optional_clocks()
959 for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) in _disable_optional_clocks()
960 if (oc->_clk) { in _disable_optional_clocks()
961 pr_debug("omap_hwmod: disable %s:%s\n", oc->role, in _disable_optional_clocks()
962 __clk_get_name(oc->_clk)); in _disable_optional_clocks()
963 clk_disable(oc->_clk); in _disable_optional_clocks()
968 * _enable_clocks - enable hwmod main clock and interface clocks
978 pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name); in _enable_clocks()
980 if (oh->flags & HWMOD_OPT_CLKS_NEEDED) in _enable_clocks()
983 if (oh->_clk) in _enable_clocks()
984 clk_enable(oh->_clk); in _enable_clocks()
986 list_for_each_entry(os, &oh->slave_ports, node) { in _enable_clocks()
987 if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) { in _enable_clocks()
988 omap2_clk_deny_idle(os->_clk); in _enable_clocks()
989 clk_enable(os->_clk); in _enable_clocks()
999 * _omap4_clkctrl_managed_by_clkfwk - true if clkctrl managed by clock framework
1004 if (oh->prcm.omap4.flags & HWMOD_OMAP4_CLKFWK_CLKCTR_CLOCK) in _omap4_clkctrl_managed_by_clkfwk()
1011 * _omap4_has_clkctrl_clock - returns true if a module has clkctrl clock
1016 if (oh->prcm.omap4.clkctrl_offs) in _omap4_has_clkctrl_clock()
1019 if (!oh->prcm.omap4.clkctrl_offs && in _omap4_has_clkctrl_clock()
1020 oh->prcm.omap4.flags & HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET) in _omap4_has_clkctrl_clock()
1027 * _disable_clocks - disable hwmod main clock and interface clocks
1036 pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name); in _disable_clocks()
1038 if (oh->_clk) in _disable_clocks()
1039 clk_disable(oh->_clk); in _disable_clocks()
1041 list_for_each_entry(os, &oh->slave_ports, node) { in _disable_clocks()
1042 if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) { in _disable_clocks()
1043 clk_disable(os->_clk); in _disable_clocks()
1044 omap2_clk_allow_idle(os->_clk); in _disable_clocks()
1048 if (oh->flags & HWMOD_OPT_CLKS_NEEDED) in _disable_clocks()
1057 * _omap4_enable_module - enable CLKCTRL modulemode on OMAP4
1065 if (!oh->clkdm || !oh->prcm.omap4.modulemode || in _omap4_enable_module()
1070 oh->name, __func__, oh->prcm.omap4.modulemode); in _omap4_enable_module()
1072 omap_cm_module_enable(oh->prcm.omap4.modulemode, in _omap4_enable_module()
1073 oh->clkdm->prcm_partition, in _omap4_enable_module()
1074 oh->clkdm->cm_inst, oh->prcm.omap4.clkctrl_offs); in _omap4_enable_module()
1078 * _omap4_wait_target_disable - wait for a module to be disabled on OMAP4
1089 return -EINVAL; in _omap4_wait_target_disable()
1091 if (oh->_int_flags & _HWMOD_NO_MPU_PORT || !oh->clkdm) in _omap4_wait_target_disable()
1094 if (oh->flags & HWMOD_NO_IDLEST) in _omap4_wait_target_disable()
1103 return omap_cm_wait_module_idle(oh->clkdm->prcm_partition, in _omap4_wait_target_disable()
1104 oh->clkdm->cm_inst, in _omap4_wait_target_disable()
1105 oh->prcm.omap4.clkctrl_offs, 0); in _omap4_wait_target_disable()
1109 * _save_mpu_port_index - find and save the index to @oh's MPU port
1124 oh->_int_flags |= _HWMOD_NO_MPU_PORT; in _save_mpu_port_index()
1126 list_for_each_entry(os, &oh->slave_ports, node) { in _save_mpu_port_index()
1127 if (os->user & OCP_USER_MPU) { in _save_mpu_port_index()
1128 oh->_mpu_port = os; in _save_mpu_port_index()
1129 oh->_int_flags &= ~_HWMOD_NO_MPU_PORT; in _save_mpu_port_index()
1138 * _find_mpu_rt_port - return omap_hwmod_ocp_if accessible by the MPU
1152 if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0) in _find_mpu_rt_port()
1155 return oh->_mpu_port; in _find_mpu_rt_port()
1159 * _enable_sysc - try to bring a module out of idle via OCP_SYSCONFIG
1164 * Usually this means placing the module into smart-idle mode and
1165 * smart-standby, but if there is a bug in the automatic idle handling
1166 * for the IP block, it may need to be placed into the force-idle or
1167 * no-idle variants of these modes. No return value.
1176 if (!oh->class->sysc) in _enable_sysc()
1182 * (off-mode for example), and the drivers require the in _enable_sysc()
1185 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) in _enable_sysc()
1188 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) in _enable_sysc()
1191 v = oh->_sysc_cache; in _enable_sysc()
1192 sf = oh->class->sysc->sysc_flags; in _enable_sysc()
1196 if (oh->flags & HWMOD_SWSUP_SIDLE || in _enable_sysc()
1197 oh->flags & HWMOD_SWSUP_SIDLE_ACT) { in _enable_sysc()
1202 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP) in _enable_sysc()
1212 clkdm_act = (clkdm && clkdm->flags & CLKDM_ACTIVE_WITH_MPU); in _enable_sysc()
1213 if (clkdm_act && !(oh->class->sysc->idlemodes & in _enable_sysc()
1221 if (oh->flags & HWMOD_FORCE_MSTANDBY) { in _enable_sysc()
1223 } else if (oh->flags & HWMOD_SWSUP_MSTANDBY) { in _enable_sysc()
1228 if (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP) in _enable_sysc()
1241 if ((oh->flags & HWMOD_SET_DEFAULT_CLOCKACT) && in _enable_sysc()
1252 idlemode = (oh->flags & HWMOD_NO_OCP_AUTOIDLE) ? in _enable_sysc()
1260 * _idle_sysc - try to put a module into idle via OCP_SYSCONFIG
1264 * idle; otherwise, configure it for smart-idle. If module is marked
1266 * configure it for smart-standby. No return value.
1273 if (!oh->class->sysc) in _idle_sysc()
1276 v = oh->_sysc_cache; in _idle_sysc()
1277 sf = oh->class->sysc->sysc_flags; in _idle_sysc()
1280 if (oh->flags & HWMOD_SWSUP_SIDLE) { in _idle_sysc()
1285 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP) in _idle_sysc()
1294 if ((oh->flags & HWMOD_SWSUP_MSTANDBY) || in _idle_sysc()
1295 (oh->flags & HWMOD_FORCE_MSTANDBY)) { in _idle_sysc()
1300 if (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP) in _idle_sysc()
1309 if (oh->_sysc_cache != v) in _idle_sysc()
1314 * _shutdown_sysc - force a module into idle via OCP_SYSCONFIG
1325 if (!oh->class->sysc) in _shutdown_sysc()
1328 v = oh->_sysc_cache; in _shutdown_sysc()
1329 sf = oh->class->sysc->sysc_flags; in _shutdown_sysc()
1344 * _lookup - find an omap_hwmod by name
1356 if (!strcmp(name, temp_oh->name)) { in _lookup()
1366 * _init_clkdm - look up a clockdomain name, store pointer in omap_hwmod
1371 * Return -EINVAL if the clkdm_name lookup failed.
1375 if (!oh->clkdm_name) { in _init_clkdm()
1376 pr_debug("omap_hwmod: %s: missing clockdomain\n", oh->name); in _init_clkdm()
1380 oh->clkdm = clkdm_lookup(oh->clkdm_name); in _init_clkdm()
1381 if (!oh->clkdm) { in _init_clkdm()
1383 oh->name, oh->clkdm_name); in _init_clkdm()
1388 oh->name, oh->clkdm_name); in _init_clkdm()
1394 * _init_clocks - clk_get() all clocks associated with this hwmod. Retrieve as
1400 * Resolves all clock names embedded in the hwmod. Returns 0 on
1407 if (oh->_state != _HWMOD_STATE_REGISTERED) in _init_clocks()
1410 pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name); in _init_clocks()
1420 oh->_state = _HWMOD_STATE_CLKS_INITED; in _init_clocks()
1422 pr_warn("omap_hwmod: %s: cannot _init_clocks\n", oh->name); in _init_clocks()
1428 * _lookup_hardreset - fill register bit info for this hwmod/reset line
1434 * input name. Return -ENOENT if not found.
1441 for (i = 0; i < oh->rst_lines_cnt; i++) { in _lookup_hardreset()
1442 const char *rst_line = oh->rst_lines[i].name; in _lookup_hardreset()
1444 ohri->rst_shift = oh->rst_lines[i].rst_shift; in _lookup_hardreset()
1445 ohri->st_shift = oh->rst_lines[i].st_shift; in _lookup_hardreset()
1447 oh->name, __func__, rst_line, ohri->rst_shift, in _lookup_hardreset()
1448 ohri->st_shift); in _lookup_hardreset()
1454 return -ENOENT; in _lookup_hardreset()
1458 * _assert_hardreset - assert the HW reset line of submodules
1465 * Returns -EINVAL if @oh is null, -ENOSYS if we have no way of
1466 * asserting the hardreset line on the currently-booted SoC, or passes
1473 int ret = -EINVAL; in _assert_hardreset()
1476 return -EINVAL; in _assert_hardreset()
1479 return -ENOSYS; in _assert_hardreset()
1491 * _deassert_hardreset - deassert the HW reset line of submodules contained
1498 * Returns -EINVAL if @oh is null, -ENOSYS if we have no way of
1499 * deasserting the hardreset line on the currently-booted SoC, or passes
1506 int ret = -EINVAL; in _deassert_hardreset()
1509 return -EINVAL; in _deassert_hardreset()
1512 return -ENOSYS; in _deassert_hardreset()
1518 if (oh->clkdm) { in _deassert_hardreset()
1524 clkdm_deny_idle(oh->clkdm); in _deassert_hardreset()
1525 ret = clkdm_hwmod_enable(oh->clkdm, oh); in _deassert_hardreset()
1528 oh->name, oh->clkdm->name, ret); in _deassert_hardreset()
1543 if (ret == -EBUSY) in _deassert_hardreset()
1544 pr_warn("omap_hwmod: %s: failed to hardreset\n", oh->name); in _deassert_hardreset()
1546 if (oh->clkdm) { in _deassert_hardreset()
1551 clkdm_allow_idle(oh->clkdm); in _deassert_hardreset()
1553 clkdm_hwmod_disable(oh->clkdm, oh); in _deassert_hardreset()
1560 * _read_hardreset - read the HW reset line state of submodules
1565 * Return the state of the reset line. Returns -EINVAL if @oh is
1566 * null, -ENOSYS if we have no way of reading the hardreset line
1567 * status on the currently-booted SoC, or passes along the return
1574 int ret = -EINVAL; in _read_hardreset()
1577 return -EINVAL; in _read_hardreset()
1580 return -ENOSYS; in _read_hardreset()
1590 * _are_all_hardreset_lines_asserted - return true if the @oh is hard-reset
1603 if (oh->rst_lines_cnt == 0) in _are_all_hardreset_lines_asserted()
1606 for (i = 0; i < oh->rst_lines_cnt; i++) in _are_all_hardreset_lines_asserted()
1607 if (_read_hardreset(oh, oh->rst_lines[i].name) > 0) in _are_all_hardreset_lines_asserted()
1610 if (oh->rst_lines_cnt == rst_cnt) in _are_all_hardreset_lines_asserted()
1617 * _are_any_hardreset_lines_asserted - return true if any part of @oh is
1618 * hard-reset
1632 for (i = 0; i < oh->rst_lines_cnt && rst_cnt == 0; i++) in _are_any_hardreset_lines_asserted()
1633 if (_read_hardreset(oh, oh->rst_lines[i].name) > 0) in _are_any_hardreset_lines_asserted()
1640 * _omap4_disable_module - enable CLKCTRL modulemode on OMAP4
1650 if (!oh->clkdm || !oh->prcm.omap4.modulemode || in _omap4_disable_module()
1652 return -EINVAL; in _omap4_disable_module()
1661 pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__); in _omap4_disable_module()
1663 omap_cm_module_disable(oh->clkdm->prcm_partition, oh->clkdm->cm_inst, in _omap4_disable_module()
1664 oh->prcm.omap4.clkctrl_offs); in _omap4_disable_module()
1669 oh->name); in _omap4_disable_module()
1675 * _ocp_softreset - reset an omap_hwmod via the OCP_SYSCONFIG bit
1679 * enabled for this to work. Returns -ENOENT if the hwmod cannot be
1680 * reset this way, -EINVAL if the hwmod is in the wrong state,
1681 * -ETIMEDOUT if the module did not reset in time, or 0 upon success.
1696 if (!oh->class->sysc || in _ocp_softreset()
1697 !(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET)) in _ocp_softreset()
1698 return -ENOENT; in _ocp_softreset()
1701 if (oh->_state != _HWMOD_STATE_ENABLED) { in _ocp_softreset()
1703 oh->name); in _ocp_softreset()
1704 return -EINVAL; in _ocp_softreset()
1708 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) in _ocp_softreset()
1711 pr_debug("omap_hwmod: %s: resetting via OCP SOFTRESET\n", oh->name); in _ocp_softreset()
1713 v = oh->_sysc_cache; in _ocp_softreset()
1720 if (oh->class->sysc->srst_udelay) in _ocp_softreset()
1721 udelay(oh->class->sysc->srst_udelay); in _ocp_softreset()
1726 oh->name, MAX_MODULE_SOFTRESET_WAIT); in _ocp_softreset()
1727 ret = -ETIMEDOUT; in _ocp_softreset()
1730 pr_debug("omap_hwmod: %s: softreset in %d usec\n", oh->name, c); in _ocp_softreset()
1745 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) in _ocp_softreset()
1752 * _reset - reset an omap_hwmod
1780 * custom reset function - these must return -EINVAL if the hwmod
1782 * -ETIMEDOUT if the module did not reset in time, or 0 upon success.
1788 pr_debug("omap_hwmod: %s: resetting\n", oh->name); in _reset()
1790 if (oh->class->reset) { in _reset()
1791 r = oh->class->reset(oh); in _reset()
1793 if (oh->rst_lines_cnt > 0) { in _reset()
1794 for (i = 0; i < oh->rst_lines_cnt; i++) in _reset()
1795 _assert_hardreset(oh, oh->rst_lines[i].name); in _reset()
1799 if (r == -ENOENT) in _reset()
1811 if (oh->class->sysc) { in _reset()
1820 * _omap4_update_context_lost - increment hwmod context loss counter if
1821 * hwmod context was lost, and clear hardware context loss reg
1825 * our in-memory context loss counter, and clear the RM_*_CONTEXT
1830 if (oh->prcm.omap4.flags & HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT) in _omap4_update_context_lost()
1833 if (!prm_was_any_context_lost_old(oh->clkdm->pwrdm.ptr->prcm_partition, in _omap4_update_context_lost()
1834 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_update_context_lost()
1835 oh->prcm.omap4.context_offs)) in _omap4_update_context_lost()
1838 oh->prcm.omap4.context_lost_counter++; in _omap4_update_context_lost()
1839 prm_clear_context_loss_flags_old(oh->clkdm->pwrdm.ptr->prcm_partition, in _omap4_update_context_lost()
1840 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_update_context_lost()
1841 oh->prcm.omap4.context_offs); in _omap4_update_context_lost()
1845 * _omap4_get_context_lost - get context loss counter for a hwmod
1848 * Returns the in-memory context loss counter for a hwmod.
1852 return oh->prcm.omap4.context_lost_counter; in _omap4_get_context_lost()
1856 * _enable - enable an omap_hwmod
1860 * register target. Returns -EINVAL if the hwmod is in the wrong
1867 pr_debug("omap_hwmod: %s: enabling\n", oh->name); in _enable()
1873 if (oh->_int_flags & _HWMOD_SKIP_ENABLE) { in _enable()
1874 oh->_int_flags &= ~_HWMOD_SKIP_ENABLE; in _enable()
1878 if (oh->_state != _HWMOD_STATE_INITIALIZED && in _enable()
1879 oh->_state != _HWMOD_STATE_IDLE && in _enable()
1880 oh->_state != _HWMOD_STATE_DISABLED) { in _enable()
1882 oh->name); in _enable()
1883 return -EINVAL; in _enable()
1900 if (oh->clkdm) { in _enable()
1906 clkdm_deny_idle(oh->clkdm); in _enable()
1907 r = clkdm_hwmod_enable(oh->clkdm, oh); in _enable()
1910 oh->name, oh->clkdm->name, r); in _enable()
1918 if (oh->flags & HWMOD_BLOCK_WFI) in _enable()
1925 -EINVAL; in _enable()
1926 if (oh->clkdm && !(oh->flags & HWMOD_CLKDM_NOAUTO)) in _enable()
1927 clkdm_allow_idle(oh->clkdm); in _enable()
1930 oh->_state = _HWMOD_STATE_ENABLED; in _enable()
1933 if (oh->class->sysc) { in _enable()
1934 if (!(oh->_int_flags & _HWMOD_SYSCONFIG_LOADED)) in _enable()
1943 oh->name, r); in _enable()
1945 if (oh->clkdm) in _enable()
1946 clkdm_hwmod_disable(oh->clkdm, oh); in _enable()
1953 * _idle - idle an omap_hwmod
1957 * no further work. Returns -EINVAL if the hwmod is in the wrong
1962 if (oh->flags & HWMOD_NO_IDLE) { in _idle()
1963 oh->_int_flags |= _HWMOD_SKIP_ENABLE; in _idle()
1967 pr_debug("omap_hwmod: %s: idling\n", oh->name); in _idle()
1972 if (oh->_state != _HWMOD_STATE_ENABLED) { in _idle()
1974 oh->name); in _idle()
1975 return -EINVAL; in _idle()
1978 if (oh->class->sysc) in _idle()
1987 if (oh->clkdm && !(oh->flags & HWMOD_CLKDM_NOAUTO)) in _idle()
1988 clkdm_deny_idle(oh->clkdm); in _idle()
1990 if (oh->flags & HWMOD_BLOCK_WFI) in _idle()
2002 if (oh->clkdm) { in _idle()
2003 clkdm_allow_idle(oh->clkdm); in _idle()
2004 clkdm_hwmod_disable(oh->clkdm, oh); in _idle()
2007 oh->_state = _HWMOD_STATE_IDLE; in _idle()
2013 * _shutdown - shutdown an omap_hwmod
2018 * used by the system. Returns -EINVAL if the hwmod is in the wrong
2029 if (oh->_state != _HWMOD_STATE_IDLE && in _shutdown()
2030 oh->_state != _HWMOD_STATE_ENABLED) { in _shutdown()
2032 oh->name); in _shutdown()
2033 return -EINVAL; in _shutdown()
2036 pr_debug("omap_hwmod: %s: disabling\n", oh->name); in _shutdown()
2038 if (oh->class->pre_shutdown) { in _shutdown()
2039 prev_state = oh->_state; in _shutdown()
2040 if (oh->_state == _HWMOD_STATE_IDLE) in _shutdown()
2042 ret = oh->class->pre_shutdown(oh); in _shutdown()
2050 if (oh->class->sysc) { in _shutdown()
2051 if (oh->_state == _HWMOD_STATE_IDLE) in _shutdown()
2057 if (oh->_state == _HWMOD_STATE_ENABLED) { in _shutdown()
2060 if (oh->flags & HWMOD_BLOCK_WFI) in _shutdown()
2065 if (oh->clkdm) in _shutdown()
2066 clkdm_hwmod_disable(oh->clkdm, oh); in _shutdown()
2068 /* XXX Should this code also force-disable the optional clocks? */ in _shutdown()
2070 for (i = 0; i < oh->rst_lines_cnt; i++) in _shutdown()
2071 _assert_hardreset(oh, oh->rst_lines[i].name); in _shutdown()
2073 oh->_state = _HWMOD_STATE_DISABLED; in _shutdown()
2086 return -ENODEV; in of_dev_find_hwmod()
2093 if (!strcmp(p, oh->name)) { in of_dev_find_hwmod()
2095 np, i, oh->name); in of_dev_find_hwmod()
2100 return -ENODEV; in of_dev_find_hwmod()
2104 * of_dev_hwmod_lookup - look up needed hwmod from dt blob
2112 * Return: Returns 0 on success, -ENODEV when not found.
2144 return -ENODEV; in of_dev_hwmod_lookup()
2148 * omap_hwmod_fix_mpu_rt_idx - fix up mpu_rt_idx register offsets
2172 error = of_address_to_resource(child, oh->mpu_rt_idx, res); in omap_hwmod_fix_mpu_rt_idx()
2179 * omap_hwmod_parse_module_range - map module IO range from device tree
2201 return -EINVAL; in omap_hwmod_parse_module_range()
2205 return -ENOENT; in omap_hwmod_parse_module_range()
2210 return -EINVAL; in omap_hwmod_parse_module_range()
2213 if (!strncmp("ti,sysc-", name, 8)) in omap_hwmod_parse_module_range()
2217 return -ENOENT; in omap_hwmod_parse_module_range()
2219 error = of_property_read_u32(np, "#address-cells", &nr_addr); in omap_hwmod_parse_module_range()
2221 return -ENOENT; in omap_hwmod_parse_module_range()
2223 error = of_property_read_u32(np, "#size-cells", &nr_size); in omap_hwmod_parse_module_range()
2225 return -ENOENT; in omap_hwmod_parse_module_range()
2228 pr_err("%s: invalid range for %s->%pOFn\n", __func__, in omap_hwmod_parse_module_range()
2229 oh->name, np); in omap_hwmod_parse_module_range()
2230 return -EINVAL; in omap_hwmod_parse_module_range()
2238 oh->name, np, base, size); in omap_hwmod_parse_module_range()
2240 if (oh && oh->mpu_rt_idx) { in omap_hwmod_parse_module_range()
2246 res->start = base; in omap_hwmod_parse_module_range()
2247 res->end = base + size - 1; in omap_hwmod_parse_module_range()
2248 res->flags = IORESOURCE_MEM; in omap_hwmod_parse_module_range()
2254 * _init_mpu_rt_base - populate the virtual address for a hwmod
2257 * @index: index of the reg entry iospace in device tree
2265 * and non-availability of MPU access is not treated as an error.
2267 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and
2268 * -ENXIO on absent or invalid register target address space.
2278 return -EINVAL; in _init_mpu_rt_base()
2283 if (!oh->class->sysc) in _init_mpu_rt_base()
2287 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) in _init_mpu_rt_base()
2288 return -ENXIO; in _init_mpu_rt_base()
2291 pr_err("omap_hwmod: %s: no dt node\n", oh->name); in _init_mpu_rt_base()
2292 return -ENXIO; in _init_mpu_rt_base()
2300 /* No ranges, rely on device reg entry */ in _init_mpu_rt_base()
2302 va_start = of_iomap(np, index + oh->mpu_rt_idx); in _init_mpu_rt_base()
2304 pr_err("omap_hwmod: %s: Missing dt reg%i for %pOF\n", in _init_mpu_rt_base()
2305 oh->name, index, np); in _init_mpu_rt_base()
2306 return -ENXIO; in _init_mpu_rt_base()
2310 oh->name, va_start); in _init_mpu_rt_base()
2312 oh->_mpu_rt_va = va_start; in _init_mpu_rt_base()
2319 if (of_find_property(np, "ti,no-reset-on-init", NULL)) in parse_module_flags()
2320 oh->flags |= HWMOD_INIT_NO_RESET; in parse_module_flags()
2321 if (of_find_property(np, "ti,no-idle-on-init", NULL)) in parse_module_flags()
2322 oh->flags |= HWMOD_INIT_NO_IDLE; in parse_module_flags()
2323 if (of_find_property(np, "ti,no-idle", NULL)) in parse_module_flags()
2324 oh->flags |= HWMOD_NO_IDLE; in parse_module_flags()
2328 * _init - initialize internal data for the hwmod @oh
2338 * address space is not defined, or -EINVAL upon failure.
2346 if (oh->_state != _HWMOD_STATE_REGISTERED) in _init()
2351 return -ENODEV; in _init()
2355 pr_debug("omap_hwmod: %s missing dt data\n", oh->name); in _init()
2358 oh->name, np); in _init()
2363 oh->name); in _init()
2369 WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); in _init()
2370 return -EINVAL; in _init()
2382 oh->_state = _HWMOD_STATE_INITIALIZED; in _init()
2388 * _setup_iclk_autoidle - configure an IP block's interface clocks
2399 if (oh->_state != _HWMOD_STATE_INITIALIZED) in _setup_iclk_autoidle()
2402 list_for_each_entry(os, &oh->slave_ports, node) { in _setup_iclk_autoidle()
2403 if (!os->_clk) in _setup_iclk_autoidle()
2406 if (os->flags & OCPIF_SWSUP_IDLE) { in _setup_iclk_autoidle()
2414 clk_enable(os->_clk); in _setup_iclk_autoidle()
2422 * _setup_reset - reset an IP block during the setup process
2434 if (oh->_state != _HWMOD_STATE_INITIALIZED) in _setup_reset()
2435 return -EINVAL; in _setup_reset()
2437 if (oh->flags & HWMOD_EXT_OPT_MAIN_CLK) in _setup_reset()
2438 return -EPERM; in _setup_reset()
2440 if (oh->rst_lines_cnt == 0) { in _setup_reset()
2444 oh->name, oh->_state); in _setup_reset()
2445 return -EINVAL; in _setup_reset()
2449 if (!(oh->flags & HWMOD_INIT_NO_RESET)) in _setup_reset()
2456 * _setup_postsetup - transition to the appropriate state after _setup
2459 * Place an IP block represented by @oh into a "post-setup" state --
2460 * either IDLE, ENABLED, or DISABLED. ("post-setup" simply means that
2467 * The IP block stays in this state until a PM runtime-based driver is
2468 * loaded for that IP block. A post-setup state of IDLE is
2469 * appropriate for almost all IP blocks with runtime PM-enabled
2471 * post-setup state of ENABLED is appropriate for kernels with PM
2477 * This post-setup mechanism is deprecated. Once all of the OMAP
2495 if (oh->rst_lines_cnt > 0) in _setup_postsetup()
2498 postsetup_state = oh->_postsetup_state; in _setup_postsetup()
2503 * XXX HWMOD_INIT_NO_IDLE does not belong in hwmod data - in _setup_postsetup()
2506 if ((oh->flags & (HWMOD_INIT_NO_IDLE | HWMOD_NO_IDLE)) && in _setup_postsetup()
2508 oh->_int_flags |= _HWMOD_SKIP_ENABLE; in _setup_postsetup()
2518 oh->name, postsetup_state); in _setup_postsetup()
2524 * _setup - prepare IP block hardware for use
2530 * post-setup state, depending on the type of IP block and applicable
2541 if (oh->_state != _HWMOD_STATE_INITIALIZED) in _setup()
2544 if (oh->parent_hwmod) { in _setup()
2547 r = _enable(oh->parent_hwmod); in _setup()
2549 oh->name, oh->parent_hwmod->name); in _setup()
2557 if (oh->parent_hwmod) { in _setup()
2560 postsetup_state = oh->parent_hwmod->_postsetup_state; in _setup()
2563 _idle(oh->parent_hwmod); in _setup()
2565 _shutdown(oh->parent_hwmod); in _setup()
2568 oh->parent_hwmod->name, postsetup_state); in _setup()
2575 * _register - register a struct omap_hwmod
2578 * Registers the omap_hwmod @oh. Returns -EEXIST if an omap_hwmod
2579 * already has been registered by the same name; -EINVAL if the
2587 * unneeded omap_hwmods to be freed on multi-OMAP configurations. Note
2593 if (!oh || !oh->name || !oh->class || !oh->class->name || in _register()
2594 (oh->_state != _HWMOD_STATE_UNKNOWN)) in _register()
2595 return -EINVAL; in _register()
2597 pr_debug("omap_hwmod: %s: registering\n", oh->name); in _register()
2599 if (_lookup(oh->name)) in _register()
2600 return -EEXIST; in _register()
2602 list_add_tail(&oh->node, &omap_hwmod_list); in _register()
2604 INIT_LIST_HEAD(&oh->slave_ports); in _register()
2605 spin_lock_init(&oh->_lock); in _register()
2606 lockdep_set_class(&oh->_lock, &oh->hwmod_key); in _register()
2608 oh->_state = _HWMOD_STATE_REGISTERED; in _register()
2614 if (!strcmp(oh->name, MPU_INITIATOR_NAME)) in _register()
2621 * _add_link - add an interconnect between two IP blocks
2625 * specified in @oi->slave to @oi. This code is assumed to run before
2632 pr_debug("omap_hwmod: %s -> %s: adding link\n", oi->master->name, in _add_link()
2633 oi->slave->name); in _add_link()
2635 list_add(&oi->node, &oi->slave->slave_ports); in _add_link()
2636 oi->slave->slaves_cnt++; in _add_link()
2642 * _register_link - register a struct omap_hwmod_ocp_if
2645 * Registers the omap_hwmod_ocp_if record @oi. Returns -EEXIST if it
2646 * has already been registered; -EINVAL if @oi is NULL or if the
2652 * unneeded omap_hwmods to be freed on multi-OMAP configurations.
2656 if (!oi || !oi->master || !oi->slave || !oi->user) in _register_link()
2657 return -EINVAL; in _register_link()
2659 if (oi->_int_flags & _OCPIF_INT_FLAGS_REGISTERED) in _register_link()
2660 return -EEXIST; in _register_link()
2663 oi->master->name, oi->slave->name); in _register_link()
2669 if (oi->master->_state != _HWMOD_STATE_REGISTERED) in _register_link()
2670 _register(oi->master); in _register_link()
2672 if (oi->slave->_state != _HWMOD_STATE_REGISTERED) in _register_link()
2673 _register(oi->slave); in _register_link()
2677 oi->_int_flags |= _OCPIF_INT_FLAGS_REGISTERED; in _register_link()
2685 * _omap2xxx_3xxx_wait_target_ready - wait for a module to leave slave idle
2696 return -EINVAL; in _omap2xxx_3xxx_wait_target_ready()
2698 if (oh->flags & HWMOD_NO_IDLEST) in _omap2xxx_3xxx_wait_target_ready()
2706 return omap_cm_wait_module_ready(0, oh->prcm.omap2.module_offs, in _omap2xxx_3xxx_wait_target_ready()
2707 oh->prcm.omap2.idlest_reg_id, in _omap2xxx_3xxx_wait_target_ready()
2708 oh->prcm.omap2.idlest_idle_bit); in _omap2xxx_3xxx_wait_target_ready()
2712 * _omap4_wait_target_ready - wait for a module to leave slave idle
2723 return -EINVAL; in _omap4_wait_target_ready()
2725 if (oh->flags & HWMOD_NO_IDLEST || !oh->clkdm) in _omap4_wait_target_ready()
2739 return omap_cm_wait_module_ready(oh->clkdm->prcm_partition, in _omap4_wait_target_ready()
2740 oh->clkdm->cm_inst, in _omap4_wait_target_ready()
2741 oh->prcm.omap4.clkctrl_offs, 0); in _omap4_wait_target_ready()
2745 * _omap2_assert_hardreset - call OMAP2 PRM hardreset fn with hwmod args
2758 return omap_prm_assert_hardreset(ohri->rst_shift, 0, in _omap2_assert_hardreset()
2759 oh->prcm.omap2.module_offs, 0); in _omap2_assert_hardreset()
2763 * _omap2_deassert_hardreset - call OMAP2 PRM hardreset fn with hwmod args
2776 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, 0, in _omap2_deassert_hardreset()
2777 oh->prcm.omap2.module_offs, 0, 0); in _omap2_deassert_hardreset()
2781 * _omap2_is_hardreset_asserted - call OMAP2 PRM hardreset fn with hwmod args
2795 return omap_prm_is_hardreset_asserted(ohri->st_shift, 0, in _omap2_is_hardreset_asserted()
2796 oh->prcm.omap2.module_offs, 0); in _omap2_is_hardreset_asserted()
2800 * _omap4_assert_hardreset - call OMAP4 PRM hardreset fn with hwmod args
2814 if (!oh->clkdm) in _omap4_assert_hardreset()
2815 return -EINVAL; in _omap4_assert_hardreset()
2817 return omap_prm_assert_hardreset(ohri->rst_shift, in _omap4_assert_hardreset()
2818 oh->clkdm->pwrdm.ptr->prcm_partition, in _omap4_assert_hardreset()
2819 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_assert_hardreset()
2820 oh->prcm.omap4.rstctrl_offs); in _omap4_assert_hardreset()
2824 * _omap4_deassert_hardreset - call OMAP4 PRM hardreset fn with hwmod args
2838 if (!oh->clkdm) in _omap4_deassert_hardreset()
2839 return -EINVAL; in _omap4_deassert_hardreset()
2841 if (ohri->st_shift) in _omap4_deassert_hardreset()
2843 oh->name, ohri->name); in _omap4_deassert_hardreset()
2844 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->rst_shift, in _omap4_deassert_hardreset()
2845 oh->clkdm->pwrdm.ptr->prcm_partition, in _omap4_deassert_hardreset()
2846 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_deassert_hardreset()
2847 oh->prcm.omap4.rstctrl_offs, in _omap4_deassert_hardreset()
2848 oh->prcm.omap4.rstctrl_offs + in _omap4_deassert_hardreset()
2853 * _omap4_is_hardreset_asserted - call OMAP4 PRM hardreset fn with hwmod args
2867 if (!oh->clkdm) in _omap4_is_hardreset_asserted()
2868 return -EINVAL; in _omap4_is_hardreset_asserted()
2870 return omap_prm_is_hardreset_asserted(ohri->rst_shift, in _omap4_is_hardreset_asserted()
2871 oh->clkdm->pwrdm.ptr-> in _omap4_is_hardreset_asserted()
2873 oh->clkdm->pwrdm.ptr->prcm_offs, in _omap4_is_hardreset_asserted()
2874 oh->prcm.omap4.rstctrl_offs); in _omap4_is_hardreset_asserted()
2878 * _omap4_disable_direct_prcm - disable direct PRCM control for hwmod
2888 return -EINVAL; in _omap4_disable_direct_prcm()
2890 oh->prcm.omap4.flags |= HWMOD_OMAP4_CLKFWK_CLKCTR_CLOCK; in _omap4_disable_direct_prcm()
2896 * _am33xx_deassert_hardreset - call AM33XX PRM hardreset fn with hwmod args
2910 return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, in _am33xx_deassert_hardreset()
2911 oh->clkdm->pwrdm.ptr->prcm_partition, in _am33xx_deassert_hardreset()
2912 oh->clkdm->pwrdm.ptr->prcm_offs, in _am33xx_deassert_hardreset()
2913 oh->prcm.omap4.rstctrl_offs, in _am33xx_deassert_hardreset()
2914 oh->prcm.omap4.rstst_offs); in _am33xx_deassert_hardreset()
2921 if (oh->flags & HWMOD_16BIT_REG) in omap_hwmod_read()
2922 return readw_relaxed(oh->_mpu_rt_va + reg_offs); in omap_hwmod_read()
2924 return readl_relaxed(oh->_mpu_rt_va + reg_offs); in omap_hwmod_read()
2929 if (oh->flags & HWMOD_16BIT_REG) in omap_hwmod_write()
2930 writew_relaxed(v, oh->_mpu_rt_va + reg_offs); in omap_hwmod_write()
2932 writel_relaxed(v, oh->_mpu_rt_va + reg_offs); in omap_hwmod_write()
2936 * omap_hwmod_softreset - reset a module via SYSCONFIG.SOFTRESET bit
2949 if (!oh || !(oh->_sysc_cache)) in omap_hwmod_softreset()
2950 return -EINVAL; in omap_hwmod_softreset()
2952 v = oh->_sysc_cache; in omap_hwmod_softreset()
2968 * omap_hwmod_lookup - look up a registered omap_hwmod by name
2987 * omap_hwmod_for_each - call function for each registered omap_hwmod
2993 * failure. If @fn returns non-zero, the iteration across omap_hwmods
2994 * will stop and the non-zero return value will be passed to the
3005 return -EINVAL; in omap_hwmod_for_each()
3017 * omap_hwmod_register_links - register an array of hwmod links
3022 * listed in @ois that are valid for this chip. Returns -EINVAL if
3024 * -ENOMEM if the link memory area can't be allocated, or 0 upon
3032 return -EINVAL; in omap_hwmod_register_links()
3043 WARN(r && r != -EEXIST, in omap_hwmod_register_links()
3044 "omap_hwmod: _register_link(%s -> %s) returned %d\n", in omap_hwmod_register_links()
3045 ois[i]->master->name, ois[i]->slave->name, r); in omap_hwmod_register_links()
3052 * _ensure_mpu_hwmod_is_setup - ensure the MPU SS hwmod is init'ed and set up
3063 if (!mpu_oh || mpu_oh->_state == _HWMOD_STATE_UNKNOWN) in _ensure_mpu_hwmod_is_setup()
3066 else if (mpu_oh->_state == _HWMOD_STATE_REGISTERED && oh != mpu_oh) in _ensure_mpu_hwmod_is_setup()
3071 * omap_hwmod_setup_one - set up a single hwmod
3072 * @oh_name: const char * name of the already-registered hwmod to set up
3077 * Resolves the struct clk names to struct clk pointers for each
3079 * -EINVAL upon error or 0 upon success.
3090 return -EINVAL; in omap_hwmod_setup_one()
3112 * omap_hwmod_check_sysc - check sysc against platform sysc
3121 const struct sysc_regbits *regbits = data->cap->regbits; in omap_hwmod_check_sysc()
3124 regbits->dmadisable_shift, in omap_hwmod_check_sysc()
3125 sysc_fields->dmadisable_shift); in omap_hwmod_check_sysc()
3127 regbits->midle_shift, in omap_hwmod_check_sysc()
3128 sysc_fields->midle_shift); in omap_hwmod_check_sysc()
3130 regbits->sidle_shift, in omap_hwmod_check_sysc()
3131 sysc_fields->sidle_shift); in omap_hwmod_check_sysc()
3133 regbits->clkact_shift, in omap_hwmod_check_sysc()
3134 sysc_fields->clkact_shift); in omap_hwmod_check_sysc()
3136 regbits->enwkup_shift, in omap_hwmod_check_sysc()
3137 sysc_fields->enwkup_shift); in omap_hwmod_check_sysc()
3139 regbits->srst_shift, in omap_hwmod_check_sysc()
3140 sysc_fields->srst_shift); in omap_hwmod_check_sysc()
3142 regbits->autoidle_shift, in omap_hwmod_check_sysc()
3143 sysc_fields->autoidle_shift); in omap_hwmod_check_sysc()
3149 * omap_hwmod_init_regbits - init sysconfig specific register bits
3159 switch (data->cap->type) { in omap_hwmod_init_regbits()
3194 if (!oh->class->sysc->sysc_fields) in omap_hwmod_init_regbits()
3199 return -EINVAL; in omap_hwmod_init_regbits()
3206 * omap_hwmod_init_reg_offs - initialize sysconfig register offsets
3218 *rev_offs = -ENODEV; in omap_hwmod_init_reg_offs()
3222 if (data->offsets[SYSC_REVISION] >= 0) in omap_hwmod_init_reg_offs()
3223 *rev_offs = data->offsets[SYSC_REVISION]; in omap_hwmod_init_reg_offs()
3225 if (data->offsets[SYSC_SYSCONFIG] >= 0) in omap_hwmod_init_reg_offs()
3226 *sysc_offs = data->offsets[SYSC_SYSCONFIG]; in omap_hwmod_init_reg_offs()
3228 if (data->offsets[SYSC_SYSSTATUS] >= 0) in omap_hwmod_init_reg_offs()
3229 *syss_offs = data->offsets[SYSC_SYSSTATUS]; in omap_hwmod_init_reg_offs()
3235 * omap_hwmod_init_sysc_flags - initialize sysconfig features
3246 switch (data->cap->type) { in omap_hwmod_init_sysc_flags()
3249 /* See SYSC_OMAP2_* in include/dt-bindings/bus/ti-sysc.h */ in omap_hwmod_init_sysc_flags()
3250 if (data->cfg->sysc_val & SYSC_OMAP2_CLOCKACTIVITY) in omap_hwmod_init_sysc_flags()
3252 if (data->cfg->sysc_val & SYSC_OMAP2_EMUFREE) in omap_hwmod_init_sysc_flags()
3254 if (data->cfg->sysc_val & SYSC_OMAP2_ENAWAKEUP) in omap_hwmod_init_sysc_flags()
3256 if (data->cfg->sysc_val & SYSC_OMAP2_SOFTRESET) in omap_hwmod_init_sysc_flags()
3258 if (data->cfg->sysc_val & SYSC_OMAP2_AUTOIDLE) in omap_hwmod_init_sysc_flags()
3263 /* See SYSC_OMAP4_* in include/dt-bindings/bus/ti-sysc.h */ in omap_hwmod_init_sysc_flags()
3264 if (data->cfg->sysc_val & SYSC_OMAP4_DMADISABLE) in omap_hwmod_init_sysc_flags()
3266 if (data->cfg->sysc_val & SYSC_OMAP4_FREEEMU) in omap_hwmod_init_sysc_flags()
3268 if (data->cfg->sysc_val & SYSC_OMAP4_SOFTRESET) in omap_hwmod_init_sysc_flags()
3273 /* See SYSC_OMAP3_SR_* in include/dt-bindings/bus/ti-sysc.h */ in omap_hwmod_init_sysc_flags()
3274 if (data->cfg->sysc_val & SYSC_OMAP3_SR_ENAWAKEUP) in omap_hwmod_init_sysc_flags()
3278 if (data->cap->regbits->emufree_shift >= 0) in omap_hwmod_init_sysc_flags()
3280 if (data->cap->regbits->enwkup_shift >= 0) in omap_hwmod_init_sysc_flags()
3282 if (data->cap->regbits->srst_shift >= 0) in omap_hwmod_init_sysc_flags()
3284 if (data->cap->regbits->autoidle_shift >= 0) in omap_hwmod_init_sysc_flags()
3289 if (data->cap->regbits->midle_shift >= 0 && in omap_hwmod_init_sysc_flags()
3290 data->cfg->midlemodes) in omap_hwmod_init_sysc_flags()
3293 if (data->cap->regbits->sidle_shift >= 0 && in omap_hwmod_init_sysc_flags()
3294 data->cfg->sidlemodes) in omap_hwmod_init_sysc_flags()
3297 if (data->cfg->quirks & SYSC_QUIRK_UNCACHED) in omap_hwmod_init_sysc_flags()
3299 if (data->cfg->quirks & SYSC_QUIRK_RESET_STATUS) in omap_hwmod_init_sysc_flags()
3302 if (data->cfg->syss_mask & 1) in omap_hwmod_init_sysc_flags()
3309 * omap_hwmod_init_idlemodes - initialize module idle modes
3320 if (data->cfg->midlemodes & BIT(SYSC_IDLE_FORCE)) in omap_hwmod_init_idlemodes()
3322 if (data->cfg->midlemodes & BIT(SYSC_IDLE_NO)) in omap_hwmod_init_idlemodes()
3324 if (data->cfg->midlemodes & BIT(SYSC_IDLE_SMART)) in omap_hwmod_init_idlemodes()
3326 if (data->cfg->midlemodes & BIT(SYSC_IDLE_SMART_WKUP)) in omap_hwmod_init_idlemodes()
3329 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_FORCE)) in omap_hwmod_init_idlemodes()
3331 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_NO)) in omap_hwmod_init_idlemodes()
3333 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_SMART)) in omap_hwmod_init_idlemodes()
3335 if (data->cfg->sidlemodes & BIT(SYSC_IDLE_SMART_WKUP)) in omap_hwmod_init_idlemodes()
3342 * omap_hwmod_check_module - check new module against platform data
3361 if (!oh->class->sysc) in omap_hwmod_check_module()
3362 return -ENODEV; in omap_hwmod_check_module()
3364 if (oh->class->sysc->sysc_fields && in omap_hwmod_check_module()
3365 sysc_fields != oh->class->sysc->sysc_fields) in omap_hwmod_check_module()
3368 if (rev_offs != oh->class->sysc->rev_offs) in omap_hwmod_check_module()
3370 oh->class->sysc->rev_offs); in omap_hwmod_check_module()
3371 if (sysc_offs != oh->class->sysc->sysc_offs) in omap_hwmod_check_module()
3373 oh->class->sysc->sysc_offs); in omap_hwmod_check_module()
3374 if (syss_offs != oh->class->sysc->syss_offs) in omap_hwmod_check_module()
3376 oh->class->sysc->syss_offs); in omap_hwmod_check_module()
3378 if (sysc_flags != oh->class->sysc->sysc_flags) in omap_hwmod_check_module()
3380 oh->class->sysc->sysc_flags); in omap_hwmod_check_module()
3382 if (idlemodes != oh->class->sysc->idlemodes) in omap_hwmod_check_module()
3384 oh->class->sysc->idlemodes); in omap_hwmod_check_module()
3386 if (data->cfg->srst_udelay != oh->class->sysc->srst_udelay) in omap_hwmod_check_module()
3388 data->cfg->srst_udelay, in omap_hwmod_check_module()
3389 oh->class->sysc->srst_udelay); in omap_hwmod_check_module()
3395 * omap_hwmod_allocate_module - allocate new module
3406 * Note that the allocations here cannot use devm as ti-sysc can rebind.
3424 return -ENOMEM; in omap_hwmod_allocate_module()
3426 sysc->sysc_fields = sysc_fields; in omap_hwmod_allocate_module()
3427 sysc->rev_offs = rev_offs; in omap_hwmod_allocate_module()
3428 sysc->sysc_offs = sysc_offs; in omap_hwmod_allocate_module()
3429 sysc->syss_offs = syss_offs; in omap_hwmod_allocate_module()
3430 sysc->sysc_flags = sysc_flags; in omap_hwmod_allocate_module()
3431 sysc->idlemodes = idlemodes; in omap_hwmod_allocate_module()
3432 sysc->srst_udelay = data->cfg->srst_udelay; in omap_hwmod_allocate_module()
3434 if (!oh->_mpu_rt_va) { in omap_hwmod_allocate_module()
3435 regs = ioremap(data->module_pa, in omap_hwmod_allocate_module()
3436 data->module_size); in omap_hwmod_allocate_module()
3442 * We may need a new oh->class as the other devices in the same class in omap_hwmod_allocate_module()
3445 if (oh->class->name && strcmp(oh->class->name, data->name)) { in omap_hwmod_allocate_module()
3446 class = kmemdup(oh->class, sizeof(*oh->class), GFP_KERNEL); in omap_hwmod_allocate_module()
3451 if (list_empty(&oh->slave_ports)) { in omap_hwmod_allocate_module()
3461 oi->slave = oh; in omap_hwmod_allocate_module()
3462 oi->user = OCP_USER_MPU | OCP_USER_SDMA; in omap_hwmod_allocate_module()
3465 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_allocate_module()
3467 oh->_mpu_rt_va = regs; in omap_hwmod_allocate_module()
3469 oh->class = class; in omap_hwmod_allocate_module()
3470 oh->class->sysc = sysc; in omap_hwmod_allocate_module()
3474 oh->clkdm = clkdm; in omap_hwmod_allocate_module()
3475 oh->_state = _HWMOD_STATE_INITIALIZED; in omap_hwmod_allocate_module()
3476 oh->_postsetup_state = _HWMOD_STATE_DEFAULT; in omap_hwmod_allocate_module()
3478 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_allocate_module()
3488 return -ENOMEM; in omap_hwmod_allocate_module()
3517 if (!strncmp(data->name, quirk->match, quirk->len)) { in omap_hwmod_init_reset_quirk()
3518 oh->class->reset = quirk->reset; in omap_hwmod_init_reset_quirk()
3543 * omap_hwmod_init_module - initialize new module
3558 if (!dev || !data || !data->name || !cookie) in omap_hwmod_init_module()
3559 return -EINVAL; in omap_hwmod_init_module()
3561 oh = _lookup(data->name); in omap_hwmod_init_module()
3565 return -ENOMEM; in omap_hwmod_init_module()
3567 oh->name = data->name; in omap_hwmod_init_module()
3568 oh->_state = _HWMOD_STATE_UNKNOWN; in omap_hwmod_init_module()
3569 lockdep_register_key(&oh->hwmod_key); in omap_hwmod_init_module()
3572 oh->prcm.omap4.flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT; in omap_hwmod_init_module()
3574 oh->class = kzalloc(sizeof(*oh->class), GFP_KERNEL); in omap_hwmod_init_module()
3575 if (!oh->class) { in omap_hwmod_init_module()
3577 return -ENOMEM; in omap_hwmod_init_module()
3582 oh->class->name = data->name; in omap_hwmod_init_module()
3588 cookie->data = oh; in omap_hwmod_init_module()
3607 if (data->cfg->quirks & SYSC_QUIRK_NO_IDLE) in omap_hwmod_init_module()
3608 oh->flags |= HWMOD_NO_IDLE; in omap_hwmod_init_module()
3609 if (data->cfg->quirks & SYSC_QUIRK_NO_IDLE_ON_INIT) in omap_hwmod_init_module()
3610 oh->flags |= HWMOD_INIT_NO_IDLE; in omap_hwmod_init_module()
3611 if (data->cfg->quirks & SYSC_QUIRK_NO_RESET_ON_INIT) in omap_hwmod_init_module()
3612 oh->flags |= HWMOD_INIT_NO_RESET; in omap_hwmod_init_module()
3613 if (data->cfg->quirks & SYSC_QUIRK_USE_CLOCKACT) in omap_hwmod_init_module()
3614 oh->flags |= HWMOD_SET_DEFAULT_CLOCKACT; in omap_hwmod_init_module()
3615 if (data->cfg->quirks & SYSC_QUIRK_SWSUP_SIDLE) in omap_hwmod_init_module()
3616 oh->flags |= HWMOD_SWSUP_SIDLE; in omap_hwmod_init_module()
3617 if (data->cfg->quirks & SYSC_QUIRK_SWSUP_SIDLE_ACT) in omap_hwmod_init_module()
3618 oh->flags |= HWMOD_SWSUP_SIDLE_ACT; in omap_hwmod_init_module()
3619 if (data->cfg->quirks & SYSC_QUIRK_SWSUP_MSTANDBY) in omap_hwmod_init_module()
3620 oh->flags |= HWMOD_SWSUP_MSTANDBY; in omap_hwmod_init_module()
3629 cookie->clkdm, rev_offs, in omap_hwmod_init_module()
3635 * omap_hwmod_setup_earlycon_flags - set up flags for early console
3650 uart = of_get_property(np, "stdout-path", NULL); in omap_hwmod_setup_earlycon_flags()
3657 uart = of_get_property(np->parent, in omap_hwmod_setup_earlycon_flags()
3663 oh->flags |= DEBUG_OMAPUART_FLAGS; in omap_hwmod_setup_earlycon_flags()
3671 * omap_hwmod_setup_all - set up all registered IP blocks
3675 * names to struct clk pointers for each registered omap_hwmod. Also
3693 * omap_hwmod_enable - enable an omap_hwmod
3697 * Returns -EINVAL on error or passes along the return value from _enable().
3705 return -EINVAL; in omap_hwmod_enable()
3707 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_enable()
3709 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_enable()
3715 * omap_hwmod_idle - idle an omap_hwmod
3719 * Returns -EINVAL on error or passes along the return value from _idle().
3727 return -EINVAL; in omap_hwmod_idle()
3729 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_idle()
3731 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_idle()
3737 * omap_hwmod_shutdown - shutdown an omap_hwmod
3741 * omap_device_shutdown(). Returns -EINVAL on error or passes along
3750 return -EINVAL; in omap_hwmod_shutdown()
3752 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_shutdown()
3754 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_shutdown()
3764 * omap_hwmod_get_pwrdm - return pointer to this module's main powerdomain
3784 if (oh->clkdm) in omap_hwmod_get_pwrdm()
3785 return oh->clkdm->pwrdm.ptr; in omap_hwmod_get_pwrdm()
3787 if (oh->_clk) { in omap_hwmod_get_pwrdm()
3788 c = oh->_clk; in omap_hwmod_get_pwrdm()
3793 c = oi->_clk; in omap_hwmod_get_pwrdm()
3797 clkdm = clk->clkdm; in omap_hwmod_get_pwrdm()
3801 return clkdm->pwrdm.ptr; in omap_hwmod_get_pwrdm()
3805 * omap_hwmod_get_mpu_rt_va - return the module's base address (for the MPU)
3818 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) in omap_hwmod_get_mpu_rt_va()
3821 if (oh->_state == _HWMOD_STATE_UNKNOWN) in omap_hwmod_get_mpu_rt_va()
3824 return oh->_mpu_rt_va; in omap_hwmod_get_mpu_rt_va()
3833 * omap_hwmod_assert_hardreset - assert the HW reset line of submodules
3840 * the IP. Returns -EINVAL if @oh is null or if the operation is not
3850 return -EINVAL; in omap_hwmod_assert_hardreset()
3852 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_assert_hardreset()
3854 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_assert_hardreset()
3860 * omap_hwmod_deassert_hardreset - deassert the HW reset line of submodules
3867 * the IP. Returns -EINVAL if @oh is null or if the operation is not
3877 return -EINVAL; in omap_hwmod_deassert_hardreset()
3879 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_deassert_hardreset()
3881 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_deassert_hardreset()
3887 * omap_hwmod_for_each_by_class - call @fn for each hwmod of class @classname
3895 * value is passed back to the caller. Returns 0 upon success, -EINVAL
3907 return -EINVAL; in omap_hwmod_for_each_by_class()
3913 if (!strcmp(temp_oh->class->name, classname)) { in omap_hwmod_for_each_by_class()
3915 __func__, temp_oh->name); in omap_hwmod_for_each_by_class()
3930 * omap_hwmod_set_postsetup_state - set the post-_setup() state for this hwmod
3937 * -EINVAL if there is a problem with the arguments or if the hwmod is
3946 return -EINVAL; in omap_hwmod_set_postsetup_state()
3951 return -EINVAL; in omap_hwmod_set_postsetup_state()
3953 spin_lock_irqsave(&oh->_lock, flags); in omap_hwmod_set_postsetup_state()
3955 if (oh->_state != _HWMOD_STATE_REGISTERED) { in omap_hwmod_set_postsetup_state()
3956 ret = -EINVAL; in omap_hwmod_set_postsetup_state()
3960 oh->_postsetup_state = state; in omap_hwmod_set_postsetup_state()
3964 spin_unlock_irqrestore(&oh->_lock, flags); in omap_hwmod_set_postsetup_state()
3970 * omap_hwmod_get_context_loss_count - get lost context count
3976 * On OMAP4, this queries the per-hwmod context loss register,
3996 * omap_hwmod_init - initialize the hwmod code
3999 * currently-booted SoC. Intended to be called once during kernel init
4048 * omap_hwmod_get_main_clk - get pointer to main clock name
4059 return oh->main_clk; in omap_hwmod_get_main_clk()