Lines Matching refs:omap_hwmod
3 * omap_hwmod implementation for OMAP2/3/4
46 * build a struct platform_device using omap_hwmod data, and that is
48 * Linux driver model. Most drivers will call omap_hwmod functions only
68 * ----> | omap_hwmod code/data | <-----
69 * | (../mach-omap2/omap_hwmod*) |
101 * OMAP core integration code can then call omap_hwmod*() functions
150 #include "omap_hwmod.h"
213 * Used only in cases where struct omap_hwmod is dynamically allocated.
218 int (*reset)(struct omap_hwmod *oh);
231 void (*enable_module)(struct omap_hwmod *oh);
232 int (*disable_module)(struct omap_hwmod *oh);
233 int (*wait_target_ready)(struct omap_hwmod *oh);
234 int (*assert_hardreset)(struct omap_hwmod *oh,
236 int (*deassert_hardreset)(struct omap_hwmod *oh,
238 int (*is_hardreset_asserted)(struct omap_hwmod *oh,
240 int (*init_clkdm)(struct omap_hwmod *oh);
241 void (*update_context_lost)(struct omap_hwmod *oh);
242 int (*get_context_lost)(struct omap_hwmod *oh);
243 int (*disable_direct_prcm)(struct omap_hwmod *oh);
244 u32 (*xlate_clkctrl)(struct omap_hwmod *oh);
247 /* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */
255 static struct omap_hwmod *mpu_oh;
264 * @oh: struct omap_hwmod *
267 * struct omap_hwmod for later use. Returns -EINVAL if the hwmod has no
270 static int _update_sysc_cache(struct omap_hwmod *oh)
273 WARN(1, "omap_hwmod: %s: cannot read OCP_SYSCONFIG: not defined on hwmod's class\n", oh->name);
290 * @oh: struct omap_hwmod *
295 static void _write_sysconfig(u32 v, struct omap_hwmod *oh)
298 WARN(1, "omap_hwmod: %s: cannot write OCP_SYSCONFIG: not defined on hwmod's class\n", oh->name);
324 * @oh: struct omap_hwmod *
332 static int _set_master_standbymode(struct omap_hwmod *oh, u8 standbymode,
343 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name);
358 * @oh: struct omap_hwmod *
366 static int _set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode, u32 *v)
376 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name);
391 * @oh: struct omap_hwmod *
400 static int _set_clockactivity(struct omap_hwmod *oh, u8 clockact, u32 *v)
410 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name);
425 * @oh: struct omap_hwmod *
431 static int _set_softreset(struct omap_hwmod *oh, u32 *v)
440 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name);
453 * @oh: struct omap_hwmod *
459 static int _clear_softreset(struct omap_hwmod *oh, u32 *v)
469 "omap_hwmod: %s: sysc_fields absent for sysconfig class\n",
483 * @oh: struct omap_hwmod * to wait on
491 static int _wait_softreset_complete(struct omap_hwmod *oh)
515 * @oh: struct omap_hwmod *
525 static int _set_dmadisable(struct omap_hwmod *oh)
535 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name);
541 pr_warn("omap_hwmod: %s: dma can be disabled only from enabled state\n", oh->name);
545 pr_debug("omap_hwmod: %s: setting DMADISABLE\n", oh->name);
558 * @oh: struct omap_hwmod *
569 static int _set_module_autoidle(struct omap_hwmod *oh, u8 autoidle,
580 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name);
595 * @oh: struct omap_hwmod *
600 static int _enable_wakeup(struct omap_hwmod *oh, u32 *v)
609 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name);
626 static struct clockdomain *_get_clkdm(struct omap_hwmod *oh)
643 * @oh: struct omap_hwmod *
654 static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
672 * @oh: struct omap_hwmod *
683 static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
761 static u32 _omap4_xlate_clkctrl(struct omap_hwmod *oh)
771 static struct clk *_lookup_clkctrl_clk(struct omap_hwmod *oh)
815 * @oh: struct omap_hwmod *
821 static int _init_main_clk(struct omap_hwmod *oh)
842 pr_warn("omap_hwmod: %s: cannot clk_get main_clk %s\n",
857 pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n",
865 * @oh: struct omap_hwmod *
870 static int _init_interface_clks(struct omap_hwmod *oh)
882 pr_warn("omap_hwmod: %s: cannot clk_get interface_clk %s\n",
904 * @oh: struct omap_hwmod *
909 static int _init_opt_clks(struct omap_hwmod *oh)
919 pr_warn("omap_hwmod: %s: cannot clk_get opt_clk %s\n",
939 static void _enable_optional_clocks(struct omap_hwmod *oh)
944 pr_debug("omap_hwmod: %s: enabling optional clocks\n", oh->name);
948 pr_debug("omap_hwmod: enable %s:%s\n", oc->role,
954 static void _disable_optional_clocks(struct omap_hwmod *oh)
959 pr_debug("omap_hwmod: %s: disabling optional clocks\n", oh->name);
963 pr_debug("omap_hwmod: disable %s:%s\n", oc->role,
971 * @oh: struct omap_hwmod *
976 static int _enable_clocks(struct omap_hwmod *oh)
980 pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name);
1002 * @oh: struct omap_hwmod *
1004 static bool _omap4_clkctrl_managed_by_clkfwk(struct omap_hwmod *oh)
1014 * @oh: struct omap_hwmod *
1016 static bool _omap4_has_clkctrl_clock(struct omap_hwmod *oh)
1030 * @oh: struct omap_hwmod *
1034 static int _disable_clocks(struct omap_hwmod *oh)
1038 pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name);
1060 * @oh: struct omap_hwmod *
1065 static void _omap4_enable_module(struct omap_hwmod *oh)
1071 pr_debug("omap_hwmod: %s: %s: %d\n",
1081 * @oh: struct omap_hwmod *
1088 static int _omap4_wait_target_disable(struct omap_hwmod *oh)
1112 * @oh: struct omap_hwmod *
1115 * to address the device, and saves it into the struct omap_hwmod.
1119 static void __init _save_mpu_port_index(struct omap_hwmod *oh)
1141 * @oh: struct omap_hwmod *
1143 * Given a pointer to a struct omap_hwmod record @oh, return a pointer
1152 static struct omap_hwmod_ocp_if *_find_mpu_rt_port(struct omap_hwmod *oh)
1162 * @oh: struct omap_hwmod *
1171 static void _enable_sysc(struct omap_hwmod *oh)
1241 * clock structures are tagged with omap_hwmod entries
1263 * @oh: struct omap_hwmod *
1270 static void _idle_sysc(struct omap_hwmod *oh)
1317 * @oh: struct omap_hwmod *
1322 static void _shutdown_sysc(struct omap_hwmod *oh)
1346 * _lookup - find an omap_hwmod by name
1347 * @name: find an omap_hwmod by name
1349 * Return a pointer to an omap_hwmod by name, or NULL if not found.
1351 static struct omap_hwmod *_lookup(const char *name)
1353 struct omap_hwmod *oh, *temp_oh;
1368 * _init_clkdm - look up a clockdomain name, store pointer in omap_hwmod
1369 * @oh: struct omap_hwmod *
1371 * Convert a clockdomain name stored in a struct omap_hwmod into a
1372 * clockdomain pointer, and save it into the struct omap_hwmod.
1375 static int _init_clkdm(struct omap_hwmod *oh)
1378 pr_debug("omap_hwmod: %s: missing clockdomain\n", oh->name);
1384 pr_warn("omap_hwmod: %s: could not associate to clkdm %s\n",
1389 pr_debug("omap_hwmod: %s: associated to clkdm %s\n",
1398 * @oh: struct omap_hwmod *
1405 static int _init_clocks(struct omap_hwmod *oh, struct device_node *np)
1412 pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name);
1424 pr_warn("omap_hwmod: %s: cannot _init_clocks\n", oh->name);
1431 * @oh: struct omap_hwmod *
1438 static int _lookup_hardreset(struct omap_hwmod *oh, const char *name,
1448 pr_debug("omap_hwmod: %s: %s: %s: rst %d st %d\n",
1462 * @oh: struct omap_hwmod *
1472 static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
1495 * @oh: struct omap_hwmod *
1505 static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1529 WARN(1, "omap_hwmod: %s: could not enable clockdomain %s: %d\n",
1546 pr_warn("omap_hwmod: %s: failed to hardreset\n", oh->name);
1564 * @oh: struct omap_hwmod *
1573 static int _read_hardreset(struct omap_hwmod *oh, const char *name)
1593 * @oh: struct omap_hwmod *
1601 static bool _are_all_hardreset_lines_asserted(struct omap_hwmod *oh)
1621 * @oh: struct omap_hwmod *
1629 static bool _are_any_hardreset_lines_asserted(struct omap_hwmod *oh)
1643 * @oh: struct omap_hwmod *
1648 static int _omap4_disable_module(struct omap_hwmod *oh)
1663 pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__);
1670 pr_warn("omap_hwmod: %s: _wait_target_disable failed\n",
1677 * _ocp_softreset - reset an omap_hwmod via the OCP_SYSCONFIG bit
1678 * @oh: struct omap_hwmod *
1680 * Resets an omap_hwmod @oh via the OCP_SYSCONFIG bit. hwmod must be
1692 static int _ocp_softreset(struct omap_hwmod *oh)
1704 pr_warn("omap_hwmod: %s: reset can only be entered from enabled state\n",
1713 pr_debug("omap_hwmod: %s: resetting via OCP SOFTRESET\n", oh->name);
1727 pr_warn("omap_hwmod: %s: softreset failed (waited %d usec)\n",
1732 pr_debug("omap_hwmod: %s: softreset in %d usec\n", oh->name, c);
1754 * _reset - reset an omap_hwmod
1755 * @oh: struct omap_hwmod *
1757 * Resets an omap_hwmod @oh. If the module has a custom reset
1786 static int _reset(struct omap_hwmod *oh)
1790 pr_debug("omap_hwmod: %s: resetting\n", oh->name);
1830 static void _omap4_update_context_lost(struct omap_hwmod *oh)
1852 static int _omap4_get_context_lost(struct omap_hwmod *oh)
1858 * _enable - enable an omap_hwmod
1859 * @oh: struct omap_hwmod *
1861 * Enables an omap_hwmod @oh such that the MPU can access the hwmod's
1865 static int _enable(struct omap_hwmod *oh)
1869 pr_debug("omap_hwmod: %s: enabling\n", oh->name);
1883 WARN(1, "omap_hwmod: %s: enabled state can only be entered from initialized, idle, or disabled state\n",
1911 WARN(1, "omap_hwmod: %s: could not enable clockdomain %s: %d\n",
1944 pr_err("omap_hwmod: %s: _wait_target_ready failed: %d\n",
1955 * _idle - idle an omap_hwmod
1956 * @oh: struct omap_hwmod *
1958 * Idles an omap_hwmod @oh. This should be called once the hwmod has
1962 static int _idle(struct omap_hwmod *oh)
1969 pr_debug("omap_hwmod: %s: idling\n", oh->name);
1975 WARN(1, "omap_hwmod: %s: idle state can only be entered from enabled state\n",
2015 * _shutdown - shutdown an omap_hwmod
2016 * @oh: struct omap_hwmod *
2018 * Shut down an omap_hwmod @oh. This should be called when the driver
2023 static int _shutdown(struct omap_hwmod *oh)
2033 WARN(1, "omap_hwmod: %s: disabled state can only be entered from idle, or enabled state\n",
2038 pr_debug("omap_hwmod: %s: disabling\n", oh->name);
2081 struct omap_hwmod *oh)
2096 pr_debug("omap_hwmod: dt %pOFn[%i] uses hwmod %s\n",
2108 * @oh: struct omap_hwmod *
2117 struct omap_hwmod *oh,
2152 * @oh: struct omap_hwmod *
2163 static void omap_hwmod_fix_mpu_rt_idx(struct omap_hwmod *oh,
2182 * @oh: struct omap_hwmod *
2191 int omap_hwmod_parse_module_range(struct omap_hwmod *oh,
2239 pr_debug("omap_hwmod: %s %pOFn at 0x%llx size 0x%llx\n",
2257 * @oh: struct omap_hwmod * to locate the virtual address
2272 static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data,
2293 pr_err("omap_hwmod: %s: no dt node\n", oh->name);
2306 pr_err("omap_hwmod: %s: Missing dt reg%i for %pOF\n",
2311 pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
2318 static void __init parse_module_flags(struct omap_hwmod *oh,
2331 * @oh: struct omap_hwmod *
2342 static int __init _init(struct omap_hwmod *oh, void *data)
2357 pr_debug("omap_hwmod: %s missing dt data\n", oh->name);
2359 pr_warn("omap_hwmod: %s using broken dt data from %pOFn\n",
2364 WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",
2371 WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name);
2391 * @oh: struct omap_hwmod *
2397 static void _setup_iclk_autoidle(struct omap_hwmod *oh)
2425 * @oh: struct omap_hwmod *
2432 static int _setup_reset(struct omap_hwmod *oh)
2445 pr_warn("omap_hwmod: %s: cannot be enabled for reset (%d)\n",
2459 * @oh: struct omap_hwmod *
2493 static void _setup_postsetup(struct omap_hwmod *oh)
2527 * @oh: struct omap_hwmod *
2541 static int _setup(struct omap_hwmod *oh, void *data)
2577 * _register - register a struct omap_hwmod
2578 * @oh: struct omap_hwmod *
2580 * Registers the omap_hwmod @oh. Returns -EEXIST if an omap_hwmod
2582 * omap_hwmod is in the wrong state, if @oh is NULL, if the
2583 * omap_hwmod's class field is NULL; if the omap_hwmod is missing a
2584 * name, or if the omap_hwmod's class is missing a name; or 0 upon
2593 static int _register(struct omap_hwmod *oh)
2599 pr_debug("omap_hwmod: %s: registering\n", oh->name);
2634 pr_debug("omap_hwmod: %s -> %s: adding link\n", oi->master->name,
2664 pr_debug("omap_hwmod: registering link from %s to %s\n",
2688 * @oh: struct omap_hwmod *
2695 static int _omap2xxx_3xxx_wait_target_ready(struct omap_hwmod *oh)
2715 * @oh: struct omap_hwmod *
2722 static int _omap4_wait_target_ready(struct omap_hwmod *oh)
2748 * @oh: struct omap_hwmod * to assert hardreset
2757 static int _omap2_assert_hardreset(struct omap_hwmod *oh,
2766 * @oh: struct omap_hwmod * to deassert hardreset
2775 static int _omap2_deassert_hardreset(struct omap_hwmod *oh,
2784 * @oh: struct omap_hwmod * to test hardreset
2794 static int _omap2_is_hardreset_asserted(struct omap_hwmod *oh,
2803 * @oh: struct omap_hwmod * to assert hardreset
2813 static int _omap4_assert_hardreset(struct omap_hwmod *oh,
2827 * @oh: struct omap_hwmod * to deassert hardreset
2837 static int _omap4_deassert_hardreset(struct omap_hwmod *oh,
2844 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n",
2856 * @oh: struct omap_hwmod * to test hardreset
2866 static int _omap4_is_hardreset_asserted(struct omap_hwmod *oh,
2881 * @oh: struct omap_hwmod * to disable control for
2887 static int _omap4_disable_direct_prcm(struct omap_hwmod *oh)
2899 * @oh: struct omap_hwmod * to deassert hardreset
2909 static int _am33xx_deassert_hardreset(struct omap_hwmod *oh,
2921 u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs)
2929 void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs)
2939 * @oh: struct omap_hwmod *
2946 int omap_hwmod_softreset(struct omap_hwmod *oh)
2970 * omap_hwmod_lookup - look up a registered omap_hwmod by name
2971 * @name: name of the omap_hwmod to look up
2973 * Given a @name of an omap_hwmod, return a pointer to the registered
2974 * struct omap_hwmod *, or NULL upon error.
2976 struct omap_hwmod *omap_hwmod_lookup(const char *name)
2978 struct omap_hwmod *oh;
2989 * omap_hwmod_for_each - call function for each registered omap_hwmod
2993 * Call @fn for each registered omap_hwmod, passing @data to each
3000 int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
3003 struct omap_hwmod *temp_oh;
3046 "omap_hwmod: _register_link(%s -> %s) returned %d\n",
3063 static void __init _ensure_mpu_hwmod_is_setup(struct omap_hwmod *oh)
3066 pr_err("omap_hwmod: %s: MPU initiator hwmod %s not yet registered\n",
3080 * registered omap_hwmod. Also calls _setup() on each hwmod. Returns
3085 struct omap_hwmod *oh;
3087 pr_debug("omap_hwmod: %s: %s\n", oh_name, __func__);
3091 WARN(1, "omap_hwmod: %s: hwmod not yet registered\n", oh_name);
3157 static int omap_hwmod_init_regbits(struct device *dev, struct omap_hwmod *oh,
3356 struct omap_hwmod *oh,
3410 static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
3509 omap_hwmod_init_reset_quirk(struct device *dev, struct omap_hwmod *oh,
3528 omap_hwmod_init_reset_quirks(struct device *dev, struct omap_hwmod *oh,
3554 struct omap_hwmod *oh;
3649 struct omap_hwmod *oh;
3679 * names to struct clk pointers for each registered omap_hwmod. Also
3697 * omap_hwmod_enable - enable an omap_hwmod
3698 * @oh: struct omap_hwmod *
3700 * Enable an omap_hwmod @oh. Intended to be called by omap_device_enable().
3703 int omap_hwmod_enable(struct omap_hwmod *oh)
3719 * omap_hwmod_idle - idle an omap_hwmod
3720 * @oh: struct omap_hwmod *
3722 * Idle an omap_hwmod @oh. Intended to be called by omap_device_idle().
3725 int omap_hwmod_idle(struct omap_hwmod *oh)
3741 * omap_hwmod_shutdown - shutdown an omap_hwmod
3742 * @oh: struct omap_hwmod *
3744 * Shutdown an omap_hwmod @oh. Intended to be called by
3748 int omap_hwmod_shutdown(struct omap_hwmod *oh)
3769 * @oh: struct omap_hwmod *
3778 struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
3818 * @oh: struct omap_hwmod *
3825 void __iomem *omap_hwmod_get_mpu_rt_va(struct omap_hwmod *oh)
3847 * @oh: struct omap_hwmod *
3856 int omap_hwmod_assert_hardreset(struct omap_hwmod *oh, const char *name)
3874 * @oh: struct omap_hwmod *
3883 int omap_hwmod_deassert_hardreset(struct omap_hwmod *oh, const char *name)
3904 * For each omap_hwmod of class @classname, call @fn.
3911 int (*fn)(struct omap_hwmod *oh,
3915 struct omap_hwmod *temp_oh;
3921 pr_debug("omap_hwmod: %s: looking for modules of class %s\n",
3926 pr_debug("omap_hwmod: %s: %s: calling callback fn\n",
3935 pr_debug("omap_hwmod: %s: iterator terminated early: %d\n",
3943 * @oh: struct omap_hwmod *
3952 int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state)
3983 * @oh: struct omap_hwmod *
3992 int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh)
4051 WARN(1, "omap_hwmod: unknown SoC type\n");
4061 * @oh: struct omap_hwmod *
4066 const char *omap_hwmod_get_main_clk(struct omap_hwmod *oh)