Lines Matching +full:omap +full:- +full:sdma
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2009-2010 Nokia Corporation
13 * This code provides a consistent interface for OMAP device drivers
17 * In the medium- to long-term, this code should be implemented as a
59 dev_dbg(&od->pdev->dev, "Creating %s -> %s\n", clk_alias, clk_name); in _add_clkdev()
61 r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias); in _add_clkdev()
63 dev_dbg(&od->pdev->dev, in _add_clkdev()
79 dev_name(&od->pdev->dev)); in _add_clkdev()
81 rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), in _add_clkdev()
86 if (rc == -ENODEV || rc == -ENOMEM) in _add_clkdev()
87 dev_err(&od->pdev->dev, in _add_clkdev()
90 dev_err(&od->pdev->dev, in _add_clkdev()
96 * _add_hwmod_clocks_clkdev - Add clkdev entry for hwmod optional clocks
103 * form <dev-id=dev_name, con-id=role> if it does not exist already.
116 _add_clkdev(od, "fck", oh->main_clk); in _add_hwmod_clocks_clkdev()
118 for (i = 0; i < oh->opt_clks_cnt; i++) in _add_hwmod_clocks_clkdev()
119 _add_clkdev(od, oh->opt_clks[i].role, oh->opt_clks[i].clk); in _add_hwmod_clocks_clkdev()
124 * omap_device_build_from_dt - build an omap_device with multiple hwmods
127 * Function for building an omap_device already registered from device-tree
136 struct device_node *node = pdev->dev.of_node; in omap_device_build_from_dt()
144 dev_dbg(&pdev->dev, "No 'hwmods' to build omap_device\n"); in omap_device_build_from_dt()
145 return -ENODEV; in omap_device_build_from_dt()
148 /* SDMA still needs special handling for omap_device_build() */ in omap_device_build_from_dt()
154 /* Use ti-sysc driver instead of omap_device? */ in omap_device_build_from_dt()
157 return -ENODEV; in omap_device_build_from_dt()
161 ret = -ENOMEM; in omap_device_build_from_dt()
169 dev_err(&pdev->dev, "Cannot lookup hwmod '%s'\n", in omap_device_build_from_dt()
171 ret = -EINVAL; in omap_device_build_from_dt()
175 if (oh->flags & HWMOD_INIT_NO_IDLE) in omap_device_build_from_dt()
181 dev_err(&pdev->dev, "Cannot allocate omap_device for :%s\n", in omap_device_build_from_dt()
188 for (i = 0; i < pdev->num_resources; i++) { in omap_device_build_from_dt()
189 struct resource *r = &pdev->resource[i]; in omap_device_build_from_dt()
191 if (r->name == NULL) in omap_device_build_from_dt()
192 r->name = dev_name(&pdev->dev); in omap_device_build_from_dt()
196 dev_pm_domain_set(&pdev->dev, &omap_device_pm_domain); in omap_device_build_from_dt()
199 pm_runtime_set_active(&pdev->dev); in omap_device_build_from_dt()
208 dev_pm_domain_set(&pdev->dev, &omap_device_fail_pm_domain); in omap_device_build_from_dt()
222 if (pdev->archdata.od) in _omap_device_notifier_call()
223 omap_device_delete(pdev->archdata.od); in _omap_device_notifier_call()
227 if (od && (od->_state == OMAP_DEVICE_STATE_ENABLED)) { in _omap_device_notifier_call()
237 od->_driver_status = BUS_NOTIFY_BIND_DRIVER; in _omap_device_notifier_call()
238 if (od->_state == OMAP_DEVICE_STATE_ENABLED && in _omap_device_notifier_call()
245 if (pdev->dev.of_node) in _omap_device_notifier_call()
251 od->_driver_status = event; in _omap_device_notifier_call()
258 * _omap_device_enable_hwmods - call omap_hwmod_enable() on all hwmods
268 for (i = 0; i < od->hwmods_cnt; i++) in _omap_device_enable_hwmods()
269 ret |= omap_hwmod_enable(od->hwmods[i]); in _omap_device_enable_hwmods()
275 * _omap_device_idle_hwmods - call omap_hwmod_idle() on all hwmods
285 for (i = 0; i < od->hwmods_cnt; i++) in _omap_device_idle_hwmods()
286 ret |= omap_hwmod_idle(od->hwmods[i]); in _omap_device_idle_hwmods()
294 * omap_device_alloc - allocate an omap_device
307 int ret = -ENOMEM; in omap_device_alloc()
316 od->hwmods_cnt = oh_cnt; in omap_device_alloc()
322 od->hwmods = hwmods; in omap_device_alloc()
323 od->pdev = pdev; in omap_device_alloc()
324 pdev->archdata.od = od; in omap_device_alloc()
327 hwmods[i]->od = od; in omap_device_alloc()
336 dev_err(&pdev->dev, "omap_device: build failed (%d)\n", ret); in omap_device_alloc()
346 od->pdev->archdata.od = NULL; in omap_device_delete()
347 kfree(od->hwmods); in omap_device_delete()
381 return -ENODEV; in _od_fail_runtime_suspend()
387 return -ENODEV; in _od_fail_runtime_resume()
400 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) in _od_suspend_noirq()
408 od->flags |= OMAP_DEVICE_SUSPENDED; in _od_suspend_noirq()
420 if (od->flags & OMAP_DEVICE_SUSPENDED) { in _od_resume_noirq()
421 od->flags &= ~OMAP_DEVICE_SUSPENDED; in _od_resume_noirq()
453 * omap_device_enable - fully activate an omap_device
460 * indirectly via pm_runtime_get*(). Returns -EINVAL if called when
471 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_enable()
472 dev_warn(&pdev->dev, in omap_device_enable()
474 __func__, od->_state); in omap_device_enable()
475 return -EINVAL; in omap_device_enable()
481 od->_state = OMAP_DEVICE_STATE_ENABLED; in omap_device_enable()
487 * omap_device_idle - idle an omap_device
491 * via pm_runtime_put*(). Returns -EINVAL if the omap_device is not
502 if (od->_state != OMAP_DEVICE_STATE_ENABLED) { in omap_device_idle()
503 dev_warn(&pdev->dev, in omap_device_idle()
505 __func__, od->_state); in omap_device_idle()
506 return -EINVAL; in omap_device_idle()
512 od->_state = OMAP_DEVICE_STATE_IDLE; in omap_device_idle()
518 * omap_device_assert_hardreset - set a device's hardreset line
535 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_assert_hardreset()
536 ret = omap_hwmod_assert_hardreset(od->hwmods[i], name); in omap_device_assert_hardreset()
545 * omap_device_deassert_hardreset - release a device's hardreset line
563 for (i = 0; i < od->hwmods_cnt; i++) { in omap_device_deassert_hardreset()
564 ret = omap_hwmod_deassert_hardreset(od->hwmods[i], name); in omap_device_deassert_hardreset()
584 * omap_device_late_idle - idle devices without drivers
609 for (i = 0; i < od->hwmods_cnt; i++) in omap_device_late_idle()
610 if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE) in omap_device_late_idle()
613 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER && in omap_device_late_idle()
614 od->_driver_status != BUS_NOTIFY_BIND_DRIVER) { in omap_device_late_idle()
615 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { in omap_device_late_idle()