Lines Matching +full:dt +full:- +full:node
1 // SPDX-License-Identifier: GPL-2.0-only
7 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
24 * of_dma_find_controller - Get a DMA controller in DT DMA helpers list
27 * Finds a DMA controller with matching device node and number for dma cells
37 if (ofdma->of_node == dma_spec->np) in of_dma_find_controller()
41 dma_spec->np); in of_dma_find_controller()
47 * of_dma_router_xlate - translation function for router devices
65 route_data = ofdma->of_dma_route_allocate(&dma_spec_target, ofdma); in of_dma_router_xlate()
73 chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target); in of_dma_router_xlate()
75 ofdma->dma_router->route_free(ofdma->dma_router->dev, in of_dma_router_xlate()
78 chan->router = ofdma->dma_router; in of_dma_router_xlate()
79 chan->route_data = route_data; in of_dma_router_xlate()
83 * Need to put the node back since the ofdma->of_dma_route_allocate in of_dma_router_xlate()
91 * of_dma_controller_register - Register a DMA controller to DT DMA helpers
92 * @np: device node of DMA controller
112 return -EINVAL; in of_dma_controller_register()
117 return -ENOMEM; in of_dma_controller_register()
119 ofdma->of_node = np; in of_dma_controller_register()
120 ofdma->of_dma_xlate = of_dma_xlate; in of_dma_controller_register()
121 ofdma->of_dma_data = data; in of_dma_controller_register()
125 list_add_tail(&ofdma->of_dma_controllers, &of_dma_list); in of_dma_controller_register()
133 * of_dma_controller_free - Remove a DMA controller from DT DMA helpers list
134 * @np: device node of DMA controller
145 if (ofdma->of_node == np) { in of_dma_controller_free()
146 list_del(&ofdma->of_dma_controllers); in of_dma_controller_free()
156 * of_dma_router_register - Register a DMA router to DT DMA helpers as a
158 * @np: device node of DMA router
179 return -EINVAL; in of_dma_router_register()
184 return -ENOMEM; in of_dma_router_register()
186 ofdma->of_node = np; in of_dma_router_register()
187 ofdma->of_dma_xlate = of_dma_router_xlate; in of_dma_router_register()
188 ofdma->of_dma_route_allocate = of_dma_route_allocate; in of_dma_router_register()
189 ofdma->dma_router = dma_router; in of_dma_router_register()
193 list_add_tail(&ofdma->of_dma_controllers, &of_dma_list); in of_dma_router_register()
201 * of_dma_match_channel - Check if a DMA specifier matches name
202 * @np: device node to look for DMA channels
209 * a valid pointer to the DMA specifier is found. Otherwise returns -ENODEV.
216 if (of_property_read_string_index(np, "dma-names", index, &s)) in of_dma_match_channel()
217 return -ENODEV; in of_dma_match_channel()
220 return -ENODEV; in of_dma_match_channel()
222 if (of_parse_phandle_with_args(np, "dmas", "#dma-cells", index, in of_dma_match_channel()
224 return -ENODEV; in of_dma_match_channel()
230 * of_dma_request_slave_channel - Get the DMA slave channel
231 * @np: device node to get DMA request from
243 int ret_no_channel = -ENODEV; in of_dma_request_slave_channel()
248 return ERR_PTR(-ENODEV); in of_dma_request_slave_channel()
253 return ERR_PTR(-ENODEV); in of_dma_request_slave_channel()
255 count = of_property_count_strings(np, "dma-names"); in of_dma_request_slave_channel()
257 pr_err("%s: dma-names property of node '%pOF' missing or empty\n", in of_dma_request_slave_channel()
259 return ERR_PTR(-ENODEV); in of_dma_request_slave_channel()
277 chan = ofdma->of_dma_xlate(&dma_spec, ofdma); in of_dma_request_slave_channel()
279 ret_no_channel = -EPROBE_DEFER; in of_dma_request_slave_channel()
296 * of_dma_simple_xlate - Simple DMA engine translation function
300 * A simple translation function for devices that use a 32-bit value for the
302 * Note that this translation function requires that #dma-cells is equal to 1
303 * and the argument of the dma specifier is the 32-bit filter_param. Returns
309 int count = dma_spec->args_count; in of_dma_simple_xlate()
310 struct of_dma_filter_info *info = ofdma->of_dma_data; in of_dma_simple_xlate()
312 if (!info || !info->filter_fn) in of_dma_simple_xlate()
318 return __dma_request_channel(&info->dma_cap, info->filter_fn, in of_dma_simple_xlate()
319 &dma_spec->args[0], dma_spec->np); in of_dma_simple_xlate()
324 * of_dma_xlate_by_chan_id - Translate dt property to DMA channel by channel id
330 * the #dma-cells propety of the DMA controller dt node needs to be set to 1.
339 struct dma_device *dev = ofdma->of_dma_data; in of_dma_xlate_by_chan_id()
342 if (!dev || dma_spec->args_count != 1) in of_dma_xlate_by_chan_id()
345 list_for_each_entry(chan, &dev->channels, device_node) in of_dma_xlate_by_chan_id()
346 if (chan->chan_id == dma_spec->args[0]) { in of_dma_xlate_by_chan_id()